Add refund capability to the customer, and in fact only the customer, as we've revoked refund capability from the lease. This is to help work through various issues surrounding use of security deposits and general refund functionality. For example, a customer who has overpayed (customer surplus, with zero balance on lease), and then moves out. Where that security deposit surplus goes has been a bit of a thorn. Hopefully, this resolves the issue, although there may still be some bugs to flush out.
git-svn-id: file:///svn-source/pmgr/branches/yafr_20090716@504 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
@@ -44,26 +44,26 @@ class Lease extends AppModel {
|
||||
$this->prEnter(compact('id', 'query'));
|
||||
$this->queryInit($query);
|
||||
|
||||
// REVISIT <AP>: 20090807
|
||||
// Let's try simplifying the security deposit issue.
|
||||
// Presume that security deposits are NOT used at all,
|
||||
// until the customer moves out of the unit. At that
|
||||
// time, the ENTIRE deposit is converted to customer
|
||||
// credit. Piece of cake.
|
||||
// For more information, see file revision history,
|
||||
// including the revision just before this, r503.
|
||||
|
||||
$this->id = $id;
|
||||
$moveout_date = $this->field('moveout_date');
|
||||
if (!empty($moveout_date))
|
||||
return $this->prReturn(0);
|
||||
|
||||
$query['conditions'][] = array('StatementEntry.lease_id' => $id);
|
||||
$query['conditions'][] = array('StatementEntry.account_id' =>
|
||||
$this->StatementEntry->Account->securityDepositAccountID());
|
||||
|
||||
// REVISIT <AP>: 20090804
|
||||
// Dilemma... how to handle security deposits used to pay
|
||||
// charges on the lease, yet are not part of the lease
|
||||
// security deposit(s)? For example, Lease A & Lease B,
|
||||
// each with $25 Sec. Dep. Move out of Lease A, and
|
||||
// promote the lease surplus to the customer. A new
|
||||
// charge on Lease B for $15, which is assigned $15/$25
|
||||
// from the promoted Lease A surplus. They way this
|
||||
// function works at present, it will presume the $15 is
|
||||
// part of the security deposit balance, and will end up
|
||||
// calculating it as only $10, which is wrong. Perhaps
|
||||
// the fix is to release security deposits into some sort
|
||||
// of income account.
|
||||
|
||||
$stats = $this->StatementEntry->stats(null, $query);
|
||||
return $this->prReturn($stats['account_balance']);
|
||||
return $this->prReturn($stats['Charge']['disbursement']);
|
||||
}
|
||||
|
||||
|
||||
@@ -113,8 +113,12 @@ class Lease extends AppModel {
|
||||
$customer_id = $secdeps[0]['StatementEntry']['customer_id'];
|
||||
$lease_id = $secdeps[0]['StatementEntry']['lease_id'];
|
||||
|
||||
// Add receipt of the security deposit funds. Do NOT
|
||||
// flag them as part of the lease, as all received funds
|
||||
// are only associated with the customer, for future
|
||||
// (or present) disbursement on any lease.
|
||||
$result = $this->StatementEntry->Transaction->addReceipt
|
||||
($release, $customer_id, $lease_id);
|
||||
($release, $customer_id, null);
|
||||
|
||||
return $this->prReturn($result);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user