Primarly a cleanup checkin, although a couple minor bugfixes were included as well.

git-svn-id: file:///svn-source/pmgr/branches/ledger_transactions_20090605@82 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
abijah
2009-06-10 05:14:08 +00:00
parent 9f8d4fa9b2
commit 55b896a9f0
15 changed files with 151 additions and 519 deletions

View File

@@ -128,11 +128,7 @@ class CustomersController extends AppController {
),
'Account',
'Lease' =>
array(//'order' => 'movein_date',
//'conditions' => array('Lease.lease_date IS NOT NULL'),
// Models
//'Account',
'Unit' =>
array('Unit' =>
array('order' => array('sort_order'),
'fields' => array('id', 'name'),
),
@@ -142,36 +138,30 @@ class CustomersController extends AppController {
$customer = $this->Customer->read(null, $id);
$this->Customer->Behaviors->detach('Containable');
// Add the lease balance to each lease.
foreach ($customer['Lease'] AS &$lease) {
$stats = $this->Customer->Lease->stats($lease['id']);
//pr($stats);
$lease['balance'] = $stats['Account']['Ledger']['balance'];
}
//pr($customer);
// Figure out the outstanding balance of the current lease.
$stats = $this->Customer->stats($id);
$deposits = $this->Customer->findSecurityDeposits($id);
$outstanding_balance = $stats['balance'];
// Figure out the total security deposit for the current lease.
$deposits = $this->Customer->findSecurityDeposits($id);
$outstanding_deposit = $deposits['summary']['balance'];
/* pr(array('Customer Stats', $stats)); */
/* pr(array('Security Deposits', $deposits)); */
// Add statistics into the customer account.
$customer['Account'] = array_merge($customer['Account'],
$stats['Account']['Ledger']);
$this->sidemenu_links[] =
array('name' => 'Operations', 'header' => true);
$this->sidemenu_links[] =
array('name' => 'Move-Out', 'url' => array('controller' => 'units', 'action' => 'move-out'));
$customer['Account'] = array_merge($customer['Account'], $stats['Account']['Ledger']);
//pr($stats);
//unset($stats['Lease'], $stats['Account']);
/* $customer['Account']['debits'] = 10; */
/* $customer['Account']['credits'] = 20; */
/* $customer['Account']['balance'] = 55; */
// Prepare to render.
$title = $customer['Customer']['name'];
$this->set(compact('customer', 'title',
'outstanding_balance',