<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" -->
<!--#include file="../Inc/SK.PageClass.asp" -->
<%if Not (getconfig("SK_Office")="0" AND (Session("Manager")="1" OR (JudgePopedomTF(Session("UserName"),"SK100000000") AND JudgePopedomTF(Session("UserName"),"SK100000500")))) then Call ReturnError()%>
<%
'Delete begin
if F("id")<>"" and RQ("Action")="Del" and (Session("Manager")="1" OR JudgePopedomTF(Session("UserName"),"SK100000503")) then
set rs=server.createobject("adodb.recordset")
if Session("Manager")=1 or Session("Manager")=2 then
conn.execute("delete from SK_OfficeWorkLog where WorkLogID in("&F("id")&")")
elseif Session("Manager")=3 then
conn.execute("delete from SK_OfficeWorkLog INNER JOIN SK_SystemUsers ON SK_OfficeWorkLog.SK_SalesID=SK_SystemUsers.UsersID where SK_SystemUsers.SK_Dept1="&Session("Dept1")&" and SK_OfficeWorkLog.WorkLogID in("&F("id")&")")
elseif Session("Manager")=4 then
conn.execute("delete from SK_OfficeWorkLog INNER JOIN SK_SystemUsers ON SK_OfficeWorkLog.SK_SalesID=SK_SystemUsers.UsersID where SK_SystemUsers.SK_Dept1="&Session("Dept1")&" and SK_SystemUsers.SK_Dept2="&Session("Dept2")&" and SK_OfficeWorkLog.WorkLogID in("&F("id")&")")
elseif Session("Manager")=5 then
conn.execute("delete from SK_OfficeWorkLog INNER JOIN SK_SystemUsers ON SK_OfficeWorkLog.SK_SalesID=SK_SystemUsers.UsersID where SK_SystemUsers.SK_Dept1="&Session("Dept1")&" and SK_SystemUsers.SK_Dept2="&Session("Dept2")&" and SK_SystemUsers.SK_Dept3="&Session("Dept3")&" and SK_OfficeWorkLog.WorkLogID in("&F("id")&")")
elseif Session("Manager")=6 then
conn.execute("delete from SK_OfficeWorkLog where SK_SalesID="&Session("UID")&" and WorkLogID in("&F("id")&")")
end if
conn.execute("delete from SK_OfficeWorkLogReply where SK_WorkLogID in("&F("id")&")")
'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
Call Returnokback()
end if
'Delete End

d=day(date())
m=F("m")
yyyy=F("yyyy")
if m="" then m=month(date())
if yyyy="" then yyyy=year(date())
function findDays(yy,mm) 
  dt=dateSerial(yy,mm,1) 
  findDays=datediff("d",dt,dateadd("m",1,dt)) 
end function
dd=findDays(yyyy,m)
if yyyy<>year(date) and m<>month(date()) then d=dd
temp_date=cdate(yyyy&"-"&m&"-"&d)
mydate=temp_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 background="../images/tab_12.gif"></td>
<td></td>
<td background="../images/tab_15.gif"></td>
</tr>

<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="619" border="0" cellpadding="0" cellspacing="0" style="margin-top:8px;">
<%
temp_year1=2006
temp_year2=year(date()) + 2
%>
<form id="form1" name="form1" method="post" action="">
<tr>
  <td width="160" align="center">[<span class=red><%=year(mydate)%>年<%=month(mydate)%>月</span>]-日报表</strong></td>
<td width="85" align="center"><select name="yyyy" id="yyyy">
<option value="<%=F("yyyy")%>" selected="selected"><%if F("yyyy")<>"" then%><%=F("yyyy")%>年<%else%>--年--<%end if%></option>
<%for temp_yyyy=temp_year1 to temp_year2%>
<option value="<%=temp_yyyy%>"><%=temp_yyyy%>年</option>
<%next%><%j=day(mydate)-1%>
</select></td>
<td width="27" align="center">--</td>
<td width="85" align="center"><select name="m" id="m">
<option value="<%=F("m")%>" selected="selected"><%if F("m")<>"" then%><%=F("m")%>月<%else%>--月--<%end if%></option>
<%for temp_m=1 to 12%>
<option value="<%=temp_m%>"><%=temp_m%>月</option>
<%next%>
</select></td>
<td width="262" align="center">主题 
  <input name="Key" type="text" size="20" value="<%=F("Key")%>">
