Hi paramvir
As a result of applying to the program as you commented,
there is a problem that the data of 'Total Production' and 'Total Shipment' are displayed,
but the data of 'Total Stock(Non VC)' and 'Total Stock(VC)' are not displayed.
I would really appreciate it if you could tell me how to solve it.
function calculateSummary(grid){
var sum_product_qty = Array.from({length: 42}, () => 0);
var sum_shipment_qty = Array.from({length: 42}, () => 0);
var sum_stock_vc_qty = Array.from({length: 42}, () => 0);
var sum_stock_qty = Array.from({length: 42}, () => 0);
var data = grid.option("dataModel.data");
var CM = grid.option("colModel");
var cd_wcop = CM[2].dataIndx;
var cd_kind = CM[15].dataIndx; // cd_kind (Day(0), Night(1), Shipment(2), Etc(3), Stock(4))
for(var i = 0; i < data.length; i++){
var row = data[i];
var cd_wcop9 = data[i][cd_wcop];
var cd_kind9 = data[i][cd_kind];
if(cd_kind9 < 2){
sum_product_qty[40] += (row['total_pre_month'] * 1);
sum_product_qty[41] += (row['total_this_month1'] * 1);
sum_product_qty[1] += (row['qty1'] * 1);
sum_product_qty[2] += (row['qty2'] * 1);
sum_product_qty[3] += (row['qty3'] * 1);
sum_product_qty[4] += (row['qty4'] * 1);
sum_product_qty[5] += (row['qty5'] * 1);
sum_product_qty[6] += (row['qty6'] * 1);
sum_product_qty[7] += (row['qty7'] * 1);
sum_product_qty[8] += (row['qty8'] * 1);
sum_product_qty[9] += (row['qty9'] * 1);
sum_product_qty[10] += (row['qty10'] * 1);
sum_product_qty[11] += (row['qty11'] * 1);
sum_product_qty[12] += (row['qty12'] * 1);
sum_product_qty[13] += (row['qty13'] * 1);
sum_product_qty[14] += (row['qty14'] * 1);
sum_product_qty[15] += (row['qty15'] * 1);
sum_product_qty[16] += (row['qty16'] * 1);
sum_product_qty[17] += (row['qty17'] * 1);
sum_product_qty[18] += (row['qty18'] * 1);
sum_product_qty[19] += (row['qty19'] * 1);
sum_product_qty[20] += (row['qty20'] * 1);
sum_product_qty[21] += (row['qty21'] * 1);
sum_product_qty[22] += (row['qty22'] * 1);
sum_product_qty[23] += (row['qty23'] * 1);
sum_product_qty[24] += (row['qty24'] * 1);
sum_product_qty[25] += (row['qty25'] * 1);
sum_product_qty[26] += (row['qty26'] * 1);
sum_product_qty[27] += (row['qty27'] * 1);
sum_product_qty[28] += (row['qty28'] * 1);
sum_product_qty[29] += (row['qty29'] * 1);
sum_product_qty[30] += (row['qty30'] * 1);
sum_product_qty[31] += (row['qty31'] * 1);
}
else if(cd_kind9 == 2){
sum_shipment_qty[40] += (row['total_pre_month'] * 1);
sum_shipment_qty[41] += (row['total_this_month1'] * 1);
sum_shipment_qty[1] += (row['qty1'] * 1);
sum_shipment_qty[2] += (row['qty2'] * 1);
sum_shipment_qty[3] += (row['qty3'] * 1);
sum_shipment_qty[4] += (row['qty4'] * 1);
sum_shipment_qty[5] += (row['qty5'] * 1);
sum_shipment_qty[6] += (row['qty6'] * 1);
sum_shipment_qty[7] += (row['qty7'] * 1);
sum_shipment_qty[8] += (row['qty8'] * 1);
sum_shipment_qty[9] += (row['qty9'] * 1);
sum_shipment_qty[10] += (row['qty10'] * 1);
sum_shipment_qty[11] += (row['qty11'] * 1);
sum_shipment_qty[12] += (row['qty12'] * 1);
sum_shipment_qty[13] += (row['qty13'] * 1);
sum_shipment_qty[14] += (row['qty14'] * 1);
sum_shipment_qty[15] += (row['qty15'] * 1);
sum_shipment_qty[16] += (row['qty16'] * 1);
sum_shipment_qty[17] += (row['qty17'] * 1);
sum_shipment_qty[18] += (row['qty18'] * 1);
sum_shipment_qty[19] += (row['qty19'] * 1);
sum_shipment_qty[20] += (row['qty20'] * 1);
sum_shipment_qty[21] += (row['qty21'] * 1);
sum_shipment_qty[22] += (row['qty22'] * 1);
sum_shipment_qty[23] += (row['qty23'] * 1);
sum_shipment_qty[24] += (row['qty24'] * 1);
sum_shipment_qty[25] += (row['qty25'] * 1);
sum_shipment_qty[26] += (row['qty26'] * 1);
sum_shipment_qty[27] += (row['qty27'] * 1);
sum_shipment_qty[28] += (row['qty28'] * 1);
sum_shipment_qty[29] += (row['qty29'] * 1);
sum_shipment_qty[30] += (row['qty30'] * 1);
sum_shipment_qty[31] += (row['qty31'] * 1);
}
else if(cd_kind9 == 4){
if(cd_wcop9 == "P165"){
sum_stock_vc_qty[40] += (row['total_pre_month'] * 1);
sum_stock_vc_qty[41] += (row['total_this_month1'] * 1);
sum_stock_vc_qty[1] += (row['qty1'] * 1);
sum_stock_vc_qty[2] += (row['qty2'] * 1);
sum_stock_vc_qty[3] += (row['qty3'] * 1);
sum_stock_vc_qty[4] += (row['qty4'] * 1);
sum_stock_vc_qty[5] += (row['qty5'] * 1);
sum_stock_vc_qty[6] += (row['qty6'] * 1);
sum_stock_vc_qty[7] += (row['qty7'] * 1);
sum_stock_vc_qty[8] += (row['qty8'] * 1);
sum_stock_vc_qty[9] += (row['qty9'] * 1);
sum_stock_vc_qty[10] += (row['qty10'] * 1);
sum_stock_vc_qty[11] += (row['qty11'] * 1);
sum_stock_vc_qty[12] += (row['qty12'] * 1);
sum_stock_vc_qty[13] += (row['qty13'] * 1);
sum_stock_vc_qty[14] += (row['qty14'] * 1);
sum_stock_vc_qty[15] += (row['qty15'] * 1);
sum_stock_vc_qty[16] += (row['qty16'] * 1);
sum_stock_vc_qty[17] += (row['qty17'] * 1);
sum_stock_vc_qty[18] += (row['qty18'] * 1);
sum_stock_vc_qty[19] += (row['qty19'] * 1);
sum_stock_vc_qty[20] += (row['qty20'] * 1);
sum_stock_vc_qty[21] += (row['qty21'] * 1);
sum_stock_vc_qty[22] += (row['qty22'] * 1);
sum_stock_vc_qty[23] += (row['qty23'] * 1);
sum_stock_vc_qty[24] += (row['qty24'] * 1);
sum_stock_vc_qty[25] += (row['qty25'] * 1);
sum_stock_vc_qty[26] += (row['qty26'] * 1);
sum_stock_vc_qty[27] += (row['qty27'] * 1);
sum_stock_vc_qty[28] += (row['qty28'] * 1);
sum_stock_vc_qty[29] += (row['qty29'] * 1);
sum_stock_vc_qty[30] += (row['qty30'] * 1);
sum_stock_vc_qty[31] += (row['qty31'] * 1);
}
else{
sum_stock_qty[40] += (row['total_pre_month'] * 1);
sum_stock_qty[41] += (row['total_this_month1'] * 1);
sum_stock_qty[1] += (row['qty1'] * 1);
sum_stock_qty[2] += (row['qty2'] * 1);
sum_stock_qty[3] += (row['qty3'] * 1);
sum_stock_qty[4] += (row['qty4'] * 1);
sum_stock_qty[5] += (row['qty5'] * 1);
sum_stock_qty[6] += (row['qty6'] * 1);
sum_stock_qty[7] += (row['qty7'] * 1);
sum_stock_qty[8] += (row['qty8'] * 1);
sum_stock_qty[9] += (row['qty9'] * 1);
sum_stock_qty[10] += (row['qty10'] * 1);
sum_stock_qty[11] += (row['qty11'] * 1);
sum_stock_qty[12] += (row['qty12'] * 1);
sum_stock_qty[13] += (row['qty13'] * 1);
sum_stock_qty[14] += (row['qty14'] * 1);
sum_stock_qty[15] += (row['qty15'] * 1);
sum_stock_qty[16] += (row['qty16'] * 1);
sum_stock_qty[17] += (row['qty17'] * 1);
sum_stock_qty[18] += (row['qty18'] * 1);
sum_stock_qty[19] += (row['qty19'] * 1);
sum_stock_qty[20] += (row['qty20'] * 1);
sum_stock_qty[21] += (row['qty21'] * 1);
sum_stock_qty[22] += (row['qty22'] * 1);
sum_stock_qty[23] += (row['qty23'] * 1);
sum_stock_qty[24] += (row['qty24'] * 1);
sum_stock_qty[25] += (row['qty25'] * 1);
sum_stock_qty[26] += (row['qty26'] * 1);
sum_stock_qty[27] += (row['qty27'] * 1);
sum_stock_qty[28] += (row['qty28'] * 1);
sum_stock_qty[29] += (row['qty29'] * 1);
sum_stock_qty[30] += (row['qty30'] * 1);
sum_stock_qty[31] += (row['qty31'] * 1);
}
}
}
var sum_product_data = {
info_item: "Total Production", total_pre_month: sum_product_qty[40], total_this_month1: sum_product_qty[41],
qty1: sum_product_qty[1], qty2: sum_product_qty[2], qty3: sum_product_qty[3], qty4: sum_product_qty[4], qty5: sum_product_qty[5],
qty6: sum_product_qty[6], qty7: sum_product_qty[7], qty8: sum_product_qty[8], qty9: sum_product_qty[9], qty10: sum_product_qty[10],
qty11: sum_product_qty[11], qty12: sum_product_qty[12], qty13: sum_product_qty[13], qty14: sum_product_qty[14], qty15: sum_product_qty[15],
qty16: sum_product_qty[16], qty17: sum_product_qty[17], qty18: sum_product_qty[18], qty19: sum_product_qty[19], qty20: sum_product_qty[20],
qty21: sum_product_qty[21], qty22: sum_product_qty[22], qty23: sum_product_qty[23], qty24: sum_product_qty[24], qty25: sum_product_qty[25],
qty26: sum_product_qty[26], qty27: sum_product_qty[27], qty28: sum_product_qty[28], qty29: sum_product_qty[29], qty30: sum_product_qty[30],
qty31: sum_product_qty[31]
};
var sum_shipment_data = {
info_item: "Total Shipment", total_pre_month: sum_shipment_qty[40], total_this_month1: sum_shipment_qty[41],
qty1: sum_shipment_qty[1], qty2: sum_shipment_qty[2], qty3: sum_shipment_qty[3], qty4: sum_shipment_qty[4], qty5: sum_shipment_qty[5],
qty6: sum_shipment_qty[6], qty7: sum_shipment_qty[7], qty8: sum_shipment_qty[8], qty9: sum_shipment_qty[9], qty10: sum_shipment_qty[10],
qty11: sum_shipment_qty[11], qty12: sum_shipment_qty[12], qty13: sum_shipment_qty[13], qty14: sum_shipment_qty[14], qty15: sum_shipment_qty[15],
qty16: sum_shipment_qty[16], qty17: sum_shipment_qty[17], qty18: sum_shipment_qty[18], qty19: sum_shipment_qty[19], qty20: sum_shipment_qty[20],
qty21: sum_shipment_qty[21], qty22: sum_shipment_qty[22], qty23: sum_shipment_qty[23], qty24: sum_shipment_qty[24], qty25: sum_shipment_qty[25],
qty26: sum_shipment_qty[26], qty27: sum_shipment_qty[27], qty28: sum_shipment_qty[28], qty29: sum_shipment_qty[29], qty30: sum_shipment_qty[30],
qty31: sum_shipment_qty[31]
};
var sum_stock_data = {
info_item: "Total Stock(Non VC)", total_pre_month: sum_stock_qty[40], total_this_month1: sum_stock_qty[41],
qty1: sum_stock_qty[1], qty2: sum_stock_qty[2], qty3: sum_stock_qty[3], qty4: sum_stock_qty[4], qty5: sum_stock_qty[5],
qty6: sum_stock_qty[6], qty7: sum_stock_qty[7], qty8: sum_stock_qty[8], qty9: sum_stock_qty[9], qty10: sum_stock_qty[10],
qty11: sum_stock_qty[11], qty12: sum_stock_qty[12], qty13: sum_stock_qty[13], qty14: sum_stock_qty[14], qty15: sum_stock_qty[15],
qty16: sum_stock_qty[16], qty17: sum_stock_qty[17], qty18: sum_stock_qty[18], qty19: sum_stock_qty[19], qty20: sum_stock_qty[20],
qty21: sum_stock_qty[21], qty22: sum_stock_qty[22], qty23: sum_stock_qty[23], qty24: sum_stock_qty[24], qty25: sum_stock_qty[25],
qty26: sum_stock_qty[26], qty27: sum_stock_qty[27], qty28: sum_stock_qty[28], qty29: sum_stock_qty[29], qty30: sum_stock_qty[30],
qty31: sum_stock_qty[31]
};
var sum_stock_vc_data = {
info_item: "Total Stock(VC)", total_pre_month: sum_stock_vc_qty[40], total_this_month1: sum_stock_vc_qty[41],
qty1: sum_stock_vc_qty[1], qty2: sum_stock_vc_qty[2], qty3: sum_stock_vc_qty[3], qty4: sum_stock_vc_qty[4], qty5: sum_stock_vc_qty[5],
qty6: sum_stock_vc_qty[6], qty7: sum_stock_vc_qty[7], qty8: sum_stock_vc_qty[8], qty9: sum_stock_vc_qty[9], qty10: sum_stock_vc_qty[10],
qty11: sum_stock_vc_qty[11], qty12: sum_stock_vc_qty[12], qty13: sum_stock_vc_qty[13], qty14: sum_stock_vc_qty[14], qty15: sum_stock_vc_qty[15],
qty16: sum_stock_vc_qty[16], qty17: sum_stock_vc_qty[17], qty18: sum_stock_vc_qty[18], qty19: sum_stock_vc_qty[19], qty20: sum_stock_vc_qty[20],
qty21: sum_stock_vc_qty[21], qty22: sum_stock_vc_qty[22], qty23: sum_stock_vc_qty[23], qty24: sum_stock_vc_qty[24], qty25: sum_stock_vc_qty[25],
qty26: sum_stock_vc_qty[26], qty27: sum_stock_vc_qty[27], qty28: sum_stock_vc_qty[28], qty29: sum_stock_vc_qty[29], qty30: sum_stock_vc_qty[30],
qty31: sum_stock_vc_qty[31]
};
return [sum_product_data, sum_shipment_data, sum_stock_data, sum_stock_vc_data];
}
;