<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: AR Account Number -->
 <LOVS_ROW>
  <GUID>8E2FF36EDE7F79D2E0530100007F1FF2</GUID>
  <LOV_NAME>AR Account Number</LOV_NAME>
  <VALIDATE_FROM_LIST>Y</VALIDATE_FROM_LIST>
  <FILTER_BEFORE_DISPLAY>Y</FILTER_BEFORE_DISPLAY>
  <LOV_QUERY>select
hca.account_number value,
hp.party_name||&apos; (&apos;||initcap(hp.party_type)||&apos;)&apos; description
from
hz_parties hp,
hz_cust_accounts hca
where
hp.party_id=hca.party_id and
(
:$flex$.operating_unit is null or
hca.cust_account_id in (
select
hcasa.cust_account_id
from
hr_all_organization_units_vl haouv,
hz_cust_acct_sites_all hcasa
where
xxen_util.contains(:$flex$.operating_unit,haouv.name)=&apos;Y&apos; and
haouv.organization_id=hcasa.org_id
)
)
order by
hp.party_name</LOV_QUERY>
  <LOV_TRANSLATIONS>
   <LOV_TRANSLATIONS_ROW>
    <LANGUAGE>US</LANGUAGE>
   </LOV_TRANSLATIONS_ROW>
  </LOV_TRANSLATIONS>
 </LOVS_ROW>
<!-- loader xml for Enginatics Blitz Report lov: AR Customer Name -->
 <LOVS_ROW>
  <GUID>8E2FF36EDE8679D2E0530100007F1FF2</GUID>
  <LOV_NAME>AR Customer Name</LOV_NAME>
  <FILTER_BEFORE_DISPLAY>Y</FILTER_BEFORE_DISPLAY>
  <LOV_QUERY>select
hp.party_name value,
hca.account_number||&apos; (&apos;||initcap(hp.party_type)||&apos;)&apos;  description
from
hz_parties hp,
hz_cust_accounts hca
where
hp.party_id=hca.party_id and
(
:$flex$.operating_unit is null or
hca.cust_account_id in (
select
hcasa.cust_account_id
from
hr_all_organization_units_vl haouv,
hz_cust_acct_sites_all hcasa
where
xxen_util.contains(:$flex$.operating_unit,haouv.name)=&apos;Y&apos; and
haouv.organization_id=hcasa.org_id
)
)
order by
hp.party_name</LOV_QUERY>
  <LOV_TRANSLATIONS>
   <LOV_TRANSLATIONS_ROW>
    <LANGUAGE>US</LANGUAGE>
   </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: INV Item -->
 <LOVS_ROW>
  <GUID>8E2FF36EDEF179D2E0530100007F1FF2</GUID>
  <LOV_NAME>INV Item</LOV_NAME>
  <VALIDATE_FROM_LIST>Y</VALIDATE_FROM_LIST>
  <FILTER_BEFORE_DISPLAY>Y</FILTER_BEFORE_DISPLAY>
  <LOV_QUERY>select
msiv.concatenated_segments value,
msiv.description||&apos; (&apos;||mp.organization_code||&apos;)&apos; description
from
mtl_system_items_vl msiv,
mtl_parameters mp
where
(
:$flex$.organization_code is null and (
fnd_profile.value(&apos;MFG_ORGANIZATION_ID&apos;) is null and msiv.organization_id in (select oav.organization_id from org_access_view oav where oav.resp_application_id=fnd_global.resp_appl_id and oav.responsibility_id=fnd_global.resp_id) or
msiv.organization_id=fnd_profile.value(&apos;MFG_ORGANIZATION_ID&apos;)
) or
xxen_util.contains(:$flex$.organization_code,mp.organization_code)=&apos;Y&apos;
) and
msiv.organization_id=mp.organization_id
order by
mp.organization_code,
msiv.concatenated_segments</LOV_QUERY>
  <LOV_TRANSLATIONS>
   <LOV_TRANSLATIONS_ROW>
    <LANGUAGE>US</LANGUAGE>
    <DESCRIPTION>Inventory items, restricted to the accessible inventory organizations</DESCRIPTION>
   </LOV_TRANSLATIONS_ROW>
  </LOV_TRANSLATIONS>
 </LOVS_ROW>
<!-- loader xml for Enginatics Blitz Report lov: ONT Line Status -->
 <LOVS_ROW>
  <GUID>8E2FF36EDF0A79D2E0530100007F1FF2</GUID>
  <LOV_NAME>ONT Line Status</LOV_NAME>
  <VALIDATE_FROM_LIST>Y</VALIDATE_FROM_LIST>
  <LOV_QUERY>select
flvv.meaning value,
flvv.lookup_code description
from
fnd_lookup_values_vl flvv
where
flvv.lookup_type=&apos;LINE_FLOW_STATUS&apos; and
flvv.view_application_id=660 and
flvv.security_group_id=0
order by
flvv.meaning</LOV_QUERY>
  <LOV_TRANSLATIONS>
   <LOV_TRANSLATIONS_ROW>
    <LANGUAGE>US</LANGUAGE>
   </LOV_TRANSLATIONS_ROW>
  </LOV_TRANSLATIONS>
 </LOVS_ROW>
<!-- loader xml for Enginatics Blitz Report lov: ONT Line Type -->
 <LOVS_ROW>
  <GUID>8E2FF36EDEF479D2E0530100007F1FF2</GUID>
  <LOV_NAME>ONT Line Type</LOV_NAME>
  <VALIDATE_FROM_LIST>Y</VALIDATE_FROM_LIST>
  <LOV_QUERY>select
ottt.name value,
xxen_util.meaning(otta.order_category_code,&apos;ORDER_CATEGORY&apos;,660) description
from
oe_transaction_types_all otta,
oe_transaction_types_tl ottt
where
(:$flex$.operating_unit is null or otta.org_id in (select haouv.organization_id from hr_all_organization_units_vl haouv where xxen_util.contains(:$flex$.operating_unit,haouv.name)=&apos;Y&apos;)) and
otta.transaction_type_code=&apos;LINE&apos; and
otta.transaction_type_id=ottt.transaction_type_id and
ottt.language=userenv(&apos;lang&apos;)
order by
decode(otta.order_category_code,&apos;ORDER&apos;,1,&apos;MIXED&apos;,2,3),
ottt.name</LOV_QUERY>
  <LOV_TRANSLATIONS>
   <LOV_TRANSLATIONS_ROW>
    <LANGUAGE>US</LANGUAGE>
   </LOV_TRANSLATIONS_ROW>
  </LOV_TRANSLATIONS>
 </LOVS_ROW>
<!-- loader xml for Enginatics Blitz Report lov: ONT Order Number -->
 <LOVS_ROW>
  <GUID>8E2FF36EDEE779D2E0530100007F1FF2</GUID>
  <LOV_NAME>ONT Order Number</LOV_NAME>
  <VALIDATE_FROM_LIST>Y</VALIDATE_FROM_LIST>
  <FILTER_BEFORE_DISPLAY>Y</FILTER_BEFORE_DISPLAY>
  <LOV_QUERY>select
ooha.order_number value,
ottt.name||&apos;: &apos;||hca.account_name||&apos; (&apos;||xxen_util.meaning(ooha.flow_status_code,&apos;FLOW_STATUS&apos;,660)||&apos;)&apos; description
from
oe_order_headers_all ooha,
oe_transaction_types_tl ottt,
hz_cust_accounts hca
where
nvl(ooha.transaction_phase_code,&apos;F&apos;)=&apos;F&apos; and
(:$flex$.operating_unit is null or ooha.org_id=(select haouv.organization_id from hr_all_organization_units_vl haouv where xxen_util.contains(:$flex$.operating_unit,haouv.name)=&apos;Y&apos;)) and
ooha.org_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) and
ooha.sold_to_org_id=hca.cust_account_id and
ooha.order_type_id=ottt.transaction_type_id and
ottt.language=userenv(&apos;lang&apos;)
order by
ooha.order_number desc</LOV_QUERY>
  <VERSION_COMMENTS>Fixed bug in operating unit access restriction when the default operating unit is set to something else</VERSION_COMMENTS>
  <LOV_TRANSLATIONS>
   <LOV_TRANSLATIONS_ROW>
    <LANGUAGE>US</LANGUAGE>
   </LOV_TRANSLATIONS_ROW>
  </LOV_TRANSLATIONS>
 </LOVS_ROW>
<!-- loader xml for Enginatics Blitz Report lov: ONT Order Status -->
 <LOVS_ROW>
  <GUID>8E2FF36EDF0979D2E0530100007F1FF2</GUID>
  <LOV_NAME>ONT Order Status</LOV_NAME>
  <VALIDATE_FROM_LIST>Y</VALIDATE_FROM_LIST>
  <LOV_QUERY>select
flvv.meaning value,
flvv.lookup_code description
from
fnd_lookup_values_vl flvv
where
flvv.lookup_type=&apos;FLOW_STATUS&apos; and
flvv.view_application_id=660 and
flvv.security_group_id=0
order by
flvv.meaning</LOV_QUERY>
  <LOV_TRANSLATIONS>
   <LOV_TRANSLATIONS_ROW>
    <LANGUAGE>US</LANGUAGE>
   </LOV_TRANSLATIONS_ROW>
  </LOV_TRANSLATIONS>
 </LOVS_ROW>
<!-- loader xml for Enginatics Blitz Report lov: ONT Order Type -->
 <LOVS_ROW>
  <GUID>8E2FF36EDEE879D2E0530100007F1FF2</GUID>
  <LOV_NAME>ONT Order Type</LOV_NAME>
  <VALIDATE_FROM_LIST>Y</VALIDATE_FROM_LIST>
  <LOV_QUERY>select
ottt.name value,
xxen_util.meaning(otta.order_category_code,&apos;ORDER_CATEGORY&apos;,660) description
from
oe_transaction_types_all otta,
oe_transaction_types_tl ottt
where
(:$flex$.operating_unit is null or otta.org_id in (select haouv.organization_id from hr_all_organization_units_vl haouv where xxen_util.contains(:$flex$.operating_unit,haouv.name)=&apos;Y&apos;)) and
otta.transaction_type_code=&apos;ORDER&apos; and
otta.transaction_type_id=ottt.transaction_type_id and
ottt.language=userenv(&apos;lang&apos;)
order by
decode(otta.order_category_code,&apos;ORDER&apos;,1,&apos;MIXED&apos;,2,3),
ottt.name</LOV_QUERY>
  <LOV_TRANSLATIONS>
   <LOV_TRANSLATIONS_ROW>
    <LANGUAGE>US</LANGUAGE>
   </LOV_TRANSLATIONS_ROW>
  </LOV_TRANSLATIONS>
 </LOVS_ROW>
<!-- loader xml for Enginatics Blitz Report lov: ONT Quote Number -->
 <LOVS_ROW>
  <GUID>8E2FF36EDF3979D2E0530100007F1FF2</GUID>
  <LOV_NAME>ONT Quote Number</LOV_NAME>
  <VALIDATE_FROM_LIST>Y</VALIDATE_FROM_LIST>
  <FILTER_BEFORE_DISPLAY>Y</FILTER_BEFORE_DISPLAY>
  <LOV_QUERY>select
