This commit is contained in:
Sunandar
2017-02-10 10:56:47 +06:30
parent a3bd5dc1b7
commit 9931152796
7 changed files with 63 additions and 78 deletions

View File

@@ -1,14 +1,14 @@
class Batch < ApplicationRecord
has_many :batch_line_item
def self.create_batch(created_by,date,order_ref, card_qty,user_id,adult_or_child,client_id,product_category_id)
def self.create_batch(date,order_ref,user_id,created_by,adult_or_child,client_id,product_category_id)
batch = Batch.new
batch.created_by = created_by
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_processing = 0
batch.qty_success = 0
batch.qty_fail = 0
batch.user_id=user_id
@@ -16,6 +16,7 @@ class Batch < ApplicationRecord
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