Merge branch 'master' of bitbucket.org:code2lab/sxrestaurant
This commit is contained in:
@@ -221,51 +221,54 @@ class Api::OrdersController < Api::ApiController
|
|||||||
|
|
||||||
order_item = OrderItem.find(order_items_id)
|
order_item = OrderItem.find(order_items_id)
|
||||||
before_updated_qty = order_item.qty
|
before_updated_qty = order_item.qty
|
||||||
|
if qty_weight < order_item.qty.to_f
|
||||||
|
order_item.item_order_by = current_login_employee.name
|
||||||
|
order_item.qty = qty_weight
|
||||||
|
order_item.remark = remarks
|
||||||
|
order_item.save
|
||||||
|
|
||||||
order_item.item_order_by = current_login_employee.name
|
if ENV["SERVER_MODE"] != "cloud" #no print in cloud server
|
||||||
order_item.qty = qty_weight
|
# print
|
||||||
order_item.remark = remarks
|
assigned_item = AssignedOrderItem.find_by_instance_code(order_item.item_instance_code)
|
||||||
order_item.save
|
assigned_items = AssignedOrderItem.where("item_code='" + assigned_item.item_code + "' AND " + "order_id='" + assigned_item.order_id + "'")
|
||||||
|
|
||||||
if ENV["SERVER_MODE"] != "cloud" #no print in cloud server
|
if !assigned_items.nil?
|
||||||
# print
|
assigned_items.each do |assign_item|
|
||||||
assigned_item = AssignedOrderItem.find_by_instance_code(order_item.item_instance_code)
|
# order queue stations
|
||||||
assigned_items = AssignedOrderItem.where("item_code='" + assigned_item.item_code + "' AND " + "order_id='" + assigned_item.order_id + "'")
|
oqs = assign_item.order_queue_station
|
||||||
|
|
||||||
if !assigned_items.nil?
|
printer = PrintSetting.all
|
||||||
assigned_items.each do |assign_item|
|
|
||||||
# order queue stations
|
unique_code="OrderItemPdf"
|
||||||
oqs = assign_item.order_queue_station
|
if !printer.empty?
|
||||||
|
printer.each do |printer_setting|
|
||||||
|
if printer_setting.unique_code == 'OrderItemPdf'
|
||||||
|
unique_code="OrderItemPdf"
|
||||||
|
elsif printer_setting.unique_code == 'OrderItemSlimPdf'
|
||||||
|
unique_code="OrderItemSlimPdf"
|
||||||
|
elsif printer_setting.unique_code == 'OrderSetItemPdf'
|
||||||
|
unique_code="OrderSetItemPdf"
|
||||||
|
elsif printer_setting.unique_code == 'OrderItemSlimCustomisePdf'
|
||||||
|
unique_code="OrderItemSlimCustomisePdf"
|
||||||
|
elsif printer_setting.unique_code == 'OrderItemCustomisePdf'
|
||||||
|
unique_code="OrderItemCustomisePdf"
|
||||||
|
elsif printer_setting.unique_code == 'OrderSetItemCustomisePdf'
|
||||||
|
unique_code="OrderSetItemCustomisePdf"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
printer = PrintSetting.all
|
print_settings=PrintSetting.find_by_unique_code(unique_code)
|
||||||
|
order_queue_printer= Printer::OrderQueuePrinter.new(print_settings)
|
||||||
unique_code="OrderItemPdf"
|
order_queue_printer.print_order_item(print_settings, oqs, order_item.order_id, order_items_id, print_status=" (Cancelled)", before_updated_qty )
|
||||||
if !printer.empty?
|
end
|
||||||
printer.each do |printer_setting|
|
|
||||||
if printer_setting.unique_code == 'OrderItemPdf'
|
|
||||||
unique_code="OrderItemPdf"
|
|
||||||
elsif printer_setting.unique_code == 'OrderItemSlimPdf'
|
|
||||||
unique_code="OrderItemSlimPdf"
|
|
||||||
elsif printer_setting.unique_code == 'OrderSetItemPdf'
|
|
||||||
unique_code="OrderSetItemPdf"
|
|
||||||
elsif printer_setting.unique_code == 'OrderItemSlimCustomisePdf'
|
|
||||||
unique_code="OrderItemSlimCustomisePdf"
|
|
||||||
elsif printer_setting.unique_code == 'OrderItemCustomisePdf'
|
|
||||||
unique_code="OrderItemCustomisePdf"
|
|
||||||
elsif printer_setting.unique_code == 'OrderSetItemCustomisePdf'
|
|
||||||
unique_code="OrderSetItemCustomisePdf"
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
print_settings=PrintSetting.find_by_unique_code(unique_code)
|
|
||||||
order_queue_printer= Printer::OrderQueuePrinter.new(print_settings)
|
|
||||||
order_queue_printer.print_order_item(print_settings, oqs, order_item.order_id, order_items_id, print_status=" (Cancelled)", before_updated_qty )
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
return return_json_status_with_code(200, "updated successfully!")
|
return return_json_status_with_code(200, "updated successfully!")
|
||||||
|
else
|
||||||
|
return return_json_status_with_code(304, "Quantity is over!")
|
||||||
|
end
|
||||||
else
|
else
|
||||||
return return_json_status_with_code(406, "Checkout time is over!")
|
return return_json_status_with_code(406, "Checkout time is over!")
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -15,9 +15,18 @@ class Api::SurveyController < Api::ApiController
|
|||||||
|
|
||||||
def create
|
def create
|
||||||
dining_facility = DiningFacility.find(params[:id])
|
dining_facility = DiningFacility.find(params[:id])
|
||||||
cashier_zone = CashierTerminalByZone.find_by_zone_id(dining_facility.zone_id)
|
# cashier_zone = CashierTerminalByZone.find_by_zone_id(dining_facility.zone_id)
|
||||||
shift_by_terminal = ShiftSale.find_by_cashier_terminal_id_and_shift_closed_at(cashier_zone.cashier_terminal_id,nil)
|
# shift_by_terminal = ShiftSale.find_by_cashier_terminal_id_and_shift_closed_at(cashier_zone.cashier_terminal_id,nil)
|
||||||
puts params.to_json
|
# puts params.to_json
|
||||||
|
# set cashier
|
||||||
|
open_cashier = Employee.where("role = 'cashier' AND token_session <> ''")
|
||||||
|
current_shift = ShiftSale.current_shift
|
||||||
|
if open_cashier.count>0
|
||||||
|
shift_by_terminal = ShiftSale.current_open_shift(open_cashier[0].id)
|
||||||
|
else
|
||||||
|
shift_by_terminal = ShiftSale.current_open_shift(current_shift.employee_id)
|
||||||
|
end
|
||||||
|
|
||||||
if params[:survey][:id]>0
|
if params[:survey][:id]>0
|
||||||
survey = Survey.find(params[:survey][:id])
|
survey = Survey.find(params[:survey][:id])
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -40,11 +40,24 @@ class Origami::SurveysController < BaseOrigamiController
|
|||||||
def create
|
def create
|
||||||
@type = params[:cashier_type]
|
@type = params[:cashier_type]
|
||||||
@sale_id = params[:sale_id]
|
@sale_id = params[:sale_id]
|
||||||
|
|
||||||
if params[:table_id].to_i>0
|
if params[:table_id].to_i>0
|
||||||
@dining_facility = DiningFacility.find(params[:table_id])
|
@dining_facility = DiningFacility.find(params[:table_id])
|
||||||
cashier_zone = CashierTerminalByZone.find_by_zone_id(@dining_facility.zone_id)
|
if params[:sale_id].to_i > 0
|
||||||
shift_by_terminal = ShiftSale.find_by_cashier_terminal_id_and_shift_closed_at(cashier_zone.cashier_terminal_id,nil)
|
# cashier_zone = CashierTerminalByZone.find_by_zone_id(@dining_facility.zone_id)
|
||||||
|
# shift_by_terminal = ShiftSale.find_by_cashier_terminal_id_and_shift_closed_at(cashier_zone.cashier_terminal_id,nil)
|
||||||
|
# set cashier
|
||||||
|
open_cashier = Employee.where("role = 'cashier' AND token_session <> ''")
|
||||||
|
current_shift = ShiftSale.current_shift
|
||||||
|
if open_cashier.count>0
|
||||||
|
shift_by_terminal = ShiftSale.current_open_shift(open_cashier[0].id)
|
||||||
|
else
|
||||||
|
shift_by_terminal = ShiftSale.current_open_shift(current_shift.employee_id)
|
||||||
|
end
|
||||||
|
else
|
||||||
|
sale = Sale.find(@sale_id)
|
||||||
|
shift = ShiftSale.find(sale.shift_sale_id)
|
||||||
|
shift_by_terminal = ShiftSale.find_by_cashier_terminal_id_and_shift_closed_at(shift.cashier_terminal_id,nil)
|
||||||
|
end
|
||||||
else
|
else
|
||||||
sale = Sale.find(@sale_id)
|
sale = Sale.find(@sale_id)
|
||||||
shift = ShiftSale.find(sale.shift_sale_id)
|
shift = ShiftSale.find(sale.shift_sale_id)
|
||||||
|
|||||||
Reference in New Issue
Block a user