src/org/openbravo/erpCommon/ad_reports/AgingDao_data.xsql
author inigo_lerga <inigo.lerga@openbravo.com>
Thu, 13 Aug 2020 13:04:53 +0200
changeset 37511 4118743db5cd
parent 37508 89b0b6a30daf
permissions -rw-r--r--
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.
nonofce@31541
     1
<?xml version="1.0" encoding="UTF-8" ?>
nonofce@31541
     2
<!--
nonofce@31541
     3
 *************************************************************************
nonofce@31541
     4
 * The contents of this file are subject to the Openbravo  Public  License
nonofce@31541
     5
 * Version  1.1  (the  "License"),  being   the  Mozilla   Public  License
nonofce@31541
     6
 * Version 1.1  with a permitted attribution clause; you may not  use this
nonofce@31541
     7
 * file except in compliance with the License. You  may  obtain  a copy of
nonofce@31541
     8
 * the License at http://www.openbravo.com/legal/license.html
nonofce@31541
     9
 * Software distributed under the License  is  distributed  on  an "AS IS"
nonofce@31541
    10
 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
nonofce@31541
    11
 * License for the specific  language  governing  rights  and  limitations
nonofce@31541
    12
 * under the License.
nonofce@31541
    13
 * The Original Code is Openbravo ERP.
nonofce@31541
    14
 * The Initial Developer of the Original Code is Openbravo SLU
inigo@37511
    15
 * All portions are Copyright (C) 2016-2020 Openbravo SLU
nonofce@31541
    16
 * All Rights Reserved.
nonofce@31541
    17
 * Contributor(s):  ______________________________________.
nonofce@31541
    18
 ************************************************************************
nonofce@31541
    19
-->
nonofce@31541
    20
nonofce@31541
    21
<SqlClass name="AgingDaoData" package="org.openbravo.erpCommon.ad_reports">
nonofce@31541
    22
  <SqlClassComment></SqlClassComment>
nonofce@31541
    23
   <SqlMethod name="select" type="preparedStatement" return="scrollable">
nonofce@31541
    24
    <SqlMethodComment></SqlMethodComment>
nonofce@31541
    25
    <Sql>
