webForumDet fria alternativet

Dictionary eller nått annat fint

ASP

40 svar · 1 452 visningar · startad av devotion · sida 2 av 3

Frågan, av devotion

Hej :( Skulle bli väldans glad om någon kunde hjälpa mig med detta... Har följande kod som loopar ut artiklar <% 'Deklarera variabler ' Dim objConn, objRS, objDict, sSQL, dArticlePrice, sCategoryName, sArticleNumber, sArticleName, sArticleUnit, iSupplierId, sSupplierName ' Öppna databasen ' Set objConn = Server.CreateObject("ADODB.Connection") objConn.C

Läs frågan i sin helhet →
Medlem sedan jan. 20013 582 inlägg
#21

Ahhh, du hann före..... (y)

Mvh
henrik

Medlem sedan jan. 20013 582 inlägg
#22

Hmm

Feltyp:
Körningsfel i Microsoft VBScript (0x800A000D)
Inkompatibla typer: '[string: "m"]'
/articles/cart.asp, line 62

Rad 62:

response.write "<tr><td>" & sArticle & "</td><td>" & sArticles(sArticle)(0) & "</td>"

Vanudå???

Mvh
Henrik

Medlem sedan dec. 19996 721 inlägg
#23

Lade du in Array-raden?

Medlem sedan jan. 20013 582 inlägg
#24

Jag tror det...

Men titta gärna:

Do while not objRS.EOF

	sArticles(cstr(objRS("articleName"))) = Array(cstr(objRS("articleUnit")),cstr(objRS("categoryName")))		
	sArticles(cstr(objRS("articleName"))) = cstr(objRS("articleUnit"))
	sKey=cstr(objRS("SupplierId")) & vbTab & cstr(objRS("articleName"))
	
	if not sSupplierarticles.Exists(sKey) then
		set sSupplierArticles(sKey)=CreateObject("Scripting.Dictionary")
	end if
	sSupplierArticles(sKey)(cstr(objRS("articleNumber")))=cdbl(objRS("articlePrice"))
	
	objRs.MoveNext
	
Loop	

response.write "<table><thead><tr><th>Artikelbenämning</th><th>Enhet</th>"

	for each iSupplierId in sSuppliers
		response.write "<th>" & sSuppliers(iSupplierId) & "</th>"
	next

	response.write "</tr></thead><tbody>"

	for each sArticle in sArticles
		response.write "<tr><td>" & sArticle & "</td><td>" & sArticles(sArticle)(0) & "</td>"
		for each iSupplierId in sSuppliers
			response.write "<td>" 
			sKey=iSupplierId & vbTab & sArticle
			if not sSupplierArticles.Exists(sKey) then
				response.write "&nbsp;"
			else
				response.write "<select name=""foo"">" 
				for each sSupplierarticle in sSupplierarticles(sKey)
					Response.write "<option value=""" & sSupplierarticles(sKey)(sSupplierarticle) & """>"& sSupplierarticle & " - " & sSupplierarticles(sKey)(sSupplierarticle) & " kr Kategori: " & sArticles(sArticle)(1) & "</option>"
				next
				Response.write "</select>"
			end if
			response.write "</td>"
		next
		response.write "</tr>"
	next

response.write "</tbody></table>"

Mvh
Henrik

Medlem sedan dec. 19996 721 inlägg
#25

Det gör du, men på raden under skriver du över den igen med samma gamla enhet. Ta bort! Fixa! Kvidevitt!

Och vart tog leverantörslistan vägen? Tror minsann att du bytt ut fel rad.

Medlem sedan jan. 20013 582 inlägg
#26

Men gahhhh.....

det tänkte jag inte på...

Mvh
Henrik

Medlem sedan jan. 20013 582 inlägg
#27

det blir dock inte helt rätt...

Det blir fel kategorier...

titta på:
http://80.73.182.130/articles/Cart.asp

jämför med den bifogfade bilden...

Hmm konstigt...

och sidan på den bifogade länken är jätteful, jag vet.. endast test.. ;)

resultat.jpg
Medlem sedan dec. 19996 721 inlägg
#28

Jaha, jag trodde att kategorin hörde till artikeln, men den hör ju till leverantörsartikeln...

Återställ det gamla och gör motsvarande manöver på leverantörsartikeln i stället

sSupplierArticles(sKey)(cstr(objRS("articleNumber")))=Array(cdbl(objRS("articlePrice")),cstr(objRS("CategoryName")))

'och sSupplierarticles(sKey)(sSupplierarticle)(0) resp. sSupplierarticles(sKey)(sSupplierarticle)(1)
Medlem sedan jan. 20013 582 inlägg
#29

hmm, får inte till det

första raden vet jag vad den ska vara men andra..?

Börjar bli trött..

Set objRS = Server.CreateObject("ADODB.Recordset")
objRS.Open sSQL, objConn, 3, 1

set sSuppliers=CreateObject("Scripting.Dictionary")
set sArticles=CreateObject("Scripting.Dictionary")
set sSupplierArticles=CreateObject("Scripting.Dictionary")

Do while not objRS.EOF

	sSuppliers(cstr(objRS("SupplierId"))) = cstr(objRS("SupplierName"))		
	sArticles(cstr(objRS("articleName"))) = cstr(objRS("articleUnit"))
	sKey=cstr(objRS("SupplierId")) & vbTab & cstr(objRS("articleName"))
	
	if not sSupplierarticles.Exists(sKey) then
		set sSupplierArticles(sKey)=CreateObject("Scripting.Dictionary")
	end if
	[b]sSupplierArticles(sKey)(cstr(objRS("articleNumber")))=Array(cdbl(objRS("articlePrice")),cstr(objRS("CategoryName")))[/b]
	objRs.MoveNext
	
Loop	

response.write "<table><thead><tr><th>Artikelbenämning</th><th>Enhet</th>"

	for each iSupplierId in sSuppliers
		response.write "<th>" & sSuppliers(iSupplierId) & "</th>"
	next

	response.write "</tr></thead><tbody>"

	for each sArticle in sArticles
		response.write "<tr><td>" & sArticle & "</td><td>" & [b]sArticles(sArticle)[/b] & "</td>"
		for each iSupplierId in sSuppliers
			response.write "<td>" 
			sKey=iSupplierId & vbTab & sArticle
			if not sSupplierArticles.Exists(sKey) then
				response.write "&nbsp;"
			else
				response.write "<select name=""foo"">" 
				for each sSupplierarticle in sSupplierarticles(sKey)
					Response.write "<option value=""" & sSupplierarticles(sKey)(sSupplierarticle) & """>"& sSupplierarticle & " - " & sSupplierarticles(sKey)(sSupplierarticle) & " kr Kategori:  </option>"
				next
				Response.write "</select>"
			end if
			response.write "</td>"
		next
		response.write "</tr>"
	next

response.write "</tbody></table>"

objRS.Close
Set objRS = Nothing

objConn.Close
Set objConn = Nothing
Medlem sedan jan. 20013 582 inlägg
#30

får

Körningsfel i Microsoft VBScript (0x800A000D)
Inkompatibla typer: '[undefined]'
/articles/cart.asp, line 61

rad 61

		response.write "<tr><td>" & sArticle & "</td><td>" & sSupplierarticles(sKey)(sSupplierarticle)(0) & "</td>"

Mvh

Medlem sedan jan. 20013 582 inlägg
#31

Glöm mina senaste inlägg!!!

Det fungerar fint nu...

Går och lägger mig!

Tack igen emission!

Mvh
Henrik

Medlem sedan dec. 19996 721 inlägg
#32

Red: Du hann före. Bra! God natt!

Medlem sedan jan. 20013 582 inlägg
#33

Nä, jag vet.... se ovanstående inlägg...

Fick hjärnsläpp...

Det funkar kanon nu!

Mvh
Henrik

Medlem sedan jan. 20013 582 inlägg
#34

Jaha då var det dags igen....

Koden funkar finfint men jag vill ju ha med antalet artiklar från tblCart.

I sql-frågan hämtas ju värdet men jag får inte till det. Nu hämtas bara samma värde hela tiden. Jag har fetmarkerat koden på relevanta ställen.

Mvh
Henrik

<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<% 'Option Explicit %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>

<link href="../css/cart.css" rel="stylesheet" type="text/css" />
</head>
<body>
<%
'Deklarera variabler
'*******************
Dim objConn, objRS, objDict, sSQL, sSuppliers, sSupplierArticles, sArticles, sKey, iSupplierId, sArticle, sSupplierarticle, iArticleAmount

iResultCount = 0

' Öppna databasen
' ***************
Set objConn = Server.CreateObject("ADODB.Connection")
objConn.ConnectionString = Application("sConn")
objConn.Open

sSQL = 	"SELECT tblArticle.articleName, tblArticle.articleUnit, tblPrice.articlePrice, tblSupplier.SupplierName, " &_
		"[B]tblCart.articleAmount[/B], tblSupplier.SupplierId, tblCategory.CategoryName, tblPrice.articleNumber, tblDefaultArticle.defaultArticle " &_
		"FROM tblArticle " &_
		"INNER JOIN tblPrice ON tblArticle.articlenumber = tblPrice.articleNumber " &_
		"INNER JOIN tblSupplier ON tblPrice.articleSupplierId = tblSupplier.SupplierId " &_
		"INNER JOIN tblCart ON tblArticle.articleName = tblCart.articleName " &_
		"INNER JOIN tblCategory ON tblPrice.articleSupplierId = tblCategory.supplierId AND tblPrice.articleCategoryNumber = tblCategory.categoryNumber " &_
		"LEFT OUTER JOIN tblDefaultArticle ON tblPrice.articleSupplierId = tblDefaultArticle.supplierId AND tblPrice.articleNumber = tblDefaultArticle.defaultArticleNumber "&_
		"ORDER BY tblPrice.articlePrice"

Class Article
	Public Name
	Public Unit
End Class

Class SupplierProduct
	Public Product
	Public CheapestArticle
	Public DefaultArticle
	Public Supplier
	Public Articles
	Public Function GetDefaultOrCheapest
		If DefaultArticle Is Nothing then
			Set GetDefaultOrCheapest=CheapestArticle
		Else
			Set GetDefaultOrCheapest=DefaultArticle
		End If
	End Function
	Private Sub Class_Initialize
		Set Articles=CreateObject("Scripting.Dictionary")
		Set CheapestArticle=Nothing
		Set DefaultArticle=Nothing
	End Sub
End Class

Class SupplierArticle
	Public SupplierProduct
	Public ArticleNumber
	Public CategoryName
	Public Price
End Class

Class Supplier
	Public Name
	Public Id
End Class

Set objRS = Server.CreateObject("ADODB.Recordset")
objRS.Open sSQL, objConn, 3, 1

set sSuppliers=CreateObject("Scripting.Dictionary")
set sProducts = CreateObject("Scripting.Dictionary")
set sSupplierProducts=CreateObject("Scripting.Dictionary")

Do while not objRS.EOF
	supplierId=cstr(objRS("SupplierId"))
	supplierName=cstr(objRS("SupplierName"))
	articleName  =cstr(objRS("articleName"))
	articleUnit=cstr(objRS("articleUnit"))
	articlePrice=cdbl(objRS("articlePrice"))
	categoryName=cstr(objRS("CategoryName"))
	articleNumber=cstr(objRS("articleNumber"))
	defaultArticle=cstr(objRS("defaultArticle") & "")
	
	[B]iArticleAmount=cint(objRS("articleAmount"))[/B]
	
	if not sSuppliers.Exists(supplierId) then
		set oSupplier = new Supplier
		oSupplier.Name = supplierName
		oSupplier.Id = supplierId
		set sSuppliers(supplierId)=oSupplier
	else
		set oSupplier = sSuppliers(supplierId)
	end if
	
	if not sProducts.Exists(articleName) then
		set oProduct = new Article
		oProduct.Name=articleName
		oProduct.Unit=articleUnit
		set sProducts(articleName) = oProduct
	else
		set oProduct=sProducts(articleName)
	end if
	
	sKey=supplierId & vbTab & articleName
	
	if not sSupplierProducts.Exists(sKey) then
		set oSupplierProduct=new SupplierProduct
		set oSupplierProduct.Product=oProduct
		set oSupplierProduct.Supplier=oSupplier
		set sSupplierProducts(sKey)=oSupplierProduct
	else
		set oSupplierProduct=sSupplierProducts(sKey)
	end if
	
	set oSupplierArticle=new SupplierArticle
	set oSupplierArticle.SupplierProduct=oSupplierProduct
	oSupplierArticle.ArticleNumber=articleNumber
	oSupplierArticle.CategoryName=categoryName
	oSupplierArticle.Price=articlePrice

	if oSupplierProduct.CheapestArticle is nothing then
		set oSupplierProduct.CheapestArticle=oSupplierArticle
	elseif oSupplierProduct.CheapestArticle.Price>oSupplierArticle.Price then
		set oSupplierProduct.CheapestArticle=oSupplierArticle
	end if

    
	

	if defaultArticle<>"" then
		set oSupplierProduct.DefaultArticle=oSupplierArticle
	end if

	set oSupplierProduct.Articles(articleNumber)=oSupplierArticle

	objRs.MoveNext
	
Loop	

response.write vbTab & "<form action=""changeDefaultArticle.asp"" method=""post"">" & vbCrLf
response.write vbTab & "<table>" & vbCrLf
response.write vbTab & vbTab & "<thead>" & vbCrLf 
response.write vbTab & vbTab & vbTab & "<tr>" & vbCrLf

response.write vbTab & vbTab & vbTab & vbTab & "<th>Artikelbenämning</th>" & vbCrLf 
response.write vbTab & vbTab & vbTab & vbTab & "<th>Enhet</th>" & vbCrLf
response.write vbTab & vbTab & vbTab & vbTab & "<th>Antal</th>" & vbCrLf

	for each iSupplierId in sSuppliers
		set oSupplier=sSuppliers(iSupplierId)
		response.write vbTab & vbTab & vbTab & vbTab & "<th>" & oSupplier.Name & "</th>" & vbCrLf
	next

	response.write vbTab & vbTab & vbTab & "</tr>" & vbCrLf 
	response.write vbTab & vbTab & "</thead>" & vbCrLf
	response.write vbTab & vbTab & "<tbody>" & vbCrLf

	for each sArticleName in sProducts
		set oProduct=sProducts(sArticleName)
		response.write vbTab & vbTab & vbTab & "<tr>" & vbCrLf 
		response.write vbTab & vbTab & vbTab & vbTab & "<td>" & sArticleName & "</td>" & vbCrLf 
		response.write vbTab & vbTab & vbTab & vbTab & "<td>" & oProduct.Unit & "</td>" & vbCrLf
		response.write vbTab & vbTab & vbTab & vbTab & "<td><input type=""text"" size=""4"" id name=""changeAmount"" [B]value=""" & iArticleAmount & """[/B]</td>" & vbCrLf 

		for each iSupplierId in sSuppliers
			set oSupplier=sSuppliers(iSupplierId)
			response.write vbTab & vbTab & vbTab & vbTab & "<td>" & vbCrLf
			sKey=iSupplierId & vbTab & sArticleName
			if not sSupplierProducts.Exists(sKey) then
				response.write "saknas"
			else
				set oSupplierProduct=sSupplierProducts(sKey)
				'Här ska priserna loopas ut
				'*******************************
				iResultCount = iResultCount + 1
			
				response.write vbTab & vbTab & vbTab & vbTab & vbTab & "<span id=""result" & iResultCount & """ style=""visibility:hidden;position:absolute;z-index:20;background-color:white;border:1px solid black;padding:3px;"">" & vbCrLf
				response.write vbTab & vbTab & vbTab & vbTab & vbTab & vbTab & "<ul>" & vbCrLf
				for each sSupplierarticle in oSupplierProduct.Articles
					set oSupplierarticle=oSupplierProduct.Articles(sSupplierarticle)    
					
					Response.Write vbTab & vbTab & vbTab & vbTab & vbTab & vbTab & vbTab & "<li>"
					Response.write "<span onclick=""changeValue('" & Trim(oSupplierArticle.ArticleNumber) & "','" & oSupplierArticle.Price & "','" & oSupplierArticle.CategoryName & "','defaultArticle', " & iResultCount & ", " & iSupplierID & ", '" & sArticleName & "')"" style=""cursor:pointer;color:blue"">" & oSupplierArticle.ArticleNumber & " - " & oSupplierArticle.Price & " - " & oSupplierArticle.CategoryName & "</span></li>" & vbCrLf
				next
				Response.write vbTab & vbTab & vbTab & vbTab & vbTab & vbTab & "</ul>" & vbCrLf
				response.write vbTab & vbTab & vbTab & vbTab & vbTab & "</span>" & vbCrLf
				'******************************************
				
				'Skriv ut länk
				'**********************
				set ComparisonArticle=oSupplierProduct.GetDefaultOrCheapest
				response.write vbTab & vbTab & vbTab & vbTab & vbTab & vbTab & "<a id=""link" & iResultCount & """ href=""#"" onclick=""chooseResultContainer('result" & iResultCount & "'); return showResults(event,this)"" style=""color:blue;text-decoration:none"" title=""" & oSupplierArticle.CategoryName & """>" & Trim(ComparisonArticle.ArticleNumber) & " - " & ComparisonArticle.Price & " kr</a>" & vbCrLf
				response.write vbTab & vbTab & vbTab & vbTab & vbTab & vbTab & "<input type=""hidden"" name=""defaultArticle" & iResultCount & """ id=""defaultArticle" & iResultCount & """ value=""" & ComparisonArticle.ArticleNumber & "|" & oSupplier.Id & "|" & sArticleName & """>" & vbCrLf
			'**********************************
			end if
			response.write vbTab & vbTab & vbTab & vbTab & "</td>" & vbCrLf
		next
		response.write vbTab & vbTab & vbTab & "</tr>" & vbCrLf
	next

response.write vbTab & vbTab & "</tbody>" & vbCrLf
response.write vbTab & "</table>" & vbCrLf
response.write vbTab & "<input name=""update"" type=""submit"" value=""Uppdatera"" />" & vbCrLf
response.write vbTab & "</form>" & vbCrLf

objRS.Close
Set objRS = Nothing

objConn.Close
Set objConn = Nothing

set sSuppliers = Nothing
set sArticles = Nothing
set sSupplierArticles = Nothing
%>
</body>
</html>
Medlem sedan dec. 19996 721 inlägg
#35

Du hämtar ut antalet, men använder det inte? Du får lägga till ett fält på Article
eller SupplierArticle och stoppa in värdet där.

Medlem sedan jan. 20013 582 inlägg
#36

:)
Skulle du kunna utveckla det lite... Denna koden har ju du gjort det mesta av och det är lite över min förmåga....

