forked from science-ation/science-ation
- 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:
parent
fcd6eedc1d
commit
e24bbb0bbc
@ -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;
|
||||
}
|
||||
|
@ -518,6 +518,7 @@ $report_students_fields = array(
|
||||
'header' => 'Count',
|
||||
'width' => 0.5,
|
||||
'table' => 'COUNT(*)',
|
||||
'total' => true,
|
||||
'group_by' => array('students.tshirt')),
|
||||
|
||||
|
||||
|
@ -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, '', ' ');
|
||||
|
8
lpdf.php
8
lpdf.php
@ -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');
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user