30. januar 2004 - 23:30
				#18
						
		 
		
			<html><%
Set Connect = Server.CreateObject("ADODB.Connection") 
Connect.Open "driver={Microsoft Access Driver (*.mdb)};dbq=" &Server.MapPath("webshop.mdb")
Session.Lcid = 1053
%>
<!--#include file="installningar.asp" -->
<%
Function kollabild(text)
dim filesys, newfolder
set filer = CreateObject("Scripting.FileSystemObject")
mappen = Server.MapPath(mapp)
If Not filer.FolderExists(mappen) Then
filer.CreateFolder mappen
End If
filen = mapp & "/" & text & ".gif"
If Not filer.FileExists(Server.MapPath(filen)) Then
Response.Write "bilder/nopicture.gif"
Else
Response.Write "filer/" & text & ".gif"
End if
Set filer = Nothing
End Function
%>
<head>
<title>Webshop</title>
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body bgcolor="#D2DCE6" text="#000000" leftmargin="" topmargin="0">
<table width="670" border="0" align="center" cellpadding="0" cellspacing="0" style="border-left: #000000 1px solid;border-right: #000000 1px solid;border-bottom: #000000 1px solid">
  <tr> 
    <td height="82" align="left" valign="top"><img src="images/default_asp_smartbutton1.gif" border="0"></td>
  </tr>
  <tr> 
    <td background="bilder/meny_inbg.gif"> 
      <table border="0" cellspacing="0" cellpadding="5" width="100%">
        <tr>
          <td width="165" valign="top"> 
            <table border="0" cellspacing="0" cellpadding="0" width="140">
              <tr>
                <td valign="top"> 
                  <p style="margin-top:1; margin-bottom:0;"><b><img src="tr.gif" width="7" height="6">Produkter</b></p>
                                    <p style="margin-top:1; margin-bottom:0;"><%
                    SQL = "SELECT id, namn FROM kategorier ORDER BY namn"
                    Set RecSet = Connect.Execute(SQL)
                    IF RecSet.EOF then
                    Response.Write "<i>Inga kategorier inlagda...</i>"
                    ELSE
                    Do until RecSet.EOF
                    Response.Write "<img src='bilder/h_pil.gif' width=4 height=6>"
                    Response.Write " <a href='default.asp?category=" & RecSet("id") & "'>"
                    Response.Write RecSet("namn") & "</a><br>"
                    RecSet.MoveNext
                    Loop
                    END IF
                    RecSet.Close
                    Set RecSet = nothing
                    IF Len(Session("nyprod")) > 0 then
                    Response.Write "<br>" & Session("nyprod")
                    Session("nyprod") = ""
                    END IF
                    %></p>
                  </td>
              </tr>
            </table>
            <div align="center"><br>
              <a href="/default.asp?show=kundvagn"><img src="bilder/img1.gif" width="124" height="22" border="0" alt="img1.gif"></a><br>
              <a href="/default.asp?show=kassa"><img src="bilder/img4.gif" width="124" height="22" border="0" alt="img4.gif"></a></div>
          </td>
          <td valign="top"> 
            <%
          kat = Request.Querystring("category")
          IF Len(kat) > 0 then 
          SQL = "SELECT * FROM produkter WHERE kat =" & kat & " ORDER BY namn"
          Set RecSet = Connect.Execute(SQL)
          
          IF RecSet.EOF then
          Response.Write "Inga artiklar hittades..."
          ELSE
          Do until RecSet.EOF
          %>
            <table width="100%" border="0" cellspacing="0" cellpadding="0">
              <tr> 
                <td width="126" height="120" valign="top"><img src="<%=kollabild(RecSet("id"))%>" width="120" height="120"></td>
                <td valign="top"><table width="100%" height="120" border="0" cellpadding="0" cellspacing="0">
                    <tr> 
                      <td valign="top"> 
                        <%
Response.Write "<b>Produktnamn:</b> " & RecSet("namn") & "<br>"
Response.Write "<b>Artikelnummer:</b> " & RecSet("artnr") & "<br><br>"
Response.Write "<b>Beskrivning:</b> <br>" & RecSet("beskrivning") & " "
%>
                      </td>
                    </tr>
                    <tr>
                      <td height="20" valign="bottom"> 
                        <form name="form1" method="post" action="spara.asp?id=<%=RecSet("id")%>&namn=<%=RecSet("namn")%>&pris=<%=RecSet("pris")%>">
                          <table width="100%" border="0" cellpadding="0" cellspacing="0">
                            <tr> 
                              <td><%
