Product: | CE - Cash Management |
---|---|
Description: | Forecasting source - temp labor purchase orders with no terms |
Implementation/DBA Data: |
![]() |
SELECT POH.SEGMENT1
, /* 1 */ (GREATEST(POD.AMOUNT_ORDERED - NVL(POD.AMOUNT_DELIVERED
, 0) - NVL(POD.AMOUNT_CANCELLED
, 0) + NVL(POD.NONRECOVERABLE_TAX
, 0)
, 0) * NVL(POD.RATE
, NVL(POH.RATE
, 1)))
, /* 2 */ GREATEST(POD.AMOUNT_ORDERED - NVL(POD.AMOUNT_DELIVERED
, 0) - NVL(POD.AMOUNT_CANCELLED
, 0) + NVL(POD.NONRECOVERABLE_TAX
, 0)
, 0)
, /* 3 */ POL.START_DATE
, /* 4 */ POL.EXPIRATION_DATE
, /* 5 */ NVL(NVL(POH.CURRENCY_CODE
, FSP.INVOICE_CURRENCY_CODE)
, SOB.CURRENCY_CODE)
, /* 6 */ NVL(POH.AUTHORIZATION_STATUS
, 'INCOMPLETE')
, /* 7 */ DECODE(POH.VENDOR_SITE_ID
, NULL
, NVL(VENDOR.PAYMENT_PRIORITY
, 99)
, /* 8 */ NVL(SITE.PAYMENT_PRIORITY
, 99))
, NVL(VENDOR.VENDOR_TYPE_LOOKUP_CODE
, '-1')
, /* 9 */ DECODE(POH.VENDOR_SITE_ID
, NULL
, NVL(VENDOR.PAY_GROUP_LOOKUP_CODE
, '-1')
, /* 10 */ NVL(SITE.PAY_GROUP_LOOKUP_CODE
, '-1'))
, POD.ORG_ID
, /* 11 */ POD.PROJECT_ID
, /* 12 */ POL.LINE_NUM
, /* 13 */ TO_CHAR(POD.PO_DISTRIBUTION_ID)
, /* 14 */ POLL.VALUE_BASIS
, /* 15 */ POL.PURCHASE_BASIS
, /* 16 */ POLL.MATCHING_BASIS /* 17 */ FROM PO_HEADERS_ALL POH
, PO_VENDOR_SITES_ALL SITE
, PO_VENDORS VENDOR
, PO_LINES_ALL POL
, PO_LINE_LOCATIONS_ALL POLL
, PO_DISTRIBUTIONS_ALL POD
, PO_DOCUMENT_TYPES_ALL PDT
, FINANCIALS_SYSTEM_PARAMS_ALL FSP
, GL_SETS_OF_BOOKS SOB
WHERE (POH.ORG_ID = PDT.ORG_ID OR POH.ORG_ID IS NULL) AND (POL.ORG_ID = POH.ORG_ID OR POL.ORG_ID IS NULL) AND (POLL.ORG_ID = POL.ORG_ID OR POLL.ORG_ID IS NULL) AND (POD.ORG_ID = FSP.ORG_ID OR POD.ORG_ID IS NULL) AND (SITE.ORG_ID = POH.ORG_ID OR SITE.ORG_ID IS NULL) AND POH.VENDOR_SITE_ID = SITE.VENDOR_SITE_ID(+) AND POH.VENDOR_ID = VENDOR.VENDOR_ID (+) AND SOB.SET_OF_BOOKS_ID = POD.SET_OF_BOOKS_ID AND POD.SET_OF_BOOKS_ID = FSP.SET_OF_BOOKS_ID AND POD.LINE_LOCATION_ID = POLL.LINE_LOCATION_ID AND POLL.SHIPMENT_TYPE = 'STANDARD' AND POLL.PO_LINE_ID = POL.PO_LINE_ID AND POLL.PO_HEADER_ID = POL.PO_HEADER_ID AND POH.PO_HEADER_ID = POL.PO_HEADER_ID AND NVL(POH.CLOSED_CODE
, 'OPEN') NOT IN ('FROZEN'
, 'CANCELLED'
, 'FINALLY CLOSED') AND NVL(POH.CANCEL_FLAG
, 'N') = 'N' AND NVL(POH.FROZEN_FLAG
, 'N') = 'N' AND POH.TYPE_LOOKUP_CODE = PDT.DOCUMENT_SUBTYPE AND PDT.DOCUMENT_TYPE_CODE IN ('PO'
, 'PA')
AND POLL.TERMS_ID IS NULL
AND POH.TERMS_ID IS NULL
AND SITE.TERMS_ID IS NULL
AND VENDOR.TERMS_ID IS NULL
AND POL.PURCHASE_BASIS = 'TEMP LABOR'