nonofce@31541
    26
      <![CDATA[
markmm82@32297
    27
         SELECT B.* FROM (
nonofce@31541
    28
         SELECT A.bpId, bp.name as bpName, SUM(A.amount) as amount, A.scope, 0 as credit, '' as invoiceId, '' as docNo, '' as dateInvoiced, SUM(doubtfuldebtamt) as doubtfuldebt
nonofce@31541
    29
         FROM ( 
nonofce@31541
    30
	             SELECT i.c_bpartner_id AS bpId, 
nonofce@31541
    31
	                    CASE 
nonofce@31541
    32
	                     WHEN to_char('Y') = ? AND psd.DOUBTFULDEBT_AMOUNT <> 0 AND FIN_AGING_ISDOUBTFULTDEBT(psd.fin_payment_schedule_invoice, TO_DATE(?)) = 'Y' THEN FIN_AGING_INVOICECURRENCY_RATE(i.c_invoice_id, ?, i.c_currency_id) * (psd.amount + psd.writeoffamt - psd.DOUBTFULDEBT_AMOUNT) 
nonofce@31541
    33
	                     ELSE FIN_AGING_INVOICECURRENCY_RATE(i.c_invoice_id, ?, i.c_currency_id) * (psd.amount + psd.writeoffamt) 
nonofce@31541
    34
	                    END                AS amount,
nonofce@31541
    35
	                    CASE 
nonofce@31541
    36
                         WHEN psd.DOUBTFULDEBT_AMOUNT <> 0 AND FIN_AGING_ISDOUBTFULTDEBT(psd.fin_payment_schedule_invoice, TO_DATE(?)) = 'Y' THEN FIN_AGING_INVOICECURRENCY_RATE(i.c_invoice_id, ?, i.c_currency_id) * (psd.DOUBTFULDEBT_AMOUNT) 
nonofce@31541
    37
                         ELSE 0
nonofce@31541
    38
                        END                AS doubtfuldebtamt, 
nonofce@31541
    39
				        CASE 
nonofce@31541
    40
				         WHEN Trunc(ps.duedate) > TO_DATE(?) THEN 0 
nonofce@31541
    41
				         WHEN Trunc(ps.duedate) > TO_DATE(?) THEN 1 
nonofce@31541
    42
				         WHEN Trunc(ps.duedate) > TO_DATE(?) THEN 2 
nonofce@31541
    43
				         WHEN Trunc(ps.duedate) > TO_DATE(?) THEN 3 
nonofce@31541
    44
				         WHEN Trunc(ps.duedate) > TO_DATE(?) THEN 4 
nonofce@31541
    45
				         ELSE 5 
nonofce@31541
    46
				        END                                                        AS scope
nonofce@31541
    47
				 FROM  fin_payment_scheduledetail psd 
nonofce@31541
    48
				       INNER JOIN fin_payment_schedule ps ON psd.fin_payment_schedule_invoice = ps.fin_payment_schedule_id 
nonofce@31541
    49
				       INNER JOIN c_invoice            i  ON ps.c_invoice_id = i.c_invoice_id 
nonofce@31541
    50
				 WHERE psd.isactive = 'Y' 
nonofce@31541
    51
				   AND psd.iscanceled = 'N' 
nonofce@31541
    52
				   AND (psd.AD_Org_ID in ('1')) 
nonofce@31541
    53
				   AND (i.AD_Org_ID in ('1')) 
nonofce@31541
    54
				   AND 2=2
nonofce@31541
    55
				   AND i.issotrx = ? 
nonofce@31541
    56
				   AND 1=1
nonofce@31541
    57
				   AND Trunc(i.dateacct) <= TO_DATE(?)
nonofce@31541
    58
				   AND (   psd.fin_payment_detail_id IS NULL 
nonofce@31541
    59
				        OR psd.isinvoicepaid = 'N' 
nonofce@31541
    60
				        OR (psd.isinvoicepaid = 'Y' 
nonofce@31541
    61
				            AND EXISTS (SELECT 1 
nonofce@31541
    62
				                      FROM  fin_payment_detail pd 
nonofce@31541
    63
				                            INNER JOIN fin_payment p ON pd.fin_payment_id = p.fin_payment_id 
nonofce@31541
    64
				                      WHERE Trunc(p.paymentdate) > TO_DATE(?)
nonofce@31541
    65
				                        AND pd.fin_payment_detail_id = psd.fin_payment_detail_id) ) ) 
nonofce@31541
    66
			  ) A 
nonofce@31541
    67
			   INNER JOIN c_bpartner bp on (A.bpId = bp.c_bpartner_id)
nonofce@31541
    68
		GROUP BY A.bpId, bp.name, A.scope  
markmm82@32297
    69
        ) B		
nonofce@31541
    70
      ]]></Sql>
nonofce@31541
    71
    <Field name="rownum" value="count"/>
nonofce@31541
    72
    <Parameter name="showDoubtfulDebt"/>
nonofce@31541
    73
    <Parameter name="asOfDate"/>
nonofce@31541
    74
    <Parameter name="currencyId"/>
nonofce@31541
    75
    <Parameter name="currencyId"/>
nonofce@31541
    76
    <Parameter name="asOfDate"/>
nonofce@31541
    77
    <Parameter name="currencyId"/>
nonofce@31541
    78
    <Parameter name="asOfDate"/>
nonofce@31541
    79
    <Parameter name="firstRangeBucket"/>
nonofce@31541
    80
    <Parameter name="secondRangeBucket"/>
nonofce@31541
    81
    <Parameter name="thirdRangeBucket"/>
nonofce@31541
    82
    <Parameter name="fourthRangeBucket"/>
