<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: 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>
</LOVS>
<REPORTS>
<!-- loader xml for Enginatics Blitz Report: ECC Procurement, Agreements -->
 <REPORTS_ROW>
  <GUID>EEE75CEB4AEB6AD8E05362FB09051F8B</GUID>
  <SQL_TEXT>select
x.*
from
(
select * from (SELECT /*+ leading(gt) */
          gt.char1                  ecc_spec_id,  dfv_h.*, 
    agr_header.po_header_id   agreement,
    agr_header.segment1       agreement_number,
    agr_header.revision_num   agr_revision,
   /* po_pcc_orders_util_pvt.get_po_status(agr_header.po_header_id,houtl.language) status, */
   (SELECT plc_sta.meaning
             FROM fnd_lookup_values plc_sta
             WHERE plc_sta.lookup_code = decode(agr_header.approved_flag, &apos;R&apos;, agr_header.approved_flag,nvl(agr_header.authorization_status,&apos;INCOMPLETE&apos;))
             and    plc_sta.lookup_type in (&apos;PO APPROVAL&apos;, &apos;DOCUMENT STATE&apos;)
             AND   plc_sta.LANGUAGE = houtl.language)
             ||
             decode(agr_header.closed_code, &apos;OPEN&apos;, &apos;&apos;, &apos;&apos;, &apos;&apos;,
				     &apos;, &apos;||decode(nvl(agr_header.closed_code, &apos;OPEN&apos;), &apos;OPEN&apos;, NULL,
             (SELECT plc_clo.meaning FROM fnd_lookup_values plc_clo WHERE plc_clo.lookup_code = nvl(agr_header.closed_code, &apos;OPEN&apos;)
              and    plc_clo.lookup_type = &apos;DOCUMENT STATE&apos;
              AND    plc_clo.LANGUAGE = houtl.language)
              ))
              ||
              decode(nvl(agr_header.cancel_flag, &apos;N&apos;), &apos;N&apos;, &apos;&apos;, &apos;&apos;, &apos;&apos;,
			        &apos;, &apos;||decode(agr_header.cancel_flag,&apos;Y&apos;,
              (SELECT plc_can.meaning FROM fnd_lookup_values plc_can WHERE plc_can.lookup_code =&apos;CANCELLED&apos;
               AND plc_can.lookup_type = &apos;DOCUMENT STATE&apos; AND plc_can.LANGUAGE = houtl.language ), NULL))
               ||
               decode(nvl(agr_header.frozen_flag, &apos;N&apos;), &apos;N&apos;, &apos;&apos;, &apos;&apos;, &apos;&apos;,
				       &apos;, &apos;||decode(agr_header.frozen_flag,&apos;Y&apos;, (SELECT plc_fro.meaning FROM fnd_lookup_values plc_fro WHERE plc_fro.lookup_code =&apos;FROZEN&apos;
               AND plc_fro.lookup_type = &apos;DOCUMENT STATE&apos; AND     plc_fro.LANGUAGE = houtl.language ), NULL))
               ||
               decode(nvl(agr_header.user_hold_flag, &apos;N&apos;), &apos;N&apos;, &apos;&apos;, &apos;&apos;, &apos;&apos;,
				       &apos;, &apos;||decode(agr_header.user_hold_flag,&apos;Y&apos;, (SELECT plc_hld.meaning FROM fnd_lookup_values plc_hld WHERE plc_hld.lookup_code =&apos;ON HOLD&apos;
               AND plc_hld.lookup_type = &apos;DOCUMENT STATE&apos; AND     plc_hld.LANGUAGE = houtl.language ), NULL))
               ||
               decode(Nvl(gt.char5,&apos;N&apos;), &apos;N&apos;, &apos;&apos;, &apos;&apos;, &apos;&apos;,
				       &apos;, &apos;||(SELECT flv.meaning
               FROM fnd_lookup_values flv
               WHERE flv.lookup_type = &apos;DOCUMENT STATE&apos;
               AND flv.lookup_code = &apos;RESERVED&apos;
               AND flv.LANGUAGE = houtl.language)) status,
    ap_supplier.vendor_name   supplier,
    (
        SELECT
            apst.vendor_site_code
        FROM
            ap_supplier_sites_all apst
        WHERE
            apst.vendor_site_id = agr_header.vendor_site_id
    ) supplier_site,
     ( SELECT
    pvc.first_name || &apos; &apos;
             || pvc.last_name
         FROM
             po_vendor_contacts pvc
         WHERE
             pvc.vendor_contact_id = agr_header.vendor_contact_id
             AND pvc.vendor_site_id = agr_header.vendor_site_id
     ) agr_supplier_contact,
     agr_header.blanket_total_amount      agr_agreed_amount,
     agr_header.amount_limit              agr_amount_limit,
     gt.num4 agr_amount_released,
     gt.char2 functional_currency_code,
     agr_header.currency_code             currency,
     (
         SELECT
             emp.full_name
         FROM
             per_all_people_f emp
         WHERE
             emp.person_id = agr_header.agent_id
             AND emp.effective_start_date = (
                 SELECT
                     MAX(c.effective_start_date)
                 FROM
                     per_all_people_f c
                 WHERE
                     emp.person_id = c.person_id )
        and rownum &lt;2
     ) buyer_name,
     agr_header.start_date                effective_from,
     agr_header.end_date                  effective_to,
     agr_header.creation_date             creation_date,
     agr_header.approved_date             approval_date,
     agr_header.submit_date               submit_date,
     (SELECT
             at.name
         FROM
             AP_TERMS  at
         WHERE
             at.term_id = agr_header.terms_id
     ) agr_payment_term,
     agr_header.org_id                    org_id,
     houtl.name Operating_Unit,
     gt.num5 as received_amount,
     gt.num6 as invoiced_amount,
     gt.num7 as shipped_amount,
     houtl.language,
    ( CASE
         WHEN ( nvl(agr_header.authorization_status,&apos;INCOMPLETE&apos;) IN (
             &apos;INCOMPLETE&apos;,
             &apos;REQUIRES REAPPROVAL&apos;,
             &apos;REJECTED&apos;
         ) ) THEN po_pcc_agreements_util_pvt.get_fnd_message (&apos;PO_PCC_DRAFT_STATUS&apos;, &apos;201&apos;,houtl.language)
         WHEN ( agr_header.authorization_status IN (
             &apos;IN PROCESS&apos;,
             &apos;PRE-APPROVED&apos;
         )
                OR ((nvl(agr_header.authorization_status,&apos;INCOMPLETE&apos;) = &apos;APPROVED&apos; and nvl(agr_header.pending_signature_flag,&apos;N&apos;) = &apos;Y&apos; and nvl(agr_header.acceptance_required_flag, &apos;N&apos;) &lt;&gt; &apos;P&apos;
              and not exists (select 1 from   PO_ACCEPTANCES
                      where  po_header_id = agr_header.po_header_id and revision_num = agr_header.revision_num
                      and    po_release_id       is null and    po_line_location_id is null
                      and    accepting_party  = &apos;S&apos; and accepted_flag    = &apos;Y&apos; and signature_flag   = &apos;Y&apos;	))
              or (nvl(agr_header.authorization_status,&apos;INCOMPLETE&apos;) = &apos;APPROVED&apos; and Nvl(agr_header.acceptance_required_flag,&apos;N&apos;) IN (&apos;Y&apos;,&apos;D&apos;)
		and NOT EXISTS (SELECT 1 FROM po_acceptances poa WHERE poa.po_header_id=agr_header.po_header_id AND poa.revision_num=agr_header.revision_num)))
         )  THEN po_pcc_agreements_util_pvt.get_fnd_message (&apos;PO_PCC_INPROC_STATUS&apos;, &apos;201&apos;,houtl.language)
         WHEN ( agr_header.closed_code IN (
             &apos;CLOSED&apos;,
             &apos;FINALLY CLOSED&apos;
         )
                OR agr_header.cancel_flag LIKE &apos;Y&apos;
                /*OR agr_header.end_date &lt;= SYSDATE
                OR gt.num4 = agr_header.amount_limit*/ ) THEN   po_pcc_agreements_util_pvt.get_fnd_message (&apos;PO_PCC_CLOSED_STATUS&apos;, &apos;201&apos;,houtl.language)
         WHEN agr_header.po_header_id IS NOT NULL THEN po_pcc_agreements_util_pvt.get_fnd_message (&apos;PO_PCC_OPEN_STATUS&apos;, &apos;201&apos;,houtl.language)
     END ) GROUP_STATUS,
     ( CASE
         WHEN agr_header.closed_code = &apos;FINALLY CLOSED&apos;  THEN po_pcc_agreements_util_pvt.get_fnd_message (&apos;PO_STATUS_FINALLY_CLOSED&apos;, &apos;201&apos;,houtl.language)
         WHEN agr_header.closed_code = &apos;CLOSED&apos;    THEN po_pcc_agreements_util_pvt.get_fnd_message (&apos;PO_STATUS_CLOSED&apos;, &apos;201&apos;,houtl.language)
         WHEN agr_header.cancel_flag = &apos;Y&apos;    THEN po_pcc_agreements_util_pvt.get_fnd_message (&apos;PO_STATUS_CANCELED&apos;, &apos;201&apos;,houtl.language)
         WHEN agr_header.authorization_status IN (
             &apos;REJECTED&apos;
         ) THEN (
             SELECT
                 flv.meaning
             FROM
                 fnd_lookup_values flv
             WHERE
                 flv.lookup_type = &apos;AUTHORIZATION STATUS&apos;
                 AND flv.lookup_code = &apos;REJECTED&apos;
                 AND flv.language= houtl.language
         )
         WHEN nvl(agr_header.authorization_status,&apos;INCOMPLETE&apos;) IN (
             &apos;INCOMPLETE&apos;
         ) THEN (
             SELECT
                 flv.meaning
             FROM
                 fnd_lookup_values flv
             WHERE
                 flv.lookup_type = &apos;AUTHORIZATION STATUS&apos;
                 AND flv.lookup_code = &apos;INCOMPLETE&apos;
                 AND flv.language= houtl.language
         )
         WHEN nvl(agr_header.authorization_status,&apos;INCOMPLETE&apos;) = &apos;APPROVED&apos; and nvl(agr_header.pending_signature_flag,&apos;N&apos;) = &apos;Y&apos; and nvl(agr_header.acceptance_required_flag, &apos;N&apos;) &lt;&gt; &apos;P&apos;
              and not exists (select 1 from   PO_ACCEPTANCES
                      where  po_header_id = agr_header.po_header_id and revision_num = agr_header.revision_num
                      and    po_release_id       is null and    po_line_location_id is null
                      and    accepting_party  = &apos;S&apos; and accepted_flag    = &apos;Y&apos; and signature_flag   = &apos;Y&apos;	)
         THEN po_pcc_agreements_util_pvt.get_fnd_message (&apos;PO_PCC_REQ_SIGN&apos;, &apos;201&apos;,houtl.language)
         WHEN nvl(agr_header.authorization_status,&apos;INCOMPLETE&apos;) = &apos;APPROVED&apos; and Nvl(agr_header.acceptance_required_flag,&apos;N&apos;) IN (&apos;Y&apos;,&apos;D&apos;)
		and NOT EXISTS (SELECT 1 FROM po_acceptances poa WHERE poa.po_header_id=agr_header.po_header_id AND poa.revision_num=agr_header.revision_num)
         THEN po_pcc_agreements_util_pvt.get_fnd_message (&apos;PO_PCC_SUPP_ACK&apos;, &apos;201&apos;,houtl.language)
         WHEN EXISTS (
             SELECT
                 1
             FROM
                 po_distributions_all pda
             WHERE
                 pda.po_header_id = agr_header.po_header_id
                 AND failed_funds_lookup_code LIKE &apos;F%&apos;
         ) THEN po_pcc_agreements_util_pvt.get_fnd_message (&apos;PO_PCC_PEND_FUNDS&apos;, &apos;201&apos;,houtl.language)
         WHEN agr_header.authorization_status IN (
             &apos;PRE-APPROVED&apos;
         ) THEN (
             SELECT
                 flv.meaning
             FROM
                 fnd_lookup_values flv
             WHERE
                 flv.lookup_type = &apos;AUTHORIZATION STATUS&apos;
                 AND flv.lookup_code = &apos;PRE-APPROVED&apos;
                 AND flv.language= houtl.language
         )
         WHEN agr_header.authorization_status IN (
             &apos;IN PROCESS&apos;
         ) THEN po_pcc_agreements_util_pvt.get_fnd_message (&apos;PO_STATUS_IN_PROCESS&apos;, &apos;201&apos;,houtl.language)
         WHEN agr_header.user_hold_flag = &apos;Y&apos;  THEN &apos;On Hold&apos;
         WHEN EXISTS (
             SELECT
                 1
             FROM
                 po_change_requests
             WHERE
                 document_header_id = agr_header.po_header_id
                 AND request_status = &apos;PENDING&apos;
         ) THEN po_pcc_agreements_util_pvt.get_fnd_message (&apos;PO_PCC_PEND_CHG_REQ&apos;, &apos;201&apos;,houtl.language)
         WHEN agr_header.end_date &lt;= SYSDATE    THEN po_pcc_agreements_util_pvt.get_fnd_message (&apos;PO_PCC_END_DATE_REACHED&apos;, &apos;201&apos;,houtl.language)
         WHEN gt.num4 = agr_header.amount_limit  THEN
         po_pcc_agreements_util_pvt.get_fnd_message (&apos;PO_PCC_AMT_LIMIT_REACHED&apos;, &apos;201&apos;,houtl.language)
         WHEN SYSDATE &gt;= agr_header.end_date - 30   THEN po_pcc_agreements_util_pvt.get_fnd_message (&apos;PO_PCC_APPROACH_END_DATE&apos;, &apos;201&apos;,houtl.language)

         WHEN gt.num4 &gt;= ( agr_header.amount_limit * 0.9 ) THEN po_pcc_agreements_util_pvt.get_fnd_message (&apos;PO_PCC_APPROACH_AMT_LIMIT&apos;, &apos;201&apos;,houtl.language)
         WHEN agr_header.frozen_flag = &apos;Y&apos;  THEN po_pcc_agreements_util_pvt.get_fnd_message (&apos;PO_STATUS_FROZEN&apos;, &apos;201&apos;,houtl.language)
        /* WHEN EXISTS (
             SELECT
                 1
             FROM
                 po_buyer_actions
             WHERE
                 trunc(nvl(completion_date,SYSDATE) ) - trunc(target_date) &gt; 0
                 AND status &lt;&gt; &apos;CLOSED&apos;
                 AND entity_type = &apos;PA_HEADER&apos;
                 AND entity_id = agr_header.po_header_id
         ) THEN &apos;Overdue Notes Exist&apos;*/
         ELSE (
             SELECT
                 flv.meaning
             FROM
                  fnd_lookup_values flv
             WHERE
                 flv.lookup_type = &apos;AUTHORIZATION STATUS&apos;
                 AND flv.lookup_code = agr_header.authorization_status
                 AND flv.language= houtl.language
         )
     END ) SUB_STATUS,
     /*(
         SELECT
             next_action_type
         FROM
             (
                 SELECT
                     fnd_look.meaning   next_action_type,
                     entity_id
                 FROM
                     po_buyer_actions pba,
                     fnd_lookup_values fnd_look
                 WHERE
                     entity_type = &apos;PA_HEADER&apos;
                     AND status = &apos;OPEN&apos;
                     AND fnd_look.lookup_type = &apos;PO_BUYER_PA_HEADER_ACTIONS&apos;
                     AND fnd_look.lookup_code = pba.action_type
                     and fnd_look.LANGUAGE=  houtl.language
                     ORDER BY
                     target_date
             )
         WHERE
             entity_id = agr_header.po_header_id
             AND ROWNUM = 1
     )*/ null as NEXT_ACTION_TYPE,
     DECODE(gt.char5,&apos;Y&apos;, (
         SELECT
             polc.meaning
         FROM
             fnd_lookup_values  polc
         WHERE
             polc.lookup_type = &apos;DOCUMENT STATE&apos;
             AND polc.lookup_code = &apos;RESERVED&apos;
             AND polc.language= houtl.language

     ), (
         SELECT
             polc.meaning
         FROM
             fnd_lookup_values polc
         WHERE
             polc.lookup_type = &apos;DOCUMENT STATE&apos;
             AND polc.lookup_code = &apos;NOT RESERVED&apos;
             AND polc.language= houtl.language
     ) ) reservation_status,
     extract(YEAR from agr_header.creation_date) CREATION_YEAR,
     to_char(agr_header.creation_date,&apos;Month&apos;) creation_month,

     (CASE WHEN
	      agr_header.authorization_status = &apos;APPROVED&apos;
       AND Nvl(agr_header.closed_code, &apos;OPEN&apos;) &lt;&gt; &apos;FINALLY CLOSED&apos;
       AND Nvl(agr_header.cancel_flag, &apos;N&apos;) = &apos;N&apos;
       AND Nvl(agr_header.frozen_flag, &apos;N&apos;) = &apos;N&apos;
       AND    ((gt.num4 &gt;= ( agr_header.amount_limit * 0.9 )) )
       OR     (gt.num4 = agr_header.amount_limit)
    THEN  &apos;Yes&apos;
	ELSE &apos;No&apos;
   END ) AGREEMENTS_TO_WATCH,

(
CASE WHEN
           agr_header.authorization_status = &apos;APPROVED&apos;
       AND Nvl(agr_header.closed_code, &apos;OPEN&apos;) &lt;&gt; &apos;FINALLY CLOSED&apos;
       AND Nvl(agr_header.cancel_flag, &apos;N&apos;) = &apos;N&apos;
       AND Nvl(agr_header.frozen_flag, &apos;N&apos;) = &apos;N&apos;
       AND ((SYSDATE &gt;= agr_header.end_date - 30)
        OR (agr_header.end_date &lt;= SYSDATE)) THEN
      &apos;Yes&apos;
      ELSE
      &apos;No&apos;
      END

) as  EXPIRING_AGREEMENTS,

doc_style.style_name AGR_STYLE ,
     CASE
                            WHEN (agr_header.currency_code IS NULL   OR gt.char2 = agr_header.currency_code) THEN
                            agr_header.blanket_total_amount
                            ELSE nvl(agr_header.rate,1)*agr_header.blanket_total_amount
                     END AS amount_agreed_func,
    CASE
                            WHEN ( agr_header.currency_code IS NULL  OR gt.char2 = agr_header.currency_code) THEN gt.num4
                            ELSE nvl(agr_header.rate,1)*gt.num4
                     END AS released_amount_func,
                     agr_header.authorization_status,
                     decode(agr_header.type_lookup_code,&apos;CONTRACT&apos;,po_pcc_agreements_util_pvt.get_fnd_message (&apos;PO_CONTRACT_AGREEMENT&apos;, &apos;201&apos;,houtl.language),
                                                                     po_pcc_agreements_util_pvt.get_fnd_message (&apos;PO_BLANKET_PO&apos;, &apos;201&apos;,houtl.language)) document_type,

  case
     when agr_header.blanket_total_amount is not null and agr_header.blanket_total_amount &gt;0 then
       (gt.num4/agr_header.blanket_total_amount)*100
    else
      null end as utilization_percentage,
      gt.char3  DOC_AUTHORIZED_USER_IDS ,
      GT.CHAR4 SECURITY_LEVEL_CODE,
      agr_header.type_lookup_code,
   agr_header.vendor_id supplier_id,  DFV_L.*, 
  agr_line.po_line_id                  agreement_line,
  agr_line.line_num                    line_number,
     (
         SELECT
             line_type
         FROM
             po_line_types_tl lt
         WHERE
             lt.line_type_id = agr_line.line_type_id
             AND lt.language  = houtl.language
     ) line_type,
     mtl_sys_item.concatenated_segments   item,
     agr_line.item_description,
     mtl_cat_kfv.concatenated_segments    category,
     agr_line.unit_meas_lookup_code       uom,
     agr_line.unit_price                  unit_price,
     DECODE( NVL(agr_line.closed_code, &apos;OPEN&apos;),
               &apos;OPEN&apos;, po_pcc_agreements_util_pvt.get_fnd_message(&apos;PO_OPEN&apos;, &apos;201&apos;,houtl.language),
               &apos;CLOSED FOR RECEIVING&apos;, po_pcc_agreements_util_pvt.get_fnd_message(&apos;PO_STATUS_CLOSED&apos;, &apos;201&apos;,houtl.language),
               po_pcc_agreements_util_pvt.get_fnd_message (&apos;PO_STATUS_CLOSED&apos;, &apos;201&apos;,houtl.language)) line_status	,

     agr_attr_values.lead_time            lead_time,
     (SELECT Count(1)
                   FROM po_line_locations_all pll
                   WHERE pll.po_line_id = agr_line.po_line_id
  )  	no_price_breaks,

  (SELECT document_number FROM pon_auction_headers_all paha
  WHERE paha.auction_header_id= agr_line.auction_header_id) negotiation,
 /* (SELECT
                LISTAGG(poh.segment1,&apos;|&apos;) WITHIN GROUP  (ORDER BY nvl(pla.from_header_id,pla.contract_id)) AS order_num
                  FROM
                  po_lines_all pla,
                  po_headers_all poh
                WHERE
                  nvl(pla.from_header_id,pla.contract_id) = agr_header.po_header_id
                  AND poh.po_header_id=pla.po_header_id
                  GROUP BY nvl(pla.from_header_id,pla.contract_id))*/ null AS ORDER_num,

    po_order_lines.Released_Quantity,
    po_order_lines.Shipped_Quantity,
    po_order_lines.Received_Quantity,
    po_order_lines.Rejected_Quantity,
    po_order_lines.Invoiced_Quantity,
    po_line_rel_amt.line_released_amount ,
    po_order_lines.line_received_amount,
    po_order_lines.line_invoiced_amount,
    po_order_lines.line_shipped_amount,

     (
         SELECT
             DECODE(flv.lookup_code,&apos;APPROVED&apos;, (CASE
                 WHEN agr_header.closed_code = &apos;CLOSED&apos;         THEN &apos;PO_STATUS_CLOSED&apos;
                 WHEN agr_header.closed_code = &apos;FINALLY CLOSED&apos; THEN &apos;PO_STATUS_FINALLY_CLOSED&apos;
                 WHEN nvl(agr_header.cancel_flag,&apos;N&apos;) = &apos;Y&apos;    THEN &apos;PO_STATUS_CANCELED&apos;
                 WHEN nvl(agr_header.frozen_flag,&apos;N&apos;) = &apos;Y&apos;    THEN &apos;PO_STATUS_FROZEN&apos;
                 WHEN nvl(agr_header.user_hold_flag,&apos;N&apos;) = &apos;Y&apos; THEN &apos;PO_STATUS_ON_HOLD&apos;
                 ELSE flv.lookup_code
             END),flv.lookup_code)
         FROM
             fnd_lookup_values_vl flv
         WHERE
             nvl(agr_header.authorization_status,&apos;INCOMPLETE&apos;) = flv.lookup_code
             AND flv.lookup_type = &apos;AUTHORIZATION STATUS&apos;
             AND agr_header.po_header_id IS NOT NULL
     ) agreement_status_code,

     agr_line.vendor_product_num          SUPPLIER_ITEM_NUM,
     deliverable.deliverable_id okc_deliverable_id ,
   deliverable.deliverable_name  okc_deliverable_name,
   (SELECT deliverabletypes_tl.name
           FROM okc_deliverable_types_tl  deliverabletypes_tl
           WHERE deliverabletypes_tl.deliverable_type_code=deliverable.deliverable_type
             AND deliverabletypes_tl.LANGUAGE = houtl.LANGUAGE)
             okc_deliverable_type,
    (SELECT busdoc_tl.name FROM
            okc_bus_doc_types_tl busdoc_tl
          WHERE  deliverable.business_document_type = busdoc_tl.document_type
          AND busdoc_tl.language = houtl.LANGUAGE) AS okc_business_document_type,
          deliverable.business_document_type okc_doc_type_code,
   deliverable.business_document_number   okc_business_doc_number,
   (select name
	 from okc_resp_parties_vl  okc_resp_party
	 where okc_resp_party.resp_party_code=deliverable.responsible_party
	 and okc_resp_party.document_type_class = &apos;PO&apos;)   responsible_party,
   (CASE
     WHEN deliverable.responsible_party = &apos;INTERNAL_ORG&apos; THEN
		(SELECT EMPLOYEE.FULL_NAME CONTACT_NAME
		 FROM PER_ALL_PEOPLE_F EMPLOYEE
		 WHERE EMPLOYEE.EFFECTIVE_START_DATE = EMPLOYEE.START_DATE
		 AND EMPLOYEE.PERSON_ID = deliverable.INTERNAL_PARTY_CONTACT_ID
		 AND ROWNUM &lt;2)
	ELSE
     (select  hpcontact.party_name  FROM
     hz_parties hpcontact WHERE
     deliverable.external_party_contact_id = hpcontact.party_id)
    END
    )   okc_party_contact,
    deliverable.actual_due_date  due_date,
    (select meaning
	   from  fnd_lookup_values fnd_lookup
	   where fnd_lookup.lookup_code = deliverable.deliverable_status
	   and fnd_lookup.lookup_type = &apos;OKC_DELIVERABLE_STATUS&apos;
     AND fnd_lookup.language = houtl.language )  deliverable_status,
     DECODE(nvl(agr_header.cancel_flag,&apos;N&apos;),&apos;Y&apos;,PO_PON_ECC_UTIL_PVT.get_fnd_message (&apos;PO_YES&apos;, &apos;201&apos;,houtl.language),
            PO_PON_ECC_UTIL_PVT.get_fnd_message (&apos;PO_NO&apos;, &apos;201&apos;,houtl.language)) CANCEL_FLAG,
     DECODE(nvl(agr_header.acceptance_required_flag,&apos;N&apos;),&apos;Y&apos;,PO_PON_ECC_UTIL_PVT.get_fnd_message (&apos;PO_YES&apos;, &apos;201&apos;,houtl.language),
            PO_PON_ECC_UTIL_PVT.get_fnd_message (&apos;PO_NO&apos;, &apos;201&apos;,houtl.language)) acceptance_required_flag
FROM
    po_headers_all agr_header,
    po_doc_style_headers doc_style,
    ap_suppliers ap_supplier,
    hr_all_organization_units_tl houtl,
    po_session_gt gt,  ( select &quot;ROW_ID&quot; &quot;&apos;PO_ORD_H_ROW_ID&apos;&quot;,&quot;CONTEXT&quot; &quot;&apos;PO_ORD_H_CONTEXT&apos;&quot;,&quot;CONCATENATED_SEGMENTS&quot; &quot;&apos;PO_ORD_H_CONCATENATED_SEGMENTS&apos;&quot; from ( select ROWID &quot;ROW_ID&quot;,ATTRIBUTE_CATEGORY &quot;CONTEXT&quot;,NULL &quot;CONCATENATED_SEGMENTS&quot; from PO_HEADERS_ALL ) ) DFV_H, 

    po_lines_all agr_line,
    po_attribute_values agr_attr_values,
    mtl_categories_kfv mtl_cat_kfv,
    mtl_system_items_b_kfv mtl_sys_item,
    financials_system_params_all fsp,  ( select &quot;ROW_ID&quot; &quot;&apos;PO_ORD_L_ROW_ID&apos;&quot;,&quot;CONTEXT&quot; &quot;&apos;PO_ORD_L_CONTEXT&apos;&quot;,&quot;ATTRIBUTE_13&quot; &quot;&apos;PO_ORD_L_ATTRIBUTE_13&apos;&quot;,&quot;ATTRIBUTE_3&quot; &quot;&apos;PO_ORD_L_ATTRIBUTE_3&apos;&quot;,&quot;ORDER_SEQUENCE&quot; &quot;&apos;PO_ORD_L_ORDER_SEQUENCE&apos;&quot;,&quot;CONCATENATED_SEGMENTS&quot; &quot;&apos;PO_ORD_L_CONCATENATED_SEGMENTS&apos;&quot; from ( select ROWID &quot;ROW_ID&quot;,ATTRIBUTE_CATEGORY &quot;CONTEXT&quot;,ATTRIBUTE13 &quot;ATTRIBUTE_13&quot;,ATTRIBUTE3 &quot;ATTRIBUTE_3&quot;,(DECODE(ATTRIBUTE_CATEGORY,&apos;2052&apos;,ATTRIBUTE1,NULL)) &quot;ORDER_SEQUENCE&quot;,ATTRIBUTE13||&apos;.&apos;||ATTRIBUTE3||&apos;.&apos;||(DECODE(ATTRIBUTE_CATEGORY,&apos;2052&apos;,ATTRIBUTE_CATEGORY||&apos;.&apos;||ATTRIBUTE1,NULL)) &quot;CONCATENATED_SEGMENTS&quot; from PO_LINES_ALL ) ) DFV_L, 
    okc_deliverables deliverable,
    (SELECT
po_line.from_line_id AS order_from_line_id,
Sum(plla.quantity) Released_Quantity,
Sum(plla.quantity_shipped) Shipped_Quantity,
Sum(plla.quantity_received) Received_Quantity,
Sum(plla.quantity_rejected) Rejected_Quantity,
Sum(plla.quantity_billed ) Invoiced_Quantity,
Sum(DECODE(plla.matching_basis,&apos;AMOUNT&apos;,nvl(plla.amount_received, 0),
	                Nvl(po_line.unit_price*plla.quantity_received, 0))) line_received_amount,
Sum(DECODE(plla.matching_basis,&apos;AMOUNT&apos;,nvl(plla.amount_billed, 0),
	                Nvl(po_line.unit_price*plla.quantity_billed, 0))) line_invoiced_amount,
Sum(DECODE(plla.matching_basis,&apos;AMOUNT&apos;,nvl(plla.amount_shipped, 0),
	                    Nvl(po_line.unit_price*plla.quantity_shipped, 0))) line_shipped_amount

FROM

po_lines_all po_line,
po_line_locations_all  plla
WHERE
po_line.creation_date &gt;= nvl(to_date(to_char(to_timestamp(&apos;&apos;),&apos;DD-MON-YY HH24.MI.SS&apos;),&apos;DD-MON-YY HH24.MI.SS&apos;) ,po_line.creation_date)
and plla.po_line_id=po_line.po_line_id
AND Nvl(plla.consigned_flag,&apos;N&apos;) &lt;&gt; &apos;Y&apos;
GROUP BY po_line.from_line_id
) po_order_lines,
(SELECT
      pol.from_line_id,
      sum (decode(pol.quantity, null,
		             (pod.amount_ordered -
                             pod.amount_cancelled),
		             (( pod.quantity_ordered
                             - pod.quantity_cancelled )
		             * poll.price_override)
			    )
		     ) line_released_amount
        FROM      po_distributions_all    pod,
                  po_line_locations_all   poll,
                  po_lines_all            pol
        WHERE   pol.creation_date &gt;= nvl(to_date(to_char(to_timestamp(&apos;&apos;),&apos;DD-MON-YY HH24.MI.SS&apos;),&apos;DD-MON-YY HH24.MI.SS&apos;),pol.creation_date)

        and       pod.line_location_id = poll.line_location_id
        AND       poll.po_line_id = pol.po_line_id
        AND       Nvl(poll.consigned_flag,&apos;N&apos;) &lt;&gt; &apos;Y&apos;
  group by pol.from_line_id) po_line_rel_amt
WHERE
    gt.key = 3332545
    AND agr_header.po_header_id = gt.index_num1
    AND agr_header.vendor_id = ap_supplier.vendor_id (+)
    AND doc_style.style_id = agr_header.style_id
    AND houtl.organization_id (+) = agr_header.org_id
    AND houtl.language IN (&apos;US&apos;)  AND agr_header.rowid = dfv_h.&quot;&apos;PO_ORD_H_ROW_ID&apos;&quot; (+) 
    AND agr_line.po_line_id (+) = gt.index_num2
    AND agr_line.po_line_id = agr_attr_values.po_line_id (+)
    AND agr_line.category_id = mtl_cat_kfv.category_id (+)
    AND agr_line.item_id = mtl_sys_item.inventory_item_id (+)
    AND agr_header.org_id = fsp.org_id (+)
    AND nvl(nvl(mtl_sys_item.organization_id,fsp.inventory_organization_id),-99) = nvl(fsp.inventory_organization_id,-99)
    AND po_order_lines.order_from_line_id(+)=gt.index_num2
    and po_line_rel_amt.from_line_id(+)= gt.index_num2   AND agr_line.rowid = dfv_l.&quot;&apos;PO_ORD_L_ROW_ID&apos;&quot; (+) 
    AND deliverable.deliverable_id (+) = gt.num3 )
    PIVOT (max(operating_unit) as operating_unit,
        max(GROUP_STATUS) as GROUP_STATUS,
        max(SUB_STATUS) as SUB_STATUS,
        max(NEXT_ACTION_TYPE) as NEXT_ACTION_TYPE,
        max(reservation_status) as reservation_status,
        max(document_type) as document_type,
        max(status) as status,
        max(line_type) as line_type ,
        max(line_status) as line_status,
        max(deliverable_status) as deliverable_status,
        max(okc_deliverable_type) as okc_deliverable_type,
        max(okc_business_document_type) okc_business_document_type,
        max(cancel_flag) as cancel_flag,
        max(acceptance_required_flag) as acceptance_required_flag
 for LANGUAGE in (&apos;US&apos; &quot;US&quot;))
) x
where
2=2</SQL_TEXT>
  <ENABLED>Y</ENABLED>
  <REPORT_TRANSLATIONS>
   <REPORT_TRANSLATIONS_ROW>
    <LANGUAGE>AR</LANGUAGE>
    <REPORT_NAME>ECC الشراء, الاتفاقيات</REPORT_NAME>
    <DESCRIPTION>Imported from Enterprise Command Center
