Sunday 29 March 2020

PO Creation Details Query

SELECT OU_NAME,PO_NUM,PO_PAYMENT_TERMS,SUPPLIER_ITEM_NUM,TYPE,APPROVAL_STATUS,CATEGORY,ORDER_DATE,SUPPLIER,CURRENCY,
AMOUNT,CONTRACT_TYPE,CONV_RATE ,'USD' CONV_CURRENCY, CASE WHEN CONV_RATE IS NULL THEN AMOUNT ELSE
SUM(CONV_RATE*AMOUNT) END CONV_AMOUNT
FROM (
select h.name OU_NAME,
po.segment1 PO_NUM,(SELECT name FROM APPS.AP_TERMS WHERE TERM_ID=PO.TERMS_ID) PO_PAYMENT_TERMS
,pl.VENDOR_PRODUCT_NUM SUPPLIER_ITEM_NUM,
po.TYPE_LOOKUP_CODE TYPE ,po.AUTHORIZATION_STATUS APPROVAL_STATUS,
mtc.segment1 CATEGORY,po.creation_date ORDER_DATE,aps.vendor_name SUPPLIER
,Po.CURRENCY_CODE CURRENCY,PL.quantity*pl.unit_price AMOUNT,po.attribute10 CONTRACT_TYPE  ,
--apps.gl_currency_api.get_rate('BRL','USD', to_date('02-JAN-2018'),'Corporate')
SUM(GLR.CONVERSION_RATE)  CONV_RATE
from apps.po_headers_all po,
     apps.po_lines_all pl,
     apps.ap_suppliers aps,
     apps.HR_OPERATING_UNITS H,
     apps.mtl_categories mtc,
     apps.GL_DAILY_RATES_V glr
where po.po_header_id=pl.po_header_id
and Po.VENDOR_ID = APS.VENDOR_ID
and po.org_id=h.ORGANIZATION_ID
and mtc.CATEGORY_ID=pl.CATEGORY_ID
and trunc(po.creation_date)>='01-JAN-2018'
and trunc(po.creation_date)<='31-DEC-2019'
--AND GLR.USER_CONVERSION_TYPE = 'Corporate'
and TRUNC(PO.CREATION_DATE) = GLR.conversion_date(+)
AND GLR.FROM_CURRENCY(+) =  PO.CURRENCY_CODE
AND GLR.TO_CURRENCY(+) = 'USD'
and po.org_id in(128,129,147,388,630,367,370,627,628,629,127)
group by h.name,
po.segment1 ,pl.VENDOR_PRODUCT_NUM,
po.TYPE_LOOKUP_CODE,po.AUTHORIZATION_STATUS ,mtc.segment1 ,po.creation_date,aps.vendor_name
,Po.CURRENCY_CODE ,PL.quantity*pl.unit_price,po.attribute10,PO.TERMS_ID
)
GROUP BY OU_NAME,PO_NUM,PO_PAYMENT_TERMS,SUPPLIER_ITEM_NUM,TYPE,APPROVAL_STATUS,CATEGORY,ORDER_DATE,SUPPLIER,CURRENCY,
AMOUNT,CONTRACT_TYPE,CONV_RATE,'USD'
order by order_date asc,po_num;

5 comments:

  1. That great posting and too its very help full article for me. thanks for sharing your information.
    Germany VPS Server Hosting

    ReplyDelete
  2. Learn import export course at exportbusiness. We provide import export master course, service and Trade in all over India. This course gives you the opportunity to get knowledge with practical training of doing International Business. The Right Opportunities are Infinite and the Bright Future for Best Import Export Professionals! You Can Also Check Amintmulani import export master course.
    Also Check
    How to Start an Import Export Business
    Free Import Export Course by Government of India
    What is Import Export Business

    ReplyDelete
  3. India's Top Ranked Export Import Course Online created by Amit Mulani & Team. Step by step complete Exim business startup guide.
    Also Check
    Export Import Course
    Import Export,
    Exim Course in surat,
    Export Import Course in Surat,
    export business.

    ReplyDelete
  4. Are you looking to grow your business through exporting? here you can learn everything about export import industry - Import Export Coach
    We are Ready to Help Your Business heading Grow Up
    Welcome to the Import Export Coach. Are you looking to grow your business through exporting?
    Here I will help you enlighten necessary procedures and formalities to start an International business in India. Small, medium and large businesses all have the fantastic opportunity to expand internationally,

    How to Find Buyers For Export Business
    Payment Terms in Export Import Business
    Import Export Procedures In India

    ReplyDelete