update total tax when other charges

This commit is contained in:
Aung Myo
2017-08-02 16:58:34 +06:30
parent da5dfa1853
commit 6a6b7eae29
3 changed files with 24 additions and 3 deletions

View File

@@ -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 }

View File

@@ -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)

View File

@@ -294,6 +294,7 @@
<button type="button" id="customer" class="btn btn-primary btn-block" disabled>Customer</button>
<button type="button" class="btn btn-primary btn-block" disabled >Edit</button>
<button type="button" id="discount" class="btn btn-primary btn-block" disabled >Discount</button>
<button type="button" id="other-charges" class="btn btn-primary btn-block" disabled>Charges</button>
<button type="button" class="btn btn-primary btn-block" id='move'>Move</button>
<button type="button" id="request_bills" class="btn btn-primary btn-block">Req.Bill</button>
<button type="button" id="first_bill" class="btn btn-primary btn-block" disabled>First Bill</button>
@@ -304,6 +305,7 @@
<button type="button" id="customer" class="btn btn-primary btn-block" >Customer</button>
<button type="button" class="btn btn-primary btn-block" id='edit'>Edit</button>
<button type="button" id="discount" class="btn btn-primary btn-block" >Discount</button>
<button type="button" id="other-charges" class="btn btn-primary btn-block" >Charges</button>
<button type="button" class="btn btn-primary btn-block" id='move' disabled="">Move</button>
<button type="button" id="request_bills" class="btn btn-primary btn-block" disabled> Req.Bill</button>
<button type="button" id="first_bill" class="btn btn-primary btn-block">First Bill</button>
@@ -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