<% Response.Flush %> <% SET rsa = server.CreateObject("ADODB.RECORDSET") SET rsp = server.CreateObject("ADODB.RECORDSET") SET rsm = server.CreateObject("ADODB.RECORDSET") '-- response.write "
" '-- For Each s In request.form '-- response.write s &":"&request.form(s)&"
"Prod) - 1) EXEC (' select A.oid,A.tid,A.pc_prjcode,A.pc_prjcode_sub1,A.pc_prjcode_sub2, case when left(A.ffusercode,2)=''1-'' then A.ffusercode else isnull(''1-''+REPLICATE(''0'',4 - LEN(A.ffusercode))+cast(A.ffusercode as varchar(10)),'''') end as ffusercode , B.* from ( select max(id) as oid, tid,pc_prjcode,pc_prjcode_sub1,pc_prjcode_sub2,ffusercode,ffid from [project2].[dbo].[punching_data] where pc_prjcode=''1904033_C01_A'' and pc_prjcode_sub1=''A'' and ff_ing=''1'' and ffid in ( select ttelnum from [punching].[dbo].[tb_response] where tprocode=''1904033_C01_A'' and char(ttype+65)=''A'' ) group by tid,pc_prjcode,pc_prjcode_sub1,pc_prjcode_sub2,ffusercode,ffid ) A left join ( select * from (SELECT ffid,ffque, case when ffans=''-1'' then '''' else ffans end as ffans FROM [project2].[dbo].[punching_data] where pc_prjcode=''1904033_C01_A'' and pc_prjcode_sub1=''A'' and ff_ing=''1'' ) Q PIVOT ( max(ffans) FOR ffque IN (' + @Prod + ') ) AS PVT ) B on A.ffid=B.ffid order by A.oid asc ') '-- next dim x_save : x_save=request.form("x_save") '-- 저장(save_ok) dim xprint : xprint="" '-- sql 출력 dim xck_num : xck_num=0 dim pn_cd : pn_cd=request.form("pn_cd") dim pu_prjcode_type : pu_prjcode_type=request.form("pu_prjcode_type") dim pu_prjcode_area : pu_prjcode_area=request.form("pu_prjcode_area") dim pu_fcs_type : pu_fcs_type=request.form("pu_fcs_type") '-- fcs 타입 dim fcs_type__ss : fcs_type__ss=request.form("fcs_type__ss") '-- fcs 타입 페이퍼 아이디 범위(~부터) dim fcs_type__ee : fcs_type__ee=request.form("fcs_type__ee") '-- fcs 타입 페이퍼 아이디 범위(~까지) dim ckday : ckday=request.form("ckday") dim sql, isql, co_sql dim tsql '-- fcs 이관 데이터 정리(피벗) isql=fun_sql("") if xprint="1" then response.Write isql&"

" rsp.Open isql, adoConn, 1 '-- 가상테이블명 dim co_table : co_table="#temp_"&pn_cd&"_"&pu_prjcode_type '-- 가상테이블 생성 co_sql="" co_sql=co_sql&" CREATE TABLE "&co_table&" ( "&vbCrLf co_sql=co_sql&" id int IDENTITY (1, 1) primary key NOT Null , "&vbCrLf For i=0 To rsp.Fields.Count-1 '--response.write rsp.Fields(i).name&"
" select case rsp.Fields(i).name case "oid" : co_sql=co_sql&" "&rsp.Fields(i).name&" int , "&vbCrLf '-- 정렬 case "tid" : co_sql=co_sql&" "&rsp.Fields(i).name&" varchar (60) default '', "&vbCrLf '-- 펀처아이디 case "pc_prjcode" : co_sql=co_sql&" "&rsp.Fields(i).name&" varchar (30) default '', "&vbCrLf '-- FCS/펀칭 프로젝트코드 case "pc_prjcode_sub1" : co_sql=co_sql&" "&rsp.Fields(i).name&" varchar (4) default '', "&vbCrLf '-- 펀칭 프로젝트코드 (타입) case "pc_prjcode_sub2" : co_sql=co_sql&" "&rsp.Fields(i).name&" varchar (4) default '', "&vbCrLf '-- 펀칭 프로젝트코드 (타입) "pc_prjcode_sub1" 과 동일함 case "ffusercode" : co_sql=co_sql&" "&rsp.Fields(i).name&" varchar (20) default '', "&vbCrLf '-- 면접원 아이디 case "ffid" : co_sql=co_sql&" "&rsp.Fields(i).name&" int , "&vbCrLf '-- 설문지 아이디 case else : co_sql=co_sql&" ["&rsp.Fields(i).name&"] varchar(200) default '' , "&vbCrLf '-- 검증문항 end select Next rsp.Close co_sql=co_sql&" r_error int , "&vbCrLf '-- 에러체크용 co_sql=co_sql&" m_error int , "&vbCrLf '-- 에러체크용 co_sql=co_sql&" s_error int , "&vbCrLf '-- 에러체크용 co_sql=co_sql&" q_error int , "&vbCrLf '-- 에러체크용 co_sql=co_sql&" insert_date datetime default getdate() ) "&vbCrLf if xprint="1" then response.write co_sql&"

