Files
nemo_encoder/app/models/batch.rb
Sunandar 723ad7462a edit
2017-02-10 17:25:12 +06:30

27 lines
727 B
Ruby

class Batch < ApplicationRecord
has_many :batch_line_item
def self.create_batch(date,order_ref,user_id,adult_or_child,client_id,product_category_id)
batch = Batch.new
batch.exported_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 = 0
batch.qty_success = 0
batch.qty_fail = 0
batch.user_id=user_id
batch.export_count=0
batch.client_id=client_id
batch.product_category_id=product_category_id
batch.adult_or_child=adult_or_child.upcase
if batch.save
return batch
else
return nil
end
end
end