element('table', array('class' => 'item contact detail', 'caption' => 'Tenant Info', 'rows' => $rows, 'column_class' => array('field', 'value'))); ?>
Security Deposit:
Balance:
element('table', array('class' => 'item phone list', 'caption' => 'Phone', 'headers' => $headers, 'rows' => $rows, 'column_class' => $headers)); /********************************************************************** * Emails */ $headers = array('Email', 'Preference', 'Comment'); $rows = array(); foreach($contact['ContactEmail'] AS $email) { $rows[] = array($email['email'], $email['ContactsMethod']['preference'] . " / " . $email['ContactsMethod']['type'], $email['comment']); } echo $this->element('table', array('class' => 'item email list', 'caption' => 'Email', 'headers' => $headers, 'rows' => $rows, 'column_class' => $headers)); /********************************************************************** * Addresses */ $headers = array('Address', 'Preference', 'Comment'); $rows = array(); foreach($contact['ContactAddress'] AS $address) { $rows[] = array(preg_replace("/\n/", "
\n", $address['address']) . "
\n" . $address['city'] . ", " . $address['state'] . " " . $address['postcode'], //. ? "
\n" . $address['country'], $address['ContactsMethod']['preference'] . " / " . $address['ContactsMethod']['type'], $address['comment']); } echo $this->element('table', array('class' => 'item address list', 'caption' => 'Address', 'headers' => $headers, 'rows' => $rows, 'column_class' => $headers)); /********************************************************************** * Lease History */ $headers = array('Lease', 'Unit', 'Signed', 'Move-In', 'Move-Out', 'Rent', 'Deposit', 'Comment'); $rows = array(); foreach($contact['Lease'] AS $lease) { $rows[] = array('#'.$lease['number'], $html->link($lease['Unit']['name'], array('controller' => 'units', 'action' => 'view', $lease['Unit']['id'])), datefmt($lease['lease_date']), datefmt($lease['movein_date']), datefmt($lease['moveout_date']), $lease['amount'], $lease['deposit'], $lease['comment']); } echo $this->element('table', array('class' => 'item lease list', 'caption' => 'Lease History', 'headers' => $headers, 'rows' => $rows, 'column_class' => $headers)); /********************************************************************** * Ledger History */ foreach($contact['Lease'] AS $lease) { $headers = array(/*'Charge/Receipt'*/'Charge', 'Date', 'Through', 'Type', 'Comment', 'Amount', 'Balance', 'Total'); $rows = array(); $row_class = array(); $running_total = 0; $odd = 0; foreach($lease['Charge'] AS $charge) { $amount = $charge['total']; $balance = $amount; foreach ($charge['Receipt'] AS $receipt) $balance -= $receipt['ChargesReceipt']['amount']; $running_total += $balance; $rows[] = array($html->link('#'.$charge['id'], array('controller' => 'charges', 'action' => 'view', $charge['id'])), datefmt($charge['charge_date']), datefmt($charge['charge_to_date']), $charge['ChargeType']['name'], $charge['comment'], currency($amount), currency($balance), //currency($amount - $paid)); currency($running_total)); $row_class[] = array('charge', (++$odd % 2) ? 'oddrow' : 'evnrow'); } echo $this->element('table', array('class' => 'item ledger list', 'caption' => 'Lease #'.$lease['number'].' (Unit: '.$lease['Unit']['name'].')', 'suppress_alternate_rows' => true, 'headers' => $headers, 'rows' => $rows, 'row_class' => $row_class, 'column_class' => $headers)); } ?>