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:
abijah
2009-08-03 04:14:44 +00:00
parent a59d93ebee
commit 7fda78f820
3 changed files with 11 additions and 5 deletions

View File

@@ -270,7 +270,7 @@ class StatementEntriesController extends AppController {
if (strtoupper($entry['StatementEntry']['type']) === 'CHARGE' &&
$stats['reconciled'] == 0) {
$stats['balance'] > 0) {
// Set up dynamic menu items
$this->sidemenu_links[] =
array('name' => 'Operations', 'header' => true);

View File

@@ -116,10 +116,14 @@ class StatementEntry extends AppModel {
function waive($id, $stamp = null) {
$this->prEnter(compact('id', 'stamp'));
// Get the basic information about the entry to be waived.
$this->recursive = -1;
$charge = $this->read(null, $id);
$charge = $charge['StatementEntry'];
// Query the stats to get the remaining balance
$stats = $this->stats($id);
// Build a transaction
$waiver = array('Transaction' => array(), 'Entry' => array());
$waiver['Transaction']['stamp'] = $stamp;
@@ -128,12 +132,14 @@ class StatementEntry extends AppModel {
if ($charge['type'] !== 'CHARGE')
die("INTERNAL ERROR: WAIVER ITEM IS NOT CHARGE");
// Add the charge waiver
$waiver['Entry'][] =
array('amount' => $charge['amount'],
array('amount' => $stats['Charge']['balance'],
'account_id' => $this->Account->waiverAccountID(),
'comment' => null,
);
// Record the waiver transaction
return $this->prReturn($this->Transaction->addWaiver
($waiver, $id, $charge['customer_id'], $charge['lease_id']));
}
@@ -369,7 +375,7 @@ OPTION 2
*/
function assignCredits($query = null, $receipt_id = null, $charge_ids = null) {
//$this->prFunctionLevel(25);
$this->prEnter( compact('query', 'receipt_id'));
$this->prEnter( compact('query', 'receipt_id', 'charge_ids'));
$this->queryInit($query);
$ret = array();
@@ -603,7 +609,7 @@ OPTION 2
$stats['Charge']['balance'] =
$stats['Charge']['total'] - $stats['Charge']['reconciled'];
$this->pr(17, compact('query', 'result'),
$this->pr(17, compact('rquery', 'result'),
'Charges');
$rquery = $query;

View File

@@ -120,7 +120,7 @@ class Transaction extends AppModel {
*/
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...
foreach ($data['Entry'] AS &$entry)