Check in the near completed implementation of security deposit utilization. It was on it's way to working well (although it only works for existing payment divs and there is not an obviously easy way for new payment divs to have the security deposit info as well). It feels like we've really gone overboard on the payment screen, pushing too much together. I'm going to strip some of this out on the next checkin, and create a dedicated security deposit utilization screen, perhaps just as part of move-out, or perhaps part of move-out and as an independent operation as well.

git-svn-id: file:///svn-source/pmgr/branches/invoice_receipt_20090629/site@292 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
abijah
2009-07-10 07:25:55 +00:00
parent ba82eabcbc
commit bcbe3767e3
6 changed files with 106 additions and 83 deletions

View File

@@ -399,12 +399,27 @@ 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;
@@ -445,12 +460,23 @@ class CustomersController extends AppController {
$unreconciled = $this->Customer->findUnreconciledLedgerEntries($id);
$unreconciled = array('entries' =>
array_intersect_key($unreconciled['debit'],
array('entry'=>1, 'balance'=>1)));
array('entry'=>1, 'balance'=>1)),
'deposit' => array(),
);
// 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);

View File

@@ -137,6 +137,14 @@ class TransactionsController extends AppController {
return;
}
foreach($this->data['LedgerEntry'] AS &$entry) {
if (!isset($entry['acct'][$entry['account_id']]))
continue;
$entry['MonetarySource'] = $entry['acct'][$entry['account_id']];
}
pr($this->data);
if (!$this->Transaction->addReceipt($this->data,
$this->data['Customer']['id'])) {
$this->Session->setFlash("RECEIPT FAILED", true);