Response.Write "<b>Pris:</b> "
pris = RecSet("pris")
pris2 = FormatCurrency(pris,2)
pris2 = Replace(pris2,",00","")
Response.Write pris2
IF inklmoms = 1 then
Response.Write " Inkl. moms"
ELSE
Response.Write " Exkl. moms"
END IF
Response.Write "</td>"
                             %></td>
 <td> <div align="right"> 
                                  <input name="antal" type="text" style="background: #A2B1C2; border: #85A0B8 1px solid; font-family: verdana; font-size: 10px" value="1" size="3" maxlength="4">
                                  <input type="submit" name="Submit" value="Lägg i kundvagn" style="background: #85A0B8; border: #85A0B8 1px solid; font-family: verdana; font-size: 10px">
                                </div></td>
                            </tr>
                          </table>
                        </form></td>
                    </tr>
                  </table>
                  
                </td>
              </tr>
              <tr colspan=2>
                <td>    </td>
                                <td></td>
              </tr>
            </table>
            <%
            RecSet.MoveNext
            Loop
            END IF
            RecSet.Close
            Set RecSet = Nothing
            
            ELSEIF Request("show") = "kundvagn" then
            %>
            <table width="100%" border="0" cellspacing="0" cellpadding="0">
              <tr> 
                <td valign="top">Indkøbsvong   <span class="vit"><br>
                  </span>
                  <table width="100%" border="0" cellpadding="0" cellspacing="0">
                    <%
varde = Request.Cookies(""& Session.SessionID &"")
hamta = Split(varde,"&")
ReDim MyArray(4,Ubound(hamta))
for x = 0 to ubound(hamta)
hamta2 = Split(hamta(x),"=")
IF Len(hamta2(0)) > 0 AND len(hamta2(1)) > 0 then
SQL = "SELECT * FROM produkter WHERE id =" & int(hamta2(0))
Set RecSet = Connect.Execute(SQL)
MyArray(0,x) = hamta2(0)
MyArray(1,x) = hamta2(1)
MyArray(2,x) = RecSet("artnr")
MyArray(3,x) = RecSet("namn")
MyArray(4,x) = RecSet("pris")
RecSet.Close
Set RecSet = nothing
END IF
next
For i = 0 To Ubound(myArray,2)
IF Len(MyArray(0,i)) > 0 then
andra = andra & myArray(0,i) & "=" & myArray(1,i)
IF NOT i = Ubound(myArray,2) then
andra = andra & "|"
END IF
END IF
Next
Session("andra") = andra
%>
                    <tr> 
                      <td width="50"><strong>Art.nr</strong></td>
                      <td width="120">Navn</td>
                      <td width="55">Pris</td>
                      <td width="55"> <div align="center">Antal</div></td>
                      <td width="55">
<div align="right">Total</div></td>
                      <td width="65"> 
                        <div align="center">Slet</div></td>
                      <td><div align="left"><strong>   </strong></div></td>
                    </tr>
                    <%
count = 0
ant = 0
total = 0            
For i = 0 To Ubound(myArray,2)
IF Len(MyArray(0,i)) > 0 then%>
                    <tr> 
                      <form namn="minsida" action="change.asp?id=<%=MyArray(0,i)%>" method="post">
                        <td><%=MyArray(2,i)%></td>
                        <td><%=MyArray(3,i)%></td>
                        <td> 
                          <%
                          Response.Write FormatCurrency(MyArray(4,i))%>
                        </td>
                        <td><div align="center"> 
                            <input name="antal" type="text" size="3" value="<%Response.Write MyArray(1,i)
                          strAntal = MyArray(1,i)
                          ant = ant + strAntal
                          %>" style="background: #A2B1C2; border: #85A0B8 1px solid; font-family: verdana; font-size: 10px; font-color: #21283D">
                          </div>
                         </td>
                        <td> <div align="right">
                          <%
