Syntax typo.
[fa-stable.git] / reporting / rep202.php
index b193f5c7755fba5837d62b9bff6c3a5e90fa88c5..ba15545c846e4b3e6a63dff9e95afd627b630cd1 100644 (file)
@@ -9,7 +9,7 @@
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  
     See the License here <http://www.gnu.org/licenses/gpl-3.0.html>.
 ***********************************************************************/
-$page_security = 2;
+$page_security = 'SA_SUPPLIERANALYTIC';
 // ----------------------------------------------------------------
 // $ Revision: 2.0 $
 // Creator:    Joe Hunt
@@ -25,7 +25,6 @@ include_once($path_to_root . "/gl/includes/gl_db.inc");
 
 //----------------------------------------------------------------------------------------------------
 
-// trial_inquiry_controls();
 print_aged_supplier_analysis();
 
 //----------------------------------------------------------------------------------------------------
@@ -39,7 +38,7 @@ function get_invoices($supplier_id, $to)
        // Revomed allocated from sql
     $value = "(".TB_PREF."supp_trans.ov_amount + ".TB_PREF."supp_trans.ov_gst + ".TB_PREF."supp_trans.ov_discount)";
        $due = "IF (".TB_PREF."supp_trans.type=20 OR ".TB_PREF."supp_trans.type=21,".TB_PREF."supp_trans.due_date,".TB_PREF."supp_trans.tran_date)";
-       $sql = "SELECT ".TB_PREF."sys_types.type_name,
+       $sql = "SELECT ".TB_PREF."supp_trans.type,
                ".TB_PREF."supp_trans.reference,
                ".TB_PREF."supp_trans.tran_date,
                $value as Balance,
@@ -49,11 +48,9 @@ function get_invoices($supplier_id, $to)
 
                FROM ".TB_PREF."suppliers,
                        ".TB_PREF."payment_terms,
-                       ".TB_PREF."supp_trans,
-                       ".TB_PREF."sys_types
+                       ".TB_PREF."supp_trans
 
-               WHERE ".TB_PREF."sys_types.type_id = ".TB_PREF."supp_trans.type
-                       AND ".TB_PREF."suppliers.payment_terms = ".TB_PREF."payment_terms.terms_indicator
+               WHERE ".TB_PREF."suppliers.payment_terms = ".TB_PREF."payment_terms.terms_indicator
                        AND ".TB_PREF."suppliers.supplier_id = ".TB_PREF."supp_trans.supplier_id
                        AND ".TB_PREF."supp_trans.supplier_id = $supplier_id
                        AND ".TB_PREF."supp_trans.tran_date <= '$todate'
@@ -78,15 +75,9 @@ function print_aged_supplier_analysis()
     $comments = $_POST['PARAM_5'];
        $destination = $_POST['PARAM_6'];
        if ($destination)
-       {
                include_once($path_to_root . "/reporting/includes/excel_report.inc");
-               $filename = "AgedSupplierAnalysis.xml";
-       }       
        else
-       {
                include_once($path_to_root . "/reporting/includes/pdf_report.inc");
-               $filename = "AgedSupplierAnalysis.pdf";
-       }
        if ($graphics)
        {
                include_once($path_to_root . "/reporting/includes/class.graphic.inc");
@@ -131,7 +122,7 @@ function print_aged_supplier_analysis()
 
        if ($convert)
                $headers[2] = _('currency');
-    $rep = new FrontReport(_('Aged Supplier Analysis'), $filename, user_pagesize());
+    $rep = new FrontReport(_('Aged Supplier Analysis'), "AgedSupplierAnalysis", user_pagesize());
 
     $rep->Font();
     $rep->Info($params, $cols, $headers, $aligns);
@@ -191,7 +182,7 @@ function print_aged_supplier_analysis()
                        while ($trans=db_fetch($res))
                        {
                                $rep->NewLine(1, 2);
-                       $rep->TextCol(0, 1,     $trans['type_name'], -2);
+                       $rep->TextCol(0, 1,     systypes::name($trans['type']), -2);
                                $rep->TextCol(1, 2,     $trans['reference'], -2);
                                $rep->TextCol(2, 3,     sql2date($trans['tran_date']), -2);
                                foreach ($trans as $i => $value)