Fixed a bug that was causing some lease charge_through_date fields to be NULL, which in turn caused additional charges to be added in error when assessing charges. The problem was that we were looking for statement entry charges that were not followed by other statement entries the next month. The intention was to locate rent charges that were not matched by a rent charge the following month, but we were looking for any type of statement entry. The presently visible problem was with a disbursement the next month on Lease #21, leaving NO last charge, not even just the wrong date. However, the issue could even be as simple as a Cleaning charge the next month, so we now filter not only for charges, but rent charges.

git-svn-id: file:///svn-source/pmgr/branches/v0.2_work@963 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
abijah
2010-03-12 03:48:03 +00:00
parent 0a594bb5a9
commit 48631cffee
2 changed files with 10 additions and 2 deletions

View File

@@ -2,6 +2,12 @@
class CustomersController extends AppController { class CustomersController extends AppController {
// DEBUG FUNCTION ONLY!
// Call without id to update ALL customers
function force_update($id = null) {
$this->Customer->update($id);
$this->redirect(array('action'=>'index'));
}
/************************************************************************** /**************************************************************************
************************************************************************** **************************************************************************

View File

@@ -148,9 +148,11 @@ class Lease extends AppModel {
array('class' => 'StatementEntry', array('class' => 'StatementEntry',
'fields' => array(), 'fields' => array(),
'conditions' => array 'conditions' => array
('SEx.effective_date = DATE_ADD(StatementEntry.through_date, INTERVAL 1 day)', ('SEx.lease_id = StatementEntry.lease_id',
'SEx.lease_id = StatementEntry.lease_id', 'SEx.type' => 'CHARGE',
'SEx.account_id' => $rent_account_id,
'SEx.reverse_transaction_id IS NULL', 'SEx.reverse_transaction_id IS NULL',
'SEx.effective_date = DATE_ADD(StatementEntry.through_date, INTERVAL 1 day)',
), ),
), ),
), ),