Friday, 23 September 2011

ALL MODULES STANDARD REQUEST NAMES

Assets
The following reports are available in the MRC Programs FA request group:
Payables
The following reports are available in the MRC Programs AP request group:
The following program is available in the MRC Programs AP request group:
Receivables
The following reports are available in the MRC Programs AR request group:
Purchasing
The following reports are available in the MRC Programs PO request group:
Projects
The following reports are available in the MRC Programs PA Billing request group:
ü AUD: Pre-Approved Expenditures Entry Audit
ü AUD: Project Expenditures Adjustment Activity
ü AUD: Project Sub-ledger Summary
ü AUD: Project Sub-ledger: Detail by Project
ü AUD: Project Sub-ledger: Detail by Expenditure Types
ü MGT: Employee Activity by Organization
The following reports are available in the MRC Programs PA Costing request group:
ü AUD: Project Sub-ledger: Detail by Project
ü MGT: Transfer Activity Report

Friday, 16 September 2011

po_report TO_SUPPLIERS

function CF_5Formula return Char is
a varchar2(25);
 v_short_long varchar2(5000);

begin
 SELECT datatype_name into a
FROM FND_ATTACHED_DOCS_FORM_VL a
WHERE FUNCTION_NAME=DECODE(0,1,NULL,'PO_POXPOVPO') AND
FUNCTION_TYPE=DECODE(0,1,NULL,'F') AND
(SECURITY_TYPE=1 OR
PUBLISH_FLAG='Y' OR
(SECURITY_TYPE=1 AND SECURITY_ID= fnd_profile.VALUE ('ORG_ID') )) AND
((ENTITY_NAME= 'PO_HEADERS' AND PK1_VALUE = :po_header_id  ) OR
(ENTITY_NAME= 'PO_VENDORS' ))
order by user_entity_name, seq_num;

if a =  'Short Text' then
SELECT SHORT_TEXT into v_short_long
FROM FND_ATTACHED_DOCS_FORM_VL a,FND_DOCUMENTS_SHORT_TEXT b
WHERE 1= 1
and a.MEDIA_ID = b.MEDIA_ID
and  FUNCTION_NAME=DECODE(0,1,NULL,'PO_POXPOVPO') AND
FUNCTION_TYPE=DECODE(0,1,NULL,'F') AND
(SECURITY_TYPE=1 OR
PUBLISH_FLAG='Y' OR
(SECURITY_TYPE=1 AND SECURITY_ID= fnd_profile.VALUE ('ORG_ID'))) AND
((ENTITY_NAME= 'PO_HEADERS' AND PK1_VALUE =:po_header_id ) OR
(ENTITY_NAME= 'PO_VENDORS' ))
order by user_entity_name, seq_num;
elsif a =  'Long Text' then
SELECT LONG_TEXT into v_short_long
FROM FND_ATTACHED_DOCS_FORM_VL a,FND_DOCUMENTS_LONG_TEXT b
WHERE 1= 1
and a.MEDIA_ID = b.MEDIA_ID
and  FUNCTION_NAME=DECODE(0,1,NULL,'PO_POXPOVPO') AND
FUNCTION_TYPE=DECODE(0,1,NULL,'F') AND
(SECURITY_TYPE=1 OR
PUBLISH_FLAG='Y' OR
(SECURITY_TYPE=1 AND SECURITY_ID= fnd_profile.VALUE ('ORG_ID'))) AND
((ENTITY_NAME= 'PO_HEADERS' AND PK1_VALUE =:po_header_id ) OR
(ENTITY_NAME= 'PO_VENDORS' ))
order by user_entity_name, seq_num;
END IF;
return v_short_long;
end;

Tuesday, 13 September 2011

gl to flex link(segments)

