Commit 67be0f64 authored by pgole's avatar pgole

Updated SQL


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@104215 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 9a1c097b
......@@ -35,3 +35,48 @@ update system_events set service_code = 'poic_default_nvo_brow_all' ,comp_name =
---------------PB TO JAVA---------------------------
update system_events set service_code = 'prv_default_ejb' ,comp_name = 'CustStock' ,comp_type = 'EJB' where obj_name = 'cust_stock' and event_code= 'pre_validate';
update system_events set service_code = 'poic_default_ejb' ,comp_name = 'CustStock' ,comp_type = 'EJB' where obj_name = 'cust_stock' and event_code= 'post_item_change';
-------------fUNCTIONS---------------------------------------------------------
create or replace function fn_get_cust_deposit
(as_sitecode in char, as_custcode in char)
return number is lc_bal number(14,3);
lc_sbal number(14,3);
ls_acctprd char(6);
ls_prdcode char(6);
ldt_today date;
ls_acctcode accounts.acct_code%type;
ldate_to date;
begin
ldt_today := to_date(sysdate);
select var_value into ls_acctcode from finparm where prd_code = '999999' and var_name = 'CUST_DEPOSIT_ACC';
select acct_prd , code, to_date
into ls_acctprd , ls_prdcode, ldate_to
from period
where ldt_today between fr_date and to_date;
select nvl(sum((dr_amt__base) - (cr_amt__base)),0)
into lc_sbal
from sundrybal
where acct_prd = ls_acctprd
and prd_code < ls_prdcode
and site_code = as_sitecode
and sundry_type = 'C'
and sundry_code = as_custcode
and acct_code = ls_acctcode
and nvl(cctr_code,'0') >= ' '
and nvl(cctr_code,'0') <= 'Z' ;
Select nvl(sum((dr_amt * exch_rate) - (cr_amt * exch_rate)) , 0)
into lc_bal
from gltrace
where site_code = as_sitecode
and tran_date >= ldt_today and tran_date < ldate_to
and sundry_type = 'C' and sundry_code= as_custcode
and acct_code = ls_acctcode;
lc_bal := lc_sbal + lc_bal;
Return lc_bal;
end;
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment