coachdan32
Posts: 1 Joined: 12/30/2003 Status: offline
|
Trouble with dynamic table - 12/30/2003 11:55:15
I am having trouble with a table that is being done dynamically. It is a very odd problem. It works fine when using for 2002 and 2003, but when using for 2004 it does not. The table is basically a calendar that is dynamically drawn when the user chooses a year and month from dropdowns on a prior page. It is not a normal calendar, it uses the corporate year instead of calendar year. Our year is based on a 4-4-5 week rotation that repeats (Jan. - 4 weeks, Feb. - 4 weeks, Mar. - 5 weeks, and so on throughout the year). The odd thing is that the table works on the periods with 5 weeks in 2004, but not on the ones with 4 weeks. On the 4 week periods, it wants to cram all the dates in one row - instead of breaking to the next line after the seventh day. I will include code below: <%@language="vbscript"%>
<%
varBusName = Session("varRedirectBus")
varBusName = Session("varRedirectTo")
%>
<!--#include file="global.asa"-->
<!--#include file="include/Connect.asp"-->
<html>
<head>
<title>Trainer Attendance and Utilization Input Page</title>
</head>
<body background="WB00760_.gif">
<%
'select case request("RedirectTo")
select case Session("varRedirectTo")
case "MenuDefault02.asp"
varYear = "2002"
case "MenuDefault03.asp"
varYear = "2003"
case "MenuDefault04.asp"
varYear = "2004"
End select
%>
<form ACTION="TAUCALCP.asp?Yr=<%=varYrA%>" METHOD="POST">
<input type="hidden" name="MonMonth" value="<%=Request("Month")%>"><input type="hidden"
name="YrYear" value="<%=varYear%>"><hr>
<hr>
<p><font size="6">Trainer Attendance and Utilization Input Page</font></p>
<hr>
<hr>
<%
varMonth = Request.Form("Month")
varYear = varYrA
If (varMonth=" ") Then
Response.Write "<H2>ERRORS PLEASE CORRECT</H2>"
Response.Write "Please Enter: <H2>'MONTH'</H2> <BR><BR>"
Response.Write "Use your Back Button to correct field or: <BR><BR>"
Response.Write "<A HREF='TAUCAL.asp'>Click Here to Clear and Correct all fields</A>"
Response.End
End If
varYear = Right(varYear,2)
varMonYr = (varMonth & "/" & varYear)
'Pull data from DBase table for building tables on Form
'
SQLCal = " SELECT ZZCalendar.MonYr, ZZCalendar.DateSt, ZZCalendar.DaySt, "
SQLCal = SQLCal & " ZZCalendar.MonSt, ZZCalendar.PosSt, ZZCalendar.DateEnd, "
SQLCal = SQLCal & " ZZCalendar.DayEnd, ZZCalendar.PosEnd, ZZCalendar.DInM, "
SQLCal = SQLCal & " ZZCalendar.DInMDSt, ZZCalendar.WksInM, ZZCalendar.[445] "
SQLCal = SQLCal & " FROM ZZCalendar "
SQLCal = SQLCal & " WHERE ZZCalendar.MonYr LIKE '%"& varMonYr &"%'"' "
'
SQLCal = SQLCal & " ORDER BY ZZCalendar.DateSt ASC "
Set rsCal=Conn.Execute(SQLCal)
varDateSt = rsCal("DateSt")
varDaySt = rsCal("DaySt")
varMonSt = rsCal("MonSt")
varPosSt = rsCal("PosSt")
varDateEnd = rsCal("DateEnd")
varDayEnd = rsCal("DayEnd")
varPosEnd = rsCal("PosEnd")
varDInM = rsCal("DInM")
varDInMDSt = rsCal("DInMDSt")
varWksInM = rsCal("WksInM")
var445 = rsCal("445")
rsCal.Close
Set rsCal=nothing
'Header for Page Month and Year
'
varMonMonth = Month(varMonSt)
varYrYear = Year(varMonSt)
varMonthH = MonthName(varMonth)
varMonthDS = MonthName(Month(varDateSt))
varYearH = Year(varMonSt)
Response.Write ("<H3>For Month/Year: " & varMonthH & ", " & varYearH & "</H3>")
%>
<table cellSpacing="0" cellPadding="0" width="10%" align="left" border="1">
<tr>
<td noWrap bgcolor="#008080"><div align="center"><center><p><font
style="BACKGROUND-COLOR: #008080" color="white">Trainer Name</font></td>
</tr>
<tr align="center">
<td noWrap bgcolor="#808080" align="Center"><select NAME="TName" SIZE="1" id="TName"
tabindex="1">
<option Selected value=" "> </option>
<% Set rsTNPD=Conn.Execute(" SELECT DISTINCT Trainers.TName FROM Trainers ORDER BY TName ASC ")
MArTNPD = rsTNPD.GetRows()
rsTNPD.Close
Set rsTNPD=Nothing
For x = 0 to Ubound(MArTNPD,2)
%> <option VALUE="<%Response.Write MArTNPD(0,x)%>"><%Response.Write MArTNPD(0,x)%></option>
<% Next %> </select> </td>
</tr>
</table>
<div align="center"><center><p><br>
<br>
<br>
<br>
</p>
</center></div><div align="center"><center><h3>Attendance & Utilization Form</h3>
</center></div><div align="center"><center><table cellSpacing="1" cellPadding="1"
width="90%" align="center" border="1">
<tr>
<th noWrap bgcolor="#008080"><font Color="White">Sunday</font></th>
<th noWrap bgcolor="#008080"><font Color="White">Monday</font></th>
<th noWrap bgcolor="#008080"><font Color="White">Tuesday</font></th>
<th noWrap bgcolor="#008080"><font Color="White">Wednesday</font></th>
<th noWrap bgcolor="#008080"><font Color="White">Thursday</font></th>
<th noWrap bgcolor="#008080"><font Color="White">Friday</font></th>
<th noWrap bgcolor="#008080"><font Color="White">Saturday</font></th>
<th height="5"></th>
<%
tab = 2
wu = varDateSt
xu = (Month(varDateSt))
yu = (Day(varDateSt))
zu = var445
wu1 = varDInMDSt
xu1 = ((wu1 - yu)+1)
yu1 = varDInM
zu1 = varMonthDS
wu2 = varMonthH
xu2 = 1
'**************Row 1 build****************
'
if xu1 > 7 Then
xu1 = (xu1 - 7)
'R 1
Response.Write ("<TR>")
For x1 = 1 to 7
Response.Write ("<TD align='center' bgcolor='#008080'><Font Color=White>" & zu1 & _
" " & yu & "</Font></TD>")
yu = (yu + 1 )
Next
Response.Write ("</TR>")
'**************R 2*******************
Response.Write ("<tr>")
' make 7 columns
For y1 = 1 to 7
'insert a table def tag with alignment center and grey color
Response.Write ("<td align=""center"" bgcolor=""#808080"">")
' create a combobox for this column as well as a blank entry to start
Response.Write ("<select name=""UCodes"" size=""1"" id=""UCodes"" tabindex=""" & tab & """>")
Response.Write ("<option selected value="" ""> </option>")
'get the data to input into an array (i'll assume this works properly)
Set rsUCAbPD=Conn.Execute(" SELECT DISTINCT ZZAttdCode.AttdCodeAb FROM ZZAttdCode ORDER BY AttdCodeAb ASC ")
MArUCAbPD = rsUCAbPD.GetRows()
rsUCAbPD.Close
Set rsUCAbPD=Nothing
'for each item in the array, make it an option in the combobox
For x = 0 to Ubound(MArUCAbPD,2)
Response.Write ("<option value=""" & MArUCAbPD(0,x) & """>" & MArUCAbPD(0,x) & "</option>")
Next
Response.Write ("</select>")
Response.Write ("</td>")
tab = (tab + 1)
Next
Response.Write ("</tr>")
'************R 3********************
'
Response.Write ("<TR>")
For x1 = 1 to xu1
Response.Write ("<TD align='center' bgcolor='#008080'><Font Color=White>" & zu1 & _
" " & yu & "</Font></TD>")
yu = (yu + 1 )
Next
For x2 = 1 to (7 - xu1)
Response.Write ("<TD align='center' bgcolor='#008080'><Font Color=White>" & wu2 & _
" " & xu2 & "</Font></TD>")
xu2 = (xu2 + 1 )
Next
Response.Write ("</TR>")
'***************R 4********************
'
Response.Write ("<TR>")
For y1 = 1 to 7
Response.Write ("<TD align='center' bgcolor='#808080'>")
%>
<select NAME="UCodes" SIZE="1" id="UCodes" tabindex="<%=tab%>">
<option Selected value=" "> </option>
<%
Set rsUCAbPD=Conn.Execute(" SELECT DISTINCT ZZAttdCode.AttdCodeAb FROM ZZAttdCode ORDER BY AttdCodeAb ASC ")
MArUCAbPD = rsUCAbPD.GetRows()
rsUCAbPD.Close
Set rsUCAbPD=Nothing
For x = 0 to Ubound(MArUCAbPD,2)
%>
<option VALUE="<%Response.Write MArUCAbPD(0,x)%>"><%Response.Write MArUCAbPD(0,x)%></option>
<%
Next
%>
</select>
<%
tab = (tab + 1)
Next
Response.Write ("</TD></TR>")
Else if xu1 = 7 Then
'**************R 1***************
'
Response.Write ("<TR>")
For x1 = 1 to 7
Response.Write ("<TD align='center' bgcolor='#008080'><Font Color=White>" & zu1 & _
" " & yu & "</Font></TD>")
yu = (yu + 1 )
Next
Response.Write ("</TR>")
'************R 2********************
'
Response.Write ("<TR>")
For y1 = 1 to 7
Response.Write ("<TD align='center' bgcolor='#808080'>")
%>
<select NAME="UCodes" SIZE="1" id="UCodes" tabindex="<%=tab%>">
<option Selected value=" "> </option>
<%
Set rsUCAbPD=Conn.Execute(" SELECT DISTINCT ZZAttdCode.AttdCodeAb FROM ZZAttdCode ORDER BY AttdCodeAb ASC ")
MArUCAbPD = rsUCAbPD.GetRows()
rsUCAbPD.Close
Set rsUCAbPD=Nothing
For x = 0 to Ubound(MArUCAbPD,2)
%>
<option VALUE="<%Response.Write MArUCAbPD(0,x)%>"><%Response.Write MArUCAbPD(0,x)%></option>
<%
Next
%>
</select>
<%
tab = (tab + 1)
Next
Response.Write ("</TD></TR>")
'***************R 3***************
'
Response.Write ("<TR>")
For x2 = 1 to 7
Response.Write ("<TD align='center' bgcolor='#008080'><Font Color=White>" & wu2 & _
" " & xu2 & "</Font></TD>")
xu2 = (xu2 + 1)
Next
Response.Write ("</TR>")
'************R 4**************
'
Response.Write ("<TR>")
For y1 = 1 to 7
Response.Write ("<TD align='center' bgcolor='#808080'>")
%>
<select NAME="UCodes" SIZE="1" id="UCodes" tabindex="<%=tab%>">
<option Selected value=" "> </option>
<%
Set rsUCAbPD=Conn.Execute(" SELECT DISTINCT ZZAttdCode.AttdCodeAb FROM ZZAttdCode ORDER BY AttdCodeAb ASC ")
MArUCAbPD = rsUCAbPD.GetRows()
rsUCAbPD.Close
Set rsUCAbPD=Nothing
For x = 0 to Ubound(MArUCAbPD,2)
%>
<option VALUE="<%Response.Write MArUCAbPD(0,x)%>"><%Response.Write MArUCAbPD(0,x)%></option>
<%
Next
%>
</select>
<%
tab = (tab + 1)
Next
Response.Write ("</TD></TR>")
Else
'***************R 1******************
'
Response.Write ("<TR>")
For x1 = 1 to xu1
Response.Write ("<TD align='center' bgcolor='#008080'><Font Color=White>" & zu1 & _
" " & yu & "</Font></TD>")
yu = (yu + 1)
Next
For y1 = 1 to (7 - xu1)
Response.Write ("<TD align='center' bgcolor='#008080'><Font Color=White>" & wu2 & _
" " & xu2 & "</Font></TD>")
xu2 = (xu2 + 1)
Next
Response.Write ("</TR>")
'************R 2****************
'
Response.Write ("<TR>")
For y1 = 1 to 7
Response.Write ("<TD align='center' bgcolor='#808080'>")
%> <select NAME="UCodes" SIZE="1" id="UCodes" tabindex="<%=tab%>">
<option Selected value=" "> </option>
<% Set rsUCAbPD=Conn.Execute(" SELECT DISTINCT ZZAttdCode.AttdCodeAb FROM ZZAttdCode ORDER BY AttdCodeAb ASC ")
MArUCAbPD = rsUCAbPD.GetRows()
rsUCAbPD.Close
Set rsUCAbPD=Nothing
For x = 0 to Ubound(MArUCAbPD,2)
%> <option VALUE="<%Response.Write MArUCAbPD(0,x)%>"><%Response.Write MArUCAbPD(0,x)%></option>
<% Next %> </select> <%
tab = (tab + 1)
Next
Response.Write ("</TD></TR>")
'************R 3**************
'
Response.Write ("<TR>")
For x1 = 1 to 7
Response.Write ("<TD align='center' bgcolor='#008080'><Font Color=White>" & wu2 & _
" " & xu2 & "</Font></TD>")
xu2 = (xu2 + 1)
Next
Response.Write ("</TR>")
'**************R 4***************
'
Response.Write ("<TR>")
For y1 = 1 to 7
Response.Write ("<TD align='center' bgcolor='#808080'>")
%> <select NAME="UCodes" SIZE="1" id="UCodes" tabindex="<%=tab%>">
<option Selected value=" "> </option>
<% Set rsUCAbPD=Conn.Execute(" SELECT DISTINCT ZZAttdCode.AttdCodeAb FROM ZZAttdCode ORDER BY AttdCodeAb ASC ")
MArUCAbPD = rsUCAbPD.GetRows()
rsUCAbPD.Close
Set rsUCAbPD=Nothing
For x = 0 to Ubound(MArUCAbPD,2)
%> <option VALUE="<%Response.Write MArUCAbPD(0,x)%>"><%Response.Write MArUCAbPD(0,x)%></option>
<% Next %> </select> <%
tab = (tab + 1)
Next
Response.Write ("</TD></TR>")
End if
End if
'**************Row 5***************
'
Response.Write ("<TR>")
For x1 = 1 to 7
Response.Write ("<TD align='center' bgcolor='#008080'><Font Color=White>" & wu2 & _
" " & xu2 & "</Font></TD>")
xu2 = (xu2 + 1)
Next
Response.Write ("</TR>")
'***************Row 6***************
'
Response.Write ("<TR>")
For y1 = 1 to 7
Response.Write ("<TD align='center' bgcolor='#808080'>")
%>
<select NAME="UCodes" SIZE="1" id="UCodes" tabindex="<%=tab%>">
<option Selected value=" "> </option>
<%
Set rsUCAbPD=Conn.Execute(" SELECT DISTINCT ZZAttdCode.AttdCodeAb FROM ZZAttdCode ORDER BY AttdCodeAb ASC ")
MArUCAbPD = rsUCAbPD.GetRows()
rsUCAbPD.Close
Set rsUCAbPD=Nothing
For x = 0 to Ubound(MArUCAbPD,2)
%>
<option VALUE="<%Response.Write MArUCAbPD(0,x)%>"><%Response.Write MArUCAbPD(0,x)%></option>
<%
Next
%>
</select>
<%
tab = (tab + 1)
Next
Response.Write ("</TD></TR>")
'***************Row 7******************
'
Response.Write ("<TR>")
For x1 = 1 to 7
Response.Write ("<TD align='center' bgcolor='#008080'><Font Color=White>" & wu2 & _
" " & xu2 & "</Font></TD>")
xu2 = (xu2 + 1)
Next
Response.Write ("</TR>")
'***************Row 8******************
'
Response.Write ("<TR>")
For y1 = 1 to 7
Response.Write ("<TD align='center' bgcolor='#808080'>")
%>
<select NAME="UCodes" SIZE="1" id="UCodes" tabindex="<%=tab%>">
<option Selected value=" "> </option>
<%
Set rsUCAbPD=Conn.Execute(" SELECT DISTINCT ZZAttdCode.AttdCodeAb FROM ZZAttdCode ORDER BY AttdCodeAb ASC ")
MArUCAbPD = rsUCAbPD.GetRows()
rsUCAbPD.Close
Set rsUCAbPD=Nothing
For x = 0 to Ubound(MArUCAbPD,2)
%>
<option VALUE="<%Response.Write MArUCAbPD(0,x)%>"><%Response.Write MArUCAbPD(0,x)%></option>
<%
Next
%>
</select>
<%
tab = (tab + 1)
Next
Response.Write ("</TD></TR>")
if zu = 5 Then
'******************Row 9***************
'
Response.Write ("<TR>")
For x1 = 1 to 7
Response.Write ("<TD align='center' bgcolor='#008080'><Font Color=White>" & wu2 & _
" " & xu2 & "</Font></TD>")
xu2 = (xu2 + 1)
Next
Response.Write ("</TR>")
'***************Row 10******************
'
Response.Write ("<TR>")
For y1 = 1 to 7
Response.Write ("<TD align='center' bgcolor='#808080'>")
%>
<select NAME="UCodes" SIZE="1" id="UCodes" tabindex="<%=tab%>">
<option Selected value=" "> </option>
<%
Set rsUCAbPD=Conn.Execute(" SELECT DISTINCT ZZAttdCode.AttdCodeAb FROM ZZAttdCode ORDER BY AttdCodeAb ASC ")
MArUCAbPD = rsUCAbPD.GetRows()
rsUCAbPD.Close
Set rsUCAbPD=Nothing
For x = 0 to Ubound(MArUCAbPD,2)
%>
<option VALUE="<%Response.Write MArUCAbPD(0,x)%>"><%Response.Write MArUCAbPD(0,x)%></option>
<%
Next
%>
</select>
<%
tab = (tab + 1)
Next
Response.Write ("</TD></TR>")
End if
%>
</td>
</tr>
<tr>
<td align="left" bgcolor="#C0C0C0" colspan="2">Submit Data: <input id="submit1"
type="submit" value="Submit" name="submit1"> </td>
</tr>
<tr>
<td align="left" bgcolor="#C0C0C0" colspan="2">Reset Form: <input id="reset1"
type="reset" value="Reset" name="reset1"> </td>
</tr>
</table>
</center></div><div align="center"><center><table cellSpacing="1" cellPadding="1"
width="90%" align="center" border="1">
<tr>
<td><b><u>AD</u></b>-Adopt a Child<b><u>CB</u></b>-Out of the Unit on Company Business <b><u>CBT</u></b>-Out
of the Unit on Company Business,Trained Full Day <b><u>CBT.5</u></b>-Out of the Unit on
Company Business,Trained 1/2 Day <b><u>CBX.5</u></b>-Out of the Unit on Company
Business,Worked 1/2 Day <b><u>D</u></b>-Designated Day Off<b><u>F</u></b>-Funeral <b><u>FMLA</u></b>-Family
Medical Leave Act <b><u>H</u></b>-Legal Holiday <b><u>IG</u></b>-Paid Illness<b><u>IGT.5</u></b>-Trained
1/2 Day,Illness 1/2Day <b><u>IGX.5</u></b>-Worked 1/2 Day, Illness 1/2 Day, No Training <b><u>IW</u></b>-Inclement
Weather<b><u>J</u></b>-Jury Duty <b><u>NA</u></b>-Used Prior to Start Date or after Last
Day in Training to Complete Month <b><u>NCNS</u></b>-No Call, No Show <b><u>PH</u></b>-Personal
Holiday<b><u>STD</u></b>-ShortTerm Disability <b><u>Susp</u></b>-Suspended <b><u>T</u></b>-Trained
Full Day, Worked Full Day <b><u>T.5</u></b>-Trained 1/2 Day, Worked Full Day<b><u>UL</u></b>-Unpaid
LOA <b><u>V</u></b>-Vacation<b><u>V.5</u></b>-1/2 Day Vacation, No Training, No Work <b><u>VT.5</u></b>-1/2
Day Vacation,1/2 Day Training<b><u>WC</u></b>-Workers Comp <b><u>X</u></b>-Full Day
Worked, No Training<b><u>X.5</u></b>-Worked 1/2Day, No Training <b><u>XT.5</u></b>-Worked
1/2 Day,Trained 1/2 Day<b><u>XV.5</u></b>-1/2Day Vacation ,Worked 1/2Day, No Training </td>
</tr>
</table>
</center></div><div align="center"><center><p><br>
<br>
</p>
</center></div>
</form>
</body>
<%
Conn.Close
Set Conn=Nothing
%>
</html>
|