nonofce@31541
    83
    <Parameter name="org" type="replace" optional="true" after="AND (psd.AD_Org_ID in (" text="'1'"/>
nonofce@31541
    84
    <Parameter name="org" type="replace" optional="true" after="AND (i.AD_Org_ID in (" text="'1'"/>
nonofce@31541
    85
    <Parameter name="cbPartnerId" optional="true" type="argument" after="AND 2=2"><![CDATA[ AND i.C_BPARTNER_ID IN]]></Parameter>
nonofce@31541
    86
    <Parameter name="recOrPay"/>
nonofce@31541
    87
    <Parameter name="excludeVoids" type="none" optional="true" after="AND 1=1" text="AND i.DOCSTATUS NOT IN ('VO')"/>
nonofce@31541
    88
    <Parameter name="asOfDate"/>
nonofce@31541
    89
    <Parameter name="asOfDate"/>
markmm82@32297
    90
    <Parameter name="pgLimit" type="argument" optional="true" after=") B"><![CDATA[LIMIT ]]></Parameter>
markmm82@32297
    91
    <Parameter name="oraLimit1" type="argument" optional="true" after=") B"><![CDATA[WHERE ROWNUM <= ]]></Parameter>
nonofce@31541
    92
    </SqlMethod>
nonofce@31541
    93
    
nonofce@31541
    94
    <SqlMethod name="selectCredit" type="preparedStatement" return="scrollable">
nonofce@31541
    95
    <SqlMethodComment></SqlMethodComment>
nonofce@31541
    96
    <Sql>
