Further progress on payment entries. There is an outstanding charges grid, but it doesn't have amounts due to the way I designed the ledger_entries element. I'll do a bit of rework on that next.

git-svn-id: file:///svn-source/pmgr/branches/ledger_transactions_20090605/site@163 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
abijah
2009-06-18 00:49:40 +00:00
parent 1fbc452581
commit de2319e93d
7 changed files with 255 additions and 48 deletions

View File

@@ -236,7 +236,7 @@ class Account extends AppModel {
? array($fundamental_type)
: array('debit', 'credit')) AS $fund) {
$ucfund = ucfirst($fund);
$unreconciled[$fund]['entries'] = $this->find
$unreconciled[$fund]['entry'] = $this->find
('all', array
('link' => array
('Ledger' => array
@@ -261,7 +261,7 @@ class Account extends AppModel {
'fields' => array(),
));
$balance = 0;
foreach ($unreconciled[$fund]['entries'] AS &$entry) {
foreach ($unreconciled[$fund]['entry'] AS &$entry) {
$entry = array_merge(array_diff_key($entry["LedgerEntry"], array(0=>true)),
$entry[0]);
$balance += $entry['balance'];
@@ -289,7 +289,7 @@ class Account extends AppModel {
function reconcileNewLedgerEntry($id, $fundamental_type, $amount) {
$ofund = $this->fundamentalOpposite($fundamental_type);
$unreconciled = array($ofund => array('entries'=>array(), 'balance'=>0));
$unreconciled = array($ofund => array('entry'=>array(), 'balance'=>0));
$applied = 0;
// if there is no money in the entry, it can reconcile nothing
@@ -297,7 +297,7 @@ class Account extends AppModel {
if ($amount > 0) {
$unreconciled = $this->findUnreconciledLedgerEntries($id, $ofund);
foreach ($unreconciled[$ofund]['entries'] AS $i => &$entry) {
foreach ($unreconciled[$ofund]['entry'] AS $i => &$entry) {
// Determine if amount is sufficient to cover the entry
if ($amount > $entry['balance'])
$apply = $entry['balance'];