Changed addReport method (better support for extension modules).
authorJanusz Dobrowolski <janusz@frontaccounting.eu>
Sun, 4 Apr 2010 12:01:18 +0000 (12:01 +0000)
committerJanusz Dobrowolski <janusz@frontaccounting.eu>
Sun, 4 Apr 2010 12:01:18 +0000 (12:01 +0000)
reporting/includes/reports_classes.inc
reporting/reports_main.php

index f9fa8696934174b212ccde8e0f1e613f5f74532d..c824ddc311dd3e036fd7fee7dadd9837b5d5e92f 100644 (file)
@@ -9,9 +9,20 @@
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
     See the License here <http://www.gnu.org/licenses/gpl-3.0.html>.
 ***********************************************************************/
+
+// Standard report classess
+define('RC_CUSTOMER', 0);
+define('RC_SUPPLIER', 1);
+define('RC_INVENTORY', 2);
+define('RC_MANUFACTURE', 3);
+define('RC_DIMENSIONS', 4);
+define('RC_BANKING', 5);
+define('RC_GL', 6);
+
 class BoxReports
 {
-       var $ar_classes;
+       var $ar_classes; // report class names
+       var $ar_reports;
        var $ctrl_handlers = array();
 
        function ReportClasses()
@@ -19,43 +30,47 @@ class BoxReports
                $this->ar_classes = array();
        }
 
-       function addReportClass($class_name)
+       function addReportClass($class_name, $class_id=null)
        {
-               $this->ar_classes[$class_name] = array();
+               if (!$class_id)
+                       $class_id = count($this->ar_classes);
+               $this->ar_classes[$class_id] = $class_name;
+
+               return $class_id;
        }
 
