/* Formatted on 13-08-2011 13:18:37 (QP5 v5.115.810.9015) */
SELECT -- SUM (aca.amount)
DISTINCT aca.vendor_id,
(SELECT segment1
FROM po_vendors
WHERE vendor_id = aca.vendor_id)
Vendor_Code,
hou.name,
hou.ORGANIZATION_ID,
aca.CHECK_ID,
aca.check_number H_REFERENCE,
LKUP.DISPLAYED_FIELD H_PAYMENT_TYPE,
aca.vendor_name H_VENDOR_NAME,
aca.vendor_Site_code H_VENDOR_SITE_CODE,
TRUNC (aca.check_date) H_CHECK_DATE,
aca.amount H_AMOUNT,
aca.bank_account_name H_BANK_ACCT_NAME,
aca.payment_method_lookup_code H_PAYMENT_METHOD,
acs.name H_PAYMENT_DOCUMENT,
DOC_SEQUENCE_VALUE H_DOCUMENT_NUMBER,
'APIL_STANDARD_PROFILE' H_PAYMENT_PROFILE,
aca.currency_code H_CURRENCY_CODE,
aca.DESCRIPTION H_NARRATION,
aca.DOC_SEQUENCE_ID,
aca.DOC_SEQUENCE_VALUE
-- aca.status_lookup_code,
-- aca.bank_Account_num,
-- aca.bank_num,
-- aca.bank_Account_id
FROM ap_checks_all aca,
ap_bank_branches abb,
ap_bank_accounts_all abc,
hr_operating_units hou,
ap_check_stocks_all acs,
ap_lookup_codes lkup
WHERE abb.bank_num = aca.bank_num
AND abc.Bank_Account_id = aca.Bank_Account_id
AND abc.bank_branch_id = abb.bank_branch_id
AND HOU.SET_OF_BOOKS_ID = abc.SET_OF_BOOKS_ID
AND acs.CHECK_STOCK_ID = aca.CHECK_STOCK_ID
AND lkup.LOOKUP_CODE = aca.PAYMENT_TYPE_FLAG
AND HOU.ORGANIZATION_ID = ACA.ORG_ID
AND hou.SET_OF_BOOKS_ID = 5
AND lkup.ENABLED_FLAG = 'Y'
AND LKUP.LOOKUP_TYPE = 'PAYMENT TYPE'
AND aca.STATUS_LOOKUP_CODE NOT IN ('VOIDED','Voided')
AND TRUNC (aca.check_date) BETWEEN '01-JUL-2011' AND '31-JUL-2011'
--AND aca.org_id = 1202
-- AND aca.CHECK_NUMBER = '193'
--AND aca.CHECK_ID = 1127930
ORDER BY aca.check_id, aca.check_number --, aca.check_date
SELECT -- SUM (aca.amount)
DISTINCT aca.vendor_id,
(SELECT segment1
FROM po_vendors
WHERE vendor_id = aca.vendor_id)
Vendor_Code,
hou.name,
hou.ORGANIZATION_ID,
aca.CHECK_ID,
aca.check_number H_REFERENCE,
LKUP.DISPLAYED_FIELD H_PAYMENT_TYPE,
aca.vendor_name H_VENDOR_NAME,
aca.vendor_Site_code H_VENDOR_SITE_CODE,
TRUNC (aca.check_date) H_CHECK_DATE,
aca.amount H_AMOUNT,
aca.bank_account_name H_BANK_ACCT_NAME,
aca.payment_method_lookup_code H_PAYMENT_METHOD,
acs.name H_PAYMENT_DOCUMENT,
DOC_SEQUENCE_VALUE H_DOCUMENT_NUMBER,
'APIL_STANDARD_PROFILE' H_PAYMENT_PROFILE,
aca.currency_code H_CURRENCY_CODE,
aca.DESCRIPTION H_NARRATION,
aca.DOC_SEQUENCE_ID,
aca.DOC_SEQUENCE_VALUE
-- aca.status_lookup_code,
-- aca.bank_Account_num,
-- aca.bank_num,
-- aca.bank_Account_id
FROM ap_checks_all aca,
ap_bank_branches abb,
ap_bank_accounts_all abc,
hr_operating_units hou,
ap_check_stocks_all acs,
ap_lookup_codes lkup
WHERE abb.bank_num = aca.bank_num
AND abc.Bank_Account_id = aca.Bank_Account_id
AND abc.bank_branch_id = abb.bank_branch_id
AND HOU.SET_OF_BOOKS_ID = abc.SET_OF_BOOKS_ID
AND acs.CHECK_STOCK_ID = aca.CHECK_STOCK_ID
AND lkup.LOOKUP_CODE = aca.PAYMENT_TYPE_FLAG
AND HOU.ORGANIZATION_ID = ACA.ORG_ID
AND hou.SET_OF_BOOKS_ID = 5
AND lkup.ENABLED_FLAG = 'Y'
AND LKUP.LOOKUP_TYPE = 'PAYMENT TYPE'
AND aca.STATUS_LOOKUP_CODE NOT IN ('VOIDED','Voided')
AND TRUNC (aca.check_date) BETWEEN '01-JUL-2011' AND '31-JUL-2011'
--AND aca.org_id = 1202
-- AND aca.CHECK_NUMBER = '193'
--AND aca.CHECK_ID = 1127930
ORDER BY aca.check_id, aca.check_number --, aca.check_date
No comments:
Post a Comment