<ROOT>
 <APPS_INITIALIZE_DATA>
  <USER_NAME>ENGINATICS</USER_NAME>
  <RESPONSIBILITY_KEY>SYSTEM_ADMINISTRATOR</RESPONSIBILITY_KEY>
  <APPLICATION_SHORT_NAME>SYSADMIN</APPLICATION_SHORT_NAME>
 </APPS_INITIALIZE_DATA>
<LOVS>
<!-- loader xml for Enginatics Blitz Report lov: GL Ledger (restricted by AR System Parameters) -->
 <LOVS_ROW>
  <GUID>B581C79E6D7AE63DE0530100007FE14A</GUID>
  <LOV_NAME>GL Ledger (restricted by AR System Parameters)</LOV_NAME>
  <VALIDATE_FROM_LIST>Y</VALIDATE_FROM_LIST>
  <LOV_QUERY>select
gl.name value,
fifsv.id_flex_structure_name||&apos;: &apos;||gl.description description
from
gl_ledgers gl,
fnd_id_flex_structures_vl fifsv
where
gl.ledger_id in (select asp.set_of_books_id from ar_system_parameters asp) and
gl.chart_of_accounts_id=fifsv.id_flex_num and
fifsv.id_flex_code=&apos;GL#&apos; and
fifsv.application_id=101
order by
fifsv.id_flex_structure_name,
gl.name</LOV_QUERY>
  <LOV_TRANSLATIONS>
   <LOV_TRANSLATIONS_ROW>
    <LANGUAGE>AR</LANGUAGE>
    <DESCRIPTION>دفاتر الأستاذ مقيدة بمعلمات النظام ar</DESCRIPTION>
   </LOV_TRANSLATIONS_ROW>
   <LOV_TRANSLATIONS_ROW>
    <LANGUAGE>D</LANGUAGE>
    <DESCRIPTION>Ledger eingeschränkt durch ar-Systemparameter</DESCRIPTION>
   </LOV_TRANSLATIONS_ROW>
   <LOV_TRANSLATIONS_ROW>
    <LANGUAGE>E</LANGUAGE>
    <DESCRIPTION>Libros mayores restringidos por los parámetros del sistema ar</DESCRIPTION>
   </LOV_TRANSLATIONS_ROW>
   <LOV_TRANSLATIONS_ROW>
    <LANGUAGE>F</LANGUAGE>
    <DESCRIPTION>Les grands livres sont limités par les paramètres du système ar</DESCRIPTION>
   </LOV_TRANSLATIONS_ROW>
   <LOV_TRANSLATIONS_ROW>
    <LANGUAGE>I</LANGUAGE>
    <DESCRIPTION>Libri mastri limitati da parametri di sistema</DESCRIPTION>
   </LOV_TRANSLATIONS_ROW>
   <LOV_TRANSLATIONS_ROW>
    <LANGUAGE>JA</LANGUAGE>
    <DESCRIPTION>ARシステムパラメータで制限された帳票</DESCRIPTION>
   </LOV_TRANSLATIONS_ROW>
   <LOV_TRANSLATIONS_ROW>
    <LANGUAGE>KO</LANGUAGE>
    <DESCRIPTION>AR 시스템 매개 변수에 의해 제한되는 원장</DESCRIPTION>
   </LOV_TRANSLATIONS_ROW>
   <LOV_TRANSLATIONS_ROW>
    <LANGUAGE>PTB</LANGUAGE>
    <DESCRIPTION>Ledgers restringidos por parâmetros do sistema ar</DESCRIPTION>
   </LOV_TRANSLATIONS_ROW>
   <LOV_TRANSLATIONS_ROW>
    <LANGUAGE>RU</LANGUAGE>
    <DESCRIPTION>Леджеры ограничены параметрами системы ar</DESCRIPTION>
   </LOV_TRANSLATIONS_ROW>
   <LOV_TRANSLATIONS_ROW>
    <LANGUAGE>S</LANGUAGE>
    <DESCRIPTION>Ledgers begränsade av ar-systemparametrar</DESCRIPTION>
   </LOV_TRANSLATIONS_ROW>
   <LOV_TRANSLATIONS_ROW>
    <LANGUAGE>TR</LANGUAGE>
    <DESCRIPTION>Ar sistem parametreleri ile kısıtlanmış defterler</DESCRIPTION>
   </LOV_TRANSLATIONS_ROW>
   <LOV_TRANSLATIONS_ROW>
    <LANGUAGE>US</LANGUAGE>
    <DESCRIPTION>Ledgers restricted by ar system parameters</DESCRIPTION>
   </LOV_TRANSLATIONS_ROW>
   <LOV_TRANSLATIONS_ROW>
    <LANGUAGE>ZHS</LANGUAGE>
    <DESCRIPTION>受人工智能系统参数限制的分类账</DESCRIPTION>
   </LOV_TRANSLATIONS_ROW>
  </LOV_TRANSLATIONS>
 </LOVS_ROW>
<!-- loader xml for Enginatics Blitz Report lov: HR Operating Unit -->
 <LOVS_ROW>
  <GUID>8E2FF36EDEB979D2E0530100007F1FF2</GUID>
  <LOV_NAME>HR Operating Unit</LOV_NAME>
  <VALIDATE_FROM_LIST>Y</VALIDATE_FROM_LIST>
  <LOV_QUERY>select
hou.name value,
null description
from
hr_operating_units hou
where
sysdate between hou.date_from and nvl(hou.date_to,sysdate) and
(:$flex$.ledger is null or hou.set_of_books_id in (select gl.ledger_id from gl_ledgers gl where xxen_util.contains(:$flex$.ledger,gl.name)=&apos;Y&apos;)) and
hou.organization_id in (select mgoat.organization_id from mo_glob_org_access_tmp mgoat union select fnd_global.org_id from dual where fnd_release.major_version=11)
order by
hou.name</LOV_QUERY>
  <VERSION_COMMENTS>Fixed where clause duplication</VERSION_COMMENTS>
  <LOV_TRANSLATIONS>
   <LOV_TRANSLATIONS_ROW>
    <LANGUAGE>AR</LANGUAGE>
    <DESCRIPTION>وحدة التشغيل مقيدة بالتحكم في الوصول متعدد المنظمات (MOAC)</DESCRIPTION>
   </LOV_TRANSLATIONS_ROW>
   <LOV_TRANSLATIONS_ROW>
    <LANGUAGE>D</LANGUAGE>
    <DESCRIPTION>Bedieneinheit eingeschränkt durch Multi Org Access Control (MOAC)</DESCRIPTION>
   </LOV_TRANSLATIONS_ROW>
   <LOV_TRANSLATIONS_ROW>
    <LANGUAGE>E</LANGUAGE>
    <DESCRIPTION>Unidad operativa restringida por el control de acceso multiorgánico (MOAC)</DESCRIPTION>
   </LOV_TRANSLATIONS_ROW>
   <LOV_TRANSLATIONS_ROW>
    <LANGUAGE>F</LANGUAGE>
    <DESCRIPTION>Unité opérationnelle restreinte par un contrôle d&apos;accès multi-organismes (MOAC)</DESCRIPTION>
   </LOV_TRANSLATIONS_ROW>
   <LOV_TRANSLATIONS_ROW>
    <LANGUAGE>I</LANGUAGE>
    <DESCRIPTION>Unità operativa limitata dal controllo di accesso multiorgano (MOAC)</DESCRIPTION>
   </LOV_TRANSLATIONS_ROW>
   <LOV_TRANSLATIONS_ROW>
    <LANGUAGE>JA</LANGUAGE>
    <DESCRIPTION>多機関アクセス制御(MOAC)で制限された操作ユニット</DESCRIPTION>
   </LOV_TRANSLATIONS_ROW>
   <LOV_TRANSLATIONS_ROW>
    <LANGUAGE>KO</LANGUAGE>
    <DESCRIPTION>다중 조직 액세스 제어 (MOAC)에 의해 제한되는 운영 단위</DESCRIPTION>
   </LOV_TRANSLATIONS_ROW>
   <LOV_TRANSLATIONS_ROW>
    <LANGUAGE>PTB</LANGUAGE>
    <DESCRIPTION>Unidade operacional restrita por controle de acesso multi org (MOAC)</DESCRIPTION>
   </LOV_TRANSLATIONS_ROW>
   <LOV_TRANSLATIONS_ROW>
    <LANGUAGE>RU</LANGUAGE>
    <DESCRIPTION>Операционное устройство, ограниченное мультиорганизованным контролем доступа (MOAC)</DESCRIPTION>
   </LOV_TRANSLATIONS_ROW>
   <LOV_TRANSLATIONS_ROW>
    <LANGUAGE>S</LANGUAGE>
    <DESCRIPTION>Styrenhet begränsad av multi-org access control (MOAC)</DESCRIPTION>
   </LOV_TRANSLATIONS_ROW>
   <LOV_TRANSLATIONS_ROW>
    <LANGUAGE>TR</LANGUAGE>
    <DESCRIPTION>Çoklu kuruluş erişim kontrolü (MOAC) tarafından kısıtlanan işletim birimi</DESCRIPTION>
   </LOV_TRANSLATIONS_ROW>
   <LOV_TRANSLATIONS_ROW>
    <LANGUAGE>US</LANGUAGE>
    <DESCRIPTION>Operating unit restricted by multi org access control (MOAC)</DESCRIPTION>
   </LOV_TRANSLATIONS_ROW>
   <LOV_TRANSLATIONS_ROW>
    <LANGUAGE>ZHS</LANGUAGE>
    <DESCRIPTION>受多机构访问控制（MOAC）限制的操作单元。</DESCRIPTION>
   </LOV_TRANSLATIONS_ROW>
  </LOV_TRANSLATIONS>
 </LOVS_ROW>
<!-- loader xml for Enginatics Blitz Report lov: Revaluation Currency -->
 <LOVS_ROW>
  <GUID>E32BB68D727ACCAFE0530100007F85F2</GUID>
  <LOV_NAME>Revaluation Currency</LOV_NAME>
  <VALIDATE_FROM_LIST>Y</VALIDATE_FROM_LIST>
  <LOV_QUERY>select distinct
fcv.currency_code value,
fcv.description
from
fnd_currencies_vl fcv,
gl_daily_rates gdr
where
fcv.currency_code=gdr.to_currency and
fcv.enabled_flag=&apos;Y&apos; and
gdr.from_currency in (
select
gl.currency_code
from
gl_ledgers gl
where
gl.ledger_id in (select asp.set_of_books_id from ar_system_parameters asp) and
(:$flex$.Ledger is null or xxen_util.contains(:$flex$.Ledger,gl.name) = &apos;Y&apos;) and
(:$flex$.Operating_Unit is null or gl.ledger_id in (select hou.set_of_books_id from hr_operating_units hou where xxen_util.contains(:$flex$.Operating_unit,hou.name) = &apos;Y&apos;))
) and
gdr.conversion_date&gt;=sysdate-365
order by 1</LOV_QUERY>
  <LOV_TRANSLATIONS>
   <LOV_TRANSLATIONS_ROW>
    <LANGUAGE>US</LANGUAGE>
    <DESCRIPTION>Revaluation Currency Code to be used in SUb Ledger Reports</DESCRIPTION>
   </LOV_TRANSLATIONS_ROW>
  </LOV_TRANSLATIONS>
 </LOVS_ROW>