" adoconn.execute co_sql '-- 가상테이블에 데이터 insert co_sql=fun_sql(co_table) if xprint="1" then response.write co_sql&"

" adoconn.execute co_sql '-- 면접원 코드변경 처리 update co_sql=" update "&co_table&" set "&vbCrLf co_sql=co_sql&" ffusercode=B.ffusercode_change "&vbCrLf co_sql=co_sql&" from "&co_table&" as A "&vbCrLf co_sql=co_sql&" inner join "&vbCrLf co_sql=co_sql&" ( "&vbCrLf co_sql=co_sql&" select ffusercode, ffusercode_change from [dbo].[T_RES_FIELD_USER_CHANGE] "&vbCrLf co_sql=co_sql&" where ting='1' "&vbCrLf co_sql=co_sql&" and len(ffusercode)=6 "&vbCrLf '-- 정상적인 면접원코드 는 6자리임 co_sql=co_sql&" and pu_child_sn='"&pn_cd&"' "&vbCrLf co_sql=co_sql&" and pu_type='"&pu_prjcode_type&"' "&vbCrLf co_sql=co_sql&" ) B "&vbCrLf co_sql=co_sql&" on A.ffusercode=B.ffusercode "&vbCrLf if xprint="1" then response.write co_sql&"

" adoconn.execute co_sql '--[정형기] 사용은 하지 않지만 일단 유지 '##### ERR 처리(s_error) ######################################################### '--s_error : [dbo].[T_AREA_SID] 기준 범위를 벗어난 리스트아이디인 경우 "1" 로 표시함 co_sql=" update "&co_table&" set "&vbCrLf co_sql=co_sql&" s_error='1' "&vbCrLf co_sql=co_sql&" where (ffid<'"&fcs_type__ss&"' or ffid>'"&fcs_type__ee&"') " if xprint="1" then response.write co_sql&"

" adoconn.execute co_sql '--[정형기] 현재 설문지 ID는 설정중이므로 유지 '############################################################################### '-- 펀칭데이터중 중복 페이퍼 아이디 - s_error 처리 co_sql=" update "&co_table&" set "&vbCrLf co_sql=co_sql&" s_error='1' "&vbCrLf co_sql=co_sql&" where id not in ( "&vbCrLf co_sql=co_sql&" select max(id) from "&co_table&" "&vbCrLf co_sql=co_sql&" group by ffid "&vbCrLf co_sql=co_sql&" ) "&vbCrLf if xprint="1" then response.write co_sql&"

