Wrox Programmer Forums
|
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 13th, 2008, 08:53 AM
Registered User
 
Join Date: May 2008
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default Calculating Subtotals and Totals in asp page

Hi, I am new to this board and this is my first post. I am working on page for Scouts-boys/girls where there are multiple unit sections. Currently all of the units have one total that is unallocated/allocated that shows at the bottom of the page. The totals are calculated when putting it in a text box and the totals are automatically configured. I am trying to get the page to show subtotals for each unit and then one grand total calculating all of the subtotals that shows at the bottom of ths page. I have tried several methods so far and I am able to get one unit to work but not all of them to calculate subtotals. I know this may be confusing I don't know how to post screen prints so I can show you what the page currently looks like.

I am not sure if I am allowed to do this but here is part of the code I have. I will put the rest of the code in a post below. I would appreciate anybody's help and input, Thank you:

Code:
'--------------------------------------------- ROWS -------------------------------------------------

if m_blnCouncilHasOrderTypes then
set m_rsScouts = m_objScoutsWithOrders.funcSelectScoutOrderTypeAllocation(m_objError, m_lngGroupID,clng(g_lngCurrentSalesCycleId))
else
set m_rsScouts = m_objScoutsWithOrders.funcSelectScoutsByUnitSubUnit(m_objError, m_lngGroupId, clng(g_lngCurrentSalesCycleId) )
end if

if not funcAreRecordsetAndObjectOK(m_rsScouts, m_objScoutsWithOrders, m_strScriptName & "m_objScoutsWithOrders.funcSelectScout") Then
'handle error
CALL subManageError(m_blnHasErrorShown)
'subAddHTML m_objScoutsWithOrders.Error.TEErrorMessage
m_blnIsFatalError = True
m_objScoutsWithOrders.Error.ClearError()
'repopulate error object
Call subResetErrorObjectProperties
else

dim m_blnUnitHasScouts
m_blnUnitHasScouts = false 'not the same as (not (m_rsScouts.EOF and m_rsScouts.BOF)) here; empty units and subunits return a single row with null scout id in this query

if (not (m_rsScouts.EOF and m_rsScouts.BOF)) then 'if there are records
dim m_lngLastSubUnitGroupID
dim m_blnFirstGroupRow 
m_blnFirstGroupRow = True
m_lngLastSubUnitGroupID = - 1

'Replace default New Scout column heading with the council specific value
'm_strNewScoutName = funcNull2Blank(m_rsScouts.Fields("NewScoutName").value)
'm_strNewScoutDescription = funcNull2Blank(m_rsScouts.Fields("NewScoutDescription").Value)
If Len(m_strNewScoutName) > 0 And Len(m_strNewScoutDescription) > 0 Then
m_strScoutHeaderRow = Replace(m_strScoutHeaderRow, mc_strNewScoutDefaultName, m_strNewScoutName)
End if 

'vvvvvvvvvvvvvvvv SCOUT LOOP vvvvvvvvvvvvvvvvvvvvv

if m_blnCouncilHasOrderTypes then
m_strScoutArray = m_strScoutArray & "var m_arrScout = ["
end if

m_intScoutCounter = 1
m_rsScouts.MoveFirst()
dim m_blnHaveTotaledOrders
do while not m_rsScouts.EOF
m_blnHaveTotaledOrders = False
m_lngScoutID = funcNull2Zero(m_rsScouts("ScoutID"))
m_strFirstName = funcNull2Blank(m_rsScouts("FirstName"))
m_strLastInitial = funcNull2Blank(m_rsScouts("LastInitial"))
m_strScoutKey = funcNull2Blank(m_rsScouts("ScoutKey"))
m_curGoal = funcNull2Blank(m_rsScouts("Goal"))
m_lngSubUnitGroupID = funcNull2Zero(m_rsScouts("SubUnitGroupID")) 
m_strSubUnitDisplayName = funcNull2Blank(m_rsScouts("SubUnitDisplayName"))
'TO DO: Add New Scout Indicator
m_blnNewScout = m_rsScouts("NewScout")
if (m_lngSubUnitGroupID = 0) then 'unit level
m_lngSubUnitGroupID = m_lngGroupID
m_strSubUnitDisplayName = m_strDisplayName
end if

if (m_blnCouncilHasOrderTypes and (m_lngScoutID <> 0)) then
m_strScoutArray = m_strScoutArray & "[" & m_lngScoutID & "," & funcNull2Zero(m_lngSubUnitGroupID) & "," & funcNull2Zero(m_curGoal) & "] ,"
m_blnUnitHasScouts = true
end if

'------------------ UNIT / SUBUNIT HEADER ROW ------------------------
dim m_blnIsNewSubUnit
if m_lngLastSubUnitGroupID <> - 1 then m_blnFirstGroupRow = False
m_blnIsNewSubUnit = (m_lngSubUnitGroupID <> m_lngLastSubUnitGroupID)
m_lngLastSubUnitGroupID = m_lngSubUnitGroupID

if (m_blnIsNewSubUnit) then '(m_intSessionLevelID = 4) and (m_lngSubUnitGroupID <> 0) 
dim m_intScoutColspan