Dataset Key: po-pcc-agreements
Query Procedure: po_pcc_agreements_util_pvt.get_ecc_data_load_info
Security Procedure: PO_PCC_DATASECURITY_PKG_PUB.GetFilterAttributeValuesPO</DESCRIPTION>
   </REPORT_TRANSLATIONS_ROW>
   <REPORT_TRANSLATIONS_ROW>
    <LANGUAGE>D</LANGUAGE>
    <REPORT_NAME>ECC Beschaffung, Rahmenverträge</REPORT_NAME>
    <DESCRIPTION>Imported from Enterprise Command Center
Dataset Key: po-pcc-agreements
Query Procedure: po_pcc_agreements_util_pvt.get_ecc_data_load_info
Security Procedure: PO_PCC_DATASECURITY_PKG_PUB.GetFilterAttributeValuesPO</DESCRIPTION>
   </REPORT_TRANSLATIONS_ROW>
   <REPORT_TRANSLATIONS_ROW>
    <LANGUAGE>E</LANGUAGE>
    <REPORT_NAME>ECC Procurement, Acuerdos</REPORT_NAME>
    <DESCRIPTION>Imported from Enterprise Command Center
Dataset Key: po-pcc-agreements
Query Procedure: po_pcc_agreements_util_pvt.get_ecc_data_load_info
Security Procedure: PO_PCC_DATASECURITY_PKG_PUB.GetFilterAttributeValuesPO</DESCRIPTION>
   </REPORT_TRANSLATIONS_ROW>
   <REPORT_TRANSLATIONS_ROW>
    <LANGUAGE>F</LANGUAGE>
    <REPORT_NAME>ECC Procurement, Accords</REPORT_NAME>
    <DESCRIPTION>Imported from Enterprise Command Center
