<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>
<REPORTS>
<!-- loader xml for Enginatics Blitz Report: Terex Daily Order Items Revenue Report -->
 <REPORTS_ROW>
  <GUID>25383B52BF4D8564E0635863B10AF11D</GUID><ENABLED>Y</ENABLED>
  <SQL_TEXT>
SELECT
    operating_unit,
    organization_code,
    delivery_number,
    customer,
    country,
    salesrep_name,
    product_category,
    order_number,
    order_type,
    inco_term,
    item,
    SUM(nvl(quantity_invoiced, 0)) invoiced_qty,
    entered_currency,
    ledger_currency,
    invoice_number,
    invoice_date,
    SUM(nvl(invoiced_amount, 0))   func_currency_invoiced_amount,
    usd_conversion_rate,
    round(SUM(nvl(invoiced_amount, 0) * usd_conversion_rate), 2)   sales_value_in_usd,
    item_description
FROM
    (
        SELECT
            hu.name                                             operating_unit,
            ood.organization_code,
            hp.party_name                                       customer,
            hca.account_number                                  customer_number,
            gl.currency_code                                    ledger_currency,
            rt.trx_number                                       invoice_number,
            rt.trx_date                                         invoice_date,
            rt.invoice_currency_code                            entered_currency,
            ol.freight_terms_code                               inco_term,
            (
                SELECT
                    glr.conversion_rate
                FROM
                    gl_daily_rates_v glr
                WHERE
                        glr.conversion_type = &apos;Corporate&apos;
                    AND trunc(glr.conversion_date) = trunc(sysdate)
                    AND glr.to_currency = &apos;USD&apos;
                    AND glr.from_currency = gl.currency_code
            )                                                   usd_conversion_rate,
            (
                SELECT
                    ft.territory_short_name
                FROM
                    hz_cust_site_uses_all  hs,
                    hz_cust_acct_sites_all hca,
                    hz_party_sites         hps,
                    hz_locations           hl,
                    fnd_territories_vl     ft
                WHERE
                        hs.site_use_id = rt.ship_to_site_use_id
                    AND hs.cust_acct_site_id = hca.cust_acct_site_id
                    AND hca.party_site_id = hps.party_site_id
                    AND hps.location_id = hl.location_id
                    AND hl.country = ft.territory_code
            )                                                   country,
            (
                SELECT
                    name
                FROM
                    jtf_rs_salesreps
                WHERE
                        salesrep_id = oh.salesrep_id
                    AND org_id = oh.org_id
            )                                                   salesrep_name,-- oh.salesrep_id,
            (
                SELECT
                    mc.segment1
                FROM
                    mtl_item_categories mic,
                    mtl_categories      mc
                WHERE
                        mic.inventory_item_id = rctl.inventory_item_id
                    AND mic.organization_id = rctl.warehouse_id
                    AND mic.category_id = mc.category_id
                    AND mic.category_set_id = 1100000022
            )                                                   product_category,
            rt.org_id,
            rt.trx_number,
            rt.cust_trx_type_id,
            oh.order_number,
            otl.name                                            order_type,
            (
                SELECT
                    segment1
                FROM
                    mtl_system_items_b
                WHERE
                        inventory_item_id = rctl.inventory_item_id
                    AND organization_id = rctl.warehouse_id
            )                                                   item,
            (
                SELECT
                    description
                FROM
                    mtl_system_items_b
                WHERE
                        inventory_item_id = rctl.inventory_item_id
                    AND organization_id = rctl.warehouse_id
            )                                                   item_description,
            rctl.quantity_ordered,
            nvl(rctl.quantity_invoiced, rctl.quantity_credited) quantity_invoiced,
            rt.invoice_currency_code,
            rctl.extended_amount,
            round(rctl.extended_amount * nvl(rt.exchange_rate, 1), 2) invoiced_amount,
            decode(rctl.interface_line_context, &apos;INTERCOMPANY&apos;,(
                SELECT
                    shipment_number
                FROM
                    mtl_material_transactions
                WHERE
                    transaction_id = rctl.interface_line_attribute7
            ), rctl.interface_line_attribute3)                  delivery_number
        FROM
            ra_customer_trx_all          rt,
            gl_ledgers                   gl,
            hr_operating_units           hu,
            ra_customer_trx_lines_all    rctl,
            ra_cust_trx_line_gl_dist_all rgd,
            oe_order_headers_all         oh,
            oe_order_lines_all           ol,
            oe_transaction_types_tl      otl,
            hz_cust_accounts             hca,
            hz_parties                   hp,
            org_organization_definitions ood
        WHERE
                1=1
            AND rt.customer_trx_id = rctl.customer_trx_id
          --AND rt.org_id = 11023
            AND rt.org_id = hu.organization_id
            AND hu.set_of_books_id = gl.ledger_id
            AND rt.customer_trx_id = rgd.customer_trx_id
            AND rgd.account_class = &apos;REC&apos;
            AND rctl.line_type = &apos;LINE&apos;
            AND rgd.latest_rec_flag = &apos;Y&apos;
            AND rgd.gl_date &gt;= nvl(:p_fdate,   nvl(trunc(:p_tdate ,&apos;MM&apos;), trunc(sysdate,&apos;MM&apos;)) )
            AND rgd.gl_date &lt;= nvl(:p_tdate,trunc(sysdate))
            AND oh.header_id = ol.header_id (+)
            AND oh.order_number = rctl.sales_order
         --AND ol.line_id (+)= rctl.interface_line_attribute6 --Shipping Charges Not Expected
            AND ol.line_id = rctl.interface_line_attribute6
            AND oh.order_type_id = otl.transaction_type_id
            AND otl.language = userenv(&apos;LANG&apos;)
            AND rctl.interface_line_context IN ( &apos;ORDER ENTRY&apos;, &apos;INTERCOMPANY&apos; )
            AND hca.cust_account_id = rt.bill_to_customer_id
            AND hca.party_id = hp.party_id 
            AND rctl.warehouse_id = ood.organization_id
    )
