Modified table element algorithm to be cleaner and to handle multiple class types. Modified ledger listings to group the charges and associated payment rows with one color. Fixed summary balance data to come from the controller instead of being created in the view. Created an infobox to carry pertinent info in the top right of the view pages.
git-svn-id: file:///svn-source/pmgr/branches/initial_20090526/site@43 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
@@ -33,13 +33,25 @@ echo $this->element('table',
|
||||
'column_class' => array('field', 'value')));
|
||||
|
||||
|
||||
?>
|
||||
<DIV CLASS="infobox contact">
|
||||
<DIV CLASS="summary grand deposit">
|
||||
Security Deposit: <?php echo currency($outstandingDeposit); ?>
|
||||
</DIV>
|
||||
<DIV CLASS="summary grand balance">
|
||||
Balance: <?php echo currency($outstandingBalance); ?>
|
||||
</DIV>
|
||||
</DIV>
|
||||
<?php
|
||||
|
||||
|
||||
/**********************************************************************
|
||||
* Lease History
|
||||
*/
|
||||
$headers = array('Lease', 'Tenant', 'Signed', 'Move-In', 'Move-Out', 'Rent', 'Deposit', 'Comment');
|
||||
$rows = array();
|
||||
foreach($unit['Lease'] AS $lease) {
|
||||
$rows[] = array('#'.$lease['id'],
|
||||
$rows[] = array('#'.$lease['number'],
|
||||
$html->link($lease['Contact'][0]['display_name'],
|
||||
array('controller' => 'contacts',
|
||||
'action' => 'view',
|
||||
@@ -63,13 +75,12 @@ echo $this->element('table',
|
||||
/**********************************************************************
|
||||
* Ledger History
|
||||
*/
|
||||
$security_deposit = 0;
|
||||
$grand_total = 0;
|
||||
foreach($unit['Lease'] AS $lease) {
|
||||
$headers = array('Date', /*'Through',*/ /*'Charge/Receipt'*/'ID', 'Type', 'Comment', 'Amount', 'Total');
|
||||
|
||||
$rows = array();
|
||||
$running_total = 0;
|
||||
$odd = 0;
|
||||
foreach($lease['Charge'] AS $charge) {
|
||||
$amount = $charge['total'];
|
||||
$running_total += $amount;
|
||||
@@ -79,33 +90,30 @@ foreach($unit['Lease'] AS $lease) {
|
||||
$charge['comment'],
|
||||
currency($amount),
|
||||
currency($running_total));
|
||||
$row_class[] = array('charge', (++$odd % 2) ? 'oddrow' : 'evnrow');
|
||||
|
||||
foreach ($charge['Receipt'] AS $receipt) {
|
||||
$amount = -1 * $receipt['ChargesReceipt']['amount'];
|
||||
$running_total += $amount;
|
||||
// REVISIT <AP> 20090527:
|
||||
// Using hardcoded value for security deposit... can't be good!
|
||||
if ($charge['charge_type_id'] == 1)
|
||||
$security_deposit += $receipt['ChargesReceipt']['amount'];
|
||||
$rows[] = array(' -- ' . datefmt($receipt['stamp']),
|
||||
'#'.$receipt['id'],
|
||||
'Payment/Receipt',
|
||||
$receipt['comment'],
|
||||
currency($amount),
|
||||
currency($running_total));
|
||||
$row_class[] = array('receipt', ($odd % 2) ? 'oddrow' : 'evnrow');
|
||||
}
|
||||
}
|
||||
$grand_total += $running_total;
|
||||
|
||||
echo $this->element('table',
|
||||
array('class' => 'item ledger list',
|
||||
'caption' => 'Lease #'.$lease['number'].' ('.$lease['Contact'][0]['display_name'].')',
|
||||
'suppress_alternate_rows' => true,
|
||||
'headers' => $headers,
|
||||
'rows' => $rows,
|
||||
'row_class' => $row_class,
|
||||
'column_class' => $headers));
|
||||
}
|
||||
?>
|
||||
|
||||
<DIV ALIGN=RIGHT><H3>Total Security Deposit: <?php echo currency($security_deposit); ?></H3></DIV>
|
||||
<DIV ALIGN=RIGHT><H3>Outstanding Balance: <?php echo currency($grand_total); ?></H3></DIV>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user