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

@@ -4,20 +4,21 @@ class Api::BatchesController < ApplicationController
session_token=params[:session_token]
check_member= Member.authenticate_session_token(session_token)
if !check_member.nil?
date = DateTime.now.beginning_of_day.utc.to_time.strftime("%Y-%m-%d")
created_by = params[:created_by]
order_ref = params[:order_ref]
card_qty = params[:card_qty]
date = DateTime.now.beginning_of_day.utc.to_time.strftime("%Y-%m-%d")
order_ref = params[:order_ref]
adult_or_child=params[:adult_or_child]
client_id=params[:client_id]
product_category_id=params[:product_category_id]
find_user=User.find_by_id(check_member.user_id)
created_by=find_user.name
find_client=Client.find_by_id(client_id)
if !find_client.nil?
find_product_category=ProductCategory.find_by_id(product_category_id)
if !find_product_category.nil?
user_id=check_member.user_id
batch = Batch.create_batch(created_by,date,order_ref,card_qty,user_id,adult_or_child,client_id,product_category_id)
user_id=check_member.user_id
batch = Batch.create_batch(date,order_ref,user_id,created_by,adult_or_child,client_id,product_category_id)
if !batch.nil?
@out=true,batch.id
else