nonofce@31541
    97
      <![CDATA[
markmm82@32297
    98
    SELECT B.* FROM (
nonofce@31541
    99
    SELECT A.credit, bp.c_bpartner_id as bpId, bp.name as bpName, A.dateInvoiced as dateInvoiced, A.invoiceId as invoiceId, A.docNo
nonofce@31541
   100
    FROM (
nonofce@31541
   101
        SELECT FIN_AGING_PAYMENTCURRENCY_RATE(P.fin_payment_id, ?, P.c_currency_id) * SUM(P.GENERATED_CREDIT - coalesce(C.USED_CREDIT, 0)) AS credit, P.c_bpartner_id,
nonofce@31541
   102
               P.PAYMENTDATE as dateInvoiced, P.fin_payment_id as invoiceId, P.docNo
nonofce@31541
   103
          FROM (
nonofce@31541
   104
                SELECT fp.fin_payment_id                AS fin_payment_id,
nonofce@31541
   105
                       fp.GENERATED_CREDIT              AS GENERATED_CREDIT,
nonofce@31541
   106
                       fp.PAYMENTDATE                   AS PAYMENTDATE,
nonofce@31541
   107
                       fp.c_currency_id                 AS c_currency_id,
nonofce@31541
   108
                       fp.c_bpartner_id                 AS c_bpartner_id,
nonofce@31541
   109
                       CASE
nonofce@31541
   110
                        WHEN fp.isreceipt = 'N' AND fp.referenceno IS NOT NULL THEN FIN_AGING_GETDOCNO(fp.referenceno, fp.documentNo, fp.ad_org_id)
nonofce@31541
   111
                        ELSE fp.documentNo
nonofce@31541
   112
                        END                             AS docNo
nonofce@31541
   113
                FROM   fin_payment fp
nonofce@31541
   114
                WHERE  (fp.AD_Org_ID in ('1')) 
nonofce@31541
   115
                       AND (fp.status IN ('1'))
nonofce@31541
   116
                       AND Trunc(fp.paymentdate) <= TO_DATE(?)
nonofce@31541
   117
                       AND fp.isreceipt = ? 
nonofce@31541
   118
                       AND 1=1
nonofce@31541
   119
                       AND fp.generated_credit <> 0 
nonofce@31541
   120
                       AND ( EXISTS (SELECT 1 
nonofce@31541
   121
                                     FROM   fin_payment_scheduledetail fpsd 
nonofce@31541
   122
                                            INNER JOIN fin_payment_detail fpd ON fpsd.fin_payment_detail_id = fpd.fin_payment_detail_id 
nonofce@31541
   123
                                     WHERE  fpd.fin_payment_id = fp.fin_payment_id 
nonofce@31541
   124
                                            AND fpsd.isactive = 'Y' 
nonofce@31541
   125
                                            AND fpsd.iscanceled = 'N' 
nonofce@31541
   126
                                            AND fpsd.fin_payment_schedule_invoice IS NULL
nonofce@31541
   127
                                     ) 
nonofce@31541
   128
                           )
atul@34217
   129
                UNION
atul@34217
   130
                SELECT fp2.fin_payment_id                AS fin_payment_id,
atul@34217
   131
                       fpsd.amount             AS GENERATED_CREDIT,
atul@34217
   132
                       fp2.PAYMENTDATE                   AS PAYMENTDATE,
atul@34217
   133
                       fp2.c_currency_id                 AS c_currency_id,
atul@34217
   134
                       fp2.c_bpartner_id                 AS c_bpartner_id,
atul@34217
   135
                       CASE
atul@34217
   136
                        WHEN fp2.isreceipt = 'N' AND fp2.referenceno IS NOT NULL THEN FIN_AGING_GETDOCNO(fp2.referenceno, fp2.documentNo, fp2.ad_org_id)
atul@34217
   137
                        ELSE fp2.documentNo
atul@34217
   138
                        END                             AS docNo
atul@34217
   139
                FROM   fin_payment_scheduledetail fpsd
atul@34217
   140
                       INNER JOIN fin_payment_detail fpd ON fpsd.fin_payment_detail_id = fpd.fin_payment_detail_id
atul@34217
   141
                       INNER JOIN fin_payment fp2 ON fpd.fin_payment_id = fp2.fin_payment_id
inigo@37511
   142
                       LEFT JOIN fin_payment_schedule fpsi ON (fpsd.fin_payment_schedule_invoice = fpsi.fin_payment_schedule_id)
inigo@37511
   143
                       LEFT JOIN c_invoice i ON (fpsi.c_invoice_id = i.c_invoice_id)
atul@34217
   144
                WHERE  (fp2.AD_Org_ID in ('1'))
atul@34217
   145
                       AND (fp2.status IN ('1'))
atul@34217
   146
                       AND Trunc(fp2.paymentdate) <= TO_DATE(?)
atul@34217
   147
                       AND fp2.isreceipt = ?
atul@34217
   148
                       AND 2=2
atul@34217
   149
                       AND fpsd.isactive = 'Y'
atul@34217
   150
                       AND fpsd.iscanceled = 'N'
inigo@37511
   151
                       AND (fpsd.fin_payment_schedule_invoice IS NULL
inigo@37511
   152
                            OR i.DATEINVOICED >= TO_DATE(?))
atul@34217
   153
                       AND fpsd.fin_payment_schedule_order IS NOT NULL
nonofce@31541
   154
                ) P 
nonofce@31541
   155
                LEFT JOIN 
nonofce@31541
   156
                (SELECT SUM(fpc.amount) AS USED_CREDIT,
nonofce@31541
   157
                         fpc.fin_payment_id_used  AS paymentUsedId
nonofce@31541
   158
                  FROM   fin_payment_credit fpc 
nonofce@31541
   159
                  WHERE ( EXISTS (SELECT 1 
nonofce@31541
   160
                                 FROM   fin_payment fp1 
nonofce@31541
   161
                                        INNER JOIN fin_payment_detail fpd1 ON fp1.fin_payment_id = fpd1.fin_payment_id 
nonofce@31541
   162
                                        INNER JOIN fin_payment_scheduledetail fpsd1 ON fpd1.fin_payment_detail_id = fpsd1.fin_payment_detail_id 
nonofce@31541
   163
                                 WHERE  fpc.fin_payment_id = fp1.fin_payment_id 
nonofce@31541
   164
                                        AND Trunc(fp1.paymentdate) <= TO_DATE(?) 
nonofce@31541
   165
                                        AND ( (fpsd1.isinvoicepaid = 'Y' AND  fpsd1.fin_payment_schedule_invoice IS NOT NULL) 
nonofce@31541
   166
                                             OR ( fp1.status IN ('1') 
nonofce@31541
   167
                                                 AND  fpsd1.fin_payment_schedule_invoice IS NULL)
nonofce@31541
   168
                                            )
nonofce@31541
   169
                                  ) 
nonofce@31541
   170
                        ) 
nonofce@31541
   171
                  GROUP BY fpc.fin_payment_id_used
nonofce@31541
   172
                ) C ON P.fin_payment_id = C.paymentUsedId
nonofce@31541
   173
          GROUP BY P.fin_payment_id, P.PAYMENTDATE, P.c_currency_id, P.c_bpartner_id, P.docNo
nonofce@31541
   174
       ) A
nonofce@31541
   175
      INNER JOIN c_bpartner bp ON A.c_bpartner_id = bp.c_bpartner_id
nonofce@31541
   176
   WHERE A.credit <> 0
markmm82@32297
   177
        ) B
nonofce@31541
   178
      ]]></Sql>
