X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=sales%2Fincludes%2Fdb%2Fcustalloc_db.inc;h=a202d313980beb2d4bb21574b6e2756cdd77dcbc;hb=3951d648b98dbd5fdf9e95b858b765b7d52fe8c0;hp=4633c7cef59f80d3402e3062e59bd25269fb74ad;hpb=3d439a337e0115e35a6e2ba28434602a418ebaa5;p=fa-stable.git diff --git a/sales/includes/db/custalloc_db.inc b/sales/includes/db/custalloc_db.inc index 4633c7ce..a202d313 100644 --- a/sales/includes/db/custalloc_db.inc +++ b/sales/includes/db/custalloc_db.inc @@ -124,7 +124,7 @@ function get_allocatable_from_cust_sql($customer_id, $settled) 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); @@ -327,9 +327,9 @@ function get_sql_for_customer_allocation_inquiry($from, $to, $customer, $filterT { $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 @@ -340,9 +340,9 @@ function get_sql_for_customer_allocation_inquiry($from, $to, $customer, $filterT 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; }