Cleanup of old lingering functions and some comment blocks
git-svn-id: file:///svn-source/pmgr/branches/yafr_20090716@423 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
@@ -149,78 +149,6 @@ class Customer extends AppModel {
|
||||
}
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
**************************************************************************
|
||||
**************************************************************************
|
||||
* function: paymentWouldReconcile
|
||||
* - Returns which charges a new payment would reconcile
|
||||
*
|
||||
* - REVISIT <AP> 20090617
|
||||
* This should be subject to different algorithms, such
|
||||
* as apply to oldest charges first, newest first, to fees
|
||||
* before rent, etc. Until we get there, I'll hardcode
|
||||
* whatever algorithm is simplest.
|
||||
*/
|
||||
|
||||
function paymentWouldReconcile($id, $amount, $query = null) {
|
||||
$unreconciled = array($ofund => array('entry'=>array(), 'balance'=>0));
|
||||
$applied = 0;
|
||||
|
||||
if ($amount <= 0)
|
||||
return;
|
||||
|
||||
$unreconciled = array();
|
||||
$unreconciled['entries'] = $this->unreconciledCharges($id, $query);
|
||||
|
||||
foreach ($unreconciled['entries'] AS $i => &$item) {
|
||||
$entry =& $item['StatementEntry'];
|
||||
// Determine if amount is sufficient to cover the entry
|
||||
if ($amount > $entry['balance'])
|
||||
$apply = $entry['balance'];
|
||||
elseif ($amount > 0)
|
||||
$apply = $amount;
|
||||
else {
|
||||
unset($unreconciled[$i]);
|
||||
continue;
|
||||
}
|
||||
|
||||
$entry['applied'] = $apply;
|
||||
$entry['reconciled'] += $apply;
|
||||
$entry['balance'] -= $apply;
|
||||
$applied += $apply;
|
||||
$amount -= $apply;
|
||||
}
|
||||
|
||||
$unreconciled['unapplied'] = $amount;
|
||||
$unreconciled['applied'] = $applied;
|
||||
$unreconciled['balance'] -= $applied;
|
||||
return $unreconciled;
|
||||
}
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
**************************************************************************
|
||||
**************************************************************************
|
||||
* function: reconcileLedgerEntries
|
||||
* - Returns which ledger entries a new credit/debit would
|
||||
* reconcile, and how much.
|
||||
*
|
||||
* - REVISIT <AP> 20090617
|
||||
* This should be subject to different algorithms, such
|
||||
* as apply to oldest charges first, newest first, to fees
|
||||
* before rent, etc. Until we get there, I'll hardcode
|
||||
* whatever algorithm is simplest.
|
||||
*/
|
||||
|
||||
function reconcileLedgerEntries($id) {
|
||||
$A = new Account();
|
||||
$reconciled = $A->reconcileLedgerEntries
|
||||
($A->accountReceivableAccountID(),
|
||||
array('StatementEntry.customer_id' => $id));
|
||||
|
||||
return $reconciled;
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
**************************************************************************
|
||||
**************************************************************************
|
||||
|
||||
Reference in New Issue
Block a user