Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calculating Row and Column Rows - not calculating

Status
Not open for further replies.

Ken011

MIS
Oct 13, 2006
66
US
Good day Geniuses.

I have several tables but of relevance here are 2 tables namely: ActivityTypes and, CaseTypes.

The ActivityTypes table contains data related to:

Bal. From Prev. Month

(+)New Filings, and all the items on the left hand side of the form shown in the link below:


Then there are caseTypes that comprise: PLA, CASE, SILICA, CIVIL and DOMESTIC.

Finally, there are Row totals and Column Totals.


What I am trying to accomplish is 3 fold:

Given an ActivityType, like Bal. From Prev Month, for instance, fill the PLA, CASE, SILICA, CIVIL and DOMESTIC with values associated with it.

Same goes with the rest of those ActivityTypes (items on left of form).

So far, my code is not populating any of those boxes.

I have spent 5 days on this and can't seem to figure out anything.

Please, please help as I am stumped on this.

Here is my entire code and please forgive me for dumping all of these codes.


Code:
<%
Set objConn = Server.CreateObject("ADODB.Connection")
objConn.Open "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist
Security Info=False;Initial Catalog=COURT;Data Source=Prompter"

judgeid = Trim( Request("judge") )
dataMonth = Trim(Request("dataMonth") )
dataYear = Trim( Request("dataYear") )

If judgeid = "" OR dataMonth = "" OR dataYear = "" Then
     Response.Redirect "ChooseJudgeAndReportMonth.asp" ' back to prior page!
End If

sql = "SELECT jm_id FROM EntryForJudgeByMonth " & _
     " WHERE judge_id = " & judgeid & _
     " AND forYear = " & Request("dataYear") & _
     " AND forMonth = " & Request("dataMonth")
Set rs = objConn.Execute(sql)

If rs.EOF Then
     ' no match for that judge/year/month, so create one!
     SQL = "INSERT INTO EntryForJudgeByMonth (judge_id, ForYear,
ForMonth ) " & _
           "VALUES(" & judgeid & "," & dataYear & "," & dataMonth & ")"
     ' should also insert person doing the reporting and current time
     objConn.Execute SQL
     Set idrs = conn.Execute("SELECT @@IDENTITY")
     jmid = idrs(0)
     idrs.Close
Else
     ' we already have a record for this jm_id!
     jmid = RS("jm_id")
     'response.write jmid
     'response.end
End If

'Get the existing data!
' now we *USE* the jm_id we got from insert
SQL = "SELECT activityType, caseType, [count] " _
    & " FROM CaseActivity WHERE jm_id = " & jmid _
& " ORDER BY activityType,caseType "
     Set eachRowRS = objConn.Execute(SQL)
 %>

<link href="css/spstyles.css" rel="stylesheet" type="text/css" />
<title>Monthly Case Activity Report </title>
</head>

<a name='topofwebtrendsreport'>
<body bgcolor="FFFFFF" BACKGROUND="img/fcweb_bg.jpg">
<script type="text/javascript">
<!--
function submit_login(e)
{
    if (typeof e != 'undefined' && !enter_key_trap(e)) {
        return;
    }

    if (document.spform.spjudge.value == "") {
        alert("Please provide jugde's name");
        document.spform.spjudge.focus();
        return false;
    } else if (document.spform.cmanager.value == "") {
        alert("Please provide case manager's name");
        document.spform.cmanager.focus();
        return false;
    } else {
        document.spform.loginButton.disabled = true;
         document.spform.submit();
        return true;
   }
}

  }-->
 </script>
 <script language="JavaScript" src="SCRIPTS/printer.js"></script>
