X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=gl%2Finquiry%2Fgl_trial_balance.php;h=c0a3e56ab1c15108466eb271e9c8250a5bf252eb;hb=61ba1cc9406056fdb2c22bd253521fae45e660c0;hp=6bf807cd83416d131df584c1c31a188ad6435bca;hpb=b7abcfdf70f6e1d61e977ac555603c591cf0006f;p=fa-stable.git diff --git a/gl/inquiry/gl_trial_balance.php b/gl/inquiry/gl_trial_balance.php index 6bf807cd..c0a3e56a 100644 --- a/gl/inquiry/gl_trial_balance.php +++ b/gl/inquiry/gl_trial_balance.php @@ -9,13 +9,14 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the License here . ***********************************************************************/ -$page_security = 8; +$page_security = 'SA_GLANALYTIC'; $path_to_root="../.."; include_once($path_to_root . "/includes/session.inc"); -include_once($path_to_root . "/includes/date_functions.inc"); include_once($path_to_root . "/includes/ui.inc"); +include_once($path_to_root . "/includes/date_functions.inc"); +include_once($path_to_root . "/admin/db/fiscalyears_db.inc"); include_once($path_to_root . "/includes/data_checks.inc"); include_once($path_to_root . "/gl/includes/gl_db.inc"); @@ -24,7 +25,7 @@ $js = ""; if ($use_date_picker) $js = get_js_date_picker(); -page(_("Trial Balance"), false, false, "", $js); +page(_($help_context = "Trial Balance"), false, false, "", $js); //---------------------------------------------------------------------------------------------------- // Ajax updates @@ -37,16 +38,21 @@ if (get_post('Show')) function gl_inquiry_controls() { + $dim = get_company_pref('use_dimension'); start_form(); - start_table("class='tablestyle_noborder'"); + start_table(TABLESTYLE_NOBORDER); date_cells(_("From:"), 'TransFromDate', '', null, -30); date_cells(_("To:"), 'TransToDate'); + if ($dim >= 1) + dimensions_list_cells(_("Dimension")." 1:", 'Dimension', null, true, " ", false, 1); + if ($dim > 1) + dimensions_list_cells(_("Dimension")." 2:", 'Dimension2', null, true, " ", false, 2); check_cells(_("No zero values"), 'NoZero', null); check_cells(_("Only balances"), 'Balance', null); - submit_cells('Show',_("Show"),'','', true); + submit_cells('Show',_("Show"),'','', 'default'); end_table(); end_form(); } @@ -55,10 +61,24 @@ function gl_inquiry_controls() function display_trial_balance() { - global $table_style, $path_to_root; + global $path_to_root; + if (isset($_POST['TransFromDate'])) + { + $row = get_current_fiscalyear(); + if (date1_greater_date2($_POST['TransFromDate'], sql2date($row['end']))) + { + display_error(_("The from date cannot be bigger than the fiscal year end.")); + set_focus('TransFromDate'); + return; + } + } div_start('balance_tbl'); - start_table($table_style); + if (!isset($_POST['Dimension'])) + $_POST['Dimension'] = 0; + if (!isset($_POST['Dimension2'])) + $_POST['Dimension2'] = 0; + start_table(TABLESTYLE); $tableheader = " " . _("Account") . " " . _("Account Name") . " @@ -87,14 +107,14 @@ function display_trial_balance() while ($account = db_fetch($accounts)) { - $prev = get_balance($account["account_code"], 0, 0, $begin, $_POST['TransFromDate'], false, false); - $curr = get_balance($account["account_code"], 0, 0, $_POST['TransFromDate'], $_POST['TransToDate'], true, true); - $tot = get_balance($account["account_code"], 0, 0, $begin, $_POST['TransToDate'], false, true); + $prev = get_balance($account["account_code"], $_POST['Dimension'], $_POST['Dimension2'], $begin, $_POST['TransFromDate'], false, false); + $curr = get_balance($account["account_code"], $_POST['Dimension'], $_POST['Dimension2'], $_POST['TransFromDate'], $_POST['TransToDate'], true, true); + $tot = get_balance($account["account_code"], $_POST['Dimension'], $_POST['Dimension2'], $begin, $_POST['TransToDate'], false, true); if (check_value("NoZero") && !$prev['balance'] && !$curr['balance'] && !$tot['balance']) continue; alt_table_row_color($k); - $url = "" . $account["account_code"] . ""; + $url = "" . $account["account_code"] . ""; label_cell($url); label_cell($account["account_name"]); @@ -149,6 +169,8 @@ function display_trial_balance() end_row(); end_table(1); + if (($pbal = round2($pbal, user_price_dec())) != 0) + display_warning(_("The Opening Balance is not in balance, probably due to a non closed Previous Fiscalyear.")); div_end(); }