mldardy
May 12th, 2008, 07:37 PM
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 but here is a link to what the page currently looks like:
http://dev.trails-end.com/TESales/admin/user/cevScout.asp?SID=8E09D7BB52774294BAC0C086B179026B
What I want it to look like is to have subtotals under each unit:Troop, Den, Patrol and then a Grand Total at the bottom.
I am not sure if I am allowed to do this but here is ta portion of the code I have. I will include the rest of it in another post. I would appreciate anybody's help and input, Thank you:
'--------------------------------------------- ROWS -------------------------------------------------
if m_blnCouncilHasOrderTypes then
set m_rsScouts = m_objScoutsWithOrders.funcSelectScoutOrderTypeAllo cation(m_objError, m_lngGroupID,clng(g_lngCurrentSalesCycleId))
else
set m_rsScouts = m_objScoutsWithOrders.funcSelectScoutsByUnitSubUni t(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>" & " " & "</td>"
m_strScoutRows = m_strScoutRows & "<td> </td><td> </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""> </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""> 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""> </td>"
end if
end if 'OT allows scout orders
else
m_strTotalRow = m_strTotalRow & "<td valign=""top"" align=""right""> </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""><-</td>"
m_strTotalRow = m_strTotalRow & "<td class=""toponlyblock"" id=""labelsize"" colspan=""2"">Total Unallocated" '</td>"
m_strTotalRow = m_strTotalRow & " " & 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""> </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""> </td>"
'TO DO: Add New Scout Indicator, added new column with colspan of 2
m_strTotalRow = m_strTotalRow & "<td valign=""top"" colspan=""2""> </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> </td>"
elseif m_intSessionLevelID = 5 then
m_strTotalRow = m_strTotalRow & "<td> </td>"
end if
'SPACER COLUMN
m_strTotalRow = m_strTotalRow & "<td> </td>"
'GOAL COLUMNS
m_strTotalRow = m_strTotalRow & "<td class=""toponlyblock"" colspan=2> </td>"
m_strTotalRow = m_strTotalRow & "</tr>"
end if
else
m_strTotalRow = m_strTotalRow & "<td valign=""top"" class=""note"" colspan=""4"" align=""center""> </td>"
m_strTotalRow = m_strTotalRow & _
"<td class=""toponlyblock"" id=""labelsize"" colspan=""2""> </td>" & _
"<td valign=""top""> </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> </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 & " " & 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""> </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""> </td>"
'TO DO: Add New Scout Indicator, added new column with colspan of 2
m_strTotalRow = m_strTotalRow & "<td valign=""top"" colspan=""2""> </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 & "<small>[" & funcTextPopup(m_strCheckOrdering,"Help") & "] </small>"
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_strAllocat edStyle,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
http://dev.trails-end.com/TESales/admin/user/cevScout.asp?SID=8E09D7BB52774294BAC0C086B179026B
What I want it to look like is to have subtotals under each unit:Troop, Den, Patrol and then a Grand Total at the bottom.
I am not sure if I am allowed to do this but here is ta portion of the code I have. I will include the rest of it in another post. I would appreciate anybody's help and input, Thank you:
'--------------------------------------------- ROWS -------------------------------------------------
if m_blnCouncilHasOrderTypes then
set m_rsScouts = m_objScoutsWithOrders.funcSelectScoutOrderTypeAllo cation(m_objError, m_lngGroupID,clng(g_lngCurrentSalesCycleId))
else
set m_rsScouts = m_objScoutsWithOrders.funcSelectScoutsByUnitSubUni t(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>" & " " & "</td>"
m_strScoutRows = m_strScoutRows & "<td> </td><td> </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""> </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""> 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""> </td>"
end if
end if 'OT allows scout orders
else
m_strTotalRow = m_strTotalRow & "<td valign=""top"" align=""right""> </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""><-</td>"
m_strTotalRow = m_strTotalRow & "<td class=""toponlyblock"" id=""labelsize"" colspan=""2"">Total Unallocated" '</td>"
m_strTotalRow = m_strTotalRow & " " & 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""> </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""> </td>"
'TO DO: Add New Scout Indicator, added new column with colspan of 2
m_strTotalRow = m_strTotalRow & "<td valign=""top"" colspan=""2""> </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> </td>"
elseif m_intSessionLevelID = 5 then
m_strTotalRow = m_strTotalRow & "<td> </td>"
end if
'SPACER COLUMN
m_strTotalRow = m_strTotalRow & "<td> </td>"
'GOAL COLUMNS
m_strTotalRow = m_strTotalRow & "<td class=""toponlyblock"" colspan=2> </td>"
m_strTotalRow = m_strTotalRow & "</tr>"
end if
else
m_strTotalRow = m_strTotalRow & "<td valign=""top"" class=""note"" colspan=""4"" align=""center""> </td>"
m_strTotalRow = m_strTotalRow & _
"<td class=""toponlyblock"" id=""labelsize"" colspan=""2""> </td>" & _
"<td valign=""top""> </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> </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 & " " & 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""> </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""> </td>"
'TO DO: Add New Scout Indicator, added new column with colspan of 2
m_strTotalRow = m_strTotalRow & "<td valign=""top"" colspan=""2""> </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 & "<small>[" & funcTextPopup(m_strCheckOrdering,"Help") & "] </small>"
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_strAllocat edStyle,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