nvl(ooha.quote_number,regexp_substr(ooha.orig_sys_document_ref,&apos;^(\d+).&apos;,1,1,null,1)) value,
ottt.name||&apos;: &apos;||hca.account_name||&apos; (&apos;||xxen_util.meaning(ooha.flow_status_code,&apos;FLOW_STATUS&apos;,660)||&apos;)&apos; description
from
oe_order_headers_all ooha,
oe_transaction_types_tl ottt,
hz_cust_accounts hca
where
(ooha.quote_number is not null or ooha.orig_sys_document_ref is not null and ooha.source_document_type_id=16) and
(:$flex$.operating_unit is null or ooha.org_id=(select haouv.organization_id from hr_all_organization_units_vl haouv where xxen_util.contains(:$flex$.operating_unit,haouv.name)=&apos;Y&apos;)) and
ooha.org_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) and
ooha.sold_to_org_id=hca.cust_account_id and
ooha.order_type_id=ottt.transaction_type_id and
ottt.language=userenv(&apos;lang&apos;)
order by
ooha.order_number desc</LOV_QUERY>
  <VERSION_COMMENTS>Fixed bug in operating unit access restriction when the default operating unit is set to something else</VERSION_COMMENTS>
  <LOV_TRANSLATIONS>
   <LOV_TRANSLATIONS_ROW>
    <LANGUAGE>US</LANGUAGE>
   </LOV_TRANSLATIONS_ROW>
  </LOV_TRANSLATIONS>
 </LOVS_ROW>
</LOVS>
<REPORTS>
<!-- loader xml for Enginatics Blitz Report: Mgt: Senfor Intl - Sales Order Book - Demand Planning Analysis -->
 <REPORTS_ROW>
  <GUID>33464264788FEC38E06369FB0905D155</GUID>
  <SQL_TEXT>-- Mgt: Senfor Intl - Sales Order Book - Demand Planning Analysis

select
        x.customer &quot;Buying Group&quot;,
        x.account_number &quot;Cust. Account&quot;,
        x.operating_unit &quot;Business Unit&quot;,
        case x.channel
        when &apos;-1&apos; then &apos;Unassigned&apos;
        else x.channel
        end &quot;Market Channel&quot;,
        x.order_number &quot;Order Number&quot;,
            --x.quote_number,  --Ion removed 15dec2020
            --x.source_type,  --Ion removed 15dec2020
            --x.source_document,  --Ion removed 15dec2020
        x.type &quot;Transaction&quot;, 
        x.order_type &quot;Order Type&quot;,
        x.customer_po &quot;Customer PO&quot;,

        hp1.party_name &quot;Ship To&quot; ,
        hca1.account_number &quot;Ship To Account&quot; ,
        hcsua1.location &quot;Ship To Location&quot;,
        hps1.party_site_number &quot;Ship To Site&quot;,
            --(select hz_format_pub.format_address(hps1.location_id,null,null,&apos; , &apos;) from dual) ship_to_address,
        ftv1.territory_short_name &quot;Ship To Country&quot;,
        hp2.party_name &quot;Bill To&quot; ,
        hca2.account_number &quot;Bill To Account&quot;,
        hcsua2.location &quot;Cust. Location&quot; ,
            --(select hz_format_pub.format_address(hps2.location_id,null,null,&apos; , &apos;) from dual) bill_to_address,
        ftv2.territory_short_name &quot;Bill To Country&quot;,
        hcsua2.attribute20 &quot;Sales Region&quot;,       
        x.invoice_salesperson &quot;Sales Manager&quot;,
        x.ordered_date &quot;Order Date&quot;,
        x.Year &quot;Order Year&quot;,
        x.Month  &quot;Order Month&quot;,
 /*       (select
        (case x.ordered_date
        when sysdate then (SELECT &apos;Current&apos; FROM dual)
        else (SELECT &apos;Future&apos; FROM dual)
        end)from dual) &quot;Timeline&quot;, */
        x.price_list &quot;Price List&quot;,
        --x.salesperson &quot;Salesperson&quot;,
         --   x.invoice_salesperson,
           -- hcsua2.attribute20,
        x.order_source &quot;Order Source&quot;,
        x.order_source_reference &quot;Reference&quot;,
        x.header_status &quot;Order Status&quot;,
        x.currency &quot;Currency&quot;,
--        x.subtotal &quot;Net Order&quot;,
--        x.tax &quot;Tax&quot;,
            --nvl(x.line_charges_total,0)+nvl(x.header_charges,0) charges,
--        nvl(x.subtotal,0)+nvl(x.tax,0)+nvl(x.line_charges_total,0)+nvl(x.header_charges,0) &quot;Order Total&quot;,
        x.payment_terms &quot;Payment Terms&quot;,
 
        x.warehouse &quot;Warehouse&quot;,
            --x.ship_method,
            --x.line_set,
            --x.freight_terms,
            --x.fob,
            --x.shipment_priority,
            --x.shipping_instructions,
            --x.packing_instructions,
            --x.payment_type,
        x.line &quot;Line&quot;,
        x.line_type &quot;Line Type&quot;,
        x.line_status &quot;Line Status&quot;,   -- Ion added 14dec2020
        x.item &quot;Product&quot;,
        x.description &quot;Description&quot;,
       nvl(x.class, &apos; &apos;) &quot;Sales Class&quot;,
      nvl(x.inventory_category, &apos; &apos;) &quot;Product Group&quot;,
        x.item_type,
x.cust_item,

        x.uom  &quot;UOM&quot;,

        x.list_price &quot;List Price&quot;,
        x.discount &quot;Discount&quot;,

        x.discounted_price &quot;Discounted List Price&quot;,
        
        (nvl(Case x.currency
        When &apos;EUR&apos; then x.discounted_price
        Else 
         Round(x.discounted_price * (select gdr.conversion_rate
         from   apps.gl_daily_rates gdr
         where  1=1
         and    gdr.conversion_type = &apos;Corporate&apos;
         and    gdr.from_currency = x.currency            -- Replace with Order Currency
         and    gdr.to_currency = &apos;EUR&apos;              -- Always EUR
         and    gdr.conversion_date = trunc(x.ordered_date)     -- Replace with Order Date 
         ),2)
         end,0) ) &quot;EUR Disc. List Price&quot;,
        
        x.surcharge &quot;Core Price&quot;,
        x.unit_selling_price &quot;Unit Price&quot;,
        x.quantity &quot;Qty Ordered&quot;,
        --nvl(x.quantity,0)*nvl(x.list_price - (x.list_price*x.discount/100),0) &quot;Total Rebuild Value&quot;,
        nvl(x.quantity*x.discounted_price,0) &quot;Total Rebuild Value&quot;,
        nvl(Case x.currency
        When &apos;EUR&apos; then nvl(x.quantity,0)*nvl(x.list_price - (x.list_price*x.discount/100),0)
        Else 
         Round((nvl(x.quantity,0)*nvl(x.list_price - (x.list_price*x.discount/100),0) * (select gdr.conversion_rate
         from   apps.gl_daily_rates gdr
         where  1=1
         and    gdr.conversion_type = &apos;Corporate&apos;
         and    gdr.from_currency = x.currency            -- Replace with Order Currency
         and    gdr.to_currency = &apos;EUR&apos;              -- Always EUR
         and    gdr.conversion_date = trunc(x.ordered_date)     -- Replace with Order Date 
         )),2)
         end,0) &quot;EUR Book Revenue&quot;,
        
        nvl((x.surcharge*x.quantity),0) &quot;Total Core Value&quot;,
        nvl(x.qty_shipped,0) &quot;Qty Shipped&quot;,          --ION 22dec To add total qty shipped
       /*
        (nvl(Case x.currency
        When &apos;EUR&apos; then x.discounted_price*x.qty_shipped
        Else 
         Round(x.discounted_price * (select gdr.conversion_rate
         from   apps.gl_daily_rates gdr
         where  1=1
         and    gdr.conversion_type = &apos;Corporate&apos;
         and    gdr.from_currency = x.currency            -- Replace with Order Currency
         and    gdr.to_currency = &apos;EUR&apos;              -- Always EUR
         and    gdr.conversion_date = trunc(x.ordered_date)     -- Replace with Order Date 
         ),2)
         end,0) * x.qty_shipped) &quot;EUR Shipped Revenue&quot;,*/
         
        (nvl(Case x.currency
        When &apos;EUR&apos; then x.discounted_price
        Else 
         Round(x.discounted_price * (select gdr.conversion_rate
         from   apps.gl_daily_rates gdr
         where  1=1
         and    gdr.conversion_type = &apos;Corporate&apos;
         and    gdr.from_currency = x.currency            -- Replace with Order Currency
         and    gdr.to_currency = &apos;EUR&apos;              -- Always EUR
         and    gdr.conversion_date = trunc(x.ordered_date)     -- Replace with Order Date 
         ),2)
         end,0))*x.qty_shipped  &quot;EUR Shipped Revenue&quot;, 
        
        nvl(x.quantity,0)-nvl(qty_shipped,0) &quot;Open Qty&quot;,
        nvl(x.qty_invoiced,0) &quot;Invoiced Qty&quot;,
        nvl(x.extended_amount,0) &quot;Invoice Amount&quot;,                                  


        nvl(Case x.currency
        When &apos;EUR&apos; then x.revenue_amount
        Else 
         Round(x.revenue_amount * (select gdr.conversion_rate
         from   apps.gl_daily_rates gdr
         where  1=1
         and    gdr.conversion_type = &apos;Corporate&apos;
         and    gdr.from_currency = x.currency            -- Replace with Order Currency
         and    gdr.to_currency = &apos;EUR&apos;              -- Always EUR
         and    gdr.conversion_date = trunc(x.ordered_date)     -- Replace with Order Date 
         ),2)
         end,0)  &quot;EUR Invoiced Revenue&quot;,
        
         
       -- nvl(x.reserved,0) &quot;Qty Reserved&quot;,
            --x.line_charges, ION 15dec
        nvl(x.tax_code, &apos; &apos;) &quot;Tax Code&quot;,
        x.tax_amount &quot;Tax&quot;,
            --x.calculate_price_flag,
        x.pricing_quantity &quot;Pricing Qty&quot;,
        x.pricing_uom &quot;Pricing UOM&quot;,
        x.pricing_date &quot;Pricing Date&quot;,
        x.request_date &quot;Requested Date&quot;,
        x.request_year &quot;Requested Year&quot;,
        x.request_month &quot;Requested Month&quot;,
        x.promise_date &quot;Date Promised&quot;,
        x.schedule_ship_date &quot;Scheduled Date&quot;
        ,
 /*       (select
        (case x.actual_shipment_date
        when (to_char(x.actual_shipment_date, &apos;DD/MM/YYYY&apos; &gt; sysdate )
        then (SELECT &apos;Current&apos; FROM dual)
        else (SELECT &apos;Future&apos; FROM dual)
        end)from dual) &quot;Timeline&quot;,*/
        
            nvl(to_char(x.actual_shipment_date), &apos; &apos;) &quot;Date Shipped&quot;, --ION15dec
            nvl(to_char(x.ship_year), &apos; &apos;) &quot;Shipped Year&quot;,
            nvl(to_char(x.ship_month), &apos; &apos;) &quot;Shipped Month&quot;,
