add new field

This commit is contained in:
Sunandar
2017-02-09 18:01:50 +06:30
parent 9dc6fd3cbe
commit 07477f1a06
7 changed files with 132 additions and 91 deletions

View File

@@ -10,16 +10,22 @@ class Api::BatchesController < ApplicationController
card_qty = params[:card_qty]
adult_or_child=params[:adult_or_child]
client_id=params[:client_id]
product_category_id=params[:product_category_id]
find_client=Client.find_by_id(client_id)
if !find_client.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)
if !batch.nil?
@out=true,batch.id
else
@out=false,'Error occurs in creating batch!'
end
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)
if !batch.nil?
@out=true,batch.id
else
@out=false,'Error occurs in creating batch!'
end
else
@out=false,'Product Category does not exists!'
end
else
@out = false, "Client does not exist!"
end