-- Use the following ordering sequence to determine the invoice-level
-- approval flag:
-- 'N' - Needs Reapproval
-- 'T' - Tested
-- 'A' - Approved
-- '' - Never Approved
--
-- 'X' - No Distributions Exist!
--
-- Initialize invoice-level approval flag
SELECT invoice_id,invoice_amount DECODE(apps.ap_invoices_pkg.get_approval_status(invoice_id,invoice_amount,payment_status_flag,invoice_type_lookup_code),
'APPROVED', 'Validated',
'FULL', 'Fully Validatd',
'UNAPPROVED', 'Unvalidated',
'NEEDS REAPPROVAL','Needs Revalidation',
'NEVER APPROVED','Never Validated',
'CANCELLED', 'Cancelled',
'UNPAID', 'Unpaid',
'AVAILABLE', 'Available'
'Needs Revalidation',
'PERMANENT', 'Permanent Prepayment',
NULL
)STATUS
FROM AP_INVOICES_ALL
WHERE invoice_id = :P_INVOICE_ID;
----------------------------------------------
AP modules payment details R12
SELECT aia.invoice_id,
aia.vendor_id,
aia.vendor_site_id,
aia.invoice_num,
aia.DOC_SEQUENCE_VALUE Voucher_num,
aca.payment_method_code,
aca.check_number payment_reference,
aca.check_date payment_date,
aca.amount,
aca.status_lookup_code payment_status,
cbv.bank_name,
aip.attribute1 UTR_NO
FROM ap_invoices_all aia,
ap_invoice_payments_all aip,
ap_checks_all aca,
ce_bank_acct_uses_all cbau,
ce_bank_accounts cba,
ce_banks_v cbv
WHERE aia.invoice_id = aip.invoice_id
AND aca.check_id = aip.check_id
AND cbau.bank_acct_use_id = aca.ce_bank_acct_use_id
AND cbau.bank_account_id = cba.bank_account_id
AND cba.bank_id = cbv.bank_party_id
0 comments:
Post a Comment