2017-08-31 113 views
0

我可能不完全了解它,但我认为付款输入/收款需要在ERPNext中简化。当前的高级付款用例不适用于客户的部分付款。付款条目应具有提交付款时的准确金额字段,或未付金额应扣除刚分配的金额。也许是另一天的话题。ERP中的付款输入/收据未付金额下一个

我已将付款条目打印格式转换为付款收据。对于部分付款,我需要在付款分配后获得实际未清余额:

实际未清=未清 - 已分配。

我一直在辛辛苦苦脚本超过24小时,所有我得到的是付款输入文件类型中的空白字段。我可以手动设置它,但我需要它自动更新,以便用户不会犯错误。

我会感激的帮助。

the new outstanding field

print format with outstanding amount manually set from form

继承人我的脚本:

//update custom Outstanding currency type field within Payment Entry DocType 
frappe.ui.form.on("Payment Entry", "validate", function(frm) { 
    $.each(frm.doc.references || [], function(i, d) { 

     // calculate using PE references table fields 
     frm.doc.Outstanding= d.outstanding - d.allocated; 

    }); 
}); 

我真的不知道在这里,请帮助

回答

0

这个脚本做到了:

//calculating a new outstanding amount as paid amount is entered. 
//The old outstanding amount is pulled from the Payment Entry References (child) table. 
frappe.ui.form.on("Payment Entry", { base_paid_amount: function(frm) { 
    var outstanding = 0;  
    var tot_outstanding = 0; 
    // add table's outstanding values 
    $.each(frm.doc.references, function(index, row){ 
     tot_outstanding += row.outstanding_amount; 
    }); 
    outstanding = tot_outstanding - frm.doc.base_paid_amount; //subtract paid amount 
    frm.set_value("outstanding", outstanding); 
    } 
});