Update from usntable branch.
[fa-stable.git] / sales / includes / db / custalloc_db.inc
index 80bc9213812e51ad29cbd952f88eae289681fcc9..618c9397ca61bbdba6879d0faba20367d04727e3 100644 (file)
@@ -80,7 +80,7 @@ function clear_cust_alloctions($type, $type_no, $date="")
                // 2008-09-20 Joe Hunt
                if ($date != "")
                        exchange_variation($type, $type_no, $row['trans_type_to'], $row['trans_no_to'], $date,
-                               $row['amt'], payment_person_types::customer(), true);
+                               $row['amt'], PT_CUSTOMER, true);
                //////////////////////
        }
 
@@ -140,7 +140,7 @@ function get_allocatable_from_cust_sql($customer_id, $settled)
                $cust_sql = " AND trans.debtor_no = ".db_escape($customer_id);
 
        $sql = get_alloc_trans_sql("round(ov_amount+ov_gst+ov_freight+ov_freight_tax+ov_discount-alloc,6) <= 0 AS settled",
-               "(type=12 OR type=11 OR type=2) AND (trans.ov_amount > 0) " . $settled_sql . $cust_sql);
+               "(type=".ST_CUSTPAYMENT." OR type=".ST_CUSTCREDIT." OR type=".ST_BANKDEPOSIT.") AND (trans.ov_amount > 0) " . $settled_sql . $cust_sql);
 
        return $sql;
 }
@@ -161,10 +161,10 @@ function get_allocatable_to_cust_transactions($customer_id, $trans_no=null, $typ
        else
        {
                $sql = get_alloc_trans_sql(null, "round(ov_amount+ov_gst+ov_freight+ov_freight_tax+ov_discount-alloc,6) > 0
-                       AND trans.type != " . systypes::cust_payment() . "
-                       AND trans.type != " . systypes::bank_deposit() . "
-                       AND trans.type != 11
-                       AND trans.type != 13
+                       AND trans.type <> " . ST_CUSTPAYMENT . "
+                       AND trans.type <> " . ST_BANKDEPOSIT . "
+                       AND trans.type <> " . ST_CUSTCREDIT . "
+                       AND trans.type <> " . ST_CUSTDELIVERY . "
                        AND trans.debtor_no=".db_escape($customer_id));
        }