From 6a6b7eae292b0a91bf55188b2f0893cd39f4517b Mon Sep 17 00:00:00 2001 From: Aung Myo Date: Wed, 2 Aug 2017 16:58:34 +0630 Subject: [PATCH] update total tax when other charges --- .../origami/other_charges_controller.rb | 3 ++- app/models/sale.rb | 3 +-- app/views/origami/rooms/show.html.erb | 21 +++++++++++++++++++ 3 files changed, 24 insertions(+), 3 deletions(-) diff --git a/app/controllers/origami/other_charges_controller.rb b/app/controllers/origami/other_charges_controller.rb index b0e6472c..9b94781d 100644 --- a/app/controllers/origami/other_charges_controller.rb +++ b/app/controllers/origami/other_charges_controller.rb @@ -45,7 +45,8 @@ class Origami::OtherChargesController < BaseOrigamiController end # Re-calc All Amount in Sale - sale.compute_by_sale_items(sale_id, sale.sale_items, sale.total_discount) + # sale.compute_by_sale_items(sale_id, sale.sale_items, sale.total_discount) + sale.compute_without_void end dining = {:table_id => table_id, :table_type => table_type } diff --git a/app/models/sale.rb b/app/models/sale.rb index b23c630b..462c8c73 100644 --- a/app/models/sale.rb +++ b/app/models/sale.rb @@ -232,7 +232,6 @@ class Sale < ApplicationRecord end #compute rounding adjustment # adjust_rounding - sale.save! end @@ -315,7 +314,7 @@ class Sale < ApplicationRecord total_tax_amount = 0 #tax_profile - list by order_by tax_profiles = TaxProfile.all.order("order_by asc") - + # #Creat new tax records tax_profiles.each do |tax| sale_tax = SaleTax.new(:sale => self) diff --git a/app/views/origami/rooms/show.html.erb b/app/views/origami/rooms/show.html.erb index 2a069af9..27f73619 100644 --- a/app/views/origami/rooms/show.html.erb +++ b/app/views/origami/rooms/show.html.erb @@ -294,6 +294,7 @@ + @@ -304,6 +305,7 @@ + @@ -429,6 +431,25 @@ $(document).ready(function(){ return false; }); + // Add Other Charges + $('#other-charges').click(function() { + var sale = $('#sale_id').val(); + if (sale!="") { + var sale_id = sale + }else{ + var sale_id = $('#save_order_id').attr('data-order'); + } + + if(sale_id!=""){ + window.location.href = '/origami/' + sale_id + '/other_charges' + } + else { + alert("Please select an table!"); + } + + return false; + }); + }); // Print for first bill