- Add a filter to the last commit, to not show the none tshirts.

- Add a 'total' option to the report generator, to signal that this column
  should be added up.
- If total is != zero, it shows the total at the bottom of each table, else, it
  shows the number of rows (changed the text to Total: for a total, and Rows:
  to show rows, if the total is 0)
This commit is contained in:
dave 2007-12-30 22:16:34 +00:00
parent fcd6eedc1d
commit e24bbb0bbc
4 changed files with 14 additions and 3 deletions

View File

@ -478,6 +478,7 @@ foreach($report_stock as $n=>$v) {
$table['widths']=array();
$table['dataalign']=array();
$table['option']=array();
$table['total']=0;
/* Validate the stock */
if($report['option']['stock'] != '') {
@ -665,6 +666,7 @@ foreach($report_stock as $n=>$v) {
$rep->addTable($table);
$rep->nextLine();
$table['data'] = array();
$table['total'] = 0;
/* Start a new page AFTER a table is
* dumped, so the first page doesn't
* end up blank */
@ -719,6 +721,9 @@ foreach($report_stock as $n=>$v) {
$d['h'], $lh,
$v, $opt);
}
if($fields[$f]['total'] == true)
$table['total'] += $v;
}
if(count($data)) $table['data'][] = $data;
}

View File

@ -518,6 +518,7 @@ $report_students_fields = array(
'header' => 'Count',
'width' => 0.5,
'table' => 'COUNT(*)',
'total' => true,
'group_by' => array('students.tshirt')),

View File

@ -11,4 +11,5 @@ INSERT INTO `reports_items` (`id`, `reports_id`, `type`, `ord`, `field`, `value`
('', LAST_INSERT_ID(), 'option', 6, 'stock', 'fullpage', 0, 0, 0, 0, 0, '', ''),
('', LAST_INSERT_ID(), 'col', 0, 'tshirt', '', 0, 0, 0, 0, 1, '', ' '),
('', LAST_INSERT_ID(), 'col', 1, 'special_tshirt_count', '', 0, 0, 0, 0, 1, '', ' '),
('', LAST_INSERT_ID(), 'sort', 0, 'tshirt', '', 0, 0, 0, 0, 1, '', ' ');
('', LAST_INSERT_ID(), 'sort', 0, 'tshirt', '', 0, 0, 0, 0, 1, '', ' '),
('', LAST_INSERT_ID(), 'filter', 0, 'tshirt', 'none', 5, 0, 0, 0, 1, '', ' ');

View File

@ -770,8 +770,12 @@ class lpdf
pdf_stroke($this->pdf);
// print the total in th etable at the bottom of the table
$t = count($table['data']);
$this->addText("(Total: $t)", 'right');
if($table['total'] != 0) {
$this->addText("(Total: {$table['total']})", 'right');
} else {
$t = count($table['data']);
$this->addText("(Rows: $t)", 'right');
}
}