I'm still in the middle of moving onto a ledger based system. However, I'm am now changing how transactions and entries relate back to the customer. I'll be using a ledger for each lease (for rent, late charges, security deposits, etc), and a ledger for each customer (for POS, non-specific deposits such as reservations or covering mulitple units, bad debt writeoff, and possibly customer credits, when not obviously lease specific). This coming change might not be in the right direction, so I want to capture the work as is right now. This change set is not fully functional. Many operations do work, but there are obviously transaction problems with units and customers.

git-svn-id: file:///svn-source/pmgr/branches/ledger_transactions_20090605/site@71 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
abijah
2009-06-06 20:18:56 +00:00
parent ce24abc812
commit 677458e942
52 changed files with 2367 additions and 1469 deletions

View File

@@ -1,6 +1,6 @@
<?php /* -*- mode:PHP -*- */ ?>
<div class="contacts view">
<div class="contact view">
<?php
@@ -28,36 +28,48 @@ function datefmt($date) {
: null);
}
/**********************************************************************
* Tenant Info
**********************************************************************
**********************************************************************
**********************************************************************
* Contact Detail Main Section
*/
$rows = array(array('Name', $contact['Contact']['display_name']),
array('Company', $contact['Contact']['company_name']),
array('SSN', $contact['Contact']['id_federal']),
array('ID', ($contact['Contact']['id_num']
. ($contact['Contact']['id_state']
? " - ".$contact['Contact']['id_state']
array('ID', ($contact['Contact']['id_local']
. ($contact['Contact']['id_local']
? " - ".$contact['Contact']['id_local_state']
: ""))),
array('Comment', $contact['Contact']['comment']));
echo $this->element('table',
array('class' => 'item contact detail',
'caption' => 'Tenant Info',
'caption' => 'Contact Details',
'rows' => $rows,
'column_class' => array('field', 'value')));
/**********************************************************************
* Contact Info Box
*/
?>
<DIV CLASS="infobox contact">
<DIV CLASS="summary grand deposit">
Security Deposit: <?php echo currency($outstandingDeposit); ?>
</DIV>
<DIV CLASS="summary grand balance">
Balance: <?php echo currency($outstandingBalance); ?>
</DIV>
<DIV CLASS="infobox">
</DIV>
<DIV CLASS="detail supporting">
<?php
; // Editor alignment
/**********************************************************************
**********************************************************************
**********************************************************************
**********************************************************************
* Supporting Elements Section
*/
/**********************************************************************
@@ -127,77 +139,14 @@ echo $this->element('table',
/**********************************************************************
* Lease History
* Customers
*/
$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));
echo $this->element('customers', array('heading' => '',
'caption' => 'Related Customers',
'customers' => $contact['Customer']));
/**********************************************************************
* 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));
}
?>
/* End "detail supporting" DIV */ ?>
</DIV>
</div>