Merge branch 'master' of bitbucket.org:code2lab/sxrestaurant into adminbsb_ui_changes

This commit is contained in:
phyusin
2017-11-17 18:26:27 +06:30
15 changed files with 295 additions and 463 deletions

View File

@@ -121,8 +121,9 @@ class Origami::CustomersController < BaseOrigamiController
if status == true
render json: JSON.generate({:status => true})
# Re-calc All Amount in Sale
sale.compute_by_sale_items(sale.sale_id, sale.sale_items, sale.total_discount)
if(id == "SAL")
sale.compute_by_sale_items(sale.sale_id, sale.sale_items, sale.total_discount)
end
else
render json: JSON.generate({:status => false, :error_message => "Record not found"})
end

View File

@@ -114,7 +114,8 @@ class Origami::DiscountsController < BaseOrigamiController
if Sale.exists?(sale_id)
sale = Sale.find(sale_id)
table_id = sale.bookings[0].dining_facility_id
table_type = DiningFacility.find(table_id).type
dining = DiningFacility.find(table_id)
table_type = dining.type
discount_items = []
#destroy all discount sale item
@@ -133,14 +134,14 @@ class Origami::DiscountsController < BaseOrigamiController
sale.sale_items.destroy(discount_items)
action_by = current_user.id
remark = "Remove Discount Sale Id [#{sale.sale_id}]| Receipt No #{sale.receipt_no} | Table- #{table.name} "
remark = "Remove Discount Sale Id [#{sale.sale_id}]| Receipt No #{sale.receipt_no} | Table- #{dining.name} "
sale_audit = SaleAudit.record_audit_discount(sale.sale_id,sale.cashier_id, action_by,remark,"REMOVEALLDISCOUNT" )
# Re-calc All Amount in Sale
sale.compute_by_sale_items(sale_id, sale.sale_items, 0)
result = {:status=> "Success", :table_id => table_id, :table_type => table_type }
result = {:status=> "Success", :table_id => table_id, :dining => dining.name, :table_type => table_type }
else
result = {:status=> "Please, Check Again!", :table_id => table_id, :table_type => table_type }
result = {:status=> "Please, Check Again!", :table_id => table_id, :dining => dining.name, :table_type => table_type }
end
render :json => result.to_json