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@163 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
@@ -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'];
|
||||
|
||||
Reference in New Issue
Block a user