<!-- loader xml for Enginatics Blitz Report lov: Revaluation Rate Type -->
 <LOVS_ROW>
  <GUID>E32BB68D727BCCAFE0530100007F85F2</GUID>
  <LOV_NAME>Revaluation Rate Type</LOV_NAME>
  <VALIDATE_FROM_LIST>Y</VALIDATE_FROM_LIST>
  <LOV_QUERY>select distinct
gdct.user_conversion_type value, 
gdct.description||&apos; (&apos;||count(*) over (partition by gdr.conversion_type)||&apos;)&apos; description
from
gl_daily_conversion_types gdct,
gl_daily_rates gdr
where
gdr.from_currency in (
select
gl.currency_code
from
gl_ledgers gl
where
gl.ledger_id in (select asp.set_of_books_id from ar_system_parameters asp) and
(:$flex$.Ledger is null or xxen_util.contains(:$flex$.Ledger,gl.name) = &apos;Y&apos;) and
(:$flex$.Operating_Unit is null or gl.ledger_id in (select hou.set_of_books_id from hr_operating_units hou where xxen_util.contains(:$flex$.Operating_unit,hou.name) = &apos;Y&apos;))
) and
gdr.to_currency=:$flex$.revaluation_currency and
gdr.conversion_date&gt;=sysdate-365 and
gdct.conversion_type=gdr.conversion_type
order by 1</LOV_QUERY>
  <LOV_TRANSLATIONS>
   <LOV_TRANSLATIONS_ROW>
    <LANGUAGE>US</LANGUAGE>
    <DESCRIPTION>Revaluation Rate Type to be used in SUb Ledger Reports</DESCRIPTION>
   </LOV_TRANSLATIONS_ROW>
  </LOV_TRANSLATIONS>
 </LOVS_ROW>
</LOVS>
<REPORTS>
<!-- loader xml for Enginatics Blitz Report: AR Customer Open Balances Period Lookback -->
 <REPORTS_ROW>
  <GUID>DEBD76372B0F6D19E05362FB0905A1E0</GUID>
  <SQL_TEXT>select
  trx.legal_entity                 legal_entity
, trx.legal_entity_identifier      legal_entity_identifier
, trx.ledger                       ledger
, trx.ou_name                      operating_unit
, trx.account_number               customer_number
, trx.customer_name                customer_name
, sum(trx.inv_amt_due_p0)          &quot;Open Amount Acctd Current&quot;
--
&amp;lp_amt_due_max_col
&amp;lp_amt_due_cols1
&amp;lp_reval_cols
&amp;lp_amt_due_max_col_reval
&amp;lp_amt_due_cols1_reval
--
from
  ( select
      xep.name                      legal_entity 
    , xep.legal_entity_identifier   legal_entity_identifier
    , gl.name                       ledger
    , hou.name                      ou_name
    , rcta.invoice_currency_code    currency_code
    , nvl(rcta.exchange_rate,1)     orig_invoice_rate
    , hp.party_name                 customer_name
    , hca.account_number            account_number
    , rcta.trx_number               invoice_number
    , &apos;&apos;                            lookup_code
    , rcta.trx_date                 invoice_date
    , rcta.doc_sequence_value       internal_invoice_no
    , rctt.type                     transaction_type
    , rcta.customer_trx_id          cust_trx_id
    --
    , rctlgd.amount                          invoice_entered_amt
    , nvl(rctlgd.acctd_amount,rctlgd.amount) invoice_entered_amt_acctd
    -- inv_amt_due_acctd
    , sum( case when aps.gl_date &lt;= :p_as_of_date then 1 else 0 end *
          ((aps.amount_due_original * nvl(aps.exchange_rate,1))
           - nvl( ( select sum(ara.acctd_amount_applied_to + nvl(ara.acctd_earned_discount_taken,0) + nvl(ara.acctd_unearned_discount_taken,0))
                    from   ar_receivable_applications_all ara
                    where  ara.status                      = &apos;APP&apos;
                    and    ara.applied_customer_trx_id     = aps.customer_trx_id
                    and    ara.applied_payment_schedule_id = aps.payment_schedule_id
                    and    ara.org_id                      = aps.org_id
                    and    ara.gl_date                    &lt;= :p_as_of_date
                  )
                , 0)
           + nvl( ( select sum(ara.acctd_amount_applied_from)
                    from   ar_receivable_applications_all ara
                    where  ara.status                  = &apos;APP&apos;
                    and    ara.application_type       != &apos;CASH&apos;
                    and    rctt.type                   = &apos;CM&apos;
                    and    ara.customer_trx_id         = aps.customer_trx_id
                    and    ara.payment_schedule_id     = aps.payment_schedule_id
                    and    ara.org_id                  = aps.org_id
                    and    ara.gl_date                &lt;= :p_as_of_date
                  )
                , 0)
           + nvl( ( select sum(ara.acctd_amount)
                    from ar_adjustments_all ara
                    where ara.customer_trx_id   = aps.customer_trx_id
                    and ara.payment_schedule_id = aps.payment_schedule_id
                    and ara.org_id              = aps.org_id
                    and ara.gl_date            &lt;= :p_as_of_date
                  )
                , 0)
           )
          )  inv_amt_due_p0
    --
    &amp;lp_amt_due_cols2
    --
    , gl.currency_code ledger_currency
    , max(decode(gl.currency_code,:p_reval_currency,1,(select gdr.conversion_rate from gl_daily_conversion_types gdct, gl_daily_rates gdr where gl.currency_code=gdr.from_currency and gdr.to_currency=:p_reval_currency and :p_reval_conv_date=gdr.conversion_date and gdct.user_conversion_type=:p_reval_conv_type and gdct.conversion_type=gdr.conversion_type))) reval_conv_rate
    from
      hr_operating_units           hou
    , gl_ledgers                   gl
    , ra_customer_trx_all          rcta
    , ar_payment_schedules_all     aps
    , ra_cust_trx_types_all        rctt
    , ra_cust_trx_line_gl_dist_all rctlgd
    , hz_cust_accounts             hca
    , hz_parties                   hp
    , ar_system_parameters_all     sp
    , xle_entity_profiles          xep
    where
        hou.set_of_books_id              = sp.set_of_books_id
    and gl.ledger_id                     = sp.set_of_books_id
    and rcta.customer_trx_id             = aps.customer_trx_id
    and rcta.org_id                      = hou.organization_id
    and aps.org_id                       = rcta.org_id
    and rcta.cust_trx_type_id            = rctt.cust_trx_type_id
    and rcta.org_id                      = rctt.org_id
    and rctlgd.org_id                    = rctt.org_id
    and aps.customer_trx_id              = rctlgd.customer_trx_id
    and rctlgd.account_class             = &apos;REC&apos;
    and rctlgd.latest_rec_flag           = &apos;Y&apos;
    and rcta.bill_to_customer_id         = hca.cust_account_id
    and hp.party_id                      = hca.party_id
    and xep.legal_entity_id (+)          = rcta.legal_entity_id
    and sp.org_id                        = rcta.org_id
    and aps.gl_date_closed               &gt; :p_first_gl_date
    and aps.gl_date                     &lt;= :p_as_of_date
    and 1=1
    group by
      xep.name
    , xep.legal_entity_identifier
    , gl.name
    , gl.currency_code
    , hou.name
    , rcta.invoice_currency_code
    , nvl(rcta.exchange_rate,1)
    , rctlgd.amount
    , nvl(rctlgd.acctd_amount,rctlgd.amount)
    , hp.party_name
    , hca.account_number
    , rcta.trx_number
    , rcta.trx_date
    , rcta.doc_sequence_value
    , rcta.invoice_currency_code
    , rctt.type
    , hca.cust_account_id
    , rcta.customer_trx_id
    union
    select
      xep.name                                      legal_entity
    , xep.legal_entity_identifier                   legal_entity_identifier 
    , gl.name                                       ledger
    , hou.name                                      ou_name
    , substr(acr.currency_code,1,3)                 currency_code
    , nvl(acr.exchange_rate,1)                      orig_invoice_rate    
    , hp.party_name                                 customer_name
    , hca.account_number                            account_number
    , acr.receipt_number                            invoice_number
    , al.lookup_code                                lookup_code
    , acr.receipt_date                              invoice_date    
    , acr.doc_sequence_value                        int_invoice_number
    , decode(ara.status,&apos;ACC&apos;,&apos;*&apos; || al.meaning)    transaction_type  
    , hca.cust_account_id                           cust_trx_id
    , acr.amount                                    orig_amt
    , acr.amount * nvl(acr.exchange_rate,1)         orig_amt_acctd
    , 0 - sum(case when ara.gl_date &lt;= :p_as_of_date then nvl(ara.acctd_amount_applied_from,0) else 0 end) inv_amt_due_p0
    --
    &amp;lp_amt_due_cols3
    --
    , gl.currency_code ledger_currency
    , max(decode(gl.currency_code,:p_reval_currency,1,(select gdr.conversion_rate from gl_daily_conversion_types gdct, gl_daily_rates gdr where gl.currency_code=gdr.from_currency and gdr.to_currency=:p_reval_currency and :p_reval_conv_date=gdr.conversion_date and gdct.user_conversion_type=:p_reval_conv_type and gdct.conversion_type=gdr.conversion_type))) reval_conv_rate
    from
      hr_operating_units             hou
    , gl_ledgers                     gl
    , ar_receivable_applications_all ara
    , ar_lookups                     al
    , ar_cash_receipts_all           acr
    , ar_cash_receipt_history_all    acrh
    , ar_payment_schedules_all       aps
    , hz_cust_accounts               hca
    , hz_parties                     hp
    , ar_system_parameters_all       sp
    , xle_entity_profiles            xep
    where
        hou.set_of_books_id              = sp.set_of_books_id
    and gl.ledger_id                     = sp.set_of_books_id
    and acr.org_id                       = hou.organization_id
    and acr.org_id                       = ara.org_id
    and hca.cust_account_id              = acr.pay_from_customer
    and hca.party_id                     = hp.party_id
    and acr.cash_receipt_id              = ara.cash_receipt_id
    and acrh.cash_receipt_id             = ara.cash_receipt_id
    and ara.cash_receipt_history_id      = acrh.cash_receipt_history_id
    and aps.cash_receipt_id              = acr.cash_receipt_id
    and al.lookup_type                   = &apos;PAYMENT_TYPE&apos;
    and ara.status                       = al.lookup_code
    and ara.status                       = &apos;ACC&apos;
    and not exists
        ( select &apos;X&apos;
          from ar_cash_receipt_history_all crhin
          where crhin.cash_receipt_id = acr.cash_receipt_id
          and   crhin.org_id = acr.org_id
          and crhin.status = &apos;REVERSED&apos;
        )
    and nvl(ara.confirmed_flag,&apos;Y&apos;)      = &apos;Y&apos;
    and nvl(acr.confirmed_flag,&apos;Y&apos;)      = &apos;Y&apos;
    and xep.legal_entity_id (+)          = acr.legal_entity_id
    and sp.org_id                        = acr.org_id
    and aps.gl_date_closed               &gt; :p_first_gl_date
    and aps.gl_date                     &lt;= :p_as_of_date
    and 2=2
    group by
      xep.name
    , xep.legal_entity_identifier
    , gl.name
    , gl.currency_code
    , hou.name
    , hca.cust_account_id
    , hp.party_name
    , hca.account_number
    , decode(ara.status,&apos;ACC&apos;,&apos;*&apos; || al.meaning)
    , acr.receipt_number
    , acr.doc_sequence_value
    , acr.receipt_date
    , al.lookup_code
    , acr.amount
    , nvl(acr.exchange_rate,1)
    , substr(acr.currency_code,1,3)
    , acr.currency_code
    union
    select
      xep.name                                      legal_entity 
    , xep.legal_entity_identifier                   legal_entity_identifier 
    , gl.name                                       ledger
    , hou.name                                      ou_name
    , substr(acr.currency_code,1,3)                 currency_code
    , nvl(acr.exchange_rate,1)                      orig_invoice_rate    
    , hp.party_name                                 customer_name
    , hca.account_number                            account_number
    , acr.receipt_number                            invoice_number
    , al.lookup_code                                lookup_code
    , acr.receipt_date                              invoice_date    
    , acr.doc_sequence_value                        int_invoice_number
    , decode(ara.status,&apos;UNAPP&apos;,&apos;*&apos; || al.meaning)  transaction_type  
    , hca.cust_account_id                           cust_trx_id
    , acr.amount                                    orig_amt
    , acr.amount * nvl(acr.exchange_rate,1)         orig_amt_acctd
    , 0 - sum(case when ara.gl_date &lt;= :p_as_of_date then nvl(ara.acctd_amount_applied_from,0) else 0 end) inv_amt_due_p0    
    --
    &amp;lp_amt_due_cols3
    --
    , gl.currency_code ledger_currency
    , max(decode(gl.currency_code,:p_reval_currency,1,(select gdr.conversion_rate from gl_daily_conversion_types gdct, gl_daily_rates gdr where gl.currency_code=gdr.from_currency and gdr.to_currency=:p_reval_currency and :p_reval_conv_date=gdr.conversion_date and gdct.user_conversion_type=:p_reval_conv_type and gdct.conversion_type=gdr.conversion_type))) reval_conv_rate
    from
      hr_operating_units             hou
    , gl_ledgers                     gl
    , ar_receivable_applications_all ara
    , ar_lookups                     al
    , ar_cash_receipts_all           acr
    , ar_cash_receipt_history_all    acrh
    , ar_payment_schedules_all       aps
    , hz_cust_accounts               hca
    , hz_parties                     hp
    , ar_system_parameters_all       sp
    , xle_entity_profiles            xep
    where
        hou.set_of_books_id              = sp.set_of_books_id
    and gl.ledger_id                     = sp.set_of_books_id
    and acr.org_id                       = hou.organization_id
    and acr.org_id                       = ara.org_id
    and hca.cust_account_id              = acr.pay_from_customer
    and hca.party_id                     = hp.party_id
    and acr.cash_receipt_id              = ara.cash_receipt_id
    and acrh.cash_receipt_id             = ara.cash_receipt_id
    and ara.cash_receipt_history_id      = acrh.cash_receipt_history_id
    and aps.cash_receipt_id              = acr.cash_receipt_id
    and al.lookup_type                   = &apos;PAYMENT_TYPE&apos;
    and ara.status                       = al.lookup_code
    and ara.status                       = &apos;UNAPP&apos;
    and not exists
        ( select &apos;X&apos;
          from ar_cash_receipt_history_all crhin
          where crhin.cash_receipt_id = acr.cash_receipt_id
          and   crhin.org_id = acr.org_id
          and   crhin.status = &apos;REVERSED&apos;
        )
    and nvl(ara.confirmed_flag,&apos;Y&apos;)      = &apos;Y&apos;
    and nvl(acr.confirmed_flag,&apos;Y&apos;)      = &apos;Y&apos;
    and xep.legal_entity_id (+)          = acr.legal_entity_id
    and sp.org_id                        = acr.org_id
    and aps.gl_date_closed               &gt; :p_first_gl_date
    and aps.gl_date                     &lt;= :p_as_of_date
    and 2=2
    group by
      xep.name
    , xep.legal_entity_identifier
    , gl.name
    , gl.currency_code
    , hou.name
    , hca.cust_account_id
    , hp.party_name
    , hca.account_number
    , decode(ara.status,&apos;UNAPP&apos;,&apos;*&apos; || al.meaning)
    , acr.receipt_number
    , acr.doc_sequence_value
    , acr.receipt_date
    , al.lookup_code
    , acr.amount
    , nvl(acr.exchange_rate,1)
    , substr(acr.currency_code,1,3)
    , acr.currency_code
    union
    select
      xep.name                                      legal_entity 
    , xep.legal_entity_identifier                   legal_entity_identifier 
    , gl.name                                       ledger
    , hou.name                                      ou_name
    , substr(acr.currency_code,1,3)                 currency_code
    , nvl(acr.exchange_rate,1)                      orig_invoice_rate    
    , hp.party_name                                 customer_name
    , hca.account_number                            account_number
    , acr.receipt_number                            invoice_number
    , al.lookup_code                                lookup_code
    , acr.receipt_date                              invoice_date    
    , acr.doc_sequence_value                        int_invoice_number
    , decode(ara.status,&apos;OTHER ACC&apos;,&apos;*&apos; || al.meaning)  transaction_type  
    , hca.cust_account_id                           cust_trx_id
    , acr.amount                                    orig_amt
    , acr.amount * nvl(acr.exchange_rate,1)         orig_amt_acctd
    , 0 - sum(case when ara.gl_date &lt;= :p_as_of_date then nvl(ara.acctd_amount_applied_from,0) else 0 end) inv_amt_due_p0    
    --
    &amp;lp_amt_due_cols3
    --
    , gl.currency_code ledger_currency
    , max(decode(gl.currency_code,:p_reval_currency,1,(select gdr.conversion_rate from gl_daily_conversion_types gdct, gl_daily_rates gdr where gl.currency_code=gdr.from_currency and gdr.to_currency=:p_reval_currency and :p_reval_conv_date=gdr.conversion_date and gdct.user_conversion_type=:p_reval_conv_type and gdct.conversion_type=gdr.conversion_type))) reval_conv_rate
    from
      hr_operating_units             hou
    , gl_ledgers                     gl
    , ar_receivable_applications_all ara
    , ar_lookups                     al
    , ar_cash_receipts_all           acr
    , ar_cash_receipt_history_all    acrh
    , ar_payment_schedules_all       aps
    , hz_cust_accounts               hca
    , hz_parties                     hp
    , ar_system_parameters_all       sp
    , xle_entity_profiles            xep
    where
        hou.set_of_books_id              = sp.set_of_books_id
    and gl.ledger_id                     = sp.set_of_books_id
    and acr.org_id                       = hou.organization_id
    and acr.org_id                       = ara.org_id
    and hca.cust_account_id              = acr.pay_from_customer
    and hca.party_id                     = hp.party_id
    and acr.cash_receipt_id              = ara.cash_receipt_id
    and acrh.cash_receipt_id             = ara.cash_receipt_id
    and ara.cash_receipt_history_id      = acrh.cash_receipt_history_id
    and aps.cash_receipt_id              = acr.cash_receipt_id
    and al.lookup_type                   = &apos;PAYMENT_TYPE&apos;
    and ara.status                       = al.lookup_code
    and ara.status                       = &apos;OTHER ACC&apos;
    and not exists
        ( select &apos;X&apos;
          from ar_cash_receipt_history_all crhin
          where crhin.cash_receipt_id = acr.cash_receipt_id
          and   crhin.status = &apos;REVERSED&apos;
          and   crhin.org_id = acr.org_id
        )
    and nvl(ara.confirmed_flag,&apos;Y&apos;)      = &apos;Y&apos;
    and nvl(acr.confirmed_flag,&apos;Y&apos;)      = &apos;Y&apos;
    and xep.legal_entity_id (+)          = acr.legal_entity_id
    and sp.org_id                        = acr.org_id
    and aps.gl_date_closed               &gt; :p_first_gl_date
    and aps.gl_date                     &lt;= :p_as_of_date
    and 2=2
    group by
      xep.name
    , xep.legal_entity_identifier
    , gl.name
    , gl.currency_code
    , hou.name
    , hca.cust_account_id
    , hp.party_name
    , hca.account_number
    , decode(ara.status,&apos;OTHER ACC&apos;,&apos;*&apos; || al.meaning)
    , acr.receipt_number
    , acr.doc_sequence_value
    , acr.receipt_date
    , al.lookup_code
    , acr.amount
    , nvl(acr.exchange_rate,1)
    , substr(acr.currency_code,1,3)
    , acr.currency_code
  ) trx
