minor cleanup of the paid through function

git-svn-id: file:///svn-source/pmgr/branches/invoice_receipt_20090629/site@344 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
abijah
2009-07-15 09:22:19 +00:00
parent dd7da1489d
commit fcb23d12a5

View File

@@ -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',
),