<?php
/**
* @author Prakash Khanchandani
* @copyright 2013
* @program controlDemo.php
*
* demonstrate the control totals feature of the list processor.
*/
require_once "listPrcsr.php"; // the list processor class
require_once "getData.php"; // functions to generate data for the demo
$data = getFullData(); // 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);
/*
I want control totals on productType and Branch with the branch being most
significant. Notice in getData.php that the list is sorted branchWise and
productTypeWise. So I specifiy my first control as branch and the second
as the productType. I also indicate which elements are to be totalled, in
this case the availableBalance and ledgerBalance. */
$cntrl[] = array(0, 4, 5);
$cntrl[] = array(1, 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
/*
if you are generating control totals, the option of pagination does not
exist and if you do try listPrcsr.php will generate an error msg.
*/
$lp->cntrlId = $cntrl; // put in the controls information
$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 */
$out = $lp->gnrtOutput(); // generate the output
include 'inc1.php';
?>
|