<html xmlns="http://www.w3.org/1999/xhtml">
<!--#include file="../Inc/Conn.asp" -->
<!--#include file="../Inc/SK.Session.asp" -->
<!--#include file="../Inc/SK.Funtion.asp" -->
<%if Not (Getconfig("SK_Client")="0" AND (Session("Manager")="1" OR (JudgePopedomTF(Session("UserName"),"SK200000000") AND JudgePopedomTF(Session("UserName"),"SK200000300")))) then Call ReturnError()%>
<%
'Delete begin
if F("id")<>"" and RQ("Action")="Del" and (Session("Manager")="1" OR JudgePopedomTF(Session("UserName"),"SK200000303")) then
str2=split(F("id"),",")
for i=0 to ubound(str2)
set rs=server.createobject("adodb.recordset")
if Session("Manager")=1 or Session("Manager")=2 then
sql="select * from SK_Follow where SK_Del=0 and SK_Di=0 and FollowID="&trim(str2(i))
elseif Session("Manager")=3 then
sql="select * from SK_Follow INNER JOIN SK_Client ON SK_Follow.SK_ClientID=SK_Client.ClientID INNER JOIN SK_SystemUsers ON SK_Client.SK_SalesID=SK_SystemUsers.UsersID where SK_Follow.SK_Del=0 and SK_Follow.SK_Di=0 and SK_SystemUsers.SK_Dept1="&Session("Dept1")&" and SK_Follow.FollowID="&trim(str2(i))
elseif Session("Manager")=4 then
sql="select * from SK_Follow INNER JOIN SK_Client ON SK_Follow.SK_ClientID=SK_Client.ClientID INNER JOIN SK_SystemUsers ON SK_Client.SK_SalesID=SK_SystemUsers.UsersID where SK_Follow.SK_Del=0 and SK_Follow.SK_Di=0 and SK_SystemUsers.SK_Dept1="&Session("Dept1")&" and SK_SystemUsers.SK_Dept2="&Session("Dept2")&" and SK_Follow.FollowID="&trim(str2(i))
elseif Session("Manager")=5 then
sql="select * from SK_Follow INNER JOIN SK_Client ON SK_Follow.SK_ClientID=SK_Client.ClientID INNER JOIN SK_SystemUsers ON SK_Client.SK_SalesID=SK_SystemUsers.UsersID where SK_Follow.SK_Del=0 and SK_Follow.SK_Di=0 and SK_SystemUsers.SK_Dept1="&Session("Dept1")&" and SK_SystemUsers.SK_Dept2="&Session("Dept2")&" and SK_SystemUsers.SK_Dept3="&Session("Dept3")&" and SK_Follow.FollowID="&trim(str2(i))
elseif Session("Manager")=6 then
sql="select * from SK_Follow INNER JOIN SK_Client ON SK_Follow.SK_ClientID=SK_Client.ClientID INNER JOIN SK_SystemUsers ON SK_Client.SK_SalesID=SK_SystemUsers.UsersID where SK_Follow.SK_Del=0 and SK_Follow.SK_Di=0 and SK_Client.SK_SalesID="&Session("UID")&" and SK_Follow.FollowID="&trim(str2(i))
end if
rs.open sql,Conn,1,3
if rs("SK_Del")=0 then
rs("SK_Del")=1
rs("SK_DelTime")=Now
rs("SK_DelUser")=Session("UID")
rs.Update
rs.close
set rs=Nothing
end if
'Event Begin
if getconfig("SK_Event")=0 then
set rsEvent=server.createobject("adodb.recordset")
sqlEvent="select * from SK_SystemEvent"
rsEvent.open sqlEvent,conn,1,3
rsEvent.AddNew
rsEvent("SK_Title")="删除跟进主题到回收站"
rsEvent("SK_User")=Session("UserName")
rsEvent("SK_Time")=Now()
rsEvent("SK_IP")=request.ServerVariables("Remote_Addr")
rsEvent.Update
rsEvent.Close 
set rsEvent=Nothing
end if
'Event End
next
Call Returnoktoback()
end if
'Delete End
%>
<% 
dim m_minyear 
dim m_maxyear 
dim nonglidayname 
dim nonglimonthname 
m_minyear= 1950 
m_maxyear= 2050 
dim calendardata(99,2) 
nonglidayname= array("初一","初二","初三","初四","初五","初六","初七","初八","初九","初十","十一","十二","十三","十四","十五","十六","十七","十八","十九","廿","廿一","廿二","廿三","廿四","廿五","廿六","廿七","廿八","廿九","三十") 
nonglimonthname = array("正","二","三","四","五","六","七","八","九","十","十一","十二") 
calendardata(0,0)=&h2f 
calendardata(0,1)=&h6c 
calendardata(0,2)=&ha0 
calendardata(1,0)=&h24 
calendardata(1,1)=&hb5 
calendardata(1,2)=&h50 
calendardata(2,0)=&hda 
calendardata(2,1)=&h53 
calendardata(2,2)=&h55 
calendardata(3,0)=&h2c 
calendardata(3,1)=&h4d 
calendardata(3,2)=&ha0 
calendardata(4,0)=&h21 
calendardata(4,1)=&ha5 
calendardata(4,2)=&hb0 
calendardata(5,0)=&h57 
calendardata(5,1)=&h45 
calendardata(5,2)=&h73 
calendardata(6,0)=&haa 
calendardata(6,1)=&h52 
calendardata(6,2)=&hb0 
calendardata(7,0)=&h1e 
calendardata(7,1)=&ha9 
calendardata(7,2)=&ha8 
calendardata(8,0)=&h30 
calendardata(8,1)=&he9 
calendardata(8,2)=&h50 
calendardata(9,0)=&h26 
calendardata(9,1)=&h6a 
calendardata(9,2)=&ha0 
calendardata(10,0)=&h9b 
calendardata(10,1)=&hae 
calendardata(10,2)=&ha6 
calendardata(11,0)=&h2d 
calendardata(11,1)=&hab 
calendardata(11,2)=&h50 
calendardata(12,0)=&h23 
calendardata(12,1)=&h4b 
calendardata(12,2)=&h60 
calendardata(13,0)=&h18 
calendardata(13,1)=&haa 
calendardata(13,2)=&he4 
calendardata(14,0)=&hab 
calendardata(14,1)=&ha5 
calendardata(14,2)=&h70 
calendardata(15,0)=&h20 
calendardata(15,1)=&h52 
calendardata(15,2)=&h60 
calendardata(16,0)=&h14 
calendardata(16,1)=&hf2 
calendardata(16,2)=&h63 
calendardata(17,0)=&h27 
calendardata(17,1)=&hd9 
calendardata(17,2)=&h50 
calendardata(18,0)=&h9d 
calendardata(18,1)=&h5b 
calendardata(18,2)=&h57 
calendardata(19,0)=&h2f 
calendardata(19,1)=&h56 
calendardata(19,2)=&ha0 
calendardata(20,0)=&h24 
calendardata(20,1)=&h96 
calendardata(20,2)=&hd0 
calendardata(21,0)=&h1a 
calendardata(21,1)=&h4d 
calendardata(21,2)=&hd5 
calendardata(22,0)=&had 
calendardata(22,1)=&h4a 
calendardata(22,2)=&hd0 
calendardata(23,0)=&h21 
calendardata(23,1)=&ha4 
calendardata(23,2)=&hd0 
calendardata(24,0)=&h16 
calendardata(24,1)=&hd4 
calendardata(24,2)=&hd4 
calendardata(25,0)=&h29 
calendardata(25,1)=&hd2 
calendardata(25,2)=&h50 
calendardata(26,0)=&h9e 
calendardata(26,1)=&hd5 
calendardata(26,2)=&h58 
calendardata(27,0)=&h30 
calendardata(27,1)=&hb5 
calendardata(27,2)=&h40 
calendardata(28,0)=&h25 
calendardata(28,1)=&hb6 
calendardata(28,2)=&ha0 
calendardata(29,0)=&h5b 
calendardata(29,1)=&h95 
calendardata(29,2)=&ha6 
calendardata(30,0)=&hae 
calendardata(30,1)=&h95 
calendardata(30,2)=&hb0 
calendardata(31,0)=&h23 
calendardata(31,1)=&h49 
calendardata(31,2)=&hb0 
calendardata(32,0)=&h18 
calendardata(32,1)=&ha9 
calendardata(32,2)=&h74 
calendardata(33,0)=&h2b 
calendardata(33,1)=&ha4 
calendardata(33,2)=&hb0 
calendardata(34,0)=&ha0 
calendardata(34,1)=&hb2 
calendardata(34,2)=&h7a 
calendardata(35,0)=&h32 
calendardata(35,1)=&h6a 
calendardata(35,2)=&h50 
calendardata(36,0)=&h27 
calendardata(36,1)=&h6d 
calendardata(36,2)=&h40 
calendardata(37,0)=&h1c 
calendardata(37,1)=&haf 
calendardata(37,2)=&h46 
calendardata(38,0)=&haf 
calendardata(38,1)=&hab 
calendardata(38,2)=&h60 
calendardata(39,0)=&h24 
calendardata(39,1)=&h95 
calendardata(39,2)=&h70 
calendardata(40,0)=&h1a 
calendardata(40,1)=&h4a 
calendardata(40,2)=&hf5 
calendardata(41,0)=&h2d 
calendardata(41,1)=&h49 
calendardata(41,2)=&h70 
calendardata(42,0)=&ha2 
calendardata(42,1)=&h64 
calendardata(42,2)=&hb0 
calendardata(43,0)=&h16 
calendardata(43,1)=&h74 
calendardata(43,2)=&ha3 
calendardata(44,0)=&h28 
calendardata(44,1)=&hea 
calendardata(44,2)=&h50 
calendardata(45,0)=&h1e 
calendardata(45,1)=&h6b 
calendardata(45,2)=&h58 
calendardata(46,0)=&hb1 
calendardata(46,1)=&h5a 
calendardata(46,2)=&hc0 
calendardata(47,0)=&h25 
calendardata(47,1)=&hab 
calendardata(47,2)=&h60 
calendardata(48,0)=&h1b 
calendardata(48,1)=&h96 
calendardata(48,2)=&hd5 
calendardata(49,0)=&h2e 
calendardata(49,1)=&h92 
calendardata(49,2)=&he0 
calendardata(50,0)=&ha3 
calendardata(50,1)=&hc9 
calendardata(50,2)=&h60 
calendardata(51,0)=&h17 
calendardata(51,1)=&hd9 
calendardata(51,2)=&h54 
calendardata(52,0)=&h2a 
calendardata(52,1)=&hd4 
calendardata(52,2)=&ha0 
calendardata(53,0)=&h1f 
calendardata(53,1)=&hda 
calendardata(53,2)=&h50 
calendardata(54,0)=&h95 
calendardata(54,1)=&h75 
calendardata(54,2)=&h52 
calendardata(55,0)=&h27 
calendardata(55,1)=&h56 
calendardata(55,2)=&ha0 
calendardata(56,0)=&h1c 
calendardata(56,1)=&hab 
calendardata(56,2)=&hb7 
calendardata(57,0)=&h30 
calendardata(57,1)=&h25 
calendardata(57,2)=&hd0 
calendardata(58,0)=&ha5 
calendardata(58,1)=&h92 
calendardata(58,2)=&hd0 
calendardata(59,0)=&h19 
calendardata(59,1)=&hca 
calendardata(59,2)=&hb5 
calendardata(60,0)=&h2c 
calendardata(60,1)=&ha9 
calendardata(60,2)=&h50 
calendardata(61,0)=&h21 
calendardata(61,1)=&hb4 
calendardata(61,2)=&ha0 
calendardata(62,0)=&h96 
calendardata(62,1)=&hba 
calendardata(62,2)=&ha4 
calendardata(63,0)=&h28 
calendardata(63,1)=&had 
calendardata(63,2)=&h50 
calendardata(64,0)=&h1e 
calendardata(64,1)=&h55 
calendardata(64,2)=&hd9 
calendardata(65,0)=&h31 
calendardata(65,1)=&h4b 
calendardata(65,2)=&ha0 
calendardata(66,0)=&ha6 
calendardata(66,1)=&ha5 
calendardata(66,2)=&hb0 
calendardata(67,0)=&h5b 
calendardata(67,1)=&h51 
calendardata(67,2)=&h76 
calendardata(68,0)=&h2e 
calendardata(68,1)=&h52 
calendardata(68,2)=&hb0 
calendardata(69,0)=&h23 
calendardata(69,1)=&ha9 
calendardata(69,2)=&h30 
calendardata(70,0)=&h98 
calendardata(70,1)=&h79 
calendardata(70,2)=&h54 
calendardata(71,0)=&h2a 
calendardata(71,1)=&h6a 
calendardata(71,2)=&ha0 
calendardata(72,0)=&h1f 
calendardata(72,1)=&had 
calendardata(72,2)=&h50 
calendardata(73,0)=&h15 
calendardata(73,1)=&h5b 
calendardata(73,2)=&h52 
calendardata(74,0)=&ha8 
calendardata(74,1)=&h4b 
calendardata(74,2)=&h60 
calendardata(75,0)=&h1c 
calendardata(75,1)=&ha6 
calendardata(75,2)=&he6 
calendardata(76,0)=&h2f 
calendardata(76,1)=&ha4 
calendardata(76,2)=&he0 
calendardata(77,0)=&h24 
calendardata(77,1)=&hd2 
calendardata(77,2)=&h60 
calendardata(78,0)=&h99 
calendardata(78,1)=&hea 
calendardata(78,2)=&h65 
calendardata(79,0)=&h2b 
calendardata(79,1)=&hd5 
calendardata(79,2)=&h30 
calendardata(80,0)=&h21 
calendardata(80,1)=&h5a 
calendardata(80,2)=&ha0 
calendardata(81,0)=&h16 
calendardata(81,1)=&h76 
calendardata(81,2)=&ha3 
calendardata(82,0)=&ha9 
calendardata(82,1)=&h96 
calendardata(82,2)=&hd0 
calendardata(83,0)=&h1e 
calendardata(83,1)=&h4a 
calendardata(83,2)=&hfb 
calendardata(84,0)=&h31 
calendardata(84,1)=&h4a 
calendardata(84,2)=&hd0 
calendardata(85,0)=&h26 
calendardata(85,1)=&ha4 
calendardata(85,2)=&hd0 
calendardata(86,0)=&hdb 
calendardata(86,1)=&hd0 
calendardata(86,2)=&hb6 
calendardata(87,0)=&h2d 
calendardata(87,1)=&hd2 
calendardata(87,2)=&h50 
calendardata(88,0)=&h22 
calendardata(88,1)=&hd5 
calendardata(88,2)=&h20 
calendardata(89,0)=&h17 
calendardata(89,1)=&hdd 
calendardata(89,2)=&h45 
calendardata(90,0)=&haa 
calendardata(90,1)=&hb5 
calendardata(90,2)=&ha0 
calendardata(91,0)=&h1f 
calendardata(91,1)=&h56 
calendardata(91,2)=&hd0 
calendardata(92,0)=&h15 
calendardata(92,1)=&h55 
calendardata(92,2)=&hb2 
calendardata(93,0)=&h28 
calendardata(93,1)=&h49 
calendardata(93,2)=&hb0 
calendardata(94,0)=&h9d 
calendardata(94,1)=&ha5 
calendardata(94,2)=&h77 
calendardata(95,0)=&h2f 
calendardata(95,1)=&ha4 
calendardata(95,2)=&hb0 
calendardata(96,0)=&h24 
calendardata(96,1)=&haa 
calendardata(96,2)=&h50 
calendardata(97,0)=&h59 
calendardata(97,1)=&hb2 
calendardata(97,2)=&h55 
calendardata(98,0)=&hac 
calendardata(98,1)=&h6d 
calendardata(98,2)=&h20 
calendardata(99,0)=&h20 
calendardata(99,1)=&had 
calendardata(99,2)=&ha0 

