select
sum(decode(app.status ,'unapp' ,
decode(upper(:p_in_curr_code ) , null , round(app.acctd_amount_applied_from, 2 ) , app.amount_applied )
, 'unid', decode(upper('eur'), null, round(app.acctd_amount_applied_from , 2 ) , app . amount_applied ) , 0 ) ) unapplied_amt
from ar_receipt_methods rm ,
ar_receivable_applications_all app ,
ar_cash_receipt_history_all crh ,
ar_cash_receipts_all rcpt
where app.status in ( 'acc' , 'unapp' , 'unid')
and app.org_id = 83
and nvl(app.confirmed_flag, 'y') = 'y'
and rcpt.cash_receipt_id = app.cash_receipt_id
and nvl(rcpt.confirmed_flag ,'y' ) = 'y'
and crh.cash_receipt_id = rcpt.cash_receipt_id
and crh.first_posted_record_flag = 'y'
and rcpt.receipt_method_id = rm.receipt_method_id
and rcpt.receipt_number = :p_receipt_number
and rcpt.deposit_date = :p_deposit_date
;
sum(decode(app.status ,'unapp' ,
decode(upper(:p_in_curr_code ) , null , round(app.acctd_amount_applied_from, 2 ) , app.amount_applied )
, 'unid', decode(upper('eur'), null, round(app.acctd_amount_applied_from , 2 ) , app . amount_applied ) , 0 ) ) unapplied_amt
from ar_receipt_methods rm ,
ar_receivable_applications_all app ,
ar_cash_receipt_history_all crh ,
ar_cash_receipts_all rcpt
where app.status in ( 'acc' , 'unapp' , 'unid')
and app.org_id = 83
and nvl(app.confirmed_flag, 'y') = 'y'
and rcpt.cash_receipt_id = app.cash_receipt_id
and nvl(rcpt.confirmed_flag ,'y' ) = 'y'
and crh.cash_receipt_id = rcpt.cash_receipt_id
and crh.first_posted_record_flag = 'y'
and rcpt.receipt_method_id = rm.receipt_method_id
and rcpt.receipt_number = :p_receipt_number
and rcpt.deposit_date = :p_deposit_date
;
No comments:
Post a Comment