diff --git a/account/application/controllers/accounts/Reports.php b/account/application/controllers/accounts/Reports.php index f6003ca..41df1a9 100644 --- a/account/application/controllers/accounts/Reports.php +++ b/account/application/controllers/accounts/Reports.php @@ -116,7 +116,7 @@ class Reports extends CI_Controller break; case 'balance_by_ledger': $accategory_id = 0; - $data['pageTitle'] = "Account Balances By Group"; + $data['pageTitle'] = "Account Balances By Ledgers"; if (isset($_GET['group'])) { $accategory_id = ($_GET['group']) ? $_GET['group'] : 0; } diff --git a/account/application/views/accounts/balances/byledger.php b/account/application/views/accounts/balances/byledger.php index e69de29..f5ee6cc 100644 --- a/account/application/views/accounts/balances/byledger.php +++ b/account/application/views/accounts/balances/byledger.php @@ -0,0 +1,133 @@ +acc->getAccountsByCategory($accategory_id); +$array = json_decode(json_encode($Accounts), true); +// print_r($array);die; +$tree = buildCategoryTree($array, false); +function buildCategoryTree($categories, $parent_id = 0, $showZero = true) +{ + $tree = array(); + foreach ($categories as $category) { + // print_r($category);die; + // print_r(myCurrency(getBalance($category['account_id'])));die; + $category['dr'] = getDrTotal('account_id'); + $category['cr'] = getCrTotal('account_id'); + if ($showZero && ($category['dr'] !== 0 || $category['cr'] !== 0)) { + $tree[] = $category; + } elseif (!$showZero && ($category['dr'] !== 0 && $category['cr'] !== 0)) { + $tree[] = $category; + } + } + + return $tree; +} +function displayCategoryTree($tree) +{ + echo '
Sn | '; + echo 'Account | '; + echo 'Balance | '; + echo '|
---|---|---|---|
' . $category['account_id'] . ' | '; + echo '' . $category['account_name'] . ' | '; + echo '' . myCurrency(getBalance($category['account_id'])) . ' | '; + $BalanceTotal += getBalance($category['account_id']); + echo '|
'; + displayCategoryTree($category['children']); + echo ' | '; + echo '|||
Total | " . myCurrency($BalanceTotal) . " |