VINOTH
1
I need a help!
@NCP
I need to add the entire row value which is named as qgcbm and print in QG. CBM
The child table doctype name is: Block confirmation
The parent name is : value
The result should be in QG. CBM is 30.6889
This what I have tried,
let QG_CBM = 0;
frappe.ui.form.on(‘value’, {
qgcbm: function(frm,cdt,cdn){
var d = localStorage[cdt][cdn];
frappe.model.set_value(cdt,cdn,(QG_CBM + d.qgcbm));
}
});
VINOTH
3
Hi, @NCP
If, you don’t mind Can you help me out in my case. Am new to this one.
NCP
4
block_confirmation = table field name in value doctype
d.qgcbm = child table field name
frm.doc.qg_cbm = value doctype QB CBM field name
Please check all value in your doctype and set it.
frappe.ui.form.on('value', {
validate: function(frm) {
var ttl_qg_cbm = 0;
$.each(frm.doc.block_confirmation, function(i, d) {
ttl_qg_cbm += flt(d.qgcbm);
});
frm.doc.qg_cbm = ttl_qg_cbm;
}
});
Learning to check it documentation.
https://frappeframework.com/docs/v14/user/en/api/form
https://frappeframework.com/docs/v14/user/en/desk/scripting/client-script
https://docs.erpnext.com/docs/v14/user/manual/en/customize-erpnext/client-scripts
Thank You!
1 Like
VINOTH
5
Thanks a lot, but the final value is not update it’s showing as 0.
NCP
6
Please go to the doctype and check your field name.
When you save the doctype then automatically total will set in QG. CBM.
1 Like
VINOTH
7
The field name are,
Doctype value:
VINOTH
8
Doctype: Block Confirmation.
NCP
9
Please apply it.
Please Float field type set in qgcbm and also Float field type set in qg_cbm
Then total will calculate.
frappe.ui.form.on('value', {
validate: function(frm) {
var ttl_qg_cbm = 0;
$.each(frm.doc.table_1, function(i, d) {
ttl_qg_cbm += flt(d.qgcbm);
});
frm.doc.qg_cbm = ttl_qg_cbm;
}
});
Then reload your system (Ctrl + Shift + R).
When you save the doctype then automatically total will set in QG. CBM.
Thank You!
1 Like
VINOTH
10
Thanks a lot @NCP .
Thanks for pulling me out of this. Really thanks for you help.