/*******Supplier Opening Balance*******/
/*---------Net Opening Credit Balance----------*/
/*--------------NET_CR_OB----------------------*/
select nvl(sum(inv.invoice_amount * nvl(inv.exchange_rate,1)) ,0)
from ap_invoices_all inv
where inv.vendor_id = :VENDOR_ID
and inv.gl_date < :P_FROM_DATE ;
/*---------Net Opening Debit Balance-----------*/
/*--------------NET_DR_OB----------------------*/
select nvl(sum (chk.amount * nvl (chk.exchange_rate,1)) ,0)
from ap_checks_all chk
where chk.vendor_id = :VENDOR_ID
and chk.check_date < :P_FROM_DATE;
/*---------Net Opening Debit Balance-----------*/
/*-----NET_OB_BAL = NET_CR_OB - NET_DR_OB------*/
(select nvl(sum(inv.invoice_amount * nvl(inv.exchange_rate,1)) ,0)
from ap_invoices_all inv
where inv.vendor_id = :VENDOR_ID
and inv.gl_date < :P_FROM_DATE )
-
(select nvl(sum (chk.amount * nvl (chk.exchange_rate,1)) ,0)
from ap_checks_all chk
where chk.vendor_id = :VENDOR_ID
and chk.check_date < :P_FROM_DATE )
/*---------Net Opening Credit Balance----------*/
/*--------------NET_CR_OB----------------------*/
select nvl(sum(inv.invoice_amount * nvl(inv.exchange_rate,1)) ,0)
from ap_invoices_all inv
where inv.vendor_id = :VENDOR_ID
and inv.gl_date < :P_FROM_DATE ;
/*---------Net Opening Debit Balance-----------*/
/*--------------NET_DR_OB----------------------*/
select nvl(sum (chk.amount * nvl (chk.exchange_rate,1)) ,0)
from ap_checks_all chk
where chk.vendor_id = :VENDOR_ID
and chk.check_date < :P_FROM_DATE;
/*---------Net Opening Debit Balance-----------*/
/*-----NET_OB_BAL = NET_CR_OB - NET_DR_OB------*/
(select nvl(sum(inv.invoice_amount * nvl(inv.exchange_rate,1)) ,0)
from ap_invoices_all inv
where inv.vendor_id = :VENDOR_ID
and inv.gl_date < :P_FROM_DATE )
-
(select nvl(sum (chk.amount * nvl (chk.exchange_rate,1)) ,0)
from ap_checks_all chk
where chk.vendor_id = :VENDOR_ID
and chk.check_date < :P_FROM_DATE )
No comments:
Post a Comment