在ERPNext中付款录入/收到未付金额

时间:2017-08-31 21:25:48

标签: javascript erpnext frappe

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

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

实际未决=优秀 - 已分配。

我已经用脚本工作超过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;

    });
});

我真的不确定,请帮忙

1 个答案:

答案 0 :(得分: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);
  }
});
相关问题