update no table quick srevice

This commit is contained in:
Aung Myo
2018-02-14 18:21:10 +06:30
parent 9757c34a09
commit 47ffc5fa51
12 changed files with 173 additions and 90 deletions

View File

@@ -6,7 +6,12 @@ class Origami::OtherChargesController < BaseOrigamiController
@cashier_type = params[:type]
if Sale.exists?(sale_id)
@sale_data = Sale.find(sale_id)
@table = DiningFacility.find(@sale_data.bookings[0].dining_facility_id)
if @sale_data.bookings[0].dining_facility_id.to_i > 0
@table = DiningFacility.find(@sale_data.bookings[0].dining_facility_id)
else
@table = nil
end
end
end
@@ -17,8 +22,14 @@ class Origami::OtherChargesController < BaseOrigamiController
if Sale.exists?(sale_id)
sale = Sale.find(sale_id)
table_id = sale.bookings[0].dining_facility_id
table = DiningFacility.find(table_id)
if sale.bookings[0].dining_facility_id.to_i > 0
table_id = sale.bookings[0].dining_facility_id
table = DiningFacility.find(table_id)
else
table_id = nil
table = nil
end
# sale.total_amount = sub_total.to_f
# sale.grand_total = sub_total.to_f + sale.total_tax;
@@ -45,7 +56,12 @@ class Origami::OtherChargesController < BaseOrigamiController
sale_item.save
action_by = current_user.id
remark = "Add Other Charges - Receipt No #{sale.receipt_no} | Sale ID #{sale.sale_id} |Charges ->#{di["price"]} For ->#{di["name"]}- Table ->#{table.name}"
if table.nil?
remark = "Add Other Charges - Receipt No #{sale.receipt_no} | Sale ID #{sale.sale_id} |Charges ->#{di["price"]} For ->#{di["name"]}- Table ->"
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_id, action_by,remark,"ADDOTHERCHARGES" )
end
@@ -54,9 +70,11 @@ class Origami::OtherChargesController < BaseOrigamiController
# Re-calc All Amount in Sale
sale.compute_by_sale_items(sale_id, sale.sale_items, sale.total_discount)
end
dining = {:table_id => table_id, :table_type => table.type }
if !table.nil?
dining = {:table_id => table_id, :table_type => table.type }
render :json => dining.to_json
end
end
#Shop Name in Navbor