home *** CD-ROM | disk | FTP | other *** search
- <%@ LANGUAGE="VBSCRIPT" %>
- <% Set clsTes = Session("TES")
- If clsTes.LoggedIn = False Then
- Set clsTes = Nothing
- Response.Redirect("../loggedout.htm")
- End If
- On Error Resume Next
- tMode=Request("Mode")
- lKey=Request("Key")
- tCode=Request("Code")
- tDesc=Request("Desc")
-
- dDate=Request("Date")
-
- tNotGridBy=Request.Form("txtNotGBCode")
- tHours=Request.Form("txtHours")
- tCostCode=Request.Form("txtCostCode")
- tCostRateAmt=Request.Form("txtCostRateAmt")
- tChargeCode=Request.Form("txtChargeCode")
- tChargeRateAmt=Request.Form("txtChargeRateAmt")
- tNotes=Request.Form("txtNotes")
-
- bOvertime=CInt(Request.Form("chkOvertime"))
- nChargeable=CInt(Request.Form("optChargeable"))
- nCostable=CInt(Request.Form("optCostable"))
- bOverideCost=CInt(Request.Form("chkOverideCost"))
- bOverideCharge=CInt(Request.Form("chkOverideCharge"))
-
- If Err.Number <> 0 Then
- Err.Clear
- End If
-
- If Request.Form("btnCancel") = "Cancel" Then
- Response.Redirect("tsgrid.asp")
- End If
-
- If Request.Form("btnSave") <> "Save Timesheet" Then
- nErrors = 0
- bSave=False
- If tMode="Amend" Then
-
- clsTes.Timesheet.Key = Clng(lKey)
- clsTes.GetTimesheetValues
- If clsTes.GridBy = "Activity" Then
- tNotGridBy = clsTes.Timesheet.ProjectCode
- tCode = clsTes.Timesheet.ActivityCode
- Else
- tNotGridBy = clsTes.Timesheet.ActivityCode
- tCode = clsTes.Timesheet.ProjectCode
- End If
-
- dDate = clsTes.Timesheet.TimesheetDate
-
- tHours = clsTes.FormatNumber(clsTes.Timesheet.Hours)
- bOvertime = clsTes.Timesheet.Overtime
- tCostCode = clsTes.Timesheet.CostCode
- tChargeCode = clsTes.Timesheet.ChargeCode
- tCostRateAmt = clsTes.Timesheet.CostRate
- tChargeRateAmt = clsTes.Timesheet.ChargeRate
- tNotes = clsTes.Timesheet.Notes
-
- nCostable = -1
- nChargeable = CInt(clsTes.Timesheet.Chargeable)
- bOverideCost = True
- bOverideCharge = nChargeable
-
- Else
-
- 'Set up defaults
-
- If clsTes.GridBy = "Activity" Then
- tNotGridBy = clsTes.DefaultProject
- Else
- tNotGridBy = clsTes.DefaultActivity
- End If
-
- tCostCode = clsTes.DefaultCost
- tChargeCode = clsTes.DefaultCharge
-
- bOverideCost = False
- bOverideCharge = False
- nChargeable = 1
- nCostable = 1
-
- End If
-
- Else
-
- 'Save Mode
-
- bSave = True
- nErrors=0
- tErrorList = "<B>Errors</B>"
-
- If Len(tHours)=0 Then
- nErrors=1
- tErrorList=tErrorList & "<BR>Please enter the number of " & Server.HTMLEncode(clsTes.UnitTimeLabelP)
- Else
- If Not clsTes.IsNumeric(tHours) Then
- nErrors=1
- tErrorList=tErrorList & "<BR>Please enter a valid number of " & Server.HTMLEncode(clsTes.UnitTimeLabelP)
- End If
- End If
-
- If bOverideCost and nCostable = -1 Then
- If Len(tCostRateAmt)=0 Then
- nErrors=1
- tErrorList=tErrorList & "<BR>Please enter the Cost Rate Amount"
- Else
- If Not clsTes.IsNumeric(tCostRateAmt) Then
- nErrors=1
- tErrorList=tErrorList & "<BR>Please enter a valid Cost Rate Amount"
- End If
- End If
- End If
-
- If nChargeable=-1 and bOverideCharge Then
- If Len(tChargeRateAmt)=0 Then
- nErrors=1
- tErrorList=tErrorList & "<BR>Please enter the Charge Rate Amount"
- Else
- If Not clsTes.IsNumeric(tChargeRateAmt) Then
- nErrors=1
- tErrorList=tErrorList & "<BR>Please enter a valid Charge Rate Amount"
- End If
- End If
- End If
-
- If Len(tNotes) > 250 Then
- nErrors = 1
- tErrorList=tErrorList & "<BR>Notes must not be more than 250 characters (currently " & CStr(Len(tNotes)) & " characters)"
- End If
-
- If nErrors=0 Then
-
- If clsTes.GridBy = "Project" Then
- tProject = tCode
- tActivity = tNotGridBy
- Else
- tProject = tNotGridBy
- tActivity = tCode
- End If
-
- If tMode = "Add" Then
- clsTes.AddTimesheet clsTes.ADbl(dDate),CStr(tProject),CStr(tActivity), CStr(tNotes), clsTes.ADbl(tHours), CInt(bOvertime), CInt(nCostable), CInt(nChargeable), CStr(tCostCode), bOverideCost, tCostRateAmt, CStr(tChargeCode), bOverideCharge, tChargeRateAmt
- If clsTes.ErrorNumber <> 0 Then
- nErrors = 1
- tErrorList = tErrorList & "<BR>" & clsTes.ErrorText
- Else
- Response.Redirect("tsgrid.asp")
- End If
- ElseIf tMode = "Amend" Then
- clsTes.AmendTimesheet CLng(lKey), clsTes.ADbl(dDate),CStr(tProject),CStr(tActivity), CStr(tNotes), clsTes.ADbl(tHours), CInt(bOvertime), CInt(nCostable), CInt(nChargeable), CStr(tCostCode), bOverideCost, tCostRateAmt, CStr(tChargeCode), bOverideCharge, tChargeRateAmt
- If clsTes.ErrorNumber <> 0 Then
- nErrors = 1
- tErrorList = tErrorList & "<BR>" & Server.HTMLEncode(clsTes.ErrorText)
- Else
- Response.Redirect("tsgrid.asp")
- End If
- End If
-
- End If
-
- End If
- %>
- <!-- #INCLUDE FILE = "settings/colours.txt" -->
- <HTML>
- <HEAD>
- <META NAME="GENERATOR" Content="Microsoft Visual InterDev 1.0">
- <META HTTP-EQUIV="Content-Type" content="text/html; charset=iso-8859-1">
- <TITLE>Edit Timesheet</TITLE>
- </HEAD>
- <BODY BGCOLOR="<%= BackColor %>" LINK="<%= LinkColor %>" VLINK="<%= VLinkColor %>" ALINK="<%= ALinkColor %>" TEXT="<%= TextColor %>">
- <BASEFONT SIZE=2 COLOR="<%= TextColor %>">
-
- <FORM ACTION="tsedit.asp" METHOD=POST NAME="frmEdit">
- <INPUT TYPE=HIDDEN NAME="Mode" VALUE="<%= tMode %>">
- <INPUT TYPE=HIDDEN NAME="Key" VALUE="<%= lKey %>">
- <INPUT TYPE=HIDDEN NAME="Code" VALUE="<%= tCode %>">
- <INPUT TYPE=HIDDEN NAME="Desc" VALUE="<%= tDesc %>">
- <INPUT TYPE=HIDDEN NAME="Date" VALUE="<%= dDate %>">
-
- <% If clsTes.TimesheetMaintainAccess <> 0 Then %>
- <CENTER>
-
- <FONT SIZE=+2><B>
- <% If tMode="Add" Then
- Response.Write("Add Timesheet")
- Else
- Response.Write("Amend Timesheet")
- End If
- %>
- </B></FONT>
- <P>
-
- <% If tMode="Amend" and Len(Request("Key"))=0 Then %>
- ERROR : No Timesheet supplied to amend
- </FORM>
- <% Else
- If nErrors Then %>
- <%= tErrorList %>
- <BR><BR>
- <% End If %>
-
-
-
- <TABLE BORDER=0 CELLPADDING=5 CELLSPACING=2>
-
- <TR>
- <TD ALIGN=LEFT VALIGN=TOP>
- <B><%= Server.HTMLEncode(clsTes.ResourceLabel) %>:</B>
- </TD>
-
- <TD ALIGN=LEFT>
- <%= Server.HTMLEncode(clsTes.Resource) %>
- </TD>
- </TR>
-
- <TR>
- <TD ALIGN=LEFT VALIGN=TOP>
- <B>Date:</B>
- </TD>
-
- <TD ALIGN=LEFT VALIGN=TOP>
- <% Response.Write(clsTes.FormatLongDate(dDate)) %>
- </TD>
- </TR>
-
- <TR>
- <TD ALIGN=LEFT VALIGN=TOP>
- <B>
- <% If clsTes.GridBy = "Project" Then %>
- <%= Server.HTMLEncode(clsTes.ProjectLabel) %>:
- <% Else %>
- <%= Server.HTMLEncode(clsTes.ActivityLabel) %>:
- <% End If %>
- </B>
- </TD>
-
- <TD ALIGN=LEFT VALIGN=TOP>
- <% Response.Write(tCode)
- Response.Write(", ") %>
- <% If tMode = "Amend" Then %>
- <%= Server.HTMLEncode(clsTes.GetDescription(CStr(tCode), clsTes.GridBy)) %>
- <% Else %>
- <%= Server.HTMLEncode(tDesc) %>
- <% End If %>
- </TD>
- </TR>
-
- <TR>
- <TD ALIGN=LEFT>
- <B>
- <% If clsTes.GridBy ="Project" Then
- tTable = "Activity" %>
- <%= Server.HTMLEncode(clsTes.ActivityLabel) %>:
- <% Else
- tTable = "Projects" %>
- <%= Server.HTMLEncode(clsTes.ProjectLabel) %>:
- <% End If %>
- </B>
- </TD>
-
- <TD ALIGN=LEFT>
- <% clsTes.GenerateDropDownList CStr(tTable),1, CStr(tCode)
- If clsTes.ErrorNumber <> 0 Then
- Response.Write(Server.HTMLEncode(clsTes.ErrorText))
- clsTes.ErrorClear
- End If %>
- <SELECT SIZE=1 NAME="txtNotGBCode">
- <% If tMode = "Amend" Then
- If clsTes.GridBy = "Project" Then %>
- <%tCurrentNotGridBy = tNotGridBy & " | " & clsTes.GetDescription(Trim(tNotGridBy), "Activity") %>
- <OPTION VALUE="<%= tNotGridBy %>" SELECTED><%= tCurrentNotGridBy %></OPTION>
- <% Else %>
- <%tCurrentNotGridBy = tNotGridBy & " | " & clsTes.GetDescription(Trim(tNotGridBy), "Project") %>
- <OPTION VALUE="<%= tNotGridBy %>" SELECTED><%= tCurrentNotGridBy %></OPTION>
- <% End If %>
- <% End If %>
-
- <% If clsTes.UpperBoundRow > 0 Then
- For lRow = 1 To clsTes.UpperBoundRow %>
- <%If Not (tNotGridBy = clsTes.GridValue(lRow,0) and tMode = "Amend") Then%>
- <OPTION VALUE="<%= Server.HTMLEncode(clsTes.GridValue(lRow, 0)) %>" <% If tNotGridBy = clsTes.GridValue(lRow,0) and tMode <> "Amend" Then Response.Write("SELECTED") %>><%= clsTes.GridValue(lRow,1) %></OPTION>
- <%End IF%>
- <% Next
- End If %>
- </SELECT>
- </TD>
- </TR>
-
- <TR>
- <TD ALIGN=LEFT>
- <B>
- <%= Server.HTMLEncode(clsTes.UnitTimeLabelP) %>:
- </B>
- </TD>
- <TD ALIGN=LEFT>
- <INPUT TYPE=TEXT MAXLENGTH=20 NAME="txtHours" VALUE="<%= tHours %>" SIZE=20>
- </TD>
- </TR>
-
-
- <% If clsTes.UserOvertime Then %>
- <TR>
- <TD></TD>
- <TD ALIGN=LEFT VALIGN=TOP>
- <INPUT TYPE=CHECKBOX NAME="chkOvertime" VALUE=-1 <%If bOvertime Then Response.Write("CHECKED") %>>
- Overtime
- </TD>
- </TR>
- <% Else %>
- <INPUT TYPE=HIDDEN NAME="chkOvertime" VALUE=<%= bOvertime %>>
- <% End If %>
-
- <% If clsTes.UserCost <> 0 Then 'UT_COST_NONE %>
- <TR>
- <TD ALIGN=LEFT VALIGN=TOP>
- <B>
- Cost:
- </B>
- </TD>
-
- <TD ALIGN=LEFT VALIGN=TOP>
- <TABLE BORDER=1 CELLSPACING=0>
- <TR>
-
- <% If clsTes.UserCost = 1 or clsTes.UserCost = 2 Then 'UT_COST_VIEW_CODE or UT_COST_VIEW_CODE_AMT %>
- <TD COLSPAN=2>
- <%= Server.HTMLEncode(tCostCode) %>
- </TD>
- <INPUT TYPE=HIDDEN NAME="optCostable" VALUE=<%= nCostable %>>
- <% Else %>
- <TD COLSPAN=3>
- <INPUT TYPE=RADIO NAME="optCostable" VALUE=1 <% If nCostable=1 Then Response.Write("CHECKED") %>>
- Default
- </TD>
- </TR>
-
- <TR>
- <TD ROWSPAN=2>
- <INPUT TYPE=RADIO NAME="optCostable" VALUE=-1 <% If nCostable=-1 Then Response.Write("CHECKED") %>>
- Specify
- </TD>
-
- <TD COLSPAN=2>
-
- <% clsTes.GenerateDropDownList "Cost",1
- If clsTes.ErrorNumber <> 0 Then
- Response.Write(clsTes.ErrorText)
- clsTes.ErrorClear
- End If %>
- <SELECT SIZE=1 NAME="txtCostCode">
- <% If clsTes.UpperBoundRow > 0 Then
- For lRow = 1 To clsTes.UpperBoundRow %>
- <OPTION VALUE="<%= Server.HTMLEncode(clsTes.GridValue(lRow, 0)) %>" <% If StrComp(tCostCode,clsTes.GridValue(lRow,0))=0 Then Response.Write("SELECTED") %>><%= clsTes.GridValue(lRow,1) %></OPTION>
- <% Next
- End If %>
- </SELECT>
- </TD>
- <% End If%>
-
-
- <% If clsTes.UserCost = 4 Then 'US_COST_MAINTAIN_CODE_AMT %>
- <TR>
- <TD>
- <INPUT TYPE=CHECKBOX NAME="chkOverideCost" VALUE=-1 <% If bOverideCost=-1 Then Response.Write("CHECKED") %>>
- Override cost rate amount
- </TD>
-
- <TD>
- <INPUT TYPE=TEXT NAME="txtCostRateAmt" VALUE="<%= tCostRateAmt %>" SIZE=10 MAXLENGTH=20>
- </TD>
- </TR>
- <% Else %>
- <INPUT TYPE=HIDDEN NAME="chkOverideCost" VALUE=0>
- <% End If %>
- </TABLE>
- </TD>
-
- </TR>
- <% End If %>
-
-
-
- <% If clsTes.UserChargeableTimesheet = 2 Then 'UT_CHARGEABLE_TS_MAINTAIN %>
- <TR>
- <TD ALIGN=LEFT VALIGN=TOP>
- <B>
- Charge:
- </B>
- </TD>
-
- <TD>
- <TABLE BORDER=1 CELLSPACING=0>
- <TR>
- <TD NOWRAP=NOWRAP COLSPAN=3>
- <INPUT TYPE=RADIO NAME="optChargeable" VALUE=0 <% If nChargeable=0 Then Response.Write("CHECKED") %>>Non-Chargeable
- </TD>
- </TR>
- <TR>
- <TD NOWRAP=NOWRAP COLSPAN=3>
- <INPUT TYPE=RADIO NAME="optChargeable" VALUE=1 <% If nChargeable=1 Then Response.Write("CHECKED") %>>Default
- </TD>
- </TR>
- <% If clsTes.UserCharge > 2 Then %>
- <TR>
- <TD NOWRAP=NOWRAP ROWSPAN=2>
- <INPUT TYPE=RADIO NAME="optChargeable" VALUE=-1 <% If nChargeable=-1 Then Response.Write("CHECKED") %>>Chargeable
- </TD>
- <TD ALIGN=LEFT VALIGN=TOP COLSPAN=2>
- <% clsTes.GenerateDropDownList "Charge", 1
- If clsTes.ErrorNumber <> 0 Then
- Response.Write(clsTes.ErrorText)
- clsTes.ErrorClear
- End If %>
- <SELECT SIZE=1 NAME="txtChargeCode">
- <% If clsTes.UpperBoundRow > 0 Then
- For lRow = 1 To clsTes.UpperBoundRow %>
- <OPTION VALUE="<%= Server.HTMLEncode(clsTes.GridValue(lRow, 0)) %>" <% If tChargeCode = clsTes.GridValue(lRow,0) Then Response.Write("SELECTED") %>><%= clsTes.GridValue(lRow,1) %></OPTION>
- <% Next
- End If %>
- </SELECT>
- </TD>
- </TR>
- <% Else %>
- <TR>
- <TD NOWRAP=NOWRAP COLSPAN=3>
- <INPUT TYPE=RADIO NAME="optChargeable" VALUE=-1 <% If nChargeable=-1 Then Response.Write("CHECKED") %>>Chargeable
- </TD>
- </TR>
- <% End If %>
-
-
- <% If clsTes.UserCharge = 4 Then 'UT_MAINTAIN_CODE_AMT %>
- <TR>
- <TD>
- <INPUT TYPE=CHECKBOX NAME="chkOverideCharge" VALUE=-1 <% If bOverideCharge=-1 Then Response.Write("CHECKED") %>>
- Override charge rate amount
- </TD>
-
- <TD>
- <INPUT TYPE=TEXT NAME="txtChargeRateAmt" VALUE="<% Response.Write(tChargeRateAmt) %>" SIZE=10 MAXLENGTH=20>
- </TD>
- </TR>
- <% Else %>
- <INPUT TYPE=HIDDEN NAME="chkOverideCharge" VALUE=0>
- <% End If %>
- </TABLE>
- </TD>
- </TR>
- <% Else %>
- <INPUT TYPE=HIDDEN NAME="optChargeable" VALUE=<%= nChargeable %>>
- <INPUT TYPE=HIDDEN NAME="chkOverideCharge" VALUE=0>
- <% End If %>
-
- <% If clsTes.UserTimesheetNotes Then %>
- <TR>
- <TD VALIGN=TOP ALIGN=LEFT>
- <B>
- Notes:
- </B>
- </TD>
-
- <TD>
- <TEXTAREA COLS=50 ROWS=2 NAME="txtNotes"><%= Server.HTMLEncode(tNotes) %></TEXTAREA>
- </TD>
- </TR>
- <% Else %>
- <INPUT TYPE=HIDDEN NAME="txtNotes" VALUE="<%= tNotes %>">
- <% End If %>
-
- <TR>
- <TD COLSPAN=2 ALIGN=CENTER>
- <INPUT TYPE=SUBMIT NAME="btnSave" VALUE="Save Timesheet">
- <INPUT TYPE=SUBMIT NAME="btnCancel" VALUE="Cancel">
- </TD>
- </TR>
-
- </TABLE>
-
- <% End If %>
-
- <% Else %>
- Sorry, you do not have permission to maintain timesheets.
- <% End If %>
-
- <% Set clsTes = Nothing %>
- </BODY>
- </HTML>
-