if m_blnCouncilHasOrderTypes and m_blnShouldShowOrders then
'TO DO: Add New Scout Indicator handling (was base colspan of 4 and 3 respectively)
m_intScoutColspan = (5 + m_intNumberOfOrderTypes)
else
m_intScoutColspan = 4
end if

'extra blank row for all but the first group?
if m_blnFirstGroupRow = False then
m_strScoutRows = m_strScoutRows & "<tr>"
m_strScoutRows = m_strScoutRows & " <td colspan=" & m_intScoutColspan & " valign=""top"" nowrap>" & "&nbsp;" & "</td>"
m_strScoutRows = m_strScoutRows & "<td>&nbsp;</td><td>&nbsp;</td>"
m_strScoutRows = m_strScoutRows & "</tr>"
end if 

'5/5/08 BEGIN sub-totals 
'--------------------------------------------- VIEW TOTALS -------------------------------------------------
if m_blnFirstGroupRow = False Then
m_strTotalRow = "<tr>"

if m_blnCouncilHasOrderTypes then

if (m_intSessionLevelID = 4) and m_blnUnitHasScouts then
'TO DO: Add New Scout Indicator colpan change, base colspan was 2
m_strTotalRow = m_strTotalRow & "<td valign=""top"" class=""label"" colspan=""3"" align=""right"">Unallocated:</td>"
else
m_strTotalRow = m_strTotalRow & "<td valign=""top"" colspan=""3"" align=""right"">&nbsp;</td>"
end if

m_rsOrderTypes.MoveFirst

do while not m_rsOrderTypes.EOF
m_lngOrderTypeID = m_rsOrderTypes("OrderTypeID")
m_strOrderType = m_rsOrderTypes("OrderType")
m_blnScoutCanOrder = m_rsOrderTypes("ScoutCanOrder")
m_curOriginalRetail = funcNull2Zero(m_rsOrderTypes("OriginalRetail"))

if m_blnUnitHasScouts then
if cbool(m_rsOrderTypes("ScoutCanOrder")) then 'OT allows scout orders
'Allowed
m_strTotalRow = m_strTotalRow & _
"<td valign=""top"" class=""uom"" style=""margin:0pt;padding:0pt;"" nowrap><img src=""/images/elements/arrows/checkboxarrow_up.gif"">&nbsp;Approved</td>"
else 'OT allows scout orders
'Not Allowed

if (m_intSessionLevelID = 4) then
m_strTotalRow = m_strTotalRow & "<td valign=""top"" align=""right""><i>" & funcBuildNumberInput("TotalUnallocated_" & m_rsOrderTypes("OrderTypeID"),0,10,12,"","class=textnumberdisplay READONLY","","","","TotalNegative") & "</i></td>" 'RJO italics?
else
m_strTotalRow = m_strTotalRow & "<td valign=""top"" align=""right"">&nbsp;</td>"
end if

end if 'OT allows scout orders
else
m_strTotalRow = m_strTotalRow & "<td valign=""top"" align=""right"">&nbsp;</td>"
end if

m_rsOrderTypes.MoveNext
loop

end if 'has order types

if m_blnCouncilHasOrderTypes then
if (m_intSessionLevelID = 4) and m_blnUnitHasScouts then
m_strTotalRow = m_strTotalRow & "<td valign=""top"" valign=""top"" align=""right"" style="";""><i>" & funcBuildNumberInput( "UnitUnallocated",0,10,12,"","class=textnumberdisplay READONLY","","","","TotalNegative") & "</i></td>" 'RJO italics?
m_strTotalRow = m_strTotalRow & "<td valign=""top"">&lt;-</td>"
m_strTotalRow = m_strTotalRow & "<td class=""toponlyblock"" id=""labelsize"" colspan=""2"">Total Unallocated" '</td>"
m_strTotalRow = m_strTotalRow & "&nbsp;" & funcBuildNumberInput("UnitAllocated",0,10,12,"display:none","class=textnumberdisplay READONLY","","","","Total") & "</td>" 'RJO or could use a new javascript variable to store
m_strTotalRow = m_strTotalRow & "</tr>"