where
    :p_periods_range = :p_periods_range
and :p_max_open_periods_range = :p_max_open_periods_range
group by
  trx.legal_entity
, trx.legal_entity_identifier 
, trx.ledger
, trx.ledger_currency
, trx.reval_conv_rate
, trx.ou_name
, trx.customer_name
, trx.account_number
&amp;lp_having_clause
order by
  ledger
, operating_unit
, customer_number
, customer_name</SQL_TEXT>
  <ENABLED>Y</ENABLED>
  <XDO_APPLICATION_SHORT_NAME>AR</XDO_APPLICATION_SHORT_NAME>
  <NUMBER_FORMAT>#,##0.00;(#,##0.00)</NUMBER_FORMAT>
  <REQUIRED_PARAMETERS>:Ledger is not null or :Operating_Unit is not null</REQUIRED_PARAMETERS>
  <REPORT_TRANSLATIONS>
   <REPORT_TRANSLATIONS_ROW>
    <LANGUAGE>US</LANGUAGE>
    <REPORT_NAME>AR Customer Open Balances Period Lookback</REPORT_NAME>
    <DESCRIPTION>Report: AR Customer Open Balances Period Lookback
Application: Receivables
Description:
Customer Open Balances summary showing
- Open Balances as of the specified &apos;As of Date&apos; and as of &lt;n&gt; periods prior to the &apos;As of Date&apos; period.
- Maximum Open Balance in the prior &lt;n&gt; periods prior to the &apos;As of Date&apos; period

All balances are show in the functional currency.

