/*** Function: add the kdtable * @ Param fields * columns to be aggregated */public static void apendfootrow (kdtable table, string fields []) {int size = fields. length; If (size = 0) return; Map sumvalue = new hashmap (); // The rows from getrowcount may be incorrect. Int COUNT = table. getrowcount3 (); For (INT I = 0; I <fields. length; I ++) {sumvalue. put (fields [I], new bigdecimal ("0.00");} irow footrow = NULL; kdtfootma Nager footmanager = table. getfootmanager (); If (footmanager = NULL) {footmanager = new kdtfootmanager (table); footmanager. addfootview (); table. setfootmanager (footmanager);} // calculates the total value of all specified rows. footrow = footmanager. getfootrow (0); For (INT I = 0; I <count; I ++) {irow ROW = table. getrow (I); For (Int J = 0; j <fields. length; j ++) {sumvalueforcell (row, fields [J], sumvalue) ;}} if (footrow = NULL) {Footrow = footmanager. addfootrow (0);} // set the display style of the total rows string colformat = "% {0.00} f"; string Total = easresource. getstring (frameworkclientutils. strresource + "msg_total"); table. getindexcolumn (). setwidthadjustmode (kdtindexcolumn. width_manual); table. getindexcolumn (). setwidth (30); footmanager. addindextext (0, total); footrow. getstyleattributes (). setbackground (new color (0xf6, 0xf6, 0xbf); For (INT I = 0; I <size; I ++) {string colname = Fields [I]; footrow. getcell (colname ). getstyleattributes (). setnumberformat (colformat); footrow. getcell (colname ). getstyleattributes (). sethorizontalalign (horizontalalignment. right); footrow. getcell (colname ). getstyleattributes (). setfontcolor (color. black);} // set the value of the total row for (INT I = 0; I <fields. length; I ++) {footrow. getcell (fields [I]). setvalue (sumvalue. get (FIE LDS [I]) ;}} Private Static void sumvalueforcell (irow row, string key, map sumvalue) {icell cell = row. getcell (key); If (cell! = NULL) {object OBJ = cell. getvalue (); If (OBJ! = NULL) {bigdecimal keyValue = (bigdecimal) sumvalue. get (key); keyValue = keyValue. add (New bigdecimal (obj. tostring (); sumvalue. put (Key, keyValue );}}}