|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Ajax Application Generator Generate database and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now!
|
|
#1
|
|||
|
|||
|
General - Question - Calculating Subtotals and Totals
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 but here is a link to what the page currently looks like:
http://dev.trails-end.com/TESales/ad...BBE7474F0D53C6 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 the code I have. I do realize that this is a lot of code so if you need me to cut it down I can. I would appreciate anybody's help and input, Thank you: Code:
m_strBackgroundColor = "#ffffff"
' get values from session
m_lngSessionGroupId = clng(rsSession("GroupID"))
m_strSessionRole = rsSession("role")
m_lngSessionActorID = clng(rsSession("ActorID"))
m_lngSessionChangeUserID = clng(rsSession("ChangeUserID"))
m_intSessionLevelID = rsSession("LevelID") 'clng()?
m_strSessionDisplayName = rsSession("DisplayName")
m_strAction = (Request("action"))
m_strMode = (Request("mode"))
'if mode is not specified, set the mode to "View" except in the case where editing
if (len(m_strMode) = 0) then
if ((len(m_strAction) = 0) or (m_strAction = "ALLOCATE")) then
m_strMode = "View"
else
m_strMode = "Edit"
end if
end if
'Get GroupID
m_lngGroupId = (Request("GroupID"))
if (len(cstr(m_lngGroupId)) = 0) then
If m_intSessionLevelID = 4 or m_intSessionLevelID = 5 Then
m_lngGroupId = m_lngSessionGroupId
Else
'Required parameter not supplied, or invalid parameter supplied
'Generate and display error
'Set Fatal Error condition
Call m_objError.LogError(CStr(m_objFormatData.funcForma tDate(m_objError, Cstr(Now()),"mm/dd/yy hh:mm:ss")), _
"TE10", _
"The supplied GroupID does not belong to a unit or sub-unit. Only LevelID 4 or 5 groups are permitted.", _
"An invalid identifier for a Unit or Sub-Unit was supplied. Only Unit and Sub-Unit identifiers are valid parameters.", _
"", _
cstr(m_strScriptName & "@Request(""GroupID"")"), _
"10")
Call subManageError(m_blnHasErrorShown)
m_blnIsFatalError = True
End if
'else
' 'Check for GroupID with LevelID of 4 or 5
' Call funcGetGroup(m_lngGroupId, g_lngCurrentSalesCycleId, m_rsGroup, m_blnGetGroupSuccess)
' If funcErrorFree() = True and m_blnGetGroupSuccess = True Then
' If (m_rsGroup.Fields("LevelID").Value = 4 or m_rsGroup.Fields("LevelID").Value = 5) = False Then
' 'Invalid parameter supplied
' 'Generate and display error
' 'Set Fatal Error condition
' Call m_objError.LogError(CStr(m_objFormatData.funcForma tDate(m_objError, Cstr(Now()),"mm/dd/yy hh:mm:ss")), _
' "TE10", _
' "The supplied GroupID does not belong to a unit or sub-unit. Only LevelID 4 or 5 groups are permitted.", _
' "An invalid identifier for a Unit or Sub-Unit was supplied. Only Unit and Sub-Unit identifiers are valid parameters.", _
' "", _
' cstr(m_strScriptName & "@funcGetGroup"), _
' "10")
' Call subManageError(m_blnHasErrorShown)
' m_blnIsFatalError = True
' Else
' 'Valid GroupID
' 'Get the Group's DisplayName
' m_strDisplayName = m_rsGroup.Fields("DisplayName").value
' End if
' Else
' m_blnIsFatalError = True
' End If
end if
'Get Group DisplayName
If IsEmpty(m_strDisplayName) Then
m_strDisplayName = (Request("DisplayName"))
if (len(m_strDisplayName) = 0) then
'Replace Javascript Escape Sequences
m_strDisplayName = Replace(Replace(Replace(m_strDisplayName, "\\", "\"), "\""", """"), "\'", "'")
'm_strDisplayName = Replace(m_strDisplayName, "\'", "'")
If m_intSessionLevelID = 4 or m_intSessionLevelID = 5 Then
m_strDisplayName = m_strSessionDisplayName
End if
end if
End if
'SubUnit's Parent Unit GroupID when a Unit has SubUnits
If m_intSessionLevelID = 4 Then
m_lngUnitGroupID = m_lngSessionGroupId
m_strUnitDisplayName = m_strSessionDisplayName
End If
m_blnPrizeProgram = false
m_htmlMain = ""
m_strScoutRows = ""
'Build Page Title
if m_strMode = "Edit" then
m_strPageTitle = "Edit " & m_strDisplayName & " Scouts"
elseif m_strMode = "View" then
m_strPageTitle = m_strDisplayName & " Scouts and Order Forms"
end if
m_strOnLoad = "funcRefreshForm();"
'Check for Fatal Error Condition
'If Fatal Error, skip all page processing except to display error and build page footer.
If m_blnIsFatalError = False Then
'mode switch
dim m_lngSwitchGroupID
dim m_strSwitchDisplayName
if ((m_strAction = "VIEWMODE") or (m_strAction = "EDITMODE")) then
if (m_strAction = "VIEWMODE") then
m_strMode = "View"
If m_intSessionLevelID <> 4 Then
m_lngSwitchGroupID = m_lngGroupID
m_strSwitchDisplayName = m_strDisplayName
Else
m_lngSwitchGroupID = m_lngUnitGroupID
m_strSwitchDisplayName = m_strUnitDisplayName
End if
else
m_strMode = "Edit"
m_lngSwitchGroupID = m_lngGroupID
m_strSwitchDisplayName = m_strDisplayName
end if
dim m_htmlRedirectLink
m_htmlRedirectLink = m_strScriptName & "?GroupID=" & m_lngSwitchGroupID & "&DisplayName=" & Server.URLEncode(m_strSwitchDisplayName) & "&SID=" & SID & "&mode=" & m_strMode 'change to new mode
Response.Redirect m_htmlRedirectLink
end if
'-------------get order types---------------
dim m_blnCouncilHasOrderTypes
dim m_rsOrderTypes
'dim m_lngUnitsCouncilID
set m_rsOrderTypes = Server.CreateObject("ADODB.recordset")
'm_lngUnitsCouncilID = clng(funcGetCouncilID(m_lngGroupID, clng(g_lngCurrentSalesCycleId)))
'If funcErrorFree() = False Then
' 'display error
' Call subManageError(m_blnHasErrorShown)
' 'Clear the error object's properties and then reset them.
' Call m_objError.ClearError
' Call subResetErrorObjectProperties
'End if
dim m_blnShouldShowOrders
m_blnShouldShowOrders = funcPermit("OR-PC-110-C") and funcPermit("OR-PC-110-E") 'and funcPermit("OR-PC-110-V") removed -jj
set m_rsOrderTypes = funcGetUnitOrderTypes(m_lngGroupID,clng(g_lngCurre ntSalesCycleId))
If funcErrorFree() = False Then
'Error is setup for display in the funcGetUnitOrderTypes method
'Clear the error object's properties and then reset them.
Call m_objError.ClearError
Call subResetErrorObjectProperties
m_blnIsFatalError = True
Else
m_blnCouncilHasOrderTypes = Not (m_rsOrderTypes.BOF and m_rsOrderTypes.EOF)
m_intNumberOfOrderTypes = m_rsOrderTypes.RecordCount
End if
'removed jj : this is really not the right logic. the council has order types, so setting it to false gives wrong results
''RJO later branch off of m_blnShouldShowOrders throughout instead of on m_blnCouncilHasOrderTypes
'if (not m_blnShouldShowOrders) then
' m_blnCouncilHasOrderTypes = false
' m_intNumberOfOrderTypes = 0
'end if
'Check for fatal error state
If m_blnIsFatalError = False Then
dim m_strFormItem
dim m_strFormValue
dim m_arrFormItem
dim m_strDateItem
dim m_lngAddOrderTypeId
dim m_intFormCounter
m_intFormCounter = 0
'_________________________________________________ __________________________________________________ _________________________________BEGIN FORM POST
for each m_strFormItem in Request.Form
if (left(m_strFormItem,5) = "Dirty") then
m_strFormValue = Request.Form(m_strFormItem)
'************************************************ INSERT *************************************************
if (m_strFormValue = "INSERT") then
m_arrFormItem = Split(m_strFormItem, "_")
m_lngScoutID = m_arrFormItem(1)
m_lngFailedScoutID = m_lngScoutID
'if user hasn't simultaneously checked the delete checkbox
if IsEmpty(Request("Delete" & m_strDateItem)) then
if ((trim(funcFormValue("FirstName")) <> "") and (trim(funcFormValue("LastInitial")) <> "")) then
'rjo - straight fields vs. change fields (3)
'TO DO: Add New Scout Indicator
call m_objScoutAdmin.funcCreateScout(m_objError, m_lngGroupId,mc_strDefaultRole,funcFormValue("FirstName"),funcFormValue("LastInitial"),cdbl(funcBlank2Null(funcFormValue("Goal"))),funcCheck2Int(funcFormValue("WantPatch")),funcCheck2Int(funcFormValue("WantPin")))
if not funcIsObjectOK(m_objScoutAdmin, m_strScriptName & "m_objScoutAdmin.funcCreateScout()" ) then
'handle error
CALL subManageError(m_blnHasErrorShown)
m_blnIsInsertError = True
'Call subAddText( m_htmlScreenText, m_objScoutAdmin.Error.TEErrorMessage)
'm_dtPostedFailedInsertDate = m_dtAddDate
m_objScoutAdmin.Error.ClearError
'repopulate error object
Call subResetErrorObjectProperties
end if
end if
end if
'************************************************ UPDATE *************************************************
elseif (m_strFormValue = "UPDATE") then
m_arrFormItem = Split(m_strFormItem, "_")
m_lngScoutID = m_arrFormItem(1)
m_arrFormPost( m_intFormCounter, 0) = m_lngScoutID
m_arrFormError( m_intFormCounter, 0) = m_lngScoutID
'Do the updates
m_arrFormPost( m_intFormCounter, 1) = "???" 'not used
'TO DO: Add New Scout Indicator
call m_objScoutAdmin.subUpdateScout(m_objError, clng(m_lngScoutID), funcFormValue("Role"),funcFormValue("UserName"),funcFormValue("Password"),funcFormValue("FirstName"),funcFormValue("LastInitial"),funcBlank2Null(funcFormValue("Goal")),funcCheck2Int(funcFormValue("WantPatch")), funcCheck2Int(funcFormValue("WantPin")), funcCheck2Int(funcFormValue("NewScout")) )
if not funcIsObjectOK(m_objScoutAdmin, m_strScriptName & "m_objScoutAdmin.subUpdateScout()" ) then
'if the update fails add it to the updateFailedIds string
m_strUpdateFailedIds = m_strUpdateFailedIds & m_lngScoutID & "|"
m_blnIsUpdateError = true
'build error messages into array for later use
m_arrFormError( m_intFormCounter, 1) = m_objScoutAdmin.Error.TEErrorMessage
m_objScoutAdmin.Error.ClearError
'repopulate error object
Call subResetErrorObjectProperties
end if
'************************************************ ALLOCATE *************************************************
'mostly same as "update"?
elseif (m_strFormValue = "ALLOCATE") then
m_arrFormItem = Split(m_strFormItem, "_")
m_lngScoutID = m_arrFormItem(1)
m_lngOrderTypeID = m_arrFormItem(2)
m_arrFormPost( m_intFormCounter, 0) = m_lngScoutID
m_arrFormError( m_intFormCounter, 0) = m_lngScoutID
'Do the updates
m_arrFormPost( m_intFormCounter, 1) = "???" 'not used
call m_objScoutsWithOrders.subModifyScoutAllocation(m_o bjError, clng(m_lngScoutID), clng(m_lngOrderTypeID), clng( funcBlank2Zero(Request.Form("Allocated_" & m_lngScoutID & "_" & m_lngOrderTypeID))) )
if not funcIsObjectOK(m_objScoutsWithOrders, m_strScriptName & "m_objScoutsWithOrders.subModifyScoutAllocation()" ) then
'if the update fails add it to the updateFailedIds string
m_strUpdateFailedIds = m_strUpdateFailedIds & m_lngScoutID & "|"
m_blnIsUpdateError = true
'build error messages into array for later use
m_arrFormError( m_intFormCounter, 1) = m_objScoutsWithOrders.Error.TEErrorMessage
m_objScoutsWithOrders.Error.ClearError
'repopulate error object
Call subResetErrorObjectProperties
end if
end if 'm_strFormValue check
'************************************************ DELETE *************************************************
elseif (left(m_strFormItem,6) = "Delete") then
m_arrFormItem = Split(m_strFormItem, "_")
m_lngScoutID = m_arrFormItem(1)
m_arrFormError( m_intFormCounter, 0) = m_lngScoutID
if isNumeric(m_lngScoutID) then
call m_objScoutAdmin.subDeleteScout(m_objError, clng(m_lngScoutID))
if not funcIsObjectOK(m_objScoutAdmin, m_strScriptName & "m_objScoutAdmin.subDeleteScout()" ) then
'if the Delete fails add it to the updateFailedIds string
m_strUpdateFailedIds = m_strUpdateFailedIds & clng(m_lngScoutID) & "|"
m_blnIsUpdateError = true
'build error messages into array for later use
m_arrFormError( m_intFormCounter, 1) = m_objScoutAdmin.Error.TEErrorMessage
'call subAddText(m_htmlScreenText, m_objScoutAdmin.Error.TEErrorMessage)
m_objScoutAdmin.Error.ClearError
'repopulate error object
Call subResetErrorObjectProperties
end if 'error check
end if 'isnumeric check
end if 'm_strFormItem prefix check
m_intFormCounter = m_intFormCounter + 1
next
'_________________________________________________ __________________________________________________ _________________________________
' END FORM POST
if ((m_strAction = "UPDATE") or (m_strAction = "ALLOCATE")) then
'dim m_htmlRedirectLink
m_htmlRedirectLink = m_strScriptName & "?GroupID=" & m_lngGroupID & "&DisplayName=" & Server.URLEncode(m_strDisplayName) & "&SID=" & SID & "&mode=" & m_strMode 'stay in same mode
If ((not m_blnIsInsertError) and (not m_blnIsUpdateError)) then
Response.Redirect m_htmlRedirectLink
End If
end if
End if 'check for Fatal Error state
End if 'check for Fatal Error state
'************************************************* ** VBSCRIPT FUNCTIONS ********************************************
function funcFormValue(ByVal v_strBaseName)
funcFormValue = Request.Form(v_strBaseName & "_" & m_lngScoutID)
end function
'sub subAddValidation(ByVal v_strInputName, ByVal v_strCondition, ByVal v_strMessage)
' m_strFormValidate = m_strFormValidate & v_strToAppend
'
' " if (" & v_strCondition & ") {" & vbCrLf & _
' " alert(" & v_strMessage & ")" & vbCrLf & _
' " document.forms[0]." & v_strInputName & ".focus()" & vbCrLf & _
' " return false" & vbCrLf & _
' " }" & vbCrLf & vbCrLf
'end sub 'subAddValidation
function funcGetFormValue(ByVal v_lngOrderTypeId, ByVal v_arrFormPost)
'go thru the array and get the form value
dim l_count
dim l_strReturn
l_strReturn = ""
for l_count = 0 to UBOUND(v_arrFormPost)
if clng(v_arrFormPost(l_count, 0)) = clng(v_lngorderTypeId) then
l_strReturn = v_arrFormPost(l_count, 1)
end if
next
funcGetFormValue = l_strReturn
end function
%>
<script language="javascript">
// ************************************************** * JAVASCRIPT FUNCTIONS ********************************************
<%
'/*-------------------------------------------------------------------------------------------------
'Date Created: 4/5/2002
'Original Developer: Bret Updegraff
'---------------------------------------------------------------------------------------------------'
' setPageAction()
'Purpose: This function was created to validate the form on this page
'---------------------------------------------------------------------------------------------------
'INPUT DESCRIPTION
'objForm The form on this page (this.form)
'v_action1 value for the action form field
'v_action2 value for the subAction form field
'OUTPUT DESCRIPTION
'
'RETURN DESCRIPTION
' This function will determine if we need to validate the form before we post it and
' post the form accordingly.
'---------------------------------------------------------------------------------------------------
'Revision History:
'DATE DEVELOPER PURPOSE
'4.5.02 Bret Updegraff Development Complete
'-------------------------------------------------------------------------------------------------*/
%>
function setPageAction(objForm, v_action1, v_action2) {
objForm.action.value = v_action1;
if ((v_action1 == "VIEWMODE") || (v_action1 == "EDITMODE")) {
// objForm.btnSave.disabled = true;
objForm.submit();
return;
}
if (v_action1 == "DELETE") {
blnDoSubmit = confirm('<% = funcMessage(118) %>');
if (blnDoSubmit) {
// objForm.btnSave.disabled = true;
objForm.submit();
} else {
alert('<% = funcMessage(119) %>');
}
}
else {
funcValidateForm( objForm );
}
}
<%
'/*-------------------------------------------------------------------------------------------------
'Date Created: 4/5/2002
'Original Developer: Bret Updegraff
'---------------------------------------------------------------------------------------------------'
' funcValidateForm()
'Purpose: This function was created to validate the form on this page
'---------------------------------------------------------------------------------------------------
'INPUT DESCRIPTION
'objForm The form on this page (this.form)
'OUTPUT DESCRIPTION
'alertBox Alerts the user to what he needs to fix on the form
'RETURN DESCRIPTION
'---------------------------------------------------------------------------------------------------
'Revision History:
'DATE DEVELOPER PURPOSE
'4.5.02 Bret Updegraff Development Complete
'-------------------------------------------------------------------------------------------------*/
%>
function funcValidateForm( objForm ) {
var l_strErrorMsg = "";
var l_blnErrorMsg = false;
if (l_blnErrorMsg == true) {
addFormError( l_strErrorMsg, '<% = funcMessage(48) %>');
alert(l_strErrorMsg);
}
else {
if ((funcValidateNumbers()) && (funcValidateFormElements())) {
//objForm.btnSave.disabled = true;
if (objForm.action.value == 'UPDATE') {
objForm.btnSave.disabled = true;
}
else
{
objForm.btnAllocate.disabled = true;
}
objForm.submit();
}
}
}
function funcDirty(objForm, v_strBaseName, v_strAction) {
//alert('setting ' + v_strBaseName + ' to ' + v_strAction)
eval('objForm.' + 'Dirty_' + v_strBaseName).value = v_strAction
} //funcDirty
// --------------------------------------------------------------------------------------------------
function funcValidateFormElements() {
var l_objForm = document.forms[0]
if (l_objForm.action.value == 'UPDATE') {
var l_objElement;
for (var l_intElement = 0; l_intElement < document.forms[0].elements.length; l_intElement++) {
l_objElement = document.forms[0].elements[l_intElement]
if (((l_objElement.name.search(/FirstName_[^0]/) > -1) || (l_objElement.name.search(/LastInitial_[^0]/) > -1) || (l_objElement.name.search(/UserName_[^0]/) > -1) || (l_objElement.name.search(/Password_[^0]/) > -1)) && (funcTrim(l_objElement.value) == '')) {
alert('<% = funcMessage(475) %>')
l_objElement.focus()
return false
}
if (((l_objElement.name.search(/FirstName_[^0]/) > -1) || (l_objElement.name.search(/UserName_[^0]/) > -1)) && (l_objElement.value.search(/@/) > -1)) {
alert('<% = funcMessage(476) %>')
l_objElement.focus()
return false
}
}
if ( (funcTrim(document.forms[0].FirstName_0.value) == '') != (funcTrim(document.forms[0].LastInitial_0.value) == '') ) {
alert('<% = funcMessage(477) %>')
document.forms[0].FirstName_0.focus()
return false
}
} else if (l_objForm.action.value == 'ALLOCATE') {
//for a given order type, the sum of all allocations must not be more than the total retail
for (var l_intIndex = 0; l_intIndex < m_arrOrderType.length; l_intIndex++) {
var l_lngOrderTypeID = m_arrOrderType[l_intIndex][0]
var l_blnScoutCanOrder = m_arrOrderType[l_intIndex][1]
if ((! l_blnScoutCanOrder) && (! funcIsValidAllocation(l_lngOrderTypeID) )) {
// var l_objAllocated = eval('l_objForm.Allocated_' + v_lngScoutID + '_' + v_lngOrderTypeID)
var l_strOrderTypeName = m_arrOrderType[l_intIndex][3]
var l_curTotalRetail = m_arrOrderType[l_intIndex][2]
alert('<% = funcMessage(478) %>'.replace(/%ORDERTYPENAME%/, l_strOrderTypeName).replace(/%TOTALRETAIL%/, funcFormatNumber(l_curTotalRetail,2,true)))
// l_objAllocated.focus() //RJO hold them here until fix OR allow to exceed temporarily (setting affected totals to ??? or something)
return false
}
}
}
return true
}
function funcScoutID2Index(v_lngScoutID) {
for (var l_intScoutIndex = 0; l_intScoutIndex < m_arrScout.length; l_intScoutIndex++) {
var l_lngScoutID = m_arrScout[l_intScoutIndex][0]
if (v_lngScoutID == l_lngScoutID) {
return l_intScoutIndex
}
}
return -1
}
function funcOrderTypeID2Index(v_lngOrderTypeID) {
for (var l_intOrderTypeIndex = 0; l_intOrderTypeIndex < m_arrOrderType.length; l_intOrderTypeIndex++) {
var l_lngOrderTypeID = m_arrOrderType[l_intOrderTypeIndex][0]
if (v_lngOrderTypeID == l_lngOrderTypeID) {
return l_intOrderTypeIndex
}
}
return -1
}
//for sum across all order types, pass in zero for the order type id
function funcGetTotalOrderTypeAllocation(v_lngOrderTypeID) {
var l_curTotalAllocated = 0
for (var l_intIndex = 0; l_intIndex < m_arrScout.length; l_intIndex++) {
var l_lngScoutID = m_arrScout[l_intIndex][0]
var l_strAllocatedName
if (v_lngOrderTypeID != 0)
l_strAllocatedName = 'Allocated_' + l_lngScoutID + '_' + v_lngOrderTypeID
else
l_strAllocatedName = 'TotalAllocated_' + l_lngScoutID
l_curTotalAllocated += funcGetNumberValue(l_strAllocatedName)
}
return l_curTotalAllocated
}
function funcGetOrderPerUnit(v_lngOrderTypeID) {
var l_curTotalAllocated = 0
for (var l_intIndex = 0; l_intIndex < m_arrScout.length; l_intIndex++) {
var l_lngScoutID = m_arrScout[l_intIndex][0]
var l_strAllocatedName
var l_curTotalUnallocated = l_curTotalRetail - l_curTotalAllocated
if (v_lngOrderTypeID != 0)
l_strAllocatedName = 'Allocated_' + l_lngScoutID + '_' + v_lngOrderTypeID
else
l_strAllocatedName = 'TotalUnallocated_' + l_lngScoutID
l_curTotalAllocated += funcGetNumberValue(l_strAllocatedName)
}
return l_curTotalUnallocated
}
//for sum of retail amounts not assigned to any scout, pass in zero for the scout id
function funcGetTotalScoutAllocation(v_lngScoutID) {
var l_curTotalAllocated = 0
for (var l_intIndex = 0; l_intIndex < m_arrOrderType.length; l_intIndex++) {
var l_lngOrderTypeID = m_arrOrderType[l_intIndex][0]
//regardless of whether scout can order
var l_strAllocatedName
if (v_lngScoutID != 0)
l_strAllocatedName = 'Allocated_' + v_lngScoutID + '_' + l_lngOrderTypeID
else
l_strAllocatedName = 'TotalUnallocated_' + l_lngOrderTypeID
l_curTotalAllocated += funcGetNumberValue(l_strAllocatedName)
}
return l_curTotalAllocated
}
function funcGetTotalScoutAllocation2(v_lngScoutID) {
var l_curTotalAllocated2 = 0
for (var l_intIndex = 0; l_intIndex < m_arrOrderType.length; l_intIndex++) {
var l_lngOrderTypeID = m_arrOrderType[l_intIndex][0]
//regardless of whether scout can order
var l_strAllocatedName2
if (v_lngScoutID != 0)
l_strAllocatedName2 = 'Allocated_' + v_lngScoutID + '_' + l_lngOrderTypeID
else
l_strAllocatedName2 = 'TotalUnallocated_' + l_lngOrderTypeID
l_curTotalAllocated2 += funcGetNumberValue(l_strAllocatedName2)
}
return l_curTotalAllocated
}
function funcIsValidAllocation(v_lngOrderTypeID) {
//total unallocated cannot be negative
var l_curTotalRetail = m_arrOrderType[funcOrderTypeID2Index(v_lngOrderTypeID)][2]
var l_curTotalAllocated = funcGetTotalOrderTypeAllocation(v_lngOrderTypeID)
return (l_curTotalAllocated <= l_curTotalRetail)
}
//pass "this" instead?
function funcChangeAllocation(v_lngScoutID, v_lngOrderTypeID) {
var l_objForm = document.forms[0]
//dirty whether currently valid or not
funcDirty(l_objForm, v_lngScoutID + '_' + v_lngOrderTypeID, 'ALLOCATE')
//refresh regardless
funcRefreshScoutRow(v_lngScoutID)
funcRefreshOrderTypeColumn(v_lngOrderTypeID)
funcRefreshTotals()
if (funcIsValidAllocation(v_lngOrderTypeID)) {
return true
} else {
var l_objAllocated = eval('l_objForm.Allocated_' + v_lngScoutID + '_' + v_lngOrderTypeID)
var l_strOrderTypeName = m_arrOrderType[funcOrderTypeID2Index(v_lngOrderTypeID)][3]
var l_curTotalRetail = m_arrOrderType[funcOrderTypeID2Index(v_lngOrderTypeID)][2]
alert('<% = funcMessage(478) %>'.replace(/%ORDERTYPENAME%/, l_strOrderTypeName).replace(/%TOTALRETAIL%/, funcFormatNumber(l_curTotalRetail,2,true)))
l_objAllocated.focus() //RJO hold them here until fix OR allow to exceed temporarily (setting affected totals to ??? or something)
return false
}
}
function funcRefreshScoutRow(v_lngScoutID) {
var l_curGoal = m_arrScout[funcScoutID2Index(v_lngScoutID)][2]
var l_curTotalAllocated = funcGetTotalScoutAllocation(v_lngScoutID)
funcSetNumberValue('TotalAllocated_' + v_lngScoutID, l_curTotalAllocated)
var l_dblPercent = (l_curTotalAllocated / l_curGoal * 100.0)
if ((isNaN(l_dblPercent)) || (!isFinite(l_dblPercent)))
l_dblPercent = ''
funcSetNumberValue('Percent_' + v_lngScoutID, l_dblPercent)
}
function funcRefreshOrderTypeColumn(v_lngOrderTypeID) {
var l_curTotalRetail = m_arrOrderType[funcOrderTypeID2Index(v_lngOrderTypeID)][2]
var l_curTotalAllocated = funcGetTotalOrderTypeAllocation(v_lngOrderTypeID)
var l_curTotalUnallocated = l_curTotalRetail - l_curTotalAllocated
//RJO blank out the negative values (later ??? instead?)
// if (l_curTotalUnallocated < 0)
// l_curTotalUnallocated = 0 //''
funcSetNumberValue('TotalUnallocated_' + v_lngOrderTypeID, l_curTotalUnallocated)
}
function funcRefreshTotals() {
var l_objForm = document.cevScout;
var l_curUnitAllocated = funcGetTotalOrderTypeAllocation(0);
funcSetNumberValue('UnitAllocated', l_curUnitAllocated)
var l_curUnitUnallocated = funcGetTotalScoutAllocation(0);
funcSetNumberValue('UnitUnallocated', l_curUnitUnallocated)
if (l_objForm.showinputmessage.value == 1){
var l_curTotalAllocated = 0;
for (var l_intIndex = 0; l_intIndex < m_arrOrderType.length; l_intIndex++) {
var l_lngOrderTypeID = m_arrOrderType[l_intIndex][0];
var l_strAllocatedName;
l_strAllocatedName = 'TotalUnallocated_' + l_lngOrderTypeID;
l_curTotalAllocated += funcGetNumberValue(l_strAllocatedName);
<%
'dim m_strOrderName
'm_strOrderName = m_arrOrderType[funcOrderTypeID2Index(l_lngOrderTypeID)][3]
'dim m_strMessage
'm_strMessage = REPLACE(funcMessage(543),"%ordername%" , ).replace(/%ordertotal%/, funcFormatNumber(m_arrOrderType[funcOrderTypeID2Index(l_lngOrderTypeID)][2],2,true))
%>
if (l_curTotalAllocated < 0) {
alert('<% = funcMessage(543) %>'.replace(/%ordername%/g, m_arrOrderType[funcOrderTypeID2Index(l_lngOrderTypeID)][3]).replace(/%ordertotal%/g, funcFormatNumber(m_arrOrderType[funcOrderTypeID2Index(l_lngOrderTypeID)][2],2,true)))
}
}//for
l_objForm.showinputmessage.value = 0;
}//check showinputmessage fields
funcSetNumberValue('UnitTotal', l_curUnitAllocated)
}
//those things not already set up from ASP
function funcRefreshForm() {
//bail out if there are no scouts OR no ordertypes
if ((typeof(m_arrScout) == 'undefined') || (typeof(m_arrOrderType) == 'undefined'))
return
for (var l_intIndex = 0; l_intIndex < m_arrScout.length; l_intIndex++) {
var l_lngScoutID = m_arrScout[l_intIndex][0]
funcRefreshScoutRow(l_lngScoutID)
}
for (l_intIndex = 0; l_intIndex < m_arrOrderType.length; l_intIndex++) {
var l_lngOrderTypeID = m_arrOrderType[l_intIndex][0]
var l_blnScoutCanOrder = m_arrOrderType[l_intIndex][1]
if (! l_blnScoutCanOrder)
funcRefreshOrderTypeColumn(l_lngOrderTypeID)
}
funcRefreshTotals()
}
</script>
<style type="text/css">/* table {border:solid red 2px;} td {border:dotted blue 1px;} */
.highlightLink {
background-color:yellow;
color:blue;
}
</style>
<!--#include virtual="/TESales/inc/_CodeBodyHeader.asp"-->
<%
rw m_htmlScreenText & "<BR>"
m_htmlScreenText = ""
'Only proceed here if page is not in a fatal error state
If m_blnIsFatalError = False Then
%>
<form name="cevScout" method="POST" action="<% = m_strScriptName %>">
<input type=hidden name="SID" value="<% = SID %>">
<input type=hidden name="GroupID" value="<% = m_lngGroupID %>">
<input type=hidden name="DisplayName" value="<% = m_strDisplayName %>">
<input type=hidden name="action" value="<% = m_strAction %>">
<input type=hidden name="showinputmessage" value="1">
<input type=hidden name="mode" value="">
<%
'In page Role Permission Test
if (m_strMode = "View" and funcPermit("AD-UM-110-V")) OR (m_strMode = "Edit" and funcPermit("AD-UM-110-E")) then
call subAttachNumberBehavior("Goal",true,0,0,2,true,false,true,true)
call subAttachNumberBehavior("Allocation",true,0,0,2,true,false,true,true)
call subAttachNumberBehavior("Total",true,0,0,2,true,false,true,true)
call subAttachNumberBehavior("TotalNegative",true,0,0,2,true, true,true,true)
call subAttachNumberBehavior("Percent",false,0,0,0,true,false,true,true)
'BEGIN PERMITTED PAGE CONTENT
dim temp_i
dim m_strScoutHeaderRow
dim m_strGrandTotalHeaderRow
dim m_strScoutRow
dim m_strScoutRows
dim mc_strReplacementGrandName
dim m_strScoutEditRow
dim m_strScoutNewTable
dim m_strScoutNewTableRow
dim m_strButtonRow
dim m_strScoutNewTableHeader
dim m_strScoutOrderTable
dim m_strScoutTable
dim m_strScoutPrizeTable
dim m_strScoutTotalTable
dim m_strUnallocatedRow
dim m_strTotalRow
dim m_strNewScoutName 'column heading
dim m_strNewScoutDescription 'description of column
const mc_strNewScoutDefaultName = "New Scout"
'HTML specification for dagger character = † or †
const mc_strNewScoutSymbol = "†"
const mc_strReplacementGroupName = "%GroupName%"
const mc_strReplacementGroupID = "%GroupID%"
dim m_objData
dim m_rsNewScout
'Get the council specific NewScout Name and Description
set m_objData = Server.CreateObject("DataAccess.clsNoTransact")
set m_rsNewScout = Server.CreateObject("ADODB.Recordset")
set m_rsNewScout = m_objData.GetADORS(m_objError, "prCouncilNewScout_selCouncilNewScout", cstr(m_lngGroupID))
If funcAreRecordsetAndObjectOK(m_rsNewScout, m_objData, m_strScriptName & "@prCouncilNewScout_selCouncilNewScout") = False Then
'display error
Call subManageError(m_blnHasErrorShown)
'Clear the error object's properties and then reset them.
Call m_objError.ClearError
Call subResetErrorObjectProperties
Elseif (m_rsNewScout.EOF And m_rsNewScout.EOF) = False then
m_strNewScoutName = funcNull2Blank(m_rsNewScout.Fields("Name").value)
m_strNewScoutDescription = funcNull2Blank(m_rsNewScout.Fields("Description").Value)
End if
|
|
#2
|
|||
|
|||
|
Here is the rest of the code:
Code:
'------------------ 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
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
'^^^^^^^^^^^^^^^^ SCOUT / ORDER TYPE LOOP ^^^^^^^^^^^^^^^^^^^^^
'Row Totals
m_strScoutRows = m_strScoutRows & " <td align=""right"">" & funcBuildNumberInput("TotalAllocated_" & m_lngScoutID,0,10,12,"background-color:" & m_colChangeBackground,"class=textnumberdisplay READONLY","","","","Total") & "</td>"
'SET GOAL
m_strScoutPercentOfGoal = funcBuildNumberInput("Percent_" & m_lngScoutID,0,10,12,"background-color:" & m_colChangeBackground,"class=textnumberdisplay READONLY","","","","Percent")
if not len(m_curGoal) = 0 then
m_strScoutPercentOfGoal = m_strScoutPercentOfGoal & "%"
end if
else
'SET GOAL
m_strScoutPercentOfGoal = "<i class=""note"">NA</i>"
end if 'council has order types?
m_strScoutRows = m_strScoutRows & " <td class=""collabel"" valign=""bottom""> </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""> </td><td class=""rightblock""> </td>"
m_strScoutRows = m_strScoutRows & "</tr>"
'empty row?
m_strScoutRows = m_strScoutRows & "<tr>"
m_strScoutRows = m_strScoutRows & " <td align=center colspan=" & m_intScoutColspan & ">" & " " & "</td>"
m_strScoutRows = m_strScoutRows & "<td class=""leftblock""> </td><td class=""rightblock""> </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> </td></tr>"
m_strScoutRows = m_strScoutRows & "<tr><td colspan=20 align=center>" & funcMessage(356) & "</td></tr>"
m_strScoutRows = m_strScoutRows & "<tr><td colspan=20> </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 & " "
end if
m_strButtonRow = m_strButtonRow & "</td>"
m_strButtonRow = m_strButtonRow & "</tr>"
else
m_strButtonRow = "<tr>" & _
"<td colspan=""10"" align=""right""> </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""> </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","","","","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""> </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""> </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><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""><-</td>"
m_strTotalRow = m_strTotalRow & "<br><td align=""right"" id=""labelsize"" colspan=""1"">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>"
m_strTotalRow = m_strTotalRow & "<td colspan=""4""""" & m_intNumberOfOrderTypes & """ align=""right"" > 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""> </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""> </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""> </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>"
'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
'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> </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
end if 'view mode check
'------------------------------------------------- HTML ----------------------------------------------------
'BEGIN TABLE
rw "<table cellspacing=""0"" class=""bordered"">"
if m_strMode <> "View" Then
rw m_strScoutHeaderRow
end if
rw m_strScoutRows
if m_strMode = "Edit" and funcPermit("AD-UM-110-C") then
rw "<tr><td colspan=""11""><img src=""/images/clear.gif"" width=3 height=20></td></tr>"
rw m_strScoutNewTableRow
end if
if m_strMode = "View" and funcPermit("AD-UM-110-V") 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
'Additonal Actions Section
if funcPermit("AD-UM-110-C") then
'HEADER
rw "<tr><td colspan=""11""><img src=""/images/clear.gif"" width=3 height=20></td></tr>" & _
"<tr><td colspan=""11"" class=""headlabel"">Additional Actions in " & m_strDisplayName & "...</th></tr>"
'TRANSFER
if funcPermit("AD-UM-110-M") then
rw "<tr><td colspan=""11"">" & _
"<table align=""center""><tr><td>" & _
"<a href=""moveScout.asp?GroupID=" & m_lngGroupId & "&DisplayName=" & Server.URLEncode(m_strDisplayName) & "&SID=" & SID & """>Scout Transfer Area</a>" & _
"</td><td class=""note"">" & _
replace(funcMessage(610),"%Group%",m_strDisplayName)
if rsSession("LevelID") = 4 and m_strMode <> "Edit" then
rw "</td></tr><tr><td colspan=""2"" align=""center"" class=""note"">" & _
funcMessage(615)
end if
rw "</td></tr>"
end if
'MULTIPLE ADD
if m_strMode = "Edit" and funcPermit("AD-UM-110-C") then
rw "<tr><td>" & _
"<a href=""multiScouts.asp?GroupID=" & m_lngGroupId & "&DisplayName=" & Server.URLEncode(m_strDisplayName) & "&SID=" & SID & """>Add Multiple Scouts</a>" & _
"</td><td class=""note"">" & _
replace(funcMessage(611),"%Group%",m_strDisplayName) & _
"</td></tr></table></td></tr>"
end if
end if
rw "</table></td></tr></table>"
'END PERMITTED PAGE CONTENT
else 'Permission test failed
call subInPagePermissionFailed
end if
%>
</form>
<%
|
![]() |
| Viewing: ASP Free Forums > Programming > ASP Development > General - Question - Calculating Subtotals and Totals |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|