shop code

This commit is contained in:
Myat Zin Wai Maw
2019-11-22 18:24:02 +06:30
parent 5a3f328789
commit d1ab2c194d
106 changed files with 834 additions and 895 deletions

View File

@@ -10,33 +10,32 @@ class Origami::CashInsController < BaseOrigamiController
payment_method_reference = params[:payment_method_reference]
type = params[:type]
p_jour = PaymentJournal.new
p_jour.cash_in(reference, remark, amount, payment_method, payment_method_reference, current_user.id)
shift = ShiftSale.current_open_shift(current_user.id)
current_shift = ShiftSale.current_shift
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.shop_code)
# set cashier
if shift != nil
shift = shift
else
open_cashier = Employee.where("role = 'cashier' AND token_session <> ''")
open_cashier = Employee.where("shop_code='#{@shop.shop_code}' and role = 'cashier' AND token_session <> ''")
if open_cashier.count>0
shift = ShiftSale.current_open_shift(open_cashier[0].id)
shift = ShiftSale.current_open_shift(open_cashier[0])
if shift
shift = ShiftSale.current_open_shift(shift.id)
else
shift = ShiftSale.current_open_shift(current_shift.id)
end
else
shift = Employee.find(current_shift.employee_id).name
end
emp = Employee.find_by_id(shift.employee_id)
shift = ShiftSale.current_open_shift(emp)
else
shift = ShiftSale.current_open_shift(current_shift)
end
else
# shift = Employee.find(current_shift.employee_id).name
shift =current_shift
end
end
puts shift.to_json
shift.cash_in = shift.cash_in + amount.to_f
shift.save
end
end