check seed
This commit is contained in:
@@ -15,7 +15,7 @@ class SeedGenerator < ApplicationRecord
|
|||||||
# Generate Receipt No for number order (1,2,3) Don't touch
|
# Generate Receipt No for number order (1,2,3) Don't touch
|
||||||
def self.new_receipt_no
|
def self.new_receipt_no
|
||||||
seed = SeedGenerator.find_by_model("Sale")
|
seed = SeedGenerator.find_by_model("Sale")
|
||||||
new_receipt_no = 0
|
new_receipt_no = 1
|
||||||
# if (seed.nil?)
|
# if (seed.nil?)
|
||||||
# seed = SeedGenerator.new()
|
# seed = SeedGenerator.new()
|
||||||
# seed.model = "Sale"
|
# seed.model = "Sale"
|
||||||
@@ -27,11 +27,12 @@ class SeedGenerator < ApplicationRecord
|
|||||||
# seed.current = current_no
|
# seed.current = current_no
|
||||||
# seed.save
|
# seed.save
|
||||||
# end
|
# end
|
||||||
|
if !seed.nil?
|
||||||
if seed.current > 0
|
if seed.current > 0
|
||||||
new_receipt_no = seed.current
|
new_receipt_no = seed.current
|
||||||
else
|
else
|
||||||
new_receipt_no = seed.current + 1
|
new_receipt_no = seed.current + 1
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
return new_receipt_no
|
return new_receipt_no
|
||||||
|
|||||||
Reference in New Issue
Block a user