control to req bill and discount ui update

This commit is contained in:
Yan
2017-07-08 23:29:31 +06:30
parent 1666cb3d0c
commit c73cfa4c2d
6 changed files with 207 additions and 82 deletions

View File

@@ -49,11 +49,14 @@ class Origami::DiscountsController < BaseOrigamiController
end
# Re-calc All Amount in Sale
sale.compute_by_sale_items(sale_id, sale.sale_items, overall_discount.to_f)
sale.compute_by_sale_items(sale_id, sale.sale_items, overall_discount.to_f)
result = {:status=> "Success", :table_id => table_id, :table_type => table_type }
else
result = {:status=> "Please, Check Again!", :table_id => table_id, :table_type => table_type }
end
dining = {:table_id => table_id, :table_type => table_type }
render :json => dining.to_json
render :json => result.to_json
end
# Remove selected discount Items
@@ -78,11 +81,12 @@ class Origami::DiscountsController < BaseOrigamiController
# sale.save
# Re-calc All Amount in Sale
sale.compute_by_sale_items(sale_id, sale.sale_items, sale.total_discount)
end
result = {:status=> "Success", :table_id => table_id, :table_type => table_type }
else
result = {:status=> "Please, Check Again!", :table_id => table_id, :table_type => table_type }
end
dining = {:table_id => table_id, :table_type => table_type }
render :json => dining.to_json
render :json => result.to_json
end
# Remove all discount Items
@@ -108,11 +112,12 @@ class Origami::DiscountsController < BaseOrigamiController
# Re-calc All Amount in Sale
sale.compute_by_sale_items(sale_id, sale.sale_items, 0)
end
result = {:status=> "Success", :table_id => table_id, :table_type => table_type }
else
result = {:status=> "Please, Check Again!", :table_id => table_id, :table_type => table_type }
end
dining = {:table_id => table_id, :table_type => table_type }
render :json => dining.to_json
render :json => result.to_json
end
#discount for selected order