" adoconn.execute co_sql '--[정형기] 펀칭데이터는 프로그램 자체적으로 중복을 허용하지 않음 '################################################################################ '-- r_error : 응답자 중복에러(모든 FF프로젝트 검색기간(ckday) 내 중복시) '-- 응답자이름, 연락처1,연락처2 가져오기 dim co_name, co_tel1, co_tel2 co_name="" : co_tel1="" : co_tel2="" co_sql=" select * from [project2].[dbo].[T_RES_SQ_QUE_LAB] with(nolock) " co_sql=co_sql&" where ting='1' " '-- 사용(1) co_sql=co_sql&" and pu_child_sn='"&pn_cd&"' " co_sql=co_sql&" and pu_type='"&pu_prjcode_type&"' " '-- fcs지역 co_sql=co_sql&" and fcs_area='"&pu_prjcode_area&"' " co_sql=co_sql&" and pu_que_type in ('2','3') " '-- 응답자(3), 연락처(2) co_sql=co_sql&" order by tuser asc, tphone_1 asc, tphone_2 asc " if xprint="1" then response.write co_sql&"

" rsp.Open co_sql, adoConn, 1 while not rsp.Eof '-- 응답자 if rsp("tuser_name")<>"" then co_name=rsp("pu_que") '-- 휴대폰 if rsp("tphone_1")<>"" then co_tel1=rsp("pu_que") '-- 일반번호 if rsp("tphone_2")<>"" then co_tel2=rsp("pu_que") rsp.movenext Wend rsp.Close dim xxsql : xxsql="" '-- 데이터 이관전 FCS데이터에서 중복 체크용 dim in_cksql : in_cksql="" '-- 펀칭데이터 응답자 중복 체크용 if co_tel2<>"" then xxsql=" on 1=1 " xxsql=xxsql&" and replace(replace(isnull(A.["&co_name&"],''),'-',''),' ','')=B.r_name " xxsql=xxsql&" and replace(replace(isnull(A.["&co_tel2&"],''),'-',''),' ','')=B.r_tel " '----------------- in_cksql=" replace(replace(isnull(["&co_name&"],''),'-',''),' ',''), replace(replace(isnull(["&co_tel2&"],''),'-',''),' ','') " elseif co_tel1<>"" then xxsql=" on 1=1 " xxsql=xxsql&" and replace(replace(isnull(A.["&co_name&"],''),'-',''),' ','')=B.r_name " xxsql=xxsql&" and replace(replace(isnull(A.["&co_tel1&"],''),'-',''),' ','')=B.r_phone " '----------------- in_cksql=" replace(replace(isnull(["&co_name&"],''),'-',''),' ',''), replace(replace(isnull(["&co_tel1&"],''),'-',''),' ','') " else xxsql=" on 1=1 " xxsql=xxsql&" and replace(replace(isnull(A.["&co_name&"],''),'-',''),' ','')=B.r_name " xxsql=xxsql&" where (replace(replace(isnull(A.["&co_tel2&"],''),'-',''),' ','')=B.r_tel or replace(replace(isnull(A.["&co_tel1&"],''),'-',''),' ','')=B.r_phone) " '----------------- in_cksql=" replace(replace(isnull(["&co_name&"],''),'-',''),' ',''), replace(replace(isnull(["&co_tel2&"],''),'-',''),' ',''), replace(replace(isnull(["&co_tel1&"],''),'-',''),' ','') " end if '##### ERR 처리(r_error) ######################################################### '-- r_error : 응답자 중복에러 처리(본인건 중복제외: 정보업데이트 할수 있도록!!) co_sql=" DECLARE @dblck_id int "&vbCrLf co_sql=co_sql&" DECLARE cur_dblck CURSOR FOR "&vbCrLf co_sql=co_sql&" select A.ffid from "&vbCrLf co_sql=co_sql&" ( select * from "&co_table&" with(nolock) ) A "&vbCrLf co_sql=co_sql&" inner join "&vbCrLf co_sql=co_sql&" ( "&vbCrLf co_sql=co_sql&" select h.r_name,h.r_tel,h.r_phone "&vbCrLf co_sql=co_sql&" from ( "&vbCrLf co_sql=co_sql&" select "&vbCrLf co_sql=co_sql&" p_sn, s_id, "&vbCrLf co_sql=co_sql&" replace(replace(isnull(r_name,''),'-',''),' ','') as r_name, "&vbCrLf co_sql=co_sql&" replace(replace(isnull(r_tel,''),'-',''),' ','') as r_tel, "&vbCrLf co_sql=co_sql&" replace(replace(isnull(r_phone,''),'-',''),' ','') as r_phone "&vbCrLf co_sql=co_sql&" from [dbo].[res] with(nolock) "&vbCrLf co_sql=co_sql&" where DelGubun='N' "&vbCrLf co_sql=co_sql&" and replace(r_date,'-','')>=replace('"&ckday&"','-','') "&vbCrLf co_sql=co_sql&" ) h "&vbCrLf co_sql=co_sql&" where h.p_sn+':'+cast(h.s_id as varchar(10)) not in ( "&vbCrLf co_sql=co_sql&" select pc_prjcode+':'+cast(ffid as varchar(10)) from "&co_table&" with(nolock) "&vbCrLf co_sql=co_sql&" ) "&vbCrLf co_sql=co_sql&" group by h.r_name,h.r_tel,h.r_phone "&vbCrLf co_sql=co_sql&" ) B "&vbCrLf co_sql=co_sql&xxsql co_sql=co_sql&" OPEN cur_dblck "&vbCrLf co_sql=co_sql&" FETCH NEXT FROM cur_dblck INTO @dblck_id "&vbCrLf co_sql=co_sql&" WHILE @@FETCH_STATUS = 0 "&vbCrLf co_sql=co_sql&" BEGIN "&vbCrLf co_sql=co_sql&" update "&co_table&" set "&vbCrLf co_sql=co_sql&" r_error='1' "&vbCrLf co_sql=co_sql&" where ffid=@dblck_id "&vbCrLf co_sql=co_sql&" FETCH NEXT FROM cur_dblck INTO @dblck_id "&vbCrLf co_sql=co_sql&" END "&vbCrLf co_sql=co_sql&" CLOSE cur_dblck "&vbCrLf co_sql=co_sql&" DEALLOCATE cur_dblck "&vbCrLf if xprint="1" then response.write co_sql&"