tal1 = round(MyArray(4,i),2)
tal2 = round(MyArray(1,i),2)
pris = tal1 * tal2
IF Instr(pris,",") then
pris2 = Split(pris,",")
decital = pris2(1)
IF NOT Len(decital) <> 1 then
decital = "" & decital & "0"
END IF
IF decital < 25 then
summa = pris2(0)
ELSEIF decital > 24 AND decital < 75 then
summa = pris2(0) + 0.50
ELSE
summa = pris2(0) + 1
END IF
ELSE
summa = pris
END IF
IF instr(summa2,",") then
summa2 = split(summa,",")
IF len(summa2(1)) <> 1 then
kontroll = summa & " kr"
ELSE
kontroll = summa & "0 kr"
END IF
ELSE
kontroll = summa & " kr"
END IF
Response.Write FormatCurrency(kontroll)
total = total + summa
%>
                          </div>
                        </td>
                        <td><div align="center"><a href="change.asp?del=ja&id=<%=myArray(0,i)%>"><img src="bilder/radera.gif" width="8" height="13" border="0"></a></div></td>
                        <td><div align="center">
                            <strong><INPUT TYPE="image" SRC="bilder/andra.gif" VALUE="submit">
                            </strong></div></td>
                      </form>
                    </tr>
                    <%
count = count + 1
END IF
Next
IF count <> 0 then%>
                    <tr> 
                      <td colspan="7">    </td>
                    </tr>
                    <tr> 
                      <td colspan="7"><div align="center">Totalt <b><%=ant%></b> 
                          <%IF ant > 1 then
                      Response.Write "produkter"
                      ELSE
                      Response.Write "produkt"
                      END IF%>
                          som sammanlagt kostar 
                          <b><%
total2 =FormatCurrency(total)
total2 = Replace(total2," kr","")
Response.Write total2%>
                           </b>kronor</div></td>
                    </tr>
                    <%ELSE%>
                    <tr> 
                      <td colspan="7"><em>Der er ingen produkter i kundevognen</em></td>
                    </tr>
                    <%END IF%>
                  </table>
                  <span class="vit"> </span></td>
              </tr>
            </table>
            <%ELSEIF Request("show") = "kassa" then %>
            <table width="100%" border="0" cellpadding="0" cellspacing="0">
              <tr> 
                <td>Kassen      <span class="vit"><br>
                  </span> <table width="90%%" border="0" cellpadding="0" cellspacing="0">
                    <%
varde = Request.Cookies(""& Session.SessionID &"")
hamta = Split(varde,"&")
ReDim MyArray(4,Ubound(hamta))
for x = 0 to ubound(hamta)
hamta2 = Split(hamta(x),"=")
IF Len(hamta2(0)) > 0 AND len(hamta2(1)) > 0 then
SQL = "SELECT * FROM produkter WHERE id =" & int(hamta2(0))
Set RecSet = Connect.Execute(SQL)
MyArray(0,x) = hamta2(0)
MyArray(1,x) = hamta2(1)
MyArray(2,x) = RecSet("artnr")
MyArray(3,x) = RecSet("namn")
MyArray(4,x) = RecSet("pris")
RecSet.Close
Set RecSet = nothing
END IF
next
For i = 0 To Ubound(myArray,2)
IF Len(MyArray(0,i)) > 0 then
andra = andra & myArray(0,i) & "=" & myArray(1,i)
IF NOT i = Ubound(myArray,2) then
andra = andra & "|"
END IF
END IF
Next
Session("andra") = andra
%>
                    <tr> 
                      <td width="55"><strong>Art.nr</strong></td>
                      <td width="160">Navn</td>
                      <td width="65">Pris</td>
                      <td width="60"> <div align="center">Antal</div></td>
                      <td> <div align="right">Tital</div></td>
                    </tr>
                    <%
count = 0
ant = 0
total = 0            
For i = 0 To Ubound(myArray,2)
IF Len(MyArray(0,i)) > 0 then%>
                    <tr> 
                      <td><%=MyArray(2,i)%></td>
                      <td><%=MyArray(3,i)%></td>
                      <td> 
                        <%
                          Response.Write FormatCurrency(MyArray(4,i))%>
                      </td>
                      <td><div align="center"> 
                          <%
                            Response.Write MyArray(1,i)
                          strAntal = MyArray(1,i)
                          ant = ant + strAntal
                          %>
                        </div></td>
                      <td> <div align="right"> 
                          <%
tal1 = round(MyArray(4,i),2)
tal2 = round(MyArray(1,i),2)
pris = tal1 * tal2
IF Instr(pris,",") then
pris2 = Split(pris,",")
decital = pris2(1)
IF NOT Len(decital) <> 1 then
decital = "" & decital & "0"
END IF
IF decital < 25 then
summa = pris2(0)
ELSEIF decital > 24 AND decital < 75 then
summa = pris2(0) + 0.50
ELSE
summa = pris2(0) + 1
END IF
ELSE
summa = pris
END IF
IF instr(summa2,",") then
summa2 = split(summa,",")
IF len(summa2(1)) <> 1 then
kontroll = summa & " kr"
ELSE
kontroll = summa & "0 kr"
END IF
ELSE
kontroll = summa & " kr"
END IF
Response.Write FormatCurrency(kontroll)
total = total + summa
%>
                        </div></td>
                    </tr>
                    <%