on error resume next 
function gongdataisvalid(m_date) 
if not isdate(m_date) then 
gongdataisvalid = false 
exit function 
else 
if year(m_date) >1950 and year(m_date) < 2050 then 
gongdataisvalid = true 
exit function 
else 
if year(m_date)=1950 then 
if month(m_date)>2 then 
gongdataisvalid = true 
exit function 
else 
if month(m_date)=2 then 
if day(m_date) > 16 then 
gongdataisvalid = true 
exit function 
end if 
end if 
end if 
end if 
end if 
end if 
gongdataisvalid = false 
end function 

function nongdataisvalid(m_date) 
if year(m_date) > 1949 and year(m_date) < 2049 then 
nongdataisvalid = true 
exit function 
else 
if year(m_date)=2049 then 
if month(m_date.month) < 12 then 
nongdataisvalid = true 
exit function 
else 
if month(m_date)=12 then 
if day(m_date) < 8 then 
nongdataisvalid = true 
exit function 
end if 
end if 
end if 
end if 
end if 
nongdataisvalid = false 
end function 

function converttogongli(m_nongli) 
dim days 
dim years 
dim alldays 
dim result 

days = daysfromspringday(m_nongli) 
days = days + getdaysfromstart(year(m_nongli)) 
years = year(m_nongli) 
alldays = getgongyeardays(years) 
if days > alldays then 
days = days - alldays 
years = years + 1 
end if 
result = calgongdate(years,days) 
converttogongli = result 
end function 