WHERE
    2=2
GROUP BY
    operating_unit,
    organization_code,
    delivery_number,
    customer,
    country,
    salesrep_name,
    product_category,
    order_number,
    order_type,
    inco_term,
    item,
    entered_currency,
    ledger_currency,
    invoice_number,
    invoice_date,
    usd_conversion_rate,
    item_description</SQL_TEXT>
  <REPORT_TRANSLATIONS>
   <REPORT_TRANSLATIONS_ROW>
    <LANGUAGE>US</LANGUAGE>
    <REPORT_NAME>Terex Daily Order Items Revenue Report</REPORT_NAME>
    <DESCRIPTION>Report:Terex Daily Order Items Revenue Report
PVCS Code : Terex_Daily_Order_Items_Revenue_Report.xml
Default from Date:Starting of Current Month 
Default Date to :Current Date
Report Set move Files to /TMSCIFS/Blitz/MP-Parts/Daily Order Items Revenue
</DESCRIPTION>
   </REPORT_TRANSLATIONS_ROW>
  </REPORT_TRANSLATIONS>
  <CATEGORY_ASSIGNMENTS>
  </CATEGORY_ASSIGNMENTS>
  <ANCHORS>
   <ANCHORS_ROW>
    <ANCHOR>1=1</ANCHOR>
   </ANCHORS_ROW>
   <ANCHORS_ROW>
    <ANCHOR>2=2</ANCHOR>
   </ANCHORS_ROW>
   <ANCHORS_ROW>
    <ANCHOR>:p_fdate</ANCHOR>
   </ANCHORS_ROW>
   <ANCHORS_ROW>
    <ANCHOR>:p_tdate</ANCHOR>
   </ANCHORS_ROW>
  </ANCHORS>
  <PARAMETERS>
   <PARAMETERS_ROW>
    <SORT_ORDER>1</SORT_ORDER>
    <DISPLAY_SEQUENCE>10</DISPLAY_SEQUENCE>
    <ANCHOR>1=1</ANCHOR>
    <SQL_TEXT>ood.organization_code = :PinvOrgCode</SQL_TEXT>
    <PARAMETER_TYPE_DSP>LOV custom</PARAMETER_TYPE_DSP>
    <VALIDATE_FROM_LIST_DSP>Y</VALIDATE_FROM_LIST_DSP>
    <LOV_QUERY_DSP>