count = count + 1
END IF
Next
IF count <> 0 then%>
                    <tr> 
                      <td colspan="5">    </td>
                    </tr>
                    <tr> 
                      <td colspan="5"> <div align="right"> 
                          <table width="118" border="0" cellpadding="0" cellspacing="0">
                            <tr> 
                              <td width="50">Summa:</td>
                              <td width="68" align="right"> <div align="right"> 
                                  <% Response.Write Rtrim(FormatCurrency(total))
                                  total2 = total %>
                                </div></td>
                            </tr>
                            <tr> 
                              <td width="50">Moms:</td>
                              <td width="68" align="right"> <div align="right"> 
                                  <%
IF inklmoms = 0 then
pris = Round(total/4,2)
IF Instr(pris,",") then
pris2 = Split(pris,",")
If len(pris2(1)) > 2 then
decital = left(pris2(1),2)
ELSE
decital = pris2(1)
END IF
IF NOT Len(decital) <> 1 then 
decital = "" & decital & "0" 
END IF
IF decital < 25 then 
summa = pris2(0)
ELSEIF decital > 24 AND decital < 75 then
summa = pris2(0) + 0.50
ELSE
summa = pris2(0) + 1 
END IF 
ELSE 
summa = pris
END IF 
IF instr(summa,",") then 
summa2 = split(summa,",") 
IF len(summa2(1)) = 1 then
mkontroll = "" & summa & "0"
ELSE
mkontroll = "" & summa & "" 
END IF
ELSE
mkontroll = "" & summa & ""
END IF
Response.Write mkontroll & " kr"
ELSE
Response.Write "<i>Ingår</i>"
END IF
%>
                                </div></td>
                            </tr>
                            <tr> 
                              <td width="50">Frakt:</td>
                              <td width="68" align="right"> <div align="right"> 
                                  <%Response.Write FormatCurrency(frakt)%>
                                </div></td>
                            </tr>
                            <tr> 
                              <td width="50">Totalt:</td>
                              <td width="68" align="right"> <div align="right"> 
                                  <%abtotalen = total2 + mkontroll + frakt
                              Response.Write FormatCurrency(abtotalen)%>
                                </div></td>
                            </tr>
                          </table>
                        </div></td>
                    </tr>
                    <tr> 
                      <td colspan="5"><form action="order.asp" method="post">
                          <table width="157" border="0" cellpadding="0" cellspacing="1">
                            <tr> 
                              <td height="15" colspan="2" width="155">Bestillingeinfomation</td>
                            </tr>
                            <%
                            IF len(Session("webshopfel")) > 0 then
                            falt = Split(Session("falt"),"|")
                            fel = 1
                            ELSE
                            fel = 0
                            END IF
                            %>
                            <tr> 
                              <td width="138">Navn:</td>
                              <td width="16"><%
Response.Write "<input name='namn' type=text style='background: #A2B1C2; border: #85A0B8 1px solid;"
Response.Write " font-family: verdana; font-size: 10px; font-color: #21283D' size=30"
IF fel > 0 then
Response.Write " value='" & falt(0) & "'>"
ELSE
Response.Write ">"
END IF
%></td></tr>
                            <tr> 
                              <td width="138">Adresse:</td>
                              <td width="16"><%
Response.Write "<input name='adress' type=text style='background: #A2B1C2; border: #85A0B8 1px solid;"
Response.Write " font-family: verdana; font-size: 10px; font-color: #21283D' size=30"
IF fel > 0 then
Response.Write " value='" & falt(1) & "'>"
ELSE
Response.Write ">"
END IF
%></td>
                            </tr>
                            <tr> 
                              <td width="138">Postnr:</td>
                              <td width="16">
                                <%
Response.Write "<input name='postnr1' type=text style='background: #A2B1C2; border: #85A0B8 1px solid;"
Response.Write " font-family: verdana; font-size: 10px; font-color: #21283D' size=3 maxlength=3"
IF fel > 0 then
Response.Write " value='" & falt(2) & "'>"
ELSE
Response.Write ">"
END IF
%>
                                
                              </td>
                            </tr>
                            <tr> 
                              <td width="138">Telefonnr:</td>
                              <td width="16"><%
