More good progress on reversals. There is still an issue where after reversing, a disbursement can be applied to a new charge from the old charge account, instead of the surplus account. I'll work on that next.
git-svn-id: file:///svn-source/pmgr/branches/surplus_account_20090815@576 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
@@ -506,34 +506,15 @@ class Transaction extends AppModel {
|
||||
'amount' => $result['receipt_balance'],
|
||||
),
|
||||
));
|
||||
$ret['credit'] = $result;
|
||||
if ($result['error'])
|
||||
$ret['error'] = true;
|
||||
|
||||
/* $result = $this->addInvoice */
|
||||
/* (array('control' => array('assign' => false), */
|
||||
/* 'Transaction' => */
|
||||
/* array_intersect_key($transaction, array('stamp'=>1)) */
|
||||
/* + array('type' => 'CREDIT_NOTE'), */
|
||||
/* 'Entry' => array */
|
||||
/* (array('type' => 'SURPLUS', */
|
||||
/* 'account_id' => $this->Account->accountPayableAccountID(), */
|
||||
/* 'amount' => $result['receipt_balance'], */
|
||||
/* ), */
|
||||
/* ), */
|
||||
/* ), */
|
||||
/* $transaction['customer_id'], */
|
||||
/* $transaction['lease_id'] */
|
||||
/* ); */
|
||||
|
||||
/* $result2 = $this->StatementEntry->assignCredits */
|
||||
/* (null, */
|
||||
/* $ret['transaction_id'], */
|
||||
/* null, */
|
||||
/* null, */
|
||||
/* $transaction['customer_id'], */
|
||||
/* $transaction['lease_id'] */
|
||||
/* ); */
|
||||
|
||||
/* if (!empty($result2['receipt_balance'])) */
|
||||
/* $this->INTERNAL_ERROR('Surplus invoice did not resolve receipt balance'); */
|
||||
// Verify the explicit credit worked. Use either Debit or Credit
|
||||
// do determine the receipt total (they BETTER be the same value!)
|
||||
$stats = $this->stats($transaction['id']);
|
||||
if ($transaction['amount'] != $stats['StatementEntry']['disbursements'])
|
||||
$this->INTERNAL_ERROR('Explicit credit did not resolve receipt balance');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -971,10 +952,8 @@ class Transaction extends AppModel {
|
||||
'Transaction' =>
|
||||
array('stamp' => $stamp,
|
||||
'type' => 'CREDIT_NOTE',
|
||||
|
||||
'crdr' => 'CREDIT',
|
||||
'account_id' => $this->Account->accountReceivableAccountID(),
|
||||
|
||||
'crdr' => 'CREDIT',
|
||||
'account_id' => $this->Account->accountReceivableAccountID(),
|
||||
'amount' => $charge['StatementEntry']['amount'],
|
||||
'customer_id' => $charge['StatementEntry']['customer_id'],
|
||||
'lease_id' => null,
|
||||
|
||||
Reference in New Issue
Block a user