Parameters:
As of Date - the report will be run as of this date. Defaults to the current system date.
Look Back &lt;n&gt; periods - number of periods prior to the &apos;As of Date&apos; period to show
Max Open over last &lt;n&gt; Periods - number of periods prior to the &apos;As of Date&apos; period to consider in the Maximum Open Balance amount calculation
</DESCRIPTION>
    <REQUIRED_PARAMETERS_MESSAGE>Please enter ledger or operating unit</REQUIRED_PARAMETERS_MESSAGE>
   </REPORT_TRANSLATIONS_ROW>
  </REPORT_TRANSLATIONS>
  <CATEGORY_ASSIGNMENTS>
   <CATEGORY_ASSIGNMENTS_ROW>
    <CATEGORY>Enginatics</CATEGORY>
   </CATEGORY_ASSIGNMENTS_ROW>
   <CATEGORY_ASSIGNMENTS_ROW>
    <CATEGORY>R12 only</CATEGORY>
   </CATEGORY_ASSIGNMENTS_ROW>
  </CATEGORY_ASSIGNMENTS>
  <ANCHORS>
   <ANCHORS_ROW>
    <ANCHOR>&amp;lp_amt_due_cols1</ANCHOR>
   </ANCHORS_ROW>
   <ANCHORS_ROW>
    <ANCHOR>&amp;lp_amt_due_cols1_reval</ANCHOR>
   </ANCHORS_ROW>
   <ANCHORS_ROW>
    <ANCHOR>&amp;lp_amt_due_cols2</ANCHOR>
   </ANCHORS_ROW>
   <ANCHORS_ROW>
    <ANCHOR>&amp;lp_amt_due_cols3</ANCHOR>
   </ANCHORS_ROW>
   <ANCHORS_ROW>
    <ANCHOR>&amp;lp_amt_due_max_col</ANCHOR>
   </ANCHORS_ROW>
   <ANCHORS_ROW>
    <ANCHOR>&amp;lp_amt_due_max_col_reval</ANCHOR>
   </ANCHORS_ROW>
   <ANCHORS_ROW>
    <ANCHOR>&amp;lp_having_clause</ANCHOR>
   </ANCHORS_ROW>
   <ANCHORS_ROW>
    <ANCHOR>&amp;lp_reval_cols</ANCHOR>
   </ANCHORS_ROW>
   <ANCHORS_ROW>
    <ANCHOR>1=1</ANCHOR>
   </ANCHORS_ROW>
   <ANCHORS_ROW>
    <ANCHOR>2=2</ANCHOR>
   </ANCHORS_ROW>
   <ANCHORS_ROW>
    <ANCHOR>:p_as_of_date</ANCHOR>
   </ANCHORS_ROW>
   <ANCHORS_ROW>
    <ANCHOR>:p_first_gl_date</ANCHOR>
   </ANCHORS_ROW>
   <ANCHORS_ROW>
    <ANCHOR>:p_max_open_periods_range</ANCHOR>
   </ANCHORS_ROW>
   <ANCHORS_ROW>
    <ANCHOR>:p_periods_range</ANCHOR>
   </ANCHORS_ROW>
   <ANCHORS_ROW>
    <ANCHOR>:p_reval_conv_date</ANCHOR>
   </ANCHORS_ROW>
   <ANCHORS_ROW>
    <ANCHOR>:p_reval_conv_type</ANCHOR>
   </ANCHORS_ROW>
   <ANCHORS_ROW>
    <ANCHOR>:p_reval_currency</ANCHOR>
   </ANCHORS_ROW>
  </ANCHORS>
  <PARAMETERS>
   <PARAMETERS_ROW>
    <SORT_ORDER>1</SORT_ORDER>
    <DISPLAY_SEQUENCE>-10</DISPLAY_SEQUENCE>
    <ANCHOR>:p_first_gl_date</ANCHOR>
    <PARAMETER_TYPE_DSP>Date</PARAMETER_TYPE_DSP>
    <DEFAULT_VALUE>select
min(x.end_date)
from
(
select
1-rank() over (partition by gl.name order by ((glp.period_year * 100000) + glp.period_num) desc) relative_period,
glp.period_name,
glp.period_type,
glp.end_date
from
 gl_ledgers gl
,gl_periods glp
,gl_periods glpc
where
    glpc.period_set_name=glp.period_set_name
and glpc.period_type=glp.period_type
and glp.adjustment_period_flag=&apos;N&apos;
and glpc.adjustment_period_flag=&apos;N&apos;
and trunc(:$flex$.as_of_date) between glpc.start_date and glpc.end_date
and glp.start_date &lt;= glpc.start_date
and glpc.period_set_name = gl.period_set_name
and glpc.period_type = gl.accounted_period_type
and gl.ledger_id =
(select min(gl2.ledger_id)
 from   gl_ledgers gl2
 where  (   xxen_util.contains(:$flex$.ledger,gl2.name) = &apos;Y&apos;
         or gl2.ledger_id in (select hou.set_of_books_id from hr_operating_units hou where xxen_util.contains(:$flex$.operating_unit,hou.name) = &apos;Y&apos;)
        )
 and exists 
 (select null from gl_periods gp where gp.period_set_name = gl.period_set_name and gp.period_type = gl.accounted_period_type and gp.adjustment_period_flag=&apos;N&apos; and trunc(:$flex$.as_of_date) between gp.start_date and gp.end_date)
)
) x
where
 x.relative_period between -1 * :$flex$.Look_Back_n_Periods and -1
</DEFAULT_VALUE>
    <PARAMETER_TRANSLATIONS>
     <PARAMETER_TRANSLATIONS_ROW>
      <LANGUAGE>F</LANGUAGE>
      <PARAMETER_NAME>Date la plus ancienne</PARAMETER_NAME>
     </PARAMETER_TRANSLATIONS_ROW>
     <PARAMETER_TRANSLATIONS_ROW>
      <LANGUAGE>US</LANGUAGE>
      <PARAMETER_NAME>Earliest As Of Date</PARAMETER_NAME>
     </PARAMETER_TRANSLATIONS_ROW>
    </PARAMETER_TRANSLATIONS>
   </PARAMETERS_ROW>
   <PARAMETERS_ROW>
    <SORT_ORDER>2</SORT_ORDER>
    <DISPLAY_SEQUENCE>10</DISPLAY_SEQUENCE>
    <ANCHOR>1=1</ANCHOR>
    <SQL_TEXT>gl.name=:ledger and 
hou.organization_id in (select mgoat.organization_id from mo_glob_org_access_tmp mgoat union select fnd_global.org_id from dual where fnd_release.major_version=11)</SQL_TEXT>
    <PARAMETER_TYPE_DSP>LOV</PARAMETER_TYPE_DSP>
    <LOV_NAME>GL Ledger (restricted by AR System Parameters)</LOV_NAME>
    <LOV_GUID>B581C79E6D7AE63DE0530100007FE14A</LOV_GUID>
    <VALIDATE_FROM_LIST_DSP>Y</VALIDATE_FROM_LIST_DSP>
    <LOV_QUERY_DSP>select
gl.name value,
fifsv.id_flex_structure_name||&apos;: &apos;||gl.description description
from
gl_ledgers gl,
fnd_id_flex_structures_vl fifsv
where
gl.ledger_id in (select asp.set_of_books_id from ar_system_parameters asp) and
gl.chart_of_accounts_id=fifsv.id_flex_num and
fifsv.id_flex_code=&apos;GL#&apos; and
fifsv.application_id=101
order by
fifsv.id_flex_structure_name,
gl.name</LOV_QUERY_DSP>
    <DEFAULT_VALUE>coalesce(xxen_util.previous_parameter_value(:parameter_id),xxen_util.default_ledger)</DEFAULT_VALUE>
    <PARAMETER_TRANSLATIONS>
     <PARAMETER_TRANSLATIONS_ROW>
      <LANGUAGE>F</LANGUAGE>
      <PARAMETER_NAME>Grand livre</PARAMETER_NAME>
     </PARAMETER_TRANSLATIONS_ROW>
     <PARAMETER_TRANSLATIONS_ROW>
      <LANGUAGE>US</LANGUAGE>
      <PARAMETER_NAME>Ledger</PARAMETER_NAME>
     </PARAMETER_TRANSLATIONS_ROW>
    </PARAMETER_TRANSLATIONS>
   </PARAMETERS_ROW>
   <PARAMETERS_ROW>
    <SORT_ORDER>3</SORT_ORDER>
    <ANCHOR>2=2</ANCHOR>
    <SQL_TEXT>gl.name=:ledger and 
hou.organization_id in (select mgoat.organization_id from mo_glob_org_access_tmp mgoat union select fnd_global.org_id from dual where fnd_release.major_version=11)</SQL_TEXT>
    <PARAMETER_TRANSLATIONS>
     <PARAMETER_TRANSLATIONS_ROW>
      <LANGUAGE>F</LANGUAGE>
      <PARAMETER_NAME>Grand livre</PARAMETER_NAME>
     </PARAMETER_TRANSLATIONS_ROW>
     <PARAMETER_TRANSLATIONS_ROW>
      <LANGUAGE>US</LANGUAGE>
      <PARAMETER_NAME>Ledger</PARAMETER_NAME>
     </PARAMETER_TRANSLATIONS_ROW>
    </PARAMETER_TRANSLATIONS>
   </PARAMETERS_ROW>
   <PARAMETERS_ROW>
    <SORT_ORDER>4</SORT_ORDER>
    <DISPLAY_SEQUENCE>20</DISPLAY_SEQUENCE>
    <ANCHOR>1=1</ANCHOR>
    <SQL_TEXT>hou.name=:operating_unit</SQL_TEXT>
    <PARAMETER_TYPE_DSP>LOV</PARAMETER_TYPE_DSP>
    <LOV_NAME>HR Operating Unit</LOV_NAME>
    <LOV_GUID>8E2FF36EDEB979D2E0530100007F1FF2</LOV_GUID>
    <VALIDATE_FROM_LIST_DSP>Y</VALIDATE_FROM_LIST_DSP>
    <LOV_QUERY_DSP>select
hou.name value,
null description
from
hr_operating_units hou
where
sysdate between hou.date_from and nvl(hou.date_to,sysdate) and
(:$flex$.ledger is null or hou.set_of_books_id in (select gl.ledger_id from gl_ledgers gl where xxen_util.contains(:$flex$.ledger,gl.name)=&apos;Y&apos;)) and
hou.organization_id in (select mgoat.organization_id from mo_glob_org_access_tmp mgoat union select fnd_global.org_id from dual where fnd_release.major_version=11)
order by
hou.name</LOV_QUERY_DSP>
    <DEFAULT_VALUE>coalesce(xxen_util.default_operating_unit,xxen_util.previous_parameter_value(:parameter_id))</DEFAULT_VALUE>
    <PARAMETER_TRANSLATIONS>
     <PARAMETER_TRANSLATIONS_ROW>
      <LANGUAGE>F</LANGUAGE>
      <PARAMETER_NAME>Unité d&apos;exploitation</PARAMETER_NAME>
      <DESCRIPTION>Unité opérationnelle</DESCRIPTION>
     </PARAMETER_TRANSLATIONS_ROW>
     <PARAMETER_TRANSLATIONS_ROW>
      <LANGUAGE>US</LANGUAGE>
      <PARAMETER_NAME>Operating Unit</PARAMETER_NAME>
      <DESCRIPTION>Operating Unit</DESCRIPTION>
     </PARAMETER_TRANSLATIONS_ROW>
    </PARAMETER_TRANSLATIONS>
   </PARAMETERS_ROW>
   <PARAMETERS_ROW>
    <SORT_ORDER>5</SORT_ORDER>
    <ANCHOR>2=2</ANCHOR>
    <SQL_TEXT>hou.name=:operating_unit</SQL_TEXT>
    <PARAMETER_TRANSLATIONS>
     <PARAMETER_TRANSLATIONS_ROW>
      <LANGUAGE>F</LANGUAGE>
      <PARAMETER_NAME>Unité d&apos;exploitation</PARAMETER_NAME>
     </PARAMETER_TRANSLATIONS_ROW>
     <PARAMETER_TRANSLATIONS_ROW>
      <LANGUAGE>US</LANGUAGE>
      <PARAMETER_NAME>Operating Unit</PARAMETER_NAME>
     </PARAMETER_TRANSLATIONS_ROW>
    </PARAMETER_TRANSLATIONS>
   </PARAMETERS_ROW>
   <PARAMETERS_ROW>
    <SORT_ORDER>6</SORT_ORDER>
    <DISPLAY_SEQUENCE>30</DISPLAY_SEQUENCE>
    <ANCHOR>1=1</ANCHOR>
    <SQL_TEXT>rcta.invoice_currency_code = :p_currency</SQL_TEXT>
    <PARAMETER_TYPE_DSP>LOV custom</PARAMETER_TYPE_DSP>
    <VALIDATE_FROM_LIST_DSP>Y</VALIDATE_FROM_LIST_DSP>
    <LOV_QUERY_DSP>select
