Clean up after Bugs 5510 and 5512.
[fa-stable.git] / sales / includes / db / cust_trans_db.inc
index f0bae1caaed9c146cd247d6b143c3e5a69704bf3..710be16f4f395968577688fcb9611ac6943b70b0 100644 (file)
@@ -353,7 +353,7 @@ function get_sql_for_customer_inquiry($from, $to, $cust_id = ALL_TEXT, $filter =
                $sql .= " AND ISNULL(v.date_) AND (trans.ov_amount + trans.ov_gst + trans.ov_freight + trans.ov_freight_tax + trans.ov_discount) != 0";
 
        if ($filter == '2')
-               $sql .= " AND ABS(IF(prep_amount, prep_amount, trans.ov_amount + trans.ov_gst + trans.ov_freight + trans.ov_freight_tax + trans.ov_discount)-trans.alloc)>"
+               $sql .= " AND ABS(IF(prep_amount, prep_amount, ABS(trans.ov_amount) + trans.ov_gst + trans.ov_freight + trans.ov_freight_tax + trans.ov_discount)-trans.alloc)>"
                        .FLOAT_COMP_DELTA;
        else {
                $sql .= " AND trans.tran_date >= '$date_after'