<%' Response.CharSet="utf-8" Response.codepage="65001" Response.ContentType="text/html;charset=utf-8" '정형기 기록 - 사용페이지 search_chasu = "" project = request("kikoan_id") search_chasu = request("search_chasu") If search_chasu = "" Then search_chasu = "전체표본" End if categori_01 = request("categori_01") categori_02 = request("categori_02") categori_03 = request("categori_03") categori_04 = request("categori_04") categori_05 = request("categori_05") categori_06 = request("categori_06") categori_07 = request("categori_07") categori_cnt = request("categori_cnt") command = request("command") '테이블 colspan을 위한 count count = 2 ' response.Write search_chasu if command="excel" then 'Response.Buffer = false response.Write "-------------------------------------------------------------------------------------
" Response.CacheControl = "public" Response.ContentType = "application/vnd.ms-excel" Response.AddHeader "Content-Disposition","attachment;filename=컨택 집계 현황 리스트.xls" end if Dim comp_area() query = " select comp_area from list where kikoan_id = '" & project & "' and comp_area <> '전국' group by comp_area order by comp_area " rs.Open query, adoConn, 1 If rs.recordCount > 0 Then if rs("comp_area") <> "" then ReDim comp_area(rs.recordCount) for z=1 to rs.recordCount comp_area(z) = rs("comp_area") ' response.Write comp_area(z) & "
" rs.movenext Next Else ReDim comp_area(0) end if Else ReDim comp_area(0) End If rs.close 'response.Write "categori_01 : " & categori_01 & "
" 'response.Write "categori_02 : " & categori_02 & "
" 'response.Write "categori_03 : " & categori_03 & "
" query = " select id, kikoan_name, contac_stat, contac_stat_label, view_index " if (categori_01 <> "" and categori_01 <> "분류1") Then query = query & " , categori_01 , categori_01_label " End If if (categori_02 <> "" and categori_02 <> "분류2") Then query = query & " , categori_02 , categori_02_label " End If if (categori_03 <> "" and categori_03 <> "분류3") Then query = query & " , categori_03 , categori_03_label " End If if (categori_04 <> "" and categori_04 <> "분류4") Then query = query & " , categori_04 , categori_04_label " End If if (categori_05 <> "" and categori_05 <> "분류5") Then query = query & " , categori_05 , categori_05_label " End If if (categori_06 <> "" and categori_06 <> "분류6") Then query = query & " , categori_06 , categori_06_label " End If if (categori_07 <> "" and categori_07 <> "분류7") Then query = query & " , categori_07 , categori_07_label " End if query = query & " , COUNT(contac_stat) as COUNT " query = query & " , sum(전국) as 전국 " If UBound(comp_area) > 0 then for z=1 to UBound(comp_area) query = query & "   , sum([" & Replace(Replace(comp_area(z), ")", ""), "(", "") & "]) as  '" & comp_area(z) & "' " Next End if ' query = query & " , sum(서울) as 서울 " ' query = query & " , sum(인천) as 인천 " ' query = query & " , sum(대전) as 대전 " ' query = query & " , sum(대구) as 대구 " ' query = query & " , sum(부산) as 부산 " ' query = query & " , sum(광주) as 광주 " ' query = query & " , sum(울산) as 울산 " ' query = query & " , sum(강원) as 강원 " ' query = query & " , sum(경기) as 경기 " ' query = query & " , sum(충남) as 충남 " ' query = query & " , sum(충북) as 충북 " ' query = query & " , sum(경남) as 경남 " ' query = query & " , sum(경북) as 경북 " ' query = query & " , sum(전남) as 전남 " ' query = query & " , sum(전북) as 전북 " ' query = query & " , sum(세종) as 세종 " ' query = query & " , sum(제주) as 제주 " query = query & " from ( " query = query & " SELECT KL.id, KL.kikoan_name, cs.contac_stat_label, cs.view_index " 'query = query & " , categori_01, categori_02, categori_03, categori_04, categori_05 " if (categori_01 <> "" and categori_01 <> "분류1") Then query = query & " , L.categori_01 " query = query & " , (SELECT category_label FROM category_code WHERE kikoan_id = KL.id and category_index = 1 and category_code = L.categori_01) as categori_01_label " count = count+1 end if if (categori_02 <> "" and categori_02 <> "분류2") Then query = query & " , L.categori_02 " query = query & " , (SELECT category_label FROM category_code WHERE kikoan_id = KL.id and category_index = 2 and category_code = L.categori_02) as categori_02_label " count = count+1 end if if (categori_03 <> "" and categori_03 <> "분류3") Then query = query & " , L.categori_03 " query = query & " , (SELECT category_label FROM category_code WHERE kikoan_id = KL.id and category_index = 3 and category_code = L.categori_03) as categori_03_label " count = count+1 end if if categori_04 <> "" and categori_04 <> "분류4" Then query = query & " , L.categori_04 " query = query & " , (SELECT category_label FROM category_code WHERE kikoan_id = KL.id and category_index = 4 and category_code = L.categori_04) as categori_04_label " count = count+1 end if if categori_05 <> "" and categori_05 <> "분류5" Then query = query & " , L.categori_05 " query = query & " , (SELECT category_label FROM category_code WHERE kikoan_id = KL.id and category_index = 5 and category_code = L.categori_05) as categori_05_label " count = count+1 end If if categori_06 <> "" and categori_06 <> "분류6" Then query = query & " , L.categori_06 " query = query & " , (SELECT category_label FROM category_code WHERE kikoan_id = KL.id and category_index = 6 and category_code = L.categori_06) as categori_06_label " count = count+1 end If if categori_07 <> "" and categori_07 <> "분류7" Then query = query & " , L.categori_07 " query = query & " , (SELECT category_label FROM category_code WHERE kikoan_id = KL.id and category_index = 7 and category_code = L.categori_07) as categori_07_label " count = count+1 end if query = query & " , L.contac_stat " query = query & " , case when comp_area = '전국' then 1 else 0 end as 전국 " If UBound(comp_area) > 0 Then for z=1 to UBound(comp_area) query = query & " , case when comp_area = '" & comp_area(z) & "' then 1 else 0 end as '" & Replace(Replace(comp_area(z), ")", ""), "(", "") & "' " Next End if ' query = query & " , case when comp_area = '서울' then 1 else 0 end as 서울 " ' query = query & " , case when comp_area = '인천' then 1 else 0 end as 인천 " ' query = query & " , case when comp_area = '대전' then 1 else 0 end as 대전 " ' query = query & " , case when comp_area = '대구' then 1 else 0 end as 대구 " ' query = query & " , case when comp_area = '부산' then 1 else 0 end as 부산 " ' query = query & " , case when comp_area = '광주' then 1 else 0 end as 광주 " ' query = query & " , case when comp_area = '울산' then 1 else 0 end as 울산 " ' query = query & " , case when comp_area = '강원' then 1 else 0 end as 강원 " ' query = query & " , case when comp_area = '경기' then 1 else 0 end as 경기 " ' query = query & " , case when comp_area = '충남' then 1 else 0 end as 충남 " ' query = query & " , case when comp_area = '충북' then 1 else 0 end as 충북 " ' query = query & " , case when comp_area = '경남' then 1 else 0 end as 경남 " ' query = query & " , case when comp_area = '경북' then 1 else 0 end as 경북 " ' query = query & " , case when comp_area = '전남' then 1 else 0 end as 전남 " ' query = query & " , case when comp_area = '전북' then 1 else 0 end as 전북 " ' query = query & " , case when comp_area = '세종' then 1 else 0 end as 세종 " ' query = query & " , case when comp_area = '제주' then 1 else 0 end as 제주 " query = query & " FROM kikoan_list KL LEFT OUTER JOIN list L ON cast(KL.id as varchar) = cast(L.kikoan_id as varchar) " query = query & " LEFT OUTER JOIN contac_stat CS ON KL.id = CS.kikoan_id AND L.contac_stat = cs.contac_stat " query = query & " WHERE KL.id = '" & project & "' " If search_chasu = "원표본" then query = query & " and L.chasu = '원표본' " End If query = query & " ) as T " ' query = query & " WHERE contac_stat = 1 " query = query & " GROUP BY id, kikoan_name, contac_stat, contac_stat_label, view_index " if categori_01 <> "" and categori_01 <> "분류1" then query = query & " , categori_01, categori_01_label " end if if categori_02 <> "" and categori_02 <> "분류2" then query = query & " , categori_02, categori_02_label " end if if categori_03 <> "" and categori_03 <> "분류3" then query = query & " , categori_03, categori_03_label " end if if categori_04 <> "" and categori_04 <> "분류4" then query = query & " , categori_04, categori_04_label " end if if categori_05 <> "" and categori_05 <> "분류5" then query = query & " , categori_05, categori_05_label " end If if categori_06 <> "" and categori_06 <> "분류6" then query = query & " , categori_06, categori_06_label " end If if categori_07 <> "" and categori_07 <> "분류7" then query = query & " , categori_07, categori_07_label " end If query = query & " ORDER BY " if categori_01 <> "" and categori_01 <> "분류1" then query = query & " categori_01 " end if if categori_02 <> "" and categori_02 <> "분류2" then query = query & " , categori_02 " end if if categori_03 <> "" and categori_03 <> "분류3" then query = query & " , categori_03 " end if if categori_04 <> "" and categori_04 <> "분류4" then query = query & " , categori_04 " end if if categori_05 <> "" and categori_05 <> "분류5" then query = query & " , categori_05 " end If if categori_06 <> "" and categori_06 <> "분류6" then query = query & " , categori_06 " end If if categori_07 <> "" and categori_07 <> "분류7" then query = query & " , categori_07 " end If if categori_01 <> "" and categori_01 <> "분류1" then query = query & " , view_index " else query = query & " view_index " end if 'response.Write query rsp.Open query, adoConn, 1 query = " select view_index, contac_stat, contac_stat_label from contac_stat where kikoan_id = " & project & " order by view_index " rs.Open query, adoConn, 1 Dim contact_status() If rs.recordCount > 0 Then ReDim contact_status(rs.recordCount, 2) for z=1 to rs.recordCount contact_status(z, 0) = rs("view_index") contact_status(z, 1) = rs("contac_stat") contact_status(z, 2) = rs("contac_stat_label") 'response.Write contact_status(z, 2) & "
" rs.movenext Next End If rs.close %>
<% if command <> "excel" then %>



