OR (type=".ST_JOURNAL. " AND (trans.ov_amount < 0)))";
if (!$settled)
- $sql .= " AND round(abs(ov_amount+ov_gst+ov_freight+ov_freight_tax+ov_discount)-alloc, 6) > 0";
+ $sql .= " AND round(abs(ov_amount+ov_gst)+ov_freight+ov_freight_tax+ov_discount-alloc, 6) > 0";
if ($customer_id != null)
$sql .= " AND trans.debtor_no = ".db_escape($customer_id);
{
$today = date2sql(Today());
$sql .= " AND trans.due_date < '$today'
- AND (round(abs(trans.ov_amount + "
+ AND (round(abs(trans.ov_amount) + "
."trans.ov_gst + trans.ov_freight + "
- ."trans.ov_freight_tax + trans.ov_discount) - trans.alloc,6) > 0) ";
+ ."trans.ov_freight_tax + trans.ov_discount - trans.alloc,6) > 0) ";
}
}
else
if (!$settled)
{
- $sql .= " AND (round(IF(trans.prep_amount,trans.prep_amount, abs(trans.ov_amount + trans.ov_gst + "
+ $sql .= " AND (ROUND(IF(trans.prep_amount,trans.prep_amount, ABS(trans.ov_amount) + trans.ov_gst + "
."trans.ov_freight + trans.ov_freight_tax + "
- ."trans.ov_discount)) - trans.alloc,6) != 0) ";
+ ."trans.ov_discount) - trans.alloc,6) != 0) ";
}
return $sql;
}