function converttonongli(m_gongli) 
dim days 
dim years 
dim alldays 
dim result 

days = daysfromnewyear(m_gongli) 
alldays = getdaysfromstart(year(m_gongli)) 
years = year(m_gongli) 
if days <= alldays then 
years = years - 1 
days = days + getgongyeardays(years) 
end if 
days = days - getdaysfromstart(years) 
result = calnongdate(years,days) 
converttonongli = result 
end function 

function getdateafterdays(m_first,m_days) 
dim m_firstdays 
m_firstdays = daysfromnewyear(m_first) + m_days 
getdateafterdays = calgongdate(year(m_first),m_firstdays) 
end function 

function calgongdate(years,days) 
dim resultday,resultyear,resultmonth 
dim caldays 
caldays = 0 
resultyear = years 
for i=1 to 13 - 1 
caldays =caldays + getgongmonthdays(years,i) 
if caldays>=days then 
caldays = caldays - getgongmonthdays(year,i) 
resultmonth = i 
resultday=days-caldays 
exit for 
end if 
next 
calgongdate=resultyear & "-" & resultmonth & "-" & resultday 
end function 

function calnongdate(years,days) 
dim resultday,resultyear,resultmonth 
dim caldays 
caldays = 0 

resultyear = years 
isrunyue = false 

