diff --git a/models/contact.php b/models/contact.php
index 2584571..5aab7f3 100644
--- a/models/contact.php
+++ b/models/contact.php
@@ -25,6 +25,36 @@ class Contact extends AppModel {
'deleteQuery' => '',
'insertQuery' => ''
),
+ 'ContactAddress' => array(
+ 'className' => 'ContactAddress',
+ 'joinTable' => 'contacts_methods',
+ 'foreignKey' => 'contact_id',
+ 'associationForeignKey' => 'method_id',
+ 'unique' => true,
+ 'conditions' => "ContactsMethod.method = 'POST'",
+ 'fields' => '',
+ 'order' => '',
+ 'limit' => '',
+ 'offset' => '',
+ 'finderQuery' => '',
+ 'deleteQuery' => '',
+ 'insertQuery' => ''
+ ),
+ 'ContactPhone' => array(
+ 'className' => 'ContactPhone',
+ 'joinTable' => 'contacts_methods',
+ 'foreignKey' => 'contact_id',
+ 'associationForeignKey' => 'method_id',
+ 'unique' => true,
+ 'conditions' => "ContactsMethod.method = 'PHONE'",
+ 'fields' => '',
+ 'order' => '',
+ 'limit' => '',
+ 'offset' => '',
+ 'finderQuery' => '',
+ 'deleteQuery' => '',
+ 'insertQuery' => ''
+ ),
'ContactEmail' => array(
'className' => 'ContactEmail',
'joinTable' => 'contacts_methods',
@@ -39,7 +69,7 @@ class Contact extends AppModel {
'finderQuery' => '',
'deleteQuery' => '',
'insertQuery' => ''
- )
+ ),
);
}
diff --git a/models/contact_address.php b/models/contact_address.php
new file mode 100644
index 0000000..d808b41
--- /dev/null
+++ b/models/contact_address.php
@@ -0,0 +1,28 @@
+ array('numeric'),
+ 'postcode' => array('postal')
+ );
+
+ var $hasAndBelongsToMany = array(
+ 'Contact' => array(
+ 'className' => 'Contact',
+ 'joinTable' => 'contacts_methods',
+ 'foreignKey' => 'method_id',
+ 'associationForeignKey' => 'contact_id',
+ 'unique' => true,
+ 'conditions' => "ContactsMethod.method = 'POST'",
+ 'fields' => '',
+ 'order' => '',
+ 'limit' => '',
+ 'offset' => '',
+ 'finderQuery' => '',
+ 'deleteQuery' => '',
+ 'insertQuery' => ''
+ )
+ );
+}
+?>
\ No newline at end of file
diff --git a/models/contact_email.php b/models/contact_email.php
index 3f4a7e9..c9b59dd 100644
--- a/models/contact_email.php
+++ b/models/contact_email.php
@@ -7,7 +7,6 @@ class ContactEmail extends AppModel {
'email' => array('email')
);
- //The Associations below have been created with all possible keys, those that are not needed can be removed
var $hasAndBelongsToMany = array(
'Contact' => array(
'className' => 'Contact',
diff --git a/models/contact_phone.php b/models/contact_phone.php
new file mode 100644
index 0000000..79b9807
--- /dev/null
+++ b/models/contact_phone.php
@@ -0,0 +1,31 @@
+ array('numeric'),
+ //'type' => array('inlist'),
+ 'phone' => array('phone'),
+ 'ext' => array('numeric')
+ );
+
+ var $hasAndBelongsToMany = array(
+ 'Contact' => array(
+ 'className' => 'Contact',
+ 'joinTable' => 'contacts_methods',
+ 'foreignKey' => 'method_id',
+ 'associationForeignKey' => 'contact_id',
+ 'unique' => true,
+ 'conditions' => "ContactsMethod.method = 'PHONE'",
+ 'fields' => '',
+ 'order' => '',
+ 'limit' => '',
+ 'offset' => '',
+ 'finderQuery' => '',
+ 'deleteQuery' => '',
+ 'insertQuery' => ''
+ )
+ );
+
+}
+?>
\ No newline at end of file
diff --git a/views/transactions/contact.ctp b/views/transactions/contact.ctp
index 18d6021..8ea105c 100644
--- a/views/transactions/contact.ctp
+++ b/views/transactions/contact.ctp
@@ -5,23 +5,117 @@
$val) {
$rows[] = array(array($col, 'width=1%'), $val);
}
+
echo('
' . "\n");
echo(' Tenant Info' . "\n");
-echo $html->tableCells($rows, null, array('class' => "altrow"));
+echo $html->tableCells(array(array('Name', $tenant['Contact']['display_name']),
+ array('Company', $tenant['Contact']['company_name']),
+ array('SSN', $tenant['Contact']['id_federal']),
+ array('ID', $tenant['Contact']['id_num']
+ . ($tenant['Contact']['id_state']
+ ? " - ".$tenant['Contact']['id_state']
+ : ""))),
+ null, array('class' => "altrow"), false, false);
echo('
' . "\n");
+
+/**********************************************************************
+ * Phones
+ */
+$headers = array('Location', 'Preference', 'Type', 'Phone', 'Extension', 'Comment');
+$rows = array();
+foreach($tenant['ContactPhone'] AS $phone) {
+ $rows[] = array($phone['ContactsMethod']['type'],
+ $phone['ContactsMethod']['preference'],
+ $phone['type'],
+ phone($phone['phone']),
+ $phone['ext'],
+ $phone['comment']);
+}
+
+if (count($rows)) {
+ echo('' . "\n");
+ echo(' Phone' . "\n");
+ echo $html->tableHeaders($headers);
+ echo $html->tableCells($rows, null, array('class' => "altrow"), false, false);
+ echo('
' . "\n");
+}
+
+
+/**********************************************************************
+ * Emails
+ */
+$headers = array('Location', 'Preference', 'Email', 'Comment');
+$rows = array();
+foreach($tenant['ContactEmail'] AS $email) {
+ $rows[] = array($email['ContactsMethod']['type'],
+ $email['ContactsMethod']['preference'],
+ $email['email'],
+ $email['comment']);
+}
+
+if (count($rows)) {
+ echo('' . "\n");
+ echo(' Email' . "\n");
+ echo $html->tableHeaders($headers);
+ echo $html->tableCells($rows, null, array('class' => "altrow"), false, false);
+ echo('
' . "\n");
+}
+
+
+/**********************************************************************
+ * Addresses
+ */
+$headers = array('Location', 'Preference', 'Address', 'City', 'State', 'Zip', 'Country', 'Comment');
+$rows = array();
+foreach($tenant['ContactAddress'] AS $address) {
+ $rows[] = array($address['ContactsMethod']['type'],
+ $address['ContactsMethod']['preference'],
+ $address['address'],
+ $address['city'],
+ $address['state'],
+ $address['postcode'],
+ $address['country'],
+ $address['comment']);
+}
+
+if (count($rows)) {
+ echo('' . "\n");
+ echo(' Address' . "\n");
+ echo $html->tableHeaders($headers);
+ echo $html->tableCells($rows, null, array('class' => "altrow"), false, false);
+ echo('
' . "\n");
+}
+
+
+/**********************************************************************
+ * Ledger History
+ */
$grand_total = 0;
foreach($tenant['Lease'] AS $lease) {
$headers = array('Date', /*'Through',*/ /*'Charge/Receipt'*/'ID', 'Type', 'Comment', 'Amount', 'Total');
@@ -31,8 +125,8 @@ 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']), 'm-d-Y') . ' - ' .
- date_format(date_create($charge['charge_to_date']), 'm-d-Y'),
+ $rows[] = array(date_format(date_create($charge['charge_date']), $date_fmt) . ' - ' .
+ date_format(date_create($charge['charge_to_date']), $date_fmt),
'#'.$charge['id'],
$charge['ChargeType']['name'],
$charge['comment'],
@@ -42,10 +136,10 @@ 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']), 'm-d-Y'),
+ $rows[] = array(' -- ' .date_format(date_create($receipt['stamp']), $date_fmt),
//null,
'#'.$receipt['id'],
- 'Receipt',
+ 'Payment/Receipt',
$receipt['comment'],
currency($amount),
currency($running_total));
@@ -56,11 +150,11 @@ foreach($tenant['Lease'] AS $lease) {
echo('' . "\n");
echo(' Lease #'.$lease['number'].' (Unit '.$lease['Unit']['name'].')' . "\n");
echo $html->tableHeaders($headers);
- echo $html->tableCells($rows, null, array('class' => "altrow"));
+ echo $html->tableCells($rows, null, array('class' => "altrow"), false, false);
echo('
' . "\n");
}
?>
-Grand Total:
+Outstanding Balance: