set paid amount with grand amount on invoice form
This commit is contained in:
parent
636acc2565
commit
88514a246b
@ -263,6 +263,10 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
amount: function(){
|
||||
this.write_off_outstanding_amount_automatically()
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -549,13 +549,6 @@ erpnext.taxes_and_totals = erpnext.payments.extend({
|
||||
if(this.frm.doc.doctype == "Sales Invoice" || this.frm.doc.doctype == "Purchase Invoice") {
|
||||
frappe.model.round_floats_in(this.frm.doc, ["paid_amount"]);
|
||||
|
||||
if(this.frm.doc.is_pos || this.frm.doc.is_paid) {
|
||||
if(!this.frm.doc.paid_amount || update_paid_amount===undefined || update_paid_amount) {
|
||||
this.frm.doc.paid_amount = flt(total_amount_to_pay);
|
||||
}
|
||||
} else {
|
||||
this.frm.doc.paid_amount = 0
|
||||
}
|
||||
this.set_in_company_currency(this.frm.doc, ["paid_amount"]);
|
||||
|
||||
if(this.frm.refresh_field){
|
||||
@ -564,6 +557,7 @@ erpnext.taxes_and_totals = erpnext.payments.extend({
|
||||
}
|
||||
|
||||
if(this.frm.doc.doctype == "Sales Invoice"){
|
||||
this.set_default_payment(total_amount_to_pay, update_paid_amount)
|
||||
this.calculate_paid_amount()
|
||||
}
|
||||
|
||||
@ -585,6 +579,19 @@ erpnext.taxes_and_totals = erpnext.payments.extend({
|
||||
this.calculate_change_amount()
|
||||
},
|
||||
|
||||
set_default_payment: function(total_amount_to_pay, update_paid_amount){
|
||||
var me = this;
|
||||
payment_status = true;
|
||||
if(this.frm.doc.is_pos && (!this.frm.doc.paid_amount || update_paid_amount===undefined || update_paid_amount)){
|
||||
$.each(this.frm.doc['payments'] || [], function(index, data){
|
||||
if(data.type == "Cash" && payment_status) {
|
||||
data.amount = total_amount_to_pay;
|
||||
payment_status = false;
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
calculate_paid_amount: function(){
|
||||
var me = this;
|
||||
var paid_amount = base_paid_amount = 0.0;
|
||||
|
@ -74,7 +74,7 @@ erpnext.payments = erpnext.stock.StockController.extend({
|
||||
this.highlight_selected_row()
|
||||
this.payment_val = 0.0
|
||||
if(this.frm.doc.outstanding_amount > 0 && flt(this.selected_mode.val()) == 0.0){
|
||||
//When user first tithis click on row
|
||||
//When user first time click on row
|
||||
this.payment_val = flt(this.frm.doc.outstanding_amount)
|
||||
this.selected_mode.val(format_number(this.payment_val, 2));
|
||||
this.update_paid_amount()
|
||||
|
Loading…
x
Reference in New Issue
Block a user