before sync

This commit is contained in:
Zoey
2019-06-21 10:04:35 +06:30
parent 60a3655dc3
commit f21d144111
17 changed files with 229 additions and 161 deletions

View File

@@ -14,6 +14,23 @@ class SeedGenerator < ApplicationRecord
return saleOrderId
end
def self.sync_seed_generator_records(seed_generators)
if !seed_generators.nil?
seed_generators.each do |sg|
seed = SeedGenerator.find_by_model(sg['model'])
if seed.nil?
seed = SeedGenerator.new
end
seed.model = sg['model']
seed.increase_by = sg['increase_by']
seed.current = sg['current']
seed.next = sg['next']
seed.save
end
puts '....... Seed Generator sync completed! .......'
end
end
# Generate Receipt No for number order (1,2,3) Don't touch
def self.new_receipt_no
seed = SeedGenerator.find_by_model("Sale")