Playing with different means for determining stats. Nothing decided yet.
git-svn-id: file:///svn-source/pmgr/branches/yafr_20090716@391 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
@@ -367,7 +367,7 @@ class Transaction extends AppModel {
|
||||
* function: stats
|
||||
* - Returns summary data from the requested transaction
|
||||
*/
|
||||
function stats($id = null, $query = null) {
|
||||
function stats($id = null, $query = null, $balance_account_id = null) {
|
||||
//pr(array('Transaction::stats' => compact('id', 'query')));
|
||||
|
||||
$this->queryInit($query);
|
||||
@@ -392,8 +392,13 @@ class Transaction extends AppModel {
|
||||
$squery['link'][$table] = array('fields' => array());
|
||||
|
||||
if ($table == 'LedgerEntry') {
|
||||
if (isset($balance_account_id)) {
|
||||
$squery['link']['LedgerEntry']['Account'] = array('fields' => array());
|
||||
$squery['conditions'][] = array("Account.id" => $balance_account_id);
|
||||
}
|
||||
|
||||
$squery['fields'] = array_merge($squery['fields'],
|
||||
$this->LedgerEntry->debitCreditFields(true, false));
|
||||
$this->LedgerEntry->debitCreditFields(true, $balance_account_id != null));
|
||||
}
|
||||
elseif ($table == 'StatementEntry') {
|
||||
$squery['fields'] = array_merge($squery['fields'],
|
||||
|
||||
Reference in New Issue
Block a user