git-svn-id: file:///svn-source/pmgr/branches/initial_20090526/site@64 97e9348a-65ac-dc4b-aefc-98561f571b83
68 lines
1.9 KiB
PHP
68 lines
1.9 KiB
PHP
<?php /* -*- mode:PHP -*- */
|
|
|
|
if (isset($heading))
|
|
echo $heading;
|
|
else
|
|
echo '<h2>'.__('Payments',true).'</h2>';
|
|
|
|
function currency($number) {
|
|
if ($number < 0)
|
|
return "($ " . number_format(-1*$number, 2) . ")";
|
|
else
|
|
return "$ " . number_format($number, 2);
|
|
}
|
|
|
|
function datefmt($date) {
|
|
$date_fmt = 'm/d/Y';
|
|
return ($date
|
|
? date_format(date_create($date), $date_fmt)
|
|
: null);
|
|
}
|
|
|
|
$headers_manual = array('ID', 'Type', 'Receipt', 'Amount', 'Comment');
|
|
if (isset($paginator)) {
|
|
echo $paginator->counter(array(
|
|
'format' => __('Page %page% of %pages%, showing %current% records (%start% - %end%) of %count% total', true)));
|
|
|
|
$headers = array($paginator->sort('id'),
|
|
$paginator->sort('Type', 'payment_type'),
|
|
$paginator->sort('Receipt', 'receipt_id'),
|
|
$paginator->sort('amount'),
|
|
$paginator->sort('comment'));
|
|
} else {
|
|
$headers = $headers_manual;
|
|
}
|
|
|
|
|
|
$rows = array();
|
|
foreach ($payments as $payment) {
|
|
$rows[] = array($html->link($payment['Payment']['id'],
|
|
array('controller' => 'payments',
|
|
'action' => 'view',
|
|
$payment['Payment']['id'])),
|
|
$payment['PaymentType']['name'],
|
|
$html->link('#'.$payment['Receipt']['id'],
|
|
array('controller' => 'receipts',
|
|
'action' => 'view',
|
|
$payment['Receipt']['id'])),
|
|
currency($payment['Payment']['amount']),
|
|
$payment['Payment']['comment'],
|
|
);
|
|
}
|
|
|
|
echo $this->element('table',
|
|
array('class' => 'item payment list',
|
|
'headers' => $headers,
|
|
'rows' => $rows,
|
|
'column_class' => $headers_manual));
|
|
|
|
if (isset($paginator)) {
|
|
echo('<div class="paging">' . "\n");
|
|
echo $paginator->prev('<< '.__('previous', true), array(), null, array('class'=>'disabled'));
|
|
echo(' | ');
|
|
echo $paginator->numbers();
|
|
echo(' | ');
|
|
echo $paginator->next(__('next', true).' >>', array(), null, array('class'=>'disabled'));
|
|
echo('</div>' . "\n");
|
|
}
|