select ORGANIZATION_CODE value, ORGANIZATION_NAME description 
from org_organization_definitions 
order by 1</LOV_QUERY_DSP>
    <REQUIRED>Y</REQUIRED>
    <PARAMETER_TRANSLATIONS>
     <PARAMETER_TRANSLATIONS_ROW>
      <LANGUAGE>US</LANGUAGE>
      <PARAMETER_NAME>Inventory Org</PARAMETER_NAME>
     </PARAMETER_TRANSLATIONS_ROW>
    </PARAMETER_TRANSLATIONS>
   </PARAMETERS_ROW>
   <PARAMETERS_ROW>
    <SORT_ORDER>2</SORT_ORDER>
    <DISPLAY_SEQUENCE>15</DISPLAY_SEQUENCE>
    <ANCHOR>:p_tdate</ANCHOR>
    <PARAMETER_TYPE_DSP>Date</PARAMETER_TYPE_DSP>
    <DEFAULT_VALUE>select trunc(sysdate) from dual</DEFAULT_VALUE>
    <PARAMETER_TRANSLATIONS>
     <PARAMETER_TRANSLATIONS_ROW>
      <LANGUAGE>US</LANGUAGE>
      <PARAMETER_NAME>To Date</PARAMETER_NAME>
     </PARAMETER_TRANSLATIONS_ROW>
    </PARAMETER_TRANSLATIONS>
   </PARAMETERS_ROW>
   <PARAMETERS_ROW>
    <SORT_ORDER>3</SORT_ORDER>
    <DISPLAY_SEQUENCE>20</DISPLAY_SEQUENCE>
    <ANCHOR>:p_fdate</ANCHOR>
    <PARAMETER_TYPE_DSP>Date</PARAMETER_TYPE_DSP>
    <DEFAULT_VALUE>select trunc(sysdate ,&apos;MM&apos;) from dual</DEFAULT_VALUE>
    <PARAMETER_TRANSLATIONS>
     <PARAMETER_TRANSLATIONS_ROW>
      <LANGUAGE>US</LANGUAGE>
      <PARAMETER_NAME>From Date</PARAMETER_NAME>
     </PARAMETER_TRANSLATIONS_ROW>
    </PARAMETER_TRANSLATIONS>
   </PARAMETERS_ROW>
   <PARAMETERS_ROW>
    <SORT_ORDER>4</SORT_ORDER>
    <DISPLAY_SEQUENCE>30</DISPLAY_SEQUENCE>
    <ANCHOR>2=2</ANCHOR>
    <SQL_TEXT>Product_Category = :pcategory</SQL_TEXT>
    <PARAMETER_TYPE_DSP>LOV custom</PARAMETER_TYPE_DSP>
    <VALIDATE_FROM_LIST_DSP>Y</VALIDATE_FROM_LIST_DSP>
    <LOV_QUERY_DSP>select distinct a.SEGMENT1 value , a.SEGMENT1 description
from mtl_categories a,mtl_category_sets b
where b.CATEGORY_SET_ID =1100000022
and a.STRUCTURE_ID =b.STRUCTURE_ID 
and a.ENABLED_FLAG=&apos;Y&apos; 
and nvl(END_DATE_ACTIVE,sysdate) &gt;= sysdate</LOV_QUERY_DSP>
    <PARAMETER_TRANSLATIONS>
     <PARAMETER_TRANSLATIONS_ROW>
      <LANGUAGE>US</LANGUAGE>
      <PARAMETER_NAME>Product Category</PARAMETER_NAME>
     </PARAMETER_TRANSLATIONS_ROW>
    </PARAMETER_TRANSLATIONS>
   </PARAMETERS_ROW>
  </PARAMETERS>
  <TEMPLATES>
  </TEMPLATES>
  <DEFAULT_TEMPLATES>
  </DEFAULT_TEMPLATES>
  <UPLOAD_COLUMNS>
  </UPLOAD_COLUMNS>
  <UPLOAD_PARAMETERS>
  </UPLOAD_PARAMETERS>
  <UPLOAD_SQLS>
  </UPLOAD_SQLS>
 </REPORTS_ROW>
</REPORTS>
</ROOT>
