Stripped security deposits out of the Receipt page (and bad debt too). Added a dedicated security deposit utilization page. Works, I think, but my eyes are closing and it really needs fresh eyes again in the morning.

git-svn-id: file:///svn-source/pmgr/branches/invoice_receipt_20090629/site@293 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
abijah
2009-07-10 09:28:29 +00:00
parent bcbe3767e3
commit 99904f22bb
5 changed files with 68 additions and 45 deletions

View File

@@ -399,27 +399,12 @@ class CustomersController extends AppController {
*/
function receipt($id = null) {
/* $deposits = $this->Customer->findSecurityDeposits($id); */
/* pr($deposits); */
/* $this->autoRender = false; */
/* return; */
if (isset($id)) {
$this->Customer->recursive = -1;
$customer = $this->Customer->read(null, $id);
$customer = $customer['Customer'];
$unreconciled = $this->Customer->findUnreconciledLedgerEntries($id);
$charges = $unreconciled['debit'];
$leases = $this->Customer->find('first', array('contain' => array('CurrentLease'),
'conditions' => array('Customer.id' => $id)));
$deposits = array();
foreach ($leases['CurrentLease'] AS $lease) {
$lease_deposits = $this->Customer->Lease->findSecurityDeposits($lease['id']);
$deposits[] = array('lease_id' => $lease['id'],
'balance' => $lease_deposits['summary']['balance']);
}
pr($deposits);
$this->set(compact('deposits'));
}
else {
$customer = null;
@@ -460,23 +445,12 @@ class CustomersController extends AppController {
$unreconciled = $this->Customer->findUnreconciledLedgerEntries($id);
$unreconciled = array('entries' =>
array_intersect_key($unreconciled['debit'],
array('entry'=>1, 'balance'=>1)),
'deposit' => array(),
);
array('entry'=>1, 'balance'=>1)));
// XML Helper will dump an empty tag if the array is empty
if (!count($unreconciled['entries']['entry']))
unset($unreconciled['entries']['entry']);
$leases = $this->Customer->find('first', array('contain' => array('CurrentLease'),
'conditions' => array('Customer.id' => $id)));
foreach ($leases['CurrentLease'] AS $lease) {
$lease_deposits = $this->Customer->Lease->findSecurityDeposits($lease['id']);
$unreconciled['deposit'][]
= array('lease_id' => $lease['id'],
'balance' => $lease_deposits['summary']['balance']);
}
pr($unreconciled);
//$reconciled = $cust->reconcileNewLedgerEntry($cust_id, 'credit', $amount);