Given provision to enter write off and change amount on POS

This commit is contained in:
Rohit Waghchaure
2016-08-05 15:41:36 +05:30
parent c41ab8d15b
commit baef2624a2
12 changed files with 203 additions and 97 deletions

View File

@@ -617,8 +617,16 @@ erpnext.taxes_and_totals = erpnext.payments.extend({
},
calculate_write_off_amount: function(){
this.frm.set_value("write_off_amount",
flt(this.frm.doc.grand_total - this.frm.doc.paid_amount + this.frm.doc.change_amount,
precision("write_off_amount")));
if(this.frm.doc.paid_amount > this.frm.doc.grand_total){
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)
}
})