check seed

This commit is contained in:
phyusin
2018-11-02 10:14:00 +06:30
parent 2a9b93cffb
commit 54d72167d7

View File

@@ -15,7 +15,7 @@ class SeedGenerator < ApplicationRecord
# Generate Receipt No for number order (1,2,3) Don't touch
def self.new_receipt_no
seed = SeedGenerator.find_by_model("Sale")
new_receipt_no = 0
new_receipt_no = 1
# if (seed.nil?)
# seed = SeedGenerator.new()
# seed.model = "Sale"
@@ -27,11 +27,12 @@ class SeedGenerator < ApplicationRecord
# seed.current = current_no
# seed.save
# end
if seed.current > 0
new_receipt_no = seed.current
else
new_receipt_no = seed.current + 1
if !seed.nil?
if seed.current > 0
new_receipt_no = seed.current
else
new_receipt_no = seed.current + 1
end
end
return new_receipt_no