Monday 8 August 2011

Imported Supply Purchase Order

SELECT         DISTINCT pva.segment1 "VENDOR CODE",
                    plla.ship_to_organization_id,
                    pha.po_header_id,
                    hla.inventory_organization_id,
                    pva.VENDOR_NAME,
                    pvsa.address_line1,
                    pvsa.address_line2,
                    pvsa.city,
                    pvsa.state,
                    pvsa.ZIP "PINCODE",
                   (PVC.first_name|| pvc.last_name) "SUPPLIER's CONTACT PERSON",
                       PVSA.phone "Mobile No./Phone No. ",
                        PVC.fax "FAX NO. ",
                   PVC.email_address "EMAIL ID ",
                  (pha.segment1||'/'||pha.revision_num) "PO/REV No",
                  (pra.release_num||'/'||pha.revision_num) "Rel/REV No.",
                  prha.segment1 "PR NO.",
                  papf.full_name "BUYER NAME ",
                  hla.address_line_1 "ADDRESS LINE 1 ",
                  hla.address_line_2 "ADDRESS LINE 2",
                  hla.LOCATION_CODE,
                  hla.town_or_city "CITY /STATE",
                  hla.telephone_number_1 "PHONE NO./FAX NO. ",
                  rownum "SL NO.",
                  msib.segment1 "ITEM_CODE",
                  pla.item_description,
                  plla.quantity "SHIPMENT QTY",
                  pla.UNIT_MEAS_LOOKUP_CODE "UOM",
                  plla.NEED_BY_DATE "NEED BY DATE ",
                  pha.currency_code "CURRENCY",
                  pla.unit_price "UNIT BASIC PRICE",
                 (pla.unit_price * plla.quantity) "TOTAL BASIC PRICE",
                 pla.po_header_id,
                 msib.organization_id,
                 plla.tax_name "SEA WORTHY PACKING",
                 pha.fob_lookup_code "DELIVERY TERMS",
                 pha.freight_terms_lookup_code "MODE OF TRANSPORT",
                 trm.name "PAYMENT TERMS",
                 papf.full_name,
                 jcvs.CST_REG_NO "CST NO.",
                 jcvs.VAT_REG_NO "VAT/ TIN NO.",
                 jcvs.EC_CODE "ECC NO.",
                 (fdt.title||fdt.description ) "ATTACHMENT",
                 hou.NAME "OPERATING UNIT"
FROM        po_headers_all pha,
                 po_releases_all pra,
                 ap_suppliers pva,
                 ap_supplier_sites_all pvsa,
                 ap_supplier_contacts pvc,
                 per_all_people_f papf,
                 po_line_locations_all plla,
                 po_distributions_all pda,
                 po_req_distributions_all prda,
                 po_requisition_lines_all prla,
                 po_requisition_headers_all prha,
                 hr_locations_all hla,
                 po_lines_all pla,
                 mtl_system_items_b msib,
                    JAI_CMN_VENDOR_SITES JCVS,
                 hr_operating_units  hou,
                ap_terms_tl trm,
                fnd_documents_tl fdt,
                fnd_attached_documents fad
WHERE  pha.po_header_id= pra.po_header_id
AND        pva.vendor_id= pvsa.vendor_id
AND       pvc.vendor_site_id= pvsa.vendor_site_id
AND       pha.org_id=pvsa.org_id(+)
AND       pha.agent_id=papf.person_id
AND       pha.po_header_id=plla.po_header_id
AND      plla.ship_to_location_id=hla.location_id
AND      plla.po_line_id=pla.po_line_id
AND       pla.item_id=msib.inventory_item_id(+)
AND      msib.organization_id=hla.inventory_organization_id

AND 
     jcvs.vendor_site_id(+)=pvsa.vendor_site_id
AND      hou.organization_id(+)=pha.org_id
AND      pda.line_location_id(+)=plla.line_location_id
AND      pra.po_release_id(+)=pda.po_release_id
AND      prda.distribution_id=pda.req_distribution_id
AND      prla.requisition_line_id=prda.requisition_line_id
AND      prha.requisition_header_id=prla.requisition_header_id
AND      trm.term_id=pha.terms_id
AND      fad.pk1_value(+) = TO_CHAR(pha.po_header_id)
AND      fdt.document_id (+)=fad.document_id
AND      pva.segment1 BETWEEN NVL(:FROM_VENDOR_CODE,pva.segment1)  
                AND NVL(:TO_VENDOR_CODE,pva.segment1)
AND     pha.currency_code<>'INR'
    

1 comment:

  1. It's interesting that many of the bloggers to helped clarify a few things for me as well as giving.Most of ideas can be nice content.The people to give them a good shake to get your point and across the command.
    Purchase Order

    ReplyDelete