m_strTotalRow = m_strTotalRow & "<tr>"
'TO DO: Add New Scout Indicator handling of colspan, colspan was 2
m_strTotalRow = m_strTotalRow & "<td valign=""top"" colspan=""3"">&nbsp;</td>"
m_strTotalRow = m_strTotalRow & "<td colspan=""" & m_intNumberOfOrderTypes & """ align=""right"">Joe Scout Sales Total:</td>"
m_strTotalRow = m_strTotalRow & "<td class=""bigdata"" valign=""top"" align=""right"" style=""border-top:solid black 1pt;"">" & funcBuildNumberInput("UnitTotal",m_marcusTotal,10,12,"","class=textnumberdisplay READONLY","","","","Total") & "</td>"
m_marcusTotal = 0
m_strTotalRow = m_strTotalRow & "<td valign=""top"">&nbsp;</td>"
'TO DO: Add New Scout Indicator, added new column with colspan of 2
m_strTotalRow = m_strTotalRow & "<td valign=""top"" colspan=""2"">&nbsp;</td>"
m_strTotalRow = m_strTotalRow & "</tr>"

else
'TO DO: Add New Scout Indicator handling of colspan, colspan was 2
'TOTAL RETAIL COLUMN
If m_intSessionLevelID = 4 then
m_strTotalRow = m_strTotalRow & "<td colspan=2>&nbsp;</td>" 
elseif m_intSessionLevelID = 5 then
m_strTotalRow = m_strTotalRow & "<td>&nbsp;</td>"
end if
'SPACER COLUMN
m_strTotalRow = m_strTotalRow & "<td>&nbsp;</td>"
'GOAL COLUMNS
m_strTotalRow = m_strTotalRow & "<td class=""toponlyblock"" colspan=2>&nbsp;</td>"
m_strTotalRow = m_strTotalRow & "</tr>"
end if

else
m_strTotalRow = m_strTotalRow & "<td valign=""top"" class=""note"" colspan=""4"" align=""center"">&nbsp;</td>"
m_strTotalRow = m_strTotalRow & _
"<td class=""toponlyblock"" id=""labelsize"" colspan=""2"">&nbsp;</td>" & _
"<td valign=""top"">&nbsp;</td>" & _
"</tr><tr>" & _
"<td valign=""top"" colspan=""10"" class=""note"" align=""center"">" & funcMessage(357) & "</td>" & _
"</tr>"
end if

'== BEGIN Scout Row Footnote Section
'spacer row
dim m_strNewScoutColSpan
m_strNewScoutColSpan = 7 + m_intNumberOfOrderTypes

m_strTotalRow = m_strTotalRow & "<tr><td colspan=" & 7 + m_strNewScoutColSpan & " class=note>&nbsp;</td></tr>"

'add column description for New Scout indicator
m_strTotalRow = m_strTotalRow & _
"<tr><td colspan=" & 7 + m_strNewScoutColSpan & " class=""note"" align=""center"">" & mc_strNewScoutSymbol & "&nbsp;" & funcMessage(763) & "</td></tr>"
If Len(m_strNewScoutName) > 0 And Len(m_strNewScoutDescription) > 0 Then
m_strTotalRow = Replace(m_strTotalRow, funcMessage(763), m_strNewScoutDescription)
End if 
'== END Scout Row Footnote Section

rw "Len(m_strTotalRow) 1: " & Len(m_strTotalRow) & "<BR>" 
rw "m_blnHasSubTotal: " & m_blnHasSubTotal & "<BR>"

if m_blnHasSubTotal = False Then
rw "Len(m_strScoutHeaderRow) 1: " & Len(m_strScoutHeaderRow) & "<BR>"
rw "Len(m_strTotalRow) 2: " & Len(m_strTotalRow) & "<BR>"
m_strScoutHeaderRow = m_strTotalRow & m_strScoutHeaderRow
rw "Len(m_strScoutHeaderRow) 2: " & Len(m_strScoutHeaderRow) & "<BR>"
m_blnHasSubTotal = True
End if
m_strTotalRow = m_strTotalRow & "<tr>"
'TO DO: Add New Scout Indicator handling of colspan, colspan was 2
m_strTotalRow = m_strTotalRow & "<td valign=""top"" colspan=""3"">&nbsp;</td>"
m_strTotalRow = m_strTotalRow & "<td colspan=""" & m_intNumberOfOrderTypes & """ align=""right"">J Scout Sales Total:</td>"
m_strTotalRow = m_strTotalRow & "<td class=""bigdata"" valign=""top"" align=""right"" style=""border-top:solid black 1pt;"">" & funcBuildNumberInput("UnitTotal5",m_lngUnitTotalAmount,10,12,"","class=textnumberdisplay READONLY","","","","Total") & "</td>"
m_strTotalRow = m_strTotalRow & "<td valign=""top"">&nbsp;</td>"
'TO DO: Add New Scout Indicator, added new column with colspan of 2
m_strTotalRow = m_strTotalRow & "<td valign=""top"" colspan=""2"">&nbsp;</td>"
m_strTotalRow = m_strTotalRow & "</tr>"

'end if 'view mode check
end if 'm_blnFirstGroupRow = false
'--------------------------------------------- END VIEW TOTALS -------------------------------------------------

'5/5/08 END sub-totals 


'm_strScoutHeaderRow = "<td valign=""top"" colspan=""4"" align=""right""><b>Total Allocated: - ></b></td>"
'column headings
'------------------------------------------------------------------------------------------------> Javascript Escape Sequences <--------------------------------------------------------|
'm_strScoutHeaderRow = Replace(m_strScoutHeaderRow, "DisplayName_" & mc_strReplacementGroupName, Replace(Replace(Replace(m_strSubUnitDisplayName, "\", "\\"), """", "\"""), "'", "\'"))
'5/5/08 BEGIN DEBUG
'm_strScoutHeaderRow = Replace(m_strScoutHeaderRow, "%m_blnFirstGroupRow%", m_blnFirstGroupRow)
m_strScoutHeaderRow = Replace(m_strScoutHeaderRow, "%m_lngSubUnitGroupID%", m_lngSubUnitGroupID)
m_strScoutHeaderRow = Replace(m_strScoutHeaderRow, "%m_lngLastSubUnitGroupID%", m_lngLastSubUnitGroupID)
m_strScoutHeaderRow = Replace(m_strScoutHeaderRow, "%m_blnIsNewSubUnit%", m_blnIsNewSubUnit)


'5/5/08 BEGIN DEBUG
m_strScoutRows = m_strScoutRows & Replace(Replace(Replace(m_strScoutHeaderRow, "DisplayName_" & mc_strReplacementGroupName, Replace(Replace(Replace(m_strSubUnitDisplayName, "\", "\\"), """", "\"""), "'", "\'")), mc_strReplacementGroupName, m_strSubUnitDisplayName), mc_strReplacementGroupID, m_lngSubUnitGroupID) 

'm_strScoutHeaderRow = Replace(m_strScoutHeaderRow, "DisplayName_" & mc_strReplacementGroupName, Replace(Replace(Replace(m_strSubUnitDisplayName, "\", "\\"), """", "\"""), "'", "\'"))
'm_strScoutRows = m_strScoutRows & Replace(Replace(m_strScoutHeaderRow, mc_strReplacementGroupName, m_strSubUnitDisplayName), mc_strReplacementGroupID, m_lngSubUnitGroupID) 
m_colChangeBackground = "white" 'reset background color to white for each new unit/subunit
end if 

if (m_lngScoutID <> 0) then 'if scout is real (and not just a placeholder for a unit/subunit with no scouts)
m_strScoutRows = m_strScoutRows & "<tr style=""background-color:" & m_colChangeBackground & ";"">"
m_strScoutRows = m_strScoutRows & " <td valign=""middle"" nowrap>" & m_strFirstName & " " & m_strLastInitial & ".</td>"
m_strScoutRows = m_strScoutRows & " <td class=""smalldata"" valign=""middle"" style=""padding:3pt 15pt 3pt 3pt;"" nowrap>" & m_strScoutKey & "</td>"
'TO DO: New Scout Indicator
if m_blnNewScout = True Then
m_strScoutRows = m_strScoutRows & " <td style=""text-align:center;""><img src=""/images/checked.gif""></td>"
else 
m_strScoutRows = m_strScoutRows & " <td style=""text-align:center;""><img src=""/images/notchecked.gif""></td>"
end if
if m_blnCouncilHasOrderTypes then

'vvvvvvvvvvvvvvvv SCOUT / ORDER TYPE LOOP vvvvvvvvvvvvvvvvvvvvv
'RJO assuming that ordertypes & scoutordertypes will mesh properly; verify ordertypeid / scoutid match?
dim m_blnShouldPopulateOrderTypeArray
m_blnShouldPopulateOrderTypeArray = eval(m_strOrderTypeArray = "")
if (m_blnShouldPopulateOrderTypeArray) then
m_strOrderTypeArray = m_strOrderTypeArray & "var m_arrOrderType = ["
end if
dim m_lngUnitTotalAmount
dim m_lngUnitTotalAmount2
dim m_lngUnitTotalAmount3
dim m_lngUnitTotalAmount4
dim m_blnScoutOrderTypeApproved
'm_lngUnitTotalAmount = 0
m_lngUnitTotalAmount = m_curOriginalRetail - m_lngUnitTotalAmount

m_rsOrderTypes.MoveFirst
do while not m_rsOrderTypes.EOF

'order type fields
m_blnScoutOrderTypeApproved = true
m_lngOrderTypeID = m_rsOrderTypes("OrderTypeID")
m_strOrderType = m_rsOrderTypes("OrderType")
m_blnScoutCanOrder = m_rsOrderTypes("ScoutCanOrder")
m_curOriginalRetail = funcNull2Zero(m_rsOrderTypes("AdjustedRetail")) 'RJO 10/14/2002 pull adjusted retail instead
if not m_blnHaveTotaledOrders then 
m_lngUnitTotalAmount = m_lngUnitTotalAmount + m_curOriginalRetail
end if
'scout fields
m_lngScoutOrderTypeID = m_rsScouts("OrderTypeID")
m_blnApproved = m_rsScouts("Approved")
'assuming only one of the next 2 fields will have a nonzero value
m_curAllocated = funcNull2Zero(m_rsScouts("TakeOrderTotalDollars")) 
m_joeTotal = funcNull2Zero(m_rsScouts("TakeOrderTotalDollars"))+m_joeTotal 
m_GrandTotal = funcNull2Zero(m_rsScouts("TakeOrderTotalDollars"))+m_GrandTotal
if (funcNull2Zero(m_rsScouts("Allocation")) > 0) then
m_curAllocated = funcNull2Zero(m_rsScouts("Allocation"))
m_joeTotal = funcNull2Zero(m_rsScouts("Allocation"))+m_joeTotal 
m_GrandTotal = funcNull2Zero(m_rsScouts("Allocation"))+m_GrandTotal
end if

if (m_blnShouldPopulateOrderTypeArray) then
m_strOrderTypeArray = m_strOrderTypeArray & "[" & m_lngOrderTypeID & "," & lcase(m_blnScoutCanOrder) & "," & m_curOriginalRetail & ",'" & replace(m_strOrderType,"'","\'") & "'],"
end if

m_strScoutRows = m_strScoutRows & "<td align=""left""><table cellspacing=""0"" cellpadding=""0""><tr><td>"
dim m_strAllocatedStyle

if cbool(m_rsOrderTypes("ScoutCanOrder")) then 'OT allows scout orders
'Allowed

if cbool(m_rsScouts("Approved")) then
m_strScoutRows = m_strScoutRows & "<img src=""/images/checked.gif"">"
m_blnScoutOrderTypeApproved = true
else
if isNull(m_rsScouts("TakeOrderTotalDollars")) then 
'do nothing
m_strScoutRows = m_strScoutRows & "<img src=""/images/clear.gif"" width=12>"
else
m_blnScoutOrderTypeApproved = false
m_strScoutRows = m_strScoutRows & "<img src=""/images/notchecked.gif"">"
end if
end if

m_strScoutRows = m_strScoutRows & "</td><td nowrap><span class=""smalldata"">"

if funcPermit("OR-PC-110-C") and funcPermit("OR-PC-110-E") then
m_strCheckOrdering = "" 'RJO this test is currently causing page to time out; will become important once non-selling scouts arrive--address then funcIsScoutOrderTypeOrderOK(clng(m_rsOrderTypes("OrderTypeID")),m_lngScoutID)

if len(m_strCheckOrdering) = 0 then
'check for non zero orders that are not approved and highlight for council actors.
'class=instructions 
if (m_blnScoutOrderTypeApproved = false) And (not isNull(m_rsScouts("TakeOrderTotalDollars")) ) and (m_intSessionLevelID = 2) then
m_strScoutRows = m_strScoutRows & "<a class=""highlightLink"" href=""/TESales/orders/popcorn/raScoutPopcornOrder.asp?ScoutID=" & m_lngScoutID & "&OrderTypeID=" & m_rsOrderTypes("OrderTypeID") & "&SID=" & SID & """>Order Form</a>"
else 
m_strScoutRows = m_strScoutRows & "<a href=""/TESales/orders/popcorn/raScoutPopcornOrder.asp?ScoutID=" & m_lngScoutID & "&OrderTypeID=" & m_rsOrderTypes("OrderTypeID") & "&SID=" & SID & """>Order Form</a>"
end if
else
m_strScoutRows = m_strScoutRows & "[" & funcTextPopup(m_strCheckOrdering,"Help") & "] "
end if

else
m_strScoutRows = m_strScoutRows & "Scout Order"
end if

m_strScoutRows = m_strScoutRows & "</span></td><td nowrap align=""right"">"
m_strAllocatedStyle = "display:none;" 'hide these
m_strOnChange = ""
else 'OT allows scout orders
'Not Allowed
m_strAllocatedStyle = ""
m_strOnChange = "funcChangeAllocation(" & m_lngScoutID & "," & m_lngOrderTypeID & ");"
m_strOnBlur = "funcDirty(this.form, '" & m_lngScoutID & "_" & m_lngOrderTypeID & "', 'ALLOCATE');"
end if 'OT allows scout orders

dim m_strAllocatedClass
m_strAllocatedClass = "class=textnumber"

if (m_intSessionLevelID > 4) then 'subunit level
m_strOnChange = ""
m_strAllocatedClass = "class=textnumberdisplay READONLY"
end if

if funcPermit("AD-OT-200-Z") then
m_strScoutRows = m_strScoutRows & funcBuildNumberInput("Allocated_" & m_lngScoutID & "_" & m_lngOrderTypeID,m_curAllocated,10,10,m_strAllocatedStyle,m_strAllocatedClass,"",m_strOnChange,m_strOnBlur,"Allocation")
m_strScoutRows = m_strScoutRows & "<input type=hidden name=""ScoutAllocatedByGroup_""" & m_lngScoutID & "_" & m_lngOrderTypeID & "_" & m_lngSubUnitGroupID & " value=""" & m_curAllocated & """>"

m_strScoutRows = m_strScoutRows & "<input type=hidden name=forceFireFoxonChange_" & m_lngScoutID & "_" & m_lngOrderTypeID & " value="""">"
'TO DO: Figure out how to right align the above
if (m_intSessionLevelID = 4) then 'unit level