for i=1 to 12 
caldays = caldays + getnotrunnongmonthdays(years,i) 
if caldays>=days then 
caldays = caldays - getnotrunnongmonthdays(years,i) 
resultmonth = i 
resultday = days - caldays 
isrunyue = false 
exit for 
else 
if getnongrunyue(years) = i then 
caldays = caldays + getnongrunyuedays(years) 
if caldays>=days then 
caldays = caldays - getnongrunyuedays(years) 
resultmonth = i 
resultday = days - caldays 
isrunyue = true 
exit for 
end if 
end if 
end if 
next 
calnongdate=resultyear & "-" & resultmonth & "-" & resultday 
end function 


function getgongmonthdays(years,months) 
getgongmonthdays = 30 
if months = 2 then 
if yearisrunnian(years) then 
getgongmonthdays = 29 
else 
getgongmonthdays = 28 
end if 
else 
if gongmonthislarge(months) then 
getgongmonthdays = 31 
else 
getgongmonthdays = 30 
end if 
end if 
end function 

function getnonglidayname(mdays) 
dim i,j 

i = instr(mdays,"-") 
j = instr(i+1,mdays,"-") 
getnonglidayname = right(mdays,len(mdays) - j) 
getnonglidayname = nonglidayname(int(getnonglidayname) - 1) 
end function 

function getnonglimonthname(mdays) 
dim i,j 

i = instr(mdays,"-") 
j = instr(i+1,mdays,"-") 
getnonglimonthname = mid(mdays,i+1,j-i-1) 
getnonglimonthname = nonglimonthname(int(getnonglimonthname) - 1) 
end function 

function getnotrunnongmonthdays(years,months) 
if nongmonthislarge(years,months) then 
getnotrunnongmonthdays = 30 
else 
getnotrunnongmonthdays = 29 
end if 
end function 

function getnongmonthdays(years,months,m_run) 
dim days 
days = 0 
if m_run then 
days = getnongrunyuedays(years) 
else 
days = getnotrunnongmonthdays(years,months) 
end if 
getnongmonthdays = days 
end function 

function getgongyeardays(years) 
if yearisrunnian(years) then 
getgongyeardays = 366 
else 
getgongyeardays = 365 
end if 
end function 

function getnongyeardays(years) 
dim days 
days = 0 
for i=1 to 12 
days =days + getnongmonthdays(years,i,false) 
next 
days =days + getnongrunyuedays(years) 
getnongyeardays = days 
end function 

function getnongrunyuedays(years) 
if getnongrunyue(years) =0 then 
getnongrunyuedays = 0 
exit function 
end if 
if runyueislarge(years) then 
getnongrunyuedays = 30 
else 
getnongrunyuedays = 29 
end if 
end function 

function daysfromnewyear(m_day) 
dim days 
days = 0 
for i=1 to month(m_day) - 1 
days = days + getgongmonthdays(year(m_day),i) 
next 
days = days + day(m_day) 
daysfromnewyear = days 
end function 
function daysfromspringday(m_day) 
dim days 
dim months 
days = 0 
months = getnongrunyue(year(m_day)) 
if months < month(m_day) then 
days = days + getnongrunyuedays(year(m_day)) 
else 
if((months=month(m_day)) and isrunyue) then 
days = days + getnongrunyuedays(year(m_day)) 
end if 
end if 
for i=1 to month(m_day) 
days = days + getnongmonthdays(year(m_day),i,false) 
next 
days = days + day(m_day) 
daysfromspringday = days 
end function 

