sale receipt no

This commit is contained in:
Yan
2017-11-04 15:00:18 +06:30
parent 15196053a0
commit d4e73a18d1

View File

@@ -12,16 +12,24 @@ class SeedGenerator < ApplicationRecord
return saleOrderId
end
# Generate Receipt No
# Generate Receipt No for number order (1,2,3) Don't touch
def self.new_receipt_no
# Only return seed no
cur_val, next_val = self.update_seed("sale")
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 (cur_val == 0)
cur_val, next_val = self.execute_query("sale")
end
else
current_no = seed.next
seed.next = seed.next
seed.current = current_no
seed.save
end
return cur_val
return seed.current
end
# Generate for 4 digit Code