Added ability to waive a partial charge.
git-svn-id: file:///svn-source/pmgr/branches/yafr_20090716/site@472 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
@@ -270,7 +270,7 @@ class StatementEntriesController extends AppController {
|
|||||||
|
|
||||||
|
|
||||||
if (strtoupper($entry['StatementEntry']['type']) === 'CHARGE' &&
|
if (strtoupper($entry['StatementEntry']['type']) === 'CHARGE' &&
|
||||||
$stats['reconciled'] == 0) {
|
$stats['balance'] > 0) {
|
||||||
// Set up dynamic menu items
|
// Set up dynamic menu items
|
||||||
$this->sidemenu_links[] =
|
$this->sidemenu_links[] =
|
||||||
array('name' => 'Operations', 'header' => true);
|
array('name' => 'Operations', 'header' => true);
|
||||||
|
|||||||
@@ -116,10 +116,14 @@ class StatementEntry extends AppModel {
|
|||||||
function waive($id, $stamp = null) {
|
function waive($id, $stamp = null) {
|
||||||
$this->prEnter(compact('id', 'stamp'));
|
$this->prEnter(compact('id', 'stamp'));
|
||||||
|
|
||||||
|
// Get the basic information about the entry to be waived.
|
||||||
$this->recursive = -1;
|
$this->recursive = -1;
|
||||||
$charge = $this->read(null, $id);
|
$charge = $this->read(null, $id);
|
||||||
$charge = $charge['StatementEntry'];
|
$charge = $charge['StatementEntry'];
|
||||||
|
|
||||||
|
// Query the stats to get the remaining balance
|
||||||
|
$stats = $this->stats($id);
|
||||||
|
|
||||||
// Build a transaction
|
// Build a transaction
|
||||||
$waiver = array('Transaction' => array(), 'Entry' => array());
|
$waiver = array('Transaction' => array(), 'Entry' => array());
|
||||||
$waiver['Transaction']['stamp'] = $stamp;
|
$waiver['Transaction']['stamp'] = $stamp;
|
||||||
@@ -128,12 +132,14 @@ class StatementEntry extends AppModel {
|
|||||||
if ($charge['type'] !== 'CHARGE')
|
if ($charge['type'] !== 'CHARGE')
|
||||||
die("INTERNAL ERROR: WAIVER ITEM IS NOT CHARGE");
|
die("INTERNAL ERROR: WAIVER ITEM IS NOT CHARGE");
|
||||||
|
|
||||||
|
// Add the charge waiver
|
||||||
$waiver['Entry'][] =
|
$waiver['Entry'][] =
|
||||||
array('amount' => $charge['amount'],
|
array('amount' => $stats['Charge']['balance'],
|
||||||
'account_id' => $this->Account->waiverAccountID(),
|
'account_id' => $this->Account->waiverAccountID(),
|
||||||
'comment' => null,
|
'comment' => null,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Record the waiver transaction
|
||||||
return $this->prReturn($this->Transaction->addWaiver
|
return $this->prReturn($this->Transaction->addWaiver
|
||||||
($waiver, $id, $charge['customer_id'], $charge['lease_id']));
|
($waiver, $id, $charge['customer_id'], $charge['lease_id']));
|
||||||
}
|
}
|
||||||
@@ -369,7 +375,7 @@ OPTION 2
|
|||||||
*/
|
*/
|
||||||
function assignCredits($query = null, $receipt_id = null, $charge_ids = null) {
|
function assignCredits($query = null, $receipt_id = null, $charge_ids = null) {
|
||||||
//$this->prFunctionLevel(25);
|
//$this->prFunctionLevel(25);
|
||||||
$this->prEnter( compact('query', 'receipt_id'));
|
$this->prEnter( compact('query', 'receipt_id', 'charge_ids'));
|
||||||
$this->queryInit($query);
|
$this->queryInit($query);
|
||||||
|
|
||||||
$ret = array();
|
$ret = array();
|
||||||
@@ -603,7 +609,7 @@ OPTION 2
|
|||||||
$stats['Charge']['balance'] =
|
$stats['Charge']['balance'] =
|
||||||
$stats['Charge']['total'] - $stats['Charge']['reconciled'];
|
$stats['Charge']['total'] - $stats['Charge']['reconciled'];
|
||||||
|
|
||||||
$this->pr(17, compact('query', 'result'),
|
$this->pr(17, compact('rquery', 'result'),
|
||||||
'Charges');
|
'Charges');
|
||||||
|
|
||||||
$rquery = $query;
|
$rquery = $query;
|
||||||
|
|||||||
@@ -120,7 +120,7 @@ class Transaction extends AppModel {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
function addWaiver($data, $charge_id, $customer_id, $lease_id = null) {
|
function addWaiver($data, $charge_id, $customer_id, $lease_id = null) {
|
||||||
$this->prEnter(compact('data', 'customer_id', 'lease_id'));
|
$this->prEnter(compact('data', 'charge_id', 'customer_id', 'lease_id'));
|
||||||
|
|
||||||
// Just make sure the entries are marked as waivers...
|
// Just make sure the entries are marked as waivers...
|
||||||
foreach ($data['Entry'] AS &$entry)
|
foreach ($data['Entry'] AS &$entry)
|
||||||
|
|||||||
Reference in New Issue
Block a user