" adoconn.execute co_sql '##### ERR 처리(m_error) ######################################################### '-- m_error : 면접원 코드가 없거나, "활동"이 아닌 면접원일 경우 - 인트라넷에 없는코드 co_sql=" select A.ffid from "&vbCrLf co_sql=co_sql&" ( "&vbCrLf co_sql=co_sql&" select "&vbCrLf co_sql=co_sql&" case when left(ffusercode,2)='1-' then ffusercode else '1-'+ffusercode end as ff "&vbCrLf co_sql=co_sql&" ,ffusercode, ffid from "&co_table&" "&vbCrLf co_sql=co_sql&" ) A "&vbCrLf co_sql=co_sql&" left join "&vbCrLf co_sql=co_sql&" ( "&vbCrLf co_sql=co_sql&" select new_id from [project2].[dbo].[man] with(nolock) "&vbCrLf co_sql=co_sql&" where m_activity='활동' "&vbCrLf co_sql=co_sql&" and left(new_id,2)='1-' "&vbCrLf co_sql=co_sql&" ) B "&vbCrLf co_sql=co_sql&" on A.ff=B.new_id "&vbCrLf co_sql=co_sql&" where B.new_id is null "&vbCrLf '-- man 테이블에 면접원 정보가 없는경우 Err 처리 po_sql=" update "&co_table&" set "&vbCrLf po_sql=po_sql&" m_error='1' "&vbCrLf po_sql=po_sql&" from "&co_table&" as AA "&vbCrLf po_sql=po_sql&" inner join "&vbCrLf po_sql=po_sql&" ( "&vbCrLf po_sql=po_sql&co_sql po_sql=po_sql&" ) BB "&vbCrLf po_sql=po_sql&" on AA.ffid=BB.ffid "&vbCrLf if xprint="1" then response.write po_sql&"