<% end if %> <% if categori_01 <> "" and categori_01 <> "분류1" then %> <% end if %> <% if categori_02 <> "" and categori_02 <> "분류2" then %> <% end if %> <% if categori_03 <> "" and categori_03 <> "분류3" then %> <% end if %> <% if categori_04 <> "" and categori_04 <> "분류4" then %> <% end if %> <% if categori_05 <> "" and categori_05 <> "분류5" then %> <% end if %> <% if categori_06 <> "" and categori_06 <> "분류6" then %> <% end if %> <% if categori_07 <> "" and categori_07 <> "분류7" then %> <% end if %> <% If UBound(comp_area) > 0 Then for z=1 to UBound(comp_area) %> <% Next End if %> <% If rsp("count") > 0 Then Dim beforeCategory_01, beforeCategory_02, beforeCategory_03, beforeCategory_04, beforeCategory_05, beforeCategory_06, beforeCategory_07 Dim beforeCategory_01_label, beforeCategory_02_label, beforeCategory_03_label, beforeCategory_04_label, beforeCategory_05_label, beforeCategory_06_label, beforeCategory_07_label Dim lineNext Dim contact_stat_st_index, contact_stat_end_index Dim column_count, category_08_count contact_stat_st_index = 0 contact_stat_end_index = ubound(contact_status)-1 category_08_count = UBound(comp_area) '지역분류코드 갯수 column_count = categori_cnt + 3 + category_08_count '카테고리 갯수 + 컨택결과, 총갯수, 전국 + 지역분류코드 갯수' for i=1 to rsp.recordCount 'for i=1 to 5 lineNext = False If i > 1 Then If categori_cnt = 1 Then If Not(beforeCategory_01 = rsp("categori_01") ) then lineNext = True End if ElseIf categori_cnt = 2 Then If Not(beforeCategory_01 = rsp("categori_01") And beforeCategory_02 = rsp("categori_02") ) then lineNext = True End if ElseIf categori_cnt = 3 Then If Not(beforeCategory_01 = rsp("categori_01") And beforeCategory_02 = rsp("categori_02") And beforeCategory_03 = rsp("categori_03") ) then lineNext = True End if ElseIf categori_cnt = 4 Then If Not(beforeCategory_01 = rsp("categori_01") And beforeCategory_02 = rsp("categori_02") And beforeCategory_03 = rsp("categori_03") And beforeCategory_04 = rsp("categori_04")) then lineNext = True End if ElseIf categori_cnt = 5 Then If Not(beforeCategory_01 = rsp("categori_01") And beforeCategory_02 = rsp("categori_02") And beforeCategory_03 = rsp("categori_03") And beforeCategory_04 = rsp("categori_04") And beforeCategory_05 = rsp("categori_05")) then lineNext = True End if ElseIf categori_cnt = 6 Then If Not(beforeCategory_01 = rsp("categori_01") And beforeCategory_02 = rsp("categori_02") And beforeCategory_03 = rsp("categori_03") And beforeCategory_04 = rsp("categori_04") And beforeCategory_05 = rsp("categori_05") And beforeCategory_06 = rsp("categori_06")) then lineNext = True End if ElseIf categori_cnt = 7 Then If Not(beforeCategory_01 = rsp("categori_01") And beforeCategory_02 = rsp("categori_02") And beforeCategory_03 = rsp("categori_03") And beforeCategory_04 = rsp("categori_04") And beforeCategory_05 = rsp("categori_05") And beforeCategory_06 = rsp("categori_06") And beforeCategory_07 = rsp("categori_07")) then lineNext = True End if End if End If '분류가 바뀌기 전에 컨택 코드의 남은 부분을 그려줌~! If lineNext Then For z = contact_stat_st_index To contact_stat_end_index 'response.write "분류가 바뀌어 남은 부분 그림 z : " & z & "//" & contact_status(z+1, 2) & "
" %> <% if categori_01 <> "" and categori_01 <> "분류1" then %> <% end if %> <% if categori_02 <> "" and categori_02 <> "분류2" then %> <% end if %> <% if categori_03 <> "" and categori_03 <> "분류3" then %> <% end if %> <% if categori_04 <> "" and categori_04 <> "분류4" then %> <% end if %> <% if categori_05 <> "" and categori_05 <> "분류5" then %> <% end if %> <% if categori_06 <> "" and categori_06 <> "분류6" then %> <% end if %> <% if categori_07 <> "" and categori_07 <> "분류7" then %> <% end if %> <% For c = 1 To category_08_count %> <% next %> <% Next contact_stat_st_index = 0 End If %> <% If rsp("contac_stat_label") <> "" Then 'response.write "st~!
" '컨택 코드의 순서대로 그리기 위해~! 현재데이터와 비교하여 사이에 없는 컨택 코드는 0으로 그려줌~! For z = contact_stat_st_index To contact_stat_end_index 'response.write z & "//" & clng(rsp("contac_stat")) & "
" If z = clng(rsp("view_index")) Then 'response.write "같은대... z : " & z & "//stat : " & clng(rsp("view_index")) & "
" contact_stat_st_index = clng(rsp("view_index"))+1 Exit For elseIf z < clng(rsp("view_index")) Then 'response.write "z가 현재 컨택결과 값다 작을 때 z : " & z & "//stat : " & clng(rsp("view_index")) & "
" %> <% if categori_01 <> "" and categori_01 <> "분류1" then %> <% end if %> <% if categori_02 <> "" and categori_02 <> "분류2" then %> <% end if %> <% if categori_03 <> "" and categori_03 <> "분류3" then %> <% end if %> <% if categori_04 <> "" and categori_04 <> "분류4" then %> <% end if %> <% if categori_05 <> "" and categori_05 <> "분류5" then %> <% end if %> <% if categori_06 <> "" and categori_06 <> "분류6" then %> <% end if %> <% if categori_07 <> "" and categori_07 <> "분류7" then %> <% end if %> <% For c = 1 To category_08_count %> <% next %> <% End if Next 'response.write "end~!
" For z = 1 To categori_cnt If categori_cnt = 1 Then beforeCategory_01 = rsp("categori_01") beforeCategory_01_label = rsp("categori_01_label") ElseIf categori_cnt = 2 Then beforeCategory_01 = rsp("categori_01") beforeCategory_02 = rsp("categori_02") beforeCategory_01_label = rsp("categori_01_label") beforeCategory_02_label = rsp("categori_02_label") ElseIf categori_cnt = 3 Then beforeCategory_01 = rsp("categori_01") beforeCategory_02 = rsp("categori_02") beforeCategory_03 = rsp("categori_03") beforeCategory_01_label = rsp("categori_01_label") beforeCategory_02_label = rsp("categori_02_label") beforeCategory_03_label = rsp("categori_03_label") ElseIf categori_cnt = 4 Then beforeCategory_01 = rsp("categori_01") beforeCategory_02 = rsp("categori_02") beforeCategory_03 = rsp("categori_03") beforeCategory_04 = rsp("categori_04") beforeCategory_01_label = rsp("categori_01_label") beforeCategory_02_label = rsp("categori_02_label") beforeCategory_03_label = rsp("categori_03_label") beforeCategory_04_label = rsp("categori_04_label") ElseIf categori_cnt = 5 Then beforeCategory_01 = rsp("categori_01") beforeCategory_02 = rsp("categori_02") beforeCategory_03 = rsp("categori_03") beforeCategory_04 = rsp("categori_04") beforeCategory_05 = rsp("categori_05") beforeCategory_01_label = rsp("categori_01_label") beforeCategory_02_label = rsp("categori_02_label") beforeCategory_03_label = rsp("categori_03_label") beforeCategory_04_label = rsp("categori_04_label") beforeCategory_05_label = rsp("categori_05_label") ElseIf categori_cnt = 6 Then beforeCategory_01 = rsp("categori_01") beforeCategory_02 = rsp("categori_02") beforeCategory_03 = rsp("categori_03") beforeCategory_04 = rsp("categori_04") beforeCategory_05 = rsp("categori_05") beforeCategory_06 = rsp("categori_06") beforeCategory_01_label = rsp("categori_01_label") beforeCategory_02_label = rsp("categori_02_label") beforeCategory_03_label = rsp("categori_03_label") beforeCategory_04_label = rsp("categori_04_label") beforeCategory_05_label = rsp("categori_05_label") beforeCategory_06_label = rsp("categori_06_label") ElseIf categori_cnt = 7 Then beforeCategory_01 = rsp("categori_01") beforeCategory_02 = rsp("categori_02") beforeCategory_03 = rsp("categori_03") beforeCategory_04 = rsp("categori_04") beforeCategory_05 = rsp("categori_05") beforeCategory_06 = rsp("categori_06") beforeCategory_07 = rsp("categori_07") beforeCategory_01_label = rsp("categori_01_label") beforeCategory_02_label = rsp("categori_02_label") beforeCategory_03_label = rsp("categori_03_label") beforeCategory_04_label = rsp("categori_04_label") beforeCategory_05_label = rsp("categori_05_label") beforeCategory_06_label = rsp("categori_06_label") beforeCategory_07_label = rsp("categori_07_label") End if Next if lineNext Then %> <% End If %> <% if categori_01 <> "" and categori_01 <> "분류1" then %> <% end if %> <% if categori_02 <> "" and categori_02 <> "분류2" then %> <% end if %> <% if categori_03 <> "" and categori_03 <> "분류3" then %> <% end if %> <% if categori_04 <> "" and categori_04 <> "분류4" then %> <% end if %> <% if categori_05 <> "" and categori_05 <> "분류5" then %> <% end if %> <% if categori_06 <> "" and categori_06 <> "분류6" then %> <% end if %> <% if categori_07 <> "" and categori_07 <> "분류7" then %> <% end if %> <% If UBound(comp_area) > 0 Then for z=1 to UBound(comp_area) %> <% Next End if %> <% End If %> <% rsp.movenext next End If '리스트가 다 끝나고 남은 컨택 결과 항목에 대하여 그려줌~! For z = contact_stat_st_index To contact_stat_end_index 'response.write "리스트 다 끝나고 남은 결과 항목에 대해 그려줌 z : " & z & "//stat : " & clng(rsp("view_index")) & "
" %> <% if categori_01 <> "" and categori_01 <> "분류1" then %> <% end if %> <% if categori_02 <> "" and categori_02 <> "분류2" then %> <% end if %> <% if categori_03 <> "" and categori_03 <> "분류3" then %> <% end if %> <% if categori_04 <> "" and categori_04 <> "분류4" then %> <% end if %> <% if categori_05 <> "" and categori_05 <> "분류5" then %> <% end if %> <% if categori_06 <> "" and categori_06 <> "분류6" then %> <% end if %> <% if categori_07 <> "" and categori_07 <> "분류7" then %> <% end if %> <% For c = 1 To category_08_count %> <% next %> <% Next rsp.close %>
<%=rsp("kikoan_name") %> 컨택 집계 현황 [<%=search_chasu%>]
분류1분류2분류3분류4분류5분류6분류7컨택 결과 합계 전국<%=comp_area(z)%>
<%=beforeCategory_01_label %><%=beforeCategory_02_label %><%=beforeCategory_03_label %><%=beforeCategory_04_label %><%=beforeCategory_05_label %><%=beforeCategory_06_label %><%=beforeCategory_07_label %><%=contact_status(z+1, 2)%> 0 00
<%=rsp("categori_01_label") %><%=rsp("categori_02_label") %><%=rsp("categori_03_label") %><%=rsp("categori_04_label") %><%=rsp("categori_05_label") %><%=rsp("categori_06_label") %><%=rsp("categori_07_label") %><%=contact_status(z+1, 2)%> 0 00
<%=rsp("categori_01_label") %><%=rsp("categori_02_label") %><%=rsp("categori_03_label") %><%=rsp("categori_04_label") %><%=rsp("categori_05_label") %><%=rsp("categori_06_label") %><%=rsp("categori_07_label") %><%=rsp("contac_stat_label")%> <%=rsp("COUNT") %> <%=rsp("전국")%><%=rsp(comp_area(z))%>
<%=beforeCategory_01_label %><%=beforeCategory_02_label %><%=beforeCategory_03_label %><%=beforeCategory_04_label %><%=beforeCategory_05_label %><%=beforeCategory_06_label %><%=beforeCategory_07_label %><%=contact_status(z+1, 2)%> 0 00