Recommend this page to a friend! |
List processor | > | All threads | > | total sum of the column | > | (Un) Subscribe thread alerts |
|
![]() Mr. Prakash Khanchandan
It is very useful to create reports with total and other function. I have tried to connect to database and generate the reports. But I could not sum(total) the column. Because I have added more column. it will show total of two column that means total value. where should do change in class file? Pls help me Sr#Code Name SO No Rate S.Qty RTN Qty Balance 1 0018 BOON TRADING CO 20130105 2.90 230 147 240.70 2 0018 BOON TRADING CO 20130112 2.90 180 148 92.80 3 0018 BOON TRADING CO 20130119 2.90 180 143 107.30 4 0018 BOON TRADING CO 20130126 2.90 180 0 522.00 5 0018 BOON TRADING CO 20130202 2.90 180 0 522.00 6 0018 BOON TRADING CO 20130209 2.90 180 0 522.00 7 0018 BOON TRADING CO 20130216 2.90 180 0 522.00 8 0018 BOON TRADING CO 20130223 2.90 180 0 522.00 9 0018 BOON TRADING CO 20130302 2.90 180 0 522.00 100018 BOON TRADING CO 20130309 2.90 180 0 522.00 110018 BOON TRADING CO 20130316 2.90 180 0 522.00 120018 BOON TRADING CO 20130323 2.90 120 0 348.00 2,150 438 Thank you Regards Maideen
![]() Mr.Maideen,
For the data that you have given in your post, the list processor will output the totals without any change. It works just fine. At the end of this post, I paste the modified controlDemo.php which is tailored for your data. Note line#32 where I have asked for totals of columns 4 and 5 depending on change of column 0 which is "0018" which doesn't change. Since you don't want totals for the 6th column, it has not been included in line#32. I also paste the getMaideenAbdulKaderData() function which you can add to the getData.php script for your test. I wish there was a way for me to attach a picture grab in this reply where I could show the system generate the totals that you wanted. However, I realize from your post that the list processor should have a facility to generate column totals even without any control column. I will try and do that for the next version. Thank you for the idea. Regards. Prakash function getMaideenAbdulKaderData() { $data[] = array("0018", "BOON TRADING CO", 20130105, 2.90, 230, 147, 240.70); $data[] = array("0018", "BOON TRADING CO", 20130112, 2.90, 180, 148, 92.80); $data[] = array("0018", "BOON TRADING CO", 20130119, 2.90, 180, 143, 107.30); $data[] = array("0018", "BOON TRADING CO", 20130126, 2.90, 180, 0, 522.00); $data[] = array("0018", "BOON TRADING CO", 20130202, 2.90, 180, 0, 522.00); $data[] = array("0018", "BOON TRADING CO", 20130209, 2.90, 180, 0, 522.00); $data[] = array("0018", "BOON TRADING CO", 20130216, 2.90, 180, 0, 522.00); $data[] = array("0018", "BOON TRADING CO", 20130223, 2.90, 180, 0, 522.00); $data[] = array("0018", "BOON TRADING CO", 20130302, 2.90, 180, 0, 522.00); $data[] = array("0018", "BOON TRADING CO", 20130309, 2.90, 180, 0, 522.00); $data[] = array("0018", "BOON TRADING CO", 20130316, 2.90, 180, 0, 522.00); $data[] = array("0018", "BOON TRADING CO", 20130323, 2.90, 120, 0, 348.00); return $data; } <?php /** * @author Prakash Khanchandani * @copyright 2013 * @program controlDemo.php * demo for the control totals feature of the list processor: * given an array, generate an html table with the contents from the array */ require_once "listPrcsr.php"; // the list processor class require_once "getData.php"; // functions to generate data for the demo $data = getMaideenAbdulKaderData(); // get the data to be displayed /* create a descriptive array for the data. Consult basicDemo.php for an explanation of the array. */ $des[] = array("Code", "L", "Y", "N", ""); $des[] = array("Name", "L", "Y", "N", ""); $des[] = array("SO No", "L", "Y", "N", ""); $des[] = array("Rate", "R", "Y", "N", "", 2); $des[] = array("S.Qty", "R", "Y", "N", "", 2); $des[] = array("RTN Qty", "R", "Y", "N", "", 2); $des[] = array("Balance", "R", "Y", "N", "", 2); $cntrl[] = array(0, 4, 5); $lp = new listPrcsr(); // instantiate the class $lp->data = $data; // put in the data to be displayed $lp->des = $des; // supply the descriptor for the data $lp->opt = "N"; // this is a plain display, without any hyperlinks $lp->max = 0; // display the full list, without any pagination $lp->cntrlId = $cntrl; // put in the controls information $lp->moneyFormat = "R"; $out = $lp->gnrtOutput(); // generate the output ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1"> <meta name="author" content="Prakash Khanchandani"> <title>list processor</title> <link rel="stylesheet" type="text/css" href="pmk.css"> </head> <body> <div id="wrapper"> <div id="lftHdr"></div> <div id="mdlHdr"><h1><?php echo 'List Processor - Generate control totals'; ?></h1></div> <div id="rtHdr"></div> <div id="dummyClearDiv"></div> <div id="lftCol"><?php include "inc2.inc"; ?></div> <div id="mdlCol"> <?php echo $out; ?> </div> <div id="rtCol"> </div> <div id="dummyClearDiv"></div> <div class="push"></div> </div> <div class="footer"> <div style="float:left; width:33%; text-align:left;">controlDemo.php</div> <div style="float:left; width:34%; text-align:center;">List Processor</div> <div style="float:left; width:33%; text-align:right;">Prakash Khanchandani</div> </div> </body> </html> |
info at phpclasses dot org
.