Sha256: ce059400c7247d2b4e5314cdfd50938078b3f7b9484dd9743d7d789d8770de4a
Contents?: true
Size: 612 Bytes
Versions: 55
Compression:
Stored size: 612 Bytes
Contents
module Comee module Core class Util # This method generates document numbers with a certain prefix # and a serial suffix def self.generate_number(clz, field) clz_hash = { "PurchaseRequisition" => "PR", "PurchaseOrder" => "PO", "Invoice" => "IN", "SalesOrder" => "SO" } clazz_name = "Comee::Core::#{clz}" clazz = clazz_name.constantize last = clazz.last return "#{clz_hash[clz]}1" unless last num = last.send(field)[2..].to_i "#{clz_hash[clz]}#{num + 1}" end end end end
Version data entries
55 entries across 55 versions & 1 rubygems