nonofce@31541
   179
    <Field name="rownum" value="count"/>
nonofce@31541
   180
    <Parameter name="currencyId"/>
nonofce@31541
   181
    <Parameter name="org" type="replace" optional="true" after=" WHERE  (fp.AD_Org_ID in (" text="'1'"/>
nonofce@31541
   182
    <Parameter name="paidStatus" type="replace" optional="true" after="AND (fp.status IN (" text="'1'"/>
nonofce@31541
   183
    <Parameter name="asOfDate"/>
nonofce@31541
   184
    <Parameter name="recOrPay"/>
nonofce@31541
   185
    <Parameter name="cbPartnerId" optional="true" type="argument" after="AND 1=1"><![CDATA[ AND fp.C_BPARTNER_ID IN]]></Parameter>
atul@34217
   186
    <Parameter name="org" type="replace" optional="true" after=" WHERE  (fp2.AD_Org_ID in (" text="'1'"/>
atul@34217
   187
    <Parameter name="paidStatus" type="replace" optional="true" after="AND (fp2.status IN (" text="'1'"/>
atul@34217
   188
    <Parameter name="asOfDate"/>
atul@34217
   189
    <Parameter name="recOrPay"/>
atul@34217
   190
    <Parameter name="cbPartnerId" optional="true" type="argument" after="AND 2=2"><![CDATA[ AND fp2.C_BPARTNER_ID IN]]></Parameter>
david@37508
   191
    <Parameter name="excludeReverseds" type="none" optional="true" after="AND 2=2" text=" AND (fp2.fin_rev_payment_id is null AND NOT EXISTS (SELECT 1 FROM fin_payment WHERE fin_rev_payment_id = fp2.fin_payment_id))"/>
nonofce@31541
   192
    <Parameter name="asOfDate"/>
inigo@37511
   193
    <Parameter name="asOfDate"/>
nonofce@31541
   194
    <Parameter name="paidStatus" type="replace" optional="true" after="OR ( fp1.status IN (" text="'1'"/>
markmm82@32297
   195
    <Parameter name="pgLimit" type="argument" optional="true" after=") B"><![CDATA[LIMIT ]]></Parameter>
markmm82@32297
   196
    <Parameter name="oraLimit1" type="argument" optional="true" after=") B"><![CDATA[WHERE ROWNUM <= ]]></Parameter>
nonofce@31541
   197
    </SqlMethod>
nonofce@31541
   198
    
nonofce@31541
   199
    <SqlMethod name="selectDetail" type="preparedStatement" return="scrollable">
nonofce@31541
   200
    <SqlMethodComment></SqlMethodComment>
