change receipt no
This commit is contained in:
@@ -16,19 +16,25 @@ class SeedGenerator < ApplicationRecord
|
|||||||
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 = 0
|
||||||
if (seed.nil?)
|
# if (seed.nil?)
|
||||||
seed = SeedGenerator.new()
|
# seed = SeedGenerator.new()
|
||||||
seed.model = "Sale"
|
# seed.model = "Sale"
|
||||||
new_receipt_no = seed.next
|
# new_receipt_no = seed.next
|
||||||
seed.save
|
# seed.save
|
||||||
# else
|
# else
|
||||||
# current_no = seed.next
|
# current_no = seed.next
|
||||||
# seed.next = seed.next
|
# seed.next = seed.next
|
||||||
# seed.current = current_no
|
# seed.current = current_no
|
||||||
# seed.save
|
# seed.save
|
||||||
|
# end
|
||||||
|
|
||||||
|
if seed.current > 0
|
||||||
|
new_receipt_no = seed.current
|
||||||
|
else
|
||||||
|
new_receipt_no = seed.current + 1
|
||||||
end
|
end
|
||||||
|
|
||||||
return seed.current
|
return new_receipt_no
|
||||||
end
|
end
|
||||||
|
|
||||||
# Generate for 4 digit Code
|
# Generate for 4 digit Code
|
||||||
|
|||||||
Reference in New Issue
Block a user