" adoconn.execute po_sql '##### ERR 처리(q_error) ######################################################### '-- q_error : FCS에서 1번이라도 검증을 진행한경우 (설문지ID 기준) '-- [정형기] 검증데이터에 존재하는 경우 가상테이블 삭제 po_sql=po_sql&" DELETE "&vbCrLf po_sql=po_sql&" FROM "&co_table&" "&vbCrLf po_sql=po_sql&" WHERE ffid in "&vbCrLf po_sql=po_sql&" ( "&vbCrLf po_sql=po_sql&" select s_id from [project2].[dbo].[T_INSPECTION_RES] with(nolock) "&vbCrLf po_sql=po_sql&" where p_sn='"&pn_cd&"' "&vbCrLf po_sql=po_sql&" ) "&vbCrLf if xprint="1" then response.write po_sql&"

" adoconn.execute po_sql '-- q_error : 현재 이관데이터로 존재하는 경우 (설문지ID 기준) '-- [정형기] 이관데이터에 존재하는 경우 가상테이블 삭제 po_sql=po_sql&" DELETE "&vbCrLf po_sql=po_sql&" FROM "&co_table&" "&vbCrLf po_sql=po_sql&" WHERE ffid in "&vbCrLf po_sql=po_sql&" ( "&vbCrLf po_sql=po_sql&" select s_id from [project2].[dbo].[RES] with(nolock) "&vbCrLf po_sql=po_sql&" where p_sn='"&pn_cd&"' "&vbCrLf po_sql=po_sql&" and DelGubun = 'N' "&vbCrLf po_sql=po_sql&" ) "&vbCrLf if xprint="1" then response.write po_sql&"

" adoconn.execute po_sql '###### 펀칭데이터내 응답중복자 (r_error) 처리 ###################################### po_sql=" update "&co_table&" set "&vbCrLf po_sql=po_sql&" r_error='1' "&vbCrLf po_sql=po_sql&" from "&co_table&" as AA "&vbCrLf po_sql=po_sql&" inner join ( "&vbCrLf po_sql=po_sql&" select A.id from "&vbCrLf po_sql=po_sql&" (select * from "&co_table&" ) A "&vbCrLf po_sql=po_sql&" left join "&vbCrLf po_sql=po_sql&" ( "&vbCrLf po_sql=po_sql&" select max(id) as id2 from "&co_table&" "&vbCrLf po_sql=po_sql&" where (isnull(r_error,'0')+isnull(m_error,'0')+isnull(s_error,'0')+isnull(q_error,'0'))=0 "&vbCrLf po_sql=po_sql&" group by "&in_cksql&" "&vbCrLf '-- 응답자 중복문항에 대한 group by po_sql=po_sql&" ) B "&vbCrLf po_sql=po_sql&" on A.id=B.id2 "&vbCrLf po_sql=po_sql&" where (isnull(A.r_error,'0')+isnull(A.m_error,'0')+isnull(A.s_error,'0')+isnull(A.q_error,'0'))=0 "&vbCrLf po_sql=po_sql&" and B.id2 is null "&vbCrLf po_sql=po_sql&" ) BB "&vbCrLf po_sql=po_sql&" on AA.id=BB.id "&vbCrLf if xprint="1" then response.write po_sql&"

