PHP Classes

File: columnTotals.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in Bookmark in
  Classes of Prakash Khanchandani  >  List processor  >  columnTotals.php  >  Download  
File: columnTotals.php
Role: Example script
Content type: text/plain
Description: example for column totals
Class: List processor
List data from arrays in HTML tables
Author: By
Last change:
Date: 2 years ago
Size: 1,669 bytes


Class file image Download

 * @author Prakash Khanchandani
 * @copyright 2013
 * @program columnTotals.php
 * demo for column totals using the list processor:

require_once "listPrcsr.php"; // the list processor class
require_once "getData.php"; // functions to generate data for the demo

$data = getLimitedData(); // get the data to be displayed

create a descriptive array for the data. Consult basicDemo.php for an
explanation of the array.
$des[] = array("Branch", "L", "Y", "N", "");
$des[] = array("Product Type", "L", "Y", "N", "");
$des[] = array("Account No", "L", "Y", "N", "");
$des[] = array("Title", "L", "Y", "N", "");
$des[] = array("Available Balance", "R", "Y", "N", "", 2);
$des[] = array("Ledger Balance", "R", "Y", "N", "", 2);

$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
if you are generating control totals or column totals, you cannot set max
lines for display. */

$lp->moneyFormat = "R";
/* "R" is for ruppee type formatting as in 1,23,456.78. The other option
is "T" for thousands formatting as in 123,456.78 */

$lp->totalId = array(4, 5);

$out = $lp->gnrtOutput(); // generate the output

/* generate another data set, very limited this time, and generate column totals
for a different set of columns */