diff --git a/controllers/contacts_controller.php b/controllers/contacts_controller.php new file mode 100644 index 0000000..f372274 --- /dev/null +++ b/controllers/contacts_controller.php @@ -0,0 +1,21 @@ +Session->setFlash(__('Invalid Item.', true)); + $this->redirect(array('action'=>'')); + } + $this->Contact->recursive = 4; + $this->Contact->Lease->LeaseType->unbindModel(array('hasMany' => array('Lease'))); + $this->Contact->Lease->Charge->unbindModel(array('belongsTo' => array('Lease'))); + $this->Contact->Lease->Charge->ChargeType->unbindModel(array('hasMany' => array('Charge'))); + $this->Contact->Lease->Charge->Receipt->unbindModel(array('hasMany' => array('ChargesReceipt'))); + + $this->set('tenant', $this->Contact->read(null, $id)); + } +} + +?> \ No newline at end of file diff --git a/controllers/transactions_controller.php b/controllers/transactions_controller.php deleted file mode 100644 index f4501ef..0000000 --- a/controllers/transactions_controller.php +++ /dev/null @@ -1,36 +0,0 @@ -Session->setFlash(__('Invalid Item.', true)); - $this->redirect(array('action'=>'')); - } - $this->Charge->recursive = 0; - //$ledgers = array($this->Charge->read(null, $id)); - $this->set('ledgers', $this->Charge->find('all')); - //$this->set(compact('ledgers', 'tables')); - } - - function contact($id = null) { - if (!$id) { - $this->Session->setFlash(__('Invalid Item.', true)); - $this->redirect(array('action'=>'')); - } - $this->Contact->recursive = 4; - $this->Contact->Lease->LeaseType->unbindModel(array('hasMany' => array('Lease'))); - $this->Contact->Lease->Charge->unbindModel(array('belongsTo' => array('Lease'))); - $this->Contact->Lease->Charge->ChargeType->unbindModel(array('hasMany' => array('Charge'))); - $this->Contact->Lease->Charge->Receipt->unbindModel(array('hasMany' => array('ChargesReceipt'))); - - //$ledgers = array($this->Charge->read(null, $id)); - //$this->set('ledgers', $this->Contact->Lease->Charge->find('all')); - //$this->set(compact('ledgers', 'tables')); - $this->set('tenant', $this->Contact->read(null, $id)); - } -} - -?> \ No newline at end of file diff --git a/views/contacts/view.ctp b/views/contacts/view.ctp new file mode 100644 index 0000000..18d6021 --- /dev/null +++ b/views/contacts/view.ctp @@ -0,0 +1,66 @@ + + +
+

