# HG changeset patch # User inigo_lerga # Date 1597316693 -7200 # Node ID 4118743db5cdac4712fd7ee56ac1089c36a936ea # Parent 76b5ebe416de1ceb38e3e3246bd12962579cbf6b fixes BUG-44788:Date of prepaid order invoice considered now The date in which an invoice of a prepaid order is now considered in que query, being properly shown as Credit independtly of the report's date. diff -r 76b5ebe416de -r 4118743db5cd src/org/openbravo/erpCommon/ad_reports/AgingDao_data.xsql --- a/src/org/openbravo/erpCommon/ad_reports/AgingDao_data.xsql Tue Aug 11 13:54:59 2020 +0200 +++ b/src/org/openbravo/erpCommon/ad_reports/AgingDao_data.xsql Thu Aug 13 13:04:53 2020 +0200 @@ -12,7 +12,7 @@ * under the License. * The Original Code is Openbravo ERP. * The Initial Developer of the Original Code is Openbravo SLU - * All portions are Copyright (C) 2016-2017 Openbravo SLU + * All portions are Copyright (C) 2016-2020 Openbravo SLU * All Rights Reserved. * Contributor(s): ______________________________________. ************************************************************************ @@ -139,6 +139,8 @@ FROM fin_payment_scheduledetail fpsd INNER JOIN fin_payment_detail fpd ON fpsd.fin_payment_detail_id = fpd.fin_payment_detail_id INNER JOIN fin_payment fp2 ON fpd.fin_payment_id = fp2.fin_payment_id + LEFT JOIN fin_payment_schedule fpsi ON (fpsd.fin_payment_schedule_invoice = fpsi.fin_payment_schedule_id) + LEFT JOIN c_invoice i ON (fpsi.c_invoice_id = i.c_invoice_id) WHERE (fp2.AD_Org_ID in ('1')) AND (fp2.status IN ('1')) AND Trunc(fp2.paymentdate) <= TO_DATE(?) @@ -146,7 +148,8 @@ AND 2=2 AND fpsd.isactive = 'Y' AND fpsd.iscanceled = 'N' - AND fpsd.fin_payment_schedule_invoice IS NULL + AND (fpsd.fin_payment_schedule_invoice IS NULL + OR i.DATEINVOICED >= TO_DATE(?)) AND fpsd.fin_payment_schedule_order IS NOT NULL ) P LEFT JOIN @@ -187,6 +190,7 @@ +