I'm still in the middle of moving onto a ledger based system. However, I'm am now changing how transactions and entries relate back to the customer. I'll be using a ledger for each lease (for rent, late charges, security deposits, etc), and a ledger for each customer (for POS, non-specific deposits such as reservations or covering mulitple units, bad debt writeoff, and possibly customer credits, when not obviously lease specific). This coming change might not be in the right direction, so I want to capture the work as is right now. This change set is not fully functional. Many operations do work, but there are obviously transaction problems with units and customers.
git-svn-id: file:///svn-source/pmgr/branches/ledger_transactions_20090605@71 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
102
site/views/transactions/view.ctp
Normal file
102
site/views/transactions/view.ctp
Normal file
@@ -0,0 +1,102 @@
|
||||
<?php /* -*- mode:PHP -*- */ ?>
|
||||
|
||||
<div class="transaction view">
|
||||
|
||||
<?php
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
/**********************************************************************
|
||||
**********************************************************************
|
||||
**********************************************************************
|
||||
**********************************************************************
|
||||
* Transaction Detail Main Section
|
||||
*/
|
||||
|
||||
$rows = array(array('ID', $transaction['Transaction']['id']),
|
||||
array('Timestamp', datefmt($transaction['Transaction']['stamp'])),
|
||||
array('Comment', $transaction['Transaction']['comment']));
|
||||
|
||||
echo $this->element('table',
|
||||
array('class' => 'item transaction detail',
|
||||
'caption' => 'Transaction Info',
|
||||
'rows' => $rows,
|
||||
'column_class' => array('field', 'value')));
|
||||
|
||||
|
||||
/**********************************************************************
|
||||
* Transaction Info Box
|
||||
*/
|
||||
|
||||
?>
|
||||
<DIV CLASS="infobox">
|
||||
<DIV CLASS="summary grand debit">
|
||||
Debits: <?php echo currency($debitAmount); ?>
|
||||
</DIV>
|
||||
<DIV CLASS="summary grand credit">
|
||||
Credits: <?php echo currency($creditAmount); ?>
|
||||
</DIV>
|
||||
</DIV>
|
||||
|
||||
<DIV CLASS="detail supporting">
|
||||
<?php
|
||||
; // Editor alignment
|
||||
|
||||
/**********************************************************************
|
||||
**********************************************************************
|
||||
**********************************************************************
|
||||
**********************************************************************
|
||||
* Supporting Elements Section
|
||||
*/
|
||||
|
||||
|
||||
/**********************************************************************
|
||||
* Entries
|
||||
*/
|
||||
|
||||
$headers = array('Name', 'Debit', 'Credit', 'Comment', 'Amount', 'Total');
|
||||
$rows = array();
|
||||
$running_total = 0;
|
||||
foreach($transaction['LedgerEntry'] AS $entry) {
|
||||
$amount = $entry['amount'];
|
||||
$running_total += $amount;
|
||||
$rows[] = array($entry['name'],
|
||||
$html->link($entry['DebitLedger']['name'],
|
||||
array('controller' => 'ledgers',
|
||||
'action' => 'view',
|
||||
$entry['DebitLedger']['id'])),
|
||||
$html->link($entry['CreditLedger']['name'],
|
||||
array('controller' => 'ledgers',
|
||||
'action' => 'view',
|
||||
$entry['CreditLedger']['id'])),
|
||||
$entry['comment'],
|
||||
currency($entry['amount']),
|
||||
currency($running_total)
|
||||
);
|
||||
}
|
||||
|
||||
echo $this->element('table',
|
||||
array('class' => 'item entry list',
|
||||
'caption' => 'Entries in Transaction',
|
||||
'headers' => $headers,
|
||||
'rows' => $rows,
|
||||
'column_class' => $headers));
|
||||
|
||||
|
||||
/* End "detail supporting" DIV */ ?>
|
||||
</DIV>
|
||||
|
||||
</div>
|
||||
Reference in New Issue
Block a user