$sql .= "SUM(IF(t.type != ".ST_SUPPINVOICE." AND NOT(t.type IN (".ST_JOURNAL." , ".ST_BANKDEPOSIT.") AND t.ov_amount>0),
abs(t.ov_amount + t.ov_gst + t.ov_discount) * -1, 0)) AS credits,";
$sql .= "SUM(IF(t.type != ".ST_SUPPINVOICE." AND NOT(t.type IN (".ST_JOURNAL." , ".ST_BANKDEPOSIT.") AND t.ov_amount>0),
abs(t.ov_amount + t.ov_gst + t.ov_discount) * -1, 0)) AS credits,";