<input type="submit" class="button1" name="Submit" value=" 查询 " /></td>
</tr></form>
</table></td>
</tr>
</table>
</td>
</tr>

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

<table width="100%" border="0" align="center" cellpadding="1" cellspacing="1" class="tr_bg_dddddd">
<tr align="center" class="tr_bg_eeeeee">
<td width="21%" height="30">日期/星期</td>
<td width="75%">日志主题</td>
<td width="4%">新增</td>
</tr>
<%for i=0 to j%>
<tr align="center" class="tr_bg_ffffff">
<td align="center" height="30" >
<%=formatdatetime(mydate-i,1)%> (<%
select case Weekday(cdate(mydate-i))
case "1"
response.write"星期日"
case "2"
response.write"星期一"
case "3"
response.write"星期二"
case "4"
response.write"星期三"
case "5"
response.write"星期四"
case "6"
response.write"星期五"
case "7"
response.write"星期六"
case else
response.write"发生错误"
end select%>)</td>

<%Dim TayDay:TayDay=split(mydate-i)(0)%>
<td class="SK_text1">
<%
set rs11=Server.createobject("adodb.recordset")
if Session("Manager")=1 or Session("Manager")=2 then
sql11="select * from SK_OfficeWorkLog where DateDiff(day,'"&mydate-i&"',SK_Ftime)=0 and SK_Title Like '%"&F("Key")&"%' and SK_Del=0 order by WorkLogID asc"
elseif Session("Manager")=3 then
sql11="select * from SK_OfficeWorkLog INNER JOIN SK_SystemUsers ON SK_OfficeWorkLog.SK_SalesID=SK_SystemUsers.UsersID where DateDiff(day,'"&mydate-i&"',SK_OfficeWorkLog.SK_Ftime)=0 and SK_OfficeWorkLog.SK_Title Like '%"&F("Key")&"%' and SK_SystemUsers.SK_Dept1="&Session("Dept1")&" and SK_OfficeWorkLog.SK_Del=0 order by SK_OfficeWorkLog.WorkLogID asc"
elseif Session("Manager")=4 then
sql11="select * from SK_OfficeWorkLog INNER JOIN SK_SystemUsers ON SK_OfficeWorkLog.SK_SalesID=SK_SystemUsers.UsersID where DateDiff(day,'"&mydate-i&"',SK_OfficeWorkLog.SK_Ftime)=0 and SK_OfficeWorkLog.SK_Title Like '%"&F("Key")&"%' and SK_SystemUsers.SK_Dept1="&Session("Dept1")&" and SK_SystemUsers.SK_Dept2="&Session("Dept2")&" and SK_OfficeWorkLog.SK_Del=0 order by SK_OfficeWorkLog.WorkLogID asc"
elseif Session("Manager")=5 then
sql11="select * from SK_OfficeWorkLog INNER JOIN SK_SystemUsers ON SK_OfficeWorkLog.SK_SalesID=SK_SystemUsers.UsersID where DateDiff(day,'"&mydate-i&"',SK_OfficeWorkLog.SK_Ftime)=0 and SK_OfficeWorkLog.SK_Title 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_OfficeWorkLog.SK_Del=0 order by SK_OfficeWorkLog.WorkLogID asc"
elseif Session("Manager")=6 then
sql11="select * from SK_OfficeWorkLog where DateDiff(day,'"&mydate-i&"',SK_OfficeWorkLog.SK_Ftime)=0 and SK_Title Like '%"&F("Key")&"%' and SK_SalesID="&Session("UID")&" and SK_Del=0 order by WorkLogID asc"
end if
rs11.open sql11,conn,1,1
K=0
while not rs11.eof
K=K+1
%>
<a href="javascript:void(0)" onClick="javascript:var win=window.open('SK.ReWorkLog.asp?id=<%=Rs11("WorkLogID")%>','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(Rs11("SK_Title"),22)%>...</a> 
 <font color="#FF7979">[ 填写人：<%
set RsFuser=server.createobject("adodb.recordset")
SqlFuser="select * from SK_SystemUsers where UsersID="&Rs11("SK_SalesID")&""
RsFuser.open SqlFuser,conn,1,1
Response.write""&RsFuser("SK_Oname")&""
RsFuser.close
set RsFuser=Nothing
%> | <%=Rs11("SK_Atime")%> ]</font> ( <%if (Session("Manager")="1" OR JudgePopedomTF(Session("UserName"),"SK100000502")) and Rs11("SK_Lock")=0 then%><a href="javascript:void(0)" onClick="javascript:var win=window.open('SK.ModWorkLog.asp?id=<%=Rs11("WorkLogID")%>','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()"><font color="#999999">修改</font></a> |<%end if%> <%if Session("Manager")="1" OR (JudgePopedomTF(Session("UserName"),"SK100000503") and Rs11("SK_Lock")=0) then%><a onClick="return confirm('此操作将无法恢复,确定要删除此记录吗？')" href="?Action=Del&ID=<%=Rs11("WorkLogID")%>"><font color="#999999">删除</font></a><%end if%> <%if (Session("Manager")<>6) and (Session("Manager")="1" OR JudgePopedomTF(Session("UserName"),"SK100000504")) then%>| <a href="javascript:void(0)" onClick="javascript:var win=window.open('SK.AddWlDP.asp?id=<%=Rs11("WorkLogID")%>','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()">点评( <font color="red"><%=conn.execute("select count(*) from SK_OfficeWorkLogReply where SK_WorkLogID="&Rs11("WorkLogID")&" and SK_Del=0")(0)%></font> )</a><%end if%> )<br>
<%
rs11.movenext
wend
rs11.close
set rs11=Nothing
%></td>
<td>
<%if Session("Manager")="1" OR JudgePopedomTF(Session("UserName"),"SK100000501") then
Response.write"<a href=""javascript:void(0)"" onClick=""javascript:var win=window.open('SK.AddWorkLog.asp?Ad="&TayDay&"','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
%>
</td>
</tr>
<%next%>
<tr align="center" class="tr_bg_ffffff">
  <td align="center" height="30" >合计</td>
  <td> <span class=red><%=year(mydate)%>年<%=month(mydate)%>月</span> 共有