" adoconn.execute po_sql %> KRC onload="javascript:js_init();" <%end if%> >
<%response.end %> <% case else '-- 데이터 리스트 출력 xTable=xTable&"" xTable=xTable&"" xTable=xTable&"" '----------------------------------------------------------------------------------------------- '-- Default ---------------------- if not rsp.eof then Twidth=cdbl(Twidth)+100 xTable=xTable&"" if xfield<>"" then xfield=xfield&"," xfield=xfield&"[ffid]" end if For i=0 To rsp.Fields.Count-1 Select Case rsp.Fields(i).name Case "t", "ff", "id", "oid","pc_prjcode_sub2","ffid" '-- 제외 case "pc_prjcode" Twidth=cdbl(Twidth)+120 xTable=xTable&"" if xfield<>"" then xfield=xfield&"," xfield=xfield&"["&rsp.Fields(i).name&"]" case "pc_prjcode_sub1" Twidth=cdbl(Twidth)+100 xTable=xTable&"" if xfield<>"" then xfield=xfield&"," xfield=xfield&"["&rsp.Fields(i).name&"]" case "ffusercode" Twidth=cdbl(Twidth)+100 xTable=xTable&"" if xfield<>"" then xfield=xfield&"," xfield=xfield&"["&rsp.Fields(i).name&"]" case "ffid" Twidth=cdbl(Twidth)+100 xTable=xTable&"" if xfield<>"" then xfield=xfield&"," xfield=xfield&"["&rsp.Fields(i).name&"]" case "r_error" Twidth=cdbl(Twidth)+120 xTable=xTable&"" if xfield<>"" then xfield=xfield&"," xfield=xfield&" case when A."&rsp.Fields(i).name&"='1' then '에러' else '' end as xr_error " case "m_error" Twidth=cdbl(Twidth)+120 xTable=xTable&"" if xfield<>"" then xfield=xfield&"," xfield=xfield&" case when A."&rsp.Fields(i).name&"='1' then '에러' else '' end as xm_error " case "s_error" Twidth=cdbl(Twidth)+130 xTable=xTable&"" if xfield<>"" then xfield=xfield&"," xfield=xfield&" case when A."&rsp.Fields(i).name&"='1' then '에러' else '' end as xs_error " case "q_error" Twidth=cdbl(Twidth)+90 xTable=xTable&"" if xfield<>"" then xfield=xfield&"," xfield=xfield&" case when A."&rsp.Fields(i).name&"='1' then '에러' else '' end as xq_error " case "tid" Twidth=cdbl(Twidth)+100 xTable=xTable&"" if xfield<>"" then xfield=xfield&"," xfield=xfield&"["&rsp.Fields(i).name&"]" case "insert_date" Twidth=cdbl(Twidth)+100 xTable=xTable&"" if xfield<>"" then xfield=xfield&"," xfield=xfield&" case when A.t=0 then convert(nvarchar(10),"&rsp.Fields(i).name&",120) else 'FCS 이관불가' end as tdate " case "면접원코드" Twidth=cdbl(Twidth)+100 xTable=xTable&"" if xfield<>"" then xfield=xfield&"," xfield=xfield&" isnull(B.new_id,'정보없음') as 면접원코드 " case "면접원이름" Twidth=cdbl(Twidth)+100 xTable=xTable&"" if xfield<>"" then xfield=xfield&"," xfield=xfield&" isnull(B.m_name,'정보없음') as 면접원이름 " case "생년월일" Twidth=cdbl(Twidth)+100 xTable=xTable&"" if xfield<>"" then xfield=xfield&"," xfield=xfield&" isnull(B.m_jumin,'정보없음') as 생년월일 " Case Else '-- 출력 Twidth=cdbl(Twidth)+100 xTable=xTable&"" if xfield<>"" then xfield=xfield&"," xfield=xfield&"["&rsp.Fields(i).name&"]" End Select next rsp.Close xTable=xTable&"" response.Write replace(xTable,"[Twidth]",Twidth) '++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ '-- 데이터 정리후 - 출력(데이터) tsql=" select A.t, "&xfield&" "&vbCrLf tsql=tsql&" from "&vbCrLf tsql=tsql&" ( "&vbCrLf tsql=tsql&" select "&vbCrLf tsql=tsql&" (isnull(r_error,'0')+isnull(m_error,'0')+isnull(s_error,'0')+isnull(q_error,'0')) as t, "&vbCrLf tsql=tsql&" case when left(ffusercode,2)='1-' then ffusercode else '1-'+ffusercode end as ff, "&vbCrLf tsql=tsql&" * "&vbCrLf tsql=tsql&" from "&co_table&" "&vbCrLf tsql=tsql&" ) A "&vbCrLf tsql=tsql&" left join "&vbCrLf tsql=tsql&" ( "&vbCrLf tsql=tsql&" select new_id, m_name, left(m_jumin,6) as m_jumin from [project2].[dbo].[man] with(nolock) "&vbCrLf tsql=tsql&" where m_activity='활동' "&vbCrLf tsql=tsql&" and left(new_id,2)='1-' "&vbCrLf tsql=tsql&" ) B "&vbCrLf tsql=tsql&" on A.ff=B.new_id "&vbCrLf tsql=tsql&" order by A.ffid asc "&vbCrLf '-- tsql=tsql&" order by B.new_id asc, A.t desc "&vbCrLf if xprint="1" then response.write tsql&"

