From a3edbb07fd5f20eea6814566b99407e61d8945e7 Mon Sep 17 00:00:00 2001 From: Zin Moe Date: Mon, 13 Jan 2020 17:34:48 +0630 Subject: [PATCH] replace @shop and shop_details with current_shop --- app/controllers/api/call_waiters_controller.rb | 2 +- .../order_reserve/order_reservation_controller.rb | 2 +- app/controllers/api/orders_controller.rb | 2 +- app/controllers/api/payment/callback_controller.rb | 2 +- .../api/payment/mobilepayment_controller.rb | 2 +- app/controllers/api/payments_controller.rb | 2 +- app/controllers/api/sound_effect_controller.rb | 2 +- app/controllers/application_controller.rb | 2 +- app/controllers/concerns/login_verification.rb | 8 ++++---- app/controllers/foodcourt/orders_controller.rb | 2 +- app/controllers/foodcourt/payments_controller.rb | 14 +++++++------- .../foodcourt/paypar_payments_controller.rb | 2 +- app/controllers/foodcourt/shifts_controller.rb | 2 +- app/controllers/foodcourt/void_controller.rb | 2 +- .../foodcourt/waste_spoile_controller.rb | 2 +- .../inventory/inventory_definitions_controller.rb | 4 ++-- .../inventory/stock_checks_controller.rb | 6 +++--- app/controllers/origami/alipay_controller.rb | 2 +- .../origami/credit_payments_controller.rb | 2 +- app/controllers/origami/dinga_controller.rb | 2 +- app/controllers/origami/gift_voucher_controller.rb | 2 +- app/controllers/origami/home_controller.rb | 2 +- app/controllers/origami/jcb_controller.rb | 2 +- app/controllers/origami/junction_pay_controller.rb | 2 +- app/controllers/origami/master_controller.rb | 2 +- app/controllers/origami/mpu_controller.rb | 2 +- app/controllers/origami/paymal_controller.rb | 2 +- app/controllers/origami/payments_controller.rb | 14 +++++++------- .../origami/paypar_payments_controller.rb | 2 +- .../origami/redeem_payments_controller.rb | 2 +- app/controllers/origami/shifts_controller.rb | 2 +- .../origami/table_invoices_controller.rb | 2 +- app/controllers/origami/unionpay_controller.rb | 2 +- app/controllers/origami/visa_controller.rb | 2 +- app/controllers/origami/void_controller.rb | 2 +- app/controllers/origami/voucher_controller.rb | 2 +- app/controllers/origami/waste_spoile_controller.rb | 2 +- .../reports/hourly_saleitem_controller.bk.rb | 2 +- .../reports/hourly_saleitem_controller.rb | 2 +- app/controllers/reports/receipt_no_controller.rb | 2 +- app/controllers/reports/saleitem_controller.rb | 4 ++-- app/controllers/reports/shiftsale_controller.rb | 4 ++-- app/controllers/settings/menus_controller.rb | 2 +- app/controllers/settings/shops_controller.rb | 10 +++++----- app/controllers/transactions/sales_controller.rb | 2 +- app/views/layouts/_header.html.erb | 2 +- app/views/layouts/_header_foodcourt.html.erb | 2 +- app/views/layouts/login.html.erb | 2 +- 48 files changed, 72 insertions(+), 72 deletions(-) diff --git a/app/controllers/api/call_waiters_controller.rb b/app/controllers/api/call_waiters_controller.rb index dcb543b7..5861621a 100644 --- a/app/controllers/api/call_waiters_controller.rb +++ b/app/controllers/api/call_waiters_controller.rb @@ -26,7 +26,7 @@ class Api::CallWaitersController < ActionController::API unique_code = "CallWaiterPdf" print_settings = PrintSetting.find_by_unique_code(unique_code) printer = Printer::ReceiptPrinter.new(print_settings) - printer.print_call_waiter(print_settings,@table,@time,@shop) + printer.print_call_waiter(print_settings,@table,@time,current_shop) end diff --git a/app/controllers/api/order_reserve/order_reservation_controller.rb b/app/controllers/api/order_reserve/order_reservation_controller.rb index f10a00c4..e8f2a6f6 100644 --- a/app/controllers/api/order_reserve/order_reservation_controller.rb +++ b/app/controllers/api/order_reserve/order_reservation_controller.rb @@ -70,7 +70,7 @@ class Api::OrderReserve::OrderReservationController < Api::ApiController order_reservation_id, flag = OrderReservation.addOrderReservationInfo(order_reservation) if !order_reservation_id.nil? && flag - shop = @shop + shop = current_shop if !shop.nil? shop_code = shop.shop_code order_audio = DisplayImage.find_by_shop_id_and_name(shop.id, "order_audio") diff --git a/app/controllers/api/orders_controller.rb b/app/controllers/api/orders_controller.rb index af3c26e6..d10f8677 100755 --- a/app/controllers/api/orders_controller.rb +++ b/app/controllers/api/orders_controller.rb @@ -47,7 +47,7 @@ class Api::OrdersController < Api::ApiController # end # - return @shop.to_json + return current_shop.to_json end diff --git a/app/controllers/api/payment/callback_controller.rb b/app/controllers/api/payment/callback_controller.rb index 89162fc4..14cd5beb 100644 --- a/app/controllers/api/payment/callback_controller.rb +++ b/app/controllers/api/payment/callback_controller.rb @@ -10,7 +10,7 @@ class Api::Payment::CallbackController < Api::ApiController if trade_status == "PAY_SUCCESS" merch_order_id = params[:Request][:merch_order_id] - status, filename, sale_receipt_no, printer_name = Payment.pay(getCloudDomain, cash, sale_id, member_info, type, tax_type, path, latest_order_no, shop_detail, current_user, 'kbzpay', merch_order_id) + status, filename, sale_receipt_no, printer_name = Payment.pay(getCloudDomain, cash, sale_id, member_info, type, tax_type, path, latest_order_no, current_shop, current_user, 'kbzpay', merch_order_id) render json: JSON.generate({:status => status, :message => "Can't Rebate coz of Sever Error ", :filename => filename, :receipt_no => sale_receipt_no, :printer_name => printer_name}) end end diff --git a/app/controllers/api/payment/mobilepayment_controller.rb b/app/controllers/api/payment/mobilepayment_controller.rb index 0c0ca37a..41e6a706 100644 --- a/app/controllers/api/payment/mobilepayment_controller.rb +++ b/app/controllers/api/payment/mobilepayment_controller.rb @@ -15,7 +15,7 @@ class Api::Payment::MobilepaymentController < Api::ApiController saleObj = Sale.find(sale_id) sale_items = SaleItem.get_all_sale_items(sale_id) - shop_detail = @shop + shop_detail = current_shop # rounding adjustment if !path.include? ("credit_payment") diff --git a/app/controllers/api/payments_controller.rb b/app/controllers/api/payments_controller.rb index 5802af96..c04c4f49 100755 --- a/app/controllers/api/payments_controller.rb +++ b/app/controllers/api/payments_controller.rb @@ -154,7 +154,7 @@ class Api::PaymentsController < Api::ApiController other_amount = SaleItem.calculate_other_charges(sale_items) printer = Printer::ReceiptPrinter.new(print_settings) - filename, sale_receipt_no, printer_name = printer.print_receipt_bill(print_settings, false, nil, cashier_terminal,sale_items,sale,params[:card_no], item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,@shop, 'Foodcourt',current_balance,card_data,other_amount,latest_order_no,card_balance_amount,nil,transaction_ref) + filename, sale_receipt_no, printer_name = printer.print_receipt_bill(print_settings, false, nil, cashier_terminal,sale_items,sale,params[:card_no], item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,current_shop, 'Foodcourt',current_balance,card_data,other_amount,latest_order_no,card_balance_amount,nil,transaction_ref) render json: JSON.generate({:status => true, :balance_amount => card_balance_amount,:receipt_no => sale.receipt_no,:order_no => latest_order_no, :message => "Payment successful."}) else diff --git a/app/controllers/api/sound_effect_controller.rb b/app/controllers/api/sound_effect_controller.rb index fda3a71d..e6c11bed 100644 --- a/app/controllers/api/sound_effect_controller.rb +++ b/app/controllers/api/sound_effect_controller.rb @@ -2,7 +2,7 @@ class Api::SoundEffectController < Api::ApiController #sound effect / alarm api for doemal side calling def sound_effect - shop = @shop + shop = current_shop if !shop.nil? shop_code = shop.shop_code order_audio = DisplayImage.find_by_shop_id_and_name(shop.id, "order_audio") diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 001cf6d9..70d93bf6 100755 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -6,7 +6,7 @@ class ApplicationController < ActionController::Base #before_action :check_installation protect_from_forgery with: :exception - helper_method :shop_detail,:order_reservation, :bank_integration + helper_method :current_shop,:order_reservation, :bank_integration # lookup domain for db from provision # before_action :set_locale # helper_method :current_company,:current_login_employee,:current_user diff --git a/app/controllers/concerns/login_verification.rb b/app/controllers/concerns/login_verification.rb index a417c533..88b31f6d 100755 --- a/app/controllers/concerns/login_verification.rb +++ b/app/controllers/concerns/login_verification.rb @@ -2,7 +2,7 @@ module LoginVerification extend ActiveSupport::Concern included do before_action :authenticate_session_token - helper_method :current_company, :current_login_employee, :current_user, :get_cashier, :order_reservation, :bank_integration, :shop_detail + helper_method :current_company, :current_login_employee, :current_user, :get_cashier, :order_reservation, :bank_integration, :current_shop end #this is base api base controller to need to inherit. @@ -30,9 +30,9 @@ module LoginVerification end #Shop Name in Navbor - def shop_detail - @shop ||= current_shop - end + # def shop_detail + # @shop ||= current_shop + # end #check order reservation used def order_reservation diff --git a/app/controllers/foodcourt/orders_controller.rb b/app/controllers/foodcourt/orders_controller.rb index f7f30fdf..8d75e0ae 100755 --- a/app/controllers/foodcourt/orders_controller.rb +++ b/app/controllers/foodcourt/orders_controller.rb @@ -76,7 +76,7 @@ class Foodcourt::OrdersController < BaseFoodcourtController def completed customer =Customer.find_by_customer_id(params[:customer_id]) phone_number =customer.contact_no - if Order.send_message(phone_number,params[:order_id],@shop.name) + if Order.send_message(phone_number,params[:order_id],current_shop.name) booking =Booking.find(params[:booking_id]) booking.booking_status ='completed' booking.save! diff --git a/app/controllers/foodcourt/payments_controller.rb b/app/controllers/foodcourt/payments_controller.rb index 14a6dd02..c3b0d904 100755 --- a/app/controllers/foodcourt/payments_controller.rb +++ b/app/controllers/foodcourt/payments_controller.rb @@ -20,7 +20,7 @@ class Foodcourt::PaymentsController < BaseFoodcourtController #shop_detail = Shop.first # rounding adjustment if !path.include? ("credit_payment") - if @shop.is_rounding_adj + if current_shop.is_rounding_adj new_total = Sale.get_rounding_adjustment(saleObj.grand_total) rounding_adj = new_total - saleObj.grand_total saleObj.update_attributes(grand_total: new_total,old_grand_total: saleObj.grand_total,rounding_adjustment:rounding_adj) if rounding_adj > 0 @@ -154,7 +154,7 @@ class Foodcourt::PaymentsController < BaseFoodcourtController other_amount = SaleItem.calculate_other_charges(sale_items) printer = Printer::ReceiptPrinter.new(print_settings) - filename, sale_receipt_no, printer_name = printer.print_receipt_bill(print_settings, false, nil, cashier_terminal,sale_items,saleObj,account_no, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,@shop, 'Foodcourt',current_balance,card_data,other_amount,latest_order_no,card_balance_amount,nil,transaction_ref) + filename, sale_receipt_no, printer_name = printer.print_receipt_bill(print_settings, false, nil, cashier_terminal,sale_items,saleObj,account_no, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,current_shop, 'Foodcourt',current_balance,card_data,other_amount,latest_order_no,card_balance_amount,nil,transaction_ref) #end end @@ -223,7 +223,7 @@ class Foodcourt::PaymentsController < BaseFoodcourtController @pdf_view = @lookup_pdf.value end - amount = SalePayment.get_kbz_pay_amount(sale_id, current_user,@shop) + amount = SalePayment.get_kbz_pay_amount(sale_id, current_user,current_shop) @kbz_pay_amount += amount.to_f #for changable on/off @@ -270,7 +270,7 @@ class Foodcourt::PaymentsController < BaseFoodcourtController #end rounding adjustment # rounding adjustment - if @shop.is_rounding_adj + if current_shop.is_rounding_adj a = saleObj.grand_total % 25 # Modulus b = saleObj.grand_total / 25 # Division #not calculate rounding if modulus is 0 and division is even @@ -472,7 +472,7 @@ class Foodcourt::PaymentsController < BaseFoodcourtController printer = Printer::ReceiptPrinter.new(print_settings) - filename, receipt_no, cashier_printer = printer.print_receipt_bill(print_settings, false, nil, cashier_terminal,saleObj.sale_items,saleObj,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,@shop, "Re-print",current_balance,card_data,other_amount,latest_order_no,card_balance_amount,nil,transaction_ref) + filename, receipt_no, cashier_printer = printer.print_receipt_bill(print_settings, false, nil, cashier_terminal,saleObj.sale_items,saleObj,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,current_shop, "Re-print",current_balance,card_data,other_amount,latest_order_no,card_balance_amount,nil,transaction_ref) result = { :status => true, @@ -571,7 +571,7 @@ class Foodcourt::PaymentsController < BaseFoodcourtController printer = Printer::ReceiptPrinter.new(print_settings) - filename, sale_receipt_no, printer_name = printer.print_receipt_bill(print_settings, false, nil, cashier_terminal,saleObj.sale_items,saleObj,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,@shop, "FOC",nil,nil,other_amount,nil,nil,nil,nil) + filename, sale_receipt_no, printer_name = printer.print_receipt_bill(print_settings, false, nil, cashier_terminal,saleObj.sale_items,saleObj,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,current_shop, "FOC",nil,nil,other_amount,nil,nil,nil,nil) result = { :status => true, :filepath => filename, @@ -606,7 +606,7 @@ class Foodcourt::PaymentsController < BaseFoodcourtController saleObj = Sale.find(params[:sale_id]) - if @shop.is_rounding_adj + if current_shop.is_rounding_adj a = saleObj.grand_total % 25 # Modulus b = saleObj.grand_total / 25 # Division #not calculate rounding if modulus is 0 and division is even diff --git a/app/controllers/foodcourt/paypar_payments_controller.rb b/app/controllers/foodcourt/paypar_payments_controller.rb index 64fe7a6d..9317bf3d 100755 --- a/app/controllers/foodcourt/paypar_payments_controller.rb +++ b/app/controllers/foodcourt/paypar_payments_controller.rb @@ -9,7 +9,7 @@ class Foodcourt::PayparPaymentsController < BaseFoodcourtController saleObj = Sale.find(sale_id) # rounding adjustment - if @shop.is_rounding_adj + if current_shop.is_rounding_adj new_total = Sale.get_rounding_adjustment(saleObj.grand_total) rounding_adj = new_total-saleObj.grand_total saleObj.update_attributes(grand_total: new_total,old_grand_total: saleObj.grand_total,rounding_adjustment:rounding_adj) diff --git a/app/controllers/foodcourt/shifts_controller.rb b/app/controllers/foodcourt/shifts_controller.rb index e16a7374..6866217b 100755 --- a/app/controllers/foodcourt/shifts_controller.rb +++ b/app/controllers/foodcourt/shifts_controller.rb @@ -88,7 +88,7 @@ class Foodcourt::ShiftsController < BaseFoodcourtController end end end - shop_details = shop_detail + shop_details = current_shop #get tax shift_obj = ShiftSale.where('id =?',@shift.id) sale_items = '' diff --git a/app/controllers/foodcourt/void_controller.rb b/app/controllers/foodcourt/void_controller.rb index d86eb652..80154300 100755 --- a/app/controllers/foodcourt/void_controller.rb +++ b/app/controllers/foodcourt/void_controller.rb @@ -132,7 +132,7 @@ class Foodcourt::VoidController < BaseFoodcourtController discount_price_by_accounts = SaleItem.get_discount_price_by_accounts(sale.sale_items) other_amount = SaleItem.calculate_other_charges(sale.sale_items) printer = Printer::ReceiptPrinter.new(print_settings) - filename, sale_receipt_no, printer_name = printer.print_receipt_bill(print_settings, false, nil,cashier_terminal,sale.sale_items,sale,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,@shop, "VOID",current_balance,nil,other_amount,nil,nil,nil,nil) + filename, sale_receipt_no, printer_name = printer.print_receipt_bill(print_settings, false, nil,cashier_terminal,sale.sale_items,sale,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,current_shop, "VOID",current_balance,nil,other_amount,nil,nil,nil,nil) result = { :filepath => filename, :printer_model => print_settings.brand_name, diff --git a/app/controllers/foodcourt/waste_spoile_controller.rb b/app/controllers/foodcourt/waste_spoile_controller.rb index aea75d18..a4c76296 100755 --- a/app/controllers/foodcourt/waste_spoile_controller.rb +++ b/app/controllers/foodcourt/waste_spoile_controller.rb @@ -118,7 +118,7 @@ class Foodcourt::WasteSpoileController < BaseFoodcourtController discount_price_by_accounts = SaleItem.get_discount_price_by_accounts(sale.sale_items) other_amount = SaleItem.calculate_other_charges(sale.sale_items) printer = Printer::ReceiptPrinter.new(print_settings) - filename, sale_receipt_no, printer_name = printer.print_receipt_bill(print_settings, false, nil,cashier_terminal,sale.sale_items,sale,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,@shop, remark,current_balance,nil,other_amount,nil,nil,nil,nil) + filename, sale_receipt_no, printer_name = printer.print_receipt_bill(print_settings, false, nil,cashier_terminal,sale.sale_items,sale,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,current_shop, remark,current_balance,nil,other_amount,nil,nil,nil,nil) result = { :filepath => filename, :printer_model => print_settings.brand_name, diff --git a/app/controllers/inventory/inventory_definitions_controller.rb b/app/controllers/inventory/inventory_definitions_controller.rb index bd1b9bbc..d1bb0753 100755 --- a/app/controllers/inventory/inventory_definitions_controller.rb +++ b/app/controllers/inventory/inventory_definitions_controller.rb @@ -90,8 +90,8 @@ class Inventory::InventoryDefinitionsController < BaseInventoryController format.json { head :no_content } end - StockJournal.delete_stock_journal(inventory.item_code,@shop) - StockCheckItem.delete_stock_check_item(inventory.item_code,@shop) + StockJournal.delete_stock_journal(inventory.item_code,current_shop) + StockCheckItem.delete_stock_check_item(inventory.item_code,current_shop) if !inventory.nil? inventory.destroy flash[:message] = 'Inventory was successfully destroyed.' diff --git a/app/controllers/inventory/stock_checks_controller.rb b/app/controllers/inventory/stock_checks_controller.rb index b71b7bec..9493b16d 100755 --- a/app/controllers/inventory/stock_checks_controller.rb +++ b/app/controllers/inventory/stock_checks_controller.rb @@ -19,7 +19,7 @@ class Inventory::StockChecksController < BaseInventoryController item_list = JSON.parse(params[:stock_item]) reason = params[:reason] check = StockCheck.new - @check = check.create(current_user, reason, item_list,@shop) + @check = check.create(current_user, reason, item_list,current_shop) end def show @@ -33,7 +33,7 @@ class Inventory::StockChecksController < BaseInventoryController check = params[:data] stockCheck = StockCheck.find_by_id(check) stockCheck.stock_check_items.each do |item| - StockJournal.from_stock_check(item,@shop) + StockJournal.from_stock_check(item,current_shop) end end @@ -49,7 +49,7 @@ class Inventory::StockChecksController < BaseInventoryController print_settings = PrintSetting.find_by_unique_code(unique_code) if !print_settings.nil? printer = Printer::ReceiptPrinter.new(print_settings) - printer.print_stock_check_result(print_settings, stockcheck, stockcheck_items, checker.name, @shop) + printer.print_stock_check_result(print_settings, stockcheck, stockcheck_items, checker.name, current_shop) end end diff --git a/app/controllers/origami/alipay_controller.rb b/app/controllers/origami/alipay_controller.rb index 49a121ca..d6dae6df 100644 --- a/app/controllers/origami/alipay_controller.rb +++ b/app/controllers/origami/alipay_controller.rb @@ -23,7 +23,7 @@ class Origami::AlipayController < BaseOrigamiController others = 0 - if @shop.is_rounding_adj + if current_shop.is_rounding_adj new_total = Sale.get_rounding_adjustment(sale_data.grand_total) else new_total = sale_data.grand_total diff --git a/app/controllers/origami/credit_payments_controller.rb b/app/controllers/origami/credit_payments_controller.rb index 16981a5a..6c2e9e51 100755 --- a/app/controllers/origami/credit_payments_controller.rb +++ b/app/controllers/origami/credit_payments_controller.rb @@ -8,7 +8,7 @@ class Origami::CreditPaymentsController < BaseOrigamiController total = sale_data.grand_total @creditcount = 0 others = 0 - if @shop.is_rounding_adj + if current_shop.is_rounding_adj new_total = Sale.get_rounding_adjustment(sale_data.grand_total) else new_total = sale_data.grand_total diff --git a/app/controllers/origami/dinga_controller.rb b/app/controllers/origami/dinga_controller.rb index 3098377a..524aa353 100644 --- a/app/controllers/origami/dinga_controller.rb +++ b/app/controllers/origami/dinga_controller.rb @@ -6,7 +6,7 @@ class Origami::DingaController < BaseOrigamiController @membership_rebate_balance=0 @sale_data = Sale.find_by_sale_id(@sale_id) @receipt_no = @sale_data.receipt_no - if @shop.is_rounding_adj + if current_shop.is_rounding_adj new_total = Sale.get_rounding_adjustment(@sale_data.grand_total) else new_total = @sale_data.grand_total diff --git a/app/controllers/origami/gift_voucher_controller.rb b/app/controllers/origami/gift_voucher_controller.rb index dac27995..bc2ecdf0 100644 --- a/app/controllers/origami/gift_voucher_controller.rb +++ b/app/controllers/origami/gift_voucher_controller.rb @@ -17,7 +17,7 @@ class Origami::GiftVoucherController < BaseOrigamiController others = 0 - if @shop.is_rounding_adj + if current_shop.is_rounding_adj new_total = Sale.get_rounding_adjustment(sale_data.grand_total) else new_total = sale_data.grand_total diff --git a/app/controllers/origami/home_controller.rb b/app/controllers/origami/home_controller.rb index 6ea59d86..24bbd3bb 100755 --- a/app/controllers/origami/home_controller.rb +++ b/app/controllers/origami/home_controller.rb @@ -33,7 +33,7 @@ class Origami::HomeController < BaseOrigamiController @status_sale = "" @sale_array = Array.new - @shop = shop_detail + @shop = current_shop @membership = MembershipSetting::MembershipSetting @payment_methods = PaymentMethodSetting.all @dining_booking = @dining.current_bookings diff --git a/app/controllers/origami/jcb_controller.rb b/app/controllers/origami/jcb_controller.rb index 74bcdcd3..63a0a6eb 100644 --- a/app/controllers/origami/jcb_controller.rb +++ b/app/controllers/origami/jcb_controller.rb @@ -24,7 +24,7 @@ class Origami::JcbController < BaseOrigamiController others = 0 - if @shop.is_rounding_adj + if current_shop.is_rounding_adj new_total = Sale.get_rounding_adjustment(sale_data.grand_total) else new_total = sale_data.grand_total diff --git a/app/controllers/origami/junction_pay_controller.rb b/app/controllers/origami/junction_pay_controller.rb index f6a7fc78..d0819437 100644 --- a/app/controllers/origami/junction_pay_controller.rb +++ b/app/controllers/origami/junction_pay_controller.rb @@ -11,7 +11,7 @@ class Origami::JunctionPayController < BaseOrigamiController @cashier_id = current_user.emp_id @payment_method_setting_nav = PaymentMethodSetting.all - if @shop.is_rounding_adj + if current_shop.is_rounding_adj new_total = Sale.get_rounding_adjustment(sale_data.grand_total) else new_total = sale_data.grand_total diff --git a/app/controllers/origami/master_controller.rb b/app/controllers/origami/master_controller.rb index 17fe4598..f92602f6 100644 --- a/app/controllers/origami/master_controller.rb +++ b/app/controllers/origami/master_controller.rb @@ -23,7 +23,7 @@ class Origami::MasterController < BaseOrigamiController others = 0 - if @shop.is_rounding_adj + if current_shop.is_rounding_adj new_total = Sale.get_rounding_adjustment(sale_data.grand_total) else new_total = sale_data.grand_total diff --git a/app/controllers/origami/mpu_controller.rb b/app/controllers/origami/mpu_controller.rb index 89d6fe7f..c9204f67 100644 --- a/app/controllers/origami/mpu_controller.rb +++ b/app/controllers/origami/mpu_controller.rb @@ -22,7 +22,7 @@ class Origami::MpuController < BaseOrigamiController others = 0 - if @shop.is_rounding_adj && (!path.include? ("credit_payment")) + if current_shop.is_rounding_adj && (!path.include? ("credit_payment")) new_total = Sale.get_rounding_adjustment(sale_data.grand_total) else new_total = sale_data.grand_total diff --git a/app/controllers/origami/paymal_controller.rb b/app/controllers/origami/paymal_controller.rb index 419e914f..918e3945 100644 --- a/app/controllers/origami/paymal_controller.rb +++ b/app/controllers/origami/paymal_controller.rb @@ -6,7 +6,7 @@ class Origami::PaymalController < BaseOrigamiController @membership_rebate_balance=0 sale_data = Sale.find_by_sale_id(@sale_id) @receipt_no = sale_data.receipt_no - if @shop.is_rounding_adj + if current_shop.is_rounding_adj new_total = Sale.get_rounding_adjustment(sale_data.grand_total) else new_total = sale_data.grand_total diff --git a/app/controllers/origami/payments_controller.rb b/app/controllers/origami/payments_controller.rb index ead80104..7caac687 100755 --- a/app/controllers/origami/payments_controller.rb +++ b/app/controllers/origami/payments_controller.rb @@ -65,7 +65,7 @@ class Origami::PaymentsController < BaseOrigamiController end end - filename, receipt_no, cashier_printer = printer.print_receipt_bill(print_settings, status, qr, cashier_terminal, sale_items, sale_data, customer.name, item_price_by_accounts, discount_price_by_accounts, member_info, nil, @shop, "Frt", current_balance, nil, other_amount, nil, nil, nil) + filename, receipt_no, cashier_printer = printer.print_receipt_bill(print_settings, status, qr, cashier_terminal, sale_items, sale_data, customer.name, item_price_by_accounts, discount_price_by_accounts, member_info, nil, current_shop, "Frt", current_balance, nil, other_amount, nil, nil, nil) result = { :filepath => filename, @@ -202,7 +202,7 @@ class Origami::PaymentsController < BaseOrigamiController other_amount = SaleItem.calculate_other_charges(sale_items) printer = Printer::ReceiptPrinter.new(print_settings) - filename, sale_receipt_no, printer_name = printer.print_receipt_bill(print_settings, false, nil, cashier_terminal, sale_items, saleObj, customer.name, item_price_by_accounts, discount_price_by_accounts, member_info, rebate_amount, @shop, "Paid", current_balance, card_data, other_amount, latest_order_no, card_balance_amount, nil) + filename, sale_receipt_no, printer_name = printer.print_receipt_bill(print_settings, false, nil, cashier_terminal, sale_items, saleObj, customer.name, item_price_by_accounts, discount_price_by_accounts, member_info, rebate_amount, current_shop, "Paid", current_balance, card_data, other_amount, latest_order_no, card_balance_amount, nil) #end end @@ -275,7 +275,7 @@ class Origami::PaymentsController < BaseOrigamiController @pdf_view = @lookup_pdf.value end - amount = SalePayment.get_kbz_pay_amount(sale_id, current_user,@shop) + amount = SalePayment.get_kbz_pay_amount(sale_id, current_user, current_shop) @kbz_pay_amount += amount.to_f #for changable on/off @@ -322,7 +322,7 @@ class Origami::PaymentsController < BaseOrigamiController #end rounding adjustment # rounding adjustment - if @shop.is_rounding_adj + if current_shop.is_rounding_adj a = saleObj.grand_total % 25 # Modulus b = saleObj.grand_total / 25 # Division #not calculate rounding if modulus is 0 and division is even @@ -524,7 +524,7 @@ class Origami::PaymentsController < BaseOrigamiController printer = Printer::ReceiptPrinter.new(print_settings) - filename, receipt_no, cashier_printer = printer.print_receipt_bill(print_settings, false, nil, cashier_terminal,saleObj.sale_items,saleObj,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,@shop, "Re-print",current_balance,card_data,other_amount,latest_order_no,card_balance_amount,nil,transaction_ref) + filename, receipt_no, cashier_printer = printer.print_receipt_bill(print_settings, false, nil, cashier_terminal,saleObj.sale_items,saleObj,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount, current_shop, "Re-print",current_balance,card_data,other_amount,latest_order_no,card_balance_amount,nil,transaction_ref) result = { :status => true, @@ -622,7 +622,7 @@ class Origami::PaymentsController < BaseOrigamiController printer = Printer::ReceiptPrinter.new(print_settings) - filename, sale_receipt_no, printer_name = printer.print_receipt_bill(print_settings, false, nil, cashier_terminal,saleObj.sale_items,saleObj,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,@shop, "FOC",nil,nil,other_amount,nil,nil,nil,nil) + filename, sale_receipt_no, printer_name = printer.print_receipt_bill(print_settings, false, nil, cashier_terminal,saleObj.sale_items,saleObj,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,current_shop, "FOC",nil,nil,other_amount,nil,nil,nil,nil) result = { :status => true, :filepath => filename, @@ -657,7 +657,7 @@ class Origami::PaymentsController < BaseOrigamiController saleObj = Sale.find(params[:sale_id]) - if @shop.is_rounding_adj + if current_shop.is_rounding_adj a = saleObj.grand_total % 25 # Modulus b = saleObj.grand_total / 25 # Division #not calculate rounding if modulus is 0 and division is even diff --git a/app/controllers/origami/paypar_payments_controller.rb b/app/controllers/origami/paypar_payments_controller.rb index 59ddb912..8acb5ca2 100755 --- a/app/controllers/origami/paypar_payments_controller.rb +++ b/app/controllers/origami/paypar_payments_controller.rb @@ -8,7 +8,7 @@ class Origami::PayparPaymentsController < BaseOrigamiController if(Sale.exists?(sale_id)) saleObj = Sale.find(sale_id) # rounding adjustment - if @shop.is_rounding_adj + if current_shop.is_rounding_adj new_total = Sale.get_rounding_adjustment(saleObj.grand_total) rounding_adj = new_total-saleObj.grand_total saleObj.update_attributes(grand_total: new_total,old_grand_total: saleObj.grand_total,rounding_adjustment:rounding_adj) diff --git a/app/controllers/origami/redeem_payments_controller.rb b/app/controllers/origami/redeem_payments_controller.rb index 6b7802cf..2604e215 100755 --- a/app/controllers/origami/redeem_payments_controller.rb +++ b/app/controllers/origami/redeem_payments_controller.rb @@ -5,7 +5,7 @@ class Origami::RedeemPaymentsController < BaseOrigamiController @cashier_type = params[:type] @membership_rebate_balance=0 sale_data = Sale.find_by_sale_id(@sale_id) - if @shop.is_rounding_adj + if current_shop.is_rounding_adj new_total = Sale.get_rounding_adjustment(sale_data.grand_total) else new_total = sale_data.grand_total diff --git a/app/controllers/origami/shifts_controller.rb b/app/controllers/origami/shifts_controller.rb index 1eb08f72..8b7bdf91 100755 --- a/app/controllers/origami/shifts_controller.rb +++ b/app/controllers/origami/shifts_controller.rb @@ -126,7 +126,7 @@ class Origami::ShiftsController < BaseOrigamiController if find_close_cashier_print[0][1].to_i > 0 - printer.print_close_cashier(print_settings,cashier_terminal,@shift, @sale_items, @total_other_charges_info, @shop,@sale_taxes,@other_payment,@total_amount_by_account,@total_discount_by_account,@total_member_discount,@total_dinein,@total_takeway,@total_other_charges,@total_waste,@total_spoile,@total_credit_payments) + printer.print_close_cashier(print_settings,cashier_terminal,current_shop, @sale_items, @total_other_charges_info, current_shop,@sale_taxes,@other_payment,@total_amount_by_account,@total_discount_by_account,@total_member_discount,@total_dinein,@total_takeway,@total_other_charges,@total_waste,@total_spoile,@total_credit_payments) end end end diff --git a/app/controllers/origami/table_invoices_controller.rb b/app/controllers/origami/table_invoices_controller.rb index 0431ff87..7c9514c8 100755 --- a/app/controllers/origami/table_invoices_controller.rb +++ b/app/controllers/origami/table_invoices_controller.rb @@ -9,7 +9,7 @@ class Origami::TableInvoicesController < BaseOrigamiController else sale = Sale.find(booking.sale_id) # rounding adjustment - if @shop.is_rounding_adj + if current_shop.is_rounding_adj a = sale.grand_total % 25 # Modulus b = sale.grand_total / 25 # Division #not calculate rounding if modulus is 0 and division is even diff --git a/app/controllers/origami/unionpay_controller.rb b/app/controllers/origami/unionpay_controller.rb index 2f708af3..43a1f5bc 100644 --- a/app/controllers/origami/unionpay_controller.rb +++ b/app/controllers/origami/unionpay_controller.rb @@ -21,7 +21,7 @@ class Origami::UnionpayController < BaseOrigamiController total = sale_data.grand_total others = 0 - if @shop.is_rounding_adj + if current_shop.is_rounding_adj new_total = Sale.get_rounding_adjustment(sale_data.grand_total) else new_total = sale_data.grand_total diff --git a/app/controllers/origami/visa_controller.rb b/app/controllers/origami/visa_controller.rb index a2e43d5a..e77363d9 100644 --- a/app/controllers/origami/visa_controller.rb +++ b/app/controllers/origami/visa_controller.rb @@ -21,7 +21,7 @@ class Origami::VisaController < BaseOrigamiController total = sale_data.grand_total others = 0 - if @shop.is_rounding_adj + if current_shop.is_rounding_adj new_total = Sale.get_rounding_adjustment(sale_data.grand_total) else new_total = sale_data.grand_total diff --git a/app/controllers/origami/void_controller.rb b/app/controllers/origami/void_controller.rb index b4a3c1dc..55ef52f5 100755 --- a/app/controllers/origami/void_controller.rb +++ b/app/controllers/origami/void_controller.rb @@ -143,7 +143,7 @@ class Origami::VoidController < BaseOrigamiController discount_price_by_accounts = SaleItem.get_discount_price_by_accounts(sale.sale_items) other_amount = SaleItem.calculate_other_charges(sale.sale_items) printer = Printer::ReceiptPrinter.new(print_settings) - filename, sale_receipt_no, printer_name = printer.print_receipt_bill(print_settings, false, nil,cashier_terminal,sale.sale_items,sale,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,@shop, "VOID",current_balance,nil,other_amount,nil,nil,nil,nil) + filename, sale_receipt_no, printer_name = printer.print_receipt_bill(print_settings, false, nil,cashier_terminal,sale.sale_items,sale,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,current_shop, "VOID",current_balance,nil,other_amount,nil,nil,nil,nil) result = { :filepath => filename, :printer_model => print_settings.brand_name, diff --git a/app/controllers/origami/voucher_controller.rb b/app/controllers/origami/voucher_controller.rb index 196d93c4..d1aeb26b 100755 --- a/app/controllers/origami/voucher_controller.rb +++ b/app/controllers/origami/voucher_controller.rb @@ -7,7 +7,7 @@ class Origami::VoucherController < BaseOrigamiController total = sale_data.grand_total @vouchercount = 0 others = 0 - if @shop.is_rounding_adj + if current_shop.is_rounding_adj new_total = Sale.get_rounding_adjustment(sale_data.grand_total) else new_total = sale_data.grand_total diff --git a/app/controllers/origami/waste_spoile_controller.rb b/app/controllers/origami/waste_spoile_controller.rb index 4ab7b671..46b6f843 100755 --- a/app/controllers/origami/waste_spoile_controller.rb +++ b/app/controllers/origami/waste_spoile_controller.rb @@ -117,7 +117,7 @@ class Origami::WasteSpoileController < BaseOrigamiController discount_price_by_accounts = SaleItem.get_discount_price_by_accounts(sale.sale_items) other_amount = SaleItem.calculate_other_charges(sale.sale_items) printer = Printer::ReceiptPrinter.new(print_settings) - filename, sale_receipt_no, printer_name = printer.print_receipt_bill(print_settings, false, nil,cashier_terminal,sale.sale_items,sale,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,@shop, remark,current_balance,nil,other_amount,nil,nil,nil,nil) + filename, sale_receipt_no, printer_name = printer.print_receipt_bill(print_settings, false, nil,cashier_terminal,sale.sale_items,sale,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,current_shop, remark,current_balance,nil,other_amount,nil,nil,nil,nil) result = { :filepath => filename, :printer_model => print_settings.brand_name, diff --git a/app/controllers/reports/hourly_saleitem_controller.bk.rb b/app/controllers/reports/hourly_saleitem_controller.bk.rb index ab4f81ea..d2df64a0 100644 --- a/app/controllers/reports/hourly_saleitem_controller.bk.rb +++ b/app/controllers/reports/hourly_saleitem_controller.bk.rb @@ -118,7 +118,7 @@ class Reports::HourlySaleitemController < BaseReportController shift_name = employee.nil? ? sh_name : "#{sh_name} (#{employee.name})" end - shop_details = shop_detail + shop_details = current_shop account_type = params[:account_type] @type = params[:period_type] period_name = get_period_name(params[:period]) diff --git a/app/controllers/reports/hourly_saleitem_controller.rb b/app/controllers/reports/hourly_saleitem_controller.rb index 4092ee40..29bc9836 100644 --- a/app/controllers/reports/hourly_saleitem_controller.rb +++ b/app/controllers/reports/hourly_saleitem_controller.rb @@ -119,7 +119,7 @@ class Reports::HourlySaleitemController < BaseReportController shift_name = employee.nil? ? sh_name : "#{sh_name} (#{employee.name})" end - shop_details = shop_detail + shop_details = current_shop account_type = params[:account_type] @type = params[:period_type] period_name = get_period_name(params[:period]) diff --git a/app/controllers/reports/receipt_no_controller.rb b/app/controllers/reports/receipt_no_controller.rb index 03854fc1..007ab864 100755 --- a/app/controllers/reports/receipt_no_controller.rb +++ b/app/controllers/reports/receipt_no_controller.rb @@ -215,7 +215,7 @@ authorize_resource :class => false printer = Printer::ReceiptPrinter.new(print_settings) - filename, receipt_no, cashier_printer = printer.print_receipt_bill(print_settings, false, nil, cashier_terminal,saleObj.sale_items,saleObj,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,shop_detail, "Re-print",current_balance,card_data,other_amount,latest_order_no,card_balance_amount,nil,transaction_ref) + filename, receipt_no, cashier_printer = printer.print_receipt_bill(print_settings, false, nil, cashier_terminal,saleObj.sale_items,saleObj,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,current_shop, "Re-print",current_balance,card_data,other_amount,latest_order_no,card_balance_amount,nil,transaction_ref) result = { :status => true, diff --git a/app/controllers/reports/saleitem_controller.rb b/app/controllers/reports/saleitem_controller.rb index eb526b22..fe8a832a 100755 --- a/app/controllers/reports/saleitem_controller.rb +++ b/app/controllers/reports/saleitem_controller.rb @@ -129,11 +129,11 @@ class Reports::SaleitemController < BaseReportController if print_settings.nil? if !print_settings_star.nil? printer = Printer::CashierStationPrinter.new(print_settings_star) - printer.print_sale_items_report(print_settings_star, @shop, period_name, @type, account_type, from, to, shift_name, @sale_data, @total_other_charges) + printer.print_sale_items_report(print_settings_star, current_shop, period_name, @type, account_type, from, to, shift_name, @sale_data, @total_other_charges) end else printer = Printer::CashierStationPrinter.new(print_settings) - printer.print_sale_items_report(print_settings, @shop, period_name, @type, account_type, from, to, shift_name, @sale_data, @total_other_charges) + printer.print_sale_items_report(print_settings, current_shop, period_name, @type, account_type, from, to, shift_name, @sale_data, @total_other_charges) end respond_to do |format| diff --git a/app/controllers/reports/shiftsale_controller.rb b/app/controllers/reports/shiftsale_controller.rb index a5231f4d..be23d412 100755 --- a/app/controllers/reports/shiftsale_controller.rb +++ b/app/controllers/reports/shiftsale_controller.rb @@ -75,7 +75,7 @@ class Reports::ShiftsaleController < BaseReportController end - shop_details = shop_detail + shop_details = current_shop cashier_terminal = @shift.cashier_terminal @sale_taxes = Sale.get_separate_tax(shift_obj,from=nil,to=nil,type='') @total_waste = Sale.get_total_waste(shift_id).sum(:grand_total) @@ -97,7 +97,7 @@ class Reports::ShiftsaleController < BaseReportController printer = Printer::CashierStationPrinter.new(print_settings) # printer.print_close_cashier(print_settings,cashier_terminal,@shift, nil, shop_details,@sale_taxes,@other_payment,@total_amount_by_account,@total_discount_by_account,@total_member_discount,@total_dinein,@total_takeway,@total_other_charges,@total_waste,@total_spoile,@total_credit_payments) - printer.print_close_cashier(print_settings,cashier_terminal,@shift, @sale_items, @total_other_charges_info, @shop,@sale_taxes,@other_payment,@total_amount_by_account,@total_discount_by_account,@total_member_discount,@total_dinein,@total_takeway,@total_other_charges,@total_waste,@total_spoile,@total_credit_payments) + printer.print_close_cashier(print_settings,cashier_terminal,@shift, @sale_items, @total_other_charges_info, current_shops,@sale_taxes,@other_payment,@total_amount_by_account,@total_discount_by_account,@total_member_discount,@total_dinein,@total_takeway,@total_other_charges,@total_waste,@total_spoile,@total_credit_payments) respond_to do |format| format.html { redirect_to '/en/reports/shiftsale/', notice: 'Printing Completed.'} diff --git a/app/controllers/settings/menus_controller.rb b/app/controllers/settings/menus_controller.rb index 89cb4dec..186391c8 100755 --- a/app/controllers/settings/menus_controller.rb +++ b/app/controllers/settings/menus_controller.rb @@ -157,7 +157,7 @@ class Settings::MenusController < ApplicationController def import if params[:file] - status = Menu.import(params[:file], current_user.name,@shop) + status = Menu.import(params[:file], current_user.name,current_shop) redirect_to settings_menus_path, notice: status end end diff --git a/app/controllers/settings/shops_controller.rb b/app/controllers/settings/shops_controller.rb index c15cf757..82fd7e06 100644 --- a/app/controllers/settings/shops_controller.rb +++ b/app/controllers/settings/shops_controller.rb @@ -32,7 +32,7 @@ class Settings::ShopsController < ApplicationController if @settings_shop.save if params[:display_images].present? params[:display_images]['image'].each do |a| - @display_image = @settings_shop.display_images.create!(:shop_id => @shop.id, :image => a) + @display_image = @settings_shop.display_images.create!(:shop_id => current_shop.id, :image => a) end end format.html { redirect_to settings_shops_url, notice: 'Shop was successfully created.' } @@ -60,16 +60,16 @@ class Settings::ShopsController < ApplicationController File.delete(delete_path) end end - save_path = Rails.root.join("public/#{@shop.shop_code}_#{a.original_filename}") + save_path = Rails.root.join("public/#{current_shop.shop_code}_#{a.original_filename}") File.open(save_path, 'wb') do |f| f.write a.read end - audio_name = "#{@shop.shop_code}_#{a.original_filename}" + audio_name = "#{current_shop.shop_code}_#{a.original_filename}" @settings_shop.display_images.where(:name => "order_audio").destroy_all - @display_image = @settings_shop.display_images.create!(:shop_id => @shop.id, :name => "order_audio", :image => audio_name) + @display_image = @settings_shop.display_images.create!(:shop_id => current_shop.id, :name => "order_audio", :image => audio_name) else @aa = Base64.encode64(a.read) - @display_image = @settings_shop.display_images.create!(:shop_id => @shop.id, :image => "data:image/jpeg;base64,"+@aa) + @display_image = @settings_shop.display_images.create!(:shop_id => current_shop.id, :image => "data:image/jpeg;base64,"+@aa) end end end diff --git a/app/controllers/transactions/sales_controller.rb b/app/controllers/transactions/sales_controller.rb index b4072855..c76a6828 100755 --- a/app/controllers/transactions/sales_controller.rb +++ b/app/controllers/transactions/sales_controller.rb @@ -350,7 +350,7 @@ class Transactions::SalesController < ApplicationController customer= Customer.find(sale.customer_id) #shop detail - shop_details = @shop + shop_details = current_shop # get member information rebate = MembershipSetting.find_by_rebate(1) if customer.membership_id != nil && rebate diff --git a/app/views/layouts/_header.html.erb b/app/views/layouts/_header.html.erb index 8f1b3581..ab91b06f 100755 --- a/app/views/layouts/_header.html.erb +++ b/app/views/layouts/_header.html.erb @@ -37,7 +37,7 @@ <% if current_login_employee.role !='foodcourt_cashier' %> diff --git a/app/views/layouts/_header_foodcourt.html.erb b/app/views/layouts/_header_foodcourt.html.erb index e7fb9dcf..6aa822d7 100644 --- a/app/views/layouts/_header_foodcourt.html.erb +++ b/app/views/layouts/_header_foodcourt.html.erb @@ -9,7 +9,7 @@ diff --git a/app/views/layouts/login.html.erb b/app/views/layouts/login.html.erb index 08e2e6c6..5f69cca9 100755 --- a/app/views/layouts/login.html.erb +++ b/app/views/layouts/login.html.erb @@ -82,7 +82,7 @@
- <%= shop_detail.name %> + <%= current_shop.name %>