Q1
Q1
jib_number
, xajch.jib_date
, xajch.jib_period
, xajch.payment_voucher_no "AP Voucher Number"
, flv.DESCRIPTION
, flv.DESCRIPTION
|| '.'
|| xajmth.department
|| '.'
|| xajcl.ACCOUNT
|| '.'
|| NVL (xajcl.well_number, '000000')
|| '.'
|| '000000'
|| '.'
|| '000000' "Account Code Combination"
, descp.description
, SUM (xajcl.gross_amount) gross_amount
, SUM (xajcl.net_amount) net_amount
, xajcl.afe "System AFE Number"
, operator_number.operator_afe_num operator_number
, operator_number.operator_afe_num_actul -- satin
, xajcl.ACCOUNT
FROM xxkuf_ap_jib_mstr_tmplt_hdr_v xajmth
, xxkuf_ap_jib_capture_lin_v xajcl
, xxkuf_ap_jib_capture_hdr_v xajch
, (SELECT LOOKUP_CODE, MEANING, DESCRIPTION
FROM fnd_lookup_values
WHERE lookup_type = 'XX_JIB_PROJECT_MAPPING'
AND NVL (end_date_active, SYSDATE) >= SYSDATE
AND NVL (LANGUAGE, USERENV ('LANG')) = USERENV ('LANG')
AND enabled_flag = 'Y'
AND SYSDATE BETWEEN start_date_active
AND NVL (end_date_active, SYSDATE + 1)) flv
, (SELECT ffv.flex_value
, ffvt.description
FROM fnd_flex_values_tl ffvt
, fnd_flex_values ffv
, fnd_flex_value_sets ffvs
WHERE 1 = 1
AND ffvt.flex_value_id = ffv.flex_value_id
AND ffv.flex_value_set_id = ffvs.flex_value_set_id
AND NVL (ffvt.LANGUAGE, USERENV ('LANG')) = USERENV ('LANG')
AND ffvs.flex_value_set_name = 'KUFPEC_ACCOUNT') descp
, (SELECT DISTINCT pha.segment1 || '-' || pra.release_num
system_afe_num
, (SELECT vendor_product_num
FROM po_lines_all
WHERE po_header_id = pha.po_header_id
AND ROWNUM < 2) operator_afe_num
, pha.comments operator_afe_num_actul -- Satin
, gcc.segment3
, assa.vendor_site_code
FROM po_headers_all pha
, po_releases_all pra
, po_lines_all pla
, po_distributions_all pda
, ap_supplier_sites_all assa
, gl_code_combinations gcc
WHERE 1 = 1
AND pla.po_header_id = pha.po_header_id
AND pla.po_line_id = pda.po_line_id
AND pha.po_header_id = pda.po_header_id
AND pra.po_release_id = pda.po_release_id
AND pra.po_header_id = pha.po_header_id
AND gcc.code_combination_id = pda.code_combination_id
AND assa.vendor_site_id = pha.vendor_site_id
AND pha.authorization_status = 'APPROVED') operator_number
WHERE 1 = 1
and flv.LOOKUP_CODE = xajmth.project_code
AND xajcl.ACCOUNT = descp.flex_value
AND xajch.jib_tmplt_hdr_id = xajmth.jib_tmplt_hdr_id
AND xajcl.jib_cptr_hdr_id = xajch.jib_cptr_hdr_id
AND operator_number.system_afe_num(+) = xajcl.afe
AND xajmth.jib_tmplt_hdr_id =
NVL (:p_project_code, xajmth.jib_tmplt_hdr_id)
--221
AND xajmth.vendor_site_code = NVL (:p_operator, xajmth.vendor_site_code)
--4
AND xajch.jib_period = NVL (:p_jib_period, xajch.jib_period)
--''NOV-2010'
--satin
-- and xajch.CREATED_BY = fu1.USER_ID
-- and xajch.LAST_UPDATE_by = fu2.user_id
-- and fu1.EMPLOYEE_ID = papf1.person_id
-- and fu2.EMPLOYEE_ID = papf2.person_id
-- satin
GROUP BY xajch.jib_number
, xajch.jib_date
, xajch.jib_period
, xajch.payment_voucher_no
, flv.DESCRIPTION
, flv.DESCRIPTION
|| '.'
|| xajmth.department
|| '.'
|| xajcl.ACCOUNT
|| '.'
|| NVL (xajcl.well_number, '000000')
|| '.'
|| '000000'
|| '.'
|| '000000'
, descp.description
, xajcl.afe
, operator_number.operator_afe_num
, operator_number.operator_afe_num_actul
, xajcl.ACCOUNT
--, xajch.CREATED_BY
--, fu1.USER_NAME
--, papf1.full_name
--, xajch.LAST_UPDATE_by
--, fu2.USER_NAME
--, papf2.full_name
ORDER BY xajcl.afe DESC, xajcl.ACCOUNT