@kinzang, You can add a custom fieldscore(0-100) to the child table to store the score out of 100 and add a custom script which would calculate the score on the basis of value entered in the score(0-5) field.
And, add another total_score field which would show you the total score on the basis of the score(0-100) in the child table.
Thanks @shreya115, but i want both (Out of 5) and (Out of 100). Just i want, Total score in (Out of 100), below (Total score Out of 5 field). don’t want to change Score(0-5) and Score Earned. Can you help me to write script.
@kinzang, You will have to add two fields in the child table, one which would show the score out of 100 on the basis of score out of 5. Another, which would show you the earned scores out of 100 on the basis of weightage. The total field in the form is based on the scores earned. So, the summation of the earned scores out of 100 will show you the total out of 100.
You can refer this file to write your custom script as per the custom fields you add.
cur_frm.cscript.calculate_total = function(doc,cdt,cdn){
var val = doc.goals || [];
var total =0;
for(var i = 0; i<val.length; i++){
total = flt(total)+flt(val[i].score_earned);
}
doc.total_score = flt(total);
refresh_field('total_score');
var total1=parseFloat(parseFloat(total)*100)/(val.length*5)
doc.total=total1
refresh_field('total');
}
cur_frm.cscript.calculate_total = function (doc, cdn, cdt){ var val = doc.goals || []; var total =0; for(var i = 0; i<val.length; i++){ total = flt(total)+flt(val[i].score_earned);
Remove Added Code From appraisal.js and Add code in custom script
-Search Custom Script in global search
-make new custom script
-select Appraisal in doctype
-put above code which i sent in script box
-save
-Go to Apprail Document Reload And Check
cur_frm.cscript.calculate_total = function(doc,cdt,cdn){
var val = doc.goals || [];
var total =0;
for(var i = 0; i<val.length; i++){
total = flt(total)+flt(val[i].score_earned);
}
doc.total_score = flt(total);
refresh_field('total_score');
var total1=parseFloat(parseFloat(total)*100)/(val.length*5)
doc.total=parseFloat(total1)
refresh_field('total');
}
try it and check browser console it’s working for me…