details: https://code.openbravo.com/erp/devel/pi/rev/873c8764054e changeset: 28072:873c8764054e user: Víctor Martínez Romanos <victor.martinez <at> openbravo.com> date: Thu Nov 26 14:08:38 2015 +0100 summary: Fixed bug 31107: Commission for full paid documents split in several payments
For Full paid documents, the query will search for the invoices that are fully paid where the last payment belongs to the selected period. So the query has been transformed to get all the PSD for the fully paid invoices if it exists at least one PSD paid in the given period and when all the PSD for the invoice are before the "to date" of the given period. diffstat: src-db/database/model/functions/C_COMMISSION_PROCESS.xml | 13 +++++++++++-- 1 files changed, 11 insertions(+), 2 deletions(-) diffs (23 lines): diff -r 5c4ebeb85b4e -r 873c8764054e src-db/database/model/functions/C_COMMISSION_PROCESS.xml --- a/src-db/database/model/functions/C_COMMISSION_PROCESS.xml Tue Dec 01 08:51:17 2015 +0100 +++ b/src-db/database/model/functions/C_COMMISSION_PROCESS.xml Thu Nov 26 14:08:38 2015 +0100 @@ -306,8 +306,17 @@ || ' AND h.ISSOTRX = ''Y''' || ' AND h.AD_Client_ID = '':1'''; IF (v_BasisStatus='F') THEN - v_Cmd:= v_Cmd || ' AND psv.LastPayment >= to_date('':2'')' - || ' AND psv.LastPayment < to_date('':3'') +1'; + v_Cmd:= v_Cmd || ' and exists (' + || ' select 1 from fin_payment_sched_inv_v psv1 ' + || ' where psv1.c_invoice_id = psv.c_invoice_id ' + || ' and psv1.lastpayment >= to_date('':2'') ' + || ' and psv1.lastpayment < to_date('':3'') + 1 ' + || ' ) ' + || ' and to_date('':3'') + 1 > ALL ( ' + || ' select psv2.lastpayment ' + || ' from fin_payment_sched_inv_v psv2 ' + || ' where psv2.c_invoice_id = h.c_invoice_id ' + || ' ) '; ELSE v_Cmd:= v_Cmd || ' AND h.DateInvoiced >= to_date('':2'')' || ' AND h.DateInvoiced < to_date('':3'') +1'; ------------------------------------------------------------------------------ Go from Idea to Many App Stores Faster with Intel(R) XDK Give your users amazing mobile app experiences with Intel(R) XDK. Use one codebase in this all-in-one HTML5 development environment. Design, debug & build mobile apps & 2D/3D high-impact games for multiple OSs. http://pubads.g.doubleclick.net/gampad/clk?id=254741911&iu=/4140 _______________________________________________ Openbravo-commits mailing list Openbravo-commits@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openbravo-commits