Update from usntable branch.
[fa-stable.git] / purchasing / includes / db / suppalloc_db.inc
index c11c7d1681802f3d528263f5ee8d300fc6a8b26a..987a640db957073acbe105afc56b416e9f22740b 100644 (file)
@@ -84,7 +84,7 @@ function clear_supp_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::supplier(), true);
+                               $row['amt'], PT_SUPPLIER, true);
                //////////////////////
        }
 
@@ -148,7 +148,7 @@ function get_allocatable_from_supp_sql($supplier_id, $settled)
                $supp_sql = " AND trans.supplier_id = ".db_escape($supplier_id);
 
        $sql = get_alloc_supp_sql("round(ABS(ov_amount+ov_gst+ov_discount)-alloc,6) <= 0 AS settled",
-               "(type=22 OR type=21 OR type=1) AND (ov_amount < 0) " . $settled_sql . $supp_sql);
+               "(type=".ST_SUPPAYMENT." OR type=".ST_SUPPCREDIT." OR type=".ST_BANKPAYMENT.") AND (ov_amount < 0) " . $settled_sql . $supp_sql);
 
        return $sql;
 }
@@ -169,7 +169,7 @@ function get_allocatable_to_supp_transactions($supplier_id, $trans_no=null, $typ
        else
        {
                $sql = get_alloc_supp_sql(null, "round(ABS(ov_amount+ov_gst+ov_discount)-alloc,6) > 0
-                       AND trans.type != 22
+                       AND trans.type != ".ST_SUPPAYMENT."
                        AND trans.supplier_id=$supplier_id");
        }