forked from frappe/erpnext
-
Notifications
You must be signed in to change notification settings - Fork 0
Script for Calculation Between Fields
umairsy edited this page Jan 17, 2013
·
7 revisions
Following the script used for a customer who needed system to calculate the amount of Down Payment after determining % of Down Payment. System needed to calculate the % of Grand Total and render the down payment amount. Following was the steps taken to achieve required customization.
- I inserted two custom field. One for determining % of down payment. Another for auto-calculation of down payment amount which will be (x/100 * grand total), where x = % of down payment.
- Wrote a following Custom Script:
cur_frm.cscript.down_payment_rate = function(doc, dt, dn) {
doc.down_payment = flt(doc.grand_total) * flt(doc.down_payment_rate) / 100.0;
refresh_field("down_payment");
};
Regards, ERPNext Team