function cal2n(n) 
cal2n = 1 
for i=0 to n - 1 
cal2n = cal2n * 2 
next 
end function 

function getnnamein60(index) 
dim shengxiao 
dim tiangan 
dim dizhi 
dim buffer 
dim m_cur,m_this,tian,di 
shengxiao = array("鼠","牛","虎","兔","龙","蛇","马","羊","猴","鸡","狗","猪") 
tiangan = array("甲","乙","丙","丁","戊","己","庚","辛","壬","癸") 
dizhi = array("子","丑","寅","卯","辰","巳","午","未","申","酉","戌","亥") 
buffer = "农历" 

m_cur = 0 
m_this = 0 
tian = 0 
di = 0 
for i=0 to 60 - 1 
tian = i mod 10 
di = i mod 12 
if m_this = index then 
buffer = buffer & tiangan(tian) 
buffer = buffer & dizhi(di) 
buffer = buffer & "年，" 
buffer = buffer & shengxiao(di) 
buffer = buffer & "年" 
end if 
m_this = m_this + 1 
next 
getnnamein60 = buffer 
end function 

function getganzhi(m_nongyear) 
dim m_index 
m_index = (m_nongyear - 1924) mod 60 
getganzhi = getnnamein60(m_index) 
end function 

function yearisrunnian(years) 
yearisrunnian = calendardata(years-m_minyear,0) and &h80 
end function 

function runyueislarge(years) 
runyueislarge = calendardata(years-m_minyear,0) and &h40 
end function 

function getdaysfromstart(years) 
getdaysfromstart = (calendardata(years-m_minyear,0) and &h3f) 
end function 

function nongmonthislarge(years,months) 
nongmonthislarge = false 
if(months<9) then 
if(calendardata(years-m_minyear,1) and cal2n(8 - months)) then 
nongmonthislarge = true 
end if 
else 
ch=cal2n(12 - months) 
ch=movebit(ch) 
if(calendardata(years-m_minyear,2) and ch) then nongmonthislarge = true 
end if 
end function 

function getnongrunyue(years) 
getnongrunyue = (calendardata(years-m_minyear,2) and &h0f) 
end function 

function gongmonthislarge(months) 
gongmonthislarge = false 
if months < 8 then 
if (months mod 2) <> 0 then 
gongmonthislarge = true 
end if 
else 
if ((months mod 2) = 0) then 
gongmonthislarge = true 
end if 
end if 
end function 
%> 
<script language="jscript" runat="server"> 
function movebit(num){ 
return num<<=4; 
} 
</script> 
<% 
dim displaynonglidate 
function getdaysinmonth(imonth, iyear) 
select case imonth 
case 1, 3, 5, 7, 8, 10, 12 
getdaysinmonth = 31 
case 4, 6, 9, 11 
getdaysinmonth = 30 
case 2 
if isdate("february 29, " & iyear) then 
getdaysinmonth = 29 
else 
getdaysinmonth = 28 
end if 
end select 
end function 

function getweekdaymonthstartson(danydayinthemonth) 
dim dtemp 
dtemp = dateadd("d", -(day(danydayinthemonth) - 1), danydayinthemonth) 
getweekdaymonthstartson = weekday(dtemp) 
end function 

function subtractonemonth(ddate) 
subtractonemonth = dateadd("m", -1, ddate) 
end function 

function addonemonth(ddate) 
addonemonth = dateadd("m", 1, ddate) 
end function 

dim ddate 
dim idim 
dim idow 
dim icurrent 
dim iposition 

dttoday=date() 
if ddate=empty then ddate=dttoday 
curdate=request("curdate") 
if instr(1, request.form, "subprev", 1) > 0 then 
ddate = dateadd("m", -1,curdate) 
elseif instr(1, request.form, "subnext", 1) > 0 then 
ddate = dateadd("m", 1,curdate) 
else 
ddate = dateserial(year(dttoday), month(dttoday)) 
end if 
idim = getdaysinmonth(month(ddate), year(ddate)) 
idow = getweekdaymonthstartson(ddate) 

m=F("m")
yyyy=F("yyyy")
if m="" then m=month(date())
if yyyy="" then yyyy=year(date())

%> 
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<LINK href="../images/style.css" type=text/css rel=stylesheet>
<SCRIPT src="../images/date.js" type=text/javascript></SCRIPT>
<title>计划跟进列表</title>
<style type="text/css">
<!--
body {
margin: 5px 0px 5px 0px;
overflow-x:hidden;
overflow-y:auto;
}
-->
</style>
</head>
<body>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
<TBODY>
  <tr>
    <td class="SK_Td_Top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="12" height="25"><img src="../images/tab_03.gif" width="12" height="25" /></td>
        <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="46%" valign="middle">已经跟进列表</td>
<td width="54%"></td>
</tr>
</table></td>
        <td width="16"><img src="../images/tab_07.gif" width="16" height="25" /></td>
      </tr>
    </table></td>
  </tr>
  <tr>
<td>

<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="8" background="../images/tab_12.gif"></td>
<td>

<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td height="30" align="center">
	<table width="100%" height="33" border="0" cellpadding="0" cellspacing="0">
        <tr class="home_03">
          <td width="70%" align="left" valign="middle">
<table width="100%" border="0" cellpadding="0" cellspacing="0" style="margin-top:8px;">
<form id="form1" name="form1" method="post" action="">
<tr>
<td width="260" align="center">主题 
  <input name="Key" type="text" size="20" value="<%=F("Key")%>">
<input type="submit" class="button1" value=" 查询 " /></td>
</tr></form>
</table></td>
</tr>
</table>
</td>
</tr>

<tr align="left">
<td align="left" valign="top">