Response.Write "<input name='tfn1' type=text style='background: #A2B1C2; border: #85A0B8 1px solid;"
Response.Write " font-family: verdana; font-size: 10px; font-color: #21283D' size=5"
IF fel > 0 then
Response.Write " value='" & falt(5) & "'>"
ELSE
Response.Write ">"
END IF
%></td>
                            </tr>
                            <tr> 
                              <td height="20" width="138">E-Mail Adresse:</td>
                              <td width="16"><%
Response.Write "<input name='epost' type=text style='background: #A2B1C2; border: #85A0B8 1px solid;"
Response.Write " font-family: verdana; font-size: 10px; font-color: #21283D' size=30"
IF fel > 0 then
Response.Write " value='" & falt(7) & "'>"
ELSE
Response.Write ">"
END IF%></td>
                            </tr>
                            <tr> 
                              <td width="138">Ørive info:</td>
                              <td width="16"><%
Response.Write "<input name='ovrigt' type=text style='background: #A2B1C2; border: #85A0B8 1px solid;"
Response.Write " font-family: verdana; font-size: 10px; font-color: #21283D' size=30"
IF fel > 0 then
Response.Write " value='" & falt(8) & "'>"
ELSE
Response.Write ">"
END IF%></td>
                            </tr>
                            <tr> 
                              <td colspan="2" width="155"><input type="submit" name="Submit2" value="Send bestilling" style="background: #85A0B8; border: #85A0B8 1px solid; font-family: verdana; font-size: 10px"></td>
                            </tr>
                           <%IF Len(Session("webshopfel")) > 0 then%>
                            <tr>
                              <td colspan="2" width="155"><%=Session("webshopfel")%></td>
                            </tr>
                            <%Session("webshopfel") = ""
                            ELSEIF Len(Request("skickad")) > 0 then%>
                            <tr><td width="138"><%Response.Write "Nu är din beställning skickad!"%></td>
                                                            <td width="16"></td>
</tr><%END IF%>
                          </table>
                        </form></td>
                    </tr>
                    <%ELSE%>
                    <%IF Request("skickad") = "ja" then %>
                    <tr><td colspan="5">Din bestillinge 
                                                er nu sendt</td></tr><%ELSE%>
                    <tr> 
                      <td colspan="5">Ingen produkter i vongen</td>
                    </tr>
                    <%END IF
                    END IF%>
                   </table></td>
              </tr>
            </table>
            <%ELSE%>
            <table width="100%" border="0" cellspacing="0" cellpadding="0">
              <tr> 
                <td valign="top">Velkommen til HJ-DATA WebShop. Webshoppen vil 
                                    inde for kort tid bruges. </td>
              </tr>
            </table> 
            <%END IF%>
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
</table>
<table width="675" border="0" align="center">
  <tr>
    <td><P align=center><FONT color=#313131 size="1"><B>Copyright 
©2004<BR>HJ-DATA.DK</B></FONT></P></td>
  </tr>
</table>
</body>
</html>
		
		
	 
	
		
								
					
				31. januar 2004 - 00:12
				#30
						
		 
		
			<%
Response.Cookies(Session.SessionID)(Request("id")) = Request("antal")
Response.Cookies(Session.SessionID).Expires = DateAdd("h", 2, now)
nyprod = Request("antal") & "st <b>" & Request("navn") & "</b> á "
priset = Request("pris")
nyprod = nyprod & FormatCurrency(priset,2)
nyprod = nyprod & "<br>Er i vongen"
Session("nyprod") = nyprod
Response.Redirect Request.ServerVariables("HTTP_REFERER")
varde = Request.Cookies(""& Session.SessionID &"")
Response.Write varde & "<br><br>"
hamta = Split(varde,"&")
ReDim MyArray(1,Ubound(hamta))
for x = 0 to ubound(hamta)
hamta2 = Split(hamta(x),"=")
MyArray(0,x) = hamta2(0)
MyArray(1,x) = hamta2(1)
Response.Write "id: " & hamta2(0) & "<br>"
Response.Write "antal: " & hamta2(1) & "<br>"
    response.write hamta(x) & "<br><br>" 
next
For i = 0 To Ubound(myArray,2)
   Response.write myArray(0,i)
   Response.Write myArray(1,i)&"<br>"
Next
%>
<p> </p>