<font face="arial,helvetica,verdana,lucida,utopia" COLOR="000000">
<div id="printFriendly"> <!--Printer friendly page begins -->
<center>
<table cellpadding='1' border='0' cellspacing='0' width='100%'><tr><td>
<table cellpadding='3' border='0' cellspacing='0' width='100%'>
<tr BGCOLOR="003399">
<td align='left' width="100%">
<font size='2' face="arial,helvetica,verdana,lucida,utopia" color="FFFFFF">
&nbsp;<b>Monthly Case Activity Report</b>
</font></td>
<td height='24' align='right' nowrap>
<font size='2' face="arial,helvetica,verdana,lucida,utopia"
color="FFFFFF"><b>Superior Court</b></font></td>
<td height='24' align='right'><a
href='#helpcardgeneralstatschapter1'><img
src='img/depts_cjis_gen-01.jpg' alt='' border=0 width="28"
height="30"></a></td></tr>
</table>
</td></tr></table>
</center>
<br><br>
<form name="spform" method="post" action="processcivilrecs.asp">
<input type="hidden" name="jmid" value="<%=jmid%>">
<table cellpadding=2 align="center" cellspacing=0 border=0 width="100%">
     <tr>
           <td nowrap bordercolor="#336699"><font color="#000000"
size="2" face="Verdana, Arial, Helvetica,
sans-serif">Month/Year:</font></td>
            <td nowrap bordercolor="#336699"><div align="left"><font
color="#0099CC" size="2" face="Verdana, Arial, Helvetica, sans-serif">
                    <select name="fmonth" class = textbox id="fmonth" >
                      <option value="1" <% if session("Smonth") = 1
then %>selected<% elseif session("smonth") = "" and month(now) = 1
then %>selected<% end if %>>January</option>
                      <option value="2" <% if session("Smonth") = 2
then %>selected<% elseif session("smonth") = "" and month(now) = 2
then %>selected<% end if %>>February</option>
                      <option value="3" <% if session("Smonth") = 3
then %>selected<% elseif session("smonth") = "" and month(now) = 3
then %>selected<% end if %>>March</option>
                      <option value="4" <% if session("Smonth") = 4
then %>selected<% elseif session("smonth") = "" and month(now) = 4
then %>selected<% end if %>>April</option>
                      <option value="5" <% if session("Smonth") = 5
then %>selected<% elseif session("smonth") = "" and month(now) = 5
then %>selected<% end if %>>May</option>
                      <option value="6" <% if session("Smonth") = 6
then %>selected<% elseif session("smonth") = "" and month(now) = 6
then %>selected<% end if %>>June</option>
                      <option value="7" <% if session("Smonth") = 7
then %>selected<% elseif session("smonth") = "" and month(now) = 7
then %>selected<% end if %>>July</option>
                      <option value="8" <% if session("Smonth") = 8
then %>selected<% elseif session("smonth") = "" and month(now) = 8
then %>selected<% end if %>>August</option>
                      <option value="9" <% if session("Smonth") = 9
then %>selected<% elseif session("smonth") = "" and month(now) = 9
then %>selected<% end if %>>September</option>
                      <option value="10" <% if session("Smonth") = 10
then %>selected<% elseif session("smonth") = "" and month(now) = 10
then %>selected<% end if %>>October</option>
                      <option value="11" <% if session("Smonth") = 11
then %>selected<% elseif session("smonth") = "" and month(now) = 11
then %>selected<% end if %>>November</option>
                      <option value="12" <% if session("Smonth") = 12
then %>selected<% elseif session("smonth") = "" and month(now) = 12
then %>selected<% end if %>>December</option>
                    </select>
                    <select name="fyear" class = textbox id="fyear">
                     <%
    for i = 2003 to 2020
  %>
                      <option value = "<%=i%>" <% if
cint(session("Syear")) = i then %>selected<% elseif session("syear") =
"" and year(now) = i then %>selected<% end if %>>
                      <%=i%>
                      </option>
                      <% next %>
                    </select>
                    </font></div>
                 </td>
                 </tr>
                 <tr><td>&nbsp;</td></tr>
                 <tr>
                 <td nowrap width="86" align="right">Judge:</td><td
align="left"><input type="text" name="spjudge" value=""></td><td
nowrap align="right">Case Manager:</td><td align="left"
width="256"><input type="text" name="cmanager" value=""></td>
              </tr>
  </table>
  <br>
  <!-- ----------------- Table: Civil_Case_Assessment  ------------- -->

<P ALIGN="CENTER">
<table cellpadding=2 cellspacing=0 border=0 width="95%">
<tr BGCOLOR="ffffff">
  <td align=left><font size=2
face="arial,helvetica,verdana,lucida,utopia" color=""><b>A: Case
Assignment</b></font></td>
  <td align=right></font></td>
</tr>
</table>
<table width="95%" align="center" cellpadding="0" cellspacing="0" border="0">
<tr>
  <td width="95%">
   <TABLE BORDER=0 BGCOLOR='#000000' CELLSPACING=0 CELLPADDING=0 WIDTH='95%'>
    <TR>
     <TD>
      <TABLE BORDER=0 CELLSPACING=1 CELLPADDING=2 WIDTH='100%'>
       <TR BGCOLOR="ffffff">
        <TD COLSPAN=3><FONT SIZE=2
FACE="arial,helvetica,verdana,lucida,utopia" COLOR="ffffff">
         <B>
         <TABLE BORDER="1" bgcolor="#ffffff" width="100%" class="myTable">
     <TR>
  <TH rowspan="2" width="30%">&nbsp;</TH><TH COLSPAN=2
align=center>Asbestos</TH><TH COLSPAN=1>&nbsp;</TH><TH
ROWSPAN=1>&nbsp;</TH><TH valign="bottom" ROWSPAN="2"
width="12%">DOMESTIC</TH><TH valign="bottom" ROWSPAN="2"
width="12%">TOTAL</TH>
 </TR>
     <TR>
      <TH width="12%">PLA</TH>
      <TH width="12%">CASE</TH>
      <TH width="12%">SILICA</TH>
      <TH width="12%">CIVIL</TH>
     </TR>
     <TR>
      <TD nowrap align="left"><font size="2">Bal. From Prev.
Month</font></TD>
      <%
  activity = 0
  For casetype = 1 TO 5
      data = 0
      If Not eachRowRS.eof Then
           If eachRowRS("activityType") = activity AND
eachRowRS("caseType") = casetype Then
               data = eachRowRS("count")
               eachRowRS.MoveNext
           End If
      End If
  %>
           <TD><input size="5"
name="count_<%=activity%>_<%=casetype%>" value="<%=data%>"></TD>
          <%
      Next
      %>
           <TD><input size=5 name="total_<%=activity%>" READONLY></TD>
     </TR>
     <TR>
      <TD nowrap align="left"><font size="2">(+)New Filings</font></TD>
      <%
  activity = 0
  For casetype = 1 TO 5
      data = ""
      If Not eachRowRS.eof Then
           If eachRowRS("activityType") = activity AND
eachRowRS("caseType") = casetype Then
               data = eachRowRS("count")
               eachRowRS.MoveNext
           End If
      End If
  %>
           <TD><input size="5"
name="count_<%=activity%>_<%=casetype%>" value="<%=data%>"></TD>
          <%
      Next
      %>
           <TD><input size=5 name="total_<%=activity%>" READONLY></TD>
     </TR>

     <TR>
      <TD nowrap align="left"><font size="2">(+)Transfers
Received</font></TD>
      <%
  activity = 0
  For casetype = 1 TO 5
      data = ""
      If Not eachRowRS.eof Then
           If eachRowRS("activityType") = activity AND
eachRowRS("caseType") = casetype Then
               data = eachRowRS("count")
               eachRowRS.MoveNext
           End If
      End If
  %>
           <TD><input size="5"
name="count_<%=activity%>_<%=casetype%>" value="<%=data%>"></TD>
          <%
      Next
      %>
           <TD><input size=5 name="total_<%=activity%>" READONLY></TD>
     </TR>
     <TR>
      <TD nowrap align="left"><font size="2">(+)Reopened Cases</font></TD>
      <%
  activity = 0
  For casetype = 1 TO 5
      data = ""
      If Not eachRowRS.eof Then
           If eachRowRS("activityType") = activity AND