--        x.qty_shipped,
            --x.shipment_priority,
            --x.shippable_flag,
            --x.ship_set, --ION15dec
            nvl(to_char(x.delivery), &apos; &apos;) &quot;Delivery&quot;, 
            
            nvl(to_char(x.invoice_number), &apos; &apos;) &quot;Invoice no.&quot;,
            nvl(to_char(x.invoice_date), &apos; &apos;) &quot;Invoice Date&quot;,
            nvl(to_char(x.inv_year), &apos; &apos;) &quot;Invoice Year&quot;,
            nvl(to_char(x.inv_month), &apos; &apos;) &quot;Invoice Month&quot;,
            --x.invoice_status,
            nvl(to_char(x.invoice_line), &apos; &apos;) &quot;Invoice_Line&quot;         
            
            
            
            --x.project,
            --x.task,
            --x.created_by,
            --x.creation_date,
            --x.last_updated_by,
            --x.last_update_date,
            --x.order_category,
            --x.line_category
            --,
--,        x.header_id, --36224
--        x.line_id  --345244
--        x.line_number
from
        (
            select
                    hp.party_name customer,
                    hca.account_number,
                    ooha.order_number,
                    haouv.name operating_unit,

                        --ION Delete
                        --nvl(ooha.quote_number,regexp_substr(ooha.orig_sys_document_ref,&apos;^(\d+).&apos;,1,1,null,1)) quote_number,
                        --decode(ooha.source_document_type_id,10,&apos;Requisitions&apos;,2,&apos;Orders&apos;,16,&apos;Quotes&apos;,7,&apos;Incidents&apos;,(select oos0.name from apps.oe_order_sources oos0 where ooha.source_document_type_id=oos0.order_source_id)) source_type,
                        --case ooha.source_document_type_id
                        --when 10 then (select prha.segment1 from apps.po_requisition_headers_all prha where ooha.source_document_id=prha.requisition_header_id)
                        --when 2 then (select to_char(ooha0.order_number) from apps.oe_order_headers_all ooha0 where ooha.source_document_id=ooha0.header_id)
                        --when 16 then (select aqha.quote_number||&apos;:&apos;||aqha.quote_version from apps.aso_quote_headers_all aqha where ooha.source_document_id=aqha.quote_header_id)
                        --when 7 then (select ciab.incident_number from apps.cs_incidents_all_b ciab where ooha.source_document_id=ciab.incident_id)
                        --end source_document, ----Ion removed 14dec2020

                    decode(ooha.transaction_phase_code,&apos;N&apos;,&apos;Quote&apos;,&apos;Order&apos;) type,
                    ottt.name order_type,
                    nvl(oola.cust_po_number,ooha.cust_po_number) customer_po,
                        --xxen_util.client_time(ooha.ordered_date) ordered_date,
                    ooha.sales_channel_code channel,
                    ooha.ordered_date ordered_date,
                    Extract(month from ooha.ordered_date) Month,
                    Extract(year from ooha.ordered_date) Year,

                    (select qlhv.name 
                     from apps.qp_list_headers_vl qlhv 
                     where ooha.price_list_id=qlhv.list_header_id) price_list,

                    --jrrev.resource_name salesperson,
                        jrrev2.resource_name invoice_salesperson,--Ion removed 14dec2020
                    oos.name order_source,
                    ooha.orig_sys_document_ref order_source_reference,
                        --xxen_util.meaning(ooha.flow_status_code,&apos;FLOW_STATUS&apos;,660) header_status,
                    ooha.flow_status_code as header_status, -- Ion added 14dec2020
                    ooha.transactional_curr_code currency,

--                    sum(decode(oola.cancelled_flag,&apos;N&apos;,oola.extended_price)) over (partition by oola.header_id) subtotal,

--                    sum(decode(oola.cancelled_flag,&apos;N&apos;,oola.tax_amount)) over (partition by oola.header_id) tax,

                    sum(decode(oola.cancelled_flag,&apos;N&apos;,oola.line_charges)) over (partition by oola.header_id) line_charges_total,

                    (select nvl(sum(decode(opa.credit_or_charge_flag,&apos;C&apos;,-1,1)*opa.operand),0) 
                     from apps.oe_price_adjustments opa 
                     where ooha.header_id=opa.header_id 
                     and oola.line_id = opa.line_id 
                     and opa.list_line_type_code=&apos;SUR&apos; 
                     and opa.applied_flag=&apos;Y&apos;) Surcharge,

                    (select nvl(sum(decode(opa.credit_or_charge_flag,&apos;C&apos;,-1,1)*opa.operand),0) 
                     from apps.oe_price_adjustments opa 
                     where ooha.header_id=opa.header_id 
                     and oola.line_id = opa.line_id 
                     and opa.list_line_type_code=&apos;DIS&apos; 
                     and opa.applied_flag=&apos;Y&apos;
                     and opa.arithmetic_operator = &apos;%&apos;) Discount,

                    (select decode(opa.credit_or_charge_flag,&apos;C&apos;,-1,1)*opa.operand 
                     from apps.oe_price_adjustments opa 
                     where ooha.header_id=opa.header_id 
                     and opa.line_id is null 
                     and opa.list_line_type_code=&apos;FREIGHT_CHARGE&apos; 
                     and opa.applied_flag=&apos;Y&apos;) header_charges,

-- To calculate discounted price

                nvl(
                (select sum(decode(opa.credit_or_charge_flag,&apos;C&apos;,-1,1)*opa.operand) 
                 from apps.oe_price_adjustments opa 
                 where oola.line_id=opa.line_id 
                 and opa.arithmetic_operator=&apos;NEWPRICE&apos; 
                 and opa.list_line_type_code=&apos;DIS&apos; 
                 and opa.applied_flag=&apos;Y&apos;), --new price
                oola.unit_list_price-
                nvl(oola.unit_list_price*(select sum(decode(opa.credit_or_charge_flag,&apos;C&apos;,-1,1)*opa.operand)/100 
                                      from apps.oe_price_adjustments opa 
                                      where oola.line_id=opa.line_id 
                                      and opa.arithmetic_operator=&apos;%&apos; 
                                      and opa.list_line_type_code=&apos;DIS&apos; 
                                      and opa.applied_flag=&apos;Y&apos;),0)- --percentage discount
                nvl((select sum(decode(opa.credit_or_charge_flag,&apos;C&apos;,-1,1)*opa.operand) 
                 from apps.oe_price_adjustments opa 
                 where oola.line_id=opa.line_id 
                 and opa.arithmetic_operator=&apos;AMT&apos; 
                 and opa.list_line_type_code=&apos;DIS&apos; 
                 and opa.applied_flag=&apos;Y&apos;),0) --absolute amount discount
                 ) discounted_price,   
     
     
/*from
apps.oe_order_lines_all oola
where
oola.line_id in (select opa.line_id 
                 from apps.oe_price_adjustments opa 
                 where opa.arithmetic_operator=&apos;NEWPRICE&apos; 
                 and opa.list_line_type_code=&apos;DIS&apos; 
                 and opa.applied_flag=&apos;Y&apos;)) discounted_price,*/




                    (select rtv.name 
                     from apps.ra_terms_vl rtv 
                     where nvl(oola.payment_term_id,ooha.payment_term_id)=rtv.term_id) payment_terms,

/* Invoice Details */
                        rcta.trx_number invoice_number, 
                        rcta.trx_date invoice_date,
                        Extract(month from rcta.trx_date) inv_month,
                        Extract(year from rcta.trx_date) inv_year,
                        rctla.reason_code,
                        --xxen_util.meaning(rcta.status_trx,&apos;PAYMENT_SCHEDULE_STATUS&apos;,222) invoice_status,
                        decode(rctla.line_type,&apos;FREIGHT&apos;,null,rctla.line_number) invoice_line,
                        rctla.extended_amount,                                                                              --Ion--
                        rctla.revenue_amount, 

                    (select mp.organization_code 
                     from apps.mtl_parameters mp 
                     where nvl(oola.ship_from_org_id,ooha.ship_from_org_id)=mp.organization_id) warehouse,

                        --xxen_util.meaning(nvl(oola.shipping_method_code,ooha.shipping_method_code),&apos;SHIP_METHOD&apos;,3) ship_method,
                        --xxen_util.meaning(ooha.customer_preference_set_code,&apos;REQUEST_DATE_TYPE&apos;,660) line_set,
                        --xxen_util.meaning(nvl(oola.freight_terms_code,ooha.freight_terms_code),&apos;FREIGHT_TERMS&apos;,660) freight_terms,
                        --xxen_util.meaning(nvl(oola.fob_point_code,ooha.fob_point_code),&apos;FOB&apos;,222) fob,
                        --xxen_util.meaning(nvl(oola.shipment_priority_code,ooha.shipment_priority_code),&apos;SHIPMENT_PRIORITY&apos;,660) shipment_priority,
                        --nvl(oola.shipping_instructions,ooha.shipping_instructions) shipping_instructions,
                        --nvl(oola.packing_instructions,ooha.packing_instructions) packing_instructions,
                        --xxen_util.meaning(nvl(oola.payment_type_code,ooha.payment_type_code),&apos;PAYMENT TYPE&apos;,660) payment_type,

                    rtrim(oola.line_number||&apos;.&apos;||oola.shipment_number||&apos;.&apos;||oola.option_number||&apos;.&apos;||oola.component_number||&apos;.&apos;||oola.service_number,&apos;.&apos;) line,
                    ottt2.name line_type,
                        --xxen_util.meaning(oola.flow_status_code,&apos;LINE_FLOW_STATUS&apos;,660) line_status,
                    oola.flow_status_code as line_status,   -- Ion added 14dec2020



                    (SELECT distinct         
                        mc.CONCATENATED_SEGMENTS
                        FROM 
                        apps.mtl_item_categories mic,        
                        apps.mtl_category_sets_tl mcst,        
                        apps.mtl_category_sets_b mcs,              
                        apps.mtl_categories_b_kfv mc,        
                        apps.mtl_system_items_b msiv  
                        WHERE mic.category_set_id = mcs.category_set_id    
                        AND mcs.category_set_id = mcst.category_set_id    
                        AND mcst.LANGUAGE = USERENV (&apos;LANG&apos;)    
                        AND mic.category_id = mc.category_id    
                        AND msiv.organization_id = oola.ship_from_org_id       
                        AND msiv.organization_id = mic.organization_id    
                        AND msiv.inventory_item_id = mic.inventory_item_id    
                        and msiv.segment1 = oola.ordered_item
                        and mcst.category_set_name=&apos;Inv.Items&apos;) Class,
--&apos;Planning-Product Group&apos;) planning_category,