Dataset Key: po-pcc-agreements
Query Procedure: po_pcc_agreements_util_pvt.get_ecc_data_load_info
Security Procedure: PO_PCC_DATASECURITY_PKG_PUB.GetFilterAttributeValuesPO</DESCRIPTION>
   </REPORT_TRANSLATIONS_ROW>
   <REPORT_TRANSLATIONS_ROW>
    <LANGUAGE>I</LANGUAGE>
    <REPORT_NAME>ECC Procurement, Accordi</REPORT_NAME>
    <DESCRIPTION>Imported from Enterprise Command Center
Dataset Key: po-pcc-agreements
Query Procedure: po_pcc_agreements_util_pvt.get_ecc_data_load_info
Security Procedure: PO_PCC_DATASECURITY_PKG_PUB.GetFilterAttributeValuesPO</DESCRIPTION>
   </REPORT_TRANSLATIONS_ROW>
   <REPORT_TRANSLATIONS_ROW>
    <LANGUAGE>JA</LANGUAGE>
    <REPORT_NAME>ECC 調達, 基本契約</REPORT_NAME>
    <DESCRIPTION>Imported from Enterprise Command Center
Dataset Key: po-pcc-agreements
Query Procedure: po_pcc_agreements_util_pvt.get_ecc_data_load_info
Security Procedure: PO_PCC_DATASECURITY_PKG_PUB.GetFilterAttributeValuesPO</DESCRIPTION>
   </REPORT_TRANSLATIONS_ROW>
   <REPORT_TRANSLATIONS_ROW>
    <LANGUAGE>KO</LANGUAGE>
    <REPORT_NAME>ECC 조달, 계약</REPORT_NAME>
    <DESCRIPTION>Imported from Enterprise Command Center
