Switch to new access levels system
[fa-stable.git] / reporting / rep101.php
index 370ad954133b43c613c571c960e2154b452ee6e0..633ef3e9971b893ba5502f82621ecb80a34f165b 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_CUSTPAYMREP';
 
 // ----------------------------------------------------------------
 // $ Revision: 2.0 $
@@ -71,17 +71,16 @@ function get_transactions($debtorno, $from, $to)
        $from = date2sql($from);
        $to = date2sql($to);
 
-    $sql = "SELECT ".TB_PREF."debtor_trans.*, ".TB_PREF."sys_types.type_name,
+    $sql = "SELECT ".TB_PREF."debtor_trans.*,
                (".TB_PREF."debtor_trans.ov_amount + ".TB_PREF."debtor_trans.ov_gst + ".TB_PREF."debtor_trans.ov_freight + ".TB_PREF."debtor_trans.ov_discount)
                AS TotalAmount, ".TB_PREF."debtor_trans.alloc AS Allocated,
                ((".TB_PREF."debtor_trans.type = 10)
                AND ".TB_PREF."debtor_trans.due_date < '$to') AS OverDue
-       FROM ".TB_PREF."debtor_trans, ".TB_PREF."sys_types
+       FROM ".TB_PREF."debtor_trans
        WHERE ".TB_PREF."debtor_trans.tran_date >= '$from'
                AND ".TB_PREF."debtor_trans.tran_date <= '$to'
                AND ".TB_PREF."debtor_trans.debtor_no = '$debtorno'
                AND ".TB_PREF."debtor_trans.type <> 13
-       AND ".TB_PREF."debtor_trans.type = ".TB_PREF."sys_types.type_id
        ORDER BY ".TB_PREF."debtor_trans.tran_date";
 
     return db_query($sql,"No transactions were returned");
@@ -178,7 +177,7 @@ function print_customer_balances()
                while ($trans = db_fetch($res))
                {
                        $rep->NewLine(1, 2);
-                       $rep->TextCol(0, 1, $trans['type_name']);
+                       $rep->TextCol(0, 1, systypes::name($trans['type']));
                        $rep->TextCol(1, 2,     $trans['reference']);
                        $rep->DateCol(2, 3,     $trans['tran_date'], true);
                        if ($trans['type'] == 10)
@@ -208,7 +207,7 @@ function print_customer_balances()
                        else
                                $item[3] = ($trans['TotalAmount'] + $trans['Allocated']) * $rate;
                        */
-                       if ($trans['type'] == 10)
+                       if ($trans['type'] == 10 || $trans['type'] == 1)
                                $item[3] = $item[0] + $item[1] - $item[2];
                        else    
                                $item[3] = $item[0] - $item[1] + $item[2];