From 79598c0126bcd981aa7bcc25ee2580a2de7620ed Mon Sep 17 00:00:00 2001 From: Myat Zin Wai Maw Date: Tue, 10 Dec 2019 15:18:48 +0630 Subject: [PATCH] shop code --- app/controllers/api/bill_controller.rb | 4 +- .../api/call_waiters_controller.rb | 4 +- .../order_reservation_controller.rb | 2 +- app/controllers/api/orders_controller.rb | 6 +- .../api/payment/mobilepayment_controller.rb | 2 +- .../api/sound_effect_controller.rb | 2 +- app/controllers/api/survey_controller.rb | 2 +- .../concerns/login_verification.rb | 2 +- app/controllers/concerns/multi_tenancy.rb | 6 +- app/controllers/crm/customers_controller.rb | 6 +- .../crm/dining_queues_controller.rb | 2 +- .../foodcourt/addorders_controller.rb | 2 +- .../foodcourt/cash_ins_controller.rb | 2 +- .../foodcourt/cash_outs_controller.rb | 2 +- .../foodcourt/dashboard_controller.rb | 3 +- .../foodcourt/discounts_controller.rb | 2 +- .../foodcourt/food_court_controller.rb | 5 +- app/controllers/foodcourt/home_controller.rb | 2 - .../foodcourt/orders_controller.rb | 4 +- .../foodcourt/paymal_controller.rb | 2 - .../foodcourt/payments_controller.rb | 22 +++--- .../foodcourt/paypar_payments_controller.rb | 2 - .../foodcourt/shifts_controller.rb | 14 ++-- .../foodcourt/surveys_controller.rb | 2 - app/controllers/foodcourt/void_controller.rb | 10 +-- .../foodcourt/waste_spoile_controller.rb | 1 - app/controllers/home_controller.rb | 7 +- .../inventory/inventory_controller.rb | 7 -- .../inventory_definitions_controller.rb | 6 -- .../inventory/stock_check_items_controller.rb | 6 -- .../inventory/stock_checks_controller.rb | 9 +-- .../inventory/stock_journals_controller.rb | 6 -- app/controllers/oqs/edit_controller.rb | 6 -- app/controllers/oqs/home_controller.rb | 1 - .../origami/addorders_controller.rb | 5 +- app/controllers/origami/alipay_controller.rb | 8 -- .../origami/cash_ins_controller.rb | 1 - .../origami/cash_outs_controller.rb | 1 - .../origami/credit_payments_controller.rb | 4 - .../origami/customers_controller.rb | 2 - .../origami/dashboard_controller.rb | 4 +- app/controllers/origami/dinga_controller.rb | 3 - .../origami/discounts_controller.rb | 1 - .../origami/food_court_controller.rb | 10 +-- .../origami/gift_voucher_controller.rb | 11 --- app/controllers/origami/home_controller.rb | 2 - app/controllers/origami/jcb_controller.rb | 8 -- .../origami/junction_pay_controller.rb | 2 - app/controllers/origami/master_controller.rb | 10 --- .../origami/movetable_controller.rb | 2 +- app/controllers/origami/mpu_controller.rb | 10 --- .../origami/order_reservation_controller.rb | 5 -- app/controllers/origami/paymal_controller.rb | 4 - .../origami/payments_controller.rb | 60 +++++++-------- .../origami/paypar_payments_controller.rb | 2 - .../origami/pending_order_controller.rb | 4 - .../origami/quick_service_controller.rb | 2 +- .../origami/redeem_payments_controller.rb | 2 - .../origami/request_bills_controller.rb | 3 +- app/controllers/origami/rooms_controller.rb | 4 - .../origami/second_display_controller.rb | 2 +- app/controllers/origami/shifts_controller.rb | 6 +- .../origami/split_bill_controller.rb | 7 -- app/controllers/origami/surveys_controller.rb | 2 - .../origami/table_invoices_controller.rb | 3 - .../origami/unionpay_controller.rb | 11 --- app/controllers/origami/visa_controller.rb | 11 --- app/controllers/origami/void_controller.rb | 4 - app/controllers/origami/voucher_controller.rb | 3 - .../origami/waste_spoile_controller.rb | 4 - app/controllers/print_settings_controller.rb | 8 +- .../reports/commission_controller.rb | 2 - .../reports/credit_payment_controller.rb | 2 - .../reports/dailysale_controller.rb | 1 - .../reports/hourly_saleitem_controller.rb | 2 - app/controllers/reports/induty_controller.rb | 2 - .../reports/order_reservation_controller.rb | 2 - .../reports/payment_method_controller.rb | 2 - .../reports/product_sale_controller.rb | 14 +--- .../reports/receipt_no_controller.rb | 6 +- .../reports/receipt_no_detail_controller.rb | 2 - .../reports/saleitem_controller.rb | 3 - .../reports/shiftsale_controller.rb | 6 +- .../reports/staff_meal_controller.rb | 2 +- .../reports/stock_check_controller.rb | 4 +- .../reports/void_sale_controller.rb | 2 +- .../reports/waste_and_spoilage_controller.rb | 2 +- .../settings/accounts_controller.rb | 4 +- .../settings/cashier_terminals_controller.rb | 4 +- .../settings/commissioners_controller.rb | 2 +- .../settings/commissions_controller.rb | 2 +- .../settings/membership_actions_controller.rb | 2 +- .../membership_settings_controller.rb | 2 +- app/controllers/settings/menus_controller.rb | 6 +- .../order_queue_stations_controller.rb | 2 +- .../payment_method_settings_controller.rb | 2 +- .../settings/products_controller.rb | 2 +- .../settings/promotions_controller.rb | 2 +- app/controllers/settings/rooms_controller.rb | 2 +- app/controllers/settings/shops_controller.rb | 4 +- app/controllers/settings/tables_controller.rb | 2 +- .../settings/tax_profiles_controller.rb | 2 +- app/controllers/settings/zones_controller.rb | 4 +- .../transactions/credit_notes_controller.rb | 2 +- .../order_reservations_controller.rb | 2 +- .../transactions/orders_controller.rb | 2 +- .../transactions/sales_controller.rb | 4 +- .../transactions/shift_sales_controller.rb | 4 +- .../transactions/surveys_controller.rb | 2 +- app/models/printer/printer_worker.rb | 30 ++++---- .../foodcourt/orders/app_orders.html.erb | 73 ++++++++++++++++++- app/views/foodcourt/payments/show.html.erb | 1 - config/initializers/action_controller.rb | 10 +-- config/puma.rb | 22 +++--- server2.pid | 1 - 115 files changed, 247 insertions(+), 396 deletions(-) delete mode 100644 server2.pid diff --git a/app/controllers/api/bill_controller.rb b/app/controllers/api/bill_controller.rb index edd15a0d..77c188fb 100755 --- a/app/controllers/api/bill_controller.rb +++ b/app/controllers/api/bill_controller.rb @@ -7,7 +7,7 @@ class Api::BillController < Api::ApiController @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.current_shop.shop_code).nil? + if !ShiftSale.current_shift(@shop.shop_code).nil? #create Bill by Booking ID table = 0 if (params[:booking_id]) @@ -107,7 +107,7 @@ class Api::BillController < Api::ApiController # unique_code = "ReceiptBillPdf" # #shop detail - # shop_details = Shop.current_shop + # shop_details = @shop # customer= Customer.find(@sale_data.customer_id) # # get member information diff --git a/app/controllers/api/call_waiters_controller.rb b/app/controllers/api/call_waiters_controller.rb index 6548c103..dcb543b7 100644 --- a/app/controllers/api/call_waiters_controller.rb +++ b/app/controllers/api/call_waiters_controller.rb @@ -23,9 +23,7 @@ class Api::CallWaitersController < ActionController::API end ActionCable.server.broadcast "call_waiter_channel",table: @table,time:@time,from: from, shift_ids: shift_ids # get printer info - - @shop = Shop.current_shop - unique_code = "CallWaiterPdf" + 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) diff --git a/app/controllers/api/order_reserve/order_reservation_controller.rb b/app/controllers/api/order_reserve/order_reservation_controller.rb index f2981601..f10a00c4 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.current_shop + shop = @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 b754e506..68d1e32c 100755 --- a/app/controllers/api/orders_controller.rb +++ b/app/controllers/api/orders_controller.rb @@ -46,7 +46,7 @@ class Api::OrdersController < Api::ApiController @tax_profile = TaxProfile.where("lower(group_type)='cashier'") # end - @shop = Shop.current_shop + # return @shop.to_json end @@ -62,7 +62,7 @@ class Api::OrdersController < Api::ApiController def create Rails.logger.debug "Order Source - " + params[:order_source].to_s Rails.logger.debug "Table ID - " + params[:table_id].to_s - # @shop = Shop.find_by_shop_code(params[:shop_code]) + @shop = Shop.find_by_shop_code(params[:shop_code]) current_shift = ShiftSale.current_shift if current_shift.nil? @status = false @@ -109,7 +109,7 @@ class Api::OrdersController < Api::ApiController @order.new_booking = true @order.waiters = current_login_employee.name @order.employee_name = current_login_employee.name - @order.shop_code = Shop.current_shop.shop_code + @order.shop_code = @shop.shop_code @order.is_extra_time = is_extra_time @order.extra_time = extra_time diff --git a/app/controllers/api/payment/mobilepayment_controller.rb b/app/controllers/api/payment/mobilepayment_controller.rb index 24461ae9..0c0ca37a 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.current_shop + shop_detail = @shop # rounding adjustment if !path.include? ("credit_payment") diff --git a/app/controllers/api/sound_effect_controller.rb b/app/controllers/api/sound_effect_controller.rb index f3126ca2..fda3a71d 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.current_shop + shop = @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/survey_controller.rb b/app/controllers/api/survey_controller.rb index 2f2da0e2..c82384ce 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.current_shop.shop_code) + current_shift = ShiftSale.current_shift(@shop.shop_code) 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/concerns/login_verification.rb b/app/controllers/concerns/login_verification.rb index 3b714cc9..1e3a61bf 100755 --- a/app/controllers/concerns/login_verification.rb +++ b/app/controllers/concerns/login_verification.rb @@ -18,7 +18,7 @@ module LoginVerification def current_shop begin - return Shop.current_shop + return @shop rescue return nil end diff --git a/app/controllers/concerns/multi_tenancy.rb b/app/controllers/concerns/multi_tenancy.rb index 5009e094..d5efb2a2 100644 --- a/app/controllers/concerns/multi_tenancy.rb +++ b/app/controllers/concerns/multi_tenancy.rb @@ -11,10 +11,10 @@ module MultiTenancy def find_shop_by_subdomain_or_frist if request.subdomain.present? shop_code = request.subdomain.partition('-').last - shop = Shop.find_by(shop_code: shop_code) + @shop = Shop.find_by(shop_code: shop_code) else - shop = Shop.first + @shop = Shop.first end - set_current_tenant(shop) + set_current_tenant(@shop) end end diff --git a/app/controllers/crm/customers_controller.rb b/app/controllers/crm/customers_controller.rb index 6d7783fa..9cd67dde 100644 --- a/app/controllers/crm/customers_controller.rb +++ b/app/controllers/crm/customers_controller.rb @@ -38,7 +38,7 @@ class Crm::CustomersController < BaseCrmController @crm_customers.membership_type = response["customer_data"]["member_group_id"] @crm_customers.customer_type = "Dinein" @crm_customers.tax_profiles = ["1", "2"] - @crm_customers.shop_code = Shop.current_shop.shop_code + @crm_customers.shop_code = @shop.shop_code @crm_customers.save @crm_customers = Customer.search(filter) flash[:member_notice]='Customer was successfully created.' @@ -130,7 +130,7 @@ class Crm::CustomersController < BaseCrmController params[:type] = nil params[:customer_id] = params[:id] - @credit_sales = SalePayment.get_credit_sales(params,Shop.current_shop.shop_code) + @credit_sales = SalePayment.get_credit_sales(params,@shop.shop_code) #get customer amount @customer = Customer.find(params[:id]) @@ -255,7 +255,7 @@ class Crm::CustomersController < BaseCrmController if @checked_contact.nil? respond_to do |format| @crm_customers = Customer.new(customer_params) - @crm_customers.shop_code = Shop.current_shop.shop_code + @crm_customers.shop_code = @shop.shop_code if @crm_customers.save # update tax profile customer = Customer.find(@crm_customers.customer_id) diff --git a/app/controllers/crm/dining_queues_controller.rb b/app/controllers/crm/dining_queues_controller.rb index 3eb6622e..da0fe6fa 100755 --- a/app/controllers/crm/dining_queues_controller.rb +++ b/app/controllers/crm/dining_queues_controller.rb @@ -40,7 +40,7 @@ class Crm::DiningQueuesController < BaseCrmController # POST /crm/dining_queues.json def create @dining_queue = DiningQueue.new(dining_queue_params) - @dining_queue.shop_code = Shop.current_shop.shop_code + @dining_queue.shop_code = @shop.shop_code respond_to do |format| if @dining_queue.save diff --git a/app/controllers/foodcourt/addorders_controller.rb b/app/controllers/foodcourt/addorders_controller.rb index 2ebea143..2af43923 100755 --- a/app/controllers/foodcourt/addorders_controller.rb +++ b/app/controllers/foodcourt/addorders_controller.rb @@ -135,7 +135,7 @@ class Foodcourt::AddordersController < BaseFoodcourtController @order.new_booking = true @order.waiters = current_login_employee.name @order.employee_name = current_login_employee.name - @order.shop_code = Shop.current_shop.shop_code + @order.shop_code = @shop.shop_code @order.is_extra_time = is_extra_time @order.extra_time = extra_time diff --git a/app/controllers/foodcourt/cash_ins_controller.rb b/app/controllers/foodcourt/cash_ins_controller.rb index 000dc420..8700b01f 100755 --- a/app/controllers/foodcourt/cash_ins_controller.rb +++ b/app/controllers/foodcourt/cash_ins_controller.rb @@ -15,7 +15,7 @@ class Foodcourt::CashInsController < BaseFoodcourtController p_jour.cash_in(reference, remark, amount, payment_method, payment_method_reference, current_user) shift = ShiftSale.current_open_shift(current_user) - current_shift = ShiftSale.current_shift(Shop.current_shop.shop_code) + current_shift = ShiftSale.current_shift(@shop.shop_code) # set cashier if shift != nil shift = shift diff --git a/app/controllers/foodcourt/cash_outs_controller.rb b/app/controllers/foodcourt/cash_outs_controller.rb index 1dbf62d2..0ac91af5 100755 --- a/app/controllers/foodcourt/cash_outs_controller.rb +++ b/app/controllers/foodcourt/cash_outs_controller.rb @@ -10,7 +10,7 @@ class Foodcourt::CashOutsController < BaseFoodcourtController p_jour.cash_out(reference, remark, amount, current_user) shift = ShiftSale.current_open_shift(current_user) - current_shift = ShiftSale.current_shift(Shop.current_shop.shop_code) + current_shift = ShiftSale.current_shift(@shop.shop_code) # set cashier if shift != nil diff --git a/app/controllers/foodcourt/dashboard_controller.rb b/app/controllers/foodcourt/dashboard_controller.rb index de47ecf4..6857eab1 100644 --- a/app/controllers/foodcourt/dashboard_controller.rb +++ b/app/controllers/foodcourt/dashboard_controller.rb @@ -6,7 +6,6 @@ class Foodcourt::DashboardController < BaseFoodcourtController @display_type = Lookup.find_by_lookup_type("display_type") @sale_data = Array.new - @shop = Shop.current_shop @total_payment_methods = Sale.total_payment_methods(@shop,today,current_user) if !@total_payment_methods.nil? @total_payment_methods.each do |payment| @@ -109,7 +108,7 @@ def get_all_menu end def get_credit_sales - credit_sales = SalePayment.get_credit_sales(params,Shop.current_shop.shop_code) + credit_sales = SalePayment.get_credit_sales(params,@shop.shop_code) if !credit_sales.nil? result = {:status=> true, :data=> credit_sales } else diff --git a/app/controllers/foodcourt/discounts_controller.rb b/app/controllers/foodcourt/discounts_controller.rb index e2ef8fcc..5ab25a7a 100755 --- a/app/controllers/foodcourt/discounts_controller.rb +++ b/app/controllers/foodcourt/discounts_controller.rb @@ -22,7 +22,7 @@ class Foodcourt::DiscountsController < BaseFoodcourtController end @member_discount = MembershipSetting.find_by_discount(1) - @accounts = Account.where("shop_code='#{Shop.current_shop.shop_code}'") + @accounts = Account.where("shop_code='#{@shop.shop_code}'") end #discount page show from origami index with selected order diff --git a/app/controllers/foodcourt/food_court_controller.rb b/app/controllers/foodcourt/food_court_controller.rb index 84ec921c..f0a35a96 100644 --- a/app/controllers/foodcourt/food_court_controller.rb +++ b/app/controllers/foodcourt/food_court_controller.rb @@ -17,7 +17,6 @@ class Foodcourt::FoodCourtController < ApplicationController # @menus = Menu.all # @menu = MenuCategory.active.where("menu_id =#{@menus[0].id}").order('order_by asc') # end - shop = Shop.current_shop @zone = Zone.all.where("is_active= true") @customer = Customer.all @tables = Table.all.active.order('status desc') @@ -40,7 +39,7 @@ class Foodcourt::FoodCourtController < ApplicationController .joins("JOIN orders ON orders.order_id=booking_orders.order_id") .joins("JOIN order_items ON orders.order_id=order_items.order_id") .joins("JOIN customers ON orders.customer_id=customers.customer_id") - .where("orders.source='app' and bookings.shop_code='#{Shop.current_shop.shop_code}' and DATE(bookings.created_at) = '#{Date.today}' and bookings.booking_status='assign'").uniq.length + .where("orders.source='app' and bookings.shop_code='#{@shop.shop_code}' and DATE(bookings.created_at) = '#{Date.today}' and bookings.booking_status='assign'").uniq.length render "foodcourt/addorders/detail" end @@ -163,7 +162,7 @@ class Foodcourt::FoodCourtController < ApplicationController end def get_all_product() - @product = Product.where("shop_code='#{Shop.current_shop.shop_code}'") + @product = Product.where("shop_code='#{@shop.shop_code}'") end # render json for http status code diff --git a/app/controllers/foodcourt/home_controller.rb b/app/controllers/foodcourt/home_controller.rb index f894afc9..09b85b16 100755 --- a/app/controllers/foodcourt/home_controller.rb +++ b/app/controllers/foodcourt/home_controller.rb @@ -4,7 +4,6 @@ class Foodcourt::HomeController < BaseFoodcourtController def index @webview = check_mobile - @shop = Shop.current_shop @tables = Table.unscoped.all.active.where("shop_code='#{@shop.shop_code}'").order('status desc') @rooms = Room.unscoped.all.active.where("shop_code='#{@shop.shop_code}'").order('status desc') @complete = Sale.completed_sale("cashier",@shop.shop_code) @@ -20,7 +19,6 @@ class Foodcourt::HomeController < BaseFoodcourtController # get printer info @print_settings = PrintSetting.get_precision_delimiter() @webview = check_mobile - @shop = Shop.current_shop @tables = Table.unscoped.all.active.where("shop_code='#{@shop.shop_code}'").order('status desc') @rooms = Room.unscoped.all.active.where("shop_code='#{@shop.shop_code}'").order('status desc') @complete = Sale.completed_sale("cashier",@shop.shop_code) diff --git a/app/controllers/foodcourt/orders_controller.rb b/app/controllers/foodcourt/orders_controller.rb index 3b3c4075..082e9ab4 100755 --- a/app/controllers/foodcourt/orders_controller.rb +++ b/app/controllers/foodcourt/orders_controller.rb @@ -70,12 +70,12 @@ class Foodcourt::OrdersController < BaseFoodcourtController .joins("JOIN orders ON orders.order_id=booking_orders.order_id") .joins("JOIN order_items ON orders.order_id=order_items.order_id") .joins("JOIN customers ON orders.customer_id=customers.customer_id") - .where("orders.source='app' and bookings.shop_code=? and DATE(bookings.created_at)=?",Shop.current_shop.shop_code,Date.today).order("bookings.created_at desc").uniq + .where("orders.source='app' and bookings.shop_code=? and DATE(bookings.created_at)=?",@shop.shop_code,Date.today).order("bookings.created_at desc").uniq end 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.current_shop.name) + if Order.send_message(phone_number,params[:order_id],@shop.name) booking =Booking.find(params[:booking_id]) booking.booking_status ='completed' booking.save! diff --git a/app/controllers/foodcourt/paymal_controller.rb b/app/controllers/foodcourt/paymal_controller.rb index bf69c946..82deda15 100644 --- a/app/controllers/foodcourt/paymal_controller.rb +++ b/app/controllers/foodcourt/paymal_controller.rb @@ -8,8 +8,6 @@ class Foodcourt::PaymalController < BaseFoodcourtController sale_data = Sale.find_by_sale_id(@sale_id) @receipt_no = sale_data.receipt_no - @shop = Shop.current_shop - if @shop.is_rounding_adj new_total = Sale.get_rounding_adjustment(sale_data.grand_total) else diff --git a/app/controllers/foodcourt/payments_controller.rb b/app/controllers/foodcourt/payments_controller.rb index 5bfa1291..3559edc8 100755 --- a/app/controllers/foodcourt/payments_controller.rb +++ b/app/controllers/foodcourt/payments_controller.rb @@ -19,7 +19,7 @@ class Foodcourt::PaymentsController < BaseFoodcourtController #shop_detail = Shop.first # rounding adjustment if !path.include? ("credit_payment") - if Shop.current_shop.is_rounding_adj + if @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 @@ -153,7 +153,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,customer.name, item_price_by_accounts, discount_price_by_accounts, member_info,rebate_amount,Shop.current_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,customer.name, 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) #end end @@ -220,7 +220,7 @@ class Foodcourt::PaymentsController < BaseFoodcourtController @pdf_view = @lookup_pdf.value end - amount = SalePayment.get_kbz_pay_amount(sale_id, current_user,Shop.current_shop) + amount = SalePayment.get_kbz_pay_amount(sale_id, current_user,@shop) @kbz_pay_amount += amount.to_f #for changable on/off @@ -267,7 +267,7 @@ class Foodcourt::PaymentsController < BaseFoodcourtController #end rounding adjustment # rounding adjustment - if Shop.current_shop.is_rounding_adj + if @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 @@ -469,7 +469,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.current_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,@shop, "Re-print",current_balance,card_data,other_amount,latest_order_no,card_balance_amount,nil,transaction_ref) result = { :status => true, @@ -544,7 +544,7 @@ class Foodcourt::PaymentsController < BaseFoodcourtController #shop detail #shop_detail = Shop.first - printer = PrintSetting.where("shop_code='#{Shop.current_shop.shop_code}'") + printer = PrintSetting.where("shop_code='#{@shop.shop_code}'") unique_code="ReceiptBillPdf" if !printer.empty? @@ -559,7 +559,7 @@ class Foodcourt::PaymentsController < BaseFoodcourtController end end # get printer info - print_settings=PrintSetting.find_by_unique_code_and_shop_code(unique_code,Shop.current_shop.shop_code) + print_settings=PrintSetting.find_by_unique_code_and_shop_code(unique_code,@shop.shop_code) # Calculate Food and Beverage Total item_price_by_accounts = SaleItem.calculate_price_by_accounts(saleObj.sale_items) discount_price_by_accounts = SaleItem.get_discount_price_by_accounts(saleObj.sale_items) @@ -568,7 +568,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.current_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,@shop, "FOC",nil,nil,other_amount,nil,nil,nil,nil) result = { :status => true, :filepath => filename, @@ -603,7 +603,7 @@ class Foodcourt::PaymentsController < BaseFoodcourtController saleObj = Sale.find(params[:sale_id]) - if Shop.current_shop.is_rounding_adj + if @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 @@ -628,7 +628,7 @@ class Foodcourt::PaymentsController < BaseFoodcourtController else receipt_bill_a5_pdf = Lookup.collection_of("print_settings") #print_settings with name:ReceiptBillA5Pdf unique_code = "ReceiptBillPdf" - print_settings = PrintSetting.where("shop_code='#{Shop.current_shop.shop_code}'") + print_settings = PrintSetting.where("shop_code='#{@shop.shop_code}'") if !print_settings.nil? print_settings.each do |setting| if setting.unique_code == 'ReceiptBillPdf' @@ -651,7 +651,7 @@ class Foodcourt::PaymentsController < BaseFoodcourtController end end # get printer info - print_settings=PrintSetting.find_by_unique_code_and_shop_code(unique_code,Shop.current_shop.shop_code) + print_settings=PrintSetting.find_by_unique_code_and_shop_code(unique_code,@shop.shop_code) printer = Printer::ReceiptPrinter.new(print_settings) printer.print_receipt_pdf(filename,receipt_no,print_settings.print_copies,printer_name) diff --git a/app/controllers/foodcourt/paypar_payments_controller.rb b/app/controllers/foodcourt/paypar_payments_controller.rb index ab67b966..64fe7a6d 100755 --- a/app/controllers/foodcourt/paypar_payments_controller.rb +++ b/app/controllers/foodcourt/paypar_payments_controller.rb @@ -8,8 +8,6 @@ class Foodcourt::PayparPaymentsController < BaseFoodcourtController if(Sale.exists?(sale_id)) saleObj = Sale.find(sale_id) - @shop = Shop.current_shop - # rounding adjustment if @shop.is_rounding_adj new_total = Sale.get_rounding_adjustment(saleObj.grand_total) diff --git a/app/controllers/foodcourt/shifts_controller.rb b/app/controllers/foodcourt/shifts_controller.rb index 8ecff4d2..599dad1e 100755 --- a/app/controllers/foodcourt/shifts_controller.rb +++ b/app/controllers/foodcourt/shifts_controller.rb @@ -6,7 +6,7 @@ class Foodcourt::ShiftsController < BaseFoodcourtController @cashier_type = params[:type] @shift = ShiftSale.current_open_shift(current_user) #for bank integration - bank_integration = Lookup.where("shop_code='#{Shop.current_shop.shop_code}'").collection_of('bank_integration') + bank_integration = Lookup.where("shop_code='#{@shop.shop_code}'").collection_of('bank_integration') @bank_integration = 0 if !bank_integration[0].nil? @bank_integration = bank_integration[0][1] @@ -16,7 +16,7 @@ class Foodcourt::ShiftsController < BaseFoodcourtController def new @float = Lookup.where('lookup_type=?','float_value') - @terminal = CashierTerminal.available.where("shop_code='#{Shop.current_shop.shop_code}'") + @terminal = CashierTerminal.available.where("shop_code='#{@shop.shop_code}'") end def create @@ -56,7 +56,7 @@ class Foodcourt::ShiftsController < BaseFoodcourtController cashier_terminal.save #add shift_sale_id to card_settle_trans - bank_integration = Lookup.find_by_lookup_type_and_shop_code('bank_integration',Shop.current_shop.shop_code) + bank_integration = Lookup.find_by_lookup_type_and_shop_code('bank_integration',@shop.shop_code) if !bank_integration.nil? card_settle_trans = CardSettleTran.select('id').where(['shift_sale_id IS NULL and status IS NOT NULL']) @@ -74,7 +74,7 @@ class Foodcourt::ShiftsController < BaseFoodcourtController # if !close_cashier_print[0].nil? # @close_cashier_print = close_cashier_print[0][1] # end - close_cashier_pdf = Lookup.where("shop_code='#{Shop.current_shop.shop_code}'").collection_of("print_settings") + close_cashier_pdf = Lookup.where("shop_code='#{@shop.shop_code}'").collection_of("print_settings") unique_code = "CloseCashierPdf" if !close_cashier_pdf.empty? @@ -92,13 +92,13 @@ class Foodcourt::ShiftsController < BaseFoodcourtController #get tax shift_obj = ShiftSale.where('id =?',@shift.id) sale_items = '' - @lookup = Lookup.shift_sale_items_lookup_value(Shop.current_shop.shop_code) + @lookup = Lookup.shift_sale_items_lookup_value(@shop.shop_code) if @lookup.to_i == 1 @sale_items = Sale.get_shift_sale_items(@shift.id) other_charges = Sale.get_other_charges() @total_other_charges_info = other_charges.where("sales.shift_sale_id IN (?) and sale_status='completed'",@shift) end - @sale_taxes = Sale.get_separate_tax(shift_obj,from=nil,to=nil,type='').where("sales.shop_code='#{Shop.current_shop.shop_code}'") + @sale_taxes = Sale.get_separate_tax(shift_obj,from=nil,to=nil,type='').where("sales.shop_code='#{@shop.shop_code}'") @total_waste = Sale.get_total_waste(shift_id).sum(:grand_total) @total_spoile = Sale.get_total_spoile(shift_id).sum(:grand_total) #other payment details for mpu or visa like card @@ -143,7 +143,7 @@ class Foodcourt::ShiftsController < BaseFoodcourtController if @shift #get tax shift_obj = ShiftSale.where('id =?',@shift.id) - @sale_taxes = Sale.get_separate_tax(shift_obj,from=nil,to=nil,type='').where("sales.shop_code='#{Shop.current_shop.shop_code}'") + @sale_taxes = Sale.get_separate_tax(shift_obj,from=nil,to=nil,type='').where("sales.shop_code='#{@shop.shop_code}'") #other payment details for mpu or visa like card @other_payment = ShiftSale.get_by_shift_other_payment(@shift) diff --git a/app/controllers/foodcourt/surveys_controller.rb b/app/controllers/foodcourt/surveys_controller.rb index bfdd30f6..363bc6ba 100644 --- a/app/controllers/foodcourt/surveys_controller.rb +++ b/app/controllers/foodcourt/surveys_controller.rb @@ -1,6 +1,5 @@ class Foodcourt::SurveysController < BaseFoodcourtController def new - @shop = Shop.current_shop @webview = false if check_mobile @webview = true @@ -39,7 +38,6 @@ class Foodcourt::SurveysController < BaseFoodcourtController end def create - @shop = Shop.current_shop @type = params[:cashier_type] @sale_id = params[:sale_id] if params[:table_id].to_i>0 diff --git a/app/controllers/foodcourt/void_controller.rb b/app/controllers/foodcourt/void_controller.rb index cf148742..5cb18b4f 100755 --- a/app/controllers/foodcourt/void_controller.rb +++ b/app/controllers/foodcourt/void_controller.rb @@ -64,14 +64,14 @@ class Foodcourt::VoidController < BaseFoodcourtController # FOr Sale Audit action_by = current_user.name if access_code != "null" && current_user.role == "cashier" - action_by = Employee.find_by_emp_id_and_shop_code(access_code,Shop.current_shop.shop_code).name + action_by = Employee.find_by_emp_id_and_shop_code(access_code,@shop.shop_code).name end # remark = "Void Sale ID #{sale_id} | Receipt No #{sale.receipt_no} | Receipt No #{sale.receipt_no} | Table ->#{table.name}" sale_audit = SaleAudit.record_audit_for_edit(sale_id,current_user.name, action_by,remark,"SALEVOID" ) #call paymal to void - if sale.sale_payments + if sale.sale_payments.nil? membership_response =sale.paymal_payment_void end Rails.logger.debug "---------Paymal Payment Void response in VoidController" @@ -110,7 +110,7 @@ class Foodcourt::VoidController < BaseFoodcourtController current_balance = 0 end - printer = PrintSetting.where("shop_code='#{Shop.current_shop.shop_code}'") + printer = PrintSetting.where("shop_code='#{@shop.shop_code}'") unique_code="ReceiptBillPdf" if !printer.empty? @@ -125,13 +125,13 @@ class Foodcourt::VoidController < BaseFoodcourtController end end # get printer info - print_settings=PrintSetting.find_by_unique_code_and_shop_code(unique_code,Shop.current_shop.shop_code) + print_settings=PrintSetting.find_by_unique_code_and_shop_code(unique_code,@shop.shop_code) # Calculate Food and Beverage Total item_price_by_accounts = SaleItem.calculate_price_by_accounts(sale.sale_items) 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.current_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,@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 bcc29f6a..c7619636 100755 --- a/app/controllers/foodcourt/waste_spoile_controller.rb +++ b/app/controllers/foodcourt/waste_spoile_controller.rb @@ -1,6 +1,5 @@ class Foodcourt::WasteSpoileController < BaseFoodcourtController def waste_and_spoilage - @shop = Shop.current_shop sale_id = params[:sale_id] remark = params[:remark] order_source = params[:type] diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb index 772710df..1f445e6c 100755 --- a/app/controllers/home_controller.rb +++ b/app/controllers/home_controller.rb @@ -18,9 +18,8 @@ class HomeController < ApplicationController def index # @employees = Employee.all_emp_except_waiter.order("name asc") - shop = Shop.current_shop - @employees = Employee.all.where("shop_code='#{shop.shop_code}' and is_active = true").order("name asc") - @roles = Employee.where("shop_code='#{shop.shop_code}'").distinct.pluck(:role) + @employees = Employee.all.where("shop_code='#{@shop.shop_code}' and is_active = true").order("name asc") + @roles = Employee.where("shop_code='#{@shop.shop_code}'").distinct.pluck(:role) # byebug # @roles = Lookup.collection_of("employee_roles") @@ -97,8 +96,6 @@ class HomeController < ApplicationController def dashboard @from, @to = get_date_range_from_params - @shop = Shop.current_shop - @orders = Sale.receipt_date_between(@from, @to).where("payment_status = 'new' and sale_status = 'bill'") @sales = Sale.receipt_date_between(@from, @to).completed diff --git a/app/controllers/inventory/inventory_controller.rb b/app/controllers/inventory/inventory_controller.rb index fa5cffc6..e9629f4e 100755 --- a/app/controllers/inventory/inventory_controller.rb +++ b/app/controllers/inventory/inventory_controller.rb @@ -19,11 +19,4 @@ class Inventory::InventoryController < BaseInventoryController end end - #Shop Name in Navbor - helper_method :shop_detail - - def shop_detail - @shop = Shop.current_shop - end - end diff --git a/app/controllers/inventory/inventory_definitions_controller.rb b/app/controllers/inventory/inventory_definitions_controller.rb index dd21f7fc..8497553e 100755 --- a/app/controllers/inventory/inventory_definitions_controller.rb +++ b/app/controllers/inventory/inventory_definitions_controller.rb @@ -104,12 +104,6 @@ class Inventory::InventoryDefinitionsController < BaseInventoryController end end - #Shop Name in Navbor - helper_method :shop_detail - def shop_detail - @shop = Shop.current_shop - end - private # Use callbacks to share common setup or constraints between actions. def set_inventory_definition diff --git a/app/controllers/inventory/stock_check_items_controller.rb b/app/controllers/inventory/stock_check_items_controller.rb index eda096d4..e4563277 100755 --- a/app/controllers/inventory/stock_check_items_controller.rb +++ b/app/controllers/inventory/stock_check_items_controller.rb @@ -60,12 +60,6 @@ class Inventory::StockCheckItemsController < BaseInventoryController end end - #Shop Name in Navbor - helper_method :shop_detail - def shop_detail - @shop = Shop.current_shop - end - private # Use callbacks to share common setup or constraints between actions. def set_stock_check_item diff --git a/app/controllers/inventory/stock_checks_controller.rb b/app/controllers/inventory/stock_checks_controller.rb index fea1ff0c..2eb0bdae 100755 --- a/app/controllers/inventory/stock_checks_controller.rb +++ b/app/controllers/inventory/stock_checks_controller.rb @@ -34,7 +34,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.current_shop) + StockJournal.from_stock_check(item,@shop) end end @@ -46,7 +46,6 @@ class Inventory::StockChecksController < BaseInventoryController unique_code = 'StockCheckPdf' - shop_details = Shop.current_shop checker = Employee.find(stockcheck.check_by) print_settings = PrintSetting.find_by_unique_code(unique_code) if !print_settings.nil? @@ -66,12 +65,6 @@ class Inventory::StockChecksController < BaseInventoryController end end - #Shop Name in Navbor - helper_method :shop_detail - def shop_detail - @shop = Shop.current_shop - end - # before_action :set_stock_check, only: [:show, :edit, :update, :destroy] # GET /stock_checks diff --git a/app/controllers/inventory/stock_journals_controller.rb b/app/controllers/inventory/stock_journals_controller.rb index 7a99e5aa..cdba207e 100755 --- a/app/controllers/inventory/stock_journals_controller.rb +++ b/app/controllers/inventory/stock_journals_controller.rb @@ -61,12 +61,6 @@ class StockJournalsController < ApplicationController end end - #Shop Name in Navbor - helper_method :shop_detail - def shop_detail - @shop = Shop.current_shop - end - private # Use callbacks to share common setup or constraints between actions. def set_stock_journal diff --git a/app/controllers/oqs/edit_controller.rb b/app/controllers/oqs/edit_controller.rb index e2499fbb..aeda9b40 100644 --- a/app/controllers/oqs/edit_controller.rb +++ b/app/controllers/oqs/edit_controller.rb @@ -81,10 +81,4 @@ class Oqs::EditController < BaseOqsController render :json => {:status=> false, :message => "Not allowed over quantity!" } end end - - #Shop Name in Navbor - helper_method :shop_detail - def shop_detail - @shop = Shop.current_shop - end end diff --git a/app/controllers/oqs/home_controller.rb b/app/controllers/oqs/home_controller.rb index abbe2295..c89f6e0a 100755 --- a/app/controllers/oqs/home_controller.rb +++ b/app/controllers/oqs/home_controller.rb @@ -1,7 +1,6 @@ class Oqs::HomeController < BaseOqsController authorize_resource :class => false def index - @shop = Shop.current_shop # Query for OQS with delivery status false # @queue_items_details = queue_items_query(false) diff --git a/app/controllers/origami/addorders_controller.rb b/app/controllers/origami/addorders_controller.rb index f4381fb4..7ae3b0f5 100755 --- a/app/controllers/origami/addorders_controller.rb +++ b/app/controllers/origami/addorders_controller.rb @@ -6,7 +6,6 @@ class Origami::AddordersController < BaseOrigamiController if check_mobile @webview = true end - @shop = Shop.current_shop @tables = Table.all.active.where("shop_code='#{@shop.shop_code}'").order('zone_id asc').group("zone_id") @rooms = Room.all.active.where("shop_code='#{@shop.shop_code}'").order('zone_id asc').group("zone_id") @all_table = Table.all.where("shop_code='#{@shop.shop_code}'").active.order('status desc') @@ -19,7 +18,6 @@ class Origami::AddordersController < BaseOrigamiController if check_mobile @webview = true end - @shop = Shop.current_shop display_type = Lookup.find_by_lookup_type_and_shop_code("display_type",@shop.shop_code) if !display_type.nil? && display_type.value.to_i ==2 @display_type = display_type.value @@ -132,7 +130,7 @@ class Origami::AddordersController < BaseOrigamiController @order.new_booking = true @order.waiters = current_login_employee.name @order.employee_name = current_login_employee.name - @order.shop_code = Shop.current_shop.shop_code + @order.shop_code = @shop.shop_code @order.is_extra_time = is_extra_time @order.extra_time = extra_time @@ -225,7 +223,6 @@ class Origami::AddordersController < BaseOrigamiController def process_order_queue(order_id,table_id,order_source) print_status = nil cup_status = nil - @shop = Shop.current_shop #Send to background job for processing order = Order.find(order_id) sidekiq = Lookup.find_by_lookup_type_and_shop_code("sidekiq",@shop.shop_code) diff --git a/app/controllers/origami/alipay_controller.rb b/app/controllers/origami/alipay_controller.rb index 9b8014f2..49a121ca 100644 --- a/app/controllers/origami/alipay_controller.rb +++ b/app/controllers/origami/alipay_controller.rb @@ -12,7 +12,6 @@ class Origami::AlipayController < BaseOrigamiController total = 0 @alipaycount = 0 - @shop = Shop.current_shop @rounding_adj = 0 @can_alipay = 0 @member_discount = 0 @@ -66,7 +65,6 @@ class Origami::AlipayController < BaseOrigamiController if(Sale.exists?(sale_id)) saleObj = Sale.find(sale_id) - shop_details = Shop.current_shop # rounding adjustment # if shop_details.is_rounding_adj @@ -87,10 +85,4 @@ class Origami::AlipayController < BaseOrigamiController end end - #Shop Name in Navbor - - helper_method :shop_detail - def shop_detail - @shop = Shop.current_shop - end end diff --git a/app/controllers/origami/cash_ins_controller.rb b/app/controllers/origami/cash_ins_controller.rb index fa0fcfc7..ac3c0648 100755 --- a/app/controllers/origami/cash_ins_controller.rb +++ b/app/controllers/origami/cash_ins_controller.rb @@ -3,7 +3,6 @@ class Origami::CashInsController < BaseOrigamiController end def create - @shop = Shop.current_shop reference = params[:reference] remark = params[:remark] amount = params[:amount] diff --git a/app/controllers/origami/cash_outs_controller.rb b/app/controllers/origami/cash_outs_controller.rb index e714ff22..e576bfc5 100755 --- a/app/controllers/origami/cash_outs_controller.rb +++ b/app/controllers/origami/cash_outs_controller.rb @@ -3,7 +3,6 @@ class Origami::CashOutsController < BaseOrigamiController end def create - @shop = Shop.current_shop reference = params[:reference] remark = params[:remark] amount = params[:amount] diff --git a/app/controllers/origami/credit_payments_controller.rb b/app/controllers/origami/credit_payments_controller.rb index cd83a346..ecf811ba 100755 --- a/app/controllers/origami/credit_payments_controller.rb +++ b/app/controllers/origami/credit_payments_controller.rb @@ -8,8 +8,6 @@ class Origami::CreditPaymentsController < BaseOrigamiController total = sale_data.grand_total @creditcount = 0 others = 0 - - @shop = Shop.current_shop if @shop.is_rounding_adj new_total = Sale.get_rounding_adjustment(sale_data.grand_total) else @@ -33,7 +31,6 @@ class Origami::CreditPaymentsController < BaseOrigamiController if(Sale.exists?(sale_id)) saleObj = Sale.find(sale_id) - shop_details = Shop.current_shop # rounding adjustment # if shop_details.is_rounding_adj # new_total = Sale.get_rounding_adjustment(saleObj.grand_total) @@ -49,7 +46,6 @@ class Origami::CreditPaymentsController < BaseOrigamiController end def create_credit_payment - @shop = Shop.current_shop arr_sale = JSON.parse(params[:data]) if !ShiftSale.current_shift(@shop.shop_code).nil? if !arr_sale.nil? diff --git a/app/controllers/origami/customers_controller.rb b/app/controllers/origami/customers_controller.rb index 5c536815..dc21ba26 100644 --- a/app/controllers/origami/customers_controller.rb +++ b/app/controllers/origami/customers_controller.rb @@ -46,7 +46,6 @@ class Origami::CustomersController < BaseOrigamiController end def add_customer - @shop = Shop.current_shop @webview = false if check_mobile @webview = true @@ -163,7 +162,6 @@ class Origami::CustomersController < BaseOrigamiController end def send_account - @shop = Shop.current_shop amount = params[:amount] account_no = params[:account_no] receipt_no = params[:receipt_no] diff --git a/app/controllers/origami/dashboard_controller.rb b/app/controllers/origami/dashboard_controller.rb index 2a0c9a4f..004cbf3b 100644 --- a/app/controllers/origami/dashboard_controller.rb +++ b/app/controllers/origami/dashboard_controller.rb @@ -1,8 +1,6 @@ class Origami::DashboardController < BaseOrigamiController def index - - @shop = Shop.current_shop @display_type = Lookup.find_by_lookup_type("display_type") @sale_data = Array.new @@ -114,7 +112,7 @@ def get_all_menu end def get_credit_sales - credit_sales = SalePayment.get_credit_sales(params,Shop.current_shop.shop_code) + credit_sales = SalePayment.get_credit_sales(params,@shop.shop_code) if !credit_sales.nil? result = {:status=> true, :data=> credit_sales } else diff --git a/app/controllers/origami/dinga_controller.rb b/app/controllers/origami/dinga_controller.rb index eba83f26..3098377a 100644 --- a/app/controllers/origami/dinga_controller.rb +++ b/app/controllers/origami/dinga_controller.rb @@ -6,8 +6,6 @@ class Origami::DingaController < BaseOrigamiController @membership_rebate_balance=0 @sale_data = Sale.find_by_sale_id(@sale_id) @receipt_no = @sale_data.receipt_no - - @shop = Shop.current_shop if @shop.is_rounding_adj new_total = Sale.get_rounding_adjustment(@sale_data.grand_total) else @@ -79,7 +77,6 @@ def create if(Sale.exists?(sale_id)) saleObj = Sale.find(sale_id) - shop_details = Shop.current_shop # rounding adjustment # if shop_details.is_rounding_adj # new_total = Sale.get_rounding_adjustment(saleObj.grand_total) diff --git a/app/controllers/origami/discounts_controller.rb b/app/controllers/origami/discounts_controller.rb index 1de3f61c..4d9f26f8 100755 --- a/app/controllers/origami/discounts_controller.rb +++ b/app/controllers/origami/discounts_controller.rb @@ -3,7 +3,6 @@ class Origami::DiscountsController < BaseOrigamiController #discount page show from origami index with selected order def index - @shop = Shop.current_shop # get printer info @print_settings = PrintSetting.get_precision_delimiter() @webview = false diff --git a/app/controllers/origami/food_court_controller.rb b/app/controllers/origami/food_court_controller.rb index fe1ad251..16766001 100644 --- a/app/controllers/origami/food_court_controller.rb +++ b/app/controllers/origami/food_court_controller.rb @@ -17,15 +17,14 @@ class Origami::FoodCourtController < ApplicationController # @menus = Menu.all # @menu = MenuCategory.active.where("menu_id =#{@menus[0].id}").order('order_by asc') # end - shop = Shop.current_shop - @zone = Zone.all.where("shop_code='#{shop.shop_code}' and is_active= true") + @zone = Zone.all.where("shop_code='#{@shop.shop_code}' and is_active= true") @customer = Customer.all - @tables = Table.all.active.where("shop_code='#{shop.shop_code}'").order('status desc') - @rooms = Room.all.active.where("shop_code='#{shop.shop_code}'").order('status desc') + @tables = Table.all.active.where("shop_code='#{@shop.shop_code}'").order('status desc') + @rooms = Room.all.active.where("shop_code='#{@shop.shop_code}'").order('status desc') @cashier_type = "food_court" #checked quick_service only @quick_service_only = true - lookup_dine_in = Lookup.where("shop_code='#{shop.shop_code}'").collection_of('dinein_cashier') + lookup_dine_in = Lookup.where("shop_code='#{@shop.shop_code}'").collection_of('dinein_cashier') if !lookup_dine_in.empty? lookup_dine_in.each do |dine_in| if dine_in[0].downcase == "dineincashier" @@ -154,7 +153,6 @@ class Origami::FoodCourtController < ApplicationController end def get_all_product() - @shop = Shop.current_shop @product = Product..where("shop_code='#{@shop.shop_code}'") end diff --git a/app/controllers/origami/gift_voucher_controller.rb b/app/controllers/origami/gift_voucher_controller.rb index a19bcfac..dac27995 100644 --- a/app/controllers/origami/gift_voucher_controller.rb +++ b/app/controllers/origami/gift_voucher_controller.rb @@ -6,8 +6,6 @@ class Origami::GiftVoucherController < BaseOrigamiController sale_data = Sale.find_by_sale_id(@sale_id) total = 0 @gift_vouchercount = 0 - - @shop = Shop.current_shop @rounding_adj = 0 @can_gift_voucher = 0 @member_discount = 0 @@ -49,8 +47,6 @@ class Origami::GiftVoucherController < BaseOrigamiController ref_no = params[:reference_no] if(Sale.exists?(sale_id)) saleObj = Sale.find(sale_id) - - shop_details = Shop.current_shop # rounding adjustment # if shop_details.is_rounding_adj # new_total = Sale.get_rounding_adjustment(saleObj.grand_total) @@ -63,11 +59,4 @@ class Origami::GiftVoucherController < BaseOrigamiController @status, @sale = sale_payment.process_payment(saleObj, current_user, cash, "GiftVoucher",ref_no) end end - - #Shop Name in Navbor - - helper_method :shop_detail - def shop_detail - @shop = Shop.current_shop - end end diff --git a/app/controllers/origami/home_controller.rb b/app/controllers/origami/home_controller.rb index a977a2c2..b31e1a17 100755 --- a/app/controllers/origami/home_controller.rb +++ b/app/controllers/origami/home_controller.rb @@ -3,7 +3,6 @@ class Origami::HomeController < BaseOrigamiController before_action :set_dining, only: [:show] def index - @shop = Shop.current_shop @webview = check_mobile @@ -20,7 +19,6 @@ class Origami::HomeController < BaseOrigamiController # origami table detail def show - @shop = Shop.current_shop # get printer info @print_settings = PrintSetting.get_precision_delimiter() @webview = check_mobile diff --git a/app/controllers/origami/jcb_controller.rb b/app/controllers/origami/jcb_controller.rb index a26a427e..74bcdcd3 100644 --- a/app/controllers/origami/jcb_controller.rb +++ b/app/controllers/origami/jcb_controller.rb @@ -13,7 +13,6 @@ class Origami::JcbController < BaseOrigamiController total = 0 @jcbcount = 0 - @shop = Shop.current_shop @rounding_adj = 0 @can_jcb = 0 @member_discount= 0 @@ -67,7 +66,6 @@ class Origami::JcbController < BaseOrigamiController ref_no = params[:ref_no] if(Sale.exists?(sale_id)) saleObj = Sale.find(sale_id) - shop_details = Shop.current_shop # rounding adjustment # if shop_details.is_rounding_adj # new_total = Sale.get_rounding_adjustment(saleObj.grand_total) @@ -86,10 +84,4 @@ class Origami::JcbController < BaseOrigamiController end end - #Shop Name in Navbor - - helper_method :shop_detail - def shop_detail - @shop = Shop.current_shop - end end diff --git a/app/controllers/origami/junction_pay_controller.rb b/app/controllers/origami/junction_pay_controller.rb index 4c97efcc..f6a7fc78 100644 --- a/app/controllers/origami/junction_pay_controller.rb +++ b/app/controllers/origami/junction_pay_controller.rb @@ -11,7 +11,6 @@ class Origami::JunctionPayController < BaseOrigamiController @cashier_id = current_user.emp_id @payment_method_setting_nav = PaymentMethodSetting.all - @shop = Shop.current_shop if @shop.is_rounding_adj new_total = Sale.get_rounding_adjustment(sale_data.grand_total) else @@ -53,7 +52,6 @@ class Origami::JunctionPayController < BaseOrigamiController if(Sale.exists?(sale_id)) saleObj = Sale.find(sale_id) - shop_details = Shop.current_shop # rounding adjustment # if shop_details.is_rounding_adj # new_total = Sale.get_rounding_adjustment(saleObj.grand_total) diff --git a/app/controllers/origami/master_controller.rb b/app/controllers/origami/master_controller.rb index d01db13b..17fe4598 100644 --- a/app/controllers/origami/master_controller.rb +++ b/app/controllers/origami/master_controller.rb @@ -12,8 +12,6 @@ class Origami::MasterController < BaseOrigamiController end total = 0 @mastercount = 0 - - @shop = Shop.current_shop @rounding_adj = 0 @can_master = 0 @member_discount = 0 @@ -65,7 +63,6 @@ class Origami::MasterController < BaseOrigamiController if(Sale.exists?(sale_id)) saleObj = Sale.find(sale_id) - shop_details = Shop.current_shop # rounding adjustment # if shop_details.is_rounding_adj # new_total = Sale.get_rounding_adjustment(saleObj.grand_total) @@ -84,11 +81,4 @@ class Origami::MasterController < BaseOrigamiController end end - - #Shop Name in Navbor - - helper_method :shop_detail - def shop_detail - @shop = Shop.current_shop - end end diff --git a/app/controllers/origami/movetable_controller.rb b/app/controllers/origami/movetable_controller.rb index 86680c6e..1433a048 100755 --- a/app/controllers/origami/movetable_controller.rb +++ b/app/controllers/origami/movetable_controller.rb @@ -105,7 +105,7 @@ class Origami::MovetableController < BaseOrigamiController # @type = (DiningFacility.find(change_to)).type # @moved_by = @current_user.name # @date = DateTime.now - # @shop = Shop.current_shop + # @shop = @shop # unique_code = "MoveTablePdf" # pdf_no = PrintSetting.where(:unique_code => unique_code).count # #print_settings = PrintSetting.find_by_unique_code(unique_code) diff --git a/app/controllers/origami/mpu_controller.rb b/app/controllers/origami/mpu_controller.rb index 17b4dd34..89d6fe7f 100644 --- a/app/controllers/origami/mpu_controller.rb +++ b/app/controllers/origami/mpu_controller.rb @@ -11,8 +11,6 @@ class Origami::MpuController < BaseOrigamiController end total = 0 @mpucount = 0 - - @shop = Shop.current_shop @rounding_adj = 0 @can_mpu = 0 @member_discount = 0 @@ -66,7 +64,6 @@ class Origami::MpuController < BaseOrigamiController if(Sale.exists?(sale_id)) saleObj = Sale.find(sale_id) - shop_details = Shop.current_shop # rounding adjustment # if shop_details.is_rounding_adj # new_total = Sale.get_rounding_adjustment(saleObj.grand_total) @@ -84,11 +81,4 @@ class Origami::MpuController < BaseOrigamiController @status, @sale = sale_payment.process_payment(saleObj, current_user, cash, "mpu",ref_no,payment_for) end end - - #Shop Name in Navbor - - helper_method :shop_detail - def shop_detail - @shop = Shop.current_shop - end end diff --git a/app/controllers/origami/order_reservation_controller.rb b/app/controllers/origami/order_reservation_controller.rb index 79acf1c5..b20656df 100644 --- a/app/controllers/origami/order_reservation_controller.rb +++ b/app/controllers/origami/order_reservation_controller.rb @@ -4,13 +4,10 @@ class Origami::OrderReservationController < BaseOrigamiController @order = OrderReservation.latest_order #.active @count_on_order = OrderReservation.get_count_on_order @count_on_completed = OrderReservation.get_count_on_completed - - @shop = Shop.current_shop @receipt_bill = check_receipt_bill end def update - @shop = Shop.current_shop @id = params[:order_id] @status = params[:status] min_type = params[:min_type] @@ -87,7 +84,6 @@ class Origami::OrderReservationController < BaseOrigamiController end def send_status - @shop = Shop.current_shop 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') @@ -107,7 +103,6 @@ class Origami::OrderReservationController < BaseOrigamiController end def check_receipt_bill - @shop = Shop.current_shop receipt_bill = Lookup.where("shop_code='#{@shop.shop_code}'").collection_of("order_reservation") status = 0 diff --git a/app/controllers/origami/paymal_controller.rb b/app/controllers/origami/paymal_controller.rb index 0b418215..a65319d2 100644 --- a/app/controllers/origami/paymal_controller.rb +++ b/app/controllers/origami/paymal_controller.rb @@ -6,8 +6,6 @@ class Origami::PaymalController < BaseOrigamiController @membership_rebate_balance=0 sale_data = Sale.find_by_sale_id(@sale_id) @receipt_no = sale_data.receipt_no - - @shop = Shop.current_shop if @shop.is_rounding_adj new_total = Sale.get_rounding_adjustment(sale_data.grand_total) else @@ -76,8 +74,6 @@ def create if(Sale.exists?(sale_id)) saleObj = Sale.find(sale_id) - shop_details = Shop.current_shop - # rounding adjustment # if shop_details.is_rounding_adj # new_total = Sale.get_rounding_adjustment(saleObj.grand_total) diff --git a/app/controllers/origami/payments_controller.rb b/app/controllers/origami/payments_controller.rb index 9f9d284f..cc9c510e 100755 --- a/app/controllers/origami/payments_controller.rb +++ b/app/controllers/origami/payments_controller.rb @@ -32,7 +32,7 @@ class Origami::PaymentsController < BaseOrigamiController end # if ENV["SERVER_MODE"] != "cloud" #no print in cloud server - receipt_bill_a5_pdf = Lookup.where("shop_code='#{Shop.current_shop.shop_code}'").collection_of("print_settings") #print_settings with name:ReceiptBillA5Pdf + receipt_bill_a5_pdf = Lookup.where("shop_code='#{@shop.shop_code}'").collection_of("print_settings") #print_settings with name:ReceiptBillA5Pdf # Print for First Bill to Customer unique_code = "ReceiptBillPdf" print_settings = PrintSetting.all @@ -59,11 +59,11 @@ class Origami::PaymentsController < BaseOrigamiController end #shop detail - ## shop_detail = Shop.current_shop + ## shop_detail = @shop # customer= Customer.where('customer_id=' +.customer_id) customer = Customer.find(sale_data.customer_id) # rounding adjustment - if Shop.current_shop.is_rounding_adj + if @shop.is_rounding_adj new_total = Sale.get_rounding_adjustment(sale_data.grand_total) rounding_adj = new_total - sale_data.grand_total sale_data.update_attributes(grand_total: new_total,old_grand_total: sale_data.grand_total,rounding_adjustment:rounding_adj) if rounding_adj > 0 @@ -76,14 +76,14 @@ class Origami::PaymentsController < BaseOrigamiController remark = "#{action_by} print out first bill for Receipt No #{sale_data.receipt_no}" sale_audit = SaleAudit.record_audit_sale(sale_id,remark,action_by,type ) # get member information - rebate = MembershipSetting.find_by_rebate_and_shop_code(1,Shop.current_shop.shop_code) + rebate = MembershipSetting.find_by_rebate_and_shop_code(1,@shop.shop_code) if customer.membership_id != nil && rebate # member_info = Customer.get_member_account(customer) # current_balance = SaleAudit.paymal_search(sale_id) current_balance = 0 end # get printer info - print_settings=PrintSetting.find_by_unique_code_and_shop_code(unique_code,Shop.current_shop.shop_code) + print_settings=PrintSetting.find_by_unique_code_and_shop_code(unique_code,@shop.shop_code) # find order id by sale id # sale_order = SaleOrder.find_by_sale_id(@sale_data.sale_id) @@ -99,7 +99,7 @@ class Origami::PaymentsController < BaseOrigamiController #TODO :: KBZPAY ( QR ) # On/Off setting ( show or not qr ) # qrCode = "00020101021202021110500346KBZ005ab0ed5c1ed09d1c4585ff1313170389160831435294600062000040732kp1e78f7efddca190042638341afb88d50200006KBZPay0106KBZPay5303MMK5802MM62170813PAY_BY_QRCODE64060002my6304FBBD" - kbz_pay_method = PaymentMethodSetting.where(:payment_method => KbzPay::KBZ_PAY,:shop_code => Shop.current_shop.shop_code).last + kbz_pay_method = PaymentMethodSetting.where(:payment_method => KbzPay::KBZ_PAY,:shop_code => @shop.shop_code).last status = false qr = nil @@ -113,7 +113,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, Shop.current_shop, "Frt",current_balance,nil,other_amount,nil,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, @shop, "Frt",current_balance,nil,other_amount,nil,nil,nil,nil) result = { :filepath => filename, @@ -141,10 +141,10 @@ class Origami::PaymentsController < BaseOrigamiController if(Sale.exists?(sale_id)) saleObj = Sale.find(sale_id) sale_items = SaleItem.get_all_sale_items(sale_id) - #shop_detail = Shop.current_shop + #shop_detail = @shop # rounding adjustment if !path.include? ("credit_payment") - if Shop.current_shop.is_rounding_adj + if @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 @@ -198,7 +198,7 @@ class Origami::PaymentsController < BaseOrigamiController # For Print # if ENV["SERVER_MODE"] != "cloud" #no print in cloud server - receipt_bill_a5_pdf = Lookup.where("shop_code='#{Shop.current_shop.shop_code}'").collection_of("print_settings") #print_settings with name:ReceiptBillA5Pdf + receipt_bill_a5_pdf = Lookup.where("shop_code='#{@shop.shop_code}'").collection_of("print_settings") #print_settings with name:ReceiptBillA5Pdf unique_code = "ReceiptBillPdf" print_settings = PrintSetting.all if !print_settings.nil? @@ -226,7 +226,7 @@ class Origami::PaymentsController < BaseOrigamiController customer= Customer.find(saleObj.customer_id) # get member information - rebate = MembershipSetting.find_by_rebate_and_shop_code(1,Shop.current_shop.shop_code) + rebate = MembershipSetting.find_by_rebate_and_shop_code(1,@shop.shop_code) credit_data = SalePayment.find_by_sale_id_and_payment_method(sale_id,'creditnote') if customer.membership_id != nil && rebate && credit_data.nil? @@ -281,14 +281,14 @@ class Origami::PaymentsController < BaseOrigamiController card_balance_amount,transaction_ref = SaleAudit.getCardBalanceAmount(sale_id) # get printer info - print_settings=PrintSetting.find_by_unique_code_and_shop_code(unique_code,Shop.current_shop.shop_code) + print_settings=PrintSetting.find_by_unique_code_and_shop_code(unique_code,@shop.shop_code) # Calculate Food and Beverage Total item_price_by_accounts = SaleItem.calculate_price_by_accounts(saleObj.sale_items) discount_price_by_accounts = SaleItem.get_discount_price_by_accounts(saleObj.sale_items) 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.current_shop, "Paid",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,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,transaction_ref) #end end @@ -313,7 +313,7 @@ class Origami::PaymentsController < BaseOrigamiController # end def show - display_type = Lookup.find_by_lookup_type_and_shop_code("display_type",Shop.current_shop.shop_code) + display_type = Lookup.find_by_lookup_type_and_shop_code("display_type",@shop.shop_code) if !display_type.nil? && display_type.value.to_i ==2 @display_type = display_type.value else @@ -333,7 +333,7 @@ class Origami::PaymentsController < BaseOrigamiController @sale_payment = SalePayment.get_credit_amount_due_left(sale_id) end - @member_discount = MembershipSetting.find_by_discount_and_shop_code(1,Shop.current_shop.shop_code) + @member_discount = MembershipSetting.find_by_discount_and_shop_code(1,@shop.shop_code) @membership_rebate_balance=0 if Sale.exists?(sale_id) @@ -358,17 +358,17 @@ class Origami::PaymentsController < BaseOrigamiController @dining = '' @other_payment = 0.0 @pdf_view = nil - @lookup_pdf = Lookup.find_by_lookup_type_and_shop_code("ReceiptPdfView",Shop.current_shop.shop_code) + @lookup_pdf = Lookup.find_by_lookup_type_and_shop_code("ReceiptPdfView",@shop.shop_code) if !@lookup_pdf.nil? @pdf_view = @lookup_pdf.value end - amount = SalePayment.get_kbz_pay_amount(sale_id, current_user,Shop.current_shop) + amount = SalePayment.get_kbz_pay_amount(sale_id, current_user,@shop) @kbz_pay_amount += amount.to_f #for changable on/off @changable_tax = true - lookup_changable_tax = Lookup.where("shop_code='#{Shop.current_shop.shop_code}'").collection_of('changable_tax') + lookup_changable_tax = Lookup.where("shop_code='#{@shop.shop_code}'").collection_of('changable_tax') if !lookup_changable_tax.empty? lookup_changable_tax.each do |changable_tax| if changable_tax[0].downcase == "change" @@ -410,7 +410,7 @@ class Origami::PaymentsController < BaseOrigamiController #end rounding adjustment # rounding adjustment - if Shop.current_shop.is_rounding_adj + if @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 @@ -436,7 +436,7 @@ class Origami::PaymentsController < BaseOrigamiController #get customer amount @customer = Customer.find(@sale_data.customer_id) # accounts = @customer.tax_profiles - accounts = TaxProfile.where("group_type = ? and shop_code='#{Shop.current_shop.shop_code}'",@cashier_type).order("order_by ASC") + accounts = TaxProfile.where("group_type = ? and shop_code='#{@shop.shop_code}'",@cashier_type).order("order_by ASC") @account_arr =[] @tax_arr =[] accounts.each do |acc| @@ -450,7 +450,7 @@ class Origami::PaymentsController < BaseOrigamiController @account_arr.push(sale_tax) end end - rebate = MembershipSetting.find_by_rebate_and_shop_code(1,Shop.current_shop.shop_code) + rebate = MembershipSetting.find_by_rebate_and_shop_code(1,@shop.shop_code) # get member information if @customer.membership_id != nil && rebate response = Customer.get_member_account(@customer) @@ -577,7 +577,7 @@ class Origami::PaymentsController < BaseOrigamiController customer= Customer.find(saleObj.customer_id) #shop detail - #shop_detail = Shop.current_shop + #shop_detail = @shop # get member information rebate = MembershipSetting.find_by_rebate(1) if customer.membership_id != nil && rebate @@ -612,7 +612,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.current_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,@shop, "Re-print",current_balance,card_data,other_amount,latest_order_no,card_balance_amount,nil,transaction_ref) result = { :status => true, @@ -687,7 +687,7 @@ class Origami::PaymentsController < BaseOrigamiController #shop detail - #shop_detail = Shop.current_shop + #shop_detail = @shop printer = PrintSetting.all unique_code="ReceiptBillPdf" @@ -703,7 +703,7 @@ class Origami::PaymentsController < BaseOrigamiController end end # get printer info - print_settings=PrintSetting.find_by_unique_code_and_shop_code(unique_code,Shop.current_shop.shop_code) + print_settings=PrintSetting.find_by_unique_code_and_shop_code(unique_code,@shop.shop_code) # Calculate Food and Beverage Total item_price_by_accounts = SaleItem.calculate_price_by_accounts(saleObj.sale_items) discount_price_by_accounts = SaleItem.get_discount_price_by_accounts(saleObj.sale_items) @@ -712,7 +712,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.current_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,@shop, "FOC",nil,nil,other_amount,nil,nil,nil,nil) result = { :status => true, :filepath => filename, @@ -747,7 +747,7 @@ class Origami::PaymentsController < BaseOrigamiController saleObj = Sale.find(params[:sale_id]) - if Shop.current_shop.is_rounding_adj + if @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 @@ -770,9 +770,9 @@ class Origami::PaymentsController < BaseOrigamiController if cashier_type.strip.downcase == "doemal_order" unique_code = "ReceiptBillOrderPdf" else - receipt_bill_a5_pdf = Lookup.where("shop_code='#{Shop.current_shop.shop_code}'").collection_of("print_settings") #print_settings with name:ReceiptBillA5Pdf + receipt_bill_a5_pdf = Lookup.where("shop_code='#{@shop.shop_code}'").collection_of("print_settings") #print_settings with name:ReceiptBillA5Pdf unique_code = "ReceiptBillPdf" - print_settings = PrintSetting.where("shop_code='#{Shop.current_shop.shop_code}'") + print_settings = PrintSetting.where("shop_code='#{@shop.shop_code}'") if !print_settings.nil? print_settings.each do |setting| if setting.unique_code == 'ReceiptBillPdf' @@ -795,7 +795,7 @@ class Origami::PaymentsController < BaseOrigamiController end end # get printer info - print_settings=PrintSetting.find_by_unique_code_and_shop_code(unique_code,Shop.current_shop.shop_code) + print_settings=PrintSetting.find_by_unique_code_and_shop_code(unique_code,@shop.shop_code) printer = Printer::ReceiptPrinter.new(print_settings) printer.print_receipt_pdf(filename,receipt_no,print_settings.print_copies,printer_name) diff --git a/app/controllers/origami/paypar_payments_controller.rb b/app/controllers/origami/paypar_payments_controller.rb index d977f38b..59ddb912 100755 --- a/app/controllers/origami/paypar_payments_controller.rb +++ b/app/controllers/origami/paypar_payments_controller.rb @@ -7,8 +7,6 @@ class Origami::PayparPaymentsController < BaseOrigamiController payment_method = "paypar" if(Sale.exists?(sale_id)) saleObj = Sale.find(sale_id) - - shop_details = Shop.current_shop # rounding adjustment if @shop.is_rounding_adj new_total = Sale.get_rounding_adjustment(saleObj.grand_total) diff --git a/app/controllers/origami/pending_order_controller.rb b/app/controllers/origami/pending_order_controller.rb index 689b2424..c6bdb2e7 100644 --- a/app/controllers/origami/pending_order_controller.rb +++ b/app/controllers/origami/pending_order_controller.rb @@ -1,6 +1,5 @@ class Origami::PendingOrderController < BaseOrigamiController def index - @shop = Shop.current_shop # @dining= DiningFacility.where("status = 'occupied'") # @order = Order.where("DATE_FORMAT(date,'%Y-%m-%d') = ? and status = 'billed' and source = 'quick_service'",DateTime.now.strftime('%Y-%m-%d')) @cashier_type = params[:type] @@ -14,7 +13,6 @@ class Origami::PendingOrderController < BaseOrigamiController end def show - @shop = Shop.current_shop id = params[:sale_id] if id.start_with?("SAL") @sale = Sale.find(id) @@ -45,7 +43,6 @@ class Origami::PendingOrderController < BaseOrigamiController end def completed_sale - @shop = Shop.current_shop @cashier_type = params[:type] @sales = Sale.pending_sale(@cashier_type) @orders = Sale.pending_order(@cashier_type) @@ -81,7 +78,6 @@ class Origami::PendingOrderController < BaseOrigamiController end def credit_sale - @shop = Shop.current_shop @cashier_type = params[:type] @sales = Sale.pending_sale(@cashier_type) @orders = Sale.pending_order(@cashier_type) diff --git a/app/controllers/origami/quick_service_controller.rb b/app/controllers/origami/quick_service_controller.rb index cb2cfb92..8f0c5c92 100644 --- a/app/controllers/origami/quick_service_controller.rb +++ b/app/controllers/origami/quick_service_controller.rb @@ -27,7 +27,7 @@ class Origami::QuickServiceController < ApplicationController #checked quick_service only @quick_service_only = false - lookup_dine_in = Lookup.where("shop_code='#{Shop.current_shop.shop_code}'").collection_of('quickservice_add_order') + lookup_dine_in = Lookup.where("shop_code='#{@shop.shop_code}'").collection_of('quickservice_add_order') if !lookup_dine_in.empty? lookup_dine_in.each do |dine_in| if dine_in[0].downcase == "quickserviceaddorder" diff --git a/app/controllers/origami/redeem_payments_controller.rb b/app/controllers/origami/redeem_payments_controller.rb index 49942e4b..6b7802cf 100755 --- a/app/controllers/origami/redeem_payments_controller.rb +++ b/app/controllers/origami/redeem_payments_controller.rb @@ -5,8 +5,6 @@ class Origami::RedeemPaymentsController < BaseOrigamiController @cashier_type = params[:type] @membership_rebate_balance=0 sale_data = Sale.find_by_sale_id(@sale_id) - - @shop = Shop.current_shop if @shop.is_rounding_adj new_total = Sale.get_rounding_adjustment(sale_data.grand_total) else diff --git a/app/controllers/origami/request_bills_controller.rb b/app/controllers/origami/request_bills_controller.rb index 48cb19b4..137aa774 100755 --- a/app/controllers/origami/request_bills_controller.rb +++ b/app/controllers/origami/request_bills_controller.rb @@ -8,7 +8,6 @@ class Origami::RequestBillsController < ApplicationController end # Print Request Bill and add to sale tables def print - @shop = Shop.current_shop if !ShiftSale.current_shift.nil? order_id = params[:id] # order_id order = Order.find(order_id) @@ -91,7 +90,7 @@ class Origami::RequestBillsController < ApplicationController # Not Use for these printed bill cannot give customer # unique_code = "ReceiptBillPdf" # #shop detail - # shop_details = Shop.current_shop + # shop_details = @shop # # customer= Customer.where('customer_id=' +.customer_id) # customer= Customer.find(@sale_data.customer_id) # # get member information diff --git a/app/controllers/origami/rooms_controller.rb b/app/controllers/origami/rooms_controller.rb index a20bfb7c..a567851f 100755 --- a/app/controllers/origami/rooms_controller.rb +++ b/app/controllers/origami/rooms_controller.rb @@ -13,7 +13,6 @@ class Origami::RoomsController < BaseOrigamiController end def show - @shop = Shop.current_shop @webview = false if check_mobile @webview = true @@ -33,9 +32,6 @@ class Origami::RoomsController < BaseOrigamiController @sale_array = Array.new @membership = MembershipSetting.find_by_shop_code(@shop.shop_code) @payment_methods = PaymentMethodSetting.find_by_shop_code(@shop.shop_code) - - - @shop = Shop.current_shop @membership = MembershipSetting::MembershipSetting @payment_methods = PaymentMethodSetting.all @dining_room = @room.bookings.active.where("DATE_FORMAT(created_at,'%Y-%m-%d') = '#{DateTime.now.strftime('%Y-%m-%d')}' OR DATE_FORMAT(created_at,'%Y-%m-%d') = '#{Date.today.prev_day}' ") diff --git a/app/controllers/origami/second_display_controller.rb b/app/controllers/origami/second_display_controller.rb index 392b85e6..c8277ef7 100644 --- a/app/controllers/origami/second_display_controller.rb +++ b/app/controllers/origami/second_display_controller.rb @@ -27,7 +27,7 @@ class Origami::SecondDisplayController < BaseOrigamiController #Shop Name in Navbor # helper_method :shop_detail # def shop_detail - # @shop = Shop.current_shop + # # end diff --git a/app/controllers/origami/shifts_controller.rb b/app/controllers/origami/shifts_controller.rb index 1b6fd355..3fcfe704 100755 --- a/app/controllers/origami/shifts_controller.rb +++ b/app/controllers/origami/shifts_controller.rb @@ -42,7 +42,6 @@ class Origami::ShiftsController < BaseOrigamiController def update_shift - @shop = Shop.current_shop closing_balance = params[:closing_balance] shift_id = params[:shift_id] @shift = ShiftSale.find_by_id(shift_id) @@ -89,7 +88,6 @@ class Origami::ShiftsController < BaseOrigamiController end end end - shop_details = shop_detail #get tax shift_obj = ShiftSale.where('id =?',@shift.id) sale_items = '' @@ -126,7 +124,9 @@ class Origami::ShiftsController < BaseOrigamiController end find_close_cashier_print = Lookup.collection_of('close_cashier_print') 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_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) end end end diff --git a/app/controllers/origami/split_bill_controller.rb b/app/controllers/origami/split_bill_controller.rb index 2216d5dd..80a6070f 100755 --- a/app/controllers/origami/split_bill_controller.rb +++ b/app/controllers/origami/split_bill_controller.rb @@ -84,7 +84,6 @@ class Origami::SplitBillController < BaseOrigamiController end def create - @shop = Shop.current_shop cashier_type = params[:cashier_type] order_ids = params[:order_ids] arr_order_ids = nil @@ -397,10 +396,4 @@ class Origami::SplitBillController < BaseOrigamiController render :json => { status: true } end - - #Shop Name in Navbor - helper_method :shop_detail - def shop_detail - @shop = Shop.current_shop - end end diff --git a/app/controllers/origami/surveys_controller.rb b/app/controllers/origami/surveys_controller.rb index 0312c2ef..be8d6b1c 100644 --- a/app/controllers/origami/surveys_controller.rb +++ b/app/controllers/origami/surveys_controller.rb @@ -1,6 +1,5 @@ class Origami::SurveysController < BaseOrigamiController def new - @shop = Shop.current_shop @webview = false if check_mobile @webview = true @@ -39,7 +38,6 @@ class Origami::SurveysController < BaseOrigamiController end def create - @shop = Shop.current_shop @type = params[:cashier_type] @sale_id = params[:sale_id] if params[:table_id].to_i>0 diff --git a/app/controllers/origami/table_invoices_controller.rb b/app/controllers/origami/table_invoices_controller.rb index 5cf20f30..e3265710 100755 --- a/app/controllers/origami/table_invoices_controller.rb +++ b/app/controllers/origami/table_invoices_controller.rb @@ -1,8 +1,6 @@ class Origami::TableInvoicesController < BaseOrigamiController def index @table = DiningFacility.find(params[:table_id]) - - @shop = Shop.current_shop @sale_array = Array.new @table.bookings.each do |booking| @@ -33,7 +31,6 @@ class Origami::TableInvoicesController < BaseOrigamiController @membership = MembershipSetting::MembershipSetting @payment_methods = PaymentMethodSetting.all - @shop = Shop.current_shop @sale_array = Array.new @table.bookings.each do |booking| if booking.sale_id.nil? diff --git a/app/controllers/origami/unionpay_controller.rb b/app/controllers/origami/unionpay_controller.rb index f132a49d..2f708af3 100644 --- a/app/controllers/origami/unionpay_controller.rb +++ b/app/controllers/origami/unionpay_controller.rb @@ -11,8 +11,6 @@ class Origami::UnionpayController < BaseOrigamiController end total = 0 @unionpaycount = 0 - - @shop = Shop.current_shop @rounding_adj = 0 @can_unionpay = 0 @member_discount = 0 @@ -62,8 +60,6 @@ class Origami::UnionpayController < BaseOrigamiController ref_no = params[:ref_no] if(Sale.exists?(sale_id)) saleObj = Sale.find(sale_id) - - shop_details = Shop.current_shop # rounding adjustment # if shop_details.is_rounding_adj # new_total = Sale.get_rounding_adjustment(saleObj.grand_total) @@ -82,11 +78,4 @@ class Origami::UnionpayController < BaseOrigamiController @status, @sale = sale_payment.process_payment(saleObj, current_user, cash, "unionpay",ref_no,payment_for) end end - - #Shop Name in Navbor - - helper_method :shop_detail - def shop_detail - @shop = Shop.current_shop - end end diff --git a/app/controllers/origami/visa_controller.rb b/app/controllers/origami/visa_controller.rb index 91095f64..a2e43d5a 100644 --- a/app/controllers/origami/visa_controller.rb +++ b/app/controllers/origami/visa_controller.rb @@ -11,8 +11,6 @@ class Origami::VisaController < BaseOrigamiController end total = 0 @visacount = 0 - - @shop = Shop.current_shop @rounding_adj = 0 @can_visa = 0 @member_discount = 0 @@ -62,8 +60,6 @@ class Origami::VisaController < BaseOrigamiController ref_no = params[:ref_no] if(Sale.exists?(sale_id)) saleObj = Sale.find(sale_id) - - shop_details = Shop.current_shop # rounding adjustment # if shop_details.is_rounding_adj # new_total = Sale.get_rounding_adjustment(saleObj.grand_total) @@ -82,11 +78,4 @@ class Origami::VisaController < BaseOrigamiController @status, @sale = sale_payment.process_payment(saleObj, current_user, cash, "visa",ref_no,payment_for) end end - - #Shop Name in Navbor - - helper_method :shop_detail - def shop_detail - @shop = Shop.current_shop - end end diff --git a/app/controllers/origami/void_controller.rb b/app/controllers/origami/void_controller.rb index 1a041638..d0d001c2 100755 --- a/app/controllers/origami/void_controller.rb +++ b/app/controllers/origami/void_controller.rb @@ -1,7 +1,6 @@ class Origami::VoidController < BaseOrigamiController authorize_resource :class => false def overall_void - @shop = Shop.current_shop sale_id = params[:sale_id] remark = params[:remark] order_source = params[:type] #tax profile source @@ -114,9 +113,6 @@ class Origami::VoidController < BaseOrigamiController # end customer= Customer.find(sale.customer_id) - - #shop detail - shop_details = Shop.current_shop # get member information rebate = MembershipSetting.find_by_rebate_and_shop_code(1,@shop.shop_code) if customer.membership_id != nil && rebate diff --git a/app/controllers/origami/voucher_controller.rb b/app/controllers/origami/voucher_controller.rb index 4ecd784b..196d93c4 100755 --- a/app/controllers/origami/voucher_controller.rb +++ b/app/controllers/origami/voucher_controller.rb @@ -7,9 +7,6 @@ class Origami::VoucherController < BaseOrigamiController total = sale_data.grand_total @vouchercount = 0 others = 0 - - - @shop = Shop.current_shop if @shop.is_rounding_adj new_total = Sale.get_rounding_adjustment(sale_data.grand_total) else diff --git a/app/controllers/origami/waste_spoile_controller.rb b/app/controllers/origami/waste_spoile_controller.rb index 68a29b8a..13a70728 100755 --- a/app/controllers/origami/waste_spoile_controller.rb +++ b/app/controllers/origami/waste_spoile_controller.rb @@ -1,6 +1,5 @@ class Origami::WasteSpoileController < BaseOrigamiController def waste_and_spoilage - @shop = Shop.current_shop sale_id = params[:sale_id] remark = params[:remark] order_source = params[:type] @@ -87,9 +86,6 @@ class Origami::WasteSpoileController < BaseOrigamiController # if ENV["SERVER_MODE"] != "cloud" #no print in cloud server # unique_code = "ReceiptBillPdf" customer= Customer.find(sale.customer_id) - - #shop detail - shop_details = Shop.current_shop # get member information rebate = MembershipSetting.find_by_rebate_and_shop_code(1,@shop.shop_code) if customer.membership_id != nil && rebate diff --git a/app/controllers/print_settings_controller.rb b/app/controllers/print_settings_controller.rb index f1f6ed68..0d8c5280 100755 --- a/app/controllers/print_settings_controller.rb +++ b/app/controllers/print_settings_controller.rb @@ -11,7 +11,7 @@ class PrintSettingsController < ApplicationController # GET /print_settings/1 # GET /print_settings/1.json def show - @lookup = Lookup.shift_sale_items_lookup_value(Shop.current_shop.shop_code) + @lookup = Lookup.shift_sale_items_lookup_value(@shop.shop_code) end # GET /print_settings/new @@ -22,7 +22,7 @@ class PrintSettingsController < ApplicationController # GET /print_settings/1/edit def edit - @lookup = Lookup.shift_sale_items_lookup_value(Shop.current_shop.shop_code) + @lookup = Lookup.shift_sale_items_lookup_value(@shop.shop_code) @server_mode = ENV["SERVER_MODE"] end @@ -30,7 +30,7 @@ class PrintSettingsController < ApplicationController # POST /print_settings.json def create @print_setting = PrintSetting.new(print_setting_params) - @print_setting.shop_code = Shop.current_shop.shop_code + @print_setting.shop_code = @shop.shop_code respond_to do |format| if @print_setting.save format.html { redirect_to @print_setting, notice: 'Print setting was successfully created.' } @@ -48,7 +48,7 @@ class PrintSettingsController < ApplicationController respond_to do |format| if @print_setting.update(print_setting_params) if @print_setting.unique_code == 'CloseCashierPdf' - Lookup.save_shift_sale_items_settings(params[:shift_sale_items],Shop.current_shop.shop_code) + Lookup.save_shift_sale_items_settings(params[:shift_sale_items],@shop.shop_code) end format.html { redirect_to @print_setting, notice: 'Print setting was successfully updated.' } diff --git a/app/controllers/reports/commission_controller.rb b/app/controllers/reports/commission_controller.rb index 9d855cea..b30299d2 100755 --- a/app/controllers/reports/commission_controller.rb +++ b/app/controllers/reports/commission_controller.rb @@ -2,7 +2,6 @@ class Reports::CommissionController < BaseReportController # authorize_resource :class => false def index - @shop = Shop.current_shop from_date, to_date = get_date_range_from_params commissioner = params[:commissioner].to_i @@ -22,7 +21,6 @@ class Reports::CommissionController < BaseReportController end def show - @shop = Shop.current_shop from, to = get_date_range_from_params @sale_data = Sale.get_by_shift_sale(from,to,Sale::SALE_STATUS_COMPLETED).where("shift_sales.shop_code='#{@shop.shop_code}'") diff --git a/app/controllers/reports/credit_payment_controller.rb b/app/controllers/reports/credit_payment_controller.rb index fc3b77cf..c1c16623 100755 --- a/app/controllers/reports/credit_payment_controller.rb +++ b/app/controllers/reports/credit_payment_controller.rb @@ -1,7 +1,6 @@ class Reports::CreditPaymentController < BaseReportController authorize_resource :class => false def index - @shop = Shop.current_shop @filter_for_credit = [['All',''],['Paid','paid'],['Unpaid','unpaid']] @sources = [["All",''], ["Cashier","cashier"],["Quick Service","quick_service"],["Online Order","doemal_order"]] from, to = get_date_range_from_params @@ -43,7 +42,6 @@ authorize_resource :class => false end def show - @shop = Shop.current_shop from, to = get_date_range_from_params @sale_data = Sale.get_by_shift_sale_by_item(from,to,Sale::SALE_STATUS_COMPLETED) diff --git a/app/controllers/reports/dailysale_controller.rb b/app/controllers/reports/dailysale_controller.rb index 44ee4bf0..a4fac509 100755 --- a/app/controllers/reports/dailysale_controller.rb +++ b/app/controllers/reports/dailysale_controller.rb @@ -2,7 +2,6 @@ class Reports::DailysaleController < BaseReportController authorize_resource :class => false def index - @shop = Shop.current_shop from, to = get_date_range_from_params @sale_data = Sale.daily_sales_list(from,to,@shop.shop_code) @tax = SaleTax.get_tax(from,to,@shop.shop_code) diff --git a/app/controllers/reports/hourly_saleitem_controller.rb b/app/controllers/reports/hourly_saleitem_controller.rb index 0bc57168..bcb5c877 100644 --- a/app/controllers/reports/hourly_saleitem_controller.rb +++ b/app/controllers/reports/hourly_saleitem_controller.rb @@ -1,7 +1,6 @@ class Reports::HourlySaleitemController < BaseReportController authorize_resource :class => false def index - @shop = Shop.current_shop @account = Account.where("shop_code='#{@shop.shop_code}'") from, to = get_date_range_from_params @@ -65,7 +64,6 @@ class Reports::HourlySaleitemController < BaseReportController end def show - @shop = Shop.current_shop from, to, report_type = get_date_range_from_params @sale_data = Sale.get_by_shift_sale_by_item(from,to,Sale::SALE_STATUS_COMPLETED) sale_data = @sale_data diff --git a/app/controllers/reports/induty_controller.rb b/app/controllers/reports/induty_controller.rb index d02b1378..efc821a7 100644 --- a/app/controllers/reports/induty_controller.rb +++ b/app/controllers/reports/induty_controller.rb @@ -1,7 +1,6 @@ class Reports::IndutyController < BaseReportController authorize_resource :class => false def index - @shop = Shop.current_shop @commissioners = Commissioner.where("shop_code='#{@shop.shop_code}'") #.where("is_active='1'") from, to = get_date_range_from_params @@ -42,7 +41,6 @@ class Reports::IndutyController < BaseReportController end def show - @shop = Shop.current_shop from, to = get_date_range_from_params @induty_data = Sale.get_by_shift_sale_by_item(from,to,Sale::SALE_STATUS_COMPLETED).where("shift_sales.shop_code='#{@shop.shop_code}'") diff --git a/app/controllers/reports/order_reservation_controller.rb b/app/controllers/reports/order_reservation_controller.rb index 1fa7ac50..4625c1f1 100644 --- a/app/controllers/reports/order_reservation_controller.rb +++ b/app/controllers/reports/order_reservation_controller.rb @@ -1,7 +1,6 @@ class Reports::OrderReservationController < BaseReportController # authorize_resource :class => false def index - @shop = Shop.current_shop @providers = [["All",''], ["Direct Delivery","direct_delivery"],["Pick-Up","pick_up"],["TURBO","turbo"],["food2u","food2u"], ["ygndoor2door","ygndoor2door"]] @payment_types = [["All",''], ["COD","cash_on_delivery"],["DINGA","dinga"]] @@ -48,7 +47,6 @@ class Reports::OrderReservationController < BaseReportController end def show - @shop = Shop.current_shop 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}'") diff --git a/app/controllers/reports/payment_method_controller.rb b/app/controllers/reports/payment_method_controller.rb index 1c1900bc..244e2974 100644 --- a/app/controllers/reports/payment_method_controller.rb +++ b/app/controllers/reports/payment_method_controller.rb @@ -1,7 +1,6 @@ class Reports::PaymentMethodController < BaseReportController # authorize_resource :class => false def index - @shop = Shop.current_shop @payments = [["All Payment",''],["Cash Payment","cash"], ["KBZ Payment", KbzPay::KBZ_PAY], ["Credit Payment","creditnote"], ["FOC Payment","foc"], ["MPU Payment","mpu"], ["Visa Payment","visa"], ["Master Payment","master"], ["JCB Payment","jcb"],["UnionPay Payment","unionpay"], @@ -42,7 +41,6 @@ class Reports::PaymentMethodController < BaseReportController end def show - @shop = Shop.current_shop from, to = get_date_range_from_params @sale_data = Sale.get_by_shift_sale(from,to,Sale::SALE_STATUS_COMPLETED).where("shift_sales.shop_code='#{@shop.shop_code}'") diff --git a/app/controllers/reports/product_sale_controller.rb b/app/controllers/reports/product_sale_controller.rb index 61f17396..eb4c6530 100644 --- a/app/controllers/reports/product_sale_controller.rb +++ b/app/controllers/reports/product_sale_controller.rb @@ -7,21 +7,15 @@ class Reports::ProductSaleController < BaseReportController @order_by = params[:order_by] end - @sale_data = Sale.get_menu_item_query(@order_by) + @sale_data = Sale.get_menu_item_query(@order_by) - # get printer info - @print_settings = PrintSetting.get_precision_delimiter() + # get printer info + @print_settings = PrintSetting.get_precision_delimiter() respond_to do |format| format.html - format.json + format.json format.xls end - end - - #Shop Name in Navbor - helper_method :shop_detail - def shop_detail - @shop = Shop.current_shop end end diff --git a/app/controllers/reports/receipt_no_controller.rb b/app/controllers/reports/receipt_no_controller.rb index 0b590421..5da8f9de 100755 --- a/app/controllers/reports/receipt_no_controller.rb +++ b/app/controllers/reports/receipt_no_controller.rb @@ -1,7 +1,6 @@ class Reports::ReceiptNoController < BaseReportController authorize_resource :class => false def index - @shop = Shop.current_shop @payments = [["All Payment",''], ["Cash Payment","cash"], ["Credit Payment","creditnote"], ["FOC Payment","foc"]] @payment_method = PaymentMethodSetting.where("shop_code='#{@shop.shop_code}'") from, to = get_date_range_from_params @@ -54,7 +53,6 @@ authorize_resource :class => false end def show - @shop = Shop.current_shop 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}'") @@ -78,7 +76,7 @@ authorize_resource :class => false end def sync_data - + @orders, @order_items, @sales, @sale_items, @sale_taxes, @sale_payments, @sale_orders, @sale_audits, @bookings, @assigned_order_items, @shift_sales = Booking.get_sync_data(params[:sale_id]) # Here comes to call the sync api @@ -182,7 +180,7 @@ authorize_resource :class => false customer= Customer.find(saleObj.customer_id) #shop detail - #shop_detail = Shop.current_shop + #shop_detail = @shop # get member information rebate = MembershipSetting.find_by_rebate(1) if customer.membership_id != nil && rebate diff --git a/app/controllers/reports/receipt_no_detail_controller.rb b/app/controllers/reports/receipt_no_detail_controller.rb index ebadb2cf..59bf70c5 100755 --- a/app/controllers/reports/receipt_no_detail_controller.rb +++ b/app/controllers/reports/receipt_no_detail_controller.rb @@ -1,7 +1,6 @@ class Reports::ReceiptNoDetailController < BaseReportController authorize_resource :class => false def index - @shop = Shop.current_shop @payments = [["All Payment",''], ["Cash Payment","cash"], ["Credit Payment","creditnote"], ["FOC Payment","foc"]] @payment_method = PaymentMethodSetting.where("shop_code='#{@shop.shop_code}'") from, to = get_date_range_from_params @@ -49,7 +48,6 @@ authorize_resource :class => false end def show - @shop = Shop.current_shop 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}'") diff --git a/app/controllers/reports/saleitem_controller.rb b/app/controllers/reports/saleitem_controller.rb index bc2ba6c9..a9cf0139 100755 --- a/app/controllers/reports/saleitem_controller.rb +++ b/app/controllers/reports/saleitem_controller.rb @@ -1,7 +1,6 @@ class Reports::SaleitemController < BaseReportController authorize_resource :class => false def index - @shop = Shop.current_shop @account = Account.where("shop_code='#{@shop.shop_code}'") from, to = get_date_range_from_params @@ -60,7 +59,6 @@ class Reports::SaleitemController < BaseReportController end def show - @shop = Shop.current_shop from, to, report_type = 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}'") @@ -86,7 +84,6 @@ class Reports::SaleitemController < BaseReportController end def print_sale_items - @shop = Shop.current_shop from, to = get_date_range_from_params shift_sale_range = '' diff --git a/app/controllers/reports/shiftsale_controller.rb b/app/controllers/reports/shiftsale_controller.rb index 504ad815..4e9d7f17 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 - @shop = Shop.current_shop + 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 - @shop = Shop.current_shop + 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 - @shop = Shop.current_shop + shift_id = params[:id] @shift = ShiftSale.find_by_id(shift_id) shift_obj = ShiftSale.where('id =?',shift_id) diff --git a/app/controllers/reports/staff_meal_controller.rb b/app/controllers/reports/staff_meal_controller.rb index b047d729..7a478847 100644 --- a/app/controllers/reports/staff_meal_controller.rb +++ b/app/controllers/reports/staff_meal_controller.rb @@ -1,7 +1,7 @@ class Reports::StaffMealController < BaseReportController authorize_resource :class => false def index - @shop = Shop.current_shop + @account = Account.where("shop_code='#{@shop.shop_code}'") from, to = get_date_range_from_params diff --git a/app/controllers/reports/stock_check_controller.rb b/app/controllers/reports/stock_check_controller.rb index a3e86f81..48d28f42 100755 --- a/app/controllers/reports/stock_check_controller.rb +++ b/app/controllers/reports/stock_check_controller.rb @@ -2,7 +2,7 @@ class Reports::StockCheckController < BaseReportController # authorize_resource :class => false def index - @shop = Shop.current_shop + # from_date = DateTime.now.beginning_of_day.utc.getlocal # to_date = DateTime.now.end_of_day.utc.getlocal # unless params[:daterange].blank? @@ -26,7 +26,7 @@ class Reports::StockCheckController < BaseReportController end def show - @shop = Shop.current_shop + from, to = get_date_range_from_params @sale_data = Sale.get_by_shift_sale(from,to,Sale::SALE_STATUS_COMPLETED).where("shift_sales.shop_code='#{@shop.shop_code}'") diff --git a/app/controllers/reports/void_sale_controller.rb b/app/controllers/reports/void_sale_controller.rb index f318adb9..425844b8 100755 --- a/app/controllers/reports/void_sale_controller.rb +++ b/app/controllers/reports/void_sale_controller.rb @@ -1,7 +1,7 @@ class Reports::VoidSaleController < BaseReportController authorize_resource :class => false def index - @shop = Shop.current_shop + from, to = get_date_range_from_params # @shift_sale_range = Sale.get_by_shift_sale(from,to,Sale::SALE_STATUS_COMPLETED) diff --git a/app/controllers/reports/waste_and_spoilage_controller.rb b/app/controllers/reports/waste_and_spoilage_controller.rb index 882218e7..4b15cc01 100755 --- a/app/controllers/reports/waste_and_spoilage_controller.rb +++ b/app/controllers/reports/waste_and_spoilage_controller.rb @@ -1,7 +1,7 @@ class Reports::WasteAndSpoilageController < BaseReportController authorize_resource :class => false def index - @shop = Shop.current_shop + from, to = get_date_range_from_params @sale_type = params[:sale_type] @sale_data = Sale.get_wastes_and_spoilages(from,to,@sale_type).where("sales.shop_code='#{@shop.shop_code}'") diff --git a/app/controllers/settings/accounts_controller.rb b/app/controllers/settings/accounts_controller.rb index b78038b6..ca6aa027 100755 --- a/app/controllers/settings/accounts_controller.rb +++ b/app/controllers/settings/accounts_controller.rb @@ -5,7 +5,7 @@ class Settings::AccountsController < ApplicationController # GET /settings/accounts # GET /settings/accounts.json def index - @shop = Shop.current_shop + @settings_accounts = Account.all.where("shop_code='#{@shop.shop_code}'") end @@ -26,7 +26,7 @@ class Settings::AccountsController < ApplicationController # POST /settings/accounts # POST /settings/accounts.json def create - @shop = Shop.current_shop + @settings_account = Account.new(account_params) @settings_account.shop_code = @shop.shop_code respond_to do |format| diff --git a/app/controllers/settings/cashier_terminals_controller.rb b/app/controllers/settings/cashier_terminals_controller.rb index 7bd3bfc6..cb875a6b 100755 --- a/app/controllers/settings/cashier_terminals_controller.rb +++ b/app/controllers/settings/cashier_terminals_controller.rb @@ -5,7 +5,7 @@ class Settings::CashierTerminalsController < ApplicationController # GET /settings/cashier_terminals # GET /settings/cashier_terminals.json def index - @settings_cashier_terminals = CashierTerminal.where("shop_code=?",Shop.current_shop.shop_code) + @settings_cashier_terminals = CashierTerminal.where("shop_code=?",@shop.shop_code) end # GET /settings/cashier_terminals/1 @@ -27,7 +27,7 @@ class Settings::CashierTerminalsController < ApplicationController # POST /settings/cashier_terminals # POST /settings/cashier_terminals.json def create - @shop = Shop.current_shop + @settings_cashier_terminal = CashierTerminal.new(settings_cashier_terminal_params) @settings_cashier_terminal.shop_code = @shop.shop_code respond_to do |format| diff --git a/app/controllers/settings/commissioners_controller.rb b/app/controllers/settings/commissioners_controller.rb index f3e506d1..24cc484b 100755 --- a/app/controllers/settings/commissioners_controller.rb +++ b/app/controllers/settings/commissioners_controller.rb @@ -28,7 +28,7 @@ class Settings::CommissionersController < ApplicationController # POST /commissioners # POST /commissioners.json def create - @shop = Shop.current_shop + @commissioner = Commissioner.new(commissioner_params) @commissioner.created_by = current_user.id @commissioner.shop_code = @shop.shop_code diff --git a/app/controllers/settings/commissions_controller.rb b/app/controllers/settings/commissions_controller.rb index 0174a526..60778dab 100755 --- a/app/controllers/settings/commissions_controller.rb +++ b/app/controllers/settings/commissions_controller.rb @@ -28,7 +28,7 @@ class Settings::CommissionsController < ApplicationController # POST /commissions # POST /commissions.json def create - @shop = Shop.current_shop + @commission = Commission.new(commission_params) @commission.product_type = 'menu_item' @commission.product_code = "[]" diff --git a/app/controllers/settings/membership_actions_controller.rb b/app/controllers/settings/membership_actions_controller.rb index fc79ad2c..f6eb77bf 100755 --- a/app/controllers/settings/membership_actions_controller.rb +++ b/app/controllers/settings/membership_actions_controller.rb @@ -25,7 +25,7 @@ class Settings::MembershipActionsController < ApplicationController # POST /settings/membership_actions # POST /settings/membership_actions.json def create - @shop = Shop.current_shop + @settings_membership_action = MembershipAction.new(settings_membership_action_params) @settings_membership_action.shop_code = @shop.shop_code respond_to do |format| diff --git a/app/controllers/settings/membership_settings_controller.rb b/app/controllers/settings/membership_settings_controller.rb index 61b4a648..2e128ce0 100755 --- a/app/controllers/settings/membership_settings_controller.rb +++ b/app/controllers/settings/membership_settings_controller.rb @@ -25,7 +25,7 @@ class Settings::MembershipSettingsController < ApplicationController # POST /settings/membership_settings # POST /settings/membership_settings.json def create - @shop = Shop.current_shop + @settings_membership_setting = MembershipSetting.new(settings_membership_setting_params) @settings_membership_setting.shop_code = @shop.shop_code respond_to do |format| diff --git a/app/controllers/settings/menus_controller.rb b/app/controllers/settings/menus_controller.rb index 449ae573..e449dd38 100755 --- a/app/controllers/settings/menus_controller.rb +++ b/app/controllers/settings/menus_controller.rb @@ -5,7 +5,7 @@ class Settings::MenusController < ApplicationController # GET /settings/menus # GET /settings/menus.json def index - @shop = Shop.current_shop + @settings_menus = Menu.all.where("shop_code='#{@shop.shop_code}'").page(params[:page]).per(10) respond_to do |format| format.html @@ -31,7 +31,7 @@ class Settings::MenusController < ApplicationController # POST /settings/menus # POST /settings/menus.json def create - @shop = Shop.current_shop + @settings_menu = Menu.new(settings_menu_params) @settings_menu.created_by = current_login_employee.name @settings_menu.shop_code = @shop.shop_code @@ -76,7 +76,7 @@ class Settings::MenusController < ApplicationController end def export - @shop = Shop.current_shop + @settings_menus = Menu.all.where("shop_code='#{@shop.shop_code}'").page(params[:page]).per(10) menu = Menu.find(params[:id]) diff --git a/app/controllers/settings/order_queue_stations_controller.rb b/app/controllers/settings/order_queue_stations_controller.rb index fba533ff..aa856801 100755 --- a/app/controllers/settings/order_queue_stations_controller.rb +++ b/app/controllers/settings/order_queue_stations_controller.rb @@ -29,7 +29,7 @@ class Settings::OrderQueueStationsController < ApplicationController # POST /settings/order_queue_stations # POST /settings/order_queue_stations.json def create - @shop = Shop.current_shop + @settings_order_queue_station = OrderQueueStation.new(settings_order_queue_station_params) @settings_order_queue_station.created_by = current_login_employee.name @settings_order_queue_station.processing_items = "[]" diff --git a/app/controllers/settings/payment_method_settings_controller.rb b/app/controllers/settings/payment_method_settings_controller.rb index e6361610..e85e7a99 100755 --- a/app/controllers/settings/payment_method_settings_controller.rb +++ b/app/controllers/settings/payment_method_settings_controller.rb @@ -26,7 +26,7 @@ class Settings::PaymentMethodSettingsController < ApplicationController # POST /settings/payment_method_settings.json def create @settings_payment_method_setting = PaymentMethodSetting.new(settings_payment_method_setting_params) - @settings_payment_method_setting.shop_code = Shop.current_shop.shop_code + @settings_payment_method_setting.shop_code = @shop.shop_code respond_to do |format| if @settings_payment_method_setting.save format.html { redirect_to settings_payment_method_settings_path, notice: 'Payment method setting was successfully created.' } diff --git a/app/controllers/settings/products_controller.rb b/app/controllers/settings/products_controller.rb index a7955b22..4562d132 100755 --- a/app/controllers/settings/products_controller.rb +++ b/app/controllers/settings/products_controller.rb @@ -26,7 +26,7 @@ load_and_authorize_resource except: [:create] # POST /settings/products # POST /settings/products.json def create - @shop = Shop.current_shop + @settings_product = Product.new(settings_product_params) @settings_product.created_by = current_user.name @settings_product.shop_code = @shop.shop_code diff --git a/app/controllers/settings/promotions_controller.rb b/app/controllers/settings/promotions_controller.rb index 57ee2d6d..442a2063 100755 --- a/app/controllers/settings/promotions_controller.rb +++ b/app/controllers/settings/promotions_controller.rb @@ -28,7 +28,7 @@ class Settings::PromotionsController < ApplicationController # POST /promotions # POST /promotions.json def create - @shop = Shop.current_shop + @promotion = Promotion.new(promotion_params) @promotion.created_by = current_login_employee.id @promotion.shop_code = @shop.shop_code diff --git a/app/controllers/settings/rooms_controller.rb b/app/controllers/settings/rooms_controller.rb index 77d91885..6617720c 100755 --- a/app/controllers/settings/rooms_controller.rb +++ b/app/controllers/settings/rooms_controller.rb @@ -25,7 +25,7 @@ class Settings::RoomsController < ApplicationController # POST /settings/rooms # POST /settings/rooms.json def create - @shop = Shop.current_shop + @settings_room = Room.new(settings_room_params) @settings_room.type = DiningFacility::ROOM_TYPE @settings_room.zone_id = params[:zone_id] diff --git a/app/controllers/settings/shops_controller.rb b/app/controllers/settings/shops_controller.rb index 33d47d09..c15cf757 100644 --- a/app/controllers/settings/shops_controller.rb +++ b/app/controllers/settings/shops_controller.rb @@ -60,11 +60,11 @@ class Settings::ShopsController < ApplicationController File.delete(delete_path) end end - save_path = Rails.root.join("public/#{Shop.current_shop.shop_code}_#{a.original_filename}") + save_path = Rails.root.join("public/#{@shop.shop_code}_#{a.original_filename}") File.open(save_path, 'wb') do |f| f.write a.read end - audio_name = "#{Shop.current_shop.shop_code}_#{a.original_filename}" + audio_name = "#{@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) else diff --git a/app/controllers/settings/tables_controller.rb b/app/controllers/settings/tables_controller.rb index 60b1ca59..ed4afe37 100755 --- a/app/controllers/settings/tables_controller.rb +++ b/app/controllers/settings/tables_controller.rb @@ -25,7 +25,7 @@ class Settings::TablesController < ApplicationController # POST /settings/tables # POST /settings/tables.json def create - @shop = Shop.current_shop + @settings_table = Table.new(settings_table_params) @settings_table.type = DiningFacility::TABLE_TYPE @settings_table.zone_id = params[:zone_id] diff --git a/app/controllers/settings/tax_profiles_controller.rb b/app/controllers/settings/tax_profiles_controller.rb index 112de9fc..51a8880f 100755 --- a/app/controllers/settings/tax_profiles_controller.rb +++ b/app/controllers/settings/tax_profiles_controller.rb @@ -45,7 +45,7 @@ class Settings::TaxProfilesController < ApplicationController # POST /settings/tax_profiles # POST /settings/tax_profiles.json def create - @shop = Shop.current_shop + @settings_tax_profile = TaxProfile.new(settings_tax_profile_params) @settings_tax_profile.created_by = current_login_employee.name @settings_tax_profile.shop_code = @shop.shop_code diff --git a/app/controllers/settings/zones_controller.rb b/app/controllers/settings/zones_controller.rb index fcad9b8d..57ecd577 100755 --- a/app/controllers/settings/zones_controller.rb +++ b/app/controllers/settings/zones_controller.rb @@ -5,7 +5,7 @@ class Settings::ZonesController < ApplicationController # GET /settings/zones # GET /settings/zones.json def index - @shop = Shop.current_shop + @settings_zones = Zone.all.where("shop_code='#{@shop.shop_code}' and is_active= true") end @@ -28,7 +28,7 @@ class Settings::ZonesController < ApplicationController # POST /settings/zones # POST /settings/zones.json def create - @shop = Shop.current_shop + @settings_zone = Zone.new(settings_zone_params) @settings_zone.shop_code =@shop.shop_code @settings_zone.created_by = current_login_employee.name diff --git a/app/controllers/transactions/credit_notes_controller.rb b/app/controllers/transactions/credit_notes_controller.rb index 6052e4b5..dac22d3e 100755 --- a/app/controllers/transactions/credit_notes_controller.rb +++ b/app/controllers/transactions/credit_notes_controller.rb @@ -6,7 +6,7 @@ class Transactions::CreditNotesController < ApplicationController # GET /transactions/sales # GET /transactions/sales.json def index - @shop = Shop.current_shop + @sources = [["All",''], ["Cashier","cashier"],["Quick Service","quick_service"],["Online Order","doemal_order"]] @customers = Customer.all diff --git a/app/controllers/transactions/order_reservations_controller.rb b/app/controllers/transactions/order_reservations_controller.rb index 6a5c3c60..3f035486 100644 --- a/app/controllers/transactions/order_reservations_controller.rb +++ b/app/controllers/transactions/order_reservations_controller.rb @@ -6,7 +6,7 @@ class Transactions::OrderReservationsController < ApplicationController # GET /transactions/order_reservations # GET /transactions/order_reservations.json def index - @shop = Shop.current_shop + from, to = get_date_range_from_params filter = params[:filter] diff --git a/app/controllers/transactions/orders_controller.rb b/app/controllers/transactions/orders_controller.rb index dbff1b43..59b5a106 100755 --- a/app/controllers/transactions/orders_controller.rb +++ b/app/controllers/transactions/orders_controller.rb @@ -3,7 +3,7 @@ class Transactions::OrdersController < ApplicationController before_action :check_user def index - @shop = Shop.current_shop + filter = params[:filter] from = params[:from] to = params[:to] diff --git a/app/controllers/transactions/sales_controller.rb b/app/controllers/transactions/sales_controller.rb index d8c2e120..13e617bb 100755 --- a/app/controllers/transactions/sales_controller.rb +++ b/app/controllers/transactions/sales_controller.rb @@ -89,7 +89,7 @@ class Transactions::SalesController < ApplicationController # GET /transactions/sales/1 # GET /transactions/sales/1.json def show - @membership = MembershipSetting.find_by_shop_code(Shop.current_shop.shop_code) + @membership = MembershipSetting.find_by_shop_code(@shop.shop_code) @payment_methods = PaymentMethodSetting.where("is_active='1'") @sale = Sale.find(params[:id]) @@ -346,7 +346,7 @@ class Transactions::SalesController < ApplicationController customer= Customer.find(sale.customer_id) #shop detail - shop_details = Shop.current_shop + shop_details = @shop # get member information rebate = MembershipSetting.find_by_rebate(1) if customer.membership_id != nil && rebate diff --git a/app/controllers/transactions/shift_sales_controller.rb b/app/controllers/transactions/shift_sales_controller.rb index 00442a30..e6565324 100644 --- a/app/controllers/transactions/shift_sales_controller.rb +++ b/app/controllers/transactions/shift_sales_controller.rb @@ -4,7 +4,7 @@ class Transactions::ShiftSalesController < ApplicationController before_action :check_user def index - @shop = Shop.current_shop + filter = params[:filter] from = params[:from] @@ -33,7 +33,7 @@ class Transactions::ShiftSalesController < ApplicationController # GET /transactions/shift_sales/1 # GET /transactions/shift_sales/1.json def show - @shop = Shop.current_shop + @shift = ShiftSale.find(params[:id]) #get tax diff --git a/app/controllers/transactions/surveys_controller.rb b/app/controllers/transactions/surveys_controller.rb index cc975810..6f90c040 100644 --- a/app/controllers/transactions/surveys_controller.rb +++ b/app/controllers/transactions/surveys_controller.rb @@ -1,6 +1,6 @@ class Transactions::SurveysController < ApplicationController def index - @shop = Shop.current_shop + filter = params[:filter] from = params[:from] to = params[:to] diff --git a/app/models/printer/printer_worker.rb b/app/models/printer/printer_worker.rb index 39cbb431..e0d4fc85 100755 --- a/app/models/printer/printer_worker.rb +++ b/app/models/printer/printer_worker.rb @@ -38,20 +38,20 @@ class Printer::PrinterWorker end def print(file_path,printer_destination = nil ) - # if printer_destination.nil? - # printer_destination = self.printer_destination - # end - # - # puts printer_destination - # puts '........Printer Destination..........' - # - # copy = self.print_copies - # #Print only when printer information is not null - # if !self.printer_destination.nil? - # (1..copy).each do - # page = Cups::PrintJob.new(file_path, printer_destination) - # page.print - # end - # end + if printer_destination.nil? + printer_destination = self.printer_destination + end + + puts printer_destination + puts '........Printer Destination..........' + + copy = self.print_copies + #Print only when printer information is not null + if !self.printer_destination.nil? + (1..copy).each do + page = Cups::PrintJob.new(file_path, printer_destination) + page.print + end + end end end diff --git a/app/views/foodcourt/orders/app_orders.html.erb b/app/views/foodcourt/orders/app_orders.html.erb index 09deb513..98c1f989 100644 --- a/app/views/foodcourt/orders/app_orders.html.erb +++ b/app/views/foodcourt/orders/app_orders.html.erb @@ -7,7 +7,6 @@ } <%= javascript_include_tag 'custom', 'data-turbolinks-track': 'reload' %> -<%= javascript_include_tag 'foodcourt', 'data-turbolinks-track': 'reload' %> <% if @booking.nil?%>