(SELECT distinct         
                        mc1.CONCATENATED_SEGMENTS
                        FROM 
                        apps.mtl_item_categories mic1,        
                        apps.mtl_category_sets_tl mcst1,        
                        apps.mtl_category_sets_b mcs1,              
                        apps.mtl_categories_b_kfv mc1,        
                        apps.mtl_system_items_b msiv1  
                        WHERE mic1.category_set_id = mcs1.category_set_id    
                        AND mcs1.category_set_id = mcst1.category_set_id    
                        AND mcst1.LANGUAGE = USERENV (&apos;LANG&apos;)    
                        AND mic1.category_id = mc1.category_id    
                        AND msiv1.organization_id = oola.ship_from_org_id       
                        AND msiv1.organization_id = mic1.organization_id    
                        AND msiv1.inventory_item_id = mic1.inventory_item_id    
                        and msiv1.segment1 = oola.ordered_item
                        and mcst1.category_set_name=&apos;Purchasing&apos;) inventory_category,

                    msiv.concatenated_segments item,
                    msiv.description,
                    oola.item_type_code item_type,
                        --xxen_util.meaning(oola.item_type_code,&apos;ITEM_TYPE&apos;,660) item_type,
                    oola.ordered_quantity quantity,
                    oola.order_quantity_uom uom,
                    oola.unit_selling_price,
                    oola.extended_price,
                    oola.unit_list_price list_price,
                        --oola.line_charges, --ION 15dec
                   -- (oola.ordered_quantity-sum(oola.shipped_quantity) over (partition by ooha.order_number, oola.line_number, oola.shipment_number)) open_qty,          --ION 22dec To add total qty shipped
                    oola.tax_code,
                    oola.tax_amount,
                        --xxen_util.meaning(oola.calculate_price_flag,&apos;CALCULATE_PRICE_FLAG&apos;,660) calculate_price_flag,
                    oola.pricing_quantity,

