📄 getday.asp
字号:
<!-- #include virtual="include/DataEnvi.asp" -->
<%
Response.Expires = -1
Response.AddHeader "Pragma","no-cache"
Response.AddHeader "Cache-Control","no-cache,must-revalidate"
if session("AccountID")="" then
%>
<script language=javascript>
alert("因登录时间过长,会话失效,请退出重新登陆!")
</script>
<%
Response.End
end if
Sub Main()
Dim strToday
strToday = Request.QueryString("Today")
Dim ObjDB, ObjRS, strSQL
Dim strStartDate, strEndDate
set ObjDB = Server.CreateObject("ADODB.Connection")
OpenDB ObjDB
'On Error Resume Next
strSQL = "SELECT ID, Title, Place, StartDate, EndDate, Remark FROM t_OA_Private_Log "
strSQL = strSQL & " WHERE IsForLeader=0 And AccountID= " & Session("AccountID")
strSQL = strSQL & " And DateDiff(dd, StartDate, '" & strToday & "') >= 0 "
strSQL = strSQL & " AND DateDiff(dd, EndDate, '" & strToday & "') <= 0 ORDER BY StartDate"
Set ObjRS = ObjDB.Execute (strSQL)
%>
<html>
<head>
<link REL=STYLESHEET HREF="<%=Application("RootPath")%>Templet/Main.css" type="text/css">
<Script Language="JavaScript" src="../include/MSAlert.js"></Script>
<Script language = "JavaScript">
<!--
function AddApp(strStartTime, strEndTime)
{
var strUrl;
strUrl = "EditLog.asp?StartDate=" + strStartTime + "&EndDate=" + strEndTime;
window.open(strUrl, "", "width=420,height=400,status=no,help=no");
}
function EditApp(intID)
{
var strUrl;
strUrl = "EditLog.asp?ID=" + intID;
window.open(strUrl, "", "width=420,height=400,status=no,help=no");
}
//-->
</Script>
</head>
<body LEFTMARGIN='0' TOPMARGIN='0' MARGINWIDTH='0' MARGINHEIGHT='0' onload="window.scrollTo(0, 336)">
<table BORDER="0" CELLPADDING="0" class="DispBackground" CELLSPACING="1">
<%
Dim intLoop
Dim intID, strTitle, strNote
Dim strStartTime, strEndTime, intTimespans, strAMPM, blnHasEvent, strBgcolor
Dim strTemp, intTemp
For intLoop = 0 To 47 '在一天24小时中循环,每半小时一行
If intLoop < 16 Then
strAMPM = "早上" & Cstr(intLoop \ 2) & "点"
strBgcolor = "#F4FCFC"
Elseif intLoop < 26 Then
strAMPM = "上午" & Cstr(intLoop \ 2) & "点"
If intLoop Mod 2 = 0 Then
strBgcolor = "#CCECFC"
Else
strBgcolor = "#ECF4FC"
End If
Elseif intLoop < 38 Then
strAMPM = "下午" & Cstr(intLoop \ 2 - 12) & "点"
If intLoop Mod 2 = 0 Then
strBgcolor = "#CCECFC"
Else
strBgcolor = "#ECF4FC"
End If
Else
strAMPM = "晚上" & Cstr(intLoop \ 2 - 12) & "点"
strBgcolor = "#F4FCFC"
End If
%>
<tr>
<%
If intLoop Mod 2 = 0 Then '小时的时间显示每两行一个
%>
<td align=right class="TimeArray" WIDTH=80 rowspan=2 NOWRAP>
<Label style="color:#2C60B1" onmouseover="this.style.color='#B12C4F'"
onmouseout="this.style.color='#2C60B1'">
<%= strAMPM %>
</label>
</td>
<%
strStartTime = strToday & " " & Right("0" & (intLoop \ 2), 2) & ":00:00"
strEndTime = strToday & " " & Right("0" & (intLoop \ 2), 2) & ":30:00"
Else
strStartTime = strToday & " " & Right("0" & (intLoop \ 2), 2) & ":30:00"
strEndTime = DateAdd("n", 30, strStartTime)
strEndTime = Year(strEndTime) & "/" & Month(strEndTime) & "/" & Day(strEndTime)
strEndTime = strEndTime & " " & Right("0" & DatePart("h", strEndTime), 2) & ":" & Right("0" & DatePart("n", strEndTime), 2) & ":00"
End If
blnHasEvent = False
'需要扣除掉已安排日程的rowspan
If intTimespans > 0 Then intTimespans = intTimespans - 1
If Not ObjRS.Eof Then
Dim intStartDay, intEndDay
Dim intStartHour, intStartMinute, intEndHour, intEndMinute, intStartLoop, intEndLoop
strStartDate = ObjRS("StartDate")
strEndDate = ObjRS("EndDate")
intStartDay = DateDiff("d", strToday, strStartDate)
intEndDay = DateDiff("d", strToday, strEndDate)
intStartHour = DatePart("h", strStartDate)
intStartMinute = DatePart("n", strStartDate)
intEndHour = DatePart("h", strEndDate)
intEndMinute = DatePart("n", strEndDate)
intStartLoop = (intStartDay * 24 * 60 + intStartHour * 60 + intStartMinute) \ 30
intEndLoop = (intEndDay * 24 * 60 + intEndHour * 60 + intEndMinute - 1) \ 30
If intStartLoop < 0 Then '开始日期在今天之前
intStartLoop = 0
End If
intID = ObjRS("ID")
strTitle = ObjRS("Title")
strNote = ObjRS("Remark")
If intLoop = intStartLoop Then
blnHasEvent = True
intTimespans = intEndLoop - intStartLoop + 1
If intTimespans > (48 - intLoop) Then intTimespans = 48 - intLoop
ObjRS.MoveNext
End If
End If
'如果安排了日程,则显示已经安排的日程
If blnHasEvent Then
%>
<td class="ThingLine" Rowspan="<%= intTimespans %>" WIDTH=100% height="<%= intTimespans * 20 %>px" onclick="EditApp(<%= intID %>)" TITLE="单击修改计划<%= VbCrLf %>备注:<%= strNote %>"
nowrap>
<label onmouseover="this.style.color='Red'"
onmouseout="this.style.color='black'">
<b><%=strTitle%></b><br>
<%= strStartDate %>--<%= strEndDate %>
</label>
</td>
<%
'需要扣除掉已安排日程的rowspan
Elseif intTimespans = 0 Then
%>
<td BGCOLOR="<%= strBgcolor %>" WIDTH="100%" TITLE="单击安排计划"
height="20px" style="cursor:hand" onclick="AddApp('<%= strStartTime %>', '<%= strEndTime %>')" nowrap> </td><%
End If
%>
</tr>
<%
Next
%>
</table>
</body>
</html>
<%
End Sub
Call Main
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -