request bill error on promotion. fix for compute sale's totals on promotion.
This commit is contained in:
@@ -4,9 +4,9 @@ class Origami::OtherChargesController < BaseOrigamiController
|
||||
def index
|
||||
@webview = false
|
||||
if check_mobile
|
||||
@webview = true
|
||||
@webview = true
|
||||
end
|
||||
|
||||
|
||||
sale_id = params[:sale_id]
|
||||
@cashier_type = params[:type]
|
||||
if Sale.exists?(sale_id)
|
||||
@@ -15,11 +15,11 @@ class Origami::OtherChargesController < BaseOrigamiController
|
||||
@table = DiningFacility.find(@sale_data.bookings[0].dining_facility_id)
|
||||
else
|
||||
@table = nil
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def create
|
||||
def create
|
||||
sale_id = params[:sale_id]
|
||||
other_charges_items = JSON.parse(params[:other_charges_items])
|
||||
sub_total = params[:sub_total]
|
||||
@@ -34,11 +34,11 @@ class Origami::OtherChargesController < BaseOrigamiController
|
||||
table_id = nil
|
||||
table = nil
|
||||
end
|
||||
|
||||
|
||||
|
||||
# sale.total_amount = sub_total.to_f
|
||||
# sale.grand_total = sub_total.to_f + sale.total_tax;
|
||||
# sale.save
|
||||
# sale.grand_total = sub_total.to_f + sale.total_tax;
|
||||
# sale.save
|
||||
if other_charges_items.length > 0
|
||||
#save sale item for discount
|
||||
other_charges_items.each do |di|
|
||||
@@ -68,18 +68,18 @@ class Origami::OtherChargesController < BaseOrigamiController
|
||||
else
|
||||
remark = "Add Other Charges - Receipt No #{sale.receipt_no} | Sale ID #{sale.sale_id} |Charges ->#{di["price"]} For ->#{di["name"]}- Table ->#{table.name}"
|
||||
end
|
||||
|
||||
|
||||
sale_audit = SaleAudit.record_audit_for_edit(sale.sale_id,sale.cashier_name, action_by,remark,"ADDOTHERCHARGES" )
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Re-calc All Amount in Sale
|
||||
sale.compute_by_sale_items(sale_id, sale.sale_items, sale.total_discount, nil, cashier_type)
|
||||
end
|
||||
sale.compute_by_sale_items(sale.total_discount, nil, cashier_type)
|
||||
end
|
||||
if !table.nil?
|
||||
dining = {:table_id => table_id, :table_type => table.type }
|
||||
render :json => dining.to_json
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user