37 lines
742 B
Ruby
37 lines
742 B
Ruby
class Origami::ShiftsController < BaseOrigamiController
|
|
|
|
def index
|
|
end
|
|
|
|
def show
|
|
puts current_user.id
|
|
@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]
|
|
@shift = ShiftSale.new
|
|
@shift.create(opening_balance,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
|
|
end
|
|
end
|
|
|
|
|
|
def edit
|
|
end
|
|
end
|