fix: Client side changes for POS Write off amount
(cherry picked from commit 2e33e748ea248acface128f759d3982635024399) # Conflicts: # erpnext/public/js/controllers/taxes_and_totals.js
This commit is contained in:
parent
f57f4af1d9
commit
d04d3038f5
@ -690,7 +690,12 @@ erpnext.taxes_and_totals = class TaxesAndTotals extends erpnext.payments {
|
||||
this.frm.doc.total_advance = flt(total_allocated_amount, precision("total_advance"));
|
||||
|
||||
this.calculate_outstanding_amount(update_paid_amount);
|
||||
<<<<<<< HEAD
|
||||
}
|
||||
=======
|
||||
this.calculate_write_off_amount();
|
||||
},
|
||||
>>>>>>> 2e33e748ea (fix: Client side changes for POS Write off amount)
|
||||
|
||||
is_internal_invoice() {
|
||||
if (['Sales Invoice', 'Purchase Invoice'].includes(this.frm.doc.doctype)) {
|
||||
@ -825,26 +830,28 @@ erpnext.taxes_and_totals = class TaxesAndTotals extends erpnext.payments {
|
||||
var grand_total = this.frm.doc.rounded_total || this.frm.doc.grand_total;
|
||||
var base_grand_total = this.frm.doc.base_rounded_total || this.frm.doc.base_grand_total;
|
||||
|
||||
this.frm.doc.change_amount = flt(this.frm.doc.paid_amount - grand_total +
|
||||
this.frm.doc.write_off_amount, precision("change_amount"));
|
||||
this.frm.doc.change_amount = flt(this.frm.doc.paid_amount - grand_total,
|
||||
precision("change_amount"));
|
||||
|
||||
this.frm.doc.base_change_amount = flt(this.frm.doc.base_paid_amount -
|
||||
base_grand_total + this.frm.doc.base_write_off_amount,
|
||||
precision("base_change_amount"));
|
||||
base_grand_total, precision("base_change_amount"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
calculate_write_off_amount(){
|
||||
if(this.frm.doc.paid_amount > this.frm.doc.grand_total){
|
||||
=======
|
||||
calculate_write_off_amount: function() {
|
||||
if (this.frm.doc.write_off_outstanding_amount_automatically) {
|
||||
>>>>>>> 2e33e748ea (fix: Client side changes for POS Write off amount)
|
||||
this.frm.doc.write_off_amount = flt(this.frm.doc.grand_total - this.frm.doc.paid_amount
|
||||
+ this.frm.doc.change_amount, precision("write_off_amount"));
|
||||
|
||||
this.frm.doc.base_write_off_amount = flt(this.frm.doc.write_off_amount * this.frm.doc.conversion_rate,
|
||||
precision("base_write_off_amount"));
|
||||
}else{
|
||||
this.frm.doc.paid_amount = 0.0;
|
||||
}
|
||||
|
||||
this.calculate_outstanding_amount(false);
|
||||
}
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user