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), ";