Commit dc25f83a authored by prane's avatar prane

removed supplier join and applicable for all sundry type used fun DDF_GET_TAX_REG_2

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@186218 ce508802-f39f-4f6c-b175-0d175dae99d5
parent aaf2056a
create or replace
FUNCTION DDF_GET_TAX_REG_2
( ls_sundry_code in char,
ls_sundry_type in char )
return varchar is
ls_taxref_2 varchar2(30);
begin
if ls_sundry_type = 'C' then
select case when tax_reg_2 is null then 'UNREGISTER' else tax_reg_2 end into ls_taxref_2
from customer
where cust_code = ls_sundry_code
and (tax_reg_2 = 'UNREGISTER' or tax_reg_2 is null);
elsif ls_sundry_type = 'S' then
select case when tax_reg_2 is null then 'UNREGISTER' else tax_reg_2 end into ls_taxref_2
from supplier
where supp_code = ls_sundry_code
and (tax_reg_2 = 'UNREGISTER' or tax_reg_2 is null) ;
elsif ls_sundry_type = 'L' then
select case when tax_reg_2 is null then 'UNREGISTER' else tax_reg_2 end into ls_taxref_2
from loanparty
where party_code = ls_sundry_code
and (tax_reg_2 = 'UNREGISTER' or tax_reg_2 is null) ;
elsif ls_sundry_type = 'P' then
select case when tax_reg_2 is null then 'UNREGISTER' else tax_reg_2 end into ls_taxref_2
From sales_pers
where sales_pers = ls_sundry_code
and (tax_reg_2 = 'UNREGISTER' or tax_reg_2 is null) ;
elsif ls_sundry_type = 'T' then
select case when tax_reg_2 is null then 'UNREGISTER' else tax_reg_2 end into ls_taxref_2
From transporter
where tran_code = ls_sundry_code
and (tax_reg_2 = 'UNREGISTER' or tax_reg_2 is null) ;
elsif ls_sundry_type = 'B' then
select case when tax_reg_2 is null then 'UNREGISTER' else tax_reg_2 end into ls_taxref_2
From bank
where bank_code = ls_sundry_code
and (tax_reg_2 = 'UNREGISTER' or tax_reg_2 is null) ;
elsif trim( ls_sundry_type) = 'R' then
select case when tax_reg_2 is null then 'UNREGISTER' else tax_reg_2 end into ls_taxref_2
from strg_customer
where sc_code = ls_sundry_code
and (tax_reg_2 = 'UNREGISTER' or tax_reg_2 is null) ;
elsif ls_sundry_type = 'O' then
ls_taxref_2 := 'NOT APPLICABLE';
End If;
RETURN ls_taxref_2;
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