<div id="overdiv" style="position:absolute; visibility:hide; z-index: 1;"></div> 
<table width="100%" style="border-collapse: collapse" bordercolor="#cccccc" cellpadding="2" border="1"> 
<tr> 
<form name="fmnextprev" method="post"> 
<input type="hidden" name="curdate" value="<%=ddate%>"> 
<th bgcolor="#ff8040"><input type="submit" name="subprev" value="&lt;&lt;" style="width:98%;font-weight: bold;color: #ffffff; border: 1px ridge #ffffff; background-color: #ff7f50"></th> 
<th bgcolor="#676704" colspan="5"><div id="title" style="font-size: 9pt; color: #fffad7"><%=year(ddate)&" 年 "&month(ddate)& "月 "&getganzhi(year(ddate))%></div></th> 
<th bgcolor="#ff8040"><input type="submit" name="subnext" value="&gt;&gt;" style="width:98%;font-weight: bold;color: #ffffff; border: 1px ridge #ffffff; background-color: #ff7f50"></th> 
</form> 
</tr> 
<div id="detail" style="position: absolute"> 
</div> 
<tr> 
<% for iday = vbsunday to vbsaturday %><th width="14%" bgcolor="#cc9933"> 
<span style="font-size:9pt;color:ffffff;font-weight: bold;"> 
<%=replace(weekdayname(iday),"星期","")%></span>　</th> 
<%next %> 
</tr> 
<% 
if idow <> 1 then 
response.write vbtab & "<tr bgcolor=""cccccc"">" & vbcrlf 
iposition = 1 
do while iposition < idow 
response.write vbtab & vbtab & "<td bgcolor=""ffffff"" height=150> </td>" & vbcrlf 
iposition = iposition + 1 
loop 
end if 

icurrent = 1 
iposition = idow 
do while icurrent <= idim 
if iposition = 1 then 
response.write vbtab & "<tr bgcolor=""cccccc"">" & vbcrlf 
end if 

if (icurrent = day(ddate) and (dttoday=ddate)) then 
displaynonglidate = converttonongli(formatdatetime(ddate,1)) 
nonglibartext= getnonglimonthname(displaynonglidate) & "月" & getnonglidayname(displaynonglidate) 
response.write vbtab & vbtab & "<td bgcolor=#ff8040 height=150 valign=top><span style=font-size:9pt;color:ffffff;font-weight: bold;font-family: arial>"&icurrent&" ("&nonglibartext&")</span>" '显示农阳历日期

Mydate=year(ddate)&"-"&month(ddate)&"-"&icurrent
'Response.write Mydate

if Session("Manager")="1" OR JudgePopedomTF(Session("UserName"),"SK200000301") then
Response.write"<a href=""javascript:void(0)"" onClick=""javascript:var win=window.open('SK.AddFollow.asp?Ad="&Mydate&"&Di=0','Add','width=820,height=400,top=170,left=161,center:yes,status:no,help:no,toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=yes,scrollbars=yes'); win.focus()""> 新增 </a>"
else
Response.write"<img src=""../images/nomod.gif"">"
end if
Response.write"<br>"