-       function addReport($class_name, $id, $rep_name, $params=null)
+       function addReport($class, $id, $rep_name, $params=null)
        {
-               unset($this->ar_classes[$class_name][$id]); // unset std report if any
-               $this->ar_classes[$class_name][$id] = new Report($id, $rep_name, $params);
+               unset($this->ar_reports[$class][$id]); // unset std report if any
+               $this->ar_reports[$class][$id] = new Report($id, $rep_name, $params);
        }
 
        function getDisplay($class=null)
        {
-               global $table_style, $comp_path, $path_to_root, $pdf_debug, $Ajax;
+               global $table_style, $path_to_root, $pdf_debug, $Ajax;
 
 
                $temp = array_values($this->ar_classes);
                $display_class = $class==null ? $temp[0] : $this->ar_classes[$class];
-               $class_counter = 0;
-               $rep_counter = 0;
                $st_reports = "";
                $st_params = "";
                $st_classes = "<b>" . _("Report Classes:") . "</b><br>";
-               foreach($this->ar_classes as $key=>$value)
+               foreach($this->ar_classes as $class_id => $name)
                {
-                       $style = $class_counter==$_REQUEST['Class'] ? '' : "style='display:none'";
-                       $acc = access_string($key);
+                       $style = $class_id==$_REQUEST['Class'] ? '' : "style='display:none'";
+//                     $cname = access_string($key, true);
+//                     $style = $_REQUEST['Class']==$cname ? '' : "style='display:none'";
+                       $acc = access_string($name);
                        $st_classes .= "<a href='"
-                               .$_SERVER['PHP_SELF']."?Class=$class_counter'"
+                               .$_SERVER['PHP_SELF']."?Class=$class_id'"
                                ." class='menu_option' id='".default_focus()."'"
-                               ." onclick='return showClass($class_counter);'$acc[1]>$acc[0]</a> <br>";
-                       $st_reports .= "<table id='TAB_" . $class_counter ."' $style cellpadding=0 cellspacing=0 width='100%'><tr><td><b>" . _("Reports For Class: ") . "&nbsp;$key</b></td></tr>\n";
-                       foreach($value as $report)
+                               ." onclick='return showClass(\"$class_id\");'$acc[1]>$acc[0]</a> <br>";
+                       $st_reports .= "<table class='repclass' id='TAB_" . $class_id ."' $style cellpadding=0 cellspacing=0 border=0 width='100%'><tr><td><b>" . _("Reports For Class: ") . "&nbsp;$name</b></td></tr>\n";
+                       foreach($this->ar_reports[$class_id] as $rep_id => $report)
                        {
                                $acc = access_string($report->name);
                                $st_reports .= "<tr><td><a class='printlink' href='"
-                                       .$_SERVER['PHP_SELF']."?Class=$class_counter&rep_id=$report->id'"
+                                       .$_SERVER['PHP_SELF']."?Class=$class_id&rep_id=$report->id'"
                                        ." id='".default_focus()."'"
                                        ."$acc[1]>$acc[0]</a><tr><td>\n";
                                if (isset($_REQUEST['rep_id']) && $_REQUEST['rep_id']==$report->id) {
@@ -74,7 +89,6 @@ class BoxReports
                                }
                        }
                        $st_reports .= "</table>";
-                       $class_counter++;
                }
 
                $st_params = "<div id='rep_form'>".
@@ -83,9 +97,11 @@ class BoxReports
 
                $st =   "<script language='javascript'>
                                        function showClass(pClass) {
-                                               for(i=0; i<$class_counter; i++) {
-                                                       document.getElementById(\"TAB_\" + i).style.display=
-                                                       i==pClass ? \"block\" : \"none\";
+                                               var classes = document.getElementsBySelector('.repclass');
+                                               for(var i in  classes) {
+                                                       cl = classes[i];
+                                                       cl.style.display=
+                                                       (cl.id==('TAB_'+pClass)) ? \"block\" : \"none\";
                                                }
                                                document.getElementById('rep_form').innerHTML = '';
 //                                             document.getElementById('rep_form').style.display = 'none';
@@ -429,23 +445,25 @@ function gl_systypes_list($name, $value=null, $spec_opt=false)
                        )
        );
 }
-
+/*
+       Add extension/custom reports to report manager.
+*/
 function add_custom_reports(&$reports)
 {
-       global $installed_extensions, $path_to_root, $comp_path;
+       global $installed_extensions, $path_to_root;
        
        // include reports installed inside extension modules
        if (count($installed_extensions) > 0)
        {
                $extensions = $installed_extensions;
                foreach ($extensions as $ext)
-                       if (($ext['active'] && $ext['type'] == 'module')) {
+                       if (($ext['active'] && $ext['type'] == 'extension')) {
                                $file = $path_to_root.'/'.$ext['path']."/reporting/reports_custom.php";
                                if (file_exists($file))
                                        include_once($file);
                        }
        }
-       $file = $comp_path.'/'.user_company()."/reporting/reports_custom.php";
+       $file = company_path()."/reporting/reports_custom.php";
        if (file_exists($file))
                include_once($file);
 }
index 5bc356a1ccee7f8c38dbea29d33c068c99ddf5d0..fe6db04f087cae4cd0e502e94f2181eca05c323a 100644 (file)
@@ -26,15 +26,15 @@ $reports = new BoxReports;
 
 $dim = get_company_pref('use_dimension');
 
-$reports->addReportClass(_('Customer'));
-$reports->addReport(_('Customer'),101,_('Customer &Balances'),
+$reports->addReportClass(_('Customer'), RC_CUSTOMER);
+$reports->addReport(RC_CUSTOMER, 101, _('Customer &Balances'),
        array(  _('Start Date') => 'DATEBEGIN',
                        _('End Date') => 'DATEENDM',
                        _('Customer') => 'CUSTOMERS_NO_FILTER',
                        _('Currency Filter') => 'CURRENCY',
                        _('Comments') => 'TEXTBOX',
                        _('Destination') => 'DESTINATION'));
-$reports->addReport(_('Customer'),102,_('&Aged Customer Analysis'),
+$reports->addReport(RC_CUSTOMER, 102, _('&Aged Customer Analysis'),
        array(  _('End Date') => 'DATE',
                        _('Customer') => 'CUSTOMERS_NO_FILTER',
                        _('Currency Filter') => 'CURRENCY',
@@ -42,7 +42,7 @@ $reports->addReport(_('Customer'),102,_('&Aged Customer Analysis'),
                        _('Graphics') => 'GRAPHIC',
                        _('Comments') => 'TEXTBOX',
                        _('Destination') => 'DESTINATION'));
-$reports->addReport(_('Customer'),103,_('Customer &Detail Listing'),
+$reports->addReport(RC_CUSTOMER, 103, _('Customer &Detail Listing'),
        array(  _('Activity Since') => 'DATEBEGIN',
                        _('Sales Areas') => 'AREAS',
                        _('Sales Folk') => 'SALESMEN',
@@ -50,7 +50,7 @@ $reports->addReport(_('Customer'),103,_('Customer &Detail Listing'),
                        _('Activity Less Than') => 'TEXT',
                        _('Comments') => 'TEXTBOX',
                        _('Destination') => 'DESTINATION'));
-$reports->addReport(_('Customer'),104,_('&Price Listing'),
+$reports->addReport(RC_CUSTOMER, 104, _('&Price Listing'),
        array(  _('Currency Filter') => 'CURRENCY',
                        _('Inventory Category') => 'CATEGORIES',
                        _('Sales Types') => 'SALESTYPES',
@@ -58,7 +58,7 @@ $reports->addReport(_('Customer'),104,_('&Price Listing'),
                        _('Show GP %') => 'YES_NO',
                        _('Comments') => 'TEXTBOX',
                        _('Destination') => 'DESTINATION'));
-$reports->addReport(_('Customer'),105,_('&Order Status Listing'),
+$reports->addReport(RC_CUSTOMER, 105, _('&Order Status Listing'),
        array(  _('Start Date') => 'DATEBEGINM',
                        _('End Date') => 'DATEENDM',
                        _('Inventory Category') => 'CATEGORIES',
@@ -66,64 +66,64 @@ $reports->addReport(_('Customer'),105,_('&Order Status Listing'),
                        _('Back Orders Only') => 'YES_NO',
                        _('Comments') => 'TEXTBOX',
                        _('Destination') => 'DESTINATION'));
-$reports->addReport(_('Customer'),106,_('&Salesman Listing'),
+$reports->addReport(RC_CUSTOMER, 106, _('&Salesman Listing'),
        array(  _('Start Date') => 'DATEBEGINM',
                        _('End Date') => 'DATEENDM',
                        _('Summary Only') => 'YES_NO',
                        _('Comments') => 'TEXTBOX',
                        _('Destination') => 'DESTINATION'));
-$reports->addReport(_('Customer'),107,_('Print &Invoices/Credit Notes'),
+$reports->addReport(RC_CUSTOMER, 107, _('Print &Invoices/Credit Notes'),
        array(  _('From') => 'INVOICE',
                        _('To') => 'INVOICE',
                        _('Currency Filter') => 'CURRENCY',
                        _('email Customers') => 'YES_NO',
                        _('Payment Link') => 'PAYMENT_LINK',
                        _('Comments') => 'TEXTBOX'));
-$reports->addReport(_('Customer'),110,_('Print &Deliveries'),
+$reports->addReport(RC_CUSTOMER, 110, _('Print &Deliveries'),
        array(  _('From') => 'DELIVERY',
                        _('To') => 'DELIVERY',
                        _('email Customers') => 'YES_NO',
                        _('Print as Packing Slip') => 'YES_NO',
                        _('Comments') => 'TEXTBOX'));
-$reports->addReport(_('Customer'),108,_('Print &Statements'),
-       array(  _('Customer') => 'CUSTOMERS_NO_FILTER',
+$reports->addReport(RC_CUSTOMER, 108, _('Print &Statements'),
+       array(  RC_CUSTOMER => 'CUSTOMERS_NO_FILTER',
                        _('Currency Filter') => 'CURRENCY',
                        _('Email Customers') => 'YES_NO',
                        _('Comments') => 'TEXTBOX'));
-$reports->addReport(_('Customer'),109,_('&Print Sales Orders'),
+$reports->addReport(RC_CUSTOMER, 109, _('&Print Sales Orders'),
        array(  _('From') => 'ORDERS',
                        _('To') => 'ORDERS',
                        _('Currency Filter') => 'CURRENCY',
                        _('Email Customers') => 'YES_NO',
                        _('Print as Quote') => 'YES_NO',
                        _('Comments') => 'TEXTBOX'));
-$reports->addReport(_('Customer'),111,_('&Print Sales Quotations'),
+$reports->addReport(RC_CUSTOMER, 111, _('&Print Sales Quotations'),
        array(  _('From') => 'QUOTATIONS',
                        _('To') => 'QUOTATIONS',
                        _('Currency Filter') => 'CURRENCY',
                        _('Email Customers') => 'YES_NO',
                        _('Comments') => 'TEXTBOX'));
-$reports->addReport(_('Customer'),111,_('&Print Sales Quotations'),
+$reports->addReport(RC_CUSTOMER, 111, _('&Print Sales Quotations'),
        array(  _('From') => 'QUOTATIONS',
                        _('To') => 'QUOTATIONS',
                        _('Currency Filter') => 'CURRENCY',
                        _('Email Customers') => 'YES_NO',
                        _('Comments') => 'TEXTBOX'));
-$reports->addReport(_('Customer'),112,_('Print Receipts'),
+$reports->addReport(RC_CUSTOMER, 112, _('Print Receipts'),
        array(  _('From') => 'RECEIPT',
                        _('To') => 'RECEIPT',
                        _('Currency Filter') => 'CURRENCY',
                        _('Comments') => 'TEXTBOX'));
 
-$reports->addReportClass(_('Supplier'));
-$reports->addReport(_('Supplier'),201,_('Supplier &Balances'),
+$reports->addReportClass(_('Supplier'), RC_SUPPLIER);
+$reports->addReport(RC_SUPPLIER, 201, _('Supplier &Balances'),
        array(  _('Start Date') => 'DATEBEGIN',
                        _('End Date') => 'DATEENDM',
                        _('Supplier') => 'SUPPLIERS_NO_FILTER',
                        _('Currency Filter') => 'CURRENCY',
                        _('Comments') => 'TEXTBOX',
                        _('Destination') => 'DESTINATION'));
-$reports->addReport(_('Supplier'),202,_('&Aged Supplier Analyses'),
+$reports->addReport(RC_SUPPLIER, 202, _('&Aged Supplier Analyses'),
        array(  _('End Date') => 'DATE',
                        _('Supplier') => 'SUPPLIERS_NO_FILTER',
                        _('Currency Filter') => 'CURRENCY',
@@ -131,42 +131,43 @@ $reports->addReport(_('Supplier'),202,_('&Aged Supplier Analyses'),
                        _('Graphics') => 'GRAPHIC',
                        _('Comments') => 'TEXTBOX',
                        _('Destination') => 'DESTINATION'));
-$reports->addReport(_('Supplier'),203,_('&Payment Report'),
+$reports->addReport(RC_SUPPLIER, 203, _('&Payment Report'),
        array(  _('End Date') => 'DATE',
                        _('Supplier') => 'SUPPLIERS_NO_FILTER',
                        _('Currency Filter') => 'CURRENCY',
                        _('Comments') => 'TEXTBOX',
                        _('Destination') => 'DESTINATION'));
-$reports->addReport(_('Supplier'),204,_('Outstanding &GRNs Report'),
+$reports->addReport(RC_SUPPLIER, 204, _('Outstanding &GRNs Report'),
        array(  _('Supplier') => 'SUPPLIERS_NO_FILTER',
                        _('Comments') => 'TEXTBOX',
                        _('Destination') => 'DESTINATION'));
-$reports->addReport(_('Supplier'),209,_('Print Purchase &Orders'),
+$reports->addReport(RC_SUPPLIER, 209, _('Print Purchase &Orders'),
        array(  _('From') => 'PO',
                        _('To') => 'PO',
                        _('Currency Filter') => 'CURRENCY',
                        _('Email Customers') => 'YES_NO',
                        _('Comments') => 'TEXTBOX'));
-$reports->addReport(_('Supplier'),210,_('Print Remittances'),
+$reports->addReport(RC_SUPPLIER, 210, _('Print Remittances'),
        array(  _('From') => 'REMITTANCE',
                        _('To') => 'REMITTANCE',
                        _('Currency Filter') => 'CURRENCY',
                        _('Email Customers') => 'YES_NO',
                        _('Comments') => 'TEXTBOX'));
 
-$reports->addReportClass(_('Inventory'));
-$reports->addReport(_('Inventory'),301,_('Inventory &Valuation Report'),
+$reports->addReportClass(_('Inventory'), RC_INVENTORY);
+
+$reports->addReport(RC_INVENTORY,  301, _('Inventory &Valuation Report'),
        array(  _('Inventory Category') => 'CATEGORIES',
                        _('Location') => 'LOCATIONS',
                        _('Summary Only') => 'YES_NO',
                        _('Comments') => 'TEXTBOX',
                        _('Destination') => 'DESTINATION'));
-$reports->addReport(_('Inventory'),302,_('Inventory &Planning Report'),
+$reports->addReport(RC_INVENTORY,  302, _('Inventory &Planning Report'),
        array(  _('Inventory Category') => 'CATEGORIES',
                        _('Location') => 'LOCATIONS',
                        _('Comments') => 'TEXTBOX',
                        _('Destination') => 'DESTINATION'));
-$reports->addReport(_('Inventory'),303,_('Stock &Check Sheets'),
+$reports->addReport(RC_INVENTORY, 303, _('Stock &Check Sheets'),
        array(  _('Inventory Category') => 'CATEGORIES',
                        _('Location') => 'LOCATIONS',
                        _('Show Pictures') => 'YES_NO',
@@ -174,7 +175,7 @@ $reports->addReport(_('Inventory'),303,_('Stock &Check Sheets'),
                        _('Show Shortage') => 'YES_NO',
                        _('Comments') => 'TEXTBOX',
                        _('Destination') => 'DESTINATION'));
-$reports->addReport(_('Inventory'),304,_('Inventory &Sales Report'),
+$reports->addReport(RC_INVENTORY, 304, _('Inventory &Sales Report'),
        array(  _('Start Date') => 'DATEBEGINM',
                        _('End Date') => 'DATEENDM',
                        _('Inventory Category') => 'CATEGORIES',
@@ -182,61 +183,61 @@ $reports->addReport(_('Inventory'),304,_('Inventory &Sales Report'),
                        _('Customer') => 'CUSTOMERS_NO_FILTER',
                        _('Comments') => 'TEXTBOX',
                        _('Destination') => 'DESTINATION'));
-$reports->addReport(_('Inventory'),305,_('&GRN Valuation Report'),
+$reports->addReport(RC_INVENTORY, 305, _('&GRN Valuation Report'),
        array(  _('Start Date') => 'DATEBEGINM',
                        _('End Date') => 'DATEENDM',
                        _('Comments') => 'TEXTBOX',
                        _('Destination') => 'DESTINATION'));
 
-$reports->addReportClass(_('Manufacturing'));
-$reports->addReport(_('Manufacturing'),401,_('&Bill of Material Listing'),
+$reports->addReportClass(_('Manufacturing'), RC_MANUFACTURE);
+$reports->addReport(RC_MANUFACTURE, 401, _('&Bill of Material Listing'),
        array(  _('From product') => 'ITEMS',
                        _('To product') => 'ITEMS',
                        _('Comments') => 'TEXTBOX',
                        _('Destination') => 'DESTINATION'));
-$reports->addReport(_('Manufacturing'),409,_('Print &Work Orders'),
+$reports->addReport(RC_MANUFACTURE, 409, _('Print &Work Orders'),
        array(  _('From') => 'WORKORDER',
                        _('To') => 'WORKORDER',
                        _('Email Locations') => 'YES_NO',
                        _('Comments') => 'TEXTBOX'));
-$reports->addReportClass(_('Dimensions'));
+$reports->addReportClass(_('Dimensions'), RC_DIMENSIONS);
 if ($dim > 0)
 {
-       $reports->addReport(_('Dimensions'),501,_('Dimension &Summary'),
+       $reports->addReport(RC_DIMENSIONS, 501, _('Dimension &Summary'),
        array(  _('From Dimension') => 'DIMENSION',
                        _('To Dimension') => 'DIMENSION',
                        _('Show Balance') => 'YES_NO',
                        _('Comments') => 'TEXTBOX',
                        _('Destination') => 'DESTINATION'));
-       //$reports->addReport(_('Dimensions'),502,_('Dimension Details'),
+       //$reports->addReport(_('Dimensions'),502, _('Dimension Details'),
        //array(        _('Dimension'),'DIMENSIONS'),
        //              _('Comments'),'TEXTBOX')));
 }
-$reports->addReportClass(_('Banking'));
-       $reports->addReport(_('Banking'),601,_('Bank &Statement'),
+$reports->addReportClass(_('Banking'), RC_BANKING);
+       $reports->addReport(RC_BANKING,  601, _('Bank &Statement'),
        array(  _('Bank Accounts') => 'BANK_ACCOUNTS',
                        _('Start Date') => 'DATEBEGINM',
                        _('End Date') => 'DATEENDM',
                        _('Comments') => 'TEXTBOX',
                        _('Destination') => 'DESTINATION'));
 
-$reports->addReportClass(_('General Ledger'));
-$reports->addReport(_('General Ledger'),701,_('Chart of &Accounts'),
+$reports->addReportClass(_('General Ledger'), RC_GL);
+$reports->addReport(RC_GL, 701, _('Chart of &Accounts'),
        array(  _('Show Balances') => 'YES_NO',
                        _('Comments') => 'TEXTBOX',
                        _('Destination') => 'DESTINATION'));
-$reports->addReport(_('General Ledger'),702,_('List of &Journal Entries'),
+$reports->addReport(RC_GL, 702, _('List of &Journal Entries'),
        array(  _('Start Date') => 'DATEBEGINM',
                        _('End Date') => 'DATEENDM',
                        _('Type') => 'SYS_TYPES',
                        _('Comments') => 'TEXTBOX',
                        _('Destination') => 'DESTINATION'));
-//$reports->addReport(_('General Ledger'),703,_('GL Account Group Summary'),
+//$reports->addReport(RC_GL, 703, _('GL Account Group Summary'),
 //     array(  _('Comments'),'TEXTBOX')));
 
 if ($dim == 2)
 {
-       $reports->addReport(_('General Ledger'),704,_('GL Account &Transactions'),
+       $reports->addReport(RC_GL, 704, _('GL Account &Transactions'),
        array(  _('Start Date') => 'DATEBEGINM',
                        _('End Date') => 'DATEENDM',
                        _('From Account') => 'GL_ACCOUNTS',
@@ -245,13 +246,13 @@ if ($dim == 2)
                        _('Dimension')." 2" =>  'DIMENSIONS2',
                        _('Comments') => 'TEXTBOX',
                        _('Destination') => 'DESTINATION'));
-       $reports->addReport(_('General Ledger'),705,_('Annual &Expense Breakdown'),
+       $reports->addReport(RC_GL, 705, _('Annual &Expense Breakdown'),
        array(  _('Year') => 'TRANS_YEARS',
                        _('Dimension')." 1" =>  'DIMENSIONS1',
                        _('Dimension')." 2" =>  'DIMENSIONS2',
                        _('Comments') => 'TEXTBOX',
                        _('Destination') => 'DESTINATION'));
-       $reports->addReport(_('General Ledger'),706,_('&Balance Sheet'),
+       $reports->addReport(RC_GL, 706, _('&Balance Sheet'),
        array(  _('Start Date') => 'DATEBEGIN',
                        _('End Date') => 'DATEENDM',
                        _('Dimension')." 1" => 'DIMENSIONS1',
@@ -260,7 +261,7 @@ if ($dim == 2)
                        _('Graphics') => 'GRAPHIC',
                        _('Comments') => 'TEXTBOX',
                        _('Destination') => 'DESTINATION'));
-       $reports->addReport(_('General Ledger'),707,_('&Profit and Loss Statement'),
+       $reports->addReport(RC_GL, 707, _('&Profit and Loss Statement'),
        array(  _('Start Date') => 'DATEBEGINM',
                        _('End Date') => 'DATEENDM',
                        _('Compare to') => 'COMPARE',
@@ -270,7 +271,7 @@ if ($dim == 2)
                        _('Graphics') => 'GRAPHIC',
                        _('Comments') => 'TEXTBOX',
                        _('Destination') => 'DESTINATION'));
-       $reports->addReport(_('General Ledger'),708,_('Trial &Balance'),
+       $reports->addReport(RC_GL, 708, _('Trial &Balance'),
        array(  _('Start Date') => 'DATEBEGINM',
                        _('End Date') => 'DATEENDM',
                        _('Zero values') => 'YES_NO',
@@ -282,7 +283,7 @@ if ($dim == 2)
 }
 else if ($dim == 1)
 {
-       $reports->addReport(_('General Ledger'),704,_('GL Account &Transactions'),
+       $reports->addReport(RC_GL, 704, _('GL Account &Transactions'),
        array(  _('Start Date') => 'DATEBEGINM',
                        _('End Date') => 'DATEENDM',
                        _('From Account') => 'GL_ACCOUNTS',
@@ -290,12 +291,12 @@ else if ($dim == 1)
                        _('Dimension') =>  'DIMENSIONS1',
                        _('Comments') => 'TEXTBOX',
                        _('Destination') => 'DESTINATION'));
-       $reports->addReport(_('General Ledger'),705,_('Annual &Expense Breakdown'),
+       $reports->addReport(RC_GL, 705, _('Annual &Expense Breakdown'),
        array(  _('Year') => 'TRANS_YEARS',
                        _('Dimension') =>  'DIMENSIONS1',
                        _('Comments') => 'TEXTBOX',
                        _('Destination') => 'DESTINATION'));
-       $reports->addReport(_('General Ledger'),706,_('&Balance Sheet'),
+       $reports->addReport(RC_GL, 706, _('&Balance Sheet'),
        array(  _('Start Date') => 'DATEBEGIN',
                        _('End Date') => 'DATEENDM',
                        _('Dimension') => 'DIMENSIONS1',
@@ -303,7 +304,7 @@ else if ($dim == 1)
                        _('Graphics') => 'GRAPHIC',
                        _('Comments') => 'TEXTBOX',
                        _('Destination') => 'DESTINATION'));
-       $reports->addReport(_('General Ledger'),707,_('&Profit and Loss Statement'),
+       $reports->addReport(RC_GL, 707, _('&Profit and Loss Statement'),
        array(  _('Start Date') => 'DATEBEGINM',
                        _('End Date') => 'DATEENDM',
                        _('Compare to') => 'COMPARE',
@@ -312,7 +313,7 @@ else if ($dim == 1)
                        _('Graphics') => 'GRAPHIC',
                        _('Comments') => 'TEXTBOX',
                        _('Destination') => 'DESTINATION'));
-       $reports->addReport(_('General Ledger'),708,_('Trial &Balance'),
+       $reports->addReport(RC_GL, 708, _('Trial &Balance'),
        array(  _('Start Date') => 'DATEBEGINM',
                        _('End Date') => 'DATEENDM',
                        _('Zero values') => 'YES_NO',
@@ -323,25 +324,25 @@ else if ($dim == 1)
 }
 else
 {
-       $reports->addReport(_('General Ledger'),704,_('GL Account &Transactions'),
+       $reports->addReport(RC_GL, 704, _('GL Account &Transactions'),
        array(  _('Start Date') => 'DATEBEGINM',
                        _('End Date') => 'DATEENDM',
                        _('From Account') => 'GL_ACCOUNTS',
                        _('To Account') => 'GL_ACCOUNTS',
                        _('Comments') => 'TEXTBOX',
                        _('Destination') => 'DESTINATION'));
-       $reports->addReport(_('General Ledger'),705,_('Annual &Expense Breakdown'),
+       $reports->addReport(RC_GL, 705, _('Annual &Expense Breakdown'),
        array(  _('Year') => 'TRANS_YEARS',
                        _('Comments') => 'TEXTBOX',
                        _('Destination') => 'DESTINATION'));
-       $reports->addReport(_('General Ledger'),706,_('&Balance Sheet'),
+       $reports->addReport(RC_GL, 706, _('&Balance Sheet'),
        array(  _('Start Date') => 'DATEBEGIN',
                        _('End Date') => 'DATEENDM',
                        _('Decimal values') => 'YES_NO',
                        _('Graphics') => 'GRAPHIC',
                        _('Comments') => 'TEXTBOX',
                        _('Destination') => 'DESTINATION'));
-       $reports->addReport(_('General Ledger'),707,_('&Profit and Loss Statement'),
+       $reports->addReport(RC_GL, 707, _('&Profit and Loss Statement'),
        array(  _('Start Date') => 'DATEBEGINM',
                        _('End Date') => 'DATEENDM',
                        _('Compare to') => 'COMPARE',
@@ -349,7 +350,7 @@ else
                        _('Graphics') => 'GRAPHIC',
                        _('Comments') => 'TEXTBOX',
                        _('Destination') => 'DESTINATION'));
-       $reports->addReport(_('General Ledger'),708,_('Trial &Balance'),
+       $reports->addReport(RC_GL, 708, _('Trial &Balance'),
        array(  _('Start Date') => 'DATEBEGINM',
                        _('End Date') => 'DATEENDM',
                        _('Zero values') => 'YES_NO',
@@ -357,12 +358,12 @@ else
                        _('Comments') => 'TEXTBOX',
                        _('Destination') => 'DESTINATION'));
 }
-$reports->addReport(_('General Ledger'),709,_('Ta&x Report'),
+$reports->addReport(RC_GL, 709, _('Ta&x Report'),
        array(  _('Start Date') => 'DATEBEGINTAX',
                        _('End Date') => 'DATEENDTAX',
                        _('Summary Only') => 'YES_NO',
                        _('Comments') => 'TEXTBOX'));
-$reports->addReport(_('General Ledger'),710,_('Audit Trail'),
+$reports->addReport(RC_GL, 710, _('Audit Trail'),
        array(  _('Start Date') => 'DATEBEGINM',
                        _('End Date') => 'DATEENDM',
                        _('Type') => 'SYS_TYPES_ALL',