Error calculating customer aging regarding journal entries. Fixed.
authorJoe Hunt <joe.hunt.consulting@gmail.com>
Fri, 29 Oct 2021 08:04:45 +0000 (10:04 +0200)
committerJoe Hunt <joe.hunt.consulting@gmail.com>
Fri, 29 Oct 2021 08:04:45 +0000 (10:04 +0200)
sales/includes/db/customers_db.inc

index 3f16159e46ddc434fe45048405ca60005e89fab7..8d4239189443652a07e66c748b6929f4e2072f00 100644 (file)
@@ -97,7 +97,7 @@ function get_customer_details($customer_id, $to=null, $all=true)
                $sql .= " AND debtor.debtor_no = ".db_escape($customer_id);
 
        if (!$all)
-               $sql .= " AND ABS(trans.ov_amount + trans.ov_gst + trans.ov_freight + trans.ov_freight_tax + trans.ov_discount - trans.alloc) > ".FLOAT_COMP_DELTA;
+               $sql .= " AND ABS(trans.ov_amount) + trans.ov_gst + trans.ov_freight + trans.ov_freight_tax + trans.ov_discount - trans.alloc > ".FLOAT_COMP_DELTA;
        $sql .= " GROUP BY
                                debtor.name,
                                terms.terms,