Tuesday, September 22, 2009

To get the selected invoices for the payment batch

-- ----------------------------------------------------------------------------------------------------
-- Purpose : 11i To get the selected invoices for the payment batch, After invoice selection Screen
-- Release Date: 22.Sep.2009
-- Created by : Siri
-- .....
-- ----------------------------------------------------------------------------------------------------

select ai.INVOICE_NUM,
ai.INVOICE_AMOUNT,
ai.AMOUNT_PAID,
asi.CHECKRUN_NAME,
asi.CHECK_NUMBER,
asi.AMOUNT_REMAINING,
abb.BANK_NAME,
abb.BANK_BRANCH_NAME,
asi.BANK_ACCOUNT_NUM,
asi.BANK_ACCOUNT_TYPE
from ap_selected_invoices_all asi,
AP_BANK_ACCOUNTS_all aba,
AP_BANK_BRANCHES abb,
ap_invoices_all ai
where 1=1
and asi.checkrun_name = :Payment_Batch_name
and asi.INVOICE_ID = ai.INVOICE_ID
and aba.BANK_ACCOUNT_NUM = asi.BANK_ACCOUNT_NUM
and aba.BANK_ACCOUNT_TYPE = asi.BANK_ACCOUNT_TYPE
and aba.BANK_BRANCH_ID = abb.BANK_BRANCH_ID
order by 4,1;

-- ----------------------------------------------------------------------------------------------------