Switch to new access levels system
[fa-stable.git] / reporting / rep203.php
index 078c7c0801bc8e147efcf730963314d6f1091543..3ad684adc96085c7afd7b27bdb3a8c530d900437 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_SUPPPAYMREP';
 // ----------------------------------------------------------------
 // $ Revision: 2.0 $
 // Creator:    Joe Hunt
@@ -25,15 +25,13 @@ include_once($path_to_root . "/gl/includes/gl_db.inc");
 
 //----------------------------------------------------------------------------------------------------
 
-// trial_inquiry_controls();
 print_payment_report();
 
 function getTransactions($supplier, $date)
 {
        $date = date2sql($date);
 
-       $sql = "SELECT ".TB_PREF."sys_types.type_name,
-                       ".TB_PREF."supp_trans.supp_reference,
+       $sql = "SELECT ".TB_PREF."supp_trans.supp_reference,
                        ".TB_PREF."supp_trans.tran_date,
                        ".TB_PREF."supp_trans.due_date,
                        ".TB_PREF."supp_trans.trans_no,
@@ -41,10 +39,8 @@ function getTransactions($supplier, $date)
                        ".TB_PREF."supp_trans.rate,
                        (ABS(".TB_PREF."supp_trans.ov_amount) + ABS(".TB_PREF."supp_trans.ov_gst) - ".TB_PREF."supp_trans.alloc) AS Balance,
                        (ABS(".TB_PREF."supp_trans.ov_amount) + ABS(".TB_PREF."supp_trans.ov_gst) ) AS TranTotal
-               FROM ".TB_PREF."supp_trans,
-                       ".TB_PREF."sys_types
-               WHERE ".TB_PREF."sys_types.type_id = ".TB_PREF."supp_trans.type
-               AND ".TB_PREF."supp_trans.supplier_id = '" . $supplier . "'
+               FROM ".TB_PREF."supp_trans
+               WHERE ".TB_PREF."supp_trans.supplier_id = '" . $supplier . "'
                AND ABS(".TB_PREF."supp_trans.ov_amount) + ABS(".TB_PREF."supp_trans.ov_gst) - ".TB_PREF."supp_trans.alloc != 0
                AND ".TB_PREF."supp_trans.tran_date <='" . $date . "'
                ORDER BY ".TB_PREF."supp_trans.type,
@@ -65,15 +61,9 @@ function print_payment_report()
     $comments = $_POST['PARAM_3'];
        $destination = $_POST['PARAM_4'];
        if ($destination)
-       {
                include_once($path_to_root . "/reporting/includes/excel_report.inc");
-               $filename = "PaymentReport.xml";
-       }       
        else
-       {
                include_once($path_to_root . "/reporting/includes/pdf_report.inc");
-               $filename = "PaymentReport.pdf";
-       }
 
        if ($fromsupp == reserved_words::get_all_numeric())
                $from = _('All');
@@ -102,7 +92,7 @@ function print_payment_report()
                                    2 => array('text' => _('Supplier'), 'from' => $from, 'to' => ''),
                                    3 => array(  'text' => _('Currency'),'from' => $currency, 'to' => ''));
 
-    $rep = new FrontReport(_('Payment Report'), "PaymentReport.pdf", user_pagesize());
+    $rep = new FrontReport(_('Payment Report'), "PaymentReport", user_pagesize());
 
     $rep->Font();
     $rep->Info($params, $cols, $headers, $aligns);
@@ -141,7 +131,7 @@ function print_payment_report()
                        else
                                $rate = 1.0;
                        $rep->NewLine(1, 2);
-                       $rep->TextCol(0, 1,     $trans['type_name']);
+                       $rep->TextCol(0, 1,     systypes::name($trans['type']));
                        $rep->TextCol(1, 2,     $trans['supp_reference']);
                        if ($trans['type'] == 20)
                                $rep->DateCol(2, 3,     $trans['due_date'], true);