diff --git a/site/views/elements/ledger_entries.ctp b/site/views/elements/ledger_entries.ctp
index 2fee5c3..70e8c1f 100644
--- a/site/views/elements/ledger_entries.ctp
+++ b/site/views/elements/ledger_entries.ctp
@@ -14,13 +14,13 @@ else {
}
$cols['Source'] = array('index' => 'MonetarySource.name', 'formatter' => 'name');
$cols['Comment'] = array('index' => 'LedgerEntry.comment', 'formatter' => 'comment', 'width'=>150);
-if (isset($account_ftype)) {
- $cols['Amount'] = array('index' => 'LedgerEntry.amount', 'formatter' => 'currency');
-}
-else {
+if (isset($ledger_id)) {
$cols['Debit'] = array('index' => 'debit', 'formatter' => 'currency');
$cols['Credit'] = array('index' => 'credit', 'formatter' => 'currency');
}
+else {
+ $cols['Amount'] = array('index' => 'LedgerEntry.amount', 'formatter' => 'currency');
+}
if (isset($reconcile_id)) {
$cols['Applied'] = array('index' => "Reconciliation.amount", 'formatter' => 'currency');
}
diff --git a/site/views/transactions/view.ctp b/site/views/transactions/view.ctp
index 973edbf..67e77cd 100644
--- a/site/views/transactions/view.ctp
+++ b/site/views/transactions/view.ctp
@@ -52,61 +52,10 @@ echo '
' . "\n";
* Entries
*/
-$headers = array('Entry', 'Debit', 'Credit', 'Amount', 'Comment',/* 'Total'*/);
-$column_class = array();
-foreach (array_intersect($headers, array('Entry')) AS $k => $v) {
- $column_class[$k] = 'id';
-}
-foreach (array_intersect($headers, array('Amount', 'Total')) AS $k => $v) {
- $column_class[$k] = 'currency';
-}
-foreach (array_intersect($headers, array('Comment')) AS $k => $v) {
- $column_class[$k] = 'slack';
-}
-
-$rows = array();
-$running_total = 0;
-foreach($transaction['LedgerEntry'] AS $entry) {
- $amount = $entry['amount'];
- $running_total += $amount;
- $rows[] = array($html->link('#'.$entry['id'],
- array('controller' => 'ledger_entries',
- 'action' => 'view',
- $entry['id'])),
- ($html->link($entry['DebitLedger']['Account']['name'],
- array('controller' => 'accounts',
- 'action' => 'view',
- $entry['DebitLedger']['Account']['id']))
- . ' ('
- . $html->link('#' . $entry['DebitLedger']['Account']['id']
- . '-' . $entry['DebitLedger']['sequence'],
- array('controller' => 'ledgers',
- 'action' => 'view',
- $entry['DebitLedger']['id']))
- . ')'),
- ($html->link($entry['CreditLedger']['Account']['name'],
- array('controller' => 'accounts',
- 'action' => 'view',
- $entry['CreditLedger']['Account']['id']))
- . ' ('
- . $html->link('#' . $entry['CreditLedger']['Account']['id']
- . '-' . $entry['CreditLedger']['sequence'],
- array('controller' => 'ledgers',
- 'action' => 'view',
- $entry['CreditLedger']['id']))
- . ')'),
- FormatHelper::currency($entry['amount']),
- $entry['comment'],
- //FormatHelper::currency($running_total),
- );
-}
-
-echo $this->element('table',
- array('class' => 'item entry list',
- 'caption' => 'Entries in Transaction',
- 'headers' => $headers,
- 'rows' => $rows,
- 'column_class' => $column_class));
+echo $this->element('ledger_entries',
+ array('caption' => 'Entries in Transaction',
+ 'ledger_entries' => $transaction['LedgerEntry'],
+ ));
/* End "detail supporting" div */