%'
Response.CharSet="utf-8"
Response.codepage="65001"
Response.ContentType="text/html;charset=utf-8"
'정형기 기록 - 사용페이지
'실제 컨택 페이지
''단, (chasu_use_chk = 'yes')문을 이용하여 사용여부 판단...(값이 no 인것들은 컨택결과를 일괄적으로 지정을 했기에 컨택을 하면 안되기에)
set adors2 = server.CreateObject("ADODB.RECORDSET")
set adors_tmp = server.CreateObject("ADODB.RECORDSET")
dim login_name '로그인 아이디
dim login_area '로그인 지역
dim login_type '로그인 타입(관리자, sv,면접원, 컨택원 등)
dim kikoan_name '쿼터용 기관명
dim categori_01, categori_02, categori_03 '쿼터용 기관 카테고리(대,중,소)
dim kikoan_area '응답자 지역
dim ani_num '발신번호
dim extension '면접원 내선번호
dim dn '응답자 전화번호
dim field_area_name()
dim tel_num(4)
dim chasu
dim key_id
dim login_id
dim interview_date(13)
dim interview_date_st
dim interview_date_end
Dim interview_date_type
interview_date(1) = "없음(거절 등)"
interview_date(2) = "2013-11-11 ~ 2013-11-16"
interview_date(3) = "2013-11-18 ~ 2013-11-23"
interview_date(4) = "2013-11-25 ~ 2013-11-30"
interview_date(5) = "2013-12-02 ~ 2013-12-07"
interview_date(6) = "2013-12-09 ~ 2013-12-14"
interview_date(7) = "2013-12-16 ~ 2013-12-21"
interview_date(8) = "2013-12-23 ~ 2013-12-28"
interview_date(9) = "2013-12-30 ~ 2014-01-04"
interview_date(10) = "2014-01-06 ~ 2014-01-11"
interview_date(11) = "2014-01-13 ~ 2014-01-18"
interview_date(12) = "2014-01-20 ~ 2014-01-25"
interview_date(13) = "2014-01-27 ~ 2014-02-01"
login_id = trim(request("login_id"))
login_name = trim(request("login_name"))
login_area = trim(request("login_area"))
login_type = trim(request("login_type"))
client_id = trim(request("client_id"))
extension = trim(request("extension"))
kikoan_id = trim(request("kikoan_id"))
kikoan_name = trim(request("kikoan_name"))
research_comp_name = trim(request("research_comp_name"))
chasu = trim(request("chasu"))
categori_check = trim(request("categori_check"))
comp_area = trim(request("comp_area"))
If categori_check = "" Then
categori_check = false
End If
categori_name_01 = trim(request("categori_name_01"))
categori_name_02 = trim(request("categori_name_02"))
categori_name_03 = trim(request("categori_name_03"))
categori_name_04 = trim(request("categori_name_04"))
categori_name_05 = trim(request("categori_name_05"))
categori_name_06 = trim(request("categori_name_06"))
categori_name_07 = trim(request("categori_name_07"))
categori_label_01 = trim(request("categori_label_01"))
categori_label_02 = trim(request("categori_label_02"))
categori_label_03 = trim(request("categori_label_03"))
categori_label_04 = trim(request("categori_label_04"))
categori_label_05 = trim(request("categori_label_05"))
categori_label_06 = trim(request("categori_label_06"))
categori_label_07 = trim(request("categori_label_07"))
categori_01 = trim(request("categori_01"))
categori_02 = trim(request("categori_02"))
categori_03 = trim(request("categori_03"))
categori_04 = trim(request("categori_04"))
categori_05 = trim(request("categori_05"))
categori_06 = trim(request("categori_06"))
categori_07 = trim(request("categori_07"))
add_item1 = trim(request("add_item1"))
add_item2 = trim(request("add_item2"))
add_item3 = trim(request("add_item3"))
add_item4 = trim(request("add_item4"))
add_item5 = trim(request("add_item5"))
add_item6 = trim(request("add_item6"))
add_item7 = trim(request("add_item7"))
contac_area = trim(request("contac_area"))
ani_num = trim(request("ani_num"))
categori_cnt = request("categori_cnt")
command = request("command")
contac_stat = trim(request("contac_stat"))
quota_area = request("quota_area")
sex = ""
age = 0
if command = "search" then
query = "select * from list where id = '" & request("key_id") & "' and chasu_use_chk = 'yes'"
adors2.open query, adoconn, 1
kikoan_name = adors2("kikoan_name")
if trim(adors2("categori_01")) <> "" then
categori_cnt = 1
categori_01 = adors2("categori_01")
else
categori_01 = ""
end If
if trim(adors2("categori_02")) <> "" then
categori_cnt = 2
categori_02 = adors2("categori_02")
else
categori_02 = ""
end If
if trim(adors2("categori_03")) <> "" then
categori_cnt = 3
categori_03 = adors2("categori_03")
else
categori_03 = ""
end If
if trim(adors2("categori_04")) <> "" then
categori_cnt = 4
categori_04 = adors2("categori_04")
else
categori_04 = ""
end If
if trim(adors2("categori_05")) <> "" then
categori_cnt = 5
categori_05 = adors2("categori_05")
else
categori_05 = ""
end If
if trim(adors2("categori_06")) <> "" then
categori_cnt = 6
categori_06 = adors2("categori_06")
else
categori_06 = ""
end If
if trim(adors2("categori_07")) <> "" then
categori_cnt = 7
categori_07 = adors2("categori_07")
else
categori_07 = ""
end If
contac_area = adors2("contac_area")
adors2.close
end if
query = "select * from kikoan_list where kikoan_name = '" & kikoan_name & "' "
adors.open query, adoconn, 1
contac_tel_cnt = adors("contac_tel_cnt")
project_type = adors("project_type")
adors.close
query = "select top 1 * from list "
where_query_01 = " where kikoan_id = '" & kikoan_id & "' "
if cint(categori_cnt) >= 1 then
where_query_01 = where_query_01 & "and categori_01 = '" & categori_01 & "' "
end If
if cint(categori_cnt) >= 2 then
where_query_01 = where_query_01 & "and categori_02 = '" & categori_02 & "' "
end If
if cint(categori_cnt) >= 3 then
where_query_01 = where_query_01 & "and categori_03 = '" & categori_03 & "' "
end If
if cint(categori_cnt) >= 4 then
where_query_01 = where_query_01 & "and categori_04 = '" & categori_04 & "' "
end If
if cint(categori_cnt) >= 5 then
where_query_01 = where_query_01 & "and categori_05 = '" & categori_05 & "' "
end If
if cint(categori_cnt) >= 6 then
where_query_01 = where_query_01 & "and categori_06 = '" & categori_06 & "' "
end If
if cint(categori_cnt) >= 7 then
where_query_01 = where_query_01 & "and categori_07 = '" & categori_07 & "' "
end If
if command <> "search" then
where_query_01 = where_query_01
end if
''차수 구분 및 전화걸기 최대횟수
where_query_02 = " and (chasu = '" & chasu & "') and (chasu_use_chk = 'yes') "
If comp_area <> "" Then
where_query_02 = where_query_02 & " and comp_area = '" & comp_area & "' "
End if
if command = "search" Then
query = "select * from list where id = " & request("key_id")
Else
If contac_stat = 0 Then
'call_count_query = "and contac_tel_cnt = 0 "
re_query = query
query = query & where_query_01 & where_query_02 & call_count_query & _
" and contac_stat = 0 " & _
" and prj_year = '" & Prj_Year & "' and contactor = 'no' " & _
" order by newid()"
Else
If contac_stat=1 Or contac_stat=2 Or contac_stat=4 then
query = query & where_query_01 & where_query_02 & _
" and contac_stat = " & contac_stat & _
" and prj_year = '" & Prj_Year & "' " & _
" and rechecker = '' and contactor = 'no' " & _
" order by newid()"
Else
query = query & where_query_01 & where_query_02 & _
" and contac_stat = " & contac_stat & _
" and prj_year = '" & Prj_Year & "' " & _
" and (contactor = '" & login_name & "' or contactor = 'no') " & _
" order by newid()"
End If
End if
end If
adors.open query, adoconn, 1
response.write ""
if adors.recordcount >= 1 then
tel_num(1) = adors("tel1")
tel_num(2) = adors("tel2")
tel_num(3) = adors("tel3")
tel_num(4) = adors("tel4")
for i = 1 to 4
If Trim(tel_num(i)) <> "" Then
tel_num(i) = replace(tel_num(i), "-", "")
tel_num(i) = replace(tel_num(i), ".", "")
tel_num(i) = replace(tel_num(i), " ", "")
if mid(tel_num(i),1,2)= "02" then
tel_num(i) = mid(tel_num(i),3)
end if
End if
next
if trim(tel_num(1)) = "" then
tel_num(1) = tel_num(2)
tel_num(2) = ""
end if
tel_num(0) = 0 '일단 개의 전화번호라고 가정
for i = 1 to 4
if trim(tel_num(i)) <> "" then
tel_num(0) = cint(tel_num(0)) + 1
end if
next
dn = tel_num(1)
key_id = adors("id")
contac_stat = adors("contac_stat")
quota_area = adors("quota_area")
field_area = adors("field_area")
interview_date(0) = adors("interview_date")
If adors("interview_date") <> "" And Len(adors("interview_date")) = 21 And instr(adors("interview_date"), "~") > 0 Then
interview_date_type = "FROM-TO"
interview_date_st = Left(Trim(adors("interview_date")), 10)
interview_date_end = right(Trim(adors("interview_date")), 10)
ElseIf Trim(adors("interview_date")) = "" Then
interview_date_type = "FROM-TO"
else
interview_date_type = "TEXT"
End if
interview_area = adors("interview_area")
contac_remark = adors("contac_remark")
add_item1 = adors("add_item1")
add_item2 = adors("add_item2")
add_item3 = adors("add_item3")
add_item4 = adors("add_item4")
add_item5 = adors("add_item5")
add_item6 = adors("add_item6")
add_item7 = adors("add_item7")
If adors("sex") <> "" then
If CStr(adors("sex")) = "1" Then
sex = "남"
ElseIf CStr(adors("sex")) = "2" Then
sex = "여"
Else
sex = adors("sex")
End If
End if
If adors("bitrh_year") <> "" Then
If IsNumeric(adors("bitrh_year")) Then
age = CInt(adors("prj_year"))-CInt(adors("bitrh_year"))+1
Else
age = adors("prj_year")
End if
ELSE
age = adors("age")
End If
' Response.Write contac_stat & " "
'일단 가져왔다고 표시
if adors("contactor") = "no" or adors("contactor") = "" then
query = "update list set contac_stat = " & contac_stat & ", " & _
"contac_date = '" & formatdatetime(date,2) & "', " & _
"contac_time = '" & formatdatetime(time,4) & "', " & _
"contactor = '" & login_name & "', " & _
"rechecker = '" & login_name & "' " & _
" where id = " & key_id
adoconn.execute query
end if
' query = "select field_area from list " & where_query_01 & where_query_02 & " group by field_area order by field_area"
' adors_tmp.open query, adoconn, 1
' redim field_area_name(adors_tmp.recordcount)
' i = 0
' do while not adors_tmp.eof
' i = i + 1
' field_area_name(i) = adors_tmp("field_area")
' adors_tmp.movenext
' loop
' adors_tmp.close
''필드지역 선택용
query = "select field_area from list where kikoan_id = '" & kikoan_id & "' group by field_area order by field_area"
adors_tmp.open query, adoconn, 1
i = adors_tmp.recordcount
redim field_area_name(i)
i = 0
do while not adors_tmp.eof
i = i + 1
field_area_name(i) = adors_tmp("field_area")
adors_tmp.movenext
loop
adors_tmp.close
''//=============
''log 저장
if command = "search" then
tmp_type = "검색에서 "
else
tmp_type = ""
end If
query = "insert into log (key_id, kikoan_name, " & _
"categori_01, categori_02, categori_03, categori_04, categori_05, categori_06, categori_07, quota_area, " & _
"list_id, tel_num, user_id, log_date, log_time, log_ip, asp_file_name, contac_stat, log_stat, prj_year) values (" & _
"'" & key_id & "', " & _
"'" & kikoan_name & "', " & _
"'" & categori_01 & "', " & _
"'" & categori_02 & "', " & _
"'" & categori_03 & "', " & _
"'" & categori_04 & "', " & _
"'" & categori_05 & "', " & _
"'" & categori_06 & "', " & _
"'" & categori_07 & "', " & _
"'" & quota_area & "', " & _
"'" & adors("list_id") & "', " & _
"'" & dn & "', " & _
"'" & login_id & "', " & _
"'" & formatdatetime(date, 2) & "', " & _
"'" & formatdatetime(time, 4) & "', " & _
"'" & Request.ServerVariables("remote_addr") & "', " & _
"'contact_inc_list.asp', " & _
"99, " & _
"'" & tmp_type & "1개 리스트 가져오기', " & _
"'" & prj_year & "')"
' Response.Write query
adoconn.execute query
%>
<%
'쿼터에 대한 쿼리를 가져오는 부분
'query = "select * from quota " & where_query_01
'if command = "search" then
' query = query & " and quota_area = '" & quota_area & "'"
'end If
'response.write query
'adors_tmp.open query, adoconn, 1
'adors_tmp.close
%>
리스트 id
사업체명
<%if kikoan_id = "222" then%>
성명 (담당선생님)
<%else %>
성명(대표자)
<%end if %>
지역(분류)
직위(급)
<% if kikoan_id = "248" Then
query = "SELECT count(*) AS cnt FROM krc_survey.dbo.Dat_2004031_A la WHERE ResType <> 'TEST' AND status = '10' AND LEFT(IDKey, 5) = '" & adors("list_id") & "'"
adors_tmp.open query, adoconn, 1
%>
<%
adors_tmp.close
%>
<% else %>
<% end if %>
나이
성별
출생년도
이메일1
','<%=kikoan_id %>', '0')" />
이메일2
','<%=kikoan_id %>', '0')" />
이메일1 수정
예
아니요
이메일1 수정
','<%=kikoan_id %>', '1')" />
이메일2 수정
예
아니요
이메일2 수정
','<%=kikoan_id %>', '2')" />
유선번호 수정
예
아니요
유선번호 수정
무선번호 수정
예
아니요
무선번호 수정
주소
주소 수정
<%if kikoan_id = "222" then%>
개학일 수정
<%else %>
업체명 수정
<%end if %>
성명 수정
<%if kikoan_id = "222" then%>
학급당 평균인원 수정
<%else %>
직위(급) 수정
<%end if %>
<%if kikoan_id = "222" then%>
9/2일주 학교행사 수정
<%else %>
성별 수정
<%end if %>
<%
query = "SELECT category_name FROM category_code where category_index = 1 AND kikoan_id = '" & kikoan_id & "' GROUP BY category_name "
adors2.open query, adoconn, 1
category01_cnt = adors2.recordcount
category01_name = ""
if category01_cnt > 0 Then
category01_name = adors2("category_name")
adors2.close
%>
<%
query = "SELECT id, category_code, category_label, attribute1, attribute2, attribute3, kikoan_id, category_index, category_name " & _
"FROM category_code where category_index = 1 AND category_code = '" & adors("categori_01") & "' AND kikoan_id = '" & kikoan_id & "' "
adors2.open query, adoconn, 1
if adors2.recordcount > 0 then
categori_name_01 = adors2("category_name")
categori_category_label_01 = adors2("category_label")
Else
categori_name_01 = ""
categori_category_label_01 = ""
End if
%>
<%
If interview_date_type = "FROM-TO" Then
%>
~
<%
Else
%>
<%
End If
%>
인터뷰 장소
<%
End if
%>
<% If category01_name <> "" then %>
분류1(<%=category01_name%>)
<%
query = "SELECT id, category_code, category_label, attribute1, attribute2, attribute3, kikoan_id, category_index, category_name " & _
"FROM category_code where category_index = 1 AND kikoan_id = '" & kikoan_id & "' ORDER BY convert(int, category_code) "
adors.open query, adoconn, 1
i = 0
do while not adors.eof
i = i + 1
if i = 1 Then
%>
<%
end If
%>
<%
adors.movenext
Loop
adors.close
%>
<% If category02_name <> "" then %>
분류2(<%=category02_name%>)
<%
query = "SELECT id, category_code, category_label, attribute1, attribute2, attribute3, kikoan_id, category_index, category_name " & _
"FROM category_code where category_index = 2 AND kikoan_id = '" & kikoan_id & "' ORDER BY convert(int, category_code) "
adors.open query, adoconn, 1
i = 0
do while not adors.eof
i = i + 1
if i = 1 Then
%>
<%
end If
%>
<%
adors.movenext
Loop
adors.close
%>
<% End If %>
<% If category03_name <> "" Then %>
분류3(<%=category03_name%>)
<%
query = "SELECT id, category_code, category_label, attribute1, attribute2, attribute3, kikoan_id, category_index, category_name " & _
"FROM category_code where category_index = 3 AND kikoan_id = '" & kikoan_id & "' ORDER BY convert(int, category_code) "
adors.open query, adoconn, 1
i = 0
do while not adors.eof
i = i + 1
if i = 1 Then
%>
<%
end If
%>
<%
adors.movenext
Loop
adors.close
%>
<% End If %>
<% End If %>
<% If category04_name <> "" then %>
분류4(<%=category04_name%>)
<%
query = "SELECT id, category_code, category_label, attribute1, attribute2, attribute3, kikoan_id, category_index, category_name " & _
"FROM category_code where category_index = 4 AND kikoan_id = '" & kikoan_id & "' ORDER BY convert(int, category_code) "
adors.open query, adoconn, 1
i = 0
do while not adors.eof
i = i + 1
if i = 1 Then
%>
<%
end If
%>
<%
adors.movenext
Loop
adors.close
%>
<% If category05_name <> "" Then %>
분류5(<%=category05_name%>)
<%
query = "SELECT id, category_code, category_label, attribute1, attribute2, attribute3, kikoan_id, category_index, category_name " & _
"FROM category_code where category_index = 5 AND kikoan_id = '" & kikoan_id & "' ORDER BY convert(int, category_code) "
adors.open query, adoconn, 1
i = 0
do while not adors.eof
i = i + 1
if i = 1 Then
%>
<%
end If
%>
<%
adors.movenext
Loop
adors.close
%>
<% End If %>
<% If category06_name <> "" then %>
분류6(<%=category06_name%>)
<%
query = "SELECT id, category_code, category_label, attribute1, attribute2, attribute3, kikoan_id, category_index, category_name " & _
"FROM category_code where category_index = 6 AND kikoan_id = '" & kikoan_id & "' ORDER BY convert(int, category_code) "
adors.open query, adoconn, 1
i = 0
do while not adors.eof
i = i + 1
if i = 1 Then
%>
<%
end If
%>
<%
adors.movenext
Loop
adors.close
%>
<% End If %>
<% End If %>
<% If category07_name <> "" Then %>
분류7(<%=category07_name%>)
<%
query = "SELECT id, category_code, category_label, attribute1, attribute2, attribute3, kikoan_id, category_index, category_name " & _
"FROM category_code where category_index = 7 AND kikoan_id = '" & kikoan_id & "' ORDER BY convert(int, category_code) "
adors.open query, adoconn, 1
i = 0
do while not adors.eof
i = i + 1
if i = 1 Then
%>
<%
end If
%>
<%
adors.movenext
Loop
adors.close
%>
<% If category08_name <> "" then %>
<% End If %>
<% If category09_name <> "" then %>
<% End If %>
<% End If %>
기타(비고)
<%
'query = "select * from log where key_id = " & key_id & " and contac_stat <> 99 and substring(log_stat,1,2) <> '검증'"
query = "select A.*, B.login_name, C.contac_stat_label " & _
"from log as A LEFT OUTER JOIN login_user as B ON A.user_id = B.id " & _
"LEFT OUTER JOIN contac_stat as C ON C.kikoan_id = '" & kikoan_id & "' and A.contac_stat = C.contac_stat " & _
"where kikoan_id = '" & kikoan_id & "' " & _
"and key_id = '" & key_id & "' and (A.contac_stat <> 99 or log_stat = 'list_call') and substring(log_stat,1,2) <> '검증' " & _
"order by id "
adors.open query, adoconn, 1
'response.write query
if adors.recordcount > 0 then
'tmpstr="전화번호" & vbtab & vbtab & "일자" & vbtab & vbtab & "시간" & vbtab & "컨택결과" & vbtab & "컨택원" & vbcrlf
tmpstr= vbcrlf
end If
Dim i
i = 1
do while not adors.eof
'tmpstr = tmpstr & adors("tel_num") & vbtab & vbtab & _
' adors("log_date") & vbtab & vbtab & _
' adors("log_time") & vbtab & _
' adors("contac_stat") & vbtab & _
' adors("user_id") & vbcrlf
' & vbtab & <<< 탭
' & vbcrlf & <<< 줄간격
If adors("log_stat") = "list_call" Then
tmpstr = tmpstr & i & "번 : " & "[전화시도 일시 : " & adors("log_date") & "//" & adors("log_time") & "]" & " " & _
"[컨택원 : " & adors("login_name") & "]" & vbcrlf
Else
tmpstr = tmpstr & i & "번 : " & "[" & adors("log_stat") & " : " & adors("log_date") & "//" & adors("log_time") & "]" & " " & _
"[컨택원 : " & adors("login_name") & "]" & " " & _
"[컨택결과 : " & adors("contac_stat_label") & "]" & vbcrlf
End if
adors.movenext
i = i + 1
loop
adors.close
%>