Initial thoughts on the charge reversal. It's obviously not working yet, or I wouldn't leave it hanging on a branch.
git-svn-id: file:///svn-source/pmgr/branches/alt_reversal_20090806@502 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
@@ -22,7 +22,7 @@ class StatementEntry extends AppModel {
|
||||
|
||||
);
|
||||
|
||||
//var $default_log_level = array('log' => 30, 'show' => 15);
|
||||
var $default_log_level = array('log' => 30, 'show' => 15);
|
||||
|
||||
/**************************************************************************
|
||||
**************************************************************************
|
||||
@@ -198,6 +198,11 @@ class StatementEntry extends AppModel {
|
||||
if ($charge['type'] !== 'CHARGE')
|
||||
INTERNAL_ERROR("Reversal item is not CHARGE.");
|
||||
|
||||
// Build a transaction
|
||||
$reversal = array('Transaction' => array(), 'Entry' => array());
|
||||
$reversal['Transaction']['stamp'] = $stamp;
|
||||
$reversal['Transaction']['comment'] = "Credit Note: Charge Reversal";
|
||||
|
||||
$voided_entry_transactions = array();
|
||||
$reconciled = $this->reconciledEntries($id);
|
||||
$this->pr(21, compact('reconciled'));
|
||||
@@ -207,34 +212,29 @@ class StatementEntry extends AppModel {
|
||||
if ($entry['DisbursementEntry']['type'] === 'REVERSAL')
|
||||
INTERNAL_ERROR("Charge has already been reversed");
|
||||
|
||||
$voided_entry_transactions[$entry['DisbursementEntry']['transaction_id']]
|
||||
= array_intersect_key($entry['DisbursementEntry'],
|
||||
array('customer_id'=>1, 'lease_id'=>1));
|
||||
/* $voided_entry_transactions[$entry['DisbursementEntry']['transaction_id']] */
|
||||
/* = array_intersect_key($entry['DisbursementEntry'], */
|
||||
/* array('customer_id'=>1, 'lease_id'=>1)); */
|
||||
|
||||
$this->del($entry['DisbursementEntry']['id']);
|
||||
continue;
|
||||
|
||||
$DE = new StatementEntry();
|
||||
$DE->id = $entry['DisbursementEntry']['id'];
|
||||
$DE->saveField('type', 'VOID');
|
||||
$DE->saveField('charge_entry_id', null);
|
||||
/* $reversal['Entry'][] = */
|
||||
/* array_intersect_key($entry['DisbursementEntry'], */
|
||||
/* array_flip(array('amount', 'account_id', 'charge_entry_id'))) */
|
||||
/* + array('type' => 'SURPLUS', */
|
||||
/* 'comment' => 'Release of funds applied to reversed charge', */
|
||||
/* ); */
|
||||
}
|
||||
$this->pr(17, compact('voided_entry_transactions'));
|
||||
/* $this->pr(17, compact('voided_entry_transactions')); */
|
||||
}
|
||||
|
||||
// Query the stats to get the remaining balance
|
||||
$stats = $this->stats($id);
|
||||
|
||||
// Build a transaction
|
||||
$reversal = array('Transaction' => array(), 'Entry' => array());
|
||||
$reversal['Transaction']['stamp'] = $stamp;
|
||||
$reversal['Transaction']['comment'] = "Credit Note: Charge Reversal";
|
||||
|
||||
// Add the charge reversal
|
||||
$reversal['Entry'][] =
|
||||
array('amount' => $stats['Charge']['balance'],
|
||||
'account_id' => $charge['account_id'],
|
||||
'comment' => 'Charge Reversal',
|
||||
array('charge_entry_id' => $id,
|
||||
'amount' => -1 * $stats['Charge'][$balance ? 'balance' : 'total'],
|
||||
'account_id' => $charge['account_id'],
|
||||
'comment' => 'Charge Reversal',
|
||||
);
|
||||
|
||||
// Record the reversal transaction
|
||||
|
||||
Reference in New Issue
Block a user