eachRowRS("caseType") = casetype Then
               data = eachRowRS("count")
               eachRowRS.MoveNext
           End If
      End If
  %>
           <TD><input size="5"
name="count_<%=activity%>_<%=casetype%>" value="<%=data%>"></TD>
          <%
      Next
      %>
           <TD><input size=5 name="total_<%=activity%>" READONLY></TD>
     </TR>
     <TR>
      <TD nowrap align="left"><font size="2">Beginning Balance</font></TD>
      <%
  activity = 0
  For casetype = 1 TO 5
      data = ""
      If Not eachRowRS.eof Then
           If eachRowRS("activityType") = activity AND
eachRowRS("caseType") = casetype Then
               data = eachRowRS("count")
               eachRowRS.MoveNext
           End If
      End If
  %>
           <TD><input size="5"
name="count_<%=activity%>_<%=casetype%>" value="<%=data%>"></TD>
          <%
      Next
      %>
           <TD><input size=5 name="total_<%=activity%>" READONLY></TD>
          </TR>
       </TABLE>
       </td>
      <tr>
     </table>
    </td>
    </tr>
   </table>
   </td>
  </tr>
 </table>
   <!-- ----------------- Table: Civil_Case_Dispositions  ------------- -->

<P ALIGN="CENTER">
<table cellpadding=2 cellspacing=0 border=0 width="95%">
<tr  BGCOLOR="ffffff">
<td align=left><font size=2
face="arial,helvetica,verdana,lucida,utopia" color=""><b>B: Case
Dispositions</b></font></td>
<td align=right></font></td>
</tr>
</table>

<table width="95%" align="center" cellpadding="0" cellspacing="0" border="0">
<tr>
  <td width="95%">
   <TABLE BORDER=0 BGCOLOR='#000000' CELLSPACING=0 CELLPADDING=0 WIDTH='95%'>
    <TR>
     <TD>
      <TABLE BORDER=0 CELLSPACING=1 CELLPADDING=2 WIDTH='100%'>
       <TR BGCOLOR="ffffff">
        <TD COLSPAN=3><FONT SIZE=2
FACE="arial,helvetica,verdana,lucida,utopia" COLOR="ffffff">
         <B>
         <TABLE BORDER="1" bgcolor="#ffffff" width="100%" class="myTable">
     <TR>
  <TH rowspan="2" width="30%">&nbsp;</TH><TH COLSPAN=2
align=center>Asbestos</TH><TH COLSPAN=1>&nbsp;</TH><TH
ROWSPAN=1>&nbsp;</TH><TH valign="bottom" ROWSPAN="2"
width="12%">DOMESTIC</TH><TH valign="bottom" ROWSPAN="2"
width="12%">TOTAL</TH>
     </TR>
     <TR>
      <TH width="12%">PLA</TH>
      <TH width="12%">CASE</TH>
      <TH width="12%">SILICA</TH>
      <TH width="12%">CIVIL</TH>
     </TR>
     <TR>
      <TD nowrap align="left"><font size="2">DISM W/OR W/O PREJ</font></TD>
      <%
  activity = 0
  For casetype = 1 TO 5
      data = ""
      If Not eachRowRS.eof Then
           If eachRowRS("activityType") = activity AND
eachRowRS("caseType") = casetype Then
               data = eachRowRS("count")
               eachRowRS.MoveNext
           End If
      End If
  %>
      <TD><input size="5" name="count_<%=activity%>_<%=casetype%>"
value="<%=data%>"></TD>
            <%
            Next
            %>
           <TD><input size=5 name="total_<%=activity%>" READONLY></TD>
     </TR>
     <TR>
      <TD nowrap align="left"><font size="2">Final
Order/Decree/Judgement</font></TD>
      <%
  activity = 0
  For casetype = 1 TO 5
      data = ""
      If Not eachRowRS.eof Then
           If eachRowRS("activityType") = activity AND