+ + $val) { + $rows[] = array(array($col, 'width=1%'), $val); +} +echo('' . "\n"); +echo(' ' . "\n"); +echo $html->tableCells($rows, null, array('class' => "altrow")); +echo('
Tenant Info
' . "\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('' . "\n"); + echo(' ' . "\n"); + echo $html->tableHeaders($headers); + echo $html->tableCells($rows, null, array('class' => "altrow")); + echo('
Lease #'.$lease['number'].' (Unit '.$lease['Unit']['name'].')
' . "\n"); + +} +?> + +

Grand Total:

+
diff --git a/views/transactions/contact.ctp b/views/transactions/contact.ctp deleted file mode 100644 index 631e709..0000000 --- a/views/transactions/contact.ctp +++ /dev/null @@ -1,193 +0,0 @@ - - -
-

- - $val) { - $rows[] = array(array($col, 'width=1%'), $val); -} - -echo('' . "\n"); -echo(' ' . "\n"); -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('
Tenant Info
' . "\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(' ' . "\n"); - echo $html->tableHeaders($headers); - echo $html->tableCells($rows, null, array('class' => "altrow"), false, false); - echo('
Phone
' . "\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(' ' . "\n"); - echo $html->tableHeaders($headers); - echo $html->tableCells($rows, null, array('class' => "altrow"), false, false); - echo('
Email
' . "\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(' ' . "\n"); - echo $html->tableHeaders($headers); - echo $html->tableCells($rows, null, array('class' => "altrow"), false, false); - echo('
Address
' . "\n"); -} - - -/********************************************************************** - * Lease History - */ -$headers = array('Lease', 'Unit', 'Signed', 'Move-In', 'Move-Out', 'Rent', 'Deposit', 'Comment'); -$rows = array(); -foreach($tenant['Lease'] AS $lease) { - $rows[] = array('#'.$lease['id'], - $lease['Unit']['name'], - 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($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(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['Unit']['name'].')
' . "\n"); - -} -?> - -

Total Security Deposit:

-

Outstanding Balance:

-
diff --git a/views/transactions/ledger.ctp b/views/transactions/ledger.ctp deleted file mode 100644 index fd59df5..0000000 --- a/views/transactions/ledger.ctp +++ /dev/null @@ -1,53 +0,0 @@ - - -
-

- - $table) { - - if (array_key_exists(0, $table)) { - // Horizontal table (multiple items) - $headers = array_keys($table[0]); - - //$rows = array_map('array_values', $table); - $rows = array(); - //echo("
table:\n"); print_r($table); echo("
\n"); - foreach ($table as $row) { - //echo("
row:\n"); print_r($row); echo("
\n"); - $rows[] = array_values($row); - } - } - else { - // Vertical table (one item) - $headers = array('Field', 'Value'); - - $rows = array(); - foreach ($table as $col => $val) { - $rows[] = array($col, $val); - } - } - - foreach($rows AS &$row) { - foreach ($row AS &$cell) { - if (is_array($cell)) - $cell = "<ARRAY>"; - } - } - //echo("
headers:\n"); print_r($headers); echo("
\n"); - //echo("
rows:\n"); print_r($rows); echo("
\n"); - ?> - - - tableHeaders($headers); - echo $html->tableCells($rows, null, array('class' => "altrow")); - ?> -
- - -
\ No newline at end of file diff --git a/views/transactions/ledger_1.ctp b/views/transactions/ledger_1.ctp deleted file mode 100644 index 316e24a..0000000 --- a/views/transactions/ledger_1.ctp +++ /dev/null @@ -1,58 +0,0 @@ -
-

- - -counter(array( - 'format' => __('Page %page% of %pages%, showing %current% records (%start% - %end%) of %count% total', true))); - - $cells = array($paginator->sort('id'), - $paginator->sort('charge_type_id'), - $paginator->sort('lease_id'), - $paginator->sort('charge_date'), - $paginator->sort('charge_to_date'), - $paginator->sort('due_date'), - $paginator->sort('amount'), - $paginator->sort('tax'), - $paginator->sort('total'), - $paginator->sort('comment')); -} else { - $cells = array('Id', 'Type', 'Lease', 'Date', 'Through', 'Due', 'Amount', 'Tax', 'Total', 'Comment'); -} -echo $html->tableHeaders($cells); - -$cells = array(); -foreach ($ledgers as $ledger) { - $cells[] = array($html->link($ledger['Charge']['id'], - array('controller' => 'transactions', - 'action' => 'view', - $ledger['Charge']['id'])), - $ledger['Charge']['charge_type_id'], - $ledger['Charge']['lease_id'], - $ledger['Charge']['charge_date'], - $ledger['Charge']['charge_to_date'], - $ledger['Charge']['due_date'], - $ledger['Charge']['amount'], - $ledger['Charge']['tax'], - $ledger['Charge']['total'], - $ledger['Charge']['comment']); -} -echo $html->tableCells($cells, null, array('class' => "altrow")); -?> -
- -' . "\n"); - echo $paginator->prev('<< '.__('previous', true), array(), null, array('class'=>'disabled')); - echo(' | '); - echo $paginator->numbers(); - echo(' | '); - echo $paginator->next(__('next', true).' >>', array(), null, array('class'=>'disabled')); - echo('
' . "\n"); - } -?> - - - \ No newline at end of file