So it should go like this first all the features cost should be converted for monthly unit (if it is yearly divide cost by 12, if it is weekly multiply cost by 4.3)
and then sum them all up and show them in Feature sum cost field.
And finally add the additional cost and put it in total cost field.
If any one can help I would appreciate it.
I am beginner in ERPnext, learning it and also not good in java script so itâs a bit hard for me but still trying my best.
Thank you for your time.
Thank you @NCP for that but I am not able to understand much from it.
I have created
child table doctype = Feature list
Child table field names = feature_name, feature_cost, feature_currency, feature_unit
current doctype where i use child table = Plan
table filed name in Plan form = feature_id
field to get sum in = sum_cost
Thanks @NCP
It is working for me now.
I have other queries as well
I also want to be able to convert the feature_cost to monthly unit (check feature_unit if it is yearly divide feature_ cost by 12, if it is weekly multiply cost by 4.3)
And then do the adding of cost as you mentioned above
How can that be calculated?
I think, first add more custom field feature_id table like final_feature_ cost.
Set a calculation in the child table like when click feature_unit then divide calculation set in final_feature_ cost and then final_feature_ cost total set in sum_cost.
Hi @NCP I tried it I added script for child table and added a new field monthly_cost
But It is showing value 0
This is the script
frappe.ui.form.on(âFeature listâ, function(frm, cdt, cdn) {
var unit, cost;
unit = frm.doc.feature_unit;
cost = frm.doc.feature_cost;
if (unit === âweeklyâ) {
cost = cost * 4.3;
}
if (unit === âyearlyâ) {
cost = cost / 12;
}
frm.set_value(âmonthly_costâ,cost)
});
Can you help?
Thank you so much @NCP
Everything is working now.
Is there a way to update the sum_cost while we are adding features because the field is not visible while we are editing and is only visible once we hit save.