eachRowRS("caseType") = casetype Then
               data = eachRowRS("count")
               eachRowRS.MoveNext
           End If
      End If
  %>
      <TD><input size="5" name="count_<%=activity%>_<%=casetype%>"
value="<%=data%>"></TD>
            <%
            Next
            %>
           <TD><input size=5 name="total_<%=activity%>" READONLY></TD>
           </TR>
     <TR>
      <TD nowrap align="left"><font size="2">Bench Trial</font></TD>
      <%
  activity = 0
  For casetype = 1 TO 5
      data = ""
      If Not eachRowRS.eof Then
           If eachRowRS("activityType") = activity AND
eachRowRS("caseType") = casetype Then
               data = eachRowRS("count")
               eachRowRS.MoveNext
           End If
      End If
  %>
      <TD><input size="5" name="count_<%=activity%>_<%=casetype%>"
value="<%=data%>"></TD>
            <%
            Next
            %>
           <TD><input size=5 name="total_<%=activity%>" READONLY></TD>
           </TR>
     <TR>
      <TD nowrap align="left"><font size="2">Jury Trial</font></TD>
      <%
  activity = 0
  For casetype = 1 TO 5
      data = ""
      If Not eachRowRS.eof Then
           If eachRowRS("activityType") = activity AND
eachRowRS("caseType") = casetype Then
               data = eachRowRS("count")
               eachRowRS.MoveNext
           End If
      End If
  %>
      <TD><input size="5" name="count_<%=activity%>_<%=casetype%>"
value="<%=data%>"></TD>
            <%
            Next
            %>
           <TD><input size=5 name="total_<%=activity%>" READONLY></TD>\
           </TR>
     <TR>
      <TD nowrap align="left"><font size="2">Sub Total of Cases
Disposed</font></TD>
      <%
  activity = 0
  For casetype = 1 TO 5
      data = ""
      If Not eachRowRS.eof Then
           If eachRowRS("activityType") = activity AND
eachRowRS("caseType") = casetype Then
               data = eachRowRS("count")
               eachRowRS.MoveNext
           End If
      End If
  %>
      <TD><input size="5" name="count_<%=activity%>_<%=casetype%>"
value="<%=data%>"></TD>
            <%
            Next
            %>
           <TD><input size=5 name="total_<%=activity%>" READONLY></TD>
           </TR>
     <TR>
      <TD nowrap align="left"><font size="2">(+)Cases Transfered
Out</font></TD>
      <%
  activity = 0
  For casetype = 1 TO 5
      data = ""
      If Not eachRowRS.eof Then
           If eachRowRS("activityType") = activity AND
eachRowRS("caseType") = casetype Then
               data = eachRowRS("count")
               eachRowRS.MoveNext
           End If
      End If
  %>
      <TD><input size="5" name="count_<%=activity%>_<%=casetype%>"
value="<%=data%>"></TD>
            <%
            Next
            %>
           <TD><input size=5 name="total_<%=activity%>" READONLY></TD>
           </TR>
     <TR>
      <TD nowrap align="left"><font size="2">Total Cases
Disposed</font></TD>
      <%
  activity = 0
  For casetype = 1 TO 5
      data = ""
      If Not eachRowRS.eof Then
           If eachRowRS("activityType") = activity AND
eachRowRS("caseType") = casetype Then
               data = eachRowRS("count")
               eachRowRS.MoveNext
           End If
      End If
  %>
      <TD><input size="5" name="count_<%=activity%>_<%=casetype%>"
value="<%=data%>"></TD>
            <%
            Next
            %>
           <TD><input size=5 name="total_<%=activity%>" READONLY></TD>
           </TR>
       </TABLE>
       </td>
      <tr>
     </table>
    </td>
    </tr>
   </table>
   </td>
  </tr>
 </table>

  <!-- ----------------- Table: Calculations  ------------- -->

<P ALIGN="CENTER">
<table cellpadding=2 cellspacing=0 border=0 width="95%">
<tr  BGCOLOR="ffffff">
<td align=left><font size=2
face="arial,helvetica,verdana,lucida,utopia" color=""><b>C:
Calculations</b></font></td>
<td align=right></font></td>
</tr>
</table>