/* --ION Need to add reservations */
/*
(select distinct
sum(mr.primary_reservation_quantity) over (partition by mr.inventory_item_id, mr.organization_id, mr.demand_source_line_id) 
--mr.inventory_item_id,
--mr.organization_id,
--mr.subinventory_code
from
apps.mtl_reservations mr
where 
mr.organization_id = nvl(oola.ship_from_org_id,ooha.ship_from_org_id)
and mr.inventory_item_id = oola.inventory_item_id
and mr.demand_source_line_id = oola.line_id
and mr.subinventory_code = (select distinct mp.organization_code 
                     from apps.mtl_parameters mp 
                     where nvl(oola.ship_from_org_id,ooha.ship_from_org_id)=mp.organization_id)
) reserved,
*/

                    oola.pricing_quantity_uom pricing_uom,
                    oola.pricing_date,
                        --xxen_util.client_time(
                    oola.request_date request_date,
                    Extract(month from oola.request_date) request_month,
                    Extract(year from oola.request_date) request_year,
                        --xxen_util.client_time(
                    oola.promise_date promise_date,
                        --xxen_util.client_time(
                    oola.schedule_ship_date schedule_ship_date,
                        --xxen_util.client_time(
                        oola.actual_shipment_date actual_shipment_date, --ION15dec
                        Extract(month from oola.actual_shipment_date) ship_month,
                        Extract(year from oola.actual_shipment_date) ship_year,
                    sum(oola.shipped_quantity) over (partition by ooha.order_number, oola.line_number, oola.shipment_number) qty_shipped, --ION 22dec To add total qty shipped
                    
                    sum(oola.invoiced_quantity) over (partition by ooha.order_number, oola.line_number, oola.shipment_number) qty_invoiced, --ION 4feb To add total qty invoiced
                        --xxen_util.meaning(decode(oola.shippable_flag,&apos;Y&apos;,&apos;Y&apos;),&apos;YES_NO&apos;,0) shippable_flag,

/* Get delivery Details*/
                        --(select distinct listagg(os.set_name,&apos;, &apos;) --ION15dec
                        -- within group (order by os.set_name) over (partition by oola.line_id) set_name ION 15dec
                        -- from apps.oe_sets os where oola.ship_set_id=os.set_id) ship_set, wnd.name delivery, ION15dec
                        wda.delivery_id delivery,

/* Get project details */
                        --ppa.project_number project,
                        --pt.task_number task,
                        --xxen_util.user_name(oola.created_by) created_by,
                        --xxen_util.client_time(oola.creation_date) creation_date,
                        --xxen_util.user_name(oola.last_updated_by) last_updated_by,
                        --xxen_util.client_time(oola.last_update_date) last_update_date,
                        --xxen_util.meaning(ooha.order_category_code,&apos;ORDER_CATEGORY&apos;,660) order_category,
                        --xxen_util.meaning(oola.line_category_code,&apos;ORDER_CATEGORY&apos;,660) line_category,
                    --ooha.attribute1,
                    ooha.header_id,
                    oola.line_number,
                    oola.shipment_number,
                    oola.option_number,
                    oola.component_number,
                    oola.service_number,
                    oola.line_id,
                    nvl(oola.ship_to_org_id,ooha.ship_to_org_id) ship_to_org_id,
                    nvl(oola.invoice_to_org_id,ooha.invoice_to_org_id) invoice_to_org_id,
                    
                    (select  
       --oola1.ordered_item as Remy_item,
oola2.ordered_item --as Customer_item
from --apps.oe_order_lines_all oola1,
        apps.oe_order_lines_all oola2,
        apps.mtl_system_items_vl msiv
       where 1=1
--and ooha.org_id = oola1.org_id
--and ooha.header_id = oola1.header_id
--and ooha.org_id = oola1.org_id
--and ooha.header_id = oola1.header_id
AND oola.top_model_line_id = oola2.line_id(+)
AND oola.inventory_item_id = msiv.inventory_item_id 
AND oola.ship_from_org_id = msiv.organization_id
) cust_item
                    
            from
                    apps.hr_all_organization_units_vl haouv,
                    apps.oe_order_headers_all ooha,
                (
                        select
                                decode(oola.line_category_code,&apos;RETURN&apos;,-1,1)*oola.unit_selling_price*oola.ordered_quantity extended_price,
                                decode(oola.line_category_code,&apos;RETURN&apos;,-1,1)*oola.tax_value tax_amount,
                        (
                            select
                                    sum(decode(opa.credit_or_charge_flag,&apos;C&apos;,-1,1)*decode(opa.arithmetic_operator,&apos;LUMPSUM&apos;,
                                    case when oola.ordered_quantity&gt;0 then opa.operand end,oola.ordered_quantity*opa.adjusted_amount)) line_charges
                            from
                                    apps.oe_price_adjustments opa
                            where
                                    oola.item_type_code != &apos;INCLUDED&apos; 
                            and                       --Ion Exclude Included items
                                    oola.line_id=opa.line_id 
                            and
                                    opa.list_line_type_code=&apos;FREIGHT_CHARGE&apos; 
                            and
                                    opa.applied_flag=&apos;Y&apos;
                                                            ) line_charges,
                                max(oola.open_flag) over (partition by oola.header_id) max_open_flag,
                                oola.*
                        from
                                apps.oe_order_lines_all oola
                                                    ) oola,
                    apps.oe_transaction_types_tl ottt,
                    apps.oe_transaction_types_tl ottt2,
                    apps.mtl_system_items_vl msiv,
                    apps.hz_cust_accounts hca,
                    apps.hz_parties hp,
                    apps.oe_order_sources oos,
                    --apps.jtf_rs_salesreps jrs,
                    apps.jtf_rs_salesreps jrs2,
                    --apps.jtf_rs_resource_extns_vl jrrev,
                    apps.jtf_rs_resource_extns_vl jrrev2,
                        (
                        select distinct
                        wdd.source_line_id,
                        min(wda.delivery_id) over (partition by wdd.source_line_id, wda.delivery_id) delivery_id
                        from
                        apps.wsh_delivery_details wdd,
                        apps.wsh_delivery_assignments wda
                        where
                        wdd.source_code=&apos;OE&apos; and
                        wdd.delivery_detail_id=wda.delivery_detail_id
                        ) wda,
                    apps.wsh_new_deliveries wnd,
      --              apps.wsh_delivery_details wdd,
      --              apps.wsh_delivery_assignments wda,
                    --(
                    --select ppa.project_id, ppa.segment1 project_number from apps.pa_projects_all ppa union
                    --select psm.project_id, psm.project_number from apps.pjm_seiban_numbers psm
                    --) ppa,
                    --&amp;xrrpv_table
                    --apps.pa_tasks pt,
            apps.ra_customer_trx_lines_all rctla,
            apps.ra_customer_trx_all rcta
        where
                2=2 
        and oola.item_type_code != &apos;INCLUDED&apos;  --Ion    to exclude INCLUDED items
        and haouv.organization_id=ooha.org_id 
        and ooha.sold_to_org_id=hca.cust_account_id(+) 
        and hca.party_id=hp.party_id(+) 
        and ooha.order_type_id=ottt.transaction_type_id(+) 
        and ottt.language(+)=userenv(&apos;lang&apos;) 
        and ooha.order_source_id=oos.order_source_id(+) 
        and ooha.header_id=oola.header_id(+) 
        and oola.line_type_id=ottt2.transaction_type_id(+) 
        and ottt2.language(+)=userenv(&apos;lang&apos;) 
        and oola.inventory_item_id=msiv.inventory_item_id(+) 
        and oola.ship_from_org_id=msiv.organization_id(+) 
        and ooha.salesrep_id=jrs2.salesrep_id 
        and ooha.org_id=jrs2.org_id 
        and jrs2.resource_id=jrrev2.resource_id(+) 
        and oola.line_id=wda.source_line_id(+) 
        and wda.delivery_id=wnd.delivery_id(+)
       -- and wda.delivery_detail_id = wdd.delivery_detail_id(+)
       -- and wdd.organization_id = oola.ship_from_org_id
        and ooha.transaction_phase_code = &apos;F&apos; --and  orders only, no quotes
/*        and ottt.name in   (&apos;CBL INVOICING - RMY BE&apos;,
                            &apos;EXPRESS - RMY BE&apos;,
                            &apos;EXPRESS - RMY UK&apos;,
                            &apos;REBILL-CREDIT - RMY BE&apos;,
                            &apos;REBILL-CREDIT - RMY UK&apos;,
                            &apos;STANDARD - RMY BE&apos;,
                            &apos;STANDARD - RMY HU&apos;,
                            &apos;STANDARD - RMY UK&apos;,
                            &apos;WARRANTY- no rcpt RMY BE&apos;,
                            &apos;WARRANTY- no rcpt RMY UK&apos;,
                            &apos;WARRANTY- with rcpt RMY BE&apos;,
                            &apos;WARRANTY- with rcpt RMY UK&apos;)  --Order Type
*/                            
        and ooha.flow_status_code not in (&apos;CANCELLED&apos;, &apos;ENTERED&apos;) --Order Status
/*        and ottt2.name not in  (&apos;BILL &amp;  AUTO INVENTORY-RMY BE&apos;, --Line Type
                                &apos;CORE CREDIT ONLY - RMY BE&apos;, 
                                &apos;CORE CREDIT ONLY - RMY UK&apos;, 
                                &apos;CORE CREDIT ONLY - RMY HU&apos;,
                                &apos;SHIP ONLY-RMY UK&apos;) 
*/
        and oola.flow_status_code not in (&apos;CANCELLED&apos;, &apos;ENTERED&apos;) --Line Status
        --and ottt2.name not in (&apos;CORE CREDIT ONLY - RMY BE&apos;, &apos;CREDIT ONLY - RMY BE&apos;, &apos;CREDIT ONLY - RMY UK&apos;, &apos;RETURN - RMY BE&apos;, &apos;RETURN - RMY UK&apos;)

                --oola.project_id=ppa.project_id(+) and
                --oola.task_id=pt.task_id(+) 
        and to_char(oola.line_id)=rctla.interface_line_attribute6(+) 
        and rctla.interface_line_context(+) in (&apos;ORDER ENTRY&apos;) 
        and rctla.customer_trx_id=rcta.customer_trx_id(+) 
        and rcta.primary_salesrep_id=jrs2.salesrep_id(+) 
        and rcta.org_id=jrs2.org_id(+) 
        and rctla.attribute3 is null
        and (interface_line_attribute5 =0 or interface_line_attribute5 is null)
        --and rctla.reason_code &lt;&gt; &apos;BONUS&apos;
        --and jrs2.resource_id=jrrev2.resource_id(+) 
                --and rcta.trx_number = &apos;8482000984&apos; --Ion--
--        and ooha.order_number in(41005014, 41005262, 41009387)
        --41002399 
        --41002148
        --, 41003357
        --and trunc(ooha.ordered_date) = trunc(sysdate,&apos;month&apos;)
       ) x,
    apps.hz_cust_site_uses_all hcsua1,
    apps.hz_cust_site_uses_all hcsua2,
    apps.hz_cust_acct_sites_all hcasa1,
    apps.hz_cust_acct_sites_all hcasa2,
    apps.hz_cust_accounts hca1,
    apps.hz_cust_accounts hca2,
    apps.hz_parties hp1,
    apps.hz_parties hp2,
    apps.hz_party_sites hps1,
    apps.hz_party_sites hps2,
    apps.hz_locations hl1,
    apps.hz_locations hl2,
    apps.fnd_territories_vl ftv1,
    apps.fnd_territories_vl ftv2
where
    1=1
and x.ship_to_org_id=hcsua1.site_use_id(+) 
and x.invoice_to_org_id=hcsua2.site_use_id(+) 
and hcsua1.cust_acct_site_id=hcasa1.cust_acct_site_id(+) 
and hcsua2.cust_acct_site_id=hcasa2.cust_acct_site_id(+) 
and hcasa1.cust_account_id=hca1.cust_account_id(+) 
and hcasa2.cust_account_id=hca2.cust_account_id(+) 
and hca1.party_id=hp1.party_id(+) 
and hca2.party_id=hp2.party_id(+) 
and hcasa1.party_site_id=hps1.party_site_id(+) 
and hcasa2.party_site_id=hps2.party_site_id(+) 
and hps1.location_id=hl1.location_id(+) 
and hps2.location_id=hl2.location_id(+) 
and hl1.country=ftv1.territory_code(+) 
and hl2.country=ftv2.territory_code(+)

order by
    x.operating_unit,
    x.ordered_date,
    x.account_number,
    x.order_number,
    x.line_number,
    x.shipment_number,
    nvl(x.option_number,-1),
    nvl(x.component_number,-1),
    nvl(x.service_number,-1)</SQL_TEXT>
  <ENABLED>Y</ENABLED>
  <NUMBER_FORMAT>#,##0.00;[Red]-#,##0.00</NUMBER_FORMAT>
  <COPIED_FROM_GUID>B8B2F4B3E08120E2E05347D8A10ADA58</COPIED_FROM_GUID>
  <REPORT_TRANSLATIONS>
   <REPORT_TRANSLATIONS_ROW>
    <LANGUAGE>US</LANGUAGE>
    <REPORT_NAME>Mgt: Senfor Intl - Sales Order Book - Demand Planning Analysis</REPORT_NAME>
    <DESCRIPTION>This report extracts details of Sales Orders and Lines according to the parameters entered.
Kit items with an item type of &quot;INCLUDED&quot; are excluded.

Pivot tables and templates can be added to produce Analysis dashboards. This example contains a pivot table by Business Unit and Customer with a dashboard configued. Data fields, parameters and other templates may be added or removed according to requirements. Please contact the author, iyilmaz@senfor-intl.eu, if you require assistance.

Version    Modified on    Modified  by     Description 
=====   ========   == ======  ======== 
  1.0         15 Dec 2020   Ion Yılmaz        Initial Release
  1.1 	  24 Jul   2021   Ion Yilmaz	     Added the SFG number for planning.
  1.2 	  18 Aug 2021   Ion Yilmaz 	     Changed logic for finding the SFG and the item categories to look for Kits and PTO items.
  1.3 	  25 Aug.2021   Ion Yilmaz 	     Added Demand Class, Product Family and Product Class plus Order date parameters
  1.4 	  18 Nov 2021   Ion Yılmaz        Added restriction &quot;and rctla.warehouse_id is not null&quot; to x in order that duplicate lines are not created by credits and rebills.
  1.5 	    7 Jul   2024   Ion Yılmaz 	     Released program for general use.

Copyright 2020 Senfor International Yönetim Danışmanlık Hizmetleri Ltd. Şti.

Original Author: İon Yılmaz (iyilmaz@senfor-intl.com.tr) Senfor International, www.senfor-intl.eu                        
All rights reserved. Permission to use this code is granted provided the original author is acknowledged.  

This code is made available on an &quot;As-Is&quot; basis and may require modification depending upon the configuration of the system it is being used on.

The author does not assume or hereby disclaim any liability to any party for any loss, damage, or disruption caused by errors or omissions, whether such errors or omissions result from negligence, accident, or any other cause.                                                                 |

Parameters:
===========
Order Number:                  Select the specific sales order(s) to be included (Optional).
Quote Number:                  Not currently used.
Customer Name:                Select the specific customer(s) to be included (Optional).
Account Number:               Select the specific customer account(s) to be included (Optional).
Type:				     Not currently used.
Order Category:                 Select the order category code(s) to be included (Optional).
Line Category:                    Select the specific line category code(s) to be included (Optional).
Order Type:                      Select the order types(s) to be included (Optional).
LineType:                          Select the order line types(s) to be included (Optional).
Line Type not equal:	     Enter Line type exclusions if applicable (Optional).
Order Status:                     Select the order status(es) to be included (Optional).
Line Status:                        Select the order line status(es) to be included (Optional).
Item:                     	     Select the item(s) to be included (Optional).
Shippable Flag:                  Is the order line shippable, Yes/No.
Open only:                  	     Only include open orders (based on order header open flg and the last order line open flag, Yes/No.
Exclude Cancelled:             Exclude cancelled order lines, Yes/No.
Scheduled ship date from:  Enter the scheduled ship date from (Optional).
Scheduled ship date to:      Enter the scheduled ship date to (Optional).
Request date from:            Enter the requested ship date from (Optional).
Request date to:                Enter the requested ship date to (Optional).
Creation date from:            Enter the order creation date from (Optional).
Creation date to:                Enter the order creation date to (Optional).
Operating Unit:		     Select the required Operating Unit (Business Group) (Optional)</DESCRIPTION>
   </REPORT_TRANSLATIONS_ROW>
  </REPORT_TRANSLATIONS>
  <CATEGORY_ASSIGNMENTS>
   <CATEGORY_ASSIGNMENTS_ROW>
    <CATEGORY>Mgt Senfor Intl</CATEGORY>
   </CATEGORY_ASSIGNMENTS_ROW>
   <CATEGORY_ASSIGNMENTS_ROW>
    <CATEGORY>Senfor International</CATEGORY>
   </CATEGORY_ASSIGNMENTS_ROW>
  </CATEGORY_ASSIGNMENTS>
  <ANCHORS>
   <ANCHORS_ROW>
    <ANCHOR>&amp;xrrpv_table</ANCHOR>
   </ANCHORS_ROW>
   <ANCHORS_ROW>
    <ANCHOR>1=1</ANCHOR>
   </ANCHORS_ROW>
   <ANCHORS_ROW>
    <ANCHOR>2=2</ANCHOR>
   </ANCHORS_ROW>
  </ANCHORS>
  <PARAMETERS>
   <PARAMETERS_ROW>
    <SORT_ORDER>1</SORT_ORDER>
    <DISPLAY_SEQUENCE>-10</DISPLAY_SEQUENCE>
    <ANCHOR>&amp;xrrpv_table</ANCHOR>
    <SQL_TEXT>(
select distinct
dbms_lob.substr(xrrpv.value,instr(xrrpv.value,&apos;|&apos;)-1) organization_id,
dbms_lob.substr(xrrpv.value,20,instr(xrrpv.value,&apos;|&apos;)+1) inventory_item_id
from
xxen_report_parameters_vl xrpv,
xxen_report_run_param_values xrrpv
where
xrpv.parameter_name=&apos;organization_id|inventory_item_id&apos; and
xrpv.parameter_id=xrrpv.parameter_id and
xrrpv.run_id=:run_id
) xrrpv,</SQL_TEXT>
    <PARAMETER_TYPE_DSP>Char</PARAMETER_TYPE_DSP>
    <PARAMETER_TRANSLATIONS>
     <PARAMETER_TRANSLATIONS_ROW>
      <LANGUAGE>US</LANGUAGE>
      <PARAMETER_NAME>organization_id|inventory_item_id</PARAMETER_NAME>
     </PARAMETER_TRANSLATIONS_ROW>
    </PARAMETER_TRANSLATIONS>
   </PARAMETERS_ROW>
   <PARAMETERS_ROW>
    <SORT_ORDER>2</SORT_ORDER>
    <ANCHOR>2=2</ANCHOR>
    <SQL_TEXT>xrrpv.organization_id=msiv.organization_id and
xrrpv.inventory_item_id=msiv.inventory_item_id</SQL_TEXT>
    <PARAMETER_TRANSLATIONS>
     <PARAMETER_TRANSLATIONS_ROW>
      <LANGUAGE>US</LANGUAGE>
      <PARAMETER_NAME>organization_id|inventory_item_id</PARAMETER_NAME>
     </PARAMETER_TRANSLATIONS_ROW>
    </PARAMETER_TRANSLATIONS>
   </PARAMETERS_ROW>
   <PARAMETERS_ROW>
    <SORT_ORDER>3</SORT_ORDER>
    <DISPLAY_SEQUENCE>1</DISPLAY_SEQUENCE>
    <ANCHOR>2=2</ANCHOR>
    <SQL_TEXT>haouv.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>
    <PARAMETER_TRANSLATIONS>
     <PARAMETER_TRANSLATIONS_ROW>
      <LANGUAGE>US</LANGUAGE>
      <PARAMETER_NAME>Operating Unit</PARAMETER_NAME>
     </PARAMETER_TRANSLATIONS_ROW>
    </PARAMETER_TRANSLATIONS>
   </PARAMETERS_ROW>
   <PARAMETERS_ROW>
    <SORT_ORDER>4</SORT_ORDER>
    <DISPLAY_SEQUENCE>5</DISPLAY_SEQUENCE>
    <ANCHOR>2=2</ANCHOR>
    <SQL_TEXT>ooha.order_number=:order_number</SQL_TEXT>
    <PARAMETER_TYPE_DSP>LOV</PARAMETER_TYPE_DSP>
    <LOV_NAME>ONT Order Number</LOV_NAME>
    <LOV_GUID>8E2FF36EDEE779D2E0530100007F1FF2</LOV_GUID>
    <VALIDATE_FROM_LIST_DSP>Y</VALIDATE_FROM_LIST_DSP>
    <FILTER_BEFORE_DISPLAY_DSP>Y</FILTER_BEFORE_DISPLAY_DSP>
    <LOV_QUERY_DSP>select
ooha.order_number value,
ottt.name||&apos;: &apos;||hca.account_name||&apos; (&apos;||xxen_util.meaning(ooha.flow_status_code,&apos;FLOW_STATUS&apos;,660)||&apos;)&apos; description
from
oe_order_headers_all ooha,
oe_transaction_types_tl ottt,
hz_cust_accounts hca
where
nvl(ooha.transaction_phase_code,&apos;F&apos;)=&apos;F&apos; and
(:$flex$.operating_unit is null or ooha.org_id=(select haouv.organization_id from hr_all_organization_units_vl haouv where xxen_util.contains(:$flex$.operating_unit,haouv.name)=&apos;Y&apos;)) and
ooha.org_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) and
ooha.sold_to_org_id=hca.cust_account_id and
ooha.order_type_id=ottt.transaction_type_id and
ottt.language=userenv(&apos;lang&apos;)
order by
ooha.order_number desc</LOV_QUERY_DSP>
    <PARAMETER_TRANSLATIONS>
     <PARAMETER_TRANSLATIONS_ROW>
      <LANGUAGE>US</LANGUAGE>
      <PARAMETER_NAME>Order Number</PARAMETER_NAME>
     </PARAMETER_TRANSLATIONS_ROW>
    </PARAMETER_TRANSLATIONS>
   </PARAMETERS_ROW>
   <PARAMETERS_ROW>
    <SORT_ORDER>5</SORT_ORDER>
    <DISPLAY_SEQUENCE>7</DISPLAY_SEQUENCE>
    <ANCHOR>2=2</ANCHOR>
    <SQL_TEXT>(
ooha.quote_number=:quote_number or
ooha.orig_sys_document_ref like :quote_number||&apos;%&apos; and ooha.source_document_type_id=16
)</SQL_TEXT>
    <PARAMETER_TYPE_DSP>LOV</PARAMETER_TYPE_DSP>
    <LOV_NAME>ONT Quote Number</LOV_NAME>
    <LOV_GUID>8E2FF36EDF3979D2E0530100007F1FF2</LOV_GUID>
    <VALIDATE_FROM_LIST_DSP>Y</VALIDATE_FROM_LIST_DSP>
    <FILTER_BEFORE_DISPLAY_DSP>Y</FILTER_BEFORE_DISPLAY_DSP>
    <LOV_QUERY_DSP>select
nvl(ooha.quote_number,regexp_substr(ooha.orig_sys_document_ref,&apos;^(\d+).&apos;,1,1,null,1)) value,
ottt.name||&apos;: &apos;||hca.account_name||&apos; (&apos;||xxen_util.meaning(ooha.flow_status_code,&apos;FLOW_STATUS&apos;,660)||&apos;)&apos; description
from
oe_order_headers_all ooha,
oe_transaction_types_tl ottt,
hz_cust_accounts hca
where
(ooha.quote_number is not null or ooha.orig_sys_document_ref is not null and ooha.source_document_type_id=16) and
(:$flex$.operating_unit is null or ooha.org_id=(select haouv.organization_id from hr_all_organization_units_vl haouv where xxen_util.contains(:$flex$.operating_unit,haouv.name)=&apos;Y&apos;)) and
ooha.org_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) and
ooha.sold_to_org_id=hca.cust_account_id and
ooha.order_type_id=ottt.transaction_type_id and
ottt.language=userenv(&apos;lang&apos;)
order by
ooha.order_number desc</LOV_QUERY_DSP>
    <PARAMETER_TRANSLATIONS>
     <PARAMETER_TRANSLATIONS_ROW>
      <LANGUAGE>US</LANGUAGE>
      <PARAMETER_NAME>Quote Number</PARAMETER_NAME>
     </PARAMETER_TRANSLATIONS_ROW>
    </PARAMETER_TRANSLATIONS>
   </PARAMETERS_ROW>
   <PARAMETERS_ROW>
    <SORT_ORDER>6</SORT_ORDER>
    <DISPLAY_SEQUENCE>10</DISPLAY_SEQUENCE>
    <ANCHOR>2=2</ANCHOR>
    <SQL_TEXT>upper(hp.party_name) like upper(:customer_name)</SQL_TEXT>
    <PARAMETER_TYPE_DSP>LOV</PARAMETER_TYPE_DSP>
    <LOV_NAME>AR Customer Name</LOV_NAME>
    <LOV_GUID>8E2FF36EDE8679D2E0530100007F1FF2</LOV_GUID>
    <FILTER_BEFORE_DISPLAY_DSP>Y</FILTER_BEFORE_DISPLAY_DSP>
    <LOV_QUERY_DSP>select
hp.party_name value,
hca.account_number||&apos; (&apos;||initcap(hp.party_type)||&apos;)&apos;  description
from
hz_parties hp,
hz_cust_accounts hca
where
hp.party_id=hca.party_id and
(
:$flex$.operating_unit is null or
hca.cust_account_id in (
select
hcasa.cust_account_id
from
hr_all_organization_units_vl haouv,
hz_cust_acct_sites_all hcasa
where
xxen_util.contains(:$flex$.operating_unit,haouv.name)=&apos;Y&apos; and
haouv.organization_id=hcasa.org_id
)
)
order by
hp.party_name</LOV_QUERY_DSP>
    <PARAMETER_TRANSLATIONS>
     <PARAMETER_TRANSLATIONS_ROW>
      <LANGUAGE>US</LANGUAGE>
      <PARAMETER_NAME>Customer Name</PARAMETER_NAME>
     </PARAMETER_TRANSLATIONS_ROW>
    </PARAMETER_TRANSLATIONS>
   </PARAMETERS_ROW>
   <PARAMETERS_ROW>
    <SORT_ORDER>7</SORT_ORDER>
    <DISPLAY_SEQUENCE>20</DISPLAY_SEQUENCE>
    <ANCHOR>2=2</ANCHOR>
    <SQL_TEXT>hca.account_number=:account_number</SQL_TEXT>
    <PARAMETER_TYPE_DSP>LOV</PARAMETER_TYPE_DSP>
    <LOV_NAME>AR Account Number</LOV_NAME>
    <LOV_GUID>8E2FF36EDE7F79D2E0530100007F1FF2</LOV_GUID>
    <VALIDATE_FROM_LIST_DSP>Y</VALIDATE_FROM_LIST_DSP>
    <FILTER_BEFORE_DISPLAY_DSP>Y</FILTER_BEFORE_DISPLAY_DSP>
    <LOV_QUERY_DSP>select
hca.account_number value,
hp.party_name||&apos; (&apos;||initcap(hp.party_type)||&apos;)&apos; description
from
hz_parties hp,
hz_cust_accounts hca
where
hp.party_id=hca.party_id and
(
:$flex$.operating_unit is null or
hca.cust_account_id in (
select
hcasa.cust_account_id
from
hr_all_organization_units_vl haouv,
hz_cust_acct_sites_all hcasa
where
xxen_util.contains(:$flex$.operating_unit,haouv.name)=&apos;Y&apos; and
haouv.organization_id=hcasa.org_id
)
)
order by
hp.party_name</LOV_QUERY_DSP>
    <PARAMETER_TRANSLATIONS>
     <PARAMETER_TRANSLATIONS_ROW>
      <LANGUAGE>US</LANGUAGE>
      <PARAMETER_NAME>Account Number</PARAMETER_NAME>
     </PARAMETER_TRANSLATIONS_ROW>
    </PARAMETER_TRANSLATIONS>
   </PARAMETERS_ROW>
   <PARAMETERS_ROW>
    <SORT_ORDER>8</SORT_ORDER>
    <DISPLAY_SEQUENCE>25</DISPLAY_SEQUENCE>
    <ANCHOR>2=2</ANCHOR>
    <SQL_TEXT>nvl(ooha.transaction_phase_code,&apos;F&apos;)=&apos;F&apos;</SQL_TEXT>
    <PARAMETER_TYPE_DSP>LOV custom</PARAMETER_TYPE_DSP>
    <VALIDATE_FROM_LIST_DSP>Y</VALIDATE_FROM_LIST_DSP>
    <LOV_QUERY_DSP>select &apos;Order&apos; value, &apos;&apos; description from dual union all
select &apos;Quote&apos; value, &apos;&apos; description from dual</LOV_QUERY_DSP>
    <MATCHING_VALUE>Order</MATCHING_VALUE>
    <PARAMETER_TRANSLATIONS>
     <PARAMETER_TRANSLATIONS_ROW>
      <LANGUAGE>US</LANGUAGE>
      <PARAMETER_NAME>Type</PARAMETER_NAME>
     </PARAMETER_TRANSLATIONS_ROW>
    </PARAMETER_TRANSLATIONS>
   </PARAMETERS_ROW>
   <PARAMETERS_ROW>
    <SORT_ORDER>9</SORT_ORDER>
    <ANCHOR>2=2</ANCHOR>
    <SQL_TEXT>ooha.transaction_phase_code=&apos;N&apos;</SQL_TEXT>
    <MATCHING_VALUE>Quote</MATCHING_VALUE>
    <PARAMETER_TRANSLATIONS>
     <PARAMETER_TRANSLATIONS_ROW>
      <LANGUAGE>US</LANGUAGE>
      <PARAMETER_NAME>Type</PARAMETER_NAME>
     </PARAMETER_TRANSLATIONS_ROW>
    </PARAMETER_TRANSLATIONS>
   </PARAMETERS_ROW>
   <PARAMETERS_ROW>
    <SORT_ORDER>10</SORT_ORDER>
    <DISPLAY_SEQUENCE>30</DISPLAY_SEQUENCE>
    <ANCHOR>2=2</ANCHOR>
    <SQL_TEXT>ooha.order_category_code=xxen_util.lookup_code(:order_category,&apos;ORDER_CATEGORY&apos;,660)</SQL_TEXT>
    <PARAMETER_TYPE_DSP>LOV custom</PARAMETER_TYPE_DSP>
    <VALIDATE_FROM_LIST_DSP>Y</VALIDATE_FROM_LIST_DSP>
    <LOV_QUERY_DSP>select
flv.meaning value,
flv.lookup_code description
from
fnd_lookup_values flv
where
flv.lookup_type=&apos;ORDER_CATEGORY&apos; and
flv.view_application_id=660 and
flv.language(+)=userenv(&apos;lang&apos;) and
flv.security_group_id=0
order by
flv.meaning</LOV_QUERY_DSP>
    <PARAMETER_TRANSLATIONS>
     <PARAMETER_TRANSLATIONS_ROW>
      <LANGUAGE>US</LANGUAGE>
      <PARAMETER_NAME>Order Category</PARAMETER_NAME>
     </PARAMETER_TRANSLATIONS_ROW>
    </PARAMETER_TRANSLATIONS>
   </PARAMETERS_ROW>
   <PARAMETERS_ROW>
    <SORT_ORDER>11</SORT_ORDER>
    <DISPLAY_SEQUENCE>35</DISPLAY_SEQUENCE>
    <ANCHOR>2=2</ANCHOR>
    <SQL_TEXT>oola.line_category_code=xxen_util.lookup_code(:line_category,&apos;ORDER_CATEGORY&apos;,660)</SQL_TEXT>
    <PARAMETER_TYPE_DSP>LOV custom</PARAMETER_TYPE_DSP>
    <VALIDATE_FROM_LIST_DSP>Y</VALIDATE_FROM_LIST_DSP>
    <LOV_QUERY_DSP>select
flv.meaning value,
flv.lookup_code description
from
fnd_lookup_values flv
where
flv.lookup_code in (&apos;ORDER&apos;,&apos;RETURN&apos;) and
flv.lookup_type=&apos;ORDER_CATEGORY&apos; and
flv.view_application_id=660 and
flv.language(+)=userenv(&apos;lang&apos;) and
flv.security_group_id=0
order by
flv.meaning</LOV_QUERY_DSP>
    <PARAMETER_TRANSLATIONS>
     <PARAMETER_TRANSLATIONS_ROW>
      <LANGUAGE>US</LANGUAGE>
      <PARAMETER_NAME>Line Category</PARAMETER_NAME>
     </PARAMETER_TRANSLATIONS_ROW>
    </PARAMETER_TRANSLATIONS>
   </PARAMETERS_ROW>
   <PARAMETERS_ROW>
    <SORT_ORDER>12</SORT_ORDER>
    <DISPLAY_SEQUENCE>40</DISPLAY_SEQUENCE>
    <ANCHOR>2=2</ANCHOR>
    <SQL_TEXT>ottt.name=:order_type</SQL_TEXT>
    <PARAMETER_TYPE_DSP>LOV</PARAMETER_TYPE_DSP>
    <LOV_NAME>ONT Order Type</LOV_NAME>
    <LOV_GUID>8E2FF36EDEE879D2E0530100007F1FF2</LOV_GUID>
    <VALIDATE_FROM_LIST_DSP>Y</VALIDATE_FROM_LIST_DSP>
    <LOV_QUERY_DSP>select
ottt.name value,
xxen_util.meaning(otta.order_category_code,&apos;ORDER_CATEGORY&apos;,660) description
from
oe_transaction_types_all otta,
oe_transaction_types_tl ottt
where
(:$flex$.operating_unit is null or otta.org_id in (select haouv.organization_id from hr_all_organization_units_vl haouv where xxen_util.contains(:$flex$.operating_unit,haouv.name)=&apos;Y&apos;)) and
otta.transaction_type_code=&apos;ORDER&apos; and
otta.transaction_type_id=ottt.transaction_type_id and
ottt.language=userenv(&apos;lang&apos;)
order by
decode(otta.order_category_code,&apos;ORDER&apos;,1,&apos;MIXED&apos;,2,3),
ottt.name</LOV_QUERY_DSP>
    <PARAMETER_TRANSLATIONS>
     <PARAMETER_TRANSLATIONS_ROW>
      <LANGUAGE>US</LANGUAGE>
      <PARAMETER_NAME>Order Type</PARAMETER_NAME>
     </PARAMETER_TRANSLATIONS_ROW>
    </PARAMETER_TRANSLATIONS>
   </PARAMETERS_ROW>
   <PARAMETERS_ROW>
    <SORT_ORDER>13</SORT_ORDER>
    <DISPLAY_SEQUENCE>50</DISPLAY_SEQUENCE>
    <ANCHOR>2=2</ANCHOR>
    <SQL_TEXT>ottt2.name=:line_type</SQL_TEXT>
    <PARAMETER_TYPE_DSP>LOV</PARAMETER_TYPE_DSP>
    <LOV_NAME>ONT Line Type</LOV_NAME>
    <LOV_GUID>8E2FF36EDEF479D2E0530100007F1FF2</LOV_GUID>
    <VALIDATE_FROM_LIST_DSP>Y</VALIDATE_FROM_LIST_DSP>
    <LOV_QUERY_DSP>select
ottt.name value,
xxen_util.meaning(otta.order_category_code,&apos;ORDER_CATEGORY&apos;,660) description
from
oe_transaction_types_all otta,
oe_transaction_types_tl ottt
where
(:$flex$.operating_unit is null or otta.org_id in (select haouv.organization_id from hr_all_organization_units_vl haouv where xxen_util.contains(:$flex$.operating_unit,haouv.name)=&apos;Y&apos;)) and
otta.transaction_type_code=&apos;LINE&apos; and
otta.transaction_type_id=ottt.transaction_type_id and
ottt.language=userenv(&apos;lang&apos;)
order by
decode(otta.order_category_code,&apos;ORDER&apos;,1,&apos;MIXED&apos;,2,3),
ottt.name</LOV_QUERY_DSP>
    <PARAMETER_TRANSLATIONS>
     <PARAMETER_TRANSLATIONS_ROW>
      <LANGUAGE>US</LANGUAGE>
      <PARAMETER_NAME>Line Type</PARAMETER_NAME>
     </PARAMETER_TRANSLATIONS_ROW>
    </PARAMETER_TRANSLATIONS>
   </PARAMETERS_ROW>
   <PARAMETERS_ROW>
    <SORT_ORDER>14</SORT_ORDER>
    <DISPLAY_SEQUENCE>52</DISPLAY_SEQUENCE>
    <ANCHOR>2=2</ANCHOR>
    <SQL_TEXT>ottt2.name&lt;&gt;:line_type_not</SQL_TEXT>
    <PARAMETER_TYPE_DSP>LOV</PARAMETER_TYPE_DSP>
    <LOV_NAME>ONT Line Type</LOV_NAME>
    <LOV_GUID>8E2FF36EDEF479D2E0530100007F1FF2</LOV_GUID>
    <VALIDATE_FROM_LIST_DSP>Y</VALIDATE_FROM_LIST_DSP>
    <LOV_QUERY_DSP>select
ottt.name value,
xxen_util.meaning(otta.order_category_code,&apos;ORDER_CATEGORY&apos;,660) description
from
oe_transaction_types_all otta,
oe_transaction_types_tl ottt
where
(:$flex$.operating_unit is null or otta.org_id in (select haouv.organization_id from hr_all_organization_units_vl haouv where xxen_util.contains(:$flex$.operating_unit,haouv.name)=&apos;Y&apos;)) and
otta.transaction_type_code=&apos;LINE&apos; and
otta.transaction_type_id=ottt.transaction_type_id and
ottt.language=userenv(&apos;lang&apos;)
order by
decode(otta.order_category_code,&apos;ORDER&apos;,1,&apos;MIXED&apos;,2,3),
ottt.name</LOV_QUERY_DSP>
    <PARAMETER_TRANSLATIONS>
     <PARAMETER_TRANSLATIONS_ROW>
      <LANGUAGE>US</LANGUAGE>
      <PARAMETER_NAME>Line Type not equal</PARAMETER_NAME>
     </PARAMETER_TRANSLATIONS_ROW>
    </PARAMETER_TRANSLATIONS>
   </PARAMETERS_ROW>
   <PARAMETERS_ROW>
    <SORT_ORDER>15</SORT_ORDER>
    <DISPLAY_SEQUENCE>55</DISPLAY_SEQUENCE>
    <ANCHOR>2=2</ANCHOR>
    <SQL_TEXT>ooha.flow_status_code=xxen_util.lookup_code(:header_status,&apos;FLOW_STATUS&apos;,660)</SQL_TEXT>
    <PARAMETER_TYPE_DSP>LOV</PARAMETER_TYPE_DSP>
    <LOV_NAME>ONT Order Status</LOV_NAME>
    <LOV_GUID>8E2FF36EDF0979D2E0530100007F1FF2</LOV_GUID>
    <VALIDATE_FROM_LIST_DSP>Y</VALIDATE_FROM_LIST_DSP>
    <LOV_QUERY_DSP>select
flvv.meaning value,
flvv.lookup_code description
from
fnd_lookup_values_vl flvv
where
flvv.lookup_type=&apos;FLOW_STATUS&apos; and
flvv.view_application_id=660 and
flvv.security_group_id=0
order by
flvv.meaning</LOV_QUERY_DSP>
    <PARAMETER_TRANSLATIONS>
     <PARAMETER_TRANSLATIONS_ROW>
      <LANGUAGE>US</LANGUAGE>
      <PARAMETER_NAME>Order Status</PARAMETER_NAME>
     </PARAMETER_TRANSLATIONS_ROW>
    </PARAMETER_TRANSLATIONS>
   </PARAMETERS_ROW>
   <PARAMETERS_ROW>
    <SORT_ORDER>16</SORT_ORDER>
    <DISPLAY_SEQUENCE>57</DISPLAY_SEQUENCE>
    <ANCHOR>2=2</ANCHOR>
    <SQL_TEXT>oola.flow_status_code=xxen_util.lookup_code(:line_status,&apos;LINE_FLOW_STATUS&apos;,660)</SQL_TEXT>
    <PARAMETER_TYPE_DSP>LOV</PARAMETER_TYPE_DSP>
    <LOV_NAME>ONT Line Status</LOV_NAME>
    <LOV_GUID>8E2FF36EDF0A79D2E0530100007F1FF2</LOV_GUID>
    <VALIDATE_FROM_LIST_DSP>Y</VALIDATE_FROM_LIST_DSP>
    <LOV_QUERY_DSP>select
flvv.meaning value,
flvv.lookup_code description
from
fnd_lookup_values_vl flvv
where
flvv.lookup_type=&apos;LINE_FLOW_STATUS&apos; and
flvv.view_application_id=660 and
flvv.security_group_id=0
order by
flvv.meaning</LOV_QUERY_DSP>
    <PARAMETER_TRANSLATIONS>
     <PARAMETER_TRANSLATIONS_ROW>
      <LANGUAGE>US</LANGUAGE>
      <PARAMETER_NAME>Line Status</PARAMETER_NAME>
     </PARAMETER_TRANSLATIONS_ROW>
    </PARAMETER_TRANSLATIONS>
   </PARAMETERS_ROW>
   <PARAMETERS_ROW>
    <SORT_ORDER>17</SORT_ORDER>
    <DISPLAY_SEQUENCE>60</DISPLAY_SEQUENCE>
    <ANCHOR>2=2</ANCHOR>
    <SQL_TEXT>msiv.concatenated_segments like :item</SQL_TEXT>
    <PARAMETER_TYPE_DSP>LOV</PARAMETER_TYPE_DSP>
    <LOV_NAME>INV Item</LOV_NAME>
    <LOV_GUID>8E2FF36EDEF179D2E0530100007F1FF2</LOV_GUID>
    <VALIDATE_FROM_LIST_DSP>Y</VALIDATE_FROM_LIST_DSP>
    <FILTER_BEFORE_DISPLAY_DSP>Y</FILTER_BEFORE_DISPLAY_DSP>
    <LOV_QUERY_DSP>select
msiv.concatenated_segments value,
msiv.description||&apos; (&apos;||mp.organization_code||&apos;)&apos; description
from
mtl_system_items_vl msiv,
mtl_parameters mp
where
(
:$flex$.organization_code is null and (
fnd_profile.value(&apos;MFG_ORGANIZATION_ID&apos;) is null and msiv.organization_id in (select oav.organization_id from org_access_view oav where oav.resp_application_id=fnd_global.resp_appl_id and oav.responsibility_id=fnd_global.resp_id) or
msiv.organization_id=fnd_profile.value(&apos;MFG_ORGANIZATION_ID&apos;)
) or
xxen_util.contains(:$flex$.organization_code,mp.organization_code)=&apos;Y&apos;
) and
msiv.organization_id=mp.organization_id
order by
mp.organization_code,
msiv.concatenated_segments</LOV_QUERY_DSP>
    <PARAMETER_TRANSLATIONS>
     <PARAMETER_TRANSLATIONS_ROW>
      <LANGUAGE>US</LANGUAGE>
      <PARAMETER_NAME>Item</PARAMETER_NAME>
     </PARAMETER_TRANSLATIONS_ROW>
    </PARAMETER_TRANSLATIONS>
   </PARAMETERS_ROW>
   <PARAMETERS_ROW>
    <SORT_ORDER>18</SORT_ORDER>
    <DISPLAY_SEQUENCE>70</DISPLAY_SEQUENCE>
    <ANCHOR>2=2</ANCHOR>
    <SQL_TEXT>oola.shippable_flag=:shippable_flag</SQL_TEXT>
    <PARAMETER_TYPE_DSP>LOV Oracle</PARAMETER_TYPE_DSP>
    <LOV_NAME>Yes_No</LOV_NAME>
    <VALIDATE_FROM_LIST_DSP>Y</VALIDATE_FROM_LIST_DSP>
    <LOV_QUERY_DSP>select
lookup_code id,
meaning value,
null description
from
fnd_lookups
where fnd_lookups.lookup_type=&apos;YES_NO&apos;
order by value,description</LOV_QUERY_DSP>
    <PARAMETER_TRANSLATIONS>
     <PARAMETER_TRANSLATIONS_ROW>
      <LANGUAGE>US</LANGUAGE>
      <PARAMETER_NAME>Shippable Flag</PARAMETER_NAME>
     </PARAMETER_TRANSLATIONS_ROW>
    </PARAMETER_TRANSLATIONS>
   </PARAMETERS_ROW>
   <PARAMETERS_ROW>
    <SORT_ORDER>19</SORT_ORDER>
    <DISPLAY_SEQUENCE>140</DISPLAY_SEQUENCE>
    <ANCHOR>2=2</ANCHOR>
    <SQL_TEXT>ooha.open_flag=&apos;Y&apos; and
oola.max_open_flag=&apos;Y&apos;</SQL_TEXT>
    <PARAMETER_TYPE_DSP>LOV Oracle</PARAMETER_TYPE_DSP>
    <LOV_NAME>Yes_No</LOV_NAME>
    <VALIDATE_FROM_LIST_DSP>Y</VALIDATE_FROM_LIST_DSP>
    <LOV_QUERY_DSP>select
lookup_code id,
meaning value,
null description
from
fnd_lookups
where fnd_lookups.lookup_type=&apos;YES_NO&apos;
order by value,description</LOV_QUERY_DSP>
    <PARAMETER_TRANSLATIONS>
     <PARAMETER_TRANSLATIONS_ROW>
      <LANGUAGE>US</LANGUAGE>
      <PARAMETER_NAME>Open only</PARAMETER_NAME>
     </PARAMETER_TRANSLATIONS_ROW>
    </PARAMETER_TRANSLATIONS>
   </PARAMETERS_ROW>
   <PARAMETERS_ROW>
    <SORT_ORDER>20</SORT_ORDER>
    <DISPLAY_SEQUENCE>150</DISPLAY_SEQUENCE>
    <ANCHOR>2=2</ANCHOR>
    <SQL_TEXT>ooha.cancelled_flag=&apos;N&apos; and
oola.cancelled_flag=&apos;N&apos;</SQL_TEXT>
    <PARAMETER_TYPE_DSP>LOV Oracle</PARAMETER_TYPE_DSP>
    <LOV_NAME>Yes_No</LOV_NAME>
    <VALIDATE_FROM_LIST_DSP>Y</VALIDATE_FROM_LIST_DSP>
    <LOV_QUERY_DSP>select
lookup_code id,
meaning value,
null description
from
fnd_lookups
where fnd_lookups.lookup_type=&apos;YES_NO&apos;
order by value,description</LOV_QUERY_DSP>
    <DEFAULT_VALUE>Yes</DEFAULT_VALUE>
    <PARAMETER_TRANSLATIONS>
     <PARAMETER_TRANSLATIONS_ROW>
      <LANGUAGE>US</LANGUAGE>
      <PARAMETER_NAME>Exclude Cancelled</PARAMETER_NAME>
     </PARAMETER_TRANSLATIONS_ROW>
    </PARAMETER_TRANSLATIONS>
   </PARAMETERS_ROW>
   <PARAMETERS_ROW>
    <SORT_ORDER>21</SORT_ORDER>
    <DISPLAY_SEQUENCE>160</DISPLAY_SEQUENCE>
    <ANCHOR>2=2</ANCHOR>
    <SQL_TEXT>oola.schedule_ship_date&gt;=:schedule_ship_date_from</SQL_TEXT>
    <PARAMETER_TYPE_DSP>Date</PARAMETER_TYPE_DSP>
    <PARAMETER_TRANSLATIONS>
     <PARAMETER_TRANSLATIONS_ROW>
      <LANGUAGE>US</LANGUAGE>
      <PARAMETER_NAME>Schedule Ship Date From</PARAMETER_NAME>
     </PARAMETER_TRANSLATIONS_ROW>
    </PARAMETER_TRANSLATIONS>
   </PARAMETERS_ROW>
   <PARAMETERS_ROW>
    <SORT_ORDER>22</SORT_ORDER>
    <DISPLAY_SEQUENCE>170</DISPLAY_SEQUENCE>
    <ANCHOR>2=2</ANCHOR>
    <SQL_TEXT>oola.schedule_ship_date&lt;:schedule_ship_date_to+1</SQL_TEXT>
    <PARAMETER_TYPE_DSP>Date</PARAMETER_TYPE_DSP>
    <PARAMETER_TRANSLATIONS>
     <PARAMETER_TRANSLATIONS_ROW>
      <LANGUAGE>US</LANGUAGE>
      <PARAMETER_NAME>Schedule Ship Date To</PARAMETER_NAME>
     </PARAMETER_TRANSLATIONS_ROW>
    </PARAMETER_TRANSLATIONS>
   </PARAMETERS_ROW>
   <PARAMETERS_ROW>
    <SORT_ORDER>23</SORT_ORDER>
    <DISPLAY_SEQUENCE>180</DISPLAY_SEQUENCE>
    <ANCHOR>2=2</ANCHOR>
    <SQL_TEXT>oola.request_date&gt;=:request_date_from</SQL_TEXT>
    <PARAMETER_TYPE_DSP>Date</PARAMETER_TYPE_DSP>
    <PARAMETER_TRANSLATIONS>
     <PARAMETER_TRANSLATIONS_ROW>
      <LANGUAGE>US</LANGUAGE>
      <PARAMETER_NAME>Request Date From</PARAMETER_NAME>
     </PARAMETER_TRANSLATIONS_ROW>
    </PARAMETER_TRANSLATIONS>
   </PARAMETERS_ROW>
   <PARAMETERS_ROW>
    <SORT_ORDER>24</SORT_ORDER>
    <DISPLAY_SEQUENCE>187</DISPLAY_SEQUENCE>
    <ANCHOR>2=2</ANCHOR>
    <SQL_TEXT>oola.request_date&lt;:request_date_to+1</SQL_TEXT>
    <PARAMETER_TYPE_DSP>Date</PARAMETER_TYPE_DSP>
    <PARAMETER_TRANSLATIONS>
     <PARAMETER_TRANSLATIONS_ROW>
      <LANGUAGE>US</LANGUAGE>
      <PARAMETER_NAME>Request Date To</PARAMETER_NAME>
     </PARAMETER_TRANSLATIONS_ROW>
    </PARAMETER_TRANSLATIONS>
   </PARAMETERS_ROW>
   <PARAMETERS_ROW>
    <SORT_ORDER>25</SORT_ORDER>
    <DISPLAY_SEQUENCE>195</DISPLAY_SEQUENCE>
    <ANCHOR>2=2</ANCHOR>
    <SQL_TEXT>oola.creation_date&gt;=:creation_date_from</SQL_TEXT>
    <PARAMETER_TYPE_DSP>Date</PARAMETER_TYPE_DSP>
    <PARAMETER_TRANSLATIONS>
     <PARAMETER_TRANSLATIONS_ROW>
      <LANGUAGE>US</LANGUAGE>
      <PARAMETER_NAME>Creation Date From</PARAMETER_NAME>
     </PARAMETER_TRANSLATIONS_ROW>
    </PARAMETER_TRANSLATIONS>
   </PARAMETERS_ROW>
   <PARAMETERS_ROW>
    <SORT_ORDER>26</SORT_ORDER>
    <DISPLAY_SEQUENCE>197</DISPLAY_SEQUENCE>
    <ANCHOR>2=2</ANCHOR>
    <SQL_TEXT>oola.creation_date&lt;:creation_date_to+1</SQL_TEXT>
    <PARAMETER_TYPE_DSP>Date</PARAMETER_TYPE_DSP>
    <PARAMETER_TRANSLATIONS>
     <PARAMETER_TRANSLATIONS_ROW>
      <LANGUAGE>US</LANGUAGE>
      <PARAMETER_NAME>Creation Date To</PARAMETER_NAME>
     </PARAMETER_TRANSLATIONS_ROW>
    </PARAMETER_TRANSLATIONS>
   </PARAMETERS_ROW>
  </PARAMETERS>
  <PARAMETER_DEPENDENCIES>
   <PARAMETER_DEPENDENCIES_ROW>
    <FLEX_BIND>:$flex$.operating_unit</FLEX_BIND>
    <PARAMETER_NAME>Operating Unit</PARAMETER_NAME>
    <DEPENDENT_PARAMETER_NAME>Account Number</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>Customer Name</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>Line 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>Line Type not equal</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>Order Number</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>Order 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>Quote Number</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>
