2017-08-31 114 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); 
    } 
});