<%if Session("Manager")=1 or Session("Manager")=2 then%>
<%=conn.execute("select count(*) from SK_OfficeWorkLog where datediff(m,[SK_Ftime],'"&mydate&"')=0 and SK_Title Like '%"&F("Key")&"%' and SK_Del=0")(0)%>
<%elseif Session("Manager")=3 then%>
<%=conn.execute("select count(*) from SK_OfficeWorkLog INNER JOIN SK_SystemUsers ON SK_OfficeWorkLog.SK_SalesID=SK_SystemUsers.UsersID where datediff(m,[SK_Ftime],'"&mydate&"')=0 and SK_OfficeWorkLog.SK_Title Like '%"&F("Key")&"%' and SK_OfficeWorkLog.SK_Del=0 and SK_SystemUsers.SK_Dept1="&Session("Dept1")&"")(0)%>
<%elseif Session("Manager")=4 then%>
<%=conn.execute("select count(*) from SK_OfficeWorkLog INNER JOIN SK_SystemUsers ON SK_OfficeWorkLog.SK_SalesID=SK_SystemUsers.UsersID where datediff(m,[SK_Ftime],'"&mydate&"')=0 and SK_OfficeWorkLog.SK_Title Like '%"&F("Key")&"%' and SK_OfficeWorkLog.SK_Del=0 and SK_SystemUsers.SK_Dept1="&Session("Dept1")&" and SK_SystemUsers.SK_Dept2="&Session("Dept2")&"")(0)%>
<%elseif Session("Manager")=5 then%>
<%=conn.execute("select count(*) from SK_OfficeWorkLog INNER JOIN SK_SystemUsers ON SK_OfficeWorkLog.SK_SalesID=SK_SystemUsers.UsersID where datediff(m,[SK_Ftime],'"&mydate&"')=0 and SK_OfficeWorkLog.SK_Title Like '%"&F("Key")&"%' and SK_OfficeWorkLog.SK_Del=0 and SK_SystemUsers.SK_Dept1="&Session("Dept1")&" and SK_SystemUsers.SK_Dept2="&Session("Dept2")&" and SK_SystemUsers.SK_Dept3="&Session("Dept3")&"")(0)%>
<%elseif Session("Manager")=6 then%>
<%=conn.execute("select count(*) from SK_OfficeWorkLog where datediff(m,[SK_Ftime],'"&mydate&"')=0 and SK_Title Like '%"&F("Key")&"%' and SK_Del=0 and SK_SalesID="&Session("UID")&"")(0)%>
<%end if%>  篇日志
</td>
  <td>&nbsp;</td>
  </tr>
    </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>