home *** CD-ROM | disk | FTP | other *** search
/ PC Plus SuperCD (UK) 2000 May / PCP163A.iso / full / atlantic / Software / Teweb / data1.cab / Pages / scripts / gridview.asp < prev    next >
Encoding:
Text File  |  2000-02-14  |  12.7 KB  |  485 lines

  1. <%@ LANGUAGE="VBSCRIPT" %>
  2. <%     Set clsTes = Session("TES")
  3.     If clsTes.LoggedIn = False Then
  4.         Set clsTes = Nothing
  5.         Response.Redirect("../loggedout.htm")
  6.     End If
  7.  
  8.     tResource = Request("Resource")
  9.     dDate = Request("Date")
  10.     tGridBy = Request("GridBy")
  11.     tViewBy = Request("ViewBy")
  12.     
  13.     If Len(dDate)=0 Then
  14.       dDate = clsTes.Monday(clsTes.ADbl(clsTes.FromDate))
  15.       clsTes.FromDate = clsTes.ADbl(dDate)
  16.     Else
  17.       dDate = clsTes.Monday(clsTes.ADbl(dDate))
  18.       clsTes.FromDate = clsTes.ADbl(dDate)
  19.     End If
  20.     
  21.     If Len(tResource) = 0 Then
  22.       tResource = clsTes.Resource
  23.     Else
  24.         If clsTes.ViewResource(tResource,1) Then
  25.             clsTes.Resource = tResource
  26.         Else
  27.             tResource = clsTes.Resource
  28.         End If
  29.     End If
  30.  
  31.     If Len(tGridBy) = 0 Then
  32.       tGridBy = clsTes.GridBy
  33.     Else
  34.       clsTes.GridBy = tGridBy
  35.     End If
  36.  
  37.     If Len(tViewBy) = 0 Then
  38.       tViewBy = clsTes.ViewBy
  39.     Else
  40.       clsTes.ViewBy = tViewBy
  41.     End If
  42.  
  43. %>
  44. <!-- #INCLUDE FILE = "settings/colours.txt" -->
  45. <HTML>
  46. <HEAD>
  47. <META NAME="GENERATOR" Content="Microsoft Visual InterDev 1.0">
  48. <META HTTP-EQUIV="Content-Type" content="text/html; charset=iso-8859-1">
  49. <TITLE>Timesheet Grid View</TITLE>
  50. </HEAD>
  51. <BODY BGCOLOR="<%= BackColor %>" LINK="<%= LinkColor %>" VLINK="<%= VLinkColor %>" ALINK="<%= ALinkColor %>" TEXT="<%= TextColor %>">
  52. <BASEFONT SIZE=2 COLOR="<%= TextColor %>">
  53.  
  54. <% If clsTes.TimesheetViewAccess <> 2 Then        'US_NONE %>
  55.  
  56. <table border=0 width=100% cellspacing=0 cellpadding=0>
  57. <tr>    
  58.     <td><IMG border=0 src="..\images\space.gif"> </td>    
  59. </tr>
  60. <tr>
  61.     <td align=left valign=top nowrap=nowrap>
  62.  
  63.         <table border=0 cellspacing=1 cellpadding=1>
  64.         <tr>
  65.             <td align=left>
  66.             <b>
  67.             <%= Server.HTMLEncode(clsTes.ResourceLabel) %>:
  68.             </b>
  69.             </td>
  70.             <td align=left>
  71. <%            If clsTes.TimesheetViewAccess <> 3 and clsTes.TimesheetViewAccess <> 6 and clsTes.TimesheetViewAccess <> 7 Then        'US_OWN %>
  72.                 <a href="pickitem.asp?Type=Resource&<%= "ReturnURL=" & Server.URLEncode("tsgrid.asp") %>" target=_parent>
  73. <%            End If
  74.  
  75.             If len(tResource) > 0 Then
  76.                 Response.Write(Server.HTMLEncode(tResource))
  77.             Else %>
  78.                 Please Select
  79. <%            End If %>
  80.  
  81. <%            If clsTes.TimesheetViewAccess <> 3 and clsTes.TimesheetViewAccess <> 6 and clsTes.TimesheetViewAccess <> 7 Then        'US_OWN %>
  82.                 </a>
  83. <%            End If %>
  84.  
  85.             </td>
  86.  
  87.             <td width=25></td>
  88.  
  89.             <td align=left>
  90.             <B>Grid By:</B>
  91. <%            tURL="tsgrid.asp?GridBy=" 
  92.             If tGridBy = "Project" Then
  93.                 tURL=tURL & "Activity" %>
  94.                 <a href="<%= tURL %>" target=_parent>
  95.                 <%= Server.HTMLEncode(clsTes.ProjectLabel) %>
  96. <%            Else
  97.                 tURL=tURL & "Project" %>
  98.                 <a href="<%= tURL %>" target=_parent>
  99.                 <%= Server.HTMLEncode(clsTes.ActivityLabel) %>
  100. <%            End If%>
  101.             </a>
  102.             </td>
  103.  
  104.             <td width=25></td>
  105.  
  106.             <td align=left>
  107.             <B>View:</b>
  108. <%            tURL="tsgrid.asp?ViewBy=" 
  109.             If tViewBy = "Desc" Then
  110.                 tURL=tURL & "Code" %>
  111.                 <a href="<% Response.Write(tURL) %>" target=_parent>
  112.                 Descriptions
  113. <%            Else
  114.               tURL=tURL & "Desc" %>
  115.                 <a href="<% Response.Write(tURL) %>" target=_parent>
  116.                 Codes
  117. <%            End If%>
  118.             </a>
  119.             </td>
  120.  
  121.             <td width=25></td>
  122.  
  123.         </tr>
  124.         </table>
  125.     </td> 
  126.  
  127.     <td align=right valign=top>
  128. <%        tURL = "tsgrid.asp?Date=" %>
  129.         <table border=0 cellspacing=1 cellpadding=1>
  130.         <tr>
  131.             <td align=center NOWRAP=NOWRAP>
  132.                 <b>
  133.                 <A HREF="calendar.asp?ReturnURL=<%= Server.URLEncode("tsgrid.asp") %>&Name=Date&Date=<%= dDate %>" target="_parent">
  134.                 <% Response.Write(clsTes.FormatDate(dDate)) %>
  135.                 </A>
  136.                 </b> 
  137.             </td>
  138.             <td align=center>
  139.                 To 
  140.             </td>
  141.             <td align=center>    
  142.                 <b><% Response.Write(clsTes.FormatDate(dDate+6)) %></b>
  143.             </td>
  144.             <td width=10></td>
  145.             <td align=center width=25>
  146.                 <a href=<% Response.Write(tURL & CStr(dDate - 28)) %> target=_parent>
  147.                 <img border=0 align=center src="../images/bck4w.gif" ALT="Back 4 Weeks">
  148.                 </a>
  149.             </td>
  150.             <td align=center width=25>
  151.                 <a href=<% Response.Write(tURL & CStr(dDate - 7)) %> target=_parent>
  152.                 <img border=0 align=center src="../images/bck1w.gif" ALT="Back 1 Week">
  153.                 </a>
  154.             </td>
  155.             <td align=center width=25>
  156.                 <a href=<% Response.Write(tURL & CStr(dDate + 7)) %> target=_parent>
  157.                 <img border=0 align=center src="../images/fwd1w.gif" ALT="Forward 1 Week">
  158.                 </a>
  159.             </td>
  160.             <td align=center width=25>
  161.                 <a href=<% Response.Write(tURL & CStr(dDate + 28)) %> target=_parent>
  162.                 <img border=0 align=center src="../images/fwd4w.gif" ALT="Forward 4 Weeks">
  163.                 </a>
  164.             </td>
  165.         </tr>
  166.         </table>
  167.     </td>
  168. </tr>
  169. <tr>
  170.     <td><IMG border=0 src="..\images\space.gif"> </td>
  171. </tr>
  172. </table>
  173.  
  174.  
  175.  
  176. <table border=0 width=100% cellspacing=1 cellpadding=2>
  177. <tr>
  178.     <td align=left valign=top bgcolor ="<%= CellTitleColor %>" width=20%>
  179.         <font color="<%= CellTitleTextColor %>">
  180. <%        If tGridBy = "Activity" Then %>    
  181.             <b><%= Server.HTMLEncode(clsTes.ActivityLabel) %></b>
  182. <%        Else %>
  183.             <b><%= Server.HTMLEncode(clsTes.ProjectLabel) %></b>
  184. <%        End If %>
  185.  
  186. <%        If tViewBy = "Desc" Then %>
  187.             <b>Description</B>
  188. <%        Else %>
  189.             <b>Code</b>
  190. <%        End If %>
  191.         </font>
  192.     </td>
  193.     <td align=center valign=top bgcolor ="<%= CellTitleColor %>" width=8%>
  194.         <font color="<%= CellTitleTextColor %>">
  195.         <b>Mon</b>
  196.         </font>
  197.     </td>
  198.     <td align=center valign=top bgcolor ="<%= CellTitleColor %>" width=8%>
  199.         <font color="<%= CellTitleTextColor %>">
  200.         <b>Tue</b>
  201.         </font>
  202.     </td>
  203.     <td align=center valign=top bgcolor ="<%= CellTitleColor %>" width=8%>
  204.         <font color="<%= CellTitleTextColor %>">
  205.         <b>Wed</b>
  206.         </font>
  207.     </td>
  208.     <td align=center valign=top bgcolor ="<%= CellTitleColor %>" width=8%>
  209.         <font color="<%= CellTitleTextColor %>">
  210.         <b>Thu</b>
  211.         </font>
  212.     </td>
  213.     <td align=center valign=top bgcolor ="<%= CellTitleColor %>" width=8%>
  214.         <font color="<%= CellTitleTextColor %>">
  215.         <b>Fri</b>
  216.         </font>
  217.     </td>
  218.     <td align=center valign=top bgcolor ="<%= CellTitleColor %>" width=8%>
  219.         <font color="<%= CellTitleTextColor %>">
  220.         <b>Sat</b>
  221.         </font>
  222.     </td>
  223.     <td align=center valign=top bgcolor ="<%= CellTitleColor %>" width=8%>
  224.         <font color="<%= CellTitleTextColor %>">
  225.         <b>Sun</b>
  226.         </font>
  227.     </td>
  228.     <td align=center valign=top bgcolor ="<%= GridTotalDarkColor %>" width=8%>
  229.         <font color="<%= GridTotalTextColor %>">
  230.         <b>Total <%= Server.HTMLEncode(clsTes.UnitTimeLabelP) %></b>
  231.         </font>
  232.     </td>
  233. <%    If clsTes.UserCost = 2 or clsTes.UserCost = 4 or clsTes.UserCost = 5 Then %>
  234.     <td align=center valign=top bgcolor ="<%= GridTotalDarkColor %>" width=8%>
  235.         <font color="<%= GridTotalTextColor %>">
  236.         <b>Total Cost</b>
  237.         </font>
  238.     </td>
  239. <%    End If %>
  240.  
  241. <%    If clsTes.UserCharge = 2 or clsTes.UserCharge = 4 or clsTes.UserCharge = 5 Then %>
  242.     <td align=center valign=top bgcolor ="<%= GridTotalDarkColor %>" width=8%>
  243.         <font color="<%= GridTotalTextColor %>">
  244.         <b>Total Charge</b>
  245.         </font>
  246.     </td>
  247. <%    End If %>
  248.  
  249. </tr>
  250.  
  251. <%    Dim lRowCount
  252.     Dim lRow
  253.     Dim nColumn
  254.  
  255.     lRowCount = clsTes.GenerateTimesheetGrid
  256.     If clsTes.ErrorNumber <> 0 Then
  257.         Response.Write (clsTes.ErrorText)
  258.         clsTes.ErrorClear
  259.     End If
  260.  
  261.     If lRowCount > 0 Then
  262.         For lRow = 1 To lRowCount %>
  263.         <tr>
  264.             <td align=left valign=bottom bgcolor="<%= CellTitleColor %>">
  265.                 <font color="<%= CellTitleTextColor %>" size=-1>
  266. <%                If tViewBy="Desc" Then %>
  267.                     <b><%= clsTes.GridValue(lRow,1) %></b>
  268. <%                Else %>
  269.                     <b><%= clsTes.GridValue(lRow,0) %></b>
  270. <%                End If %>
  271.                 </font>
  272.             </td>
  273.  
  274. <%            For nColumn = 2 To 8 %>
  275.  
  276.             <td align=right valign=bottom bgcolor="<%= CellColor %>">
  277. <%            If IsNull(clsTes.GridValue(lRow,0)) Then
  278.                 tCode = ""
  279.             Else
  280.                 tCode = CStr(clsTes.GridValue(lRow,0))
  281.             End If
  282.             If IsNull(clsTes.GridValue(lRow,1)) Then
  283.                 tDesc = ""
  284.             Else
  285.                 tDesc = CStr(clsTes.GridValue(lRow,1))
  286.             End If
  287.  
  288.             tAddNewURL = "tsedit.asp?Mode=Add&Code=" & Server.URLEncode(tCode) & "&Desc=" & Server.URLEncode(tDesc) & "&Date=" & (dDate + (nColumn - 2))
  289.             tDisplayURL = "detail.asp?Code=" & Server.URLEncode(tCode) & "&Desc=" & Server.URLEncode(tDesc) & "&Date=" & (dDate + (nColumn - 2))
  290.              If Not IsNull(clsTes.GridValue(lRow,nColumn)) Then %>
  291.                 <font size=-1>
  292.                 <a href="<%= tDisplayURL %>" target="DETAIL">
  293.                 <%= clsTes.GridValue(lRow, nColumn) %>
  294.                 </a>
  295.                 </font>
  296.                  
  297. <%                If clsTes.Maintain(lRow) Then %>
  298.                     <font size =-2>
  299.                     <a href="<%= tAddNewURL %>" target="_parent">
  300.                     +
  301.                     </a>
  302.                     </font>
  303. <%                End If
  304.             Else
  305.                 If clsTes.Maintain(lRow) Then %>
  306.                     <font size =-2>
  307.                     <a href="<%= tAddNewURL %>" target="_parent">
  308.                     +
  309.                     </a>
  310.                     </font>
  311. <%                End If %>
  312. <%            End If %>
  313.             </td>
  314. <%            Next
  315.  
  316.             nColumn = 9 %>
  317.  
  318.             <td align=right bgcolor="<%= GridTotalLightColor %>">
  319.             <font size=-1 color="<%= GridTotalTextColor %>">
  320.             <% If Not IsNull(clsTes.GridValue(lRow,nColumn)) Then %>
  321.                 <%= clsTes.GridValue(lRow,nColumn) %>
  322.             <% End If %>
  323.             </font>
  324.             </td>
  325.  
  326. <%        If clsTes.UserCost=2 or clsTes.UserCost=4 or clsTes.UserCost=5 Then
  327.  
  328.             nColumn = 10 %>
  329.             <td align=right bgcolor="<%= GridTotalLightColor %>">
  330.             <font size=-1 color="<%= GridTotalTextColor %>">
  331.             <% If Not IsNull(clsTes.GridValue(lRow,nColumn)) Then %>
  332.                 <%= clsTes.GridValue(lRow,nColumn) %>
  333.             <% End If %>
  334.             </font>
  335.             </td>
  336. <%        End If 
  337.  
  338.     If clsTes.UserCharge=2 or clsTes.UserCharge=4 or clsTes.UserCharge=5 Then
  339.  
  340.             nColumn = nColumn + 1 %>
  341.             <td align=right bgcolor="<%= GridTotalLightColor %>">
  342.             <font size=-1 color="<%= GridTotalTextColor %>">
  343.             <% If Not IsNull(clsTes.GridValue(lRow,nColumn)) Then %>
  344.                 <%= clsTes.GridValue(lRow,nColumn) %>
  345.             <% End If %>
  346.             </font>
  347.             </td>
  348. <%    End If %>
  349.         </tr>
  350.  
  351. <%    Next
  352.     lRow = lRowCount + 1 %>
  353.  
  354. <TR>
  355.     <TD BGCOLOR="<%= GridTotalDarkColor %>">
  356.     <FONT COLOR="<%= GridTotalTextColor %>">
  357.     <b>Total <%= clsTes.UnitTimeLabelP %></b>
  358.     </TD>
  359.  
  360. <%    For nColumn = 2 to 8 %>
  361.     <td bgcolor="<%= GridTotalLightColor %>" ALIGN=MIDDLE>
  362.         <FONT SIZE=-1 COLOR="<%= GridTotalTextColor %>">
  363. <%        If Not IsNull(clsTes.GridValue(lRow, nColumn)) Then %>
  364.             <%= clsTes.GridValue(lRow, nColumn) %>
  365. <%        Else %>
  366.              
  367. <%        End If %>
  368.         </FONT>
  369.     </td>
  370. <%    Next %>
  371.  
  372.     <td bgcolor="<%= GridTotalDarkColor %>" align=right>
  373.         <FONT COLOR="<%= GridTotalTextColor %>" SIZE=-1>
  374. <%        If Not IsNull(clsTes.GridValue(lRow,9)) Then %>
  375.             <B><%= clsTes.GridValue(lRow,9) %></B>
  376. <%        Else %>
  377.              
  378. <%        End If %>
  379.     </td>
  380.  
  381.  
  382.  
  383. <%    If clsTes.UserCost=2 or clsTes.UserCost=4 or clsTes.UserCost=5 Then %>
  384.             <td bgcolor="<%= GridTotalDarkColor %>"> </td>
  385. <%    End If %>
  386.  
  387. <%    If clsTes.UserCharge=2 or clsTes.UserCharge=4 or clsTes.UserCharge=5 Then %>
  388.             <td bgcolor="<%= GridTotalDarkColor %>"> </td>
  389. <%    End If %>
  390. </TR>
  391.  
  392.  
  393.  
  394.  
  395. <%    If clsTes.UserCost=2 or clsTes.UserCost=4 or clsTes.UserCost=5 Then
  396.         lRow = lRow + 1 %>
  397. <TR>
  398.     <TD BGCOLOR="<%= GridTotalDarkColor %>">
  399.     <FONT COLOR="<%= GridTotalTextColor %>">
  400.     <b>Total Cost</b>
  401.     </TD>
  402.  
  403. <%        For nColumn = 2 to 8 %>
  404.     <td bgcolor="<%= GridTotalLightColor %>" align=center>
  405.         <FONT SIZE=-1 COLOR="<%= GridTotalTextColor %>">
  406. <%        If Not IsNull(clsTes.GridValue(lRow, nColumn)) Then %>
  407.             <%= clsTes.GridValue(lRow, nColumn) %>
  408. <%        Else %>
  409.              
  410. <%        End If %>
  411.         </FONT>
  412.     </td>
  413. <%        Next %>
  414.  
  415.     <td bgcolor="<%= GridTotalDarkColor %>"> </td>
  416.  
  417.     <td bgcolor="<%= GridTotalDarkColor %>" align=right>
  418.         <FONT COLOR="<%= GridTotalTextColor %>" SIZE=-1>
  419. <%            If Not IsNull(clsTes.GridValue(lRow,10)) Then %>
  420.             <B><%= clsTes.GridValue(lRow,10) %></B>
  421. <%            Else %>
  422.                  
  423. <%            End If %>
  424.         </FONT>
  425.     </td>
  426.  
  427.     <%        If clsTes.UserCharge=2 or clsTes.UserCharge=4 or clsTes.UserCharge=5 Then %>
  428.             <td bgcolor="<%= GridTotalDarkColor %>"> </td>
  429.     <%        End If %>
  430. </TR>
  431. <%    End If %>
  432.  
  433.  
  434. <%    If clsTes.UserCharge=2 or clsTes.UserCharge=4 or clsTes.UserCharge=5 Then
  435.     lRow = lRow + 1 %>
  436. <TR>
  437.     <TD BGCOLOR="<%= GridTotalDarkColor %>">
  438.     <FONT COLOR="<%= GridTotalTextColor %>">
  439.     <b>Total Charge</b>
  440.     </TD>
  441.  
  442. <%        For nColumn = 2 to 8 %>
  443.         <td bgcolor="<%= GridTotalLightColor %>" align=center>
  444.         <FONT SIZE=-1 COLOR="<%= GridTotalTextColor %>">
  445. <%        If Not IsNull(clsTes.GridValue(lRow,nColumn)) Then %>
  446.             <%= clsTes.GridValue(lRow,nColumn) %>
  447. <%        Else %>
  448.              
  449. <%        End If %>
  450.         </FONT>
  451.         </td>
  452. <%    Next %>
  453.  
  454. <%    nColumn = 10 %>
  455.     <td bgcolor="<%= GridTotalDarkColor %>"> </td>
  456.  
  457. <%    If clsTes.UserCost=2 or clsTes.UserCost=4 or clsTes.UserCost=5 Then
  458.         nColumn = nColumn + 1 %>
  459.         <td bgcolor="<%= GridTotalDarkColor %>"> </td>
  460. <%    End If %>
  461.  
  462.     <td bgcolor="<%= GridTotalDarkColor %>" align=right>
  463.         <FONT COLOR="<%= GridTotalTextColor %>" SIZE=-1>
  464. <%        If Not IsNull(clsTes.GridValue(lRow,nColumn)) Then %>
  465.             <B><%= clsTes.GridValue(lRow,nColumn) %></B>
  466. <%        Else %>
  467.              
  468. <%        End If %>
  469.         </FONT>
  470.     </td>
  471.  
  472. </TR>
  473. <%    End If %>
  474. </table>
  475.  
  476. <%    End If %>
  477.  
  478.  
  479. <% Else %>
  480. Sorry, you do not have access to view timesheets.
  481. <% End If %>
  482. <% Set clsTes = Nothing %>
  483. </BODY>
  484. </HTML>
  485.