home *** CD-ROM | disk | FTP | other *** search
/ PC Plus SuperCD (UK) 2000 May / PCP163A.iso / full / atlantic / Software / Teweb / data1.cab / Pages / scripts / expense.asp < prev    next >
Encoding:
Text File  |  2000-02-14  |  11.5 KB  |  423 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.     tResource = Request("Resource")
  8.     dFromDate = Request("FromDate")
  9.     dToDate = Request("ToDate")
  10.  
  11.     If Len(dFromDate)=0 Then
  12.       dFromDate = clsTes.ADbl(clsTes.FromDate)
  13.     Else
  14.       clsTes.FromDate = clsTes.ADbl(dFromDate)
  15.     End If
  16.  
  17.     If Len(dToDate)=0 Then
  18.       dToDate = clsTes.ADbl(clsTes.ToDate)
  19.     Else
  20.       clsTes.ToDate = clsTes.ADbl(dToDate)
  21.     End If
  22.  
  23.     If Len(tResource) = 0 Then
  24.         tResource = clsTes.Resource
  25.     Else
  26.         If clsTes.ViewResource(tResource,2) Then
  27.             clsTes.Resource = tResource
  28.         Else
  29.             tResource = clsTes.Resource
  30.         End If
  31.     End If
  32. %>
  33. <!-- #INCLUDE FILE = "settings/colours.txt" -->
  34. <HTML>
  35. <HEAD>
  36. <META NAME="GENERATOR" Content="Microsoft Visual InterDev 1.0">
  37. <META HTTP-EQUIV="Content-Type" content="text/html; charset=iso-8859-1">
  38. <TITLE>Expense Table</TITLE>
  39. </HEAD>
  40. <BODY BGCOLOR="<%= BackColor %>" LINK="<%= LinkColor %>" VLINK="<%= VLinkColor %>" ALINK="<%= ALinkColor %>" TEXT="<%= TextColor %>">
  41. <BASEFONT SIZE=2 COLOR="<%= TextColor %>">
  42.  
  43. <% If clsTes.ExpenseViewAccess <> 2 Then    'US_NONE %>
  44. <FORM ACTION="expaction.asp" METHOD=POST>
  45.         
  46. <table border=0 Cellpadding=0 CellSpacing=0 width=100%>
  47. <tr>
  48.     <td><IMG border=0 src="..\images\space.gif"> </td>
  49. </tr>
  50. <tr>
  51.     <td align=left valign=top nowrap=nowrap>
  52.         <table width = 250 border=0 cellspacing=1 cellpadding=1>
  53.         <tr>
  54.             <td align=left width = 75>
  55.             <b><%= Server.HTMLEncode(clsTes.ResourceLabel) %>:</b>
  56.             </td>
  57.             <td align=left width = 175>
  58. <%            If clsTes.ExpenseViewAccess <> 3 and clsTes.ExpenseViewAccess <> 6 and clsTes.ExpenseViewAccess <> 7 Then        'US_OWN %>
  59.                 <a href="pickitem.asp?Type=Resource&<% Response.Write("ReturnURL=" & Server.URLEncode("expense.asp")) %>">
  60. <%            End If
  61.  
  62.             If len(tResource) > 0 Then
  63.                 Response.Write(Server.HTMLEncode(tResource))
  64.             Else %>
  65.                 Please Select
  66. <%            End If 
  67.             If clsTes.ExpenseViewAccess <> 3 and clsTes.ExpenseViewAccess <> 6 and clsTes.ExpenseViewAccess <> 7 Then        'US_OWN %>
  68.                 </a>
  69. <%            End If %>
  70.             </td>
  71.  
  72.         </tr>
  73.         </table>
  74.     </td>
  75.  
  76.     <td align=right valign=top>
  77. <%        tURL = "expense.asp?FromDate=" %>
  78.         <table border=0 cellspacing=1 cellpadding=1>
  79.         <tr>
  80.  
  81.             <td align=center NOWRAP=NOWRAP>
  82.                 <A HREF="calendar.asp?ReturnURL=<%= Server.URLEncode("expense.asp") %>&Name=FromDate&Date=<%= dFromDate %>">
  83.                 <b><% Response.Write(clsTes.FormatDate(dFromDate)) %></b> 
  84.                 </A>
  85.             </td>
  86.             <td align=center>    
  87.                 To
  88.             </td>
  89.             <td align=center NOWRAP=NOWRAP bgcolor="<%= SelectBackColor %>">
  90.                 <A HREF="calendar.asp?ReturnURL=<%= Server.URLEncode("expense.asp") %>&Name=ToDate&Date=<%= dToDate %>">
  91.                 <b><% Response.Write(clsTes.FormatDate(dToDate)) %></b>
  92.                 </A>
  93.             </td>
  94.             <td width=10></td>
  95.             <td align=center width=25>
  96.                 <a href=<% Response.Write(tURL & CStr(dFromDate - 28) & "&ToDate=" & CStr(dToDate - 28)) %>>
  97.                 <img border=0 align=center src="../images/bck4w.gif" ALT="Back 4 Weeks">
  98.                 </a>
  99.             </td>
  100.             <td align=center width=25>
  101.                 <a href=<% Response.Write(tURL & CStr(dFromDate - 7) & "&ToDate=" & CStr(dToDate - 7)) %>>
  102.                 <img border=0 align=center src="../images/bck1w.gif" ALT="Back 1 Week">
  103.                 </a>
  104.             </td>
  105.             <td align=center width=25>
  106.                 <a href=<% Response.Write(tURL & CStr(dFromDate + 7) & "&ToDate=" & CStr(dToDate + 7)) %>>
  107.                 <img border=0 align=center src="../images/fwd1w.gif" ALT="Forward 1 Week">
  108.                 </a>
  109.             </td>
  110.             <td align=center width=25>
  111.                 <a href=<% Response.Write(tURL & CStr(dFromDate + 28) & "&ToDate=" & CStr(dToDate + 28)) %>>
  112.                 <img border=0 align=center src="../images/fwd4w.gif" ALT="Forward 4 Weeks">
  113.                 </a>
  114.             </td>
  115.         </tr>
  116.         </table>
  117.     </td>
  118.     
  119. </tr>
  120. <tr>
  121.     <td><IMG border=0 src="..\images\space.gif"> </td>
  122. </tr>
  123. </table>
  124.  
  125. <table width=100% border=0 cellspacing=1 cellpadding=1>
  126. <tr>
  127.     <td align=left valign=top bgcolor="<%= CellTitleColor %>">
  128.         <font color = "<%= CellTitleTextColor %>">
  129.         <b>Date</b>
  130.         </font>
  131.     </td>
  132.     <td align=left valign=top bgcolor="<%= CellTitleColor %>">
  133.         <font color = "<%= CellTitleTextColor %>">
  134.         <b><%= Server.HTMLEncode(clsTes.ResourceLabel) %></b>
  135.         </font>
  136.     </td>
  137.     <td align=left valign=top bgcolor="<%= CellTitleColor %>">
  138.         <font color = "<%= CellTitleTextColor %>">
  139.         <b><%= Server.HTMLEncode(clsTes.ClientLabel) %></b>
  140.         </font>
  141.     </td>
  142.     <td align=left valign=top bgcolor="<%= CellTitleColor %>">
  143.         <font color = "<%= CellTitleTextColor %>">
  144.         <b><%= Server.HTMLEncode(clsTes.ProjectLabel) %></b>
  145.         </font>
  146.     </td>
  147.     <td align=left valign=top bgcolor="<%= CellTitleColor %>">
  148.         <font color = "<%= CellTitleTextColor %>">
  149.         <b>Expense Type</b>
  150.         </font>
  151.     </td>
  152.     <td align=center valign=top bgcolor="<%= CellTitleColor %>">
  153.         <font color = "<%= CellTitleTextColor %>">
  154.         <b>Units</b>
  155.         </font>
  156.     </td>
  157.     <td align=center valign=top bgcolor="<%= CellTitleColor %>">
  158.         <font color = "<%= CellTitleTextColor %>">
  159.         <b>Gross</b>
  160.         </font>
  161.     </td>
  162.  
  163. <%        If clsTes.UserChargeableExpense <> 0 Then %>
  164.     <td align=center valign=top bgcolor="<%= CellTitleColor %>">
  165.         <font color = "<%= CellTitleTextColor %>">
  166.         <b>Chargeable</b>
  167.         </font>
  168.     </td>
  169.     <td align=center valign=top bgcolor="<%= CellTitleColor %>">
  170.         <font color = "<%= CellTitleTextColor %>">
  171.         <b>Total Charge</b>
  172.         </font>
  173.     </td>
  174. <%        End If %>
  175.  
  176.  
  177. <%        If clsTes.UserApprovedExpense Then %>
  178.     <td align=center valign=top bgcolor="<%= CellTitleColor %>">
  179.         <font color = "<%= CellTitleTextColor %>">
  180.         <b>Approved</b>
  181.         </font>
  182.     </td>
  183. <%        End If %>
  184.  
  185. <%        If clsTes.UserInvoicedExpense Then %>
  186.     <td align=center valign=top bgcolor="<%= CellTitleColor %>">
  187.         <font color = "<%= CellTitleTextColor %>">
  188.         <b>Invoiced</b>
  189.         </font>
  190.     </td>
  191. <%        End If %>
  192.  
  193. <%        If clsTes.UserExpenseNotes Then %>
  194.     <td align=Left valign=top bgcolor="<%= CellTitleColor %>">
  195.         <font color = "<%= CellTitleTextColor %>">
  196.         <b>Notes</b>
  197.         </font>
  198.     </td>
  199. <%        End If %>
  200.  
  201. <%        If clsTes.ExpenseMaintainAccess <> 0 And  clsTes.ExpenseApproveAccess <> 0 Then %>
  202.     <td align=center valign=top bgcolor="<%= CellTitleColor %>">
  203.         <FONT color = "<%= CellTitleTextColor %>">
  204.         <b>Select</b>
  205.         </FONT>
  206.     </td>
  207. <%        End If %>
  208.  
  209.     <td align=left valign=top bgcolor="<%= CellTitleColor %>">
  210.          
  211.     </td>
  212. </tr>
  213.  
  214. <%    lMaintainCount = 0
  215.     lApproveCount = 0
  216.  
  217.     Dim lRowCount
  218.     Dim lRow
  219.     Dim nColumn
  220.  
  221.     lRowCount = clsTes.GenerateExpenseTable
  222.  
  223.     If clsTes.ErrorNumber <> 0 Then
  224.  
  225.         Response.Write (clsTes.ErrorText)
  226.  
  227.     Else
  228.  
  229.         If lRowCount > 0 then
  230.  
  231.         For lRow = 1 to lRowCount %>
  232.  
  233.         <tr>
  234.             <td align=left valign=middle bgcolor="<%= CellColor %>">
  235.                 <FONT SIZE=-1>
  236.                 <%= Server.HTMLEncode(clsTes.GridValue(lRow, 4)) %>
  237.                 </FONT>
  238.             </td>            
  239.             <td align=left valign=middle bgcolor="<%= CellColor %>">
  240.                 <FONT SIZE=-1>
  241.                 <%= Server.HTMLEncode(clsTes.gridValue(lRow, 5)) %>
  242.                 </FONT>
  243.             </td>
  244.             <td align=left valign=middle bgcolor="<%= CellColor %>">
  245.                 <FONT SIZE=-1>
  246.                 <%= Server.HTMLEncode(clsTes.GridValue(lRow, 6)) %>
  247.                 </FONT>
  248.             </td>
  249.             <td align=left valign=middle bgcolor="<%= CellColor %>">
  250.                 <FONT SIZE=-1>
  251.                 <%= Server.HTMLEncode(clsTes.GridValue(lRow, 7)) %>
  252.                 </FONT>
  253.             </td>
  254.             <td align=left valign=middle bgcolor="<%= CellColor %>">
  255.                 <FONT SIZE=-1>
  256.                 <%= Server.HTMLEncode(clsTes.GridValue(lRow, 8)) %>
  257.                 </FONT>
  258.             </td>
  259.             <td align=right valign=middle bgcolor="<%= CellColor %>">
  260.                 <FONT SIZE=-1>
  261.                 <% If Not IsNull(clsTes.GridValue(lRow,9)) Then %>
  262.                     <%= CStr(clsTes.GridValue(lRow, 9)) %>
  263.                 <% Else %>
  264.                      
  265.                 <% End If %>
  266.                 </FONT>
  267.             </td>
  268.  
  269.             <td align=right valign=middle bgcolor="<%= CellColor %>">
  270.                 <FONT SIZE=-1>
  271.                 <%= CStr(clsTes.GridValue(lRow, 10)) %>
  272.                 </FONT>
  273.             </td>
  274.  
  275.             <% nColumn = 11 %>
  276.  
  277.  
  278. <%        If clsTes.UserChargeableExpense <> 0 Then %>
  279.             <td align=center valign=middle bgcolor="<%= CellColor %>">
  280.                 <FONT SIZE=-1>
  281.                 <%= Server.HTMLEncode(clsTes.GridValue(lRow, 11)) %>
  282.                 </FONT>
  283.             </td>
  284.             <td align=right valign=middle bgcolor="<%= CellColor %>">
  285.                 <FONT SIZE=-1>
  286.                 <%= CStr(clsTes.GridValue(lRow, 12)) %>
  287.                 <% nColumn = 13 %>
  288.                 </FONT>
  289.             </td>
  290. <%        End If %>
  291.  
  292.  
  293.  
  294. <%        If clsTes.UserApprovedExpense Then %>
  295.             <td align=center valign=middle bgcolor="<%= CellColor %>">
  296.                 <FONT SIZE=-1>
  297. <%                If Not IsNull(clsTes.GridValue(lRow, nColumn)) Then %>
  298.                     <%= Server.HTMLEncode(clsTes.GridValue(lRow,nColumn)) %>
  299. <%                Else %>
  300.                      
  301. <%                End If %>
  302.                 </FONT>
  303.                 <% nColumn = nColumn + 1 %>
  304.             </td>
  305. <%        End If %>
  306.  
  307.  
  308.  
  309. <%        If clsTes.UserInvoicedExpense Then %>
  310.             <td align=center valign=middle bgcolor="<%= CellColor %>">
  311.                 <FONT SIZE=-1>
  312.                 <%= Server.HTMLEncode(clsTes.GridValue(lRow, nColumn)) %>
  313.                 <% nColumn = nColumn + 1 %>
  314.                 </FONT>
  315.             </td>
  316. <%        End If %>
  317.  
  318. <%        If clsTes.UserExpenseNotes Then %>
  319.             <td align=left valign=middle bgcolor="<%= CellColor %>">
  320.                 <FONT SIZE=-1>
  321. <%                If Not IsNull(clsTes.GridValue(lRow, nColumn)) Then %>
  322.                     <%= Server.HTMLEncode(clsTes.GridValue(lRow,nColumn)) %>
  323. <%                Else %>
  324.                      
  325. <%                End If %>
  326.                 <% nColumn = nColumn + 1 %>
  327.                 </FONT>
  328.             </td>
  329. <%        End If %>
  330.  
  331.  
  332. <%        If clsTes.ExpenseMaintainAccess <> 0 or clsTes.ExpenseApproveAccess <> 0 Then %>
  333. <%            If clsTes.Maintain(lRow) or clsTes.Approve(lRow) Then %>
  334.             <td align=center valign=middle bgcolor="<% = CellColor %>">
  335.                 <INPUT TYPE=CHECKBOX NAME="chkSelect" VALUE="<%= clsTes.GridValue(lRow,0) %>">
  336. <%                 If clsTes.Approve(lRow) Then
  337.                     lApproveCount = lApproveCount + 1
  338.                 End If %>
  339.             </td>
  340. <%            Else %>
  341.             <td align=center valign=middle bgcolor="<%= CellColor %>">
  342.                  
  343.             </td>
  344. <%            End If %>
  345. <%        End If %>
  346.  
  347.             <td align=center valign=middle bgcolor="<%= CellColor %>">
  348. <%        If clsTes.Maintain(lRow) Then %>
  349.                 <a href="expedit.asp?Mode=Amend&Key=<%= clsTes.GridValue(lRow,0) %>&ReturnURL=<%= Server.URLEncode("expense.asp") %>"><IMG BORDER=0 align=center SRC="../images/amend.gif" ALT="Amend Expense"></a>
  350. <%                lMaintainCount = lMaintainCount + 1 %>
  351. <%        Else %>
  352.                 <a href="expview.asp?Key=<%= clsTes.GridValue(lRow,0) %>&ReturnURL=<%= Server.URLEncode("expense.asp") %>"><IMG BORDER=0 align=center SRC="../images/view.gif" ALT="View Expense"></a>
  353. <%        End If %>
  354.             </td>
  355.  
  356.         </tr>
  357.  
  358. <%        Next
  359.         End If
  360.  
  361.     End If %>
  362.  
  363.  
  364.  
  365. </table>
  366.  
  367. <BR>
  368. <table border=0 align=right>
  369. <TR>
  370. <%    If lApproveCount > 0  and clsTes.ExpenseApproveAccess <> 0 Then    %>
  371.     <TD align=center>
  372.         <INPUT TYPE=SUBMIT NAME="btnSubmit" VALUE="Approve">
  373.     </TD>
  374. <%    End If %>
  375. <%    If Len(clsTes.Resource) > 0 and clsTes.ExpenseMaintainAccess <> 0 and clsTes.MaintainResource(tResource, 2) Then %>
  376.     <TD align=center>
  377.         <INPUT TYPE=SUBMIT NAME="btnSubmit" VALUE="Add">
  378.     </TD>
  379. <%    End If %>
  380. <%    If lMaintainCount > 0 and clsTes.ExpenseMaintainAccess <> 0 and clsTes.MaintainResource(tResource, 2) Then %>
  381.     <TD align=center>
  382.         <INPUT TYPE=SUBMIT NAME="btnSubmit" VALUE="Delete">
  383.     </TD>
  384. <%    End If %>
  385. </TR>
  386. </TABLE>
  387.  
  388. <TABLE BORDER=0 ALIGN=LEFT CELLSPACING=2 CELLPADDING=5>
  389. <TR>
  390.     <TD ALIGN=LEFT>
  391.         <FONT SIZE=-1>
  392.         <B>Total Cost</B>
  393.         </FONT>
  394.     </TD>
  395.     <TD ALIGN=LEFT>
  396.         <FONT SIZE=-1>
  397.         <%= clsTes.GridTotalCost %>
  398.         </FONT>
  399.     </TD>
  400.  
  401. <%    If clsTes.UserChargeableExpense <> 0 Then    'US_NONE %>
  402.     <TD WIDTH=10></TD>
  403.     <TD ALIGN=LEFT>
  404.         <FONT SIZE=-1>
  405.         <B>Total Charge</B>
  406.         </FONT>
  407.     </TD>
  408.     <TD ALIGN=LEFT>
  409.         <FONT SIZE=-1>
  410.         <%= clsTes.GridTotalCharge %>
  411.         </FONT>
  412.     </TD>
  413. <% End If %>
  414. </TR>
  415. </TABLE>
  416. </FORM>
  417. <%    Else %>
  418. Sorry, you do not have access to view expenses.
  419. <%    End If %>
  420. <% Set clsTes = Nothing %>
  421. </BODY>
  422. </HTML>
  423.