Dataset Key: po-pcc-agreements
Query Procedure: po_pcc_agreements_util_pvt.get_ecc_data_load_info
Security Procedure: PO_PCC_DATASECURITY_PKG_PUB.GetFilterAttributeValuesPO</DESCRIPTION>
   </REPORT_TRANSLATIONS_ROW>
   <REPORT_TRANSLATIONS_ROW>
    <LANGUAGE>RU</LANGUAGE>
    <REPORT_NAME>ECC Закупки, Соглашения</REPORT_NAME>
    <DESCRIPTION>Imported from Enterprise Command Center
Dataset Key: po-pcc-agreements
Query Procedure: po_pcc_agreements_util_pvt.get_ecc_data_load_info
Security Procedure: PO_PCC_DATASECURITY_PKG_PUB.GetFilterAttributeValuesPO</DESCRIPTION>
   </REPORT_TRANSLATIONS_ROW>
   <REPORT_TRANSLATIONS_ROW>
    <LANGUAGE>S</LANGUAGE>
    <REPORT_NAME>ECC Inköp, Avtal</REPORT_NAME>
    <DESCRIPTION>Imported from Enterprise Command Center
Dataset Key: po-pcc-agreements
Query Procedure: po_pcc_agreements_util_pvt.get_ecc_data_load_info
Security Procedure: PO_PCC_DATASECURITY_PKG_PUB.GetFilterAttributeValuesPO</DESCRIPTION>
   </REPORT_TRANSLATIONS_ROW>
   <REPORT_TRANSLATIONS_ROW>
    <LANGUAGE>TR</LANGUAGE>
    <REPORT_NAME>ECC Tedarik, Anlaşmalar</REPORT_NAME>
    <DESCRIPTION>Imported from Enterprise Command Center