Mvh
Henrik

Medlem sedan dec. 19996 721 inlägg
#37

Då förelår jag att du försöker först själv, enligt mina knappa instruktioner. Om det är kod som du ska underhålla så måste du förstå den också :)

Medlem sedan jan. 20013 582 inlägg
#38

okej!

:)

Medlem sedan jan. 20013 582 inlägg
#39

:)

Hej!

Jag gjorde så här och det fjunkade.... Mina tillägg i fetstil! Tack emission, ibland kan man behöva en spark i rätt riktning.. Det var ju inte så svårt... :)

Mvh
Henrik

<%
'Deklarera variabler
'*******************
Dim objConn, objRS, objDict, sSQL, sSuppliers, sSupplierArticles, sArticles, sKey, iSupplierId, sArticle, sSupplierarticle, articleAmount

iResultCount = 0

' Öppna databasen
' ***************
Set objConn = Server.CreateObject("ADODB.Connection")
objConn.ConnectionString = Application("sConn")
objConn.Open

sSQL = 	"SELECT tblArticle.articleName, tblArticle.articleUnit, tblPrice.articlePrice, tblSupplier.SupplierName, " &_
		"tblCart.articleAmount, tblSupplier.SupplierId, tblCategory.CategoryName, tblPrice.articleNumber, tblDefaultArticle.defaultArticle " &_
		"FROM tblArticle " &_
		"INNER JOIN tblPrice ON tblArticle.articlenumber = tblPrice.articleNumber " &_
		"INNER JOIN tblSupplier ON tblPrice.articleSupplierId = tblSupplier.SupplierId " &_
		"INNER JOIN tblCart ON tblArticle.articleName = tblCart.articleName " &_
		"INNER JOIN tblCategory ON tblPrice.articleSupplierId = tblCategory.supplierId AND tblPrice.articleCategoryNumber = tblCategory.categoryNumber " &_
		"LEFT OUTER JOIN tblDefaultArticle ON tblPrice.articleSupplierId = tblDefaultArticle.supplierId AND tblPrice.articleNumber = tblDefaultArticle.defaultArticleNumber "&_
		"ORDER BY tblPrice.articlePrice"

Class Article
	Public Name
	Public Unit
	[b]Public Amount[/b]
End Class

Class SupplierProduct
	Public Product
	Public CheapestArticle
	Public DefaultArticle
	Public Supplier
	Public Articles
	Public Function GetDefaultOrCheapest
		If DefaultArticle Is Nothing then
			Set GetDefaultOrCheapest=CheapestArticle
		Else
			Set GetDefaultOrCheapest=DefaultArticle
		End If
	End Function
	Private Sub Class_Initialize
		Set Articles=CreateObject("Scripting.Dictionary")
		Set CheapestArticle=Nothing
		Set DefaultArticle=Nothing
	End Sub
End Class

Class SupplierArticle
	Public SupplierProduct
	Public ArticleNumber
	Public CategoryName
	Public Price
End Class

Class Supplier
	Public Name
	Public Id
End Class

Set objRS = Server.CreateObject("ADODB.Recordset")
objRS.Open sSQL, objConn, 3, 1

set sSuppliers=CreateObject("Scripting.Dictionary")
set sProducts = CreateObject("Scripting.Dictionary")
set sSupplierProducts=CreateObject("Scripting.Dictionary")

Do while not objRS.EOF
	supplierId=cstr(objRS("SupplierId"))
	supplierName=cstr(objRS("SupplierName"))
	articleName  =cstr(objRS("articleName"))
	articleUnit=cstr(objRS("articleUnit"))
	articlePrice=cdbl(objRS("articlePrice"))
	categoryName=cstr(objRS("CategoryName"))
	articleNumber=cstr(objRS("articleNumber"))
	defaultArticle=cstr(objRS("defaultArticle") & "")
	
	articleAmount=cint(objRS("articleAmount"))
	
	if not sSuppliers.Exists(supplierId) then
		set oSupplier = new Supplier
		oSupplier.Name = supplierName
		oSupplier.Id = supplierId
		set sSuppliers(supplierId)=oSupplier
	else
		set oSupplier = sSuppliers(supplierId)
	end if
	
	if not sProducts.Exists(articleName) then
		set oProduct = new Article
		oProduct.Name=articleName
		oProduct.Unit=articleUnit
		[b]oProduct.Amount=articleAmount[/b]
		set sProducts(articleName) = oProduct
	else
		set oProduct=sProducts(articleName)
	end if
	
	sKey=supplierId & vbTab & articleName
	
	if not sSupplierProducts.Exists(sKey) then
		set oSupplierProduct=new SupplierProduct
		set oSupplierProduct.Product=oProduct
		set oSupplierProduct.Supplier=oSupplier
		set sSupplierProducts(sKey)=oSupplierProduct
	else
		set oSupplierProduct=sSupplierProducts(sKey)
	end if
	
	set oSupplierArticle=new SupplierArticle
	set oSupplierArticle.SupplierProduct=oSupplierProduct
	oSupplierArticle.ArticleNumber=articleNumber
	oSupplierArticle.CategoryName=categoryName
	oSupplierArticle.Price=articlePrice

	if oSupplierProduct.CheapestArticle is nothing then
		set oSupplierProduct.CheapestArticle=oSupplierArticle
	elseif oSupplierProduct.CheapestArticle.Price>oSupplierArticle.Price then
		set oSupplierProduct.CheapestArticle=oSupplierArticle
	end if

    
	

	if defaultArticle<>"" then
		set oSupplierProduct.DefaultArticle=oSupplierArticle
	end if

	set oSupplierProduct.Articles(articleNumber)=oSupplierArticle

	objRs.MoveNext
	
Loop	

response.write vbTab & "<form action=""changeDefaultArticle.asp"" method=""post"">" & vbCrLf
response.write vbTab & "<table>" & vbCrLf
response.write vbTab & vbTab & "<thead>" & vbCrLf 
response.write vbTab & vbTab & vbTab & "<tr>" & vbCrLf

response.write vbTab & vbTab & vbTab & vbTab & "<th>Artikelbenämning</th>" & vbCrLf 
response.write vbTab & vbTab & vbTab & vbTab & "<th>Enhet</th>" & vbCrLf
response.write vbTab & vbTab & vbTab & vbTab & "<th>Antal</th>" & vbCrLf

	for each iSupplierId in sSuppliers
		set oSupplier=sSuppliers(iSupplierId)
		response.write vbTab & vbTab & vbTab & vbTab & "<th>" & oSupplier.Name & "</th>" & vbCrLf
	next

	response.write vbTab & vbTab & vbTab & "</tr>" & vbCrLf 
	response.write vbTab & vbTab & "</thead>" & vbCrLf
	response.write vbTab & vbTab & "<tbody>" & vbCrLf

	for each sArticleName in sProducts
		set oProduct=sProducts(sArticleName)
		response.write vbTab & vbTab & vbTab & "<tr>" & vbCrLf 
		response.write vbTab & vbTab & vbTab & vbTab & "<td>" & sArticleName & "</td>" & vbCrLf 
		response.write vbTab & vbTab & vbTab & vbTab & "<td>" & oProduct.Unit & "</td>" & vbCrLf
		response.write vbTab & vbTab & vbTab & vbTab & "<td><input type=""text"" size=""4"" id name=""changeAmount"" value=""" & [b]oProduct.Amount[/b] & """></td>" & vbCrLf 

		for each iSupplierId in sSuppliers
			set oSupplier=sSuppliers(iSupplierId)
			response.write vbTab & vbTab & vbTab & vbTab & "<td>" & vbCrLf
			sKey=iSupplierId & vbTab & sArticleName
			if not sSupplierProducts.Exists(sKey) then
				response.write "saknas"
			else
				set oSupplierProduct=sSupplierProducts(sKey)
				'Här ska priserna loopas ut
				'*******************************
				iResultCount = iResultCount + 1
			
				response.write vbTab & vbTab & vbTab & vbTab & vbTab & "<span id=""result" & iResultCount & """ style=""visibility:hidden;position:absolute;z-index:20;background-color:white;border:1px solid black;padding:3px;white-space:nowrap;"">" & vbCrLf
				response.write vbTab & vbTab & vbTab & vbTab & vbTab & vbTab & "<ul>" & vbCrLf
				for each sSupplierarticle in oSupplierProduct.Articles
					set oSupplierarticle=oSupplierProduct.Articles(sSupplierarticle)    
					
					Response.Write vbTab & vbTab & vbTab & vbTab & vbTab & vbTab & vbTab & "<li>"
					Response.write "<span onclick=""changeValue('" & Trim(oSupplierArticle.ArticleNumber) & "','" & oSupplierArticle.Price & "','" & oSupplierArticle.CategoryName & "','defaultArticle', " & iResultCount & ", " & iSupplierID & ", '" & sArticleName & "')"" style=""cursor:pointer;color:blue"">" & oSupplierArticle.ArticleNumber & " - " & oSupplierArticle.Price & " - " & oSupplierArticle.CategoryName & "</span></li>" & vbCrLf
				next
				Response.write vbTab & vbTab & vbTab & vbTab & vbTab & vbTab & "</ul>" & vbCrLf
				response.write vbTab & vbTab & vbTab & vbTab & vbTab & "</span>" & vbCrLf
				'******************************************
				
				'Skriv ut länk
				'**********************
				set ComparisonArticle=oSupplierProduct.GetDefaultOrCheapest
				response.write vbTab & vbTab & vbTab & vbTab & vbTab & vbTab & "<a id=""link" & iResultCount & """ href=""#"" onclick=""chooseResultContainer('result" & iResultCount & "'); return showResults(event,this)"" style=""color:blue;text-decoration:none"" title=""" & oSupplierArticle.CategoryName & """>" & Trim(ComparisonArticle.ArticleNumber) & " - " & ComparisonArticle.Price & " kr</a>" & vbCrLf
				response.write vbTab & vbTab & vbTab & vbTab & vbTab & vbTab & "<input type=""hidden"" name=""defaultArticle" & iResultCount & """ id=""defaultArticle" & iResultCount & """ value=""" & ComparisonArticle.ArticleNumber & "|" & oSupplier.Id & "|" & sArticleName & """>" & vbCrLf
			'**********************************
			end if
			response.write vbTab & vbTab & vbTab & vbTab & "</td>" & vbCrLf
		next
		response.write vbTab & vbTab & vbTab & "</tr>" & vbCrLf
	next

response.write vbTab & vbTab & "</tbody>" & vbCrLf
response.write vbTab & "</table>" & vbCrLf
response.write vbTab & "<input name=""update"" type=""submit"" value=""Uppdatera"" />" & vbCrLf
response.write vbTab & "</form>" & vbCrLf

objRS.Close
Set objRS = Nothing

objConn.Close
Set objConn = Nothing

set sSuppliers = Nothing
set sArticles = Nothing
set sSupplierArticles = Nothing
%>
Medlem sedan dec. 19996 721 inlägg
#40

Perfa! :bire

270 ms totalt · 4 externa anrop · v20260731065814-full.a51de22e
123 ms — deklarationer (db)
0 ms — hämta statistik (cache)
144 ms — hämta tråd, inlägg och bilagor (db)
120 ms — ändringar (db)