CURRENCY_CODE value,
DESCRIPTION description
from
FND_CURRENCIES_VL
WHERE CURRENCY_FLAG=&apos;Y&apos;
AND ENABLED_FLAG IN (&apos;Y&apos;,&apos;N&apos;)
and currency_code != &apos;ANY&apos;
ORDER BY CURRENCY_CODE
</LOV_QUERY_DSP>
    <PARAMETER_TRANSLATIONS>
     <PARAMETER_TRANSLATIONS_ROW>
      <LANGUAGE>AR</LANGUAGE>
      <PARAMETER_NAME>العملة</PARAMETER_NAME>
      <DESCRIPTION>العملة </DESCRIPTION>
     </PARAMETER_TRANSLATIONS_ROW>
     <PARAMETER_TRANSLATIONS_ROW>
      <LANGUAGE>D</LANGUAGE>
      <PARAMETER_NAME>Währung</PARAMETER_NAME>
      <DESCRIPTION>Währung</DESCRIPTION>
     </PARAMETER_TRANSLATIONS_ROW>
     <PARAMETER_TRANSLATIONS_ROW>
      <LANGUAGE>F</LANGUAGE>
      <PARAMETER_NAME>Monnaie</PARAMETER_NAME>
      <DESCRIPTION>Devise</DESCRIPTION>
     </PARAMETER_TRANSLATIONS_ROW>
     <PARAMETER_TRANSLATIONS_ROW>
      <LANGUAGE>I</LANGUAGE>
      <PARAMETER_NAME>Divisa</PARAMETER_NAME>
      <DESCRIPTION>Divisa</DESCRIPTION>
     </PARAMETER_TRANSLATIONS_ROW>
     <PARAMETER_TRANSLATIONS_ROW>
      <LANGUAGE>US</LANGUAGE>
      <PARAMETER_NAME>Currency</PARAMETER_NAME>
      <DESCRIPTION>Currency - Must be specified for User Exchange Rate Type</DESCRIPTION>
     </PARAMETER_TRANSLATIONS_ROW>
     <PARAMETER_TRANSLATIONS_ROW>
      <LANGUAGE>ZHS</LANGUAGE>
      <PARAMETER_NAME>币种</PARAMETER_NAME>
      <DESCRIPTION>币种</DESCRIPTION>
     </PARAMETER_TRANSLATIONS_ROW>
    </PARAMETER_TRANSLATIONS>
   </PARAMETERS_ROW>
   <PARAMETERS_ROW>
    <SORT_ORDER>7</SORT_ORDER>
    <ANCHOR>2=2</ANCHOR>
    <SQL_TEXT>acr.currency_code = :p_currency</SQL_TEXT>
    <PARAMETER_TRANSLATIONS>
     <PARAMETER_TRANSLATIONS_ROW>
      <LANGUAGE>F</LANGUAGE>
      <PARAMETER_NAME>Monnaie</PARAMETER_NAME>
     </PARAMETER_TRANSLATIONS_ROW>
     <PARAMETER_TRANSLATIONS_ROW>
      <LANGUAGE>US</LANGUAGE>
      <PARAMETER_NAME>Currency</PARAMETER_NAME>
     </PARAMETER_TRANSLATIONS_ROW>
    </PARAMETER_TRANSLATIONS>
   </PARAMETERS_ROW>
   <PARAMETERS_ROW>
    <SORT_ORDER>8</SORT_ORDER>
    <DISPLAY_SEQUENCE>40</DISPLAY_SEQUENCE>
    <ANCHOR>1=1</ANCHOR>
    <SQL_TEXT>hca.account_number = :p_customer</SQL_TEXT>
    <PARAMETER_TYPE_DSP>LOV Oracle</PARAMETER_TYPE_DSP>
    <LOV_NAME>AR_CUST_NAME</LOV_NAME>
    <VALIDATE_FROM_LIST_DSP>Y</VALIDATE_FROM_LIST_DSP>
    <LOV_QUERY_DSP>select
cust.account_number id,
party.party_name value,
null description
from
hz_cust_accounts cust,hz_parties party
where cust.party_id=party.party_id
order by cust.account_number</LOV_QUERY_DSP>
    <PARAMETER_TRANSLATIONS>
     <PARAMETER_TRANSLATIONS_ROW>
      <LANGUAGE>AR</LANGUAGE>
      <PARAMETER_NAME>العميل</PARAMETER_NAME>
      <DESCRIPTION>العميل</DESCRIPTION>
     </PARAMETER_TRANSLATIONS_ROW>
     <PARAMETER_TRANSLATIONS_ROW>
      <LANGUAGE>D</LANGUAGE>
      <PARAMETER_NAME>Kunde</PARAMETER_NAME>
      <DESCRIPTION>Kunde</DESCRIPTION>
     </PARAMETER_TRANSLATIONS_ROW>
     <PARAMETER_TRANSLATIONS_ROW>
      <LANGUAGE>F</LANGUAGE>
      <PARAMETER_NAME>Client</PARAMETER_NAME>
      <DESCRIPTION>Client</DESCRIPTION>
     </PARAMETER_TRANSLATIONS_ROW>
     <PARAMETER_TRANSLATIONS_ROW>
      <LANGUAGE>I</LANGUAGE>
      <PARAMETER_NAME>Cliente</PARAMETER_NAME>
      <DESCRIPTION>Cliente</DESCRIPTION>
     </PARAMETER_TRANSLATIONS_ROW>
     <PARAMETER_TRANSLATIONS_ROW>
      <LANGUAGE>US</LANGUAGE>
      <PARAMETER_NAME>Customer</PARAMETER_NAME>
      <DESCRIPTION>Customer</DESCRIPTION>
     </PARAMETER_TRANSLATIONS_ROW>
     <PARAMETER_TRANSLATIONS_ROW>
      <LANGUAGE>ZHS</LANGUAGE>
      <PARAMETER_NAME>客户</PARAMETER_NAME>
      <DESCRIPTION>客户</DESCRIPTION>
     </PARAMETER_TRANSLATIONS_ROW>
    </PARAMETER_TRANSLATIONS>
   </PARAMETERS_ROW>
   <PARAMETERS_ROW>
    <SORT_ORDER>9</SORT_ORDER>
    <ANCHOR>2=2</ANCHOR>
    <SQL_TEXT>hca.account_number = :p_customer</SQL_TEXT>
    <PARAMETER_TRANSLATIONS>
     <PARAMETER_TRANSLATIONS_ROW>
      <LANGUAGE>F</LANGUAGE>
      <PARAMETER_NAME>Client</PARAMETER_NAME>
     </PARAMETER_TRANSLATIONS_ROW>
     <PARAMETER_TRANSLATIONS_ROW>
      <LANGUAGE>US</LANGUAGE>
      <PARAMETER_NAME>Customer</PARAMETER_NAME>
     </PARAMETER_TRANSLATIONS_ROW>
    </PARAMETER_TRANSLATIONS>
   </PARAMETERS_ROW>
   <PARAMETERS_ROW>
    <SORT_ORDER>10</SORT_ORDER>
    <DISPLAY_SEQUENCE>50</DISPLAY_SEQUENCE>
    <ANCHOR>:p_as_of_date</ANCHOR>
    <PARAMETER_TYPE_DSP>Date</PARAMETER_TYPE_DSP>
    <DEFAULT_VALUE>trunc(sysdate)</DEFAULT_VALUE>
    <REQUIRED>Y</REQUIRED>
    <PARAMETER_TRANSLATIONS>
     <PARAMETER_TRANSLATIONS_ROW>
      <LANGUAGE>AR</LANGUAGE>
      <PARAMETER_NAME>اعتبارًا من تاريخ</PARAMETER_NAME>
      <DESCRIPTION>اعتبارًا من تاريخ</DESCRIPTION>
     </PARAMETER_TRANSLATIONS_ROW>
     <PARAMETER_TRANSLATIONS_ROW>
      <LANGUAGE>D</LANGUAGE>
      <PARAMETER_NAME>Vom</PARAMETER_NAME>
      <DESCRIPTION>Vom</DESCRIPTION>
     </PARAMETER_TRANSLATIONS_ROW>
     <PARAMETER_TRANSLATIONS_ROW>
      <LANGUAGE>F</LANGUAGE>
      <PARAMETER_NAME>En date du</PARAMETER_NAME>
      <DESCRIPTION>En date du</DESCRIPTION>
     </PARAMETER_TRANSLATIONS_ROW>
     <PARAMETER_TRANSLATIONS_ROW>
      <LANGUAGE>I</LANGUAGE>
      <PARAMETER_NAME>In data</PARAMETER_NAME>
      <DESCRIPTION>In data</DESCRIPTION>
     </PARAMETER_TRANSLATIONS_ROW>
     <PARAMETER_TRANSLATIONS_ROW>
      <LANGUAGE>US</LANGUAGE>
      <PARAMETER_NAME>As of Date</PARAMETER_NAME>
      <DESCRIPTION>As of Date</DESCRIPTION>
     </PARAMETER_TRANSLATIONS_ROW>
     <PARAMETER_TRANSLATIONS_ROW>
      <LANGUAGE>ZHS</LANGUAGE>
      <PARAMETER_NAME>截止日期</PARAMETER_NAME>
      <DESCRIPTION>截止日期</DESCRIPTION>
     </PARAMETER_TRANSLATIONS_ROW>
    </PARAMETER_TRANSLATIONS>
   </PARAMETERS_ROW>
   <PARAMETERS_ROW>
    <SORT_ORDER>11</SORT_ORDER>
    <ANCHOR>&amp;lp_amt_due_cols1</ANCHOR>
    <SQL_TEXT>select
&apos;, sum(trx.inv_amt_due_p&apos; || abs(x.relative_period) || &apos;) &quot;Open Amount Acctd &apos; || to_char(x.end_date,&apos;DD/MM/YYYY&apos;) || &apos;&quot;&apos;
from
(
select
1-rank() over (partition by gl.name order by ((glp.period_year * 100000) + glp.period_num) desc) relative_period,
glp.period_name,
glp.period_type,
glp.end_date
from
 gl_periods glp
,gl_periods glpc
,gl_ledgers gl
where
    glpc.period_set_name=glp.period_set_name
and glpc.period_type=glp.period_type
and glp.adjustment_period_flag=&apos;N&apos;
and glpc.adjustment_period_flag=&apos;N&apos;
and trunc(:p_as_of_date) between glpc.start_date and glpc.end_date
and glp.start_date &lt;= glpc.start_date
and glpc.period_set_name = gl.period_set_name
and glpc.period_type = gl.accounted_period_type
and gl.ledger_id =
(select min(gl2.ledger_id)
 from   gl_ledgers gl2
 where  (   xxen_util.contains(:ledger,gl2.name) = &apos;Y&apos;
         or gl2.ledger_id in (select hou.set_of_books_id from hr_operating_units hou where xxen_util.contains(:operating_unit,hou.name) = &apos;Y&apos;)
        )
 and exists 
 (select null from gl_periods gp where gp.period_set_name = gl.period_set_name and gp.period_type = gl.accounted_period_type and gp.adjustment_period_flag=&apos;N&apos; and trunc(:p_as_of_date) between gp.start_date and gp.end_date)
)
) x
where
 x.relative_period between -1 * :p_periods_range and -1
