From 287d9f8f11d35b9ccb06af30d60c98c355e330ee Mon Sep 17 00:00:00 2001 From: abijah Date: Mon, 17 Aug 2009 06:31:42 +0000 Subject: [PATCH] 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/site@602 97e9348a-65ac-dc4b-aefc-98561f571b83 --- models/lease.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/models/lease.php b/models/lease.php index 437b607..217b683 100644 --- a/models/lease.php +++ b/models/lease.php @@ -150,6 +150,7 @@ class Lease extends AppModel { 'conditions' => array ('SEx.effective_date = DATE_ADD(StatementEntry.through_date, INTERVAL 1 day)', '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), array('StatementEntry.type' => 'CHARGE'), array('StatementEntry.account_id' => $rent_account_id), + array('StatementEntry.reverse_transaction_id IS NULL'), array('SEx.id' => null), ), ) @@ -259,7 +261,9 @@ class Lease extends AppModel { 'conditions' => 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'), ), @@ -278,7 +282,9 @@ class Lease extends AppModel { ('CHARGE', array('conditions' => 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'), ),