First pass at a charge waiver implementation. It hasn't been tested but for a tiny bit.
git-svn-id: file:///svn-source/pmgr/branches/yafr_20090716@471 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
@@ -22,7 +22,7 @@ class StatementEntry extends AppModel {
|
||||
|
||||
);
|
||||
|
||||
//var $default_log_level = 30;
|
||||
var $default_log_level = 30;
|
||||
|
||||
/**************************************************************************
|
||||
**************************************************************************
|
||||
@@ -106,6 +106,39 @@ class StatementEntry extends AppModel {
|
||||
}
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
**************************************************************************
|
||||
**************************************************************************
|
||||
* function: waive
|
||||
* - Waives the charges
|
||||
*
|
||||
*/
|
||||
function waive($id, $stamp = null) {
|
||||
$this->prEnter(compact('id', 'stamp'));
|
||||
|
||||
$this->recursive = -1;
|
||||
$charge = $this->read(null, $id);
|
||||
$charge = $charge['StatementEntry'];
|
||||
|
||||
// Build a transaction
|
||||
$waiver = array('Transaction' => array(), 'Entry' => array());
|
||||
$waiver['Transaction']['stamp'] = $stamp;
|
||||
$waiver['Transaction']['comment'] = "Charge Waiver";
|
||||
|
||||
if ($charge['type'] !== 'CHARGE')
|
||||
die("INTERNAL ERROR: WAIVER ITEM IS NOT CHARGE");
|
||||
|
||||
$waiver['Entry'][] =
|
||||
array('amount' => $charge['amount'],
|
||||
'account_id' => $this->Account->waiverAccountID(),
|
||||
'comment' => null,
|
||||
);
|
||||
|
||||
return $this->prReturn($this->Transaction->addWaiver
|
||||
($waiver, $id, $charge['customer_id'], $charge['lease_id']));
|
||||
}
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
**************************************************************************
|
||||
**************************************************************************
|
||||
@@ -334,7 +367,7 @@ OPTION 2
|
||||
* the user to specify how payments should be applied.
|
||||
*
|
||||
*/
|
||||
function assignCredits($query = null, $receipt_id = null) {
|
||||
function assignCredits($query = null, $receipt_id = null, $charge_ids = null) {
|
||||
//$this->prFunctionLevel(25);
|
||||
$this->prEnter( compact('query', 'receipt_id'));
|
||||
$this->queryInit($query);
|
||||
@@ -374,7 +407,12 @@ OPTION 2
|
||||
}
|
||||
|
||||
// Now find all unpaid charges
|
||||
$lquery = $query;
|
||||
if (isset($charge_ids)) {
|
||||
$lquery = array('contain' => false,
|
||||
'conditions' => array('StatementEntry.id' => $charge_ids));
|
||||
} else {
|
||||
$lquery = $query;
|
||||
}
|
||||
$lquery['order'] = 'StatementEntry.effective_date ASC';
|
||||
$charges = $this->reconciledSet('CHARGE', $lquery, true);
|
||||
$this->pr(18, compact('charges'),
|
||||
|
||||
Reference in New Issue
Block a user