order by
 x.relative_period desc</SQL_TEXT>
    <PARAMETER_TRANSLATIONS>
     <PARAMETER_TRANSLATIONS_ROW>
      <LANGUAGE>F</LANGUAGE>
      <PARAMETER_NAME>En date du</PARAMETER_NAME>
     </PARAMETER_TRANSLATIONS_ROW>
     <PARAMETER_TRANSLATIONS_ROW>
      <LANGUAGE>US</LANGUAGE>
      <PARAMETER_NAME>As of Date</PARAMETER_NAME>
     </PARAMETER_TRANSLATIONS_ROW>
    </PARAMETER_TRANSLATIONS>
   </PARAMETERS_ROW>
   <PARAMETERS_ROW>
    <SORT_ORDER>12</SORT_ORDER>
    <ANCHOR>&amp;lp_amt_due_cols2</ANCHOR>
    <SQL_TEXT>select
   &apos;, sum(case when aps.gl_date &lt;= to_date(&apos;&apos;&apos; || to_char(x.end_date,&apos;YYYY/MM/DD&apos;) || &apos;&apos;&apos;,&apos;&apos;YYYY/MM/DD&apos;&apos;) then 1 else 0 end * 
          ((aps.amount_due_original * nvl(aps.exchange_rate,1))
            - nvl( ( select sum(ara.acctd_amount_applied_to + nvl(ara.acctd_earned_discount_taken,0) + nvl(ara.acctd_unearned_discount_taken,0))
                     from   ar_receivable_applications_all ara
                     where  ara.status                      = &apos;&apos;APP&apos;&apos;
                     and    ara.applied_customer_trx_id     = aps.customer_trx_id
                     and    ara.applied_payment_schedule_id = aps.payment_schedule_id
                     and    ara.org_id                      = aps.org_id
                     and    ara.gl_date                    &lt;= to_date(&apos;&apos;&apos; || to_char(x.end_date,&apos;YYYY/MM/DD&apos;) || &apos;&apos;&apos;,&apos;&apos;YYYY/MM/DD&apos;&apos;)
                   )
                 , 0)
            + nvl( ( select sum(ara.acctd_amount_applied_from)
                     from   ar_receivable_applications_all ara
                     where  ara.status                  = &apos;&apos;APP&apos;&apos;
                     and    ara.application_type       != &apos;&apos;CASH&apos;&apos;
                     and    rctt.type                   = &apos;&apos;CM&apos;&apos;
                     and    ara.customer_trx_id         = aps.customer_trx_id
                     and    ara.payment_schedule_id     = aps.payment_schedule_id
                     and    ara.org_id                  = aps.org_id
                     and    ara.gl_date                &lt;= to_date(&apos;&apos;&apos; || to_char(x.end_date,&apos;YYYY/MM/DD&apos;) || &apos;&apos;&apos;,&apos;&apos;YYYY/MM/DD&apos;&apos;)
                   )
                 , 0)
            + nvl( ( select sum(ara.acctd_amount)
                     from ar_adjustments_all ara
                     where ara.customer_trx_id     = aps.customer_trx_id
                     and   ara.payment_schedule_id = aps.payment_schedule_id
                     and   ara.org_id              = aps.org_id
                     and   ara.gl_date            &lt;= to_date(&apos;&apos;&apos; || to_char(x.end_date,&apos;YYYY/MM/DD&apos;) || &apos;&apos;&apos;,&apos;&apos;YYYY/MM/DD&apos;&apos;)
                   )
                 , 0)
          )
         ) inv_amt_due_p&apos; || abs(x.relative_period)
from
(
select
1-rank() over (partition by gl.name order by ((glp.period_year * 100000) + glp.period_num) desc) relative_period,
glp.period_name,
glp.period_type,
glp.end_date
from
 gl_periods glp
,gl_periods glpc
,gl_ledgers gl
where
    glpc.period_set_name=glp.period_set_name
and glpc.period_type=glp.period_type
and glp.adjustment_period_flag=&apos;N&apos;
and glpc.adjustment_period_flag=&apos;N&apos;
and trunc(:p_as_of_date) between glpc.start_date and glpc.end_date
and glp.start_date &lt;= glpc.start_date
and glpc.period_set_name = gl.period_set_name
and glpc.period_type = gl.accounted_period_type
and gl.ledger_id =
(select min(gl2.ledger_id)
 from   gl_ledgers gl2
 where  (   xxen_util.contains(:ledger,gl2.name) = &apos;Y&apos;
         or gl2.ledger_id in (select hou.set_of_books_id from hr_operating_units hou where xxen_util.contains(:operating_unit,hou.name) = &apos;Y&apos;)
        )
 and exists 
 (select null from gl_periods gp where gp.period_set_name = gl.period_set_name and gp.period_type = gl.accounted_period_type and gp.adjustment_period_flag=&apos;N&apos; and trunc(:p_as_of_date) between gp.start_date and gp.end_date)
)
) x
where
 x.relative_period between -1 * :p_periods_range and -1
order by
 x.relative_period desc</SQL_TEXT>
    <PARAMETER_TRANSLATIONS>
     <PARAMETER_TRANSLATIONS_ROW>
      <LANGUAGE>F</LANGUAGE>
      <PARAMETER_NAME>En date du</PARAMETER_NAME>
     </PARAMETER_TRANSLATIONS_ROW>
     <PARAMETER_TRANSLATIONS_ROW>
      <LANGUAGE>US</LANGUAGE>
      <PARAMETER_NAME>As of Date</PARAMETER_NAME>
     </PARAMETER_TRANSLATIONS_ROW>
    </PARAMETER_TRANSLATIONS>
   </PARAMETERS_ROW>
   <PARAMETERS_ROW>
    <SORT_ORDER>13</SORT_ORDER>
    <ANCHOR>&amp;lp_amt_due_cols3</ANCHOR>
    <SQL_TEXT>select
   &apos;    , 0 - sum(case when ara.gl_date &lt;= to_date(&apos;&apos;&apos; || to_char(x.end_date,&apos;YYYY/MM/DD&apos;) || &apos;&apos;&apos;,&apos;&apos;YYYY/MM/DD&apos;&apos;) then nvl(ara.acctd_amount_applied_from,0) else 0 end) inv_amt_due_p&apos; || abs(x.relative_period)
from
(
select
1-rank() over (partition by gl.name order by ((glp.period_year * 100000) + glp.period_num) desc) relative_period,
glp.period_name,
glp.period_type,
glp.end_date
from
 gl_periods glp
,gl_periods glpc
,gl_ledgers gl
where
    glpc.period_set_name=glp.period_set_name
and glpc.period_type=glp.period_type
and glp.adjustment_period_flag=&apos;N&apos;
and glpc.adjustment_period_flag=&apos;N&apos;
and trunc(:p_as_of_date) between glpc.start_date and glpc.end_date
and glp.start_date &lt;= glpc.start_date
and glpc.period_set_name = gl.period_set_name
and glpc.period_type = gl.accounted_period_type
and gl.ledger_id =
(select min(gl2.ledger_id)
 from   gl_ledgers gl2
 where  (   xxen_util.contains(:ledger,gl2.name) = &apos;Y&apos;
         or gl2.ledger_id in (select hou.set_of_books_id from hr_operating_units hou where xxen_util.contains(:operating_unit,hou.name) = &apos;Y&apos;)
        )
 and exists 
 (select null from gl_periods gp where gp.period_set_name = gl.period_set_name and gp.period_type = gl.accounted_period_type and gp.adjustment_period_flag=&apos;N&apos; and trunc(:p_as_of_date) between gp.start_date and gp.end_date)
)
) x
where
 x.relative_period between -1 * :p_periods_range and -1
order by
 x.relative_period desc
</SQL_TEXT>
    <PARAMETER_TRANSLATIONS>
     <PARAMETER_TRANSLATIONS_ROW>
      <LANGUAGE>F</LANGUAGE>
      <PARAMETER_NAME>En date du</PARAMETER_NAME>
     </PARAMETER_TRANSLATIONS_ROW>
     <PARAMETER_TRANSLATIONS_ROW>
      <LANGUAGE>US</LANGUAGE>
      <PARAMETER_NAME>As of Date</PARAMETER_NAME>
     </PARAMETER_TRANSLATIONS_ROW>
    </PARAMETER_TRANSLATIONS>
   </PARAMETERS_ROW>
   <PARAMETERS_ROW>
    <SORT_ORDER>14</SORT_ORDER>
    <ANCHOR>&amp;lp_amt_due_max_col</ANCHOR>
    <SQL_TEXT>select
&apos;, greatest(&apos; || listagg (&apos;sum(trx.inv_amt_due_p&apos; || abs(x.relative_period) || &apos;)&apos;,&apos;,&apos;) within group (order by abs(x.relative_period)) || &apos;) &quot;Highest AR in prior &apos; || least(:p_max_open_periods_range,:p_periods_range)  || &apos; Periods&quot;&apos;
from
(
select
1-rank() over (partition by gl.name order by ((glp.period_year * 100000) + glp.period_num) desc) relative_period,
glp.period_name,
glp.period_type,
glp.end_date
from
 gl_periods glp
,gl_periods glpc
,gl_ledgers gl
where
    glpc.period_set_name=glp.period_set_name
and glpc.period_type=glp.period_type
and glp.adjustment_period_flag=&apos;N&apos;
and glpc.adjustment_period_flag=&apos;N&apos;
and trunc(:p_as_of_date) between glpc.start_date and glpc.end_date
and glp.start_date &lt;= glpc.start_date
and glpc.period_set_name = gl.period_set_name
and glpc.period_type = gl.accounted_period_type
and gl.ledger_id =
(select min(gl2.ledger_id)
 from   gl_ledgers gl2
 where  (   xxen_util.contains(:ledger,gl2.name) = &apos;Y&apos;
         or gl2.ledger_id in (select hou.set_of_books_id from hr_operating_units hou where xxen_util.contains(:operating_unit,hou.name) = &apos;Y&apos;)
        )
 and exists 
 (select null from gl_periods gp where gp.period_set_name = gl.period_set_name and gp.period_type = gl.accounted_period_type and gp.adjustment_period_flag=&apos;N&apos; and trunc(:p_as_of_date) between gp.start_date and gp.end_date)
)
) x
where
 x.relative_period between -1 * least(:p_max_open_periods_range,:p_periods_range)  and -1
</SQL_TEXT>
    <PARAMETER_TRANSLATIONS>
     <PARAMETER_TRANSLATIONS_ROW>
      <LANGUAGE>F</LANGUAGE>
      <PARAMETER_NAME>En date du</PARAMETER_NAME>
     </PARAMETER_TRANSLATIONS_ROW>
     <PARAMETER_TRANSLATIONS_ROW>
      <LANGUAGE>US</LANGUAGE>
      <PARAMETER_NAME>As of Date</PARAMETER_NAME>
     </PARAMETER_TRANSLATIONS_ROW>
    </PARAMETER_TRANSLATIONS>
   </PARAMETERS_ROW>
   <PARAMETERS_ROW>
    <SORT_ORDER>15</SORT_ORDER>
    <ANCHOR>&amp;lp_having_clause</ANCHOR>
    <SQL_TEXT>select