SELECT   DECODE (gcc.segment1,
                 '10', 'APIL - HO - 10',
                 '20', 'APIL - BPU UNIT - 20',
                 '21', 'APIL - BPU UNIT - 21',
                 '30', 'APIL - SHREE GOPAL UNIT - 30',
                 '40', 'APIL - SEWA UNIT - 40',
                 '50', 'APIL - BWN - 50',
                 '51', 'APIL - BWN - 51'
                ) operating_unit,
         ffv.flex_value_meaning natural_acct, ffv.description acct_desc
    FROM gl_code_combinations gcc, fnd_flex_values_vl ffv
   WHERE gcc.segment3 = ffv.flex_value
     AND ffv.flex_value_set_id = 1014870
     AND ffv.end_date_active IS NOT NULL
--   or AND ffv.END_DATE_ACTIVE IS NULL
     AND gcc.segment1 IN ('10', '20', '21', '30', '40', '50', '51')
ORDER BY TO_NUMBER (gcc.segment1)

Thursday, 8 September 2011

PO_TAX_REPORT

SELECT   DISTINCT
           ph.segment1,
           PH.ORG_ID,
           pv.segment1 "Vendor Code ",
           ph.po_header_id,
           pll.ship_to_organization_id,
           pv.vendor_name "VENDOR NAME ",
           pvs.address_line1 "Supplier_Address1",
           pvs.address_line2 "Supplier_Address2",
           pvs.city "CITY ",
           pvs.state "STATE ",
           pvs.zip "PIN CODE ",
           (pvc.first_name || pvc.last_name) "Supplier's  Contact Person ",
           pvs.phone "Mobile No. / Phone No",
           pvc.fax "Fax no. ",
           pvc.email_address "EMAIL ID ",
           (ph.segment1 || '/' || ph.revision_num) "PO/REV No.",
           ph.creation_date "Date of PO ",
           (prel.release_num || '/' || ph.revision_num) "Rel/REV No.",
           ph.attribute1 "Your Ref ",
           ph.currency_code "Currency ",
           ppf.full_name "Buyer Name ",
           UPPER (h.address_line_1) OU_Address1,
           UPPER (h.address_line_2) OU_Address2,
           (SELECT   a.segment1
              FROM   po_requisition_headers_all a,
                     po_requisition_lines_all b,
                     po_req_distributions_all c
             WHERE   a.requisition_header_id(+) = b.requisition_header_id
                     AND b.requisition_line_id(+) = c.requisition_line_id
                     AND c.distribution_id IN
                              (SELECT   B.req_distribution_id
                                 FROM   PO_HEADERS_ALL A,
                                        PO_DISTRIBUTIONS_ALL B
                                WHERE       A.PO_HEADER_ID = PH.PO_HEADER_ID
                                        AND A.PO_HEADER_ID = B.PO_HEADER_ID
                                        AND ROWNUM = 1
                                        AND B.req_distribution_id IS NOT NULL)
                     AND ROWNUM = 1)
              "PR No.",
           h.town_or_city "CITY /STATE",
           h.telephone_number_1 "PHONE No./ Fax no.",
           ph.NOTE_TO_VENDOR,
           --           term.name,
           FLV1.MEANING Delivery_Terms,
           FLV2.MEANING Freight,
           PH.SHIP_VIA_LOOKUP_CODE Carrier,
           -----------------------------------------Payment_terms, test elango
           term.name "PAYMENT TERMS",
           ppf.first_name,
           CMN.cst_reg_no "CST No",
           CMN.vat_reg_no "VAT/ TIN No.",
           cmn.TAN_NO,
           CMN.ec_code "ECC No.",
           CMN.PAN_NO "PAN_NO",
           hou.NAME "operating unit",
           ph.segment4,
           ph.segment5,
           (SELECT   TAX.tax_name
              FROM   JAI_PO_TAXES A, JAI_CMN_TAXES_ALL TAX
             WHERE       A.po_header_id = PH.PO_HEADER_ID
                     AND A.TAX_ID = TAX.TAX_ID
                     AND A.tax_type IN ('Excise', 'ADDITIONAL_CVD')
                     AND ROWNUM = 1)
              "Excise Tax",
           (SELECT   SUM (A.TAX_AMOUNT)
              FROM   JAI_PO_TAXES A
             WHERE   A.po_header_id = PH.PO_HEADER_ID
                     AND A.tax_type IN ('Excise', 'ADDITIONAL_CVD'))
              "Excise Duty",
           (SELECT   TAX.tax_name
              FROM   JAI_PO_TAXES A, JAI_CMN_TAXES_ALL TAX
             WHERE   A.po_header_id = PH.po_header_id AND A.TAX_ID = TAX.TAX_ID
                     AND A.tax_type IN
                              ('EXCISE_EDUCATION_CESS',
                               'SERVICE_EDUCATION_CESS',
                               'CUSTOMS_EDUCATION_CESS',
                               'CVD_EDUCATION_CESS')
                     AND ROWNUM = 1)
              "EDUCATION Tax",
           (SELECT   SUM (A.tax_amount)
              FROM   jai_po_taxes A
             WHERE   A.po_header_id = PH.po_header_id
                     AND A.tax_type IN
                              ('EXCISE_EDUCATION_CESS',
                               'SERVICE_EDUCATION_CESS',
                               'CUSTOMS_EDUCATION_CESS',
                               'CVD_EDUCATION_CESS'))
              "EDUCATION_CESS",
           (SELECT   TAX.TAX_NAME
              FROM   jai_po_taxes A, JAI_CMN_TAXES_ALL TAX
             WHERE   A.po_header_id = PH.po_header_id AND A.TAX_ID = TAX.TAX_ID
                     AND A.tax_type IN
                              ('SERVICE_SH_EDU_CESS',
                               'CVD_SH_EDU_CESS',
                               'EXCISE_SH_EDU_CESS',
                               'CUSTOMS_SH_EDU_CESS')
                     AND ROWNUM = 1)
              "Higher Education Tax ",
           (SELECT   SUM (A.TAX_AMOUNT)
              FROM   jai_po_taxes A
             WHERE   A.po_header_id = PH.po_header_id
                     AND A.tax_type IN
                              ('SERVICE_SH_EDU_CESS',
                               'CVD_SH_EDU_CESS',
                               'EXCISE_SH_EDU_CESS',
                               'CUSTOMS_SH_EDU_CESS'))
              "Higher Education Cess ",
           (SELECT   SUM (A.TAX_AMOUNT)
              FROM   JAI_PO_TAXES A
             WHERE   A.po_header_id = PH.PO_HEADER_ID
                     AND A.tax_type IN ('VALUE ADDED TAX', 'CST'))
              "SALES TAX/VAT/cst ",
           (SELECT   TAX.TAX_NAME
              FROM   JAI_PO_TAXES A, JAI_CMN_TAXES_ALL TAX
             WHERE       A.po_header_id = PH.PO_HEADER_ID
                     AND A.TAX_ID = TAX.TAX_ID
                     AND A.tax_type IN ('VALUE ADDED TAX', 'CST')
                     AND ROWNUM = 1)
              "SALES TAX/VAT NAME ",
           (SELECT   SUM (A.TAX_AMOUNT)
              FROM   JAI_PO_TAXES A
             WHERE   A.po_header_id = PH.PO_HEADER_ID
                     AND A.tax_type = 'Service')
              "service tax  ",
           (SELECT   TAX.TAX_NAME
              FROM   JAI_PO_TAXES A, JAI_CMN_TAXES_ALL TAX
             WHERE       A.po_header_id = PH.PO_HEADER_ID
                     AND A.TAX_ID = TAX.TAX_ID
                     AND A.tax_type = 'Service'
                     AND ROWNUM = 1)
              "service tax NAME  ",
           (SELECT   SUM (A.TAX_AMOUNT)
              FROM   JAI_PO_TAXES A
             WHERE   A.po_header_id = PH.PO_HEADER_ID
                     AND A.tax_type = 'Freight')
              "TRANSPORTATION CHARGES  ",
           (SELECT   TAX.TAX_NAME
              FROM   JAI_PO_TAXES A, JAI_CMN_TAXES_ALL TAX
             WHERE       A.po_header_id = PH.PO_HEADER_ID
                     AND A.TAX_ID = TAX.TAX_ID
                     AND A.tax_type = 'Freight'
                     AND ROWNUM = 1)
              "TRANSPORTATION CHARGES NAME ",
           (SELECT   TAX.tax_name
              FROM   JAI_PO_TAXES A, JAI_CMN_TAXES_ALL TAX
             WHERE       A.po_header_id = PH.PO_HEADER_ID
                     AND A.TAX_ID = TAX.TAX_ID
                     AND A.tax_type = 'Other'
                     AND tax.TAX_NAME NOT LIKE '%NCL%'       --'%P'||'&'||'F%'
                     AND ROWNUM = 1)
              "PackForwardTax",
           (SELECT   SUM (A.TAX_AMOUNT)
              FROM   JAI_PO_TAXES A, JAI_CMN_TAXES_ALL TAX
             WHERE       A.po_header_id = PH.PO_HEADER_ID
                     AND A.TAX_ID = TAX.TAX_ID
                     AND A.tax_type = 'Other'
                     AND tax.TAX_NAME NOT LIKE '%NCL%')              --ncl, nc
              "PackForwardAmt",
           UPPER(   h.ADDRESS_LINE_1
                 || ''
                 || h.ADDRESS_LINE_2
                 || ' '
                 || h.ADDRESS_LINE_3
                 || ' '
                 || h.COUNTRY
                 || ''
                 || h.POSTAL_CODE
                 || ''
                 || h.REGION_1
                 || ''
                 || h.REGION_2
                 || ''
                 || h.REGION_3
                 || ''
                 || h.TELEPHONE_NUMBER_1
                 || ''
                 || h.TELEPHONE_NUMBER_2
                 || ''
                 || h.TELEPHONE_NUMBER_2
                 || ''
                 || h.LOC_INFORMATION13
                 || ''
                 || h.LOC_INFORMATION14
                 || ''
                 || h.LOC_INFORMATION15)
              "ADDRESS" 
