⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 getweek.asp

📁 功能齐全的oa系统
💻 ASP
字号:
<%@ LANGUAGE = VBScript %>
<% Option Explicit %>
<!-- #include virtual="include/DataEnvi.asp" -->
<%
Sub Main()
  Dim strWeekStart, strWeekEnd, strToday, strTodaytime
  Dim ObjDB, ObjRS, strSQL
  Dim strStartDate, strEndDate

	if session("AccountID")="" then
%>
<script language=javascript>
  	alert("因登录时间过长,会话失效,请退出重新登陆!")
</script>
<%  
   	Response.End
	end if

  strWeekStart = Request.QueryString("WeekStart") & " 00:00:00"
  strWeekEnd = Request.QueryString("WeekEnd") & " 23:59:59"
  
  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 (StartDate BETWEEN '" & strWeekStart & "' AND '" & strWeekEnd & "' "
  strSQL = strSQL & " OR EndDate BETWEEN '" & strWeekStart & "' AND '" & strWeekEnd & "') "
  strSQL = strSQL & " ORDER BY StartDate"
  Set ObjRS = Server.CreateObject("ADODB.Recordset")
  ObjRS.Open strSQL,ObjDB,1,3
%>
  <html>
  <head>
  <link REL="STYLESHEET" HREF="<%=Application("RootPath")%>Templet/Main.css" type="text/css">
<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(intEvtID)
  {
    var strUrl;
    strUrl = "EditLog.asp?ID=" + intEvtID;
    window.open(strUrl, "", "width=450,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 intStartTime, intEndTime, intEvtID, strTitle, strNote
  Dim strStartTime, strEndTime, intTimespans, strAMPM, blnHasEvent, strBgcolor
  Dim strTemp, intTemp
  Dim strCurDay, strTimeStart, strTimeEnd, intWeekDay
  ReDim intTimespans(7)
  
  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" rowspan="2" NOWRAP>
        <label style="color:#2C60B1" onmouseover="this.style.color='#B12C4F'" onmouseout="this.style.color='#2C60B1'">
          <%= strAMPM %>&nbsp;
        </label>
      </td>
<%
    End If

    blnHasEvent = False
    '需要扣除掉已安排日程的rowspan
    For intWeekDay = 0 To 6
      If intWeekDay >= 5 Then strBgcolor = "#ECFCFC"
      If intTimespans(intWeekDay) > 0 Then intTimespans(intWeekDay) = intTimespans(intWeekDay) - 1

      strCurDay = DateAdd("d", intWeekDay, strWeekStart)
      strCurDay = Month(strCurDay) & "/" & Day(strCurDay) & "/" & Year(strCurDay)

      If intLoop Mod 2 = 0 Then
        strTimeStart = strCurDay & " " & Right("0" & (intLoop \ 2), 2) & ":00:00"
        strTimeEnd = strCurDay & " " & Right("0" & (intLoop \ 2), 2) & ":30:00"
      Else
        strTimeStart = strCurDay & " " & Right("0" & (intLoop \ 2), 2) & ":30:00"
        strTimeEnd = DateAdd("n", 30, strTimeStart)
        strTimeEnd = Year(strTimeEnd) & "/" & Month(strTimeEnd) & "/" & Day(strTimeEnd) & _
          " " & Right("0" & DatePart("h", strTimeEnd), 2) & ":" & Right("0" & DatePart("n", strTimeEnd), 2) & ":00"
      End If
      
      ObjRS.Filter = "StartDate <= '" & strTimeStart & "' AND EndDate >= '" & strTimeEnd & "'"
      blnHasEvent = False

      If ObjRS.RecordCount > 0 Then 'recordcount should be 1 or 0
        Dim intStartDay, intEndDay
        Dim intStartHour, intStartMinute, intEndHour, intEndMinute, intStartLoop, intEndLoop

        strStartDate = ObjRS("StartDate")
        strEndDate = ObjRS("EndDate")
        intStartDay = DateDiff("d", strCurDay, strStartDate)
        intEndDay = DateDiff("d", strCurDay, 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

        strStartTime = intStartHour & ":" & Right("0" & intStartMinute, 2)
        strEndTime = DatePart("h", strEndDate) & ":" & Right("0" & DatePart("n", strEndDate), 2)
        intEvtID = ObjRS("ID")
        strTitle = ObjRS("Title")
        strNote = ObjRS("Remark")

        If intStartLoop = intLoop Then
          blnHasEvent = True
          intTimespans(intWeekDay) = intEndLoop - intStartLoop + 1
          If intTimespans(intWeekDay) > (48 - intLoop) Then intTimespans(intWeekDay) = 48 - intLoop
        End If
      End If
       
      '如果安排了日程,则显示已经安排的日程
      If blnHasEvent Then
%>
        <td class="ThingLine" Rowspan="<%= intTimespans(intWeekDay) %>" WIDTH="14%" height="<%= intTimespans(intWeekDay) * 20 %>px" onclick="EditApp(<%= intEvtID %>)" TITLE="单击可以修改计划<%= strTitle %> 备注:<%= strNote %>">
        <img src="../images/alarm.gif" WIDTH="17" HEIGHT="14">
        <label onmouseover="this.style.color='Red'" onmouseout="this.style.color='black'">
          <b>
<%
        If Len(strTitle) > 4 Then
          Response.Write Left(strTitle, 4) & "..."
        Else
          Response.Write strTitle
        End If 
%>
        </b>
        </label>
      </td>
<%
      '需要扣除掉已安排日程的rowspan
      Elseif intTimespans(intWeekDay) = 0 Then
%>
        <td BGCOLOR="<%= strBgcolor %>" WIDTH="14%" TITLE="单击安排计划" height="20px" style="cursor:hand" onclick="AddApp('<%= strTimeStart %>', '<%= strTimeEnd %>')">&nbsp;</td><%
      End If
    Next
  
    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 %>&nbsp;
        </label>
      </td>
<%
    End If
%>
  </tr>
<%
  Next
%>
  </table>
  </body>
  </html>
<%
End Sub

Call Main 
%>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -