Bug 5510: fix of bug 0004530 is not correct. Has now been fixed and rerun.
[fa-stable.git] / sales / includes / db / cust_trans_db.inc
index a68063b8ff8f0cc315c0ddd09911e79b8c5bced5..e71ecad05543f872cd98aa9bb6b833865c437e69 100644 (file)
@@ -318,7 +318,7 @@ function get_sql_for_customer_inquiry($from, $to, $cust_id = ALL_TEXT, $filter =
                debtor.name, 
                branch.br_name,
                debtor.curr_code,
-               IF(prep_amount, prep_amount, trans.ov_amount + trans.ov_gst + trans.ov_freight 
+               IF(prep_amount, prep_amount, abs(trans.ov_amount) + trans.ov_gst + trans.ov_freight 
                        + trans.ov_freight_tax + trans.ov_discount)     AS TotalAmount,"
 //     if ($filter != ALL_TEXT)
 //             $sql .= "@bal := @bal+IF(prep_amount, prep_amount, trans.ov_amount + trans.ov_gst + trans.ov_freight + trans.ov_freight_tax + trans.ov_discount), ";