" rsp.Open tsql, adoConn, 1 dim k : k=1 xck_num=0 '########################################################################### if rsp.Eof then '-- 이관 데이터 없음 response.write "※ 이관하실 데이터가 없습니다 " rsp.close '############################################## '-- 가삭테이블 삭제 po_sql=" drop table "&co_table&" " if xprint="1" then response.write po_sql&"

" adoconn.execute po_sql '############################################## %> <% response.end end if '########################################################################### Response.Buffer = True '----- 버퍼사용 dim ck_data : ck_data=0 while not rsp.Eof if cdbl(rsp("t"))>0 then xck_num=1 '-- 데이터출력 ↓ response.write "" For i=1 To rsp.Fields.Count-1 if isnull(rsp(i)) or trim(rsp(i))="" then response.write "" else response.write "" 'response.write "" End If '------------------------------------------------ if trim(i)=trim(rsp.Fields.Count-1) then if instr(rsp(i),"FCS 이관불가")=0 then ck_data=1 '-- 이관할 데이터 있음 end if '------------------------------------------------ Next response.write "" '-- 데이터출력 ↑ if k mod 500=0 then Response.flush ' 500번째마다 버퍼내용 출력... k=k+1 rsp.movenext wend rsp.close Response.flush ' 최종 버퍼에서 출력. Response.Clear '버퍼 내용 초기화 response.write "" response.write "
설문지아이디
(입력)
펀칭/FCS 프로젝트코드펀칭타입면접원코드설문지ID응답자중복 에러
(업로드불가)
면접원코드 에러
(업로드불가)
리스트ID 에러
(업로드불가)
이관 및 검증진행
(업로드불가)
펀처정보FCS 이관처리일면접원코드면접원이름생년월일"&rsp.Fields(i).name&"
 "&rsp(i)&""&rsp(i)&":"& trim(i)&":"&trim(rsp.Fields.Count-1)&":"&instr(rsp(i),"FCS 이관불가")&":"&ck_data&"
" response.write "
" end select %> <% For Each s In request.form %><% next %> <% '############################################## '-- 가상테이블 삭제 po_sql=" drop table "&co_table&" " if xprint="1" then response.write po_sql&"

