Calculation based on Mathematical Formula, how to?

Hello All,

I want to do some calculations on ERPNext/Frappe. Something very similar to Mathematical Formulas, Input two values, and third value will be calculated by the system.

to_be_calculated = {(ab / cd) + (ef / gh)} * 50

I’m very newbie in writing codes, trying to write but fails every time. What I’m trying to do is: creating 4 new docfield, which is int/float(I tried both), where ab, cd, ef, gh is user input. And, to_be_calculated is the value which has to be calculated, so another docfield for this, is Read Only. I’m adding these docfields in Item Master Itself.

But, nothing working. Can someone write sample script, to achieve somewhat similar, so that I can learn and use it.

1 Like

Check code behind Salary Slip in HR module, maybe you would get some idea from there.

1 Like

Got it. Thankyou :slight_smile:

Let’s laugh first please !! Because, I’m going to ask some silly questions next. Request you not to laugh on that. hhaha.

Which one used in which specific condition function(frm, doc, dt, dn & many others), what’s actually they are? When we should use that?? Please simplify this puzzle for me. As I already said, I’m noob & learning.

In addition to this, same javscript file, contains cur_frm.cscript & frappe.ui.form.on. I noticed that, many custom client-side scripts, starts with cur_frm.cscript, so what condition uses for frappe.ui.form.on