if cbool(m_rsOrderTypes("ScoutCanOrder")) then 
m_strScoutRows = m_strScoutRows & funcDisplayDollars(m_curAllocated)
'TO DO: Figure out how to right align the above
end if

m_strScoutRows = m_strScoutRows & "<input type=hidden name=Dirty_" & m_lngScoutID & "_" & m_lngOrderTypeID & " value="""">"
end if

else
m_strScoutRows = m_strScoutRows & funcDisplayDollars(m_curAllocated) & "<input type=hidden name=""Allocated_" & m_lngScoutID & "_" & m_lngOrderTypeID & """ value=""" & m_curAllocated & """>"
end if<%
 
Old May 13th, 2008, 08:55 AM
Registered User
 
Join Date: May 2008
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Code:
m_strScoutRows = m_strScoutRows & "</td></tr></table></td>"
'want to move ahead for each OT
m_rsScouts.MoveNext
m_rsOrderTypes.MoveNext

loop
m_blnHaveTotaledOrders = True

if (m_blnShouldPopulateOrderTypeArray) then
m_strOrderTypeArray = left(m_strOrderTypeArray,len(m_strOrderTypeArray) - 1) 'ditch the final comma
m_strOrderTypeArray = m_strOrderTypeArray & "] "
end if
'SET GOAL
m_strScoutPercentOfGoal = "<i class=""note"">NA</i>"
end if 'council has order types?

