From aa682c9bb2b487bb07f126f321f768bc82252d22 Mon Sep 17 00:00:00 2001 From: abijah Date: Wed, 15 Jul 2009 09:22:19 +0000 Subject: [PATCH] minor cleanup of the paid through function git-svn-id: file:///svn-source/pmgr/branches/invoice_receipt_20090629@344 97e9348a-65ac-dc4b-aefc-98561f571b83 --- site/models/lease.php | 36 ++---------------------------------- 1 file changed, 2 insertions(+), 34 deletions(-) diff --git a/site/models/lease.php b/site/models/lease.php index 8d69a5c..c658d96 100644 --- a/site/models/lease.php +++ b/site/models/lease.php @@ -254,56 +254,24 @@ class Lease extends AppModel { array('alias' => 'ReceiptLedgerEntry', 'fields' => array(), - /* 'Transaction' => */ - /* array('alias' => 'ReceiptTransaction', */ - /* 'fields' => array(), */ - /* ), */ - - // Credit Ledger should be A/R; - // Debit Ledger should be Receipt - /* 'DebitLedger' => */ - /* array('alias' => 'ReceiptLedger', */ - /* 'fields' => array(), */ - /* 'Account' => array('alias' => 'ReceiptAccount' */ - /* 'fields' => array(), */ - /* ), */ - /* ), */ - // Finally, the Money (Cash/Check/etc) Entry is the one // which reconciles our ReceiptLedgerEntry debit 'DebitReconciliationLedgerEntry' => array('alias' => 'MoneyLedgerEntry', 'linkalias' => 'MoneyLedgerEntryR', 'fields' => array('SUM(COALESCE(MoneyLedgerEntryR.amount,0)) AS paid'), - //'fields' => array('MoneyLedgerEntryR.amount AS paid'), - - /* // Credit Ledger should be Receipt; */ - /* // Debit Ledger should be our Money Account */ - /* 'DebitLedger' => */ - /* array('alias' => 'MoneyLedger', */ - /* 'fields' => array(), */ - - /* 'Account' => */ - /* array('alias' => 'MoneyAccount', */ - /* 'fields' => array(), */ - /* ), */ - /* ), */ ), ), ), - //'fields' => array('LedgerEntry.*, MoneyLedgerEntryR.*'), - //'MAX(ReceiptTransaction.stamp) AS last_paid'; - 'fields' => array('LedgerEntry.amount', 'DATE_SUB(LedgerEntry.effective_date, INTERVAL 1 DAY) AS paid_through', ), -// 'group' => 'LedgerEntry.id', + 'group' => 'LedgerEntry.id HAVING paid <> LedgerEntry.amount', + 'conditions' => array(array('LedgerEntry.lease_id' => $id), array('Account.id' => $this->LedgerEntry->Ledger->Account->rentAccountID()), - //array('paid =' => 'LedgerEntry.amount'), - //array('NOT' => array(array('MoneyLedgerEntry.id' => null))), ), 'order' => array('LedgerEntry.effective_date', ),