Changed the reconciledSet to provide an option for returning partially reconciled results. This keeps the same behavior so as not to break anything (although I can only think of paid rents that might suffer).

git-svn-id: file:///svn-source/pmgr/branches/yafr_20090716/site@462 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
abijah
2009-07-31 21:07:00 +00:00
parent 4ef09080be
commit b00944a412

View File

@@ -249,8 +249,9 @@ OPTION 2
return $query; return $query;
} }
function reconciledSet($set, $query = null, $unrec = false) { function reconciledSet($set, $query = null, $unrec = false, $if_rec_include_partial = false) {
$this->prEnter(compact('set', 'query', 'unrec')); //$this->prFunctionLevel(16);
$this->prEnter(compact('set', 'query', 'unrec', 'if_rec_include_partial'));
$lquery = $this->reconciledSetQuery($set, $query); $lquery = $this->reconciledSetQuery($set, $query);
$result = $this->find('all', $lquery); $result = $this->find('all', $lquery);
@@ -268,14 +269,17 @@ OPTION 2
// Since HAVING isn't a builtin feature of CakePHP, // Since HAVING isn't a builtin feature of CakePHP,
// we'll have to post-process to get the desired entries // we'll have to post-process to get the desired entries
if ($entry['StatementEntry']['balance'] == 0) {
if (!$unrec) if ($entry['StatementEntry']['balance'] == 0)
$resultset[] = $entry; $reconciled = true;
} elseif ($entry['StatementEntry']['reconciled'] == 0)
else { $reconciled = false;
if ($unrec) else // Partial payment; depends on unrec
$resultset[] = $entry; $reconciled = (!$unrec && $if_rec_include_partial);
}
// Add to the set, if it's been requested
if ($reconciled == !$unrec)
$resultset[] = $entry;
} }
return $this->prReturn(array('entries' => $resultset, return $this->prReturn(array('entries' => $resultset,