|
|

楼主 |
发表于 2005/5/25 14:11:28
|
显示全部楼层
--企业已收,银行未收
SELECT CUSTOMER_NAME KYSK_CNAME,
TRX_DATE KYSK_DATE,
TRX_NUMBER KYSK_NUMBER,
AMOUNT_CLEARED KYSK_AMOUNT,
description KYSK_DESC,
p.PERIOD_NAME KYSK_PERIOD_NAME,
BANK_ACCOUNT_ID KYSK_BANK_ACCOUNT_ID
from apps.CE_AVAILABLE_TRANSACTIONS_V t, apps.gl_period_statuses p
where CLEARING_TRX_TYPE IN ('CASH', 'MISC')
--AND BANK_ACCOUNT_ID = TO_NUMBER( _BANK_ACCOUNT_NUM_NAME)
AND TRX_TYPE IN ('CASH', 'MISC')
AND STATUS IN ('CLEARED')
--AND p.PERIOD_NAME = :P_PERIOD_NAME
AND p.END_DATE >= GL_DATE
and P.SET_OF_BOOKS_ID IN
(select set_of_books_id from apps.ce_system_parameters)
and p.application_id = 101
and TRX_NUMBER not in (select TRX_NUMBER
from apps.CE_AVAILABLE_TRANSACTIONS_V cv
where cv.CLEARING_TRX_TYPE IN ('CASH', 'MISC')
AND cv.TRX_TYPE IN ('CASH', 'MISC')
and cv.STATUS IN ('REVERSED')
--and cv.bank_account_id = TO_NUMBER(:P_BANK_ACCOUNT_NUM_NAME)
)
union all
select sc.agent_name KYSK_CNAME,
sc.trx_date KYSK_DATE,
sc.trx_number KYSK_NUMBER,
sc.AMOUNT_CLEARED KYSK_AMOUNT,
sc.reversal_comments KYSK_DESC,
p.PERIOD_NAME KYSK_PERIOD_NAME,
BANK_ACCOUNT_ID KYSK_BANK_ACCOUNT_ID
from apps.st_ce_222_reversal_v sc, apps.gl_period_statuses p
where sc.trx_type IN ('CASH', 'MISC')
--AND sc.bank_account_id = TO_NUMBER(:P_BANK_ACCOUNT_NUM_NAME)
--AND p.PERIOD_NAME = :P_PERIOD_NAME
AND p.END_DATE >= sc.gl_date
and P.SET_OF_BOOKS_ID IN
(select set_of_books_id from apps.ce_system_parameters)
and p.application_id = 101
union all
select v.agent_name KYSK_CNAME,
v.trx_date KYSK_DATE,
v.trx_number KYSK_NUMBER,
v.AMOUNT_CLEARED KYSK_AMOUNT,
v.reversal_comments KYSK_DESC,
p.PERIOD_NAME KYSK_PERIOD_NAME,
BANK_ACCOUNT_ID KYSK_BANK_ACCOUNT_ID
from apps.ST_CE_222_REVERSAL_V1 v, apps.gl_period_statuses p
where v.trx_number in (select c.trx_number
from apps.ST_CE_222_REVERSAL_V1 c
where c.status = 'REVERSED'
and c.gl_date > p.end_date)
and v.status = 'CLEARED'
--and v.bank_account_id = TO_NUMBER(:P_BANK_ACCOUNT_NUM_NAME)
and v.trx_type IN ('CASH', 'MISC')
--AND p.PERIOD_NAME = :P_PERIOD_NAME
AND p.END_DATE >= v.gl_date
and P.SET_OF_BOOKS_ID IN
(select set_of_books_id from apps.ce_system_parameters)
and p.application_id = 101 |
|