Dataset Key: po-pcc-agreements
Query Procedure: po_pcc_agreements_util_pvt.get_ecc_data_load_info
Security Procedure: PO_PCC_DATASECURITY_PKG_PUB.GetFilterAttributeValuesPO</DESCRIPTION>
   </REPORT_TRANSLATIONS_ROW>
   <REPORT_TRANSLATIONS_ROW>
    <LANGUAGE>US</LANGUAGE>
    <REPORT_NAME>ECC Procurement, Agreements</REPORT_NAME>
    <DESCRIPTION>Imported from Enterprise Command Center
Dataset Key: po-pcc-agreements
Query Procedure: po_pcc_agreements_util_pvt.get_ecc_data_load_info
Security Procedure: PO_PCC_DATASECURITY_PKG_PUB.GetFilterAttributeValuesPO</DESCRIPTION>
   </REPORT_TRANSLATIONS_ROW>
   <REPORT_TRANSLATIONS_ROW>
    <LANGUAGE>ZHS</LANGUAGE>
    <REPORT_NAME>ECC Procurement, 协议</REPORT_NAME>
    <DESCRIPTION>Imported from Enterprise Command Center
Dataset Key: po-pcc-agreements
Query Procedure: po_pcc_agreements_util_pvt.get_ecc_data_load_info
Security Procedure: PO_PCC_DATASECURITY_PKG_PUB.GetFilterAttributeValuesPO</DESCRIPTION>
   </REPORT_TRANSLATIONS_ROW>
  </REPORT_TRANSLATIONS>
  <CATEGORY_ASSIGNMENTS>
   <CATEGORY_ASSIGNMENTS_ROW>
    <CATEGORY>Enterprise Command Center</CATEGORY>
   </CATEGORY_ASSIGNMENTS_ROW>
  </CATEGORY_ASSIGNMENTS>
  <ANCHORS>
  </ANCHORS>
  <PARAMETERS>
   <PARAMETERS_ROW>
    <SORT_ORDER>1</SORT_ORDER>
    <DISPLAY_SEQUENCE>10</DISPLAY_SEQUENCE>
    <ANCHOR>2=2</ANCHOR>
    <SQL_TEXT>x.org_id in (select haouv.organization_id from hr_all_organization_units_vl haouv where 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>
    <DEFAULT_VALUE>select haouv.name from hr_all_organization_units_vl haouv where haouv.organization_id=nvl((select mgoat.organization_id from mo_glob_org_access_tmp mgoat where mgoat.organization_id=nvl(fnd_profile.value(&apos;DEFAULT_ORG_ID&apos;),mgoat.organization_id) and rownum=1),fnd_global.org_id)</DEFAULT_VALUE>
    <PARAMETER_TRANSLATIONS>
     <PARAMETER_TRANSLATIONS_ROW>
      <LANGUAGE>US</LANGUAGE>
      <PARAMETER_NAME>Operating Unit</PARAMETER_NAME>
     </PARAMETER_TRANSLATIONS_ROW>
    </PARAMETER_TRANSLATIONS>
   </PARAMETERS_ROW>
  </PARAMETERS>
  <PARAMETER_DEPENDENCIES>
  </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>