FROM   po_distributions_all pd,
           po_line_locations_all pll,
           po_lines_all pl,
           po_headers_all ph,
           ap_terms_tl term,
           JAI_CMN_VENDOR_SITES pts,
           po_releases_all prel,
           ap_suppliers pv,
           ap_supplier_sites_all pvs,
           ap_supplier_contacts pvc,
           hr_locations_all h,
           hr_all_organization_units hu,
           hr_operating_units hou,
           per_all_people_f ppf,
           mtl_system_items_b msi,
           jai_cmn_inventory_orgs cmn,
           FND_LOOKUP_VALUES FLV1,
           FND_LOOKUP_VALUES FLV2
   WHERE       ph.po_header_id = pl.po_header_id
           AND pd.line_location_id = pll.line_location_id
           AND pll.po_line_id = pl.po_line_id
           AND term.term_id = ph.terms_id
           AND prel.po_release_id(+) = pd.po_release_id
           AND ppf.person_id(+) = ph.agent_id
           AND h.location_id = pll.ship_to_location_id
           AND hou.organization_id = ph.org_id
           AND pv.vendor_id(+) = ph.vendor_id
           AND pvs.vendor_site_id(+) = ph.vendor_site_id
           AND ph.vendor_contact_id = pvc.vendor_contact_id(+)
           AND pts.vendor_site_id(+) = pvs.vendor_site_id
           AND msi.inventory_item_id(+) = pl.item_id
           AND h.LOCATION_ID = cmn.LOCATION_ID(+)
           AND HU.ORGANIZATION_ID(+) = CMN.ORGANIZATION_ID  --------  test elango
           AND hu.LOCATION_ID(+) = cmn.LOCATION_ID
           AND FLV1.LOOKUP_CODE(+) = PH.FOB_LOOKUP_CODE
           AND FLV2.LOOKUP_CODE(+) = PH.FREIGHT_TERMS_LOOKUP_CODE
           AND ph.segment1 >= :from_po
           AND ph.segment1 <= :to_po
           AND (ph.AUTHORIZATION_STATUS =
                   NVL (:P_PO_STATUS, ph.AUTHORIZATION_STATUS)
                OR ph.AUTHORIZATION_STATUS IS NULL)
             &p_release_no
           AND ppf.person_id = NVL (:P_PERSON_ID, ppf.person_id)
          AND FLV1.LOOKUP_TYPE(+) = 'FOB'
           AND FLV2.LOOKUP_TYPE(+) = 'FREIGHT TERMS'
           AND ph.org_id = fnd_profile.VALUE ('ORG_ID')
