From 4c69c1d5d2d3a8adddeda90fa742fe29cdec4557 Mon Sep 17 00:00:00 2001 From: yarzar_code Date: Tue, 14 Jan 2020 14:21:46 +0630 Subject: [PATCH] Print close cashier --- app/controllers/home_controller.rb | 2 +- app/controllers/origami/payments_controller.rb | 2 +- app/controllers/origami/shifts_controller.rb | 2 +- app/models/sale.rb | 4 ++-- app/views/home/dashboard.html.erb | 2 +- app/views/layouts/_header.html.erb | 8 +++++++- 6 files changed, 13 insertions(+), 7 deletions(-) diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb index dcf31a36..0da2bbf5 100755 --- a/app/controllers/home_controller.rb +++ b/app/controllers/home_controller.rb @@ -100,7 +100,7 @@ class HomeController < ApplicationController @sales = Sale.receipt_date_between(@from, @to).completed if current_user.present? && !(current_user.role == 'administrator' || current_user.role == 'manager' || current_user.role == 'account' || current_user.role == 'supervisor') - if shift = ShiftSale.current_open_shift(current_user.id) + if shift = ShiftSale.current_open_shift(current_user) @orders = @orders.where(shift_sale_id: shift.id) @sales = @sales.where(shift_sale_id: shift.id) end diff --git a/app/controllers/origami/payments_controller.rb b/app/controllers/origami/payments_controller.rb index 7951c348..a5b38db2 100755 --- a/app/controllers/origami/payments_controller.rb +++ b/app/controllers/origami/payments_controller.rb @@ -192,7 +192,7 @@ class Origami::PaymentsController < BaseOrigamiController end #card_balance amount for Paymal payment - card_balance_amount = SaleAudit.getCardBalanceAmount(sale_id) + card_balance_amount,transaction_ref = SaleAudit.getCardBalanceAmount(sale_id) # get printer info print_settings = PrintSetting.find_by_unique_code(unique_code) diff --git a/app/controllers/origami/shifts_controller.rb b/app/controllers/origami/shifts_controller.rb index 8b7bdf91..bbe2cf57 100755 --- a/app/controllers/origami/shifts_controller.rb +++ b/app/controllers/origami/shifts_controller.rb @@ -126,7 +126,7 @@ class Origami::ShiftsController < BaseOrigamiController if find_close_cashier_print[0][1].to_i > 0 - printer.print_close_cashier(print_settings,cashier_terminal,current_shop, @sale_items, @total_other_charges_info, current_shop,@sale_taxes,@other_payment,@total_amount_by_account,@total_discount_by_account,@total_member_discount,@total_dinein,@total_takeway,@total_other_charges,@total_waste,@total_spoile,@total_credit_payments) + printer.print_close_cashier(print_settings,cashier_terminal, @shift, @sale_items, @total_other_charges_info, current_shop,@sale_taxes,@other_payment,@total_amount_by_account,@total_discount_by_account,@total_member_discount,@total_dinein,@total_takeway,@total_other_charges,@total_waste,@total_spoile,@total_credit_payments) end end end diff --git a/app/models/sale.rb b/app/models/sale.rb index 74460cdf..c2faae54 100644 --- a/app/models/sale.rb +++ b/app/models/sale.rb @@ -1496,7 +1496,7 @@ end end if current_user.present? && !(current_user.role == 'administrator' || current_user.role == 'manager' || current_user.role == 'account' || current_user.role == 'supervisor') - if shift = ShiftSale.current_open_shift(current_user.id) + if shift = ShiftSale.current_open_shift(current_user) query = query.where("shift_sale_id='#{shift.id}'") end @@ -1523,7 +1523,7 @@ end end if current_user.present? && !(current_user.role == 'administrator' || current_user.role == 'manager' || current_user.role == 'account' || current_user.role == 'supervisor') - if shift = ShiftSale.current_open_shift(current_user.id) + if shift = ShiftSale.current_open_shift(current_user) query = query.where("shift_sale_id='#{shift.id}'") end end diff --git a/app/views/home/dashboard.html.erb b/app/views/home/dashboard.html.erb index 71f7398a..4cb3bde2 100755 --- a/app/views/home/dashboard.html.erb +++ b/app/views/home/dashboard.html.erb @@ -347,7 +347,7 @@ <% end %> <% end %> - <% if isMobile.include? "Mobile" %> + <% if isMobile.to_s.include? "Mobile" %>
diff --git a/app/views/layouts/_header.html.erb b/app/views/layouts/_header.html.erb index ab91b06f..e3bba515 100755 --- a/app/views/layouts/_header.html.erb +++ b/app/views/layouts/_header.html.erb @@ -19,8 +19,14 @@ <% if current_login_employee.role == "administrator" || current_login_employee.role == "manager" || current_login_employee.role == "account" %> - <% elsif current_login_employee.role == "supervisor" || current_login_employee.role == "cashier" || current_login_employee.role == "waiter" %> + <% elsif current_login_employee.role == "supervisor" %> + <% elsif current_login_employee.role == "cashier" || current_login_employee.role == "waiter"%> + <%if ShiftSale.current_open_shift(current_login_employee) %> + + <%else%> + + <%end%> <%else%> <% end %>