<% Response.Buffer = True %> <% Response.Expires = -1442 %> <% Dim dimma, ladda_korg, nutid nutid = left(now(),10) dimma = true ladda_korg = false if Request.QueryString("korg") = 1 then ladda_korg = true end if bild_namn = Request.QueryString("bild") if bild_namn = "" then bild_namn = Request.Form("bild") end if if bild_namn = "" then dimma = false bild_namn = Session("bildnamn") end if if bild_namn = "" then dimma = false bild_namn = "logobkg.jpg" end if 'Spara bildnamnet till nästa gång top.asp laddas Session("bildnamn") = bild_namn ' ========================================================================== ' Sätter SessID till det sessionID som kunden har ' ========================================================================== SessID = Session.SessionID ''-----------------------------------------------------------------'' '' Läs in form-parametrar ''-----------------------------------------------------------------'' prodid = "" prodant = "" for each MyItem in Request.Form if not MyItem = "submit" then if left(MyItem,6) = "frmSt_" then prodid = mid(MyItem,7) prodant = Request.Form(MyItem).Item end if end if next if prodant <> "" then if instr(prodant,".") then prodant=left(prodant,instr(prodant,".")-1) end if if instr(prodant,",") then prodant=left(prodant,instr(prodant,",")-1) end if end if if prodant < "1" then prodid = "" prodant = "" end if ' ========================================================================== ' Öppna databasen ' ========================================================================== Set Connect = Server.CreateObject("ADODB.Connection") Connect.Open DBpath Set ArtSet = Server.CreateObject("ADODB.Recordset") if prodid <> "" then ''-----------------------------------------------------------------'' '' Leta upp artikel ''-----------------------------------------------------------------'' SQLstr = " SELECT * FROM art " &_ " WHERE id = " & prodid ArtSet.Open SQLstr, Connect, adOpenStatic, adLockOptimistic If Not ArtSet.EOF Then KatID = ArtSet("katid") if ArtSet("tilbud") then prodpris = ArtSet("xpris") else prodpris = ArtSet("pris") end if End If ArtSet.Close SQLstr = " SELECT * FROM korg " &_ " WHERE (kundid = " & SessId &_ " AND prodid = " & prodid & ")" ArtSet.Open SQLstr, Connect, adOpenStatic, adLockOptimistic If ArtSet.EOF Then ArtSet.Addnew ArtSet("kundid") = SessId ArtSet("katid") = KatID ArtSet("prodid") = prodid ArtSet("pris") = prodpris ArtSet("antal") = prodant else ArtSet("antal") = ArtSet("antal") + prodant end if ArtSet.Update ArtSet.Close end if ''-----------------------------------------------------------------'' '' Räkna ihop korginnehåll (Antal och totalpris) ''-----------------------------------------------------------------'' korg_antal = 0 korg_total = 0 SQLstr = " SELECT pris, antal FROM korg " &_ " WHERE kundid = " & SessId ArtSet.Open SQLstr, Connect, adOpenStatic, adLockOptimistic If not ArtSet.EOF Then do until ArtSet.EOF korg_antal = korg_antal + ArtSet("antal") korg_total = korg_total + (ArtSet("antal")*ArtSet("pris")) ArtSet.MoveNext loop end if ''-----------------------------------------------------------------'' '' Stäng databasobject ''-----------------------------------------------------------------'' Connect.Close Set ArtSet = nothing Set Connect = nothing Function FixValuta(prisuppgift) prisuppgift = replace(prisuppgift,".",",") if Instr(prisuppgift,",") < 1 then prisuppgift = prisuppgift & "," end if prisuppgift = prisuppgift & "00" FixValuta = left(prisuppgift,instr(prisuppgift,",")+2) & " kr" 'FixValuta = left(prisuppgift,instr(prisuppgift,",")-1) & " kr." 'FixValuta = prisuppgift End Function %> hyrporslin.nu <% if dimma then %> <% end if %>
image
image
© webbasen 2007     
<% if ladda_korg then %> <% end if %>