Finally added a format helper, which has been long intended. There may be still be conversion issues, it hasn't been tested much.

git-svn-id: file:///svn-source/pmgr/branches/ledger_transactions_20090605/site@77 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
abijah
2009-06-08 03:32:07 +00:00
parent e740cc859b
commit f08884f326
16 changed files with 178 additions and 349 deletions

View File

@@ -1,26 +1,22 @@
<?php /* -*- mode:PHP -*- */
if (isset($heading))
echo $heading;
elseif (!isset($caption))
echo '<h2>'.__('Ledger',true).'</h2>';
$headers = array('Transaction', 'Entry', 'Date', 'Customer', 'Comment', 'Debit', 'Credit', 'Total');
$column_class = $headers;
foreach (array_intersect($column_class, array('Transaction', 'Entry')) AS $k => $v) {
$column_class = array();
foreach (array_intersect($headers, array('Transaction', 'Entry')) AS $k => $v) {
$column_class[$k] = array($column_class[$k], 'id');
}
foreach (array_intersect($column_class, array('Debits', 'Credits', 'Total')) AS $k => $v) {
foreach (array_intersect($headers, array('Debit', 'Credit', 'Total')) AS $k => $v) {
$column_class[$k] = array($column_class[$k], 'currency');
}
/* if (isset($paginator)) { */
/* echo $paginator->counter(array( */
/* 'format' => __('Page %page% of %pages%, showing %current% records (%start% - %end%) of %count% total', true))); */
foreach (array_intersect($headers, array('Comment')) AS $k => $v) {
$column_class[$k] = 'slack';
}
/* $headers = array($paginator->sort('Transaction', 'transaction_id'), */
/* $paginator->sort('entry_id'), */
/* $paginator->sort('Date', 'stamp'), */
/* $paginator->sort('customer_id'), */
/* $paginator->sort('comment'), */
/* $paginator->sort('debit'), */
/* $paginator->sort('credit'), */
/* $paginator->sort('total')); */
/* } */
$rows = array();
$running_total = 0;
@@ -48,33 +44,23 @@ foreach($entries AS $entry) {
array('controller' => 'ledger_entries',
'action' => 'view',
$entry['id'])),
datefmt($transaction['stamp']),
FormatHelper::date($transaction['stamp']),
$html->link($customer['name'],
array('controller' => 'customers',
'action' => 'view',
$customer['id'])),
comment(array($transaction['comment'], $entry['comment'])),
currency($debit),
currency($credit),
currency($running_total)
FormatHelper::comment(array($transaction['comment'], $entry['comment'])),
FormatHelper::currency($debit),
FormatHelper::currency($credit),
FormatHelper::currency($running_total)
);
}
echo $this->element('table',
array('class' => 'item account ledger list',
'caption' => $caption,
'caption' => isset($caption) ? $caption : null,
'headers' => $headers,
'rows' => $rows,
'column_class' => $column_class));
/* 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"); */
/* } */
?>