GROUP BY   pv.segment1,
           ph.po_header_id,
           pv.vendor_name,
           pvs.address_line1,
           pvs.address_line2,
           pvs.city,
           pvs.state,
           pvs.zip,
           pvc.first_name,
           pvc.last_name,
           pvs.phone,
           pvc.fax,
           pvc.email_address,
           ph.segment1,
           ph.revision_num,
           ph.creation_date,
           ph.NOTE_TO_VENDOR,
           prel.release_num,
           ph.revision_num,
           ph.attribute1,
           ph.currency_code,
           ppf.full_name,
           h.address_line_1,
           h.address_line_2,
           h.location_code,
           h.town_or_city,
           h.telephone_number_1,
           pll.tax_name,
           ph.fob_lookup_code,
           ph.freight_terms_lookup_code,
           term.name,
           ppf.first_name,
           CMN.cst_reg_no,
           CMN.vat_reg_no,
           CMN.ec_code,
           CMN.PAN_NO,
           hou.NAME,
           ph.segment4,
           ph.segment5,
           pll.ship_to_organization_id,
           pll.quantity,
           pll.need_by_date,
           cmn.TAN_NO,
           (   h.ADDRESS_LINE_1
            || ''
            || h.ADDRESS_LINE_2
            || ' '
            || h.ADDRESS_LINE_3
            || ' '
            || h.COUNTRY
            || ''
            || h.POSTAL_CODE
            || ''
            || h.REGION_1
            || ''
            || h.REGION_2
            || ''
            || h.REGION_3
            || ''
            || h.TELEPHONE_NUMBER_1
            || ''
            || h.TELEPHONE_NUMBER_2
            || ''
            || h.TELEPHONE_NUMBER_2
            || ''
            || h.LOC_INFORMATION13
            || ''
            || h.LOC_INFORMATION14
            || ''
            || h.LOC_INFORMATION15),
           FLV1.MEANING,
           FLV2.MEANING,
           PH.SHIP_VIA_LOOKUP_CODE,
           pl.po_line_id,
           PH.ORG_ID
ORDER BY   TO_NUMBER (ph.segment1)


---------------------  line -------------
SELECT   msi.segment1 "Item code ",
         pl.item_description "Item Description",
         pl.unit_meas_lookup_code "UOM",
         pll.quantity "Shipment Qty ",
         pll.need_by_date "Need By date ",
         pl.unit_price "Unit Basic Price",
         (pl.unit_price * pll.QUANTITY) "Total Basic Price",
         pl.po_header_id,
         msi.organization_id,
         pll.need_by_date,
         :Currency_
  FROM   po_lines_all pl, po_line_locations_all pll, mtl_system_items_b msi
 WHERE       pl.po_line_id = pll.po_line_id
         AND pl.item_id = msi.inventory_item_id
         AND pll.po_line_id = pl.po_line_id(+)
         and msi.organization_id=pll.SHIP_TO_ORGANIZATION_ID
         --AND pl.po_header_id               = ph.po_header_id(+)
         AND msi.inventory_item_id(+) = pl.item_id
         AND PL.CLOSED_CODE not in 'CLOSED'
         AND pll.quantity IS NOT NULL