add tax in charges
This commit is contained in:
@@ -19,6 +19,7 @@ class Origami::OtherChargesController < BaseOrigamiController
|
||||
sale_id = params[:sale_id]
|
||||
other_charges_items = JSON.parse(params[:other_charges_items])
|
||||
sub_total = params[:sub_total]
|
||||
cashier_type = params[:cashier_type]
|
||||
|
||||
if Sale.exists?(sale_id)
|
||||
sale = Sale.find(sale_id)
|
||||
@@ -68,7 +69,7 @@ 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, nil, cashier_type)
|
||||
end
|
||||
if !table.nil?
|
||||
dining = {:table_id => table_id, :table_type => table.type }
|
||||
|
||||
@@ -361,7 +361,6 @@ class Sale < ApplicationRecord
|
||||
end
|
||||
end
|
||||
|
||||
compute_tax(sale, total_taxable, total_discount, order_source)
|
||||
sale.total_amount = subtotal_price
|
||||
sale.total_discount = total_discount
|
||||
sale.grand_total = (sale.total_amount - sale.total_discount) + sale.total_tax
|
||||
@@ -372,8 +371,9 @@ class Sale < ApplicationRecord
|
||||
# adjust_rounding
|
||||
sale.rounding_adjustment = compute_adjust_rounding(sale.grand_total)
|
||||
|
||||
sale.save!
|
||||
compute_tax(sale, total_taxable, total_discount, order_source)
|
||||
|
||||
sale.save!
|
||||
end
|
||||
|
||||
# No Use too many wrong
|
||||
@@ -454,6 +454,7 @@ class Sale < ApplicationRecord
|
||||
# end
|
||||
end
|
||||
end
|
||||
|
||||
sale.total_tax = total_tax_amount
|
||||
end
|
||||
|
||||
|
||||
@@ -308,7 +308,7 @@ var cashier_type = "<%= @cashier_type %>";
|
||||
var other_charges_items = JSON.stringify(get_other_item_rows());
|
||||
var ajax_url = "/origami/" + sale_id + "/other_charges";
|
||||
|
||||
var params = { 'sale_id': sale_id, 'sub_total': sub_total, 'other_charges_items': other_charges_items };
|
||||
var params = { 'cashier_type' : cashier_type,'sale_id': sale_id, 'sub_total': sub_total, 'other_charges_items': other_charges_items };
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
|
||||
Reference in New Issue
Block a user