Dim RsFollow,K
set RsFollow=Server.createobject("adodb.recordset")
if Session("Manager")=1 or Session("Manager")=2 then
SqlFollow="select * from SK_Follow where DateDiff(day,'"&Mydate&"',SK_FTime)=0 and SK_Ftitle Like '%"&F("Key")&"%' and SK_Di=0 and SK_Del=0 order by FollowID asc"
elseif Session("Manager")=3 then
SqlFollow="select * from SK_Follow INNER JOIN SK_Client ON SK_Follow.SK_ClientID=SK_Client.ClientID INNER JOIN SK_SystemUsers ON SK_Client.SK_SalesID=SK_SystemUsers.UsersID where DateDiff(day,'"&Mydate&"',SK_Follow.SK_FTime)=0 and SK_Follow.SK_Ftitle Like '%"&F("Key")&"%' and SK_SystemUsers.SK_Dept1="&Session("Dept1")&" and SK_Follow.SK_Di=0 and SK_Follow.SK_Del=0 order by SK_Follow.FollowID asc"
elseif Session("Manager")=4 then
SqlFollow="select * from SK_Follow INNER JOIN SK_Client ON SK_Follow.SK_ClientID=SK_Client.ClientID INNER JOIN SK_SystemUsers ON SK_Client.SK_SalesID=SK_SystemUsers.UsersID where DateDiff(day,'"&Mydate&"',SK_Follow.SK_FTime)=0 and SK_Follow.SK_Ftitle Like '%"&F("Key")&"%' and SK_SystemUsers.SK_Dept1="&Session("Dept1")&" and SK_SystemUsers.SK_Dept2="&Session("Dept2")&" and SK_Follow.SK_Di=0 and SK_Follow.SK_Del=0 order by SK_Follow.FollowID asc"
elseif Session("Manager")=5 then
SqlFollow="select * from SK_Follow INNER JOIN SK_Client ON SK_Follow.SK_ClientID=SK_Client.ClientID INNER JOIN SK_SystemUsers ON SK_Client.SK_SalesID=SK_SystemUsers.UsersID where DateDiff(day,'"&Mydate&"',SK_Follow.SK_FTime)=0 and SK_Follow.SK_Ftitle Like '%"&F("Key")&"%' and SK_SystemUsers.SK_Dept1="&Session("Dept1")&" and SK_SystemUsers.SK_Dept2="&Session("Dept2")&" and SK_SystemUsers.SK_Dept3="&Session("Dept3")&" and SK_Follow.SK_Di=0 and SK_Follow.SK_Del=0 order by SK_Follow.FollowID asc"
elseif Session("Manager")=6 then
SqlFollow="select * from SK_Follow INNER JOIN SK_Client ON SK_Follow.SK_ClientID=SK_Client.ClientID INNER JOIN SK_SystemUsers ON SK_Client.SK_SalesID=SK_SystemUsers.UsersID where DateDiff(day,'"&Mydate&"',SK_Follow.SK_FTime)=0 and SK_Follow.SK_Ftitle Like '%"&F("Key")&"%' and SK_Client.SK_SalesID="&Session("UID")&" and SK_Follow.SK_Di=0 and SK_Follow.SK_Del=0 order by SK_Follow.FollowID asc"
end if
RsFollow.open SqlFollow,conn,1,1
K=0
while not RsFollow.eof
K=K+1
%>
<div align="left" style="font-size:9pt;color:ffffff;">
<a href="javascript:void(0)" onClick="javascript:var win=window.open('SK.ReFollow.asp?id=<%=RsFollow("FollowID")%>','Read','width=820,height=400,top=170,left=161,center:yes,status:no,help:no,toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=yes,scrollbars=yes'); win.focus()"><%=K%>.<%=left(RsFollow("SK_Ftitle"),30)%>...</a> <font color="#FF7979">[ 跟进:<%
set RsFuser=server.createobject("adodb.recordset")
SqlFuser="select * from SK_SystemUsers where UsersID="&RsFollow("SK_SalesID")&""
RsFuser.open SqlFuser,conn,1,1
Response.write""&RsFuser("SK_OName")&""
RsFuser.close
RsFuser=Nothing
%> | <%=RsFollow("SK_AFollowtime")%> ]</font> ( <%if Session("Manager")="1" OR JudgePopedomTF(Session("UserName"),"SK200000302") then%><a href="javascript:void(0)" onClick="javascript:var win=window.open('SK.ModFollow.asp?id=<%=RsFollow("FollowID")%>','Mod','width=820,height=400,top=170,left=161,center:yes,status:no,help:no,toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=yes,scrollbars=yes'); win.focus()">修改</a><%end if%> <%if Session("Manager")="1" OR JudgePopedomTF(Session("UserName"),"SK200000303") then%> | <a onClick="return confirm('此操作将删除记录,确定要删除此记录吗？')" href="?Action=Del&ID=<%=RsFollow("FollowID")%>">删除</a><%end if%> <%if Session("Manager")<>6 AND RsFollow("SK_SalesID")<>Session("UID") AND JudgePopedomTF(Session("UserName"),"SK200000304") then%>| <a href="javascript:void(0)" onClick="javascript:var win=window.open('SK.AddDP.asp?id=<%=RsFollow("FollowID")%>','DP','width=820,height=400,top=170,left=161,center:yes,status:no,help:no,toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=yes,scrollbars=yes'); win.focus()">点评(<%=conn.execute("select count(*) from SK_FollowReply where SK_FollowID="&RsFollow("FollowID")&" and SK_Del=0")(0)%> )</a><%end if%> )<br></div>
<%
RsFollow.movenext
wend
RsFollow.close
set RsFollow=Nothing

response.write "</td>" & vbcrlf 
else 


if (iposition=7 or iposition=1) then scolor="red" else scolor="black" 
displaynonglidate = converttonongli(formatdatetime(year(ddate) & "-" & month(ddate) & "-" & icurrent ,1)) 
nonglibartext= getnonglimonthname(displaynonglidate) & "月" & getnonglidayname(displaynonglidate) 
response.write vbtab & vbtab & "<td bgcolor=""ffffff"" height=150 valign=top><span style=font-size:9pt;color:"& scolor &";font-weight: bold;font-family: arial>"&icurrent&" ("&nonglibartext&")</span>"   '显示农阳历日期

Youdate=year(ddate)&"-"&month(ddate)&"-"&icurrent
'Response.write Youdate

if Session("Manager")="1" OR JudgePopedomTF(Session("UserName"),"SK200000301") then
Response.write"<a href=""javascript:void(0)"" onClick=""javascript:var win=window.open('SK.AddFollow.asp?Ad="&Youdate&"&Di=0','Add','width=820,height=400,top=170,left=161,center:yes,status:no,help:no,toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=yes,scrollbars=yes'); win.focus()""> 新增 </a>"
else
Response.write"<img src=""../images/nomod.gif"">"
end if
Response.write"<br>"

