update sale order talble
This commit is contained in:
@@ -1,14 +1,20 @@
|
||||
class SeedGenerator < ApplicationRecord
|
||||
|
||||
def self.generate_id(model, prefix)
|
||||
seed = SeedGenerator.find_by_model(model)
|
||||
puts "found seed"
|
||||
puts seed
|
||||
new_receipt_no = 0
|
||||
|
||||
if (seed.nil?)
|
||||
puts "seed is null"
|
||||
seed = SeedGenerator.new()
|
||||
seed.model = model
|
||||
new_receipt_no = seed.next
|
||||
seed.save
|
||||
|
||||
else
|
||||
puts "seed is not null"
|
||||
current_no = seed.next
|
||||
seed.next = seed.next + seed.increase_by
|
||||
seed.current = current_no
|
||||
@@ -16,8 +22,10 @@ class SeedGenerator < ApplicationRecord
|
||||
end
|
||||
|
||||
padding_len = 15 - prefix.length
|
||||
|
||||
return prefix +"-"+ seed.current.to_s.to_s.rjust((14-prefix.length)+1,'0')
|
||||
puts prefix +"-"+ seed.current.to_s.to_s.rjust((14-prefix.length)+1,'0')
|
||||
puts "this is actural sale orde"
|
||||
saleOrderId = prefix +"-"+ seed.current.to_s.to_s.rjust((14-prefix.length)+1,'0')
|
||||
return saleOrderId
|
||||
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user