Bug 4530. Customers with 0 left to allocate shown on Customer Allocations when using...
authorJoe Hunt <joe.hunt.consulting@gmail.com>
Tue, 26 Oct 2021 13:22:24 +0000 (15:22 +0200)
committerJoe Hunt <joe.hunt.consulting@gmail.com>
Tue, 26 Oct 2021 13:22:24 +0000 (15:22 +0200)
sales/includes/db/custalloc_db.inc

index 6dc3ee0423dc359d65edd5c29e41470227ce70ff..1fa6995acad11cb81def1701502f8518501f5adb 100644 (file)
@@ -121,7 +121,7 @@ function get_allocatable_from_cust_sql($customer_id, $settled)
        ." WHERE trans.debtor_no=debtor.debtor_no
                AND (((type=".ST_CUSTPAYMENT." OR type=".ST_BANKDEPOSIT.") AND (trans.ov_amount > 0))
                 OR (type=".ST_CUSTCREDIT. " AND (ov_amount+ov_gst+ov_freight+ov_freight_tax+ov_discount)>0)
-                OR (type=".ST_JOURNAL. " AND (trans.ov_amount < 0)))";
+                OR (type=".ST_JOURNAL. " AND (trans.ov_amount > 0)))";
 
        if (!$settled)
                $sql .= " AND (round(abs(ov_amount+ov_gst+ov_freight+ov_freight_tax+ov_discount-alloc),6) > 0)";