equal split and order split in order tab'
This commit is contained in:
@@ -30,6 +30,33 @@ class Origami::SurveysController < BaseOrigamiController
|
||||
end
|
||||
# end
|
||||
end
|
||||
|
||||
def create_survey
|
||||
if shift_by_terminal = ShiftSale.current_open_shift(get_cashier[0].id)
|
||||
dining_facility = DiningFacility.find(params[:dining_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)
|
||||
|
||||
survey = Survey.find_by_receipt_no(params[:receipt_no])
|
||||
|
||||
if survey.nil?
|
||||
survey = Survey.new
|
||||
survey.dining_name = dining_facility.name
|
||||
survey.receipt_no = params[:receipt_no]
|
||||
survey.shift_id = shift_by_terminal.id
|
||||
survey.created_by = current_user.name
|
||||
survey.total_customer = params[:total_customer]
|
||||
survey.total_amount = params[:total_amount]
|
||||
survey.save!
|
||||
else
|
||||
survey.total_customer = params[:total_customer]
|
||||
survey.save!
|
||||
end
|
||||
render :json => {status: true}
|
||||
else
|
||||
render :json => { status: false, error_message: 'No Current Open Shift!'}
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
|
||||
Reference in New Issue
Block a user