nonofce@31541
   201
    <Sql>
nonofce@31541
   202
      <![CDATA[
markmm82@32297
   203
           SELECT C.* FROM (
nonofce@31541
   204
           SELECT B.bpId, bp.name as bpName, FIN_AGING_INVOICECURRENCY_RATE(B.c_invoice_id, ?, B.c_currency_id) * B.amount as amount, B.scope, B.c_invoice_id as invoiceId, B.documentNo as docNo, 
nonofce@31541
   205
           B.dateacct as dateInvoiced, FIN_AGING_INVOICECURRENCY_RATE(B.c_invoice_id, ?, B.c_currency_id) * (B.doubtfuldebtamt) as doubtfuldebt
nonofce@31541
   206
           FROM (  
nonofce@31541
   207
                 SELECT A.c_invoice_id, A.c_currency_id, A.bpId, A.documentNo, A.dateacct, SUM(A.amount) as amount, SUM(A.doubtfuldebtamt) as doubtfuldebtAmt, A.scope
nonofce@31541
   208
                 FROM ( 
nonofce@31541
   209
                         SELECT i.c_bpartner_id AS bpId, i.c_invoice_id,
nonofce@31541
   210
                                CASE
nonofce@31541
   211
                                 WHEN i.issotrx = 'N' AND i.poreference IS NOT NULL THEN FIN_AGING_GETDOCNO(i.poreference, i.documentNo, i.ad_org_id)
nonofce@31541
   212
                                 ELSE i.documentNo
nonofce@31541
   213
                                 END                AS documentNo,
nonofce@31541
   214
                                i.dateacct, i.c_currency_id,
nonofce@31541
   215
                                CASE 
nonofce@31541
   216
                                 WHEN to_char('Y') = ? AND psd.DOUBTFULDEBT_AMOUNT <> 0 AND FIN_AGING_ISDOUBTFULTDEBT(psd.fin_payment_schedule_invoice, TO_DATE(?)) = 'Y' THEN  psd.amount + psd.writeoffamt - psd.DOUBTFULDEBT_AMOUNT
nonofce@31541
   217
                                 ELSE psd.amount + psd.writeoffamt
nonofce@31541
   218
                                 END                AS amount, 
nonofce@31541
   219
                                CASE
nonofce@31541
   220
                                 WHEN psd.DOUBTFULDEBT_AMOUNT <> 0 AND FIN_AGING_ISDOUBTFULTDEBT(psd.fin_payment_schedule_invoice, TO_DATE(?)) = 'Y' THEN psd.DOUBTFULDEBT_AMOUNT
nonofce@31541
   221
                                 ELSE 0
nonofce@31541
   222
                                 END                AS doubtfuldebtamt,
nonofce@31541
   223
                                CASE 
nonofce@31541
   224
                                 WHEN Trunc(ps.duedate) > TO_DATE(?) THEN 0 
nonofce@31541
   225
                                 WHEN Trunc(ps.duedate) > TO_DATE(?) THEN 1 
nonofce@31541
   226
                                 WHEN Trunc(ps.duedate) > TO_DATE(?) THEN 2 
nonofce@31541
   227
                                 WHEN Trunc(ps.duedate) > TO_DATE(?) THEN 3 
nonofce@31541
   228
                                 WHEN Trunc(ps.duedate) > TO_DATE(?) THEN 4 
nonofce@31541
   229
                                 ELSE 5 
nonofce@31541
   230
                                END                                                        AS scope
nonofce@31541
   231
                         FROM  fin_payment_scheduledetail psd 
nonofce@31541
   232
                               INNER JOIN fin_payment_schedule ps ON psd.fin_payment_schedule_invoice = ps.fin_payment_schedule_id 
nonofce@31541
   233
                               INNER JOIN c_invoice            i  ON ps.c_invoice_id = i.c_invoice_id 
nonofce@31541
   234
                         WHERE psd.isactive = 'Y' 
nonofce@31541
   235
                           AND psd.iscanceled = 'N' 
nonofce@31541
   236
                           AND (psd.AD_Org_ID in ('1')) 
nonofce@31541
   237
                           AND (i.AD_Org_ID in ('1')) 
nonofce@31541
   238
                           AND 2=2
nonofce@31541
   239
                           AND i.issotrx = ? 
nonofce@31541
   240
                           AND 1=1
nonofce@31541
   241
                           AND Trunc(i.dateacct) <= TO_DATE(?)
nonofce@31541
   242
                           AND (   psd.fin_payment_detail_id IS NULL 
nonofce@31541
   243
                                OR psd.isinvoicepaid = 'N' 
nonofce@31541
   244
                                OR (psd.isinvoicepaid = 'Y' 
nonofce@31541
   245
                                    AND EXISTS (SELECT 1 
nonofce@31541
   246
                                              FROM  fin_payment_detail pd 
nonofce@31541
   247
                                                    INNER JOIN fin_payment p ON pd.fin_payment_id = p.fin_payment_id 
nonofce@31541
   248
                                              WHERE Trunc(p.paymentdate) > TO_DATE(?)
nonofce@31541
   249
                                                AND pd.fin_payment_detail_id = psd.fin_payment_detail_id) ) ) 
nonofce@31541
   250
                      ) A       
nonofce@31541
   251
                GROUP BY A.c_invoice_id, A.c_currency_id, A.bpId, A.documentNo, A.dateacct, A.scope
nonofce@31541
   252
               ) B
nonofce@31541
   253
          INNER JOIN c_bpartner bp on (B.bpId = bp.c_bpartner_id)     
markmm82@32297
   254
          ) C		  
nonofce@31541
   255
      ]]></Sql>
