Fix bugs and improvements

fix payment outstanding with amount <= 0
fix payment outstanding with other payments
This commit is contained in:
Thein Lin Kyaw
2019-12-18 15:41:18 +06:30
parent e6392c3bd4
commit 92e467d512
11 changed files with 122 additions and 217 deletions

View File

@@ -18,7 +18,7 @@ class Origami::RequestBillsController < ApplicationController
else
table = DiningFacility.find_by(id: booking.dining_facility_id)
if booking.sale.nil?
if booking.sale_id.nil?
if sale_data = Sale.generate_invoice_from_booking(booking, current_login_employee, current_user, order.source, params[:current_checkin_induties_count])
# in-duty update
in_duties = InDuty.where("booking_id=?", booking.id)
@@ -47,13 +47,11 @@ class Origami::RequestBillsController < ApplicationController
from = ""
end
if order.source == "cashier" || order.source == "quick_service"
ActionCable.server.broadcast "bill_channel",table: table, from: from
if ["quick_service", "cashier"].include? order.source
ActionCable.server.broadcast "bill_channel", table: table, from: from
end
if order.source == "quick_service" || order.source == "food_court"
result = {:status=> @status, :data => sale_data.sale_id }
render :json => result.to_json
else
unless ["quick_service", "food_court"].include? order.source
#check checkInOut pdf print
checkout_time = Lookup.collection_of('checkout_time')
if !booking.dining_facility_id.nil?
@@ -74,15 +72,24 @@ class Origami::RequestBillsController < ApplicationController
end
end
@status = true
sale_id = sale_data.sale_id
else
@status = false
sale_id = nil
end
else
@status = true
sale_id = booking.sale_id
end
end
else
@status = false
@error_message = "No Current Open Shift for This Employee"
end
if ["quick_service", "food_court"].include? order.source
result = {:status=> @status, :data => sale_data.sale_id }
render :json => result.to_json
end
end
end