From e9b31d964c055309f72368c029946411a164fb68 Mon Sep 17 00:00:00 2001 From: abijah Date: Thu, 28 May 2009 07:05:05 +0000 Subject: [PATCH] Added Lease History and security deposit tracking. git-svn-id: file:///svn-source/pmgr/branches/initial_20090526/site@19 97e9348a-65ac-dc4b-aefc-98561f571b83 --- views/transactions/contact.ctp | 45 +++++++++++++++++++++++++++++----- 1 file changed, 39 insertions(+), 6 deletions(-) diff --git a/views/transactions/contact.ctp b/views/transactions/contact.ctp index 8ea105c..631e709 100644 --- a/views/transactions/contact.ctp +++ b/views/transactions/contact.ctp @@ -5,7 +5,6 @@ ' . "\n"); +echo(' Lease History' . "\n"); +echo $html->tableHeaders($headers); +echo $html->tableCells($rows, null, array('class' => "altrow"), false, false); +echo('' . "\n"); + + /********************************************************************** * Ledger History */ +$security_deposit = 0; $grand_total = 0; foreach($tenant['Lease'] AS $lease) { $headers = array('Date', /*'Through',*/ /*'Charge/Receipt'*/'ID', 'Type', 'Comment', 'Amount', 'Total'); @@ -125,8 +155,7 @@ foreach($tenant['Lease'] AS $lease) { foreach($lease['Charge'] AS $charge) { $amount = $charge['total']; $running_total += $amount; - $rows[] = array(date_format(date_create($charge['charge_date']), $date_fmt) . ' - ' . - date_format(date_create($charge['charge_to_date']), $date_fmt), + $rows[] = array(datefmt($charge['charge_date']) .' - '. datefmt($charge['charge_to_date']), '#'.$charge['id'], $charge['ChargeType']['name'], $charge['comment'], @@ -136,8 +165,11 @@ foreach($tenant['Lease'] AS $lease) { foreach ($charge['Receipt'] AS $receipt) { $amount = -1 * $receipt['ChargesReceipt']['amount']; $running_total += $amount; - $rows[] = array(' -- ' .date_format(date_create($receipt['stamp']), $date_fmt), - //null, + // REVISIT 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'], @@ -148,7 +180,7 @@ foreach($tenant['Lease'] AS $lease) { $grand_total += $running_total; echo('' . "\n"); - echo(' ' . "\n"); + echo(' ' . "\n"); echo $html->tableHeaders($headers); echo $html->tableCells($rows, null, array('class' => "altrow"), false, false); echo('
Lease #'.$lease['number'].' (Unit '.$lease['Unit']['name'].')Lease #'.$lease['number'].' ('.$lease['Unit']['name'].')
' . "\n"); @@ -156,5 +188,6 @@ foreach($tenant['Lease'] AS $lease) { } ?> +

Total Security Deposit:

Outstanding Balance: