nohandlesleft254
IS-IT--Management
Hi,
For some reason the 'GROUP1.DoorCodes' loop is repeating its first value for every output row, yet it is outputting the correct number of rows.
Dont know what im missing!! Can post more info if anyone has an idea...
<!--- PRICE GROUP1 -------------------------------------------------------------------------------------------------------------------------------->
<!--- Reset the GROUP1.MissingItems query for this item --->
<cfif isDefined ('GROUP1.MissingItems')>
<cfset StructDelete(GROUP1, "MissingItems")>
</cfif>
<!--- See if the Item has a recipe --->
<cfquery datasource="#Application.HansaData#" name="FindRecipe">
SELECT
Code,
Item,
Comment,
InQty
FROM RECIPESROW
WHERE Code = '#FindItems.Recepy#'
AND (Item LIKE '%ZZDR%'
OR Item LIKE '%ZZDW%')
</cfquery>
<!--- If the item has a recipe; loop through and add the prices up --->
<cfif FindRecipe.Recordcount gt 0>
<cfset RecipePrice = '0'>
<cfset GROUP1.MissingItems = #QueryNew("Code, Comment, Door")#>
<!--- BEGIN LOOPING THROUGH THE DIFFERENT DOOR STYLES FOR THIS GROUP --->
<cfloop query="GROUP1.DoorCodes">
<!--- If the unit is Glazed; find the default glazing type --->
<cfif ListFindNoCase(FindItems.DispGroups,'GLAZ') GT 0>
<cfquery datasource="#Application.HansaData#" name="FindDefaultGlazing">
SELECT
Code,
Mother,
DefGlazeRange,
DefGlazeRangeDesc
FROM DOORRANGES
WHERE CODE = '#GROUP1.DoorCodes.Code#'
</cfquery>
</cfif>
<!--- Loop through the recipe to find the products --->
<cfloop query="FindRecipe">
<cfquery datasource="#Application.HansaData#" name="FindExtraPrice">
SELECT
Code,
UPrice1,
SubDoor,
DRang,
DrawTyp,
SubDraw
FROM ITEMS
WHERE (SubDoor = '#FindRecipe.Item#'
OR SubDraw = '#FindRecipe.Item#')
<!--- If the unit is glazed; use the FindDefaultGlazing.DefGlazeRange --->
<cfif ListFindNoCase(FindItems.DispGroups,'GLAZ') GT 0>
AND (Drang = '#FindDefaultGlazing.DefGlazeRange#'
OR Drang = '#GROUP1.DoorCodes.Code#'
OR DrawTyp = '#GROUP1.DrawerCode#')
<!--- If the unit is standard; use the GROUP1.DoorCode --->
<cfelse>
AND (Drang = '#GROUP1.DoorCodes.Code#'
OR DrawTyp = '#GROUP1.DrawerCode#')
</cfif>
</cfquery>
<!--- If the Recipe Item exists in the Inventory - Add the price to the RecipePrice Var --->
<cfif FindExtraPrice.Recordcount gt 0>
<cfset RecipePrice = RecipePrice + (FindRecipe.InQty * FindExtraPrice.UPrice1)>
<!--- If the item doesn't exist; find and add the missing item to the GROUP1.MissingItems query --->
<cfelse>
<cfif GROUP1.MissingItems.RecordCount gt 0>
<cfset Row = (GROUP1.MissingItems.RecordCount +1)>
<cfelse>
<cfset Row = 1>
</cfif>
<cfset NewRows = QueryAddRow(GROUP1.MissingItems, 1)>
<cfset QuerySetCell(GROUP1.MissingItems, "Code", FindRecipe.Item, Row)>
<cfset QuerySetCell(GROUP1.MissingItems, "Comment", FindRecipe.Comment, Row)>
<cfset QuerySetCell(GROUP1.MissingItems, "Door", GROUP1.DoorCodes.Code, Row)>
</cfif>
</cfloop>
<!--- If there are no missing items; break the loop --->
<cfif GROUP1.MissingItems.RecordCount eq 0>
<cfbreak>
<cfelse>
<!--- If there are missing items; reset the recipe price ready for another round --->
<cfset RecipePrice = 0>
</cfif>
</cfloop>
<!--- Add the RecipePrice to the Base Price --->
<cfset GROUP1.TotalPrice = RecipePrice + FindItems.UPrice1>
<cfset RecipeExists = 'yes'>
<cfelse>
<!--- If there is no recipe set the total price as the Base Price --->
<cfset GROUP1.TotalPrice = FindItems.UPrice1>
<cfset RecipeExists = 'no'>
</cfif>
<!--- END PRICE GROUP1 ------------------------------------------------------------------------------------------------------------------------------>
For some reason the 'GROUP1.DoorCodes' loop is repeating its first value for every output row, yet it is outputting the correct number of rows.
Dont know what im missing!! Can post more info if anyone has an idea...
<!--- PRICE GROUP1 -------------------------------------------------------------------------------------------------------------------------------->
<!--- Reset the GROUP1.MissingItems query for this item --->
<cfif isDefined ('GROUP1.MissingItems')>
<cfset StructDelete(GROUP1, "MissingItems")>
</cfif>
<!--- See if the Item has a recipe --->
<cfquery datasource="#Application.HansaData#" name="FindRecipe">
SELECT
Code,
Item,
Comment,
InQty
FROM RECIPESROW
WHERE Code = '#FindItems.Recepy#'
AND (Item LIKE '%ZZDR%'
OR Item LIKE '%ZZDW%')
</cfquery>
<!--- If the item has a recipe; loop through and add the prices up --->
<cfif FindRecipe.Recordcount gt 0>
<cfset RecipePrice = '0'>
<cfset GROUP1.MissingItems = #QueryNew("Code, Comment, Door")#>
<!--- BEGIN LOOPING THROUGH THE DIFFERENT DOOR STYLES FOR THIS GROUP --->
<cfloop query="GROUP1.DoorCodes">
<!--- If the unit is Glazed; find the default glazing type --->
<cfif ListFindNoCase(FindItems.DispGroups,'GLAZ') GT 0>
<cfquery datasource="#Application.HansaData#" name="FindDefaultGlazing">
SELECT
Code,
Mother,
DefGlazeRange,
DefGlazeRangeDesc
FROM DOORRANGES
WHERE CODE = '#GROUP1.DoorCodes.Code#'
</cfquery>
</cfif>
<!--- Loop through the recipe to find the products --->
<cfloop query="FindRecipe">
<cfquery datasource="#Application.HansaData#" name="FindExtraPrice">
SELECT
Code,
UPrice1,
SubDoor,
DRang,
DrawTyp,
SubDraw
FROM ITEMS
WHERE (SubDoor = '#FindRecipe.Item#'
OR SubDraw = '#FindRecipe.Item#')
<!--- If the unit is glazed; use the FindDefaultGlazing.DefGlazeRange --->
<cfif ListFindNoCase(FindItems.DispGroups,'GLAZ') GT 0>
AND (Drang = '#FindDefaultGlazing.DefGlazeRange#'
OR Drang = '#GROUP1.DoorCodes.Code#'
OR DrawTyp = '#GROUP1.DrawerCode#')
<!--- If the unit is standard; use the GROUP1.DoorCode --->
<cfelse>
AND (Drang = '#GROUP1.DoorCodes.Code#'
OR DrawTyp = '#GROUP1.DrawerCode#')
</cfif>
</cfquery>
<!--- If the Recipe Item exists in the Inventory - Add the price to the RecipePrice Var --->
<cfif FindExtraPrice.Recordcount gt 0>
<cfset RecipePrice = RecipePrice + (FindRecipe.InQty * FindExtraPrice.UPrice1)>
<!--- If the item doesn't exist; find and add the missing item to the GROUP1.MissingItems query --->
<cfelse>
<cfif GROUP1.MissingItems.RecordCount gt 0>
<cfset Row = (GROUP1.MissingItems.RecordCount +1)>
<cfelse>
<cfset Row = 1>
</cfif>
<cfset NewRows = QueryAddRow(GROUP1.MissingItems, 1)>
<cfset QuerySetCell(GROUP1.MissingItems, "Code", FindRecipe.Item, Row)>
<cfset QuerySetCell(GROUP1.MissingItems, "Comment", FindRecipe.Comment, Row)>
<cfset QuerySetCell(GROUP1.MissingItems, "Door", GROUP1.DoorCodes.Code, Row)>
</cfif>
</cfloop>
<!--- If there are no missing items; break the loop --->
<cfif GROUP1.MissingItems.RecordCount eq 0>
<cfbreak>
<cfelse>
<!--- If there are missing items; reset the recipe price ready for another round --->
<cfset RecipePrice = 0>
</cfif>
</cfloop>
<!--- Add the RecipePrice to the Base Price --->
<cfset GROUP1.TotalPrice = RecipePrice + FindItems.UPrice1>
<cfset RecipeExists = 'yes'>
<cfelse>
<!--- If there is no recipe set the total price as the Base Price --->
<cfset GROUP1.TotalPrice = FindItems.UPrice1>
<cfset RecipeExists = 'no'>
</cfif>
<!--- END PRICE GROUP1 ------------------------------------------------------------------------------------------------------------------------------>