diff --git a/app/controllers/api/bill_controller.rb b/app/controllers/api/bill_controller.rb index 77c188fb..4a80cfd8 100755 --- a/app/controllers/api/bill_controller.rb +++ b/app/controllers/api/bill_controller.rb @@ -2,12 +2,12 @@ class Api::BillController < Api::ApiController #Create invoice based on booking #Output and invoice - + def create @status = false @error_message = "Order ID or Booking ID is require to request for a bill." # if shift_by_terminal = ShiftSale.current_open_shift(get_cashier[0].id) - if !ShiftSale.current_shift(@shop.shop_code).nil? + if !ShiftSale.current_shift.nil? #create Bill by Booking ID table = 0 if (params[:booking_id]) diff --git a/app/controllers/api/survey_controller.rb b/app/controllers/api/survey_controller.rb index c82384ce..06ac6d01 100644 --- a/app/controllers/api/survey_controller.rb +++ b/app/controllers/api/survey_controller.rb @@ -16,7 +16,7 @@ class Api::SurveyController < Api::ApiController def create dining_facility = DiningFacility.find(params[:id]) open_cashier = Employee.where("role = 'cashier' AND token_session <> ''") - current_shift = ShiftSale.current_shift(@shop.shop_code) + current_shift = ShiftSale.current_shift current_shift_user =Employee.find_by_id(current_shift.employee_id) if open_cashier.count>0 shift_by_terminal = ShiftSale.current_open_shift(open_cashier[0]) diff --git a/app/controllers/foodcourt/surveys_controller.rb b/app/controllers/foodcourt/surveys_controller.rb index 363bc6ba..e7f4a664 100644 --- a/app/controllers/foodcourt/surveys_controller.rb +++ b/app/controllers/foodcourt/surveys_controller.rb @@ -47,7 +47,7 @@ class Foodcourt::SurveysController < BaseFoodcourtController # 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 <> '' and shop_code='#{@shop.shop_code}'") - current_shift = ShiftSale.current_shift(@shop.shop_code) + current_shift = ShiftSale.current_shift current_shift_user =Employee.find_by_id(current_user.employee_id) if open_cashier.count>0 shift_by_terminal = ShiftSale.current_open_shift(open_cashier[0]) diff --git a/app/controllers/origami/credit_payments_controller.rb b/app/controllers/origami/credit_payments_controller.rb index ecf811ba..16981a5a 100755 --- a/app/controllers/origami/credit_payments_controller.rb +++ b/app/controllers/origami/credit_payments_controller.rb @@ -47,7 +47,7 @@ class Origami::CreditPaymentsController < BaseOrigamiController def create_credit_payment arr_sale = JSON.parse(params[:data]) - if !ShiftSale.current_shift(@shop.shop_code).nil? + if !ShiftSale.current_shift.nil? if !arr_sale.nil? arr_sale.each do |arr_sale| arr_sale.each do |sale| diff --git a/app/controllers/origami/order_reservation_controller.rb b/app/controllers/origami/order_reservation_controller.rb index b20656df..54760e78 100644 --- a/app/controllers/origami/order_reservation_controller.rb +++ b/app/controllers/origami/order_reservation_controller.rb @@ -22,7 +22,7 @@ class Origami::OrderReservationController < BaseOrigamiController order_reserve = OrderReservation.find_by_transaction_ref(params[:ref_no]) if !order_reserve.nil? - if !ShiftSale.current_shift(@shop.shop_code).nil? + if !ShiftSale.current_shift.nil? if @status == "processed" if order_reserve.status == "accepted" result = OrderReservation.create_doemal_order(order_reserve,current_user) @@ -86,7 +86,7 @@ class Origami::OrderReservationController < BaseOrigamiController def send_status order_reservation = OrderReservation.find_by_transaction_ref(params[:ref_no]) if !order_reservation.nil? - if !ShiftSale.current_shift(@shop.shop_code).nil? || params[:status] == 'accepted' || (order_reservation.status == 'new' && params[:status] == 'rejected') + if !ShiftSale.current_shift.nil? || params[:status] == 'accepted' || (order_reservation.status == 'new' && params[:status] == 'rejected') response = OrderReservation.send_status_to_ordering(params[:url],params[:ref_no],params[:status],params[:waiting_time],params[:min_type],params[:reason]) else response = { status: false, message: 'No current shift open for this employee!'} diff --git a/app/controllers/origami/split_bill_controller.rb b/app/controllers/origami/split_bill_controller.rb index 80a6070f..4d57bad3 100755 --- a/app/controllers/origami/split_bill_controller.rb +++ b/app/controllers/origami/split_bill_controller.rb @@ -100,7 +100,7 @@ class Origami::SplitBillController < BaseOrigamiController end status = false - if !ShiftSale.current_shift(@shop.shop_code).nil? + if !ShiftSale.current_shift.nil? #create Bill by Booking ID table = 0 if !params[:booking_id].empty? diff --git a/app/controllers/origami/surveys_controller.rb b/app/controllers/origami/surveys_controller.rb index be8d6b1c..10b025ef 100644 --- a/app/controllers/origami/surveys_controller.rb +++ b/app/controllers/origami/surveys_controller.rb @@ -47,7 +47,7 @@ class Origami::SurveysController < BaseOrigamiController # 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 <> '' and shop_code='#{@shop.shop_code}'") - current_shift = ShiftSale.current_shift(@shop.shop_code) + current_shift = ShiftSale.current_shift current_shift_user =Employee.find_by_id(current_user.employee_id) if open_cashier.count>0 shift_by_terminal = ShiftSale.current_open_shift(open_cashier[0]) diff --git a/app/controllers/reports/shiftsale_controller.rb b/app/controllers/reports/shiftsale_controller.rb index 4e9d7f17..0c71f061 100755 --- a/app/controllers/reports/shiftsale_controller.rb +++ b/app/controllers/reports/shiftsale_controller.rb @@ -2,7 +2,7 @@ class Reports::ShiftsaleController < BaseReportController authorize_resource :class => false def index - + from, to = get_date_range_from_params @shift = '' if params[:shift_name].to_i != 0 @@ -26,7 +26,7 @@ class Reports::ShiftsaleController < BaseReportController end def show - + from, to = get_date_range_from_params @sale_data = Sale.get_by_shift_sale_by_item(from,to,Sale::SALE_STATUS_COMPLETED).where("shift_sales.shop_code='#{@shop.shop_code}'") @@ -50,7 +50,7 @@ class Reports::ShiftsaleController < BaseReportController end def print_close_receipt - + shift_id = params[:id] @shift = ShiftSale.find_by_id(shift_id) shift_obj = ShiftSale.where('id =?',shift_id)