Making progress. Much still to do, but there are hints of functionality finally returning so I'm snapshotting.
git-svn-id: file:///svn-source/pmgr/branches/yafr_20090716/site@360 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
@@ -1,17 +1,14 @@
|
||||
<?php
|
||||
class Transaction extends AppModel {
|
||||
|
||||
var $validate = array(
|
||||
'stamp' => array('date')
|
||||
);
|
||||
|
||||
var $belongsTo = array(
|
||||
'Customer',
|
||||
'Lease',
|
||||
'Account',
|
||||
'Ledger',
|
||||
);
|
||||
|
||||
var $hasMany = array(
|
||||
'DoubleEntry',
|
||||
'LedgerEntry',
|
||||
'StatementEntry',
|
||||
);
|
||||
|
||||
|
||||
@@ -37,15 +34,15 @@ class Transaction extends AppModel {
|
||||
|
||||
// Determine the total charges on the invoice
|
||||
$invoice['amount'] = 0;
|
||||
foreach ($data['DoubleEntry'] AS $entry)
|
||||
foreach ($data['LedgerEntry'] AS $entry)
|
||||
$invoice['amount'] += $entry['amount'];
|
||||
|
||||
// Go through the entered charges
|
||||
foreach ($data['DoubleEntry'] AS $entry) {
|
||||
foreach ($data['LedgerEntry'] AS $entry) {
|
||||
//pr(compact('entry'));
|
||||
// Create the receipt entry, and reconcile the credit side
|
||||
// of the double-entry (which should be A/R) as a payment.
|
||||
$ids = $this->DoubleEntry->Ledger->Account->postDoubleEntry
|
||||
$ids = $this->LedgerEntry->Ledger->Account->postLedgerEntry
|
||||
($invoice,
|
||||
array('debit_ledger_id' => $A->currentLedgerID($A->accountReceivableAccountID()),
|
||||
'credit_ledger_id' => $A->currentLedgerID($entry['account_id'])
|
||||
@@ -83,14 +80,14 @@ class Transaction extends AppModel {
|
||||
|
||||
// Determine the total charges on the receipt
|
||||
$receipt['amount'] = 0;
|
||||
foreach ($data['DoubleEntry'] AS $entry)
|
||||
foreach ($data['LedgerEntry'] AS $entry)
|
||||
$receipt['amount'] += $entry['amount'];
|
||||
|
||||
// Go through the entered charges
|
||||
foreach ($data['DoubleEntry'] AS $entry) {
|
||||
foreach ($data['LedgerEntry'] AS $entry) {
|
||||
// Create the receipt entry, and reconcile the credit side
|
||||
// of the double-entry (which should be A/R) as a receipt.
|
||||
$ids = $this->DoubleEntry->Ledger->Account->postDoubleEntry
|
||||
$ids = $this->LedgerEntry->Ledger->Account->postLedgerEntry
|
||||
($receipt,
|
||||
array('debit_ledger_id' => $A->currentLedgerID($entry['account_id']),
|
||||
'credit_ledger_id' => $A->currentLedgerID($A->receiptAccountID())
|
||||
|
||||
Reference in New Issue
Block a user