Commit c3fb38f7 authored by caluka's avatar caluka

new function added and also pohelp querys updated


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@102210 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 751e12c9
......@@ -819,3 +819,105 @@ CONNECT BY PRIOR C.POS_CODE=C.POS_CODE__REPTO
AND C.VERSION_ID =(SELECT MAX(VERSION_ID) FROM ORG_STRUCTURE E)
)
ORDER BY LEVEL_NO',sql_input=':login_poscode' where mod_name='W_SECONDORY_SALE_GWT_WIZ' and FIELD_NAME='POS_CODE';
CREATE OR REPLACE TYPE EMPPOS AS OBJECT (CODE CHAR(10));
CREATE TYPE TYP_EMPCODE IS TABLE OF EMPPOS;
create or replace
function FN_ES3_POS_CODE2(AS_EMP_CODE in varchar2,FUNTYPE in varchar2)
return TYP_EMPCODE PIPELINED
is
begin
if funType ='E' then
for r_empcode in ( SELECT distinct C.emp_code as emp_code
FROM ORG_STRUCTURE C
START WITH C.POS_CODE=
(SELECT POS_CODE
FROM EMPLOYEE A
WHERE trim(A.EMP_CODE)=trim(as_emp_Code)
)
CONNECT BY PRIOR C.POS_CODE=C.POS_CODE__REPTO
AND C.VERSION_ID =
(SELECT MAX(VERSION_ID) FROM ORG_STRUCTURE E))
LOOP
PIPE ROW (EMPPOS(r_empcode.EMP_CODE));
end LOOP;
elsif funType ='P' then
BEGIN
for r_poscode in ( SELECT distinct C.POS_CODE as pos_code
FROM ORG_STRUCTURE C
START WITH C.POS_CODE=
(SELECT POS_CODE
FROM EMPLOYEE A
WHERE trim(A.EMP_CODE)=trim(as_emp_Code)
)
CONNECT BY PRIOR C.POS_CODE=C.POS_CODE__REPTO
AND C.VERSION_ID =
(SELECT MAX(VERSION_ID) FROM ORG_STRUCTURE E))
LOOP
PIPE ROW (EMPPOS(r_poscode.pos_code));
end loop;
END;
end if;
RETURN;
end;
update user_rights set acc_filt='TRIM(CUST_STOCK.EMP_CODE) in (select TRIM(CODE) from TABLE(FN_ES3_POS_CODE2(''<entityCode>'',''E''))) OR (TRIM(CUST_STOCK.EMP_CODE) IS NULL AND TRIM(CUST_STOCK.POS_CODE) IN (select TRIM(CODE) from TABLE(FN_ES3_POS_CODE2(''<entityCode>'',''P''))))' where obj_name='secondory_sale_gwt';
update POPHELP set sql_str='select item_code,descr,unit from item where item_code like ''?%'' and item_ser IN (
select item_ser from itemser where grp_code=''?'' and item_ser<>case when grp_code is null then ''.'' else grp_code end
union all
select item_ser from itemser where item_ser=''?'' and item_ser<>case when grp_code is null then ''.'' else grp_code end)'
,sql_input=':item_code,:item_ser,,:item_ser'
WHERE MOD_NAME='W_SECONDORY_SALE_GWT_WIZ' and field_name='ITEM_CODE';
update pophelp set sql_str='SELECT trim(A.POS_CODE) as pos_code ,A.DESCR,trim(A.EMP_CODE) as emp_code,C.EMP_FNAME||'' ''||C.EMP_MNAME||'' ''||C.EMP_LNAME NAME,a.table_no as Division, itmser.sh_descr as Div_description
FROM ORG_STRUCTURE A ,EMPLOYEE C,itemser itmser
WHERE A.VERSION_ID IN(SELECT MAX(VERSION_ID) FROM ORG_STRUCTURE D)
AND A.EMP_CODE=C.EMP_CODE(+)
AND A.POS_CODE IN(SELECT C.POS_CODE FROM ORG_STRUCTURE C
START WITH C.POS_CODE=''?''
CONNECT BY PRIOR C.POS_CODE=C.POS_CODE__REPTO
AND C.VERSION_ID =(SELECT MAX(VERSION_ID) FROM ORG_STRUCTURE E)
) and itmser.item_ser=a.table_no
ORDER BY A.POS_CODE,A.DESCR asc ',sql_input=':login_poscode' where mod_name='W_SECONDORY_SALE_GWT_WIZ' and FIELD_NAME='POS_CODE';
UPDATE pophelp SET
sql_input=':pos_code,:item_ser,:pophelp_frmdt,:pophelp_todt,:cust_code,:cust_code,:cust_code,:country_code,:pophelp_frmdt,:pophelp_todt,:item_ser,:item_ser',
sql_str='select distinct trim(cust.cust_code) as cust_code,cust.cust_name,stn.descr as Station,org.table_no as Division,itmser.sh_descr as Div_description
from org_structure org,org_structure_cust orgcust,customer cust ,
station stn,customer_series custser,state state ,itemser itmser
where org.version_id=orgcust.version_id and
org.pos_code=orgcust.pos_code and
org.table_no=orgcust.table_no and
orgcust.cust_code=cust.cust_code
and itmser.item_ser=org.table_no
and cust.stan_code=stn.stan_code
and custser.cust_code=cust.cust_code
and case when custser.black_listed is null then ''N'' else custser.black_listed end !=''Y''
AND orgcust.pos_code =''?''
AND org.table_no =''?''
and org.version_id in (select max(version_id) from org_structure )
and orgcust.cust_code not in(SELECT distinct(cust_code) FROM cust_stock WHERE
from_date >= ''?''
and to_date <= ''?'') AND (cust.SH_NAME LIKE upper(''?%'')
or cust.cust_code LIKE upper(''?%'') OR cust.cust_name LIKE upper(''?%''))
and state.count_code=''?'' and state.state_code=stn.state_code
and (''?'' BETWEEN orgcust.EFF_DATE and orgcust.VALID_UPTO )
and (''?'' BETWEEN orgcust.EFF_DATE and orgcust.VALID_UPTO )
and custser.item_ser in(select item_ser from itemser where grp_code=''?'' and item_ser<>case when grp_code is null then ''.'' else grp_code end
union all
select item_ser from itemser where item_ser=''?'' and item_ser<>case when grp_code is null then ''.'' else grp_code end)
order by stn.descr,cust.cust_name asc '
WHERE mod_name='W_SECONDORY_SALE_GWT_WIZ' AND field_name='CUST_CODE';
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