" adoconn.execute po_sql '############################################## %> <% function fun_sql(tmode) dim tval dim sql dim sqArr sql=" DECLARE @Prod varchar(max) "&vbCrLf sql=sql&" SET @Prod = '' "&vbCrLf sql=sql&" SELECT @Prod = @Prod + '' + pu_que + ',' "&vbCrLf sql=sql&" FROM ( "&vbCrLf sql=sql&" select id, pu_que from [project2].[dbo].[T_RES_SQ_QUE_LAB] "&vbCrLf sql=sql&" where ting='1' "&vbCrLf sql=sql&" and pu_child_sn='"&pn_cd&"' "&vbCrLf sql=sql&" and pu_type='"&pu_prjcode_type&"' "&vbCrLf sql=sql&" and pu_que_type in ('0','2','3') "&vbCrLf '-- 검증문항(0), 검증전화번호(2), 이름(3) sql=sql&" ) A "&vbCrLf sql=sql&" order by A.id asc "&vbCrLf sql=sql&" SET @Prod = LEFT(@Prod, LEN(@Prod) - 1) "&vbCrLf sql=sql&" select @Prod as 'que' "&vbCrLf rsm.Open sql, adoConn, 1 , 1 sqArr = split(rsm("que"),",") sql=" DECLARE @Prod varchar(max) "&vbCrLf sql=sql&" SET @Prod = '' "&vbCrLf sql=sql&" SELECT @Prod = @Prod + '[' + pu_que + '],' "&vbCrLf sql=sql&" FROM ( "&vbCrLf sql=sql&" select id, pu_que from [project2].[dbo].[T_RES_SQ_QUE_LAB] "&vbCrLf sql=sql&" where ting='1' "&vbCrLf sql=sql&" and pu_child_sn='"&pn_cd&"' "&vbCrLf sql=sql&" and pu_type='"&pu_prjcode_type&"' "&vbCrLf '-- fcs지역 sql=sql&" and fcs_area='"&pu_prjcode_area&"' "&vbCrLf sql=sql&" and pu_que_type in ('0','2','3') "&vbCrLf '-- 검증문항(0), 검증전화번호(2), 이름(3) sql=sql&" ) A "&vbCrLf sql=sql&" order by A.id asc "&vbCrLf sql=sql&" SET @Prod = LEFT(@Prod, LEN(@Prod) - 1) "&vbCrLf sql=sql&" EXEC (' " if tmode<>"" then sql=sql&" insert into "&tmode&" " end if sql=sql&" select "&vbCrLf sql=sql&" A.oid,A.tid,A.pc_prjcode,A.pc_prjcode_sub1,A.pc_prjcode_sub2, "&vbCrLf sql=sql&" case when left(A.ffusercode,2)=''1-'' then A.ffusercode else isnull(''1-''+REPLICATE(''0'',4 - LEN(A.ffusercode))+cast(A.ffusercode as varchar(10)),'''') end as ffusercode , "&vbCrLf '-- 면접원코드 포멧 자릿수 채워줌 sql=sql&" B.* "&vbCrLf if tmode<>"" then sql=sql&" , null as r_error, null as m_error,null as s_error,null as q_error, getdate() as insert_date " end if sql=sql&" from "&vbCrLf sql=sql&" ( "&vbCrLf sql=sql&" select max(id) as oid, "&vbCrLf sql=sql&" tid,pc_prjcode,pc_prjcode_sub1,pc_prjcode_sub2,ffusercode,ffid "&vbCrLf sql=sql&" from [project2].[dbo].[punching_data] "&vbCrLf sql=sql&" where pc_prjcode=''"&pn_cd&"'' "&vbCrLf sql=sql&" and pc_prjcode_sub1=''"&pu_prjcode_type&"'' "&vbCrLf sql=sql&" and ff_ing=''1'' "&vbCrLf '--- 검증이관 데이터 -------------------------------------------------------------------- sql=sql&" and ffid in ( "&vbCrLf sql=sql&" select ttelnum from [punching].[dbo].[tb_response] "&vbCrLf sql=sql&" where tprocode=''"&pn_cd&"'' "&vbCrLf sql=sql&" and char(ttype+65)=''"&pu_prjcode_type&"'' "&vbCrLf sql=sql&" ) "&vbCrLf '-------------------------------------------------------------------------------------- sql=sql&" group by tid,pc_prjcode,pc_prjcode_sub1,pc_prjcode_sub2,ffusercode,ffid "&vbCrLf sql=sql&" ) A "&vbCrLf sql=sql&" left join "&vbCrLf sql=sql&" ( "&vbCrLf sql=sql&" select * from "&vbCrLf sql=sql&" (SELECT ffid,ffque, ffans FROM [project2].[dbo].[punching_data] "&vbCrLf sql=sql&" where pc_prjcode=''"&pn_cd&"'' "&vbCrLf sql=sql&" and pc_prjcode_sub1=''"&pu_prjcode_type&"'' "&vbCrLf sql=sql&" and ff_ing=''1'' "&vbCrLf sql=sql&" ) Q "&vbCrLf sql=sql&" PIVOT ( max(ffans) FOR ffque IN (' + @Prod + ') "&vbCrLf sql=sql&" ) AS PVT "&vbCrLf sql=sql&" ) B "&vbCrLf sql=sql&" on A.ffid=B.ffid "&vbCrLf sql=sql&" where 1=1 "&vbCrLf for i = 0 to UBound(sqArr) sql=sql&" and " & sqArr(i) & " <> ''-1'' "&vbCrLf next sql=sql&" order by A.oid asc ') "&vbCrLf tval=sql fun_sql=tval rsm.Close end function %>