Implemented Selectable Print Orientation (Portrait, Landscape) for all reports in...
[fa-stable.git] / reporting / rep708.php
index e57d0a9f7265860fa0908b758454aadc52ff6e9c..ff82c89bc1abec771b94d2dab003a93af3f6e129 100644 (file)
@@ -19,6 +19,7 @@ $page_security = 'SA_GLANALYTIC';
 $path_to_root="..";
 
 include_once($path_to_root . "/includes/session.inc");
+include_once($path_to_root . "/admin/db/fiscalyears_db.inc");
 include_once($path_to_root . "/includes/ui.inc");
 include_once($path_to_root . "/includes/date_functions.inc");
 include_once($path_to_root . "/includes/data_checks.inc");
@@ -37,7 +38,7 @@ function display_type ($type, $typename, &$dec, &$rep, $from, $to, $zero, $balan
        //Get Accounts directly under this group/type
        $accounts = get_gl_accounts(null, null, $type); 
        
-       $begin = begin_fiscalyear();
+       $begin = get_fiscalyear_begin_for_date($from);
        if (date1_greater_date2($begin, $from))
                $begin = $from;
        $begin = add_days($begin, -1);
@@ -146,23 +147,27 @@ function print_trial_balance()
                $dimension = $_POST['PARAM_4'];
                $dimension2 = $_POST['PARAM_5'];
                $comments = $_POST['PARAM_6'];
-               $destination = $_POST['PARAM_7'];
+               $orientation = $_POST['PARAM_7'];
+               $destination = $_POST['PARAM_8'];
        }
        else if ($dim == 1)
        {
                $dimension = $_POST['PARAM_4'];
                $comments = $_POST['PARAM_5'];
-               $destination = $_POST['PARAM_6'];
+               $orientation = $_POST['PARAM_6'];
+               $destination = $_POST['PARAM_7'];
        }
        else
        {
                $comments = $_POST['PARAM_4'];
-               $destination = $_POST['PARAM_5'];
+               $orientation = $_POST['PARAM_5'];
+               $destination = $_POST['PARAM_6'];
        }
        if ($destination)
                include_once($path_to_root . "/reporting/includes/excel_report.inc");
        else
                include_once($path_to_root . "/reporting/includes/pdf_report.inc");
+       $orientation = ($orientation ? 'L' : 'P');
        $dec = user_price_dec();
 
        $cols2 = array(0, 50, 190, 310, 430, 530);
@@ -202,12 +207,16 @@ function print_trial_balance()
                                    1 => array('text' => _('Period'),'from' => $from, 'to' => $to));
     }
 
-       $rep = new FrontReport(_('Trial Balance'), "TrialBalance", user_pagesize());
-
+       $rep = new FrontReport(_('Trial Balance'), "TrialBalance", user_pagesize(), 9, $orientation);
+    if ($orientation == 'L')
+    {
+       $rep->recalculate_cols($cols);
+       $rep->recalculate_cols($cols2);
+       }
        $rep->Font();
        $rep->Info($params, $cols, $headers, $aligns, $cols2, $headers2, $aligns2);
        $rep->NewPage();
-       
+
        $classresult = get_account_classes(false);
        while ($class = db_fetch($classresult))
        {
@@ -255,7 +264,7 @@ function print_trial_balance()
        else
                $rep->AmountCol(7, 8, abs($tbal), $dec);
        $rep->NewLine();
-               
+
        $rep->Line($rep->row + 10);
        if (($pbal = round2($pbal, $dec)) != 0.0 && $dimension == 0 && $dimension2 == 0)
        {