<table width="95%" align="center" cellpadding="0" cellspacing="0" border="0">
<tr>
  <td width="95%">
   <TABLE BORDER=0 BGCOLOR='#000000' CELLSPACING=0 CELLPADDING=0 WIDTH='95%'>
    <TR>
     <TD>
      <TABLE BORDER=0 CELLSPACING=1 CELLPADDING=2 WIDTH='100%'>
       <TR BGCOLOR="ffffff">
        <TD COLSPAN=3><FONT SIZE=2
FACE="arial,helvetica,verdana,lucida,utopia" COLOR="ffffff">
         <B>
         <TABLE BORDER="1" bgcolor="#ffffff" width="100%" class="myTable">
     <TR>
  <TH rowspan="2" width="30%">&nbsp;</TH><TH COLSPAN=2
align=center>Asbestos</TH><TH COLSPAN=1>&nbsp;</TH><TH
ROWSPAN=1>&nbsp;</TH><TH valign="bottom" ROWSPAN="2"
width="12%">DOMESTIC</TH><TH valign="bottom" ROWSPAN="2"
width="12%">TOTAL</TH>
     </TR>
     <TR>
      <TH width="12%">PLA</TH>
      <TH width="12%">CASE</TH>
      <TH width="12%">SILICA</TH>
      <TH width="12%">CIVIL</TH>
     </TR>
     </TR>
     <TR>
      <TD nowrap align="left"><font size="2">Beginning
Balance</font></TD><TD><input type="text" size="5" name="begbalpla"
value=""></TD> <TD><input type="text" size="5" name="begbalcase"
value=""></TD> <TD><input type="text" size="5" name="begbalsilical"
value=""></TD>
      <TD><input type="text" size="5" name="begbalcivil"
value=""></TD><TD><input type="text" size="10" name="begbaldomestic"
value=""></TD><TD><input type="text" size="5" name="begbaltot"
value=""></TD>
     </TR>
     <TR>
      <TD nowrap align="left"><font size="2">(-)Total Cases
Disposed</font></TD> <TD><input type="text" size="5" name="totdisppla"
value=""></TD><TD><input type="text" size="5" name="totdispcases"
value=""></TD><TD><input type="text" size="5" name="totdispsilica"
value=""></TD>
      <TD><input type="text" size="5" name="totdispcivil"
value=""></TD><TD><input type="text" size="10" name="totdispdomestic"
value=""></TD><TD><input type="text" size="5" name="totdisptot"
value=""></TD>
     </TR>

     <TR>
      <TD nowrap align="left"><font size="2">Ending Balance This
Month</font></TD> <TD><input type="text" size="5" name="endbalpla"
value=""></TD><TD><input type="text" size="5" name="endbalcase"
value=""></TD><TD><input type="text" size="5" name="endbalsilica"
value=""></TD>
      <TD><input type="text" size="5" name="endbalcivil"
value=""></TD><TD><input type="text" size="10" name="endbaldomestic"
value=""></TD><TD><input type="text" size="5" name="prevMoBal"
value=""></TD>
     </TR>
       </TABLE>
       </td>
      <tr>
     </table>
    </td>
    </tr>
   </table>
   </td>
  </tr>
 </table>
 </div> <!-- Printer friendly page ends -->
<table align="center">
  <tr>
    <td align="left" class="light"></td><td><input name="loginButton"
class="button" value="Submit this data" type="submit" onclick="return
submit_doc();" />&nbsp;|&nbsp;</td><td><input type="button"
class="button" name="printMe" onClick="printFriendly()" value="Print
report"></td>
  </tr>
<table>
</form>
 
That's a bit of a big read if you're looking for advice on the code. I'd suggest putting output markers in your loops (such as Response.Write "Inside eachRowRS Loop<br>") and then post smaller snippets with specific questions. Just a suggestion, I hate to see people with questions not get any replies...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top