git-svn-id: file:///svn-source/pmgr/branches/initial_20090526/site@20 97e9348a-65ac-dc4b-aefc-98561f571b83
67 lines
2.0 KiB
PHP
67 lines
2.0 KiB
PHP
<?php /* -*- mode:PHP -*- */ ?>
|
|
|
|
<div class="contacts view">
|
|
<h2><?php __('Contact'); ?></h2>
|
|
|
|
<?php
|
|
|
|
function currency($number) {
|
|
if ($number < 0) {
|
|
return "($ " . number_format(-1*$number, 2) . ")";
|
|
} else {
|
|
return "$ " . number_format($number, 2);
|
|
}
|
|
}
|
|
|
|
$rows = array();
|
|
foreach($tenant['Contact'] AS $col => $val) {
|
|
$rows[] = array(array($col, 'width=1%'), $val);
|
|
}
|
|
echo('<table cellpadding="0" cellspacing="0">' . "\n");
|
|
echo(' <CAPTION>Tenant Info</CAPTION>' . "\n");
|
|
echo $html->tableCells($rows, null, array('class' => "altrow"));
|
|
echo('</table>' . "\n");
|
|
|
|
$grand_total = 0;
|
|
foreach($tenant['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(date_format(date_create($charge['charge_date']), 'm-d-Y') . ' - ' .
|
|
date_format(date_create($charge['charge_to_date']), 'm-d-Y'),
|
|
'#'.$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;
|
|
$rows[] = array(' -- ' .date_format(date_create($receipt['stamp']), 'm-d-Y'),
|
|
//null,
|
|
'#'.$receipt['id'],
|
|
'Receipt',
|
|
$receipt['comment'],
|
|
currency($amount),
|
|
currency($running_total));
|
|
}
|
|
}
|
|
$grand_total += $running_total;
|
|
|
|
echo('<table cellpadding="0" cellspacing="0">' . "\n");
|
|
echo(' <CAPTION>Lease #'.$lease['number'].' (Unit '.$lease['Unit']['name'].')</CAPTION>' . "\n");
|
|
echo $html->tableHeaders($headers);
|
|
echo $html->tableCells($rows, null, array('class' => "altrow"));
|
|
echo('</table>' . "\n");
|
|
|
|
}
|
|
?>
|
|
|
|
<DIV ALIGN=RIGHT><H3>Grand Total: <?php echo currency($grand_total); ?></H3></DIV>
|
|
</div>
|