m_strScoutRows = m_strScoutRows & " <td class=""collabel"" valign=""bottom"">&nbsp;&nbsp;</td>"
m_strScoutRows = m_strScoutRows & " <td class=""leftblock"" align=""right"" nowrap>"
'GOAL
m_strScoutRows = m_strScoutRows & funcBuildNumberInput("Goal_" & m_lngScoutID,m_curGoal,10,12,"background-color:" & m_colChangeBackground,"class=textnumberdisplay READONLY","","","","Goal") 'funcFormatNumber(funcNull2Zero(m_curGoal),0,true)
m_strScoutRows = m_strScoutRows & "<input type=hidden name=forceFireFoxonChange_" & m_lngScoutID & " value="""">"
m_strScoutRows = m_strScoutRows & "</td>"
m_strScoutRows = m_strScoutRows & " <td class=""rightblock"" align=""center"">" & m_strScoutPercentOfGoal & "</td>"
m_strScoutRows = m_strScoutRows & "</tr>"

if (not m_blnCouncilHasOrderTypes) then
m_rsScouts.MoveNext
end if 

else

if (m_blnIsNewSubUnit) then
'"no scouts in this unit" message
m_strScoutRows = m_strScoutRows & "<tr>"
m_strScoutRows = m_strScoutRows & " <td align=center colspan=" & m_intScoutColspan & ">" & funcMessage(356) & "</td>"
m_strScoutRows = m_strScoutRows & "<td class=""leftblock"">&nbsp;</td><td class=""rightblock"">&nbsp;</td>"
m_strScoutRows = m_strScoutRows & "</tr>"
'empty row?
m_strScoutRows = m_strScoutRows & "<tr>"
m_strScoutRows = m_strScoutRows & " <td align=center colspan=" & m_intScoutColspan & ">" & "&nbsp;" & "</td>"
m_strScoutRows = m_strScoutRows & "<td class=""leftblock"">&nbsp;</td><td class=""rightblock"">&nbsp;</td>"
m_strScoutRows = m_strScoutRows & "</tr>"
end if

m_rsScouts.MoveNext
end if 'scout is real

call subDoColorChange(m_intScoutCounter,3,1)
m_intScoutCounter = m_intScoutCounter + 1




loop 'loop thru scouts 

if m_blnCouncilHasOrderTypes then
if m_blnUnitHasScouts then '(left(m_strScoutArray,len(m_strScoutArray) - 1) = ",")
m_strScoutArray = left(m_strScoutArray,len(m_strScoutArray) - 1) 'ditch the final comma
end if
m_strScoutArray = m_strScoutArray & "] "
end if
'^^^^^^^^^^^^^^^^ SCOUT LOOP ^^^^^^^^^^^^^^^^^^^^^
else
'no longer used? (recordset will always have)
m_strScoutRows = m_strScoutRows & "<tr><td colspan=20>&nbsp;</td></tr>"
m_strScoutRows = m_strScoutRows & "<tr><td colspan=20 align=center>" & funcMessage(356) & "</td></tr>"
m_strScoutRows = m_strScoutRows & "<tr><td colspan=20>&nbsp;</td></tr>"
end if 'scouts exist

end if 'no errors

if (funcPermit("AD-UM-110-E")) then
m_strButtonRow = "<tr>"
m_strButtonRow = m_strButtonRow & "<td colspan=""10"" align=""right"">"

if ((m_intSessionLevelID = 4) and m_blnCouncilHasOrderTypes and m_blnUnitHasScouts) then 'unit level

m_strButtonRow = m_strButtonRow & "<input type=""button"" class=""button"" value=""Save Allocations"" onClick=""setPageAction(this.form, 'ALLOCATE', '')"" id=""btnSave"" name=""btnSave"">"
else
m_strButtonRow = m_strButtonRow & "&nbsp;"
end if

m_strButtonRow = m_strButtonRow & "</td>"
m_strButtonRow = m_strButtonRow & "</tr>"
else
m_strButtonRow = "<tr>" & _
"<td colspan=""10"" align=""right"">&nbsp;</td>" & _
"</tr>"
end if

'5/5/08 begin dev repeating totals
if m_strMode = "View" and funcPermit("AD-UM-110-V") and m_blnIsNewSubUnit then
rw "<tr><td colspan=""11""><img src=""/images/clear.gif"" width=3 height=20></td></tr>"
rw m_strTotalRow 
end if

rw m_strButtonRow 
'5/5/08 end dev repeating totals

'--------------------------------------------- VIEW TOTALS -------------------------------------------------
m_strTotalRow = "<tr>"

if m_blnCouncilHasOrderTypes then

if (m_intSessionLevelID = 4) and m_blnUnitHasScouts then
'TO DO: Add New Scout Indicator colpan change, base colspan was 2
m_strTotalRow = m_strTotalRow & "<td valign=""top"" class=""label"" colspan=""3"" align=""right"">Unallocated:</td>"
else
m_strTotalRow = m_strTotalRow & "<td valign=""top"" colspan=""3"" align=""right"">&nbsp;</td>"
end if

m_rsOrderTypes.MoveFirst

do while not m_rsOrderTypes.EOF

m_lngOrderTypeID = m_rsOrderTypes("OrderTypeID")
m_strOrderType = m_rsOrderTypes("OrderType")
m_blnScoutCanOrder = m_rsOrderTypes("ScoutCanOrder")
m_curOriginalRetail = funcNull2Zero(m_rsOrderTypes("OriginalRetail"))

if m_blnUnitHasScouts then
if cbool(m_rsOrderTypes("ScoutCanOrder")) then 'OT allows scout orders
'Allowed
m_strTotalRow = m_strTotalRow & _
"<td valign=""top"" class=""uom"" style=""margin:0pt;padding:0pt;"" nowrap><img src=""/images/elements/arrows/checkboxarrow_up.gif"">&nbsp;Approved</td>"
else 'OT allows scout orders
'Not Allowed

if (m_intSessionLevelID = 4) then
m_strTotalRow = m_strTotalRow & "<td valign=""top"" align=""right""><i>" & funcBuildNumberInput("TotalUnallocated_" & m_rsOrderTypes("OrderTypeID"),0,10,12,"","class=textnumberdisplay READONLY","","","","TotalNegative") & "</i></td>" 'RJO italics?
else
m_strTotalRow = m_strTotalRow & "<td valign=""top"" align=""right"">&nbsp;</td>"
end if

end if 'OT allows scout orders
else
' m_strTotalRow = m_strTotalRow & "<td valign=""top"" align=""right"">&nbsp;</td>"
end if

m_rsOrderTypes.MoveNext

loop


end if 'has order types

if m_blnCouncilHasOrderTypes then

if (m_intSessionLevelID = 4) and m_blnUnitHasScouts then
m_strTotalRow = m_strTotalRow & "<td valign=""top"" valign=""top"" align=""right"" style="";""><i>" & funcBuildNumberInput( "UnitUnallocated",0,10,12,"","class=textnumberdisplay READONLY","","","","TotalNegative") & "</i></td>" 'RJO italics?
m_strTotalRow = m_strTotalRow & "<td valign=""top"">&lt;-</td>"
m_strTotalRow = m_strTotalRow & "<td class=""toponlyblock"" id=""labelsize"" colspan=""2"">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Total Unallocated" '</td>"
m_strTotalRow = m_strTotalRow & "&nbsp;" & funcBuildNumberInput("UnitAllocated",0,10,12,"display:none","class=textnumberdisplay READONLY","","","","UnitAllocated") & "</td>" 'RJO or could use a new javascript variable to store
m_strTotalRow = m_strTotalRow & "</tr>"

m_strTotalRow = m_strTotalRow & "<tr>"

'TO DO: Add New Scout Indicator handling of colspan, colspan was 2
m_strTotalRow = m_strTotalRow & "<td valign=""top"" colspan=""3"">&nbsp;</td>"
m_strTotalRow = m_strTotalRow & "<td colspan=""" & m_intNumberOfOrderTypes & """ align=""right"">Marcus Sales Total:</td>"
m_strTotalRow = m_strTotalRow & "<td colspan=""4"" class=""bigdata"" valign=""top"" style=""border-top:solid black 1pt;"">" & funcBuildNumberInput("UnitTotal2" ,m_joeTotal,10,12,"","class=textnumberdisplay READONLY","","","","Total") & "</td>"

m_strTotalRow = m_strTotalRow & "<td valign=""top"">&nbsp;</td>"
'TO DO: Add New Scout Indicator, added new column with colspan of 2
m_strTotalRow = m_strTotalRow & "<td valign=""top"" colspan=""2"">&nbsp;</td>"

m_strTotalRow = m_strTotalRow & "<tr><th colspan=""20"">" & mc_strReplacementGrandName & " Grand Totals</th></tr>"

m_strTotalRow = m_strTotalRow & "<td valign=""top"" valign=""top"" align=""right"" colspan=""5"" style="";""><i>" & funcBuildNumberInput( "UnitUnallocated",0,10,12,"","class=textnumberdisplay READONLY","","","","TotalNegative") & "</i></td>" 'RJO italics? 
m_strTotalRow = m_strTotalRow & "<td valign=""top"">&lt;-</td>"
m_strTotalRow = m_strTotalRow & "<br><td align=""right"" id=""labelsize"" colspan=""1"">Total Unallocated" '</td>"
m_strTotalRow = m_strTotalRow & "&nbsp;" & funcBuildNumberInput("UnitAllocated",0,10,12,"display:none","class=textnumberdisplay READONLY","","","","Total") & "</td>" 'RJO or could use a new javascript variable to store
m_strTotalRow = m_strTotalRow & "</tr>"
m_strTotalRow = m_strTotalRow & "<tr>"
m_strTotalRow = m_strTotalRow & "<td colspan=""4""""" & m_intNumberOfOrderTypes & """ align=""right"" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Perpetual Scout Sales Total:</td>"
m_strTotalRow = m_strTotalRow & "<td class=""bigdata"" valign=""top"" style=""border-top:solid black 1pt;"">" & funcBuildNumberInput("UnitTotal3",m_grandTotal,10,12,"","class=textnumberdisplay READONLY","","","","Total") & "</td>"
m_strTotalRow = m_strTotalRow & "<td valign=""top"">&nbsp;</td>"
m_strTotalRow = m_strTotalRow & "</tr>"
else

m_strTotalRow = m_strTotalRow & "<tr>"

'TO DO: Add New Scout Indicator handling of colspan, colspan was 2
m_strTotalRow = m_strTotalRow & "<td valign=""top"" colspan=""3"">&nbsp;</td>"
m_strTotalRow = m_strTotalRow & "<td colspan=""4""""" & m_intNumberOfOrderTypes & """ align=""right"">Test Scout Sales Total:</td>"
m_strTotalRow = m_strTotalRow & "<td class=""bigdata"" valign=""top"" align=""right"" style=""border-top:solid black 1pt;"">" & funcBuildNumberInput("UnitTotal4",m_lngUnitTotalAmount,10,12,"","class=textnumberdisplay READONLY","","","","Total") & "</td>"
m_strTotalRow = m_strTotalRow & "<td valign=""top"">&nbsp;</td>"
'TO DO: Add New Scout Indicator, added new column with colspan of 2
m_strTotalRow = m_strTotalRow & "<td valign=""top"" colspan=""2"">&nbsp;</td>"

m_strTotalRow = m_strTotalRow & "</tr>"

'TO DO: Add New Scout Indicator handling of colspan, colspan was 2
'TOTAL RETAIL COLUMN
If m_intSessionLevelID = 4 then
m_strTotalRow = m_strTotalRow & "<td colspan=2>&nbsp;</td>"
elseif m_intSessionLevelID = 5 then
m_strTotalRow = m_strTotalRow & "<td>&nbsp;</td>"
end if
'SPACER COLUMN
m_strTotalRow = m_strTotalRow & "<td>&nbsp;</td>"
'GOAL COLUMNS
m_strTotalRow = m_strTotalRow & "<td class=""toponlyblock"" colspan=2>&nbsp;</td>"
m_strTotalRow = m_strTotalRow & "</tr>"
end if

else
m_strTotalRow = m_strTotalRow & "<td valign=""top"" class=""note"" colspan=""4"" align=""center"">&nbsp;</td>"
m_strTotalRow = m_strTotalRow & _
"<td class=""toponlyblock"" id=""labelsize"" colspan=""2"">&nbsp;</td>" & _
"<td valign=""top"">&nbsp;</td>" & _
"</tr><tr>" & _
"<td valign=""top"" colspan=""10"" class=""note"" align=""center"">" & funcMessage(357) & "</td>" & _
"</tr>"
end if

'== BEGIN Scout Row Footnote Section
'spacer row
'5/5/08 DECLARED EARLIER IN SUB-TOTALS SECTION
'dim m_strNewScoutColSpan
m_strNewScoutColSpan = 7 + m_intNumberOfOrderTypes

m_strTotalRow = m_strTotalRow & "<tr><td colspan=" & 7 + m_strNewScoutColSpan & " class=note>&nbsp;</td></tr>"

'add column description for New Scout indicator
m_strTotalRow = m_strTotalRow & _
"<tr><td colspan=" & 7 + m_strNewScoutColSpan & " class=""note"" align=""center"">" & mc_strNewScoutSymbol & "&nbsp;" & funcMessage(763) & "</td></tr>"
If Len(m_strNewScoutName) > 0 And Len(m_strNewScoutDescription) > 0 Then
m_strTotalRow = Replace(m_strTotalRow, funcMessage(763), m_strNewScoutDescription)
End if 
'== END Scout Row Footnote Section


end if 'view mode check

'
</form>
<%
 
Old May 13th, 2008, 08:59 AM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

It is not entirely clear what your problem is and, don't take offense to this, I don't think anyone is going to wade through such length code. My suggestion might be to create some screen shots and put them up on a site like flickr and just post the URLs to said images. That might be a better bet!

-Doug

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
================================================== =========
.: Wrox Technical Editor / Author :.
Wrox Books 24 x 7
================================================== =========
 
Old May 13th, 2008, 09:33 AM
Registered User
 
Join Date: May 2008
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
quote:Originally posted by dparsons
 It is not entirely clear what your problem is and, don't take offense to this, I don't think anyone is going to wade through such length code. My suggestion might be to create some screen shots and put them up on a site like flickr and just post the URLs to said images. That might be a better bet!

-Doug

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
================================================== =========
.: Wrox Technical Editor / Author :.
Wrox Books 24 x 7
================================================== =========
Hi Doug,

I posted images of the pages on flickr's site.

Here is the url:
http://www.flickr.com/photos/2651092...th/2489785148/

The problem is that currently you will that each list has no subtotals and I want to be able to show subtotals for each sections : Troop, Den, Patrol, etc and then a grand total at the bottom of the page. You put in an amount in the text boxes and it should automatically create a subtotal for each section. There can be more than 3 units it just so happens that on this particular page only shows 3. The page loops through each scout unit. Hopefully this helps.

Thanks





Similar Threads
Thread Thread Starter Forum Replies Last Post
Subtotals bab02 Excel VBA 0 May 21st, 2007 05:56 PM
Pivot Subtotals in Bold paul20091968 Excel VBA 0 June 29th, 2006 07:03 AM
Subtotals in access report using vba bogaerts Pro Visual Basic 2005 0 January 30th, 2006 08:33 AM
how do I show subtotals in an accessreport by vba bogaerts Pro Visual Basic 2005 0 January 30th, 2006 08:32 AM
Dividing Subtotals on a Report Corey Access 12 September 30th, 2005 11:39 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.