add new files

This commit is contained in:
Sunandar
2017-01-24 17:45:40 +06:30
parent 2f427ae5b9
commit 2893f33a23
138 changed files with 36367 additions and 0 deletions

22
app/models/batch.rb Normal file
View File

@@ -0,0 +1,22 @@
class Batch < ApplicationRecord
has_many :batch_line_item
def self.create_batch(created_by,date,order_ref, card_qty,user_id)
batch = Batch.new
batch.created_by = created_by
batch.order_ref = order_ref
batch.date = date
batch.batch_start = true
batch.batch_start_time=DateTime.now.beginning_of_day.utc.to_time.strftime("%Y-%m-%d")
batch.qty_processing = card_qty.to_i
batch.qty_success = 0
batch.qty_fail = 0
batch.user_id=user_id
batch.export_count=0
if batch.save
return batch
else
return nil
end
end
end