$val) { $rows[] = array(array($col, 'width=1%'), $val); } echo('' . "\n"); echo(' ' . "\n"); echo $html->tableCells(array(array('Name', $unit['Unit']['name']), array('Status', $unit['Unit']['status']), array('Comment', $unit['Unit']['comment'])), null, array('class' => "altrow"), false, false); echo('
Unit Info
' . "\n"); /********************************************************************** * 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'], $html->link($lease['Contact'][0]['display_name'], array('controller' => 'contacts', 'action' => 'view', $lease['Contact'][0]['id'])), datefmt($lease['lease_date']), datefmt($lease['movein_date']), datefmt($lease['moveout_date']), $lease['amount'], $lease['deposit'], $lease['comment']); } echo('' . "\n"); echo(' ' . "\n"); echo $html->tableHeaders($headers); echo $html->tableCells($rows, null, array('class' => "altrow"), false, false); echo('
Lease History
' . "\n"); /********************************************************************** * 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; foreach($lease['Charge'] AS $charge) { $amount = $charge['total']; $running_total += $amount; $rows[] = array(datefmt($charge['charge_date']) .' - '. datefmt($charge['charge_to_date']), '#'.$charge['id'], $charge['ChargeType']['name'], $charge['comment'], currency($amount), currency($running_total)); foreach ($charge['Receipt'] AS $receipt) { $amount = -1 * $receipt['ChargesReceipt']['amount']; $running_total += $amount; // 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'], currency($amount), currency($running_total)); } } $grand_total += $running_total; echo('' . "\n"); echo(' ' . "\n"); echo $html->tableHeaders($headers); echo $html->tableCells($rows, null, array('class' => "altrow"), false, false); echo('
Lease #'.$lease['number'].' ('.$lease['Contact'][0]['display_name'].')
' . "\n"); } ?>

Total Security Deposit:

Outstanding Balance: