mirror of
https://github.com/frappe/erpnext.git
synced 2026-04-24 17:18:30 +00:00
fix(accounts): compute tax net_amount in JS controller
(cherry picked from commit 153ad99f85)
# Conflicts:
# erpnext/public/js/controllers/taxes_and_totals.js
This commit is contained in:
@@ -173,9 +173,21 @@ erpnext.taxes_and_totals = class TaxesAndTotals extends erpnext.payments {
|
|||||||
if (!tax.dont_recompute_tax) {
|
if (!tax.dont_recompute_tax) {
|
||||||
tax.item_wise_tax_detail = {};
|
tax.item_wise_tax_detail = {};
|
||||||
}
|
}
|
||||||
|
<<<<<<< HEAD
|
||||||
var tax_fields = ["total", "tax_amount_after_discount_amount",
|
var tax_fields = ["total", "tax_amount_after_discount_amount",
|
||||||
"tax_amount_for_current_item", "grand_total_for_current_item",
|
"tax_amount_for_current_item", "grand_total_for_current_item",
|
||||||
"tax_fraction_for_current_item", "grand_total_fraction_for_current_item"];
|
"tax_fraction_for_current_item", "grand_total_fraction_for_current_item"];
|
||||||
|
=======
|
||||||
|
var tax_fields = [
|
||||||
|
"net_amount",
|
||||||
|
"total",
|
||||||
|
"tax_amount_after_discount_amount",
|
||||||
|
"tax_amount_for_current_item",
|
||||||
|
"grand_total_for_current_item",
|
||||||
|
"tax_fraction_for_current_item",
|
||||||
|
"grand_total_fraction_for_current_item",
|
||||||
|
];
|
||||||
|
>>>>>>> 153ad99f85 (fix(accounts): compute tax net_amount in JS controller)
|
||||||
|
|
||||||
if (cstr(tax.charge_type) != "Actual" &&
|
if (cstr(tax.charge_type) != "Actual" &&
|
||||||
!(me.discount_amount_applied && me.frm.doc.apply_discount_on=="Grand Total")) {
|
!(me.discount_amount_applied && me.frm.doc.apply_discount_on=="Grand Total")) {
|
||||||
@@ -363,7 +375,7 @@ erpnext.taxes_and_totals = class TaxesAndTotals extends erpnext.payments {
|
|||||||
var item_tax_map = me._load_item_tax_rate(item.item_tax_rate);
|
var item_tax_map = me._load_item_tax_rate(item.item_tax_rate);
|
||||||
$.each(doc.taxes, function(i, tax) {
|
$.each(doc.taxes, function(i, tax) {
|
||||||
// tax_amount represents the amount of tax for the current step
|
// tax_amount represents the amount of tax for the current step
|
||||||
var current_tax_amount = me.get_current_tax_amount(item, tax, item_tax_map);
|
var [current_net_amount, current_tax_amount] = me.get_current_tax_amount(item, tax, item_tax_map);
|
||||||
if (frappe.flags.round_row_wise_tax) {
|
if (frappe.flags.round_row_wise_tax) {
|
||||||
current_tax_amount = flt(current_tax_amount, precision("tax_amount", tax));
|
current_tax_amount = flt(current_tax_amount, precision("tax_amount", tax));
|
||||||
}
|
}
|
||||||
@@ -380,6 +392,7 @@ erpnext.taxes_and_totals = class TaxesAndTotals extends erpnext.payments {
|
|||||||
if (tax.charge_type != "Actual" &&
|
if (tax.charge_type != "Actual" &&
|
||||||
!(me.discount_amount_applied && me.frm.doc.apply_discount_on=="Grand Total")) {
|
!(me.discount_amount_applied && me.frm.doc.apply_discount_on=="Grand Total")) {
|
||||||
tax.tax_amount += current_tax_amount;
|
tax.tax_amount += current_tax_amount;
|
||||||
|
tax.net_amount += current_net_amount;
|
||||||
}
|
}
|
||||||
|
|
||||||
// store tax_amount for current item as it will be used for
|
// store tax_amount for current item as it will be used for
|
||||||
@@ -494,11 +507,15 @@ erpnext.taxes_and_totals = class TaxesAndTotals extends erpnext.payments {
|
|||||||
current_tax_amount = tax_rate * item.qty;
|
current_tax_amount = tax_rate * item.qty;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
if (!tax.dont_recompute_tax) {
|
if (!tax.dont_recompute_tax) {
|
||||||
this.set_item_wise_tax(item, tax, tax_rate, current_tax_amount);
|
this.set_item_wise_tax(item, tax, tax_rate, current_tax_amount);
|
||||||
}
|
}
|
||||||
|
|
||||||
return current_tax_amount;
|
return current_tax_amount;
|
||||||
|
=======
|
||||||
|
return [current_net_amount, current_tax_amount];
|
||||||
|
>>>>>>> 153ad99f85 (fix(accounts): compute tax net_amount in JS controller)
|
||||||
}
|
}
|
||||||
|
|
||||||
set_item_wise_tax(item, tax, tax_rate, current_tax_amount) {
|
set_item_wise_tax(item, tax, tax_rate, current_tax_amount) {
|
||||||
@@ -532,7 +549,15 @@ erpnext.taxes_and_totals = class TaxesAndTotals extends erpnext.payments {
|
|||||||
}
|
}
|
||||||
|
|
||||||
tax.tax_amount = flt(tax.tax_amount, precision("tax_amount", tax));
|
tax.tax_amount = flt(tax.tax_amount, precision("tax_amount", tax));
|
||||||
|
<<<<<<< HEAD
|
||||||
tax.tax_amount_after_discount_amount = flt(tax.tax_amount_after_discount_amount, precision("tax_amount", tax));
|
tax.tax_amount_after_discount_amount = flt(tax.tax_amount_after_discount_amount, precision("tax_amount", tax));
|
||||||
|
=======
|
||||||
|
tax.net_amount = flt(tax.net_amount, precision("net_amount", tax));
|
||||||
|
tax.tax_amount_after_discount_amount = flt(
|
||||||
|
tax.tax_amount_after_discount_amount,
|
||||||
|
precision("tax_amount", tax)
|
||||||
|
);
|
||||||
|
>>>>>>> 153ad99f85 (fix(accounts): compute tax net_amount in JS controller)
|
||||||
}
|
}
|
||||||
|
|
||||||
round_off_base_values(tax) {
|
round_off_base_values(tax) {
|
||||||
|
|||||||
Reference in New Issue
Block a user