Automatic additional of charges when making Payments from POs/PIs/etcs

[code]frappe.ui.form.on(“Journal Entry”,“onload”,function(frm, cdt, cdn){
if (frm.doc.voucher_type == “Bank Entry” && frm.doc.modified == null) {
var rows = [
{“account”:“Bank charges and interest - GSPL”,“debit_in_account_currency”:0.20}
], total = 0;

for (var i=0, l=rows.length; i < l; i++) {
total += rows[i][“debit_in_account_currency”];
frm.doc.accounts[1].credit += total;
frm.doc.accounts[1].credit_in_account_currency += total;

This would be my first contribution back to ERPNext ever since I been using it for 3 months now. I would totally be willing to sponsor some major apps idea if I had the money xD. ERPNext definitely deserves more press for the flexibility, user friendliness and modularity.

This script is useful in cases where, if purchasing goods, there are separate charges that are not payable to the seller, e.g. Bank transfer charges or standard import charges.

Just change this line to your respective account and amount payable:

{"account":"Bank charges and interest - GSPL","debit_in_account_currency":0.20}

You can duplicate the line for more charges like:

{"account":"Bank charges and interest - GSPL","debit_in_account_currency":0.20},
{"account":"Money grabbing customs account - GSPL","debit_in_account_currency":50}

I am still fairly new and learning the API, I welcome any script improvement tips.

P.S. It would be nice if there is a new category specially for user contributed scripts. Maybe “Community Scripts”?

1 Like

yes a collection of client side Java scripts would be great