More work on refund. I'm going to skip the whole voucher/credit_note bit and simply present a page that lets the user enter a date, an account, and the amount to refund, recording 1 payment transaction.

git-svn-id: file:///svn-source/pmgr/branches/yafr_20090716@491 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
abijah
2009-08-06 02:52:45 +00:00
parent cca698d437
commit 4d62d7da73
7 changed files with 111 additions and 73 deletions

View File

@@ -332,17 +332,17 @@ class Transaction extends AppModel {
$refund =& $data['Transaction'];
$refund +=
array('type' => 'CREDIT_NOTE',
'crdr' => 'CREDIT',
'account_id' => $this->Account->accountPayableAccountID(),
'crdr' => 'DEBIT',
'account_id' => $this->Account->accountReceivableAccountID(),
'customer_id' => $customer_id,
'lease_id' => $lease_id,
);
// Go through the statement entries and flag as vouchers
foreach ($data['Entry'] AS &$entry)
$entry += array('type' => 'VOUCHER',
'crdr' => 'DEBIT',
'account_id' => $this->Account->accountReceivableAccountID(),
$entry += array('type' => 'VOUCHER',
'crdr' => 'CREDIT',
'account_id' => $this->Account->accountPayableAccountID(),
);
$ids = $this->addTransaction($data['Transaction'], $data['Entry']);
@@ -575,9 +575,9 @@ class Transaction extends AppModel {
// (DISBURSEMENTS will have statement entries created below, when
// assigning credits, and DEPOSITS don't have statement entries)
if (($transaction['account_id'] != $this->Account->accountReceivableAccountID() &&
$transaction['account_id'] != $this->Account->nsfAccountID()) ||
$transaction['crdr'] != 'DEBIT')
if (empty($transaction['customer_id']) ||
($transaction['account_id'] == $this->Account->accountReceivableAccountID() &&
$transaction['crdr'] == 'CREDIT'))
$se = null;
// NSF transactions don't use LedgerEntries