Commit 70562523 authored by pgole's avatar pgole

Updated SQL


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@104216 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 67be0f64
...@@ -79,4 +79,35 @@ begin ...@@ -79,4 +79,35 @@ begin
Return lc_bal; Return lc_bal;
end; end;
create or replace
FUNCTION FN_GET_CUSTOS (as_cust_code char, as_site_code char,
as_type char)
return number is lc_osamt number(14,3);
begin
if as_type = 'T' then
select sum(tot_amt-adj_amt) into lc_osamt from receivables
where cust_code = as_cust_code
and site_code = as_site_code;
elsif as_type = 'O' then
select sum(tot_amt-adj_amt) into lc_osamt from receivables
where cust_code = as_cust_code
and site_code = as_site_code
and due_date < fn_sysdate();
end if;
If lc_osamt is null then
lc_osamt := 0 ;
end if;
return lc_osamt;
Exception
when OTHERS then
return 0;
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