&apos;having greatest(sum(abs(trx.inv_amt_due_p0)),&apos; || listagg (&apos;sum(abs(trx.inv_amt_due_p&apos; || abs(x.relative_period) || &apos;))&apos;,&apos;,&apos;) within group (order by abs(x.relative_period)) || &apos;) &gt; 0&apos;
from
(
select
1-rank() over (partition by gl.name order by ((glp.period_year * 100000) + glp.period_num) desc) relative_period,
glp.period_name,
glp.period_type,
glp.end_date
from
 gl_periods glp
,gl_periods glpc
,gl_ledgers gl
where
    glpc.period_set_name=glp.period_set_name
and glpc.period_type=glp.period_type
and glp.adjustment_period_flag=&apos;N&apos;
and glpc.adjustment_period_flag=&apos;N&apos;
and trunc(:p_as_of_date) between glpc.start_date and glpc.end_date
and glp.start_date &lt;= glpc.start_date
and glpc.period_set_name = gl.period_set_name
and glpc.period_type = gl.accounted_period_type
and gl.ledger_id =
(select min(gl2.ledger_id)
 from   gl_ledgers gl2
 where  (   xxen_util.contains(:ledger,gl2.name) = &apos;Y&apos;
         or gl2.ledger_id in (select hou.set_of_books_id from hr_operating_units hou where xxen_util.contains(:operating_unit,hou.name) = &apos;Y&apos;)
        )
 and exists 
 (select null from gl_periods gp where gp.period_set_name = gl.period_set_name and gp.period_type = gl.accounted_period_type and gp.adjustment_period_flag=&apos;N&apos; and trunc(:p_as_of_date) between gp.start_date and gp.end_date)
)
) x
where
 x.relative_period between -1 * :p_periods_range and -1


</SQL_TEXT>
    <PARAMETER_TRANSLATIONS>
     <PARAMETER_TRANSLATIONS_ROW>
      <LANGUAGE>F</LANGUAGE>
      <PARAMETER_NAME>En date du</PARAMETER_NAME>
     </PARAMETER_TRANSLATIONS_ROW>
     <PARAMETER_TRANSLATIONS_ROW>
      <LANGUAGE>US</LANGUAGE>
      <PARAMETER_NAME>As of Date</PARAMETER_NAME>
     </PARAMETER_TRANSLATIONS_ROW>
    </PARAMETER_TRANSLATIONS>
   </PARAMETERS_ROW>
   <PARAMETERS_ROW>
    <SORT_ORDER>16</SORT_ORDER>
    <DISPLAY_SEQUENCE>60</DISPLAY_SEQUENCE>
    <ANCHOR>:p_periods_range</ANCHOR>
    <PARAMETER_TYPE_DSP>Number</PARAMETER_TYPE_DSP>
    <DEFAULT_VALUE>14</DEFAULT_VALUE>
    <REQUIRED>Y</REQUIRED>
    <PARAMETER_TRANSLATIONS>
     <PARAMETER_TRANSLATIONS_ROW>
      <LANGUAGE>F</LANGUAGE>
      <PARAMETER_NAME>Retour en arrière &lt;n&gt; Périodes</PARAMETER_NAME>
     </PARAMETER_TRANSLATIONS_ROW>
     <PARAMETER_TRANSLATIONS_ROW>
      <LANGUAGE>US</LANGUAGE>
      <PARAMETER_NAME>Look Back &lt;n&gt; Periods</PARAMETER_NAME>
     </PARAMETER_TRANSLATIONS_ROW>
    </PARAMETER_TRANSLATIONS>
   </PARAMETERS_ROW>
   <PARAMETERS_ROW>
    <SORT_ORDER>17</SORT_ORDER>
    <DISPLAY_SEQUENCE>70</DISPLAY_SEQUENCE>
    <ANCHOR>:p_max_open_periods_range</ANCHOR>
    <PARAMETER_TYPE_DSP>Number</PARAMETER_TYPE_DSP>
    <DEFAULT_VALUE>12</DEFAULT_VALUE>
    <REQUIRED>Y</REQUIRED>
    <PARAMETER_TRANSLATIONS>
     <PARAMETER_TRANSLATIONS_ROW>
      <LANGUAGE>F</LANGUAGE>
      <PARAMETER_NAME>Ouverture maximale sur les &lt;n&gt; dernières périodes</PARAMETER_NAME>
     </PARAMETER_TRANSLATIONS_ROW>
     <PARAMETER_TRANSLATIONS_ROW>
      <LANGUAGE>US</LANGUAGE>
      <PARAMETER_NAME>Max Open over last &lt;n&gt; Periods</PARAMETER_NAME>
     </PARAMETER_TRANSLATIONS_ROW>
    </PARAMETER_TRANSLATIONS>
   </PARAMETERS_ROW>
   <PARAMETERS_ROW>
    <SORT_ORDER>18</SORT_ORDER>
    <DISPLAY_SEQUENCE>80</DISPLAY_SEQUENCE>
    <ANCHOR>:p_reval_currency</ANCHOR>
    <PARAMETER_TYPE_DSP>LOV</PARAMETER_TYPE_DSP>
    <LOV_NAME>Revaluation Currency</LOV_NAME>
    <LOV_GUID>E32BB68D727ACCAFE0530100007F85F2</LOV_GUID>
    <VALIDATE_FROM_LIST_DSP>Y</VALIDATE_FROM_LIST_DSP>
    <LOV_QUERY_DSP>select distinct
fcv.currency_code value,
fcv.description
from
fnd_currencies_vl fcv,
gl_daily_rates gdr
where
fcv.currency_code=gdr.to_currency and
fcv.enabled_flag=&apos;Y&apos; and
gdr.from_currency in (
select
gl.currency_code
from
gl_ledgers gl
where
gl.ledger_id in (select asp.set_of_books_id from ar_system_parameters asp) and
(:$flex$.Ledger is null or xxen_util.contains(:$flex$.Ledger,gl.name) = &apos;Y&apos;) and
(:$flex$.Operating_Unit is null or gl.ledger_id in (select hou.set_of_books_id from hr_operating_units hou where xxen_util.contains(:$flex$.Operating_unit,hou.name) = &apos;Y&apos;))
) and
gdr.conversion_date&gt;=sysdate-365
order by 1</LOV_QUERY_DSP>
    <PARAMETER_TRANSLATIONS>
     <PARAMETER_TRANSLATIONS_ROW>
      <LANGUAGE>F</LANGUAGE>
      <PARAMETER_NAME>Monnaie de réévaluation</PARAMETER_NAME>
     </PARAMETER_TRANSLATIONS_ROW>
     <PARAMETER_TRANSLATIONS_ROW>
      <LANGUAGE>US</LANGUAGE>
      <PARAMETER_NAME>Revaluation Currency</PARAMETER_NAME>
     </PARAMETER_TRANSLATIONS_ROW>
    </PARAMETER_TRANSLATIONS>
   </PARAMETERS_ROW>
   <PARAMETERS_ROW>
    <SORT_ORDER>19</SORT_ORDER>
    <ANCHOR>&amp;lp_amt_due_cols1_reval</ANCHOR>
    <SQL_TEXT>select
&apos;, sum(trx.inv_amt_due_p&apos; || abs(x.relative_period) || &apos; * trx.reval_conv_rate) &quot;&apos; || :p_reval_currency || &apos; Open Amount Acctd &apos; || to_char(x.end_date,&apos;DD/MM/YYYY&apos;) || &apos;&quot;&apos;
from
(
select
1-rank() over (partition by gl.name order by ((glp.period_year * 100000) + glp.period_num) desc) relative_period,
glp.period_name,
glp.period_type,
glp.end_date
from
 gl_periods glp
,gl_periods glpc
,gl_ledgers gl
where
        glpc.period_set_name=glp.period_set_name
and glpc.period_type=glp.period_type
and glp.adjustment_period_flag=&apos;N&apos;
and glpc.adjustment_period_flag=&apos;N&apos;
and trunc(:p_as_of_date) between glpc.start_date and glpc.end_date
and glp.start_date &lt;= glpc.start_date
and glpc.period_set_name = gl.period_set_name
and glpc.period_type = gl.accounted_period_type
and gl.ledger_id =
(select min(gl2.ledger_id)
 from   gl_ledgers gl2
 where  (   xxen_util.contains(:ledger,gl2.name) = &apos;Y&apos;
         or gl2.ledger_id in (select hou.set_of_books_id from hr_operating_units hou where xxen_util.contains(:operating_unit,hou.name) = &apos;Y&apos;)
        )
 and exists 
 (select null from gl_periods gp where gp.period_set_name = gl.period_set_name and gp.period_type = gl.accounted_period_type and gp.adjustment_period_flag=&apos;N&apos; and trunc(:p_as_of_date) between gp.start_date and gp.end_date)
)
) x
where
 x.relative_period between -1 * :p_periods_range and -1
order by
 x.relative_period desc</SQL_TEXT>
    <PARAMETER_TRANSLATIONS>
     <PARAMETER_TRANSLATIONS_ROW>
      <LANGUAGE>F</LANGUAGE>
      <PARAMETER_NAME>Monnaie de réévaluation</PARAMETER_NAME>
     </PARAMETER_TRANSLATIONS_ROW>
     <PARAMETER_TRANSLATIONS_ROW>
      <LANGUAGE>US</LANGUAGE>
      <PARAMETER_NAME>Revaluation Currency</PARAMETER_NAME>
     </PARAMETER_TRANSLATIONS_ROW>
    </PARAMETER_TRANSLATIONS>
   </PARAMETERS_ROW>
   <PARAMETERS_ROW>
    <SORT_ORDER>20</SORT_ORDER>
    <ANCHOR>&amp;lp_amt_due_max_col_reval</ANCHOR>
    <SQL_TEXT>select
&apos;, greatest(&apos; || listagg (&apos;sum(trx.inv_amt_due_p&apos; || abs(x.relative_period) || &apos; * trx.reval_conv_rate)&apos;,&apos;,&apos;) within group (order by abs(x.relative_period)) || &apos;) &apos; ||
&apos;&quot;&apos; || substrb(:p_reval_currency || &apos; Highest AR in prior &apos; || least(:p_max_open_periods_range,:p_periods_range)  || &apos; Periods&apos;,1,xxen_report.max_column_length) || &apos;&quot;&apos;
from
(
select
1-rank() over (partition by gl.name order by ((glp.period_year * 100000) + glp.period_num) desc) relative_period,
glp.period_name,
glp.period_type,
glp.end_date
from
 gl_periods glp
,gl_periods glpc
,gl_ledgers gl
where
    glpc.period_set_name=glp.period_set_name
and glpc.period_type=glp.period_type
and glp.adjustment_period_flag=&apos;N&apos;
and glpc.adjustment_period_flag=&apos;N&apos;
and trunc(:p_as_of_date) between glpc.start_date and glpc.end_date
and glp.start_date &lt;= glpc.start_date
and glpc.period_set_name = gl.period_set_name
and glpc.period_type = gl.accounted_period_type
and gl.ledger_id =
(select min(gl2.ledger_id)
 from   gl_ledgers gl2
 where  (   xxen_util.contains(:ledger,gl2.name) = &apos;Y&apos;
         or gl2.ledger_id in (select hou.set_of_books_id from hr_operating_units hou where xxen_util.contains(:operating_unit,hou.name) = &apos;Y&apos;)
        )
 and exists 
 (select null from gl_periods gp where gp.period_set_name = gl.period_set_name and gp.period_type = gl.accounted_period_type and gp.adjustment_period_flag=&apos;N&apos; and trunc(:p_as_of_date) between gp.start_date and gp.end_date)
)
) x
where
 x.relative_period between -1 * least(:p_max_open_periods_range,:p_periods_range) and -1</SQL_TEXT>
    <PARAMETER_TRANSLATIONS>
     <PARAMETER_TRANSLATIONS_ROW>
      <LANGUAGE>F</LANGUAGE>
      <PARAMETER_NAME>Monnaie de réévaluation</PARAMETER_NAME>
     </PARAMETER_TRANSLATIONS_ROW>
     <PARAMETER_TRANSLATIONS_ROW>
      <LANGUAGE>US</LANGUAGE>
      <PARAMETER_NAME>Revaluation Currency</PARAMETER_NAME>
     </PARAMETER_TRANSLATIONS_ROW>
    </PARAMETER_TRANSLATIONS>
   </PARAMETERS_ROW>
   <PARAMETERS_ROW>
    <SORT_ORDER>21</SORT_ORDER>
    <ANCHOR>&amp;lp_reval_cols</ANCHOR>
    <SQL_TEXT>select
&apos;, trx.ledger_currency revaluation_from_currency
 , :p_reval_currency revaluation_currency
 , :p_reval_conv_type revaluation_rate_type
 , nvl2(:p_reval_currency,:p_reval_conv_date,null) revaluation_date
 , trx.reval_conv_rate revaluation_rate
&apos;
from dual</SQL_TEXT>
    <PARAMETER_TRANSLATIONS>
     <PARAMETER_TRANSLATIONS_ROW>
      <LANGUAGE>F</LANGUAGE>
      <PARAMETER_NAME>Monnaie de réévaluation</PARAMETER_NAME>
     </PARAMETER_TRANSLATIONS_ROW>
     <PARAMETER_TRANSLATIONS_ROW>
      <LANGUAGE>US</LANGUAGE>
      <PARAMETER_NAME>Revaluation Currency</PARAMETER_NAME>
     </PARAMETER_TRANSLATIONS_ROW>
    </PARAMETER_TRANSLATIONS>
   </PARAMETERS_ROW>
   <PARAMETERS_ROW>
    <SORT_ORDER>22</SORT_ORDER>
    <DISPLAY_SEQUENCE>90</DISPLAY_SEQUENCE>
    <ANCHOR>:p_reval_conv_type</ANCHOR>
    <PARAMETER_TYPE_DSP>LOV</PARAMETER_TYPE_DSP>
    <LOV_NAME>Revaluation Rate Type</LOV_NAME>
    <LOV_GUID>E32BB68D727BCCAFE0530100007F85F2</LOV_GUID>
    <VALIDATE_FROM_LIST_DSP>Y</VALIDATE_FROM_LIST_DSP>
    <LOV_QUERY_DSP>select distinct
gdct.user_conversion_type value, 
gdct.description||&apos; (&apos;||count(*) over (partition by gdr.conversion_type)||&apos;)&apos; description
from
gl_daily_conversion_types gdct,
gl_daily_rates gdr
where
gdr.from_currency in (
select
gl.currency_code
from
gl_ledgers gl
where
gl.ledger_id in (select asp.set_of_books_id from ar_system_parameters asp) and
(:$flex$.Ledger is null or xxen_util.contains(:$flex$.Ledger,gl.name) = &apos;Y&apos;) and
(:$flex$.Operating_Unit is null or gl.ledger_id in (select hou.set_of_books_id from hr_operating_units hou where xxen_util.contains(:$flex$.Operating_unit,hou.name) = &apos;Y&apos;))
) and
gdr.to_currency=:$flex$.revaluation_currency and
gdr.conversion_date&gt;=sysdate-365 and
gdct.conversion_type=gdr.conversion_type
order by 1</LOV_QUERY_DSP>
    <PARAMETER_TRANSLATIONS>
     <PARAMETER_TRANSLATIONS_ROW>
      <LANGUAGE>F</LANGUAGE>
      <PARAMETER_NAME>Taux de réévaluation Type</PARAMETER_NAME>
     </PARAMETER_TRANSLATIONS_ROW>
     <PARAMETER_TRANSLATIONS_ROW>
      <LANGUAGE>US</LANGUAGE>
      <PARAMETER_NAME>Revaluation Rate Type</PARAMETER_NAME>
     </PARAMETER_TRANSLATIONS_ROW>
    </PARAMETER_TRANSLATIONS>
   </PARAMETERS_ROW>
   <PARAMETERS_ROW>
    <SORT_ORDER>23</SORT_ORDER>
    <DISPLAY_SEQUENCE>100</DISPLAY_SEQUENCE>
    <ANCHOR>:p_reval_conv_date</ANCHOR>
    <PARAMETER_TYPE_DSP>Date</PARAMETER_TYPE_DSP>
    <DEFAULT_VALUE>sysdate</DEFAULT_VALUE>
    <PARAMETER_TRANSLATIONS>
     <PARAMETER_TRANSLATIONS_ROW>
      <LANGUAGE>F</LANGUAGE>
      <PARAMETER_NAME>Date de réévaluation</PARAMETER_NAME>
     </PARAMETER_TRANSLATIONS_ROW>
     <PARAMETER_TRANSLATIONS_ROW>
      <LANGUAGE>US</LANGUAGE>
      <PARAMETER_NAME>Revaluation Date</PARAMETER_NAME>
     </PARAMETER_TRANSLATIONS_ROW>
    </PARAMETER_TRANSLATIONS>
   </PARAMETERS_ROW>
  </PARAMETERS>
  <PARAMETER_DEPENDENCIES>
   <PARAMETER_DEPENDENCIES_ROW>
    <FLEX_BIND>:$flex$.Ledger</FLEX_BIND>
    <PARAMETER_NAME>Ledger</PARAMETER_NAME>
    <DEPENDENT_PARAMETER_NAME>Revaluation Currency</DEPENDENT_PARAMETER_NAME>
   </PARAMETER_DEPENDENCIES_ROW>
   <PARAMETER_DEPENDENCIES_ROW>
    <FLEX_BIND>:$flex$.Ledger</FLEX_BIND>
    <PARAMETER_NAME>Ledger</PARAMETER_NAME>
    <DEPENDENT_PARAMETER_NAME>Revaluation Rate Type</DEPENDENT_PARAMETER_NAME>
   </PARAMETER_DEPENDENCIES_ROW>
   <PARAMETER_DEPENDENCIES_ROW>
    <FLEX_BIND>:$flex$.Look_Back_n_Periods</FLEX_BIND>
    <PARAMETER_NAME>Look Back &lt;n&gt; Periods</PARAMETER_NAME>
    <DEPENDENT_PARAMETER_NAME>Earliest As Of Date</DEPENDENT_PARAMETER_NAME>
   </PARAMETER_DEPENDENCIES_ROW>
   <PARAMETER_DEPENDENCIES_ROW>
    <FLEX_BIND>:$flex$.Operating_Unit</FLEX_BIND>
    <PARAMETER_NAME>Operating Unit</PARAMETER_NAME>
    <DEPENDENT_PARAMETER_NAME>Revaluation Currency</DEPENDENT_PARAMETER_NAME>
   </PARAMETER_DEPENDENCIES_ROW>
   <PARAMETER_DEPENDENCIES_ROW>
    <FLEX_BIND>:$flex$.Operating_Unit</FLEX_BIND>
    <PARAMETER_NAME>Operating Unit</PARAMETER_NAME>
    <DEPENDENT_PARAMETER_NAME>Revaluation Rate Type</DEPENDENT_PARAMETER_NAME>
   </PARAMETER_DEPENDENCIES_ROW>
   <PARAMETER_DEPENDENCIES_ROW>
    <FLEX_BIND>:$flex$.Operating_unit</FLEX_BIND>
    <PARAMETER_NAME>Operating Unit</PARAMETER_NAME>
    <DEPENDENT_PARAMETER_NAME>Revaluation Currency</DEPENDENT_PARAMETER_NAME>
   </PARAMETER_DEPENDENCIES_ROW>
   <PARAMETER_DEPENDENCIES_ROW>
    <FLEX_BIND>:$flex$.Operating_unit</FLEX_BIND>
    <PARAMETER_NAME>Operating Unit</PARAMETER_NAME>
    <DEPENDENT_PARAMETER_NAME>Revaluation Rate Type</DEPENDENT_PARAMETER_NAME>
   </PARAMETER_DEPENDENCIES_ROW>
   <PARAMETER_DEPENDENCIES_ROW>
    <FLEX_BIND>:$flex$.as_of_date</FLEX_BIND>
    <PARAMETER_NAME>As of Date</PARAMETER_NAME>
    <IS_DATE>Y</IS_DATE>
    <DEPENDENT_PARAMETER_NAME>Earliest As Of Date</DEPENDENT_PARAMETER_NAME>
   </PARAMETER_DEPENDENCIES_ROW>
   <PARAMETER_DEPENDENCIES_ROW>
    <FLEX_BIND>:$flex$.ledger</FLEX_BIND>
    <PARAMETER_NAME>Ledger</PARAMETER_NAME>
    <DEPENDENT_PARAMETER_NAME>Earliest As Of Date</DEPENDENT_PARAMETER_NAME>
   </PARAMETER_DEPENDENCIES_ROW>
   <PARAMETER_DEPENDENCIES_ROW>
    <FLEX_BIND>:$flex$.ledger</FLEX_BIND>
    <PARAMETER_NAME>Ledger</PARAMETER_NAME>
    <DEPENDENT_PARAMETER_NAME>Operating Unit</DEPENDENT_PARAMETER_NAME>
   </PARAMETER_DEPENDENCIES_ROW>
   <PARAMETER_DEPENDENCIES_ROW>
    <FLEX_BIND>:$flex$.operating_unit</FLEX_BIND>
    <PARAMETER_NAME>Operating Unit</PARAMETER_NAME>
    <DEPENDENT_PARAMETER_NAME>Earliest As Of Date</DEPENDENT_PARAMETER_NAME>
   </PARAMETER_DEPENDENCIES_ROW>
   <PARAMETER_DEPENDENCIES_ROW>
    <FLEX_BIND>:$flex$.revaluation_currency</FLEX_BIND>
    <PARAMETER_NAME>Revaluation Currency</PARAMETER_NAME>
    <DEPENDENT_PARAMETER_NAME>Revaluation Rate Type</DEPENDENT_PARAMETER_NAME>
   </PARAMETER_DEPENDENCIES_ROW>
  </PARAMETER_DEPENDENCIES>
  <TEMPLATES>
  </TEMPLATES>
  <DEFAULT_TEMPLATES>
  </DEFAULT_TEMPLATES>
  <UPLOAD_COLUMNS>
  </UPLOAD_COLUMNS>
  <UPLOAD_PARAMETERS>
  </UPLOAD_PARAMETERS>
  <UPLOAD_SQLS>
  </UPLOAD_SQLS>
  <UPLOAD_DEPENDENCIES>
  </UPLOAD_DEPENDENCIES>
 </REPORTS_ROW>
</REPORTS>
</ROOT>
