change receipt no

This commit is contained in:
phyusin
2018-11-01 18:07:06 +06:30
parent 225d0ac7a8
commit 2a9b93cffb

View File

@@ -16,19 +16,25 @@ class SeedGenerator < ApplicationRecord
def self.new_receipt_no
seed = SeedGenerator.find_by_model("Sale")
new_receipt_no = 0
if (seed.nil?)
seed = SeedGenerator.new()
seed.model = "Sale"
new_receipt_no = seed.next
seed.save
# if (seed.nil?)
# seed = SeedGenerator.new()
# seed.model = "Sale"
# new_receipt_no = seed.next
# seed.save
# else
# current_no = seed.next
# seed.next = seed.next
# seed.current = current_no
# seed.save
# end
if seed.current > 0
new_receipt_no = seed.current
else
new_receipt_no = seed.current + 1
end
return seed.current
return new_receipt_no
end
# Generate for 4 digit Code