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:
@@ -254,56 +254,24 @@ class Lease extends AppModel {
|
|||||||
array('alias' => 'ReceiptLedgerEntry',
|
array('alias' => 'ReceiptLedgerEntry',
|
||||||
'fields' => array(),
|
'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
|
// Finally, the Money (Cash/Check/etc) Entry is the one
|
||||||
// which reconciles our ReceiptLedgerEntry debit
|
// which reconciles our ReceiptLedgerEntry debit
|
||||||
'DebitReconciliationLedgerEntry' =>
|
'DebitReconciliationLedgerEntry' =>
|
||||||
array('alias' => 'MoneyLedgerEntry',
|
array('alias' => 'MoneyLedgerEntry',
|
||||||
'linkalias' => 'MoneyLedgerEntryR',
|
'linkalias' => 'MoneyLedgerEntryR',
|
||||||
'fields' => array('SUM(COALESCE(MoneyLedgerEntryR.amount,0)) AS paid'),
|
'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',
|
'fields' => array('LedgerEntry.amount',
|
||||||
'DATE_SUB(LedgerEntry.effective_date, INTERVAL 1 DAY) AS paid_through',
|
'DATE_SUB(LedgerEntry.effective_date, INTERVAL 1 DAY) AS paid_through',
|
||||||
),
|
),
|
||||||
// 'group' => 'LedgerEntry.id',
|
|
||||||
'group' => 'LedgerEntry.id HAVING paid <> LedgerEntry.amount',
|
'group' => 'LedgerEntry.id HAVING paid <> LedgerEntry.amount',
|
||||||
|
|
||||||
'conditions' => array(array('LedgerEntry.lease_id' => $id),
|
'conditions' => array(array('LedgerEntry.lease_id' => $id),
|
||||||
array('Account.id' => $this->LedgerEntry->Ledger->Account->rentAccountID()),
|
array('Account.id' => $this->LedgerEntry->Ledger->Account->rentAccountID()),
|
||||||
//array('paid =' => 'LedgerEntry.amount'),
|
|
||||||
//array('NOT' => array(array('MoneyLedgerEntry.id' => null))),
|
|
||||||
),
|
),
|
||||||
'order' => array('LedgerEntry.effective_date',
|
'order' => array('LedgerEntry.effective_date',
|
||||||
),
|
),
|
||||||
|
|||||||
Reference in New Issue
Block a user