nonofce@31541
   256
    <Field name="rownum" value="count"/>
nonofce@31541
   257
    <Parameter name="currencyId"/>
nonofce@31541
   258
    <Parameter name="currencyId"/>
nonofce@31541
   259
    <Parameter name="showDoubtfulDebt"/>
nonofce@31541
   260
    <Parameter name="asOfDate"/>
nonofce@31541
   261
    <Parameter name="asOfDate"/>
nonofce@31541
   262
    <Parameter name="asOfDate"/>
nonofce@31541
   263
    <Parameter name="firstRangeBucket"/>
nonofce@31541
   264
    <Parameter name="secondRangeBucket"/>
nonofce@31541
   265
    <Parameter name="thirdRangeBucket"/>
nonofce@31541
   266
    <Parameter name="fourthRangeBucket"/>
nonofce@31541
   267
    <Parameter name="org" type="replace" optional="true" after="AND (psd.AD_Org_ID in (" text="'1'"/>
nonofce@31541
   268
    <Parameter name="org" type="replace" optional="true" after="AND (i.AD_Org_ID in (" text="'1'"/>
nonofce@31541
   269
    <Parameter name="cbPartnerId" optional="true" type="argument" after="AND 2=2"><![CDATA[ AND i.C_BPARTNER_ID IN]]></Parameter>
nonofce@31541
   270
    <Parameter name="recOrPay"/>
nonofce@31541
   271
    <Parameter name="excludeVoids" type="none" optional="true" after="AND 1=1" text="AND i.DOCSTATUS NOT IN ('VO')"/>
nonofce@31541
   272
    <Parameter name="asOfDate"/>
nonofce@31541
   273
    <Parameter name="asOfDate"/>
markmm82@32297
   274
    <Parameter name="pgLimit" type="argument" optional="true" after=") C"><![CDATA[LIMIT ]]></Parameter>
markmm82@32297
   275
    <Parameter name="oraLimit1" type="argument" optional="true" after=") C"><![CDATA[WHERE ROWNUM <= ]]></Parameter>
nonofce@31541
   276
    </SqlMethod>
nonofce@31541
   277
</SqlClass>
nonofce@31541
   278