class Origami::ShiftsController < BaseOrigamiController def index end def show @shift = ShiftSale.current_open_shift(current_user.id) end def new @float = Lookup.where('lookup_type=?','float_value') @terminal = CashierTerminal.all end def create opening_balance = params[:opening_balance] cashier_terminal = params[:cashier_terminal] @shift = ShiftSale.new @shift.create(opening_balance,cashier_terminal, current_user) end def update_shift closing_balance = params[:closing_balance] shift_id = params[:shift_id] @shift = ShiftSale.find_by_id(shift_id) if @shift @shift.shift_closed_at = DateTime.now.utc @shift.closing_balance = closing_balance.to_f @shift.save unique_code = "CloseCashierPdf" shop_details = Shop.find(1) #get tax shift_obj = ShiftSale.where('id =?',@shift.id) @sale_taxes = Sale.get_separate_tax(shift_obj,from=nil,to=nil,type='') puts @sale_taxes.to_a puts @sale_taxes puts @sale_taxes.to_json puts "taxxxxxxxxxxxx" # get printer info print_settings=PrintSetting.find_by_unique_code(unique_code) printer = Printer::CashierStationPrinter.new(print_settings) printer.print_close_cashier(print_settings,@shift,shop_details,@sale_taxes) end Employee.logout(session[:session_token]) session[:session_token] = nil end def edit end def sale_summary @shift = ShiftSale.current_open_shift(current_user.id) end end