Implemented refund, at least for the most part. Minor testing, but looks promising. Because of this change the customer account entries grid appears odd, with a refunds showing up as a 'Charge'. So, I'm toying with the idea of having entries show up as customer 'Debits' and 'Credits'. I don't know if this will cause user confusion, but we'll play with it for a while and see. It actually reminds me a bit (coming full circle) of the earliest implementations, which kept track of a lease on its own account/ledger, in which credit/debit would be the exact correct terms.

git-svn-id: file:///svn-source/pmgr/branches/yafr_20090716@493 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
abijah
2009-08-06 05:11:58 +00:00
parent 5a7b087ddc
commit e784931fa8
12 changed files with 238 additions and 134 deletions

View File

@@ -324,28 +324,21 @@ class Transaction extends AppModel {
function addRefund($data, $customer_id, $lease_id = null) {
$this->prEnter(compact('data', 'customer_id', 'lease_id'));
// REVISIT <AP>: 20090804
// NOT IMPLEMENTED AT ALL. Just cut and paste so far
return array('error' => true);
// Establish the transaction as a Refund
// Establish the transaction as a Refund. This is just like a
// Payment, except instead of paying out of the account payable,
// it comes from the customer credit in the account receivable.
// Someday, perhaps we'll just issue a Credit Note or similar,
// but for now, a refund means it's time to actually PAY.
$refund =& $data['Transaction'];
$refund +=
array('type' => 'CREDIT_NOTE',
'crdr' => 'DEBIT',
'account_id' => $this->Account->accountReceivableAccountID(),
'customer_id' => $customer_id,
'lease_id' => $lease_id,
);
array('account_id' => $this->Account->accountReceivableAccountID());
// Go through the statement entries and flag as vouchers
// Also, to make it clear to the user, we flag as a REFUND
// even though that type works and operates just as PAYMENT
foreach ($data['Entry'] AS &$entry)
$entry += array('type' => 'VOUCHER',
'crdr' => 'CREDIT',
'account_id' => $this->Account->accountPayableAccountID(),
);
$entry += array('type' => 'REFUND');
$ids = $this->addTransaction($data['Transaction'], $data['Entry']);
$ids = $this->addPayment($data, $customer_id, $lease_id);
if (isset($ids['transaction_id']))
$ids['refund_id'] = $ids['transaction_id'];
@@ -363,10 +356,6 @@ class Transaction extends AppModel {
function addPayment($data, $customer_id, $lease_id = null) {
$this->prEnter(compact('data', 'customer_id', 'lease_id'));
// REVISIT <AP>: 20090804
// NOT IMPLEMENTED AT ALL. Just cut and paste so far
return array('error' => true);
// Establish the transaction as an payment
$payment =& $data['Transaction'];
$payment +=