Dim RsFollow1,L
set RsFollow1=Server.createobject("adodb.recordset")
if Session("Manager")=1 or Session("Manager")=2 then
SqlFollow1="select * from SK_Follow where DateDiff(day,'"&Youdate&"',SK_FTime)=0 and SK_Ftitle Like '%"&F("Key")&"%' and SK_Di=0 and SK_Del=0 order by FollowID asc"
elseif Session("Manager")=3 then
SqlFollow1="select * from SK_Follow INNER JOIN SK_Client ON SK_Follow.SK_ClientID=SK_Client.ClientID INNER JOIN SK_SystemUsers ON SK_Client.SK_SalesID=SK_SystemUsers.UsersID where DateDiff(day,'"&Youdate&"',SK_Follow.SK_FTime)=0 and SK_Follow.SK_Ftitle Like '%"&F("Key")&"%' and SK_SystemUsers.SK_Dept1="&Session("Dept1")&" and SK_Follow.SK_Di=0 and SK_Follow.SK_Del=0 order by SK_Follow.FollowID asc"
elseif Session("Manager")=4 then
SqlFollow1="select * from SK_Follow INNER JOIN SK_Client ON SK_Follow.SK_ClientID=SK_Client.ClientID INNER JOIN SK_SystemUsers ON SK_Client.SK_SalesID=SK_SystemUsers.UsersID where DateDiff(day,'"&Youdate&"',SK_Follow.SK_FTime)=0 and SK_Follow.SK_Ftitle Like '%"&F("Key")&"%' and SK_SystemUsers.SK_Dept1="&Session("Dept1")&" and SK_SystemUsers.SK_Dept2="&Session("Dept2")&" and SK_Follow.SK_Di=0 and SK_Follow.SK_Del=0 order by SK_Follow.FollowID asc"
elseif Session("Manager")=5 then
SqlFollow1="select * from SK_Follow INNER JOIN SK_Client ON SK_Follow.SK_ClientID=SK_Client.ClientID INNER JOIN SK_SystemUsers ON SK_Client.SK_SalesID=SK_SystemUsers.UsersID where DateDiff(day,'"&Youdate&"',SK_Follow.SK_FTime)=0 and SK_Follow.SK_Ftitle Like '%"&F("Key")&"%' and SK_SystemUsers.SK_Dept1="&Session("Dept1")&" and SK_SystemUsers.SK_Dept2="&Session("Dept2")&" and SK_SystemUsers.SK_Dept3="&Session("Dept3")&" and SK_Follow.SK_Di=0 and SK_Follow.SK_Del=0 order by SK_Follow.FollowID asc"
elseif Session("Manager")=6 then
SqlFollow1="select * from SK_Follow INNER JOIN SK_Client ON SK_Follow.SK_ClientID=SK_Client.ClientID INNER JOIN SK_SystemUsers ON SK_Client.SK_SalesID=SK_SystemUsers.UsersID where DateDiff(day,'"&Youdate&"',SK_Follow.SK_FTime)=0 and SK_Follow.SK_Ftitle Like '%"&F("Key")&"%' and SK_Client.SK_SalesID="&Session("UID")&" and SK_Follow.SK_Di=0 and SK_Follow.SK_Del=0 order by SK_Follow.FollowID asc"
end if
RsFollow1.open SqlFollow1,conn,1,1
L=0
while not RsFollow1.eof
L=L+1
%>
<div align="left" style="font-size:9pt;color:888888;">
<a href="javascript:void(0)" onClick="javascript:var win=window.open('SK.ReFollow.asp?id=<%=RsFollow1("FollowID")%>','Read','width=820,height=400,top=170,left=161,center:yes,status:no,help:no,toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=yes,scrollbars=yes'); win.focus()"><%=L%>.<%=left(RsFollow1("SK_Ftitle"),30)%>...</a> <font color="#FF7979">[ 跟进:<%
set RsFuser1=server.createobject("adodb.recordset")
SqlFuser1="select * from SK_SystemUsers where UsersID="&RsFollow1("SK_SalesID")&""
RsFuser1.open SqlFuser1,conn,1,1
Response1.write""&RsFuser1("SK_OName")&""
RsFuser1.close
RsFuser1=Nothing
%> | <%=RsFollow1("SK_AFollowtime")%> ]</font> ( <%if Session("Manager")="1" OR JudgePopedomTF(Session("UserName"),"SK200000302") then%><a href="javascript:void(0)" onClick="javascript:var win=window.open('SK.ModFollow.asp?id=<%=RsFollow1("FollowID")%>','Mod','width=820,height=400,top=170,left=161,center:yes,status:no,help:no,toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=yes,scrollbars=yes'); win.focus()">修改</a><%end if%> <%if Session("Manager")="1" OR JudgePopedomTF(Session("UserName"),"SK200000303") then%> | <a onClick="return confirm('此操作将删除记录,确定要删除此记录吗？')" href="?Action=Del&ID=<%=RsFollow1("FollowID")%>">删除</a><%end if%> <%if Session("Manager")<>6 AND RsFollow1("SK_SalesID")<>Session("UID") AND JudgePopedomTF(Session("UserName"),"SK200000304") then%>| <a href="javascript:void(0)" onClick="javascript:var win=window.open('SK.AddDP.asp?id=<%=RsFollow1("FollowID")%>','DP','width=820,height=400,top=170,left=161,center:yes,status:no,help:no,toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=yes,scrollbars=yes'); win.focus()">点评(<%=conn.execute("select count(*) from SK_FollowReply where SK_FollowID="&RsFollow1("FollowID")&" and SK_Del=0")(0)%> )</a><%end if%> )<br>
</div>
<%
RsFollow1.movenext
wend
RsFollow1.close
set RsFollow1=Nothing

response.write "</td>" & vbcrlf 
end if 

if iposition = 7 then 
response.write vbtab & "</tr>" & vbcrlf 
iposition = 0 
end if 

icurrent = icurrent + 1 
iposition = iposition + 1 
loop 

if iposition <> 1 then 
do while iposition <= 7 
response.write vbtab & vbtab & "<td bgcolor=""ffffff"" height=150> </td>" & vbcrlf 
iposition = iposition + 1 
loop 
response.write vbtab & "</tr>" & vbcrlf 
end if 
%>
</table>

</td>
  </tr>
</table>

</td>
<td width="8" background="../images/tab_15.gif"></td>
</tr>
</table></td>
</tr>
<tr>
<td class="SK_Td_Foot">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="1%" height="20"><img src="../images/tab_18.gif" width="12" height="20" /></td>
<td width="98%" class="SK_Td_Page"></td>
<td width="1%"><img src="../images/tab_20.gif" width="16" height="20" /></td>
</tr>
</table>

</td>
</tr>
</TBODY>
</table>
</body>
<%
Call CloseDB()
%>
</html>