X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=reporting%2Frep102.php;h=a63ac9c5cd58f1b4b987a5f021159546d0e46dad;hb=a67b7a07178dd92bb8e8bf60b6f7b474a1cbf433;hp=92b56466b7cbd7f7dfdf0f6c734032d5f8b27749;hpb=8d809a4d7562cde8931bf4a69d3e63f63157973c;p=fa-stable.git diff --git a/reporting/rep102.php b/reporting/rep102.php index 92b56466..a63ac9c5 100644 --- a/reporting/rep102.php +++ b/reporting/rep102.php @@ -35,9 +35,9 @@ function get_invoices($customer_id, $to, $all=true) // Revomed allocated from sql if ($all) - $value = "(ov_amount + ov_gst + ov_freight + ov_freight_tax + ov_discount)"; + $value = "IF(prep_amount, prep_amount, ov_amount + ov_gst + ov_freight + ov_freight_tax + ov_discount)"; else - $value = "(ov_amount + ov_gst + ov_freight + ov_freight_tax + ov_discount - alloc)"; + $value = "(IF(prep_amount, prep_amount, ov_amount + ov_gst + ov_freight + ov_freight_tax + ov_discount)-alloc)"; $sign = "IF(`type` IN(".implode(',', array(ST_CUSTCREDIT,ST_CUSTPAYMENT,ST_BANKDEPOSIT,ST_JOURNAL))."), -1, 1)"; $due = "IF (type=".ST_SALESINVOICE.", due_date, tran_date)";