Merging version 2.1 RC to main trunk.
[fa-stable.git] / reporting / rep701.php
index f01628f8bd367ea3c7324f648262e76dc5a14629..63c90c39ede42b88b85206d4c4224389b1e33793 100644 (file)
@@ -1,5 +1,14 @@
 <?php
-
+/**********************************************************************
+    Copyright (C) FrontAccounting, LLC.
+       Released under the terms of the GNU General Public License, GPL, 
+       as published by the Free Software Foundation, either version 3 
+       of the License, or (at your option) any later version.
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
+    See the License here <http://www.gnu.org/licenses/gpl-3.0.html>.
+***********************************************************************/
 $page_security = 2;
 // ----------------------------------------------------------------
 // $ Revision: 2.0 $
@@ -7,16 +16,15 @@ $page_security = 2;
 // date_:      2005-05-19
 // Title:      Chart of GL Accounts
 // ----------------------------------------------------------------
-$path_to_root="../";
+$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/data_checks.inc");
-include_once($path_to_root . "gl/includes/gl_db.inc");
+include_once($path_to_root . "/includes/session.inc");
+include_once($path_to_root . "/includes/date_functions.inc");
+include_once($path_to_root . "/includes/data_checks.inc");
+include_once($path_to_root . "/gl/includes/gl_db.inc");
 
 //----------------------------------------------------------------------------------------------------
 
-// trial_inquiry_controls();
 print_Chart_of_Accounts();
 
 //----------------------------------------------------------------------------------------------------
@@ -25,10 +33,14 @@ function print_Chart_of_Accounts()
 {
        global $path_to_root;
 
-       include_once($path_to_root . "reporting/includes/pdf_report.inc");
-
        $showbalance = $_POST['PARAM_0'];
        $comments = $_POST['PARAM_1'];
+       $destination = $_POST['PARAM_2'];
+       if ($destination)
+               include_once($path_to_root . "/reporting/includes/excel_report.inc");
+       else
+               include_once($path_to_root . "/reporting/includes/pdf_report.inc");
+
        $dec = 0;
 
        $cols = array(0, 50, 300, 425, 500);
@@ -39,7 +51,7 @@ function print_Chart_of_Accounts()
        
        $params = array(0 => $comments);
 
-       $rep = new FrontReport(_('Chart of Accounts'), "ChartOfAccounts.pdf", user_pagesize());
+       $rep = new FrontReport(_('Chart of Accounts'), "ChartOfAccounts", user_pagesize());
        
        $rep->Font();
        $rep->Info($params, $cols, $headers, $aligns);
@@ -68,12 +80,14 @@ function print_Chart_of_Accounts()
                                $rep->Font('bold');
                                $rep->TextCol(0, 4, $account['AccountClassName']);
                                $rep->Font();
-                               $rep->row -= ($rep->lineHeight + 4);
+                               //$rep->row -= ($rep->lineHeight + 4);
+                               $rep->NewLine();
                        }
                        $group = $account['AccountTypeName'];
                        $rep->TextCol(0, 4, $account['AccountTypeName']);
                        //$rep->Line($rep->row - 4);
-                       $rep->row -= ($rep->lineHeight + 4);
+                       //$rep->row -= ($rep->lineHeight + 4);
+                       $rep->NewLine();
                }
                $classname = $account['AccountClassName'];
 
@@ -81,7 +95,7 @@ function print_Chart_of_Accounts()
                $rep->TextCol(1, 2,     $account['account_name']);
                $rep->TextCol(2, 3,     $account['account_code2']);
                if ($showbalance == 1)  
-                       $rep->TextCol(3, 4,     number_format2($balance, $dec));
+                       $rep->AmountCol(3, 4, $balance, $dec);
 
                $rep->NewLine();
                if ($rep->row < $rep->bottomMargin + 3 * $rep->lineHeight)