Fixed a bug with charge through / paid through, which was not taking into account reversed charges. I fear there are other conditions not being accounted for, not only here but throughout. One at a time for now...

git-svn-id: file:///svn-source/pmgr/branches/yafr_20090716@602 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
abijah
2009-08-17 06:31:42 +00:00
parent 73c5a20158
commit 589168440c

View File

@@ -150,6 +150,7 @@ class Lease extends AppModel {
'conditions' => array 'conditions' => array
('SEx.effective_date = DATE_ADD(StatementEntry.through_date, INTERVAL 1 day)', ('SEx.effective_date = DATE_ADD(StatementEntry.through_date, INTERVAL 1 day)',
'SEx.lease_id = StatementEntry.lease_id', 'SEx.lease_id = StatementEntry.lease_id',
'SEx.reverse_transaction_id IS NULL',
), ),
), ),
), ),
@@ -159,6 +160,7 @@ class Lease extends AppModel {
'conditions' => array(array('Lease.id' => $id), 'conditions' => array(array('Lease.id' => $id),
array('StatementEntry.type' => 'CHARGE'), array('StatementEntry.type' => 'CHARGE'),
array('StatementEntry.account_id' => $rent_account_id), array('StatementEntry.account_id' => $rent_account_id),
array('StatementEntry.reverse_transaction_id IS NULL'),
array('SEx.id' => null), array('SEx.id' => null),
), ),
) )
@@ -259,7 +261,9 @@ class Lease extends AppModel {
'conditions' => 'conditions' =>
array(array('StatementEntry.lease_id' => $id), array(array('StatementEntry.lease_id' => $id),
array('StatementEntry.account_id' => $rent_account_id)), array('StatementEntry.account_id' => $rent_account_id),
array('StatementEntry.reverse_transaction_id IS NULL'),
),
'order' => array('StatementEntry.effective_date'), 'order' => array('StatementEntry.effective_date'),
), ),
@@ -278,7 +282,9 @@ class Lease extends AppModel {
('CHARGE', ('CHARGE',
array('conditions' => array('conditions' =>
array(array('StatementEntry.lease_id' => $id), array(array('StatementEntry.lease_id' => $id),
array('StatementEntry.account_id' => $rent_account_id)), array('StatementEntry.account_id' => $rent_account_id),
array('StatementEntry.reverse_transaction_id IS NULL'),
),
'order' => array('StatementEntry.through_date DESC'), 'order' => array('StatementEntry.through_date DESC'),
), ),