fix(pos): taxes amount in pos item cart (#26410)

This commit is contained in:
Saqib 2021-07-09 18:09:26 +05:30 committed by GitHub
parent de4450aee9
commit 2098684bc0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -472,12 +472,7 @@ erpnext.PointOfSale.ItemCart = class {
const grand_total = cint(frappe.sys_defaults.disable_rounded_total) ? frm.doc.grand_total : frm.doc.rounded_total; const grand_total = cint(frappe.sys_defaults.disable_rounded_total) ? frm.doc.grand_total : frm.doc.rounded_total;
this.render_grand_total(grand_total); this.render_grand_total(grand_total);
const taxes = frm.doc.taxes.map(t => { this.render_taxes(frm.doc.taxes);
return {
description: t.description, rate: t.rate
};
});
this.render_taxes(frm.doc.total_taxes_and_charges, taxes);
} }
render_net_total(value) { render_net_total(value) {
@ -502,14 +497,14 @@ erpnext.PointOfSale.ItemCart = class {
); );
} }
render_taxes(value, taxes) { render_taxes(taxes) {
if (taxes.length) { if (taxes.length) {
const currency = this.events.get_frm().doc.currency; const currency = this.events.get_frm().doc.currency;
const taxes_html = taxes.map(t => { const taxes_html = taxes.map(t => {
const description = /[0-9]+/.test(t.description) ? t.description : `${t.description} @ ${t.rate}%`; const description = /[0-9]+/.test(t.description) ? t.description : `${t.description} @ ${t.rate}%`;
return `<div class="tax-row"> return `<div class="tax-row">
<div class="tax-label">${description}</div> <div class="tax-label">${description}</div>
<div class="tax-value">${format_currency(value, currency)}</div> <div class="tax-value">${format_currency(t.tax_amount_after_discount_amount, currency)}</div>
</div>`; </div>`;
}).join(''); }).join('');
this.$totals_section.find('.taxes-container').css('display', 'flex').html(taxes_html); this.$totals_section.find('.taxes-container').css('display', 'flex').html(taxes_html);