git-svn-id: file:///svn-source/pmgr/branches/ledger_transactions_20090605@77 97e9348a-65ac-dc4b-aefc-98561f571b83
76 lines
2.4 KiB
PHP
76 lines
2.4 KiB
PHP
<?php /* -*- mode:PHP -*- */
|
|
|
|
if (isset($heading))
|
|
echo $heading;
|
|
elseif (!isset($caption))
|
|
echo '<h2>'.__('Accounts',true).'</h2>';
|
|
|
|
$headers = array('Name', 'Type', 'Ext. Name', 'Ext. Account', 'Entries', 'Debits', 'Credits', 'Balance', 'Comment');
|
|
$column_class = array();
|
|
foreach (array_intersect($headers, array('Debits', 'Credits', 'Balance')) AS $k => $v) {
|
|
$column_class[$k] = 'currency';
|
|
}
|
|
foreach (array_intersect($headers, array('Comment')) AS $k => $v) {
|
|
$column_class[$k] = 'slack';
|
|
}
|
|
|
|
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('name'),
|
|
$paginator->sort('type'),
|
|
$paginator->sort('Ext. Name', 'external_name'),
|
|
$paginator->sort('Ext. Account', 'external_account'),
|
|
$paginator->sort('entries'),
|
|
$paginator->sort('debits'),
|
|
$paginator->sort('credits'),
|
|
$paginator->sort('balance'),
|
|
$paginator->sort('comment'));
|
|
}
|
|
|
|
$rows = array();
|
|
foreach ($accounts as $account) {
|
|
$extra = null;
|
|
if (isset($account[0])) {
|
|
$extra = $account[0];
|
|
unset($account[0]);
|
|
}
|
|
if (isset($account['Account']))
|
|
$account = $account['Account'];
|
|
|
|
if (isset($extra))
|
|
$account = array_merge($account, $extra);
|
|
|
|
$rows[] = array($html->link($account['name'],
|
|
array('controller' => 'accounts',
|
|
'action' => 'view',
|
|
$account['id'])),
|
|
$account['type'],
|
|
$account['external_name'],
|
|
$account['external_account'],
|
|
$account['entries'],
|
|
FormatHelper::currency($account['debits']),
|
|
FormatHelper::currency($account['credits']),
|
|
FormatHelper::currency($account['balance']),
|
|
$account['comment'],
|
|
);
|
|
}
|
|
|
|
echo $this->element('table',
|
|
array('class' => 'item account list',
|
|
'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");
|
|
}
|