Avatar billede kal.dk Nybegynder
05. april 2004 - 17:22 Der er 1 kommentar

Hjælp til shopping modul lavet i VBScript

Hej Eksperter

Jeg kan lige sige det med det samme. Jeg er ikke programør. Så derfor søger jeg en som måske med betaling kan lave følgende for mig.

Jeg bruger OfficeFinancian fra lykkegruppen.dk. De har et simpel Internet modul som har nogle mangler og det skal man selv lave.:

Jeg har følgende ønsker.:

Mulighed for at ligge et forsendelse gebyr efter hvilke betaling kunden vælger.

Mulighed for at vælge følgende betaling.: Postefterkrav, Forudbetaling, Konto.

Mulighed for at den kikker om der er ekstra tekst i et html dokument i et sub directory. Og den så linker til den.

Mulighed for at priserne både er i incl og excl. Moms.

Systemet kører ud fra 2 filer (default.asp og default.ini) samt 2 access database en med varer og en med bestilte produkter.

default.asp ser ud som følgende.:
<!-- #include file="admin/default.ini" -->
<%
'---Initialize cart array
If Session("OF_CARTITEM") = "" then
reDim arrcart(5,100)
'Productid = 1 ProductCode = 2 Productname = 3 Quantity = 4 UnitPrice = 5
Session("OF_CART") = arrcart
Session("OF_CARTITEM") = 0
End if

'clean up the session variables
If Request.QueryString ("end") = 1 Then
Session.Abandon
End If

'**********Get picture from database*******************
dim pic, picsize, query, rsblob, pid
pid = Request.QueryString("picID")
if len(pid)>0 then
Response.Expires = 0
Response.Buffer = TRUE
Response.Clear
set rsBlob = Server.CreateObject("adodb.recordset")
rsBlob.CursorLocation = 3
query = "Select Foto from iInventory Where InventoryID='" & cstr(pid) & "'"
rsBlob.Open query, dbc, 2, 3
if rsBlob.eof then Response.End
if isnull(rsBlob(0)) then Response.End
PicSize = rsBlob(0).ActualSize
Pic = rsBlob(0).GetChunk(PicSize)
Response.BinaryWrite Pic
rsBlob.Close
Set rsBlob = Nothing
Response.End
end if

'get QueryStrings
Dim RsO, RsI, RsD, RsOS, sPage, lCat, sCat, netto,i, IntCartItem, aCart, curAmount,sError,sAction, rsImage,CheckFile,FileObject

sPage = Request.QueryString("page")
lCat = Cint(Request.QueryString("id"))
sCat = Request.QueryString("cat")
sError = Request.QueryString("error")
sAction = Request.Form("action")
sPWD = Request.QueryString("pwd")
if sAction = txtCart Then sPage = "cart" end if
if len(sPage) = 0 Then sPage = "" end if
If len(sCat)>0 Then sPage = "Catalog" End if
If len(sPWD)>0 then

Set dbo = Server.CreateObject("ADODB.Connection")
dbo.Open strCono & sPWD
Set RsO = Server.CreateObject ("adodb.recordset")
RsO.Open sPage , dbo, 0, 1, &H0002
Response.ContentType = "text/xml"
%>
<?xml version="1.0" ?>
<%
RsO.Save Response, 1
RsO.close
Set RsO = dbo.Execute("DELETE * FROM " & sPage)
Response.End
end if

'----store new items
if sPage = "cart" then
Dim intProdID, lQty, lCartItems, CurCartItem,ItemRst,strAction
intProdID = Request.Form("pid")
lQty = Request.Form("qty")
aCart = Session("OF_CART")
lCartItems = Session("OF_CARTITEM")
If lCartItems = "" Then
Response.Redirect "default.asp?error=" & Server.URLEncode ("We noticed you do not accept cookies. Please enable cookies to shop.")
End If
'if product exists - add quantity
If intProdID <> "" Then
For i = 1 To lCartItems
if aCart(1,i) = intProdID then
CurCartItem = i
lQty = lQty + aCart(4,CurCartItem)
exit for
end if
Next
If CurCartItem then
lCartItems = lCartItems
else
If lCartItems < 1000 Then
lCartItems = lCartItems + 1
CurCartItem = lCartItems
Session("OF_CARTITEM") = lCartItems
End If
End If
Set ItemRst = Server.CreateObject("ADODB.Recordset")
ItemRst.Open "iInventory", dbc, 0, 1, &H0002 'ReadOnly
ItemRst.Filter = "InventoryID = '" & intProdID & "'"
If Not ItemRst.EOF Then
aCart(1,CurCartItem) = ItemRst("InventoryID")
aCart(2,CurCartItem) = ItemRst("InventoryID")
aCart(3,CurCartItem) = ItemRst("Note")
aCart(4,CurCartItem) = CInt(lQty)
aCart(5,CurCartItem) = ItemRst("SalesPrice")
Session("OF_CART") = aCart
ItemRst.Close
End If
else
strAction = UCase(Left(Request.Form("action"),5))
Select Case strAction
Case UCase(Left(txtRecalculate,5))
For i = 1 To lCartItems
Dim tquantity
tquantity = Request.Form("lQty" & Cstr(i))
aCart(4,i) = CInt(tquantity)
Next
For i = 1 to lCartItems
Dim confirm
confirm = Request.Form("selected" & CStr(i))
If confirm <> "yes" Then
lCartItems = lCartItems - 1
Dim x
For x = 1 to UBound(aCart,1)
aCart(x,i) = ""
Next
Dim n
n = i
while n < UBound(aCart,2)
For x = 1 to UBound(aCart,1)
aCart(x,n) = aCart(x,n + 1)
aCart(x,n + 1) = ""
Next
n = n + 1
wend
end If
Next
Session("OF_CARTITEM") = lCartItems
Session("OF_CART") = aCart
Case UCase(Left(txtRegister,5))
Response.Redirect "default.asp?page=form"
Case UCase(Left(txtRemove,5))
Session.Abandon
Response.Redirect "default.asp"
Case UCase(Left(txtReturn,5))
Response.Redirect "default.asp"
End Select
End If
end if
%>


<%'******************HEADER**************************%>
<HTML>
<meta name="Generator" content="Stone's WebWriter 4">
<HEAD><meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
<title>DanTalk Amager - KAL Data & Mobil ApS - Online Butik</title></HEAD>
<style>
<!--
body        { font-size: 70%; font-family: Verdana, Arial, Helvetica, MS Sans Serif;
          margin-top: 0em; margin-bottom: 0em; margin-left: 0em; margin-right: 0em;}

a:link        { color: #ffffff; }

a:active    { color: #ffffff; }

a:visited     {  color: #ffffff; }

h1        { font-size: 145%;
        margin-bottom: .5em; }

h2        { font-size: 145%; 
        margin-top: 1em;
        margin-left: 1em; }

h3        { font-size: 70%;  }

table    { font-size: 100%;}

INPUT {font-size: 100%; }
SELECT {font-size: 100%; }
-->
</style>

<BODY bgColor=<%= Color1 %>>
<TABLE border=0 cellPadding=0 cellSpacing=0 width=100% height=100%>
<TR>
<TD valign=top bgColor=<%= Color1 %> width="100">
<%'******************NAVIGATION BAR****************%>
<table border=0 cellspacing=0 cellpadding=2 width="100%">
<tr>
<td nowrap bgColor=<%= Color1 %>>&nbsp;<a title="<%=txtSalesPriceLists %>" href="default.asp" target="_self" style="text-decoration: none" onmouseover="style.color = 'red'; window.status=' '" onmouseout="style.color = 'white';window.status=''" name="navn"><b><%=txtSalesPriceLists %></b></a><br><br>
<%
'Show catalogs
Dim barRst
Set barRst= Server.CreateObject ("ADODB.Recordset")
barRst.Open "iPriceListSales", dbc, 0,1,&H0002
While Not barRst.EOF
%>
&nbsp;&nbsp;&nbsp;<a title="<%= barRst("Note") %>" HREF="default.asp?id=<%= barRst("PriceID") %>&amp;cat=<%= barRst("Note") %>" target=_self style="text-decoration: none" onmouseover="style.color = 'red'" onmouseout="style.color = 'white'"><b><%= barRst("Note") %></b></a><br><br>
<%
barRst.MoveNext
Wend
barRst.Close
Set barRst = Nothing
%>
<br>
&nbsp;<a title="<%= ucase(txtinformation) %>" HREF="default.asp?page=info" target=_self style="text-decoration: none" onmouseover="style.color = 'red'" onmouseout="style.color = 'white'"><b><%= ucase(txtinformation) %></b></a><br><br>
<br><br><br><br><br>
<%
Dim Order1Rst, OrderCount
Set Order1Rst= Server.CreateObject ("ADODB.Recordset")
Order1Rst.Open "iorders", dbo, 3, 1, &H0002
OrderCount= Order1Rst.Recordcount
Order1Rst.Close
Set Order1Rst=nothing
%>
<font Color=<%= Color1 %>><%=OrderCount %></font>
</tr>
<tr>
<td nowrap align=left bgColor=<%= Color1 %> height="78">
<%
Dim hisubtotal, hi, hcartItem, harrCart
hcartItem = Session("OF_CARTITEM")
harrCart = Session("OF_CART")
hisubtotal = 0
if sPage="accept" or sPage="decline" then
else
For hi = 1 to hcartItem
hisubtotal = hisubtotal + (harrCart(4,hi) * harrCart(5,hi))
Next
end if
%>
<table border="1" bgcolor=<%= Color1 %> cellPadding=3 cellspacing="0" width="100%">
<tr>
<td align=center>
<a title="<%= txtCart %>" href="default.asp?page=cart" target="_self" style="text-decoration: none" onmouseover="style.color = 'red'" onmouseout="style.color = 'white'"><b><%= txtCart & ":" %><br><%= Formatnumber((hisubtotal*(1+Ctax)),2) %><%= cCurrency %></b></a>
</td>
</tr>
</table>
</td>
</tr>
</table>
<%'******************NAVIGATION BAR END*************%>
</TD>
<TD align="center" valign="top"  bgcolor=<%= Color3 %>>
<%'******************DECLINE*START*********************%>
<%IF sPage = "decline" THEN
sError = txtDecline
sPage = "form"
END IF%>
<%'******************DECLINE*END*********************%>
<%'******************ERROR*START*********************%>
<%If len(sError)>0 Then %>
<TABLE border=0 cellPadding=10 cellSpacing=0 bgcolor=<%= Color2 %> width="100%">
<TR valign="top">
<TD><H1>OBS! <%= sError %></H1>
</td>
</tr>
</table>
<%END IF%>

<%'******************ERROR*END*********************%>
<%'******************MAIN*START********************%>
<%IF sPage = "" THEN %>
<TABLE border=0 cellPadding=10 cellSpacing=0  width=100% height="10%" >
<TR>
<TD align="center"><h1><%= txtHeaderFrameText %></h1></TD>
</TR>
</TABLE>
<TABLE border=0 cellPadding=10 cellSpacing=0  width=100% height="80%" >
<TR>
<TD align="center" <h1><%=txtMainFrameText %></h1></TD>
</TR>
</TABLE>
<TABLE border=0 cellPadding=10 cellSpacing=0  width=100% height="10%" >
<TR>
<TD align="center" valign="bottom"><%=txtButtomFrameText %></TD>
</TR>
</TABLE>
<%END IF%>
<%'******************MAIN**END*********************%>
<%'******************CATALOG**START******************%>
<%IF sPage = "Catalog" THEN %>
<TABLE border=0 cellPadding=10 cellSpacing=0 width=100%>
<TR valign="top">
<TD>
<H1><%= sCat %></H1>
<%
'create table of products
Dim Picjpg,Picgif,Picbmp
Set RsO = Server.CreateObject("ADODB.Recordset")
RsO.Open "iInventory", dbc, 0, 1, &H0002
If lCat <> "" Then
RsO.Filter = "PriceID = " & lCat
End If
While Not RsO.EOF
%>
<TABLE border="1" cellPadding="1" cellSpacing="0" bordercolor=<%= Color1 %> width="100%">
<TR>
<TD colspan=2 bgColor=<%= Color1 %>>
<FONT color="White" ><%= RsO("InventoryID") %></FONT>
</TD>
</TR>
<TR>
<%
Picjpg = "images/" & RsO("InventoryID") & ".jpg"
Picgif = "images/" & RsO("InventoryID") & ".gif"
Picbmp = RsO("InventoryID")
If FileExists(Picjpg) or FileExists(Picgif) Then
if FileExists(Picjpg) then%>
<TD width="100" bgColor=<%= Color2 %>><img src="<%= Picjpg %>" width="100"></TD>
<%else%>
<TD width="100" bgColor=<%= Color2 %>><img src="<%= Picgif %>" width="100"></TD>
<%end if%>
<%else%>
<%if ImageExists(Picbmp) then%>
<TD width="100" bgColor=<%= Color2 %>>
<img src="default.asp?picID=<%= RsO("InventoryID") %>" width="100">
</TD>
<%end if%>
<%end if%>
<TD bgColor=<%= Color2 %>>
<%= RsO("Note") %><br>
<div align="right">
<table>
<TR>
<TD><form action="default.asp?page=cart" method="POST" ID=Form1>
<b><%= txtPrice %>: </b><%= Formatnumber(RsO("SalesPrice"),2)%><%= cCurrency %>
<input type="hidden" name="pid" value="<%= RsO("InventoryID")%>" ID=Hidden1>
<b><%= txtQty %>:</b>
<input maxLength="7" name="qty" size="2" value="1" ID=Text1>
<input type="submit" value="<%= txtAdd %>" name="order" ID=Submit1>
</TD></FORM>
</TR>
</TABLE>
</div>
</TD>
</TR>
</TABLE>
<br>
<%
RsO.MoveNext
Wend
RsO.Close
%>
</TD>
</TR>
</TABLE>
<%END IF%>
<%'******************CATALOG*END*********************%>
<%'******************CART*START*********************%>
<%IF sPage = "cart" THEN %>
<TABLE border=0 cellPadding=10 cellSpacing=0 width=100%>
<TR valign="top">
<TD>
<h1><%= txtCart %><br></h1>
<TABLE border=1 cellPadding=8 cellSpacing=0 bordercolor=#FFFFFF width="100%" bordercolorlight="#000000">
<TR>
<TD>
<TABLE valign=top border=1 cellPadding=1 cellSpacing=0  bordercolor=#FFFFFF width="100%">
<TR bordercolor=<%= Color1 %> bgColor=<%= Color1 %>>
<TD>
<FONT color=white><%= txtProduct %></FONT>
</TD>
<TD align=center colspan="2">
<FONT color=white><%= txtQty %></FONT>
</TD>
<TD align=right width=100>
<FONT color=white><%= txtPrice %></FONT>
</TD>
<TD align=right width=100>
<FONT color=white><%= txtTotal %></FONT>
</TD>
</TR>
<FORM action="default.asp?page=cart" method="POST" ID=Form2 name="formcart">
<%
netto = 0
For i = 1 to lCartItems
%>
<TR bordercolor=<%= Color1 %> bgColor=<%= Color2 %>>
<TD>
<INPUT name=<%= "selected" & Cstr(i)%> type=checkbox value="yes" checked ID=Checkbox1>
<b><%= aCart(2,i) %></b><%= " " & aCart(3,i) %>
</font>
</TD>
<TD align=center colspan="2">
<INPUT type="text" size="4" name=<%= "lQty" & CStr(i) %> value="<%= aCart(4,i) %>" ID=Text2  onchange="document.all.flag.value='on';formcart.submit()" >
</TD>
<TD align=right>
<%= Formatnumber(aCart(5,i),2) %></font><%= cCurrency %>
</TD>
<TD align=right>
<%= Formatnumber(aCart(5,i) * aCart(4,i),2) %></font><%= cCurrency %>
</TD>
</tr>
<%
netto = netto + (aCart(5,i) * aCart(4,i))
Next
%>
<TR>
<TD colspan="3">
&nbsp;
</TD>
<TD align=right bgColor=<%= Color1 %> bordercolor=<%= Color1 %>>
<FONT color=white><%= txtSubtotal %></FONT>
</TD>
<TD align=right bgColor=<%= Color2 %> bordercolor=<%= Color1 %>>
<%= Formatnumber(netto,2) %><%= cCurrency %>
</TD>
</TR>
<TR>
<TD colspan="3">
&nbsp;
</TD>
<TD align=right bgColor=<%= Color1 %> bordercolor=<%= Color1 %>>
<FONT color=white><%= txtTax %></FONT>
</TD>
<TD align=right  bgColor=<%= Color2 %> bordercolor=<%= Color1 %>>
<%= Formatnumber((netto*Ctax),2) %><%= cCurrency %>
</TD>
</TR>
<TR>
<TD colspan="3">
&nbsp;
</TD>
<TD align=right bgColor=<%= Color1 %> bordercolor=<%= Color1 %>>
<FONT color=white><%= txtTotal %></FONT>
</TD>
<TD align=right  bgColor=<%= Color2 %> bordercolor=<%= Color1 %>>
<%= Formatnumber((netto*(1+Ctax)),2) %></font><%= cCurrency %>
</TD>
</TR>
</TABLE>
</TABLE>
</TR>
</TABLE>
<INPUT name=action style="width: 100" type=submit value="<%= txtReturn %>" ID=Submit2>
<INPUT name=action style="width: 100" type=submit value="<%= txtRemove %>" ID=Submit3>
<INPUT name=action style="width: 100" type=submit value="<%= txtRecalculate %>" ID=Submit4 >
<INPUT name=action style="width: 100" type=submit value="<%= txtRegister %>" ID=Submit5>
<input type="hidden" id=Hidden12 name="flag">
</FORM>


<%END IF%>
<%'******************CART*END*****************%>
<%'******************FORM START*****************%>
<%IF sPage = "form" THEN %>
<%
if Session("OF_CARTITEM")=0 then
Response.Redirect "default.asp"
end if
Session("flag")="off"
%>
<TABLE border=0 cellPadding=10 cellSpacing=0 width=100%>
<tr>
<TD valign="top">
<% if sError = "" Then %>   
<h1><%= txtEnter %>:</h1>
<%end if %>
<TABLE border=1 cellPadding=8 cellSpacing=0 bordercolor=#FFFFFF width="100%" bordercolorlight="#000000">
<TR>
<TD>
<form method="POST" action="default.asp?page=confirm" name="formorder" ID=For9>
<TABLE border=0 cellPadding=0 cellSpacing=0 width="100%">
<TD width="10%" align="left" >
</TD>
<TD width="65%">
</TD>
<TD width="25%" valign="top" rowspan="6">
<br>
<br>
<b><%= txtOrder %></b>
<br>
<%= txtDate %>:&nbsp;<%= date %><br>
<br>
<br>
</TD>
<TR>
<TD align="right" >
<%= txtName %>:
</TD>
<TD  align="left" >
<input type="text" name="name" value="<%= Session("name") %>" size=51 maxlength=60 tabindex="2" style="background-color: <%= Color2 %>" ID=Text7>
</TD>
</TR>
<TR>
<TD align="right" >
<%= txtaddress %>:
</TD>
<TD align="left">
<input type="text" name="address1" value="<%= Session("address1") %>" size=51 maxlength=60 tabindex="3" style="background-color: <%= Color2 %>" ID=Text3>
</TD>
</TR>
<TR>
<TD  align="right" >
<%= txtaddress %>:
</TD>
<TD align="left" >
<input type="text" name="address2" value="<%= Session("address2") %>" size=51 maxlength=60 tabindex="3" style="background-color: <%= Color2 %>" ID=Text4>
</TD>
</TR>
<TR>
<TD align="right">
<%= txtpostalcode %>:
</TD>
<TD align="left">
<input type="text" name="zip" id="zip" value="<%= Session("zip") %>" size=5 tabindex="4" style="background-color: <%= Color2 %>">&nbsp;
<%= txtcity %>:
<input type="text" name="city" value="<%= Session("city") %>" size=14 tabindex="5" style="background-color: <%= Color2 %>" ID=Text5>&nbsp;
<%= txtcountry %>:
<input type="text" name="country" value="<%= Session("country") %>" size=12 tabindex="6" style="background-color: <%= Color2 %>" ID=Text6>
</TD>
</TR>
<TR>
<TD align="right" >
E-mail:
</TD>
<TD align="left" >
<input type="text" name="email" value="<%= Session("email") %>" size=24 tabindex="7" style="background-color: <%= Color2 %>" ID=Text8>&nbsp;<%= txtphone %>:
<input type="text" name="phone" value="<%= Session("phone") %>" size=13 tabindex="8" style="background-color: <%= Color2 %>" ID=Text9>
<input type="hidden" id="flag" name="flag">
</TD>
</TR>
</table>
<TABLE border=1 cellSpacing=0 bordercolor=#FFFFFF width="100%">
<TR bgColor=<%= Color1 %> bordercolor=<%= Color1 %>>
<TD colspan=2>
<FONT color=white><%= txtProduct %></FONT>
</TD>
<TD align=center>
<FONT color=white ><%= txtQty %></FONT>
</TD>
<TD align=right width=100>
<FONT color=white><%= txtPrice %></FONT>
</TD>
<TD align=right width=100>
<FONT color=white><%= txtTotal %></FONT>
</TD>
</TR>
<%
IntCartItem = Session("OF_CARTITEM")
aCart = Session("OF_CART")
netto= 0
For i = 1 to IntCartItem
%>
<TR bordercolor=<%= Color1 %>>
<TD colspan=2>
<b><%= aCart(2,i) %></b><br><%= aCart(3,i) %>
</TD>
<TD align=center >
<%= cstr(aCart(4,i)) %>
</TD>
<TD align=right >
<%= Formatnumber(aCart(5,i),2) %><%= cCurrency %>
</TD>
<TD align=right >
<%= Formatnumber(aCart(5,i) * aCart(4,i),2) %><%= cCurrency %>
</TD>
</TR>
<%
netto= netto+ (aCart(5,i) * aCart(4,i))
Next
%>
<TR>
<TD align=right width="20%">
<%= txtpayment %>:
</TD>
<TD align=left>
<select name="payment" size="1" onchange="document.all.flag.value='on';formorder.submit()" style="background-color: <%= Color2 %>" ID=Select1>
<%
If Session("payment")="" then
Session("payment")=cpayment1
end if
If len(cpayment1)>0 then %>
<OPTION <%If Session("payment")=cpayment1 then%>SELECTED <% end if %> value="<%= cpayment1 %>"><%= cpayment1 %>
<% end if %>
<%If len(cpayment2)>0 then %>
<OPTION <%If Session("payment")=cpayment2 then%>SELECTED <% end if %> value="<%= cpayment2 %>"><%= cpayment2 %>
<% end if %>
<%If len(cpayment3)>0 then %>
<OPTION <%If Session("payment")=cpayment3 then%>SELECTED <% end if %> value="<%= cpayment3 %>"><%= cpayment3 %>
<% end if %>
<%If len(cpayment4)>0 then %>
<OPTION <%If Session("payment")=cpayment4 then%>SELECTED <% end if %> value="<%= cpayment4 %>"><%= cpayment4 %>
<% end if %>
<%If len(cpayment5)>0 then %>
<OPTION <%If Session("payment")=cpayment5 then%>SELECTED <% end if %> value="<%= cpayment5 %>"><%= cpayment5 %>
<% end if %>
</SELECT>
</TD>
<TD>
</TD>
<TD align=right bgColor=<%= Color1 %> bordercolor=<%= Color1 %> >
<FONT color=white ><%= txtSubTotal %>: </FONT>
</TD>
<TD align=right bordercolor=<%= Color1 %> >
<%= Formatnumber(netto,2) %><%= cCurrency %>
</TD>
</TR>
<TR >
<TD align=right width="20%">
<% if Session("payment") = cPayment1 then %>
</TD><TD>
<% else %>
<%= txtCardNumber %>:
</TD>
<TD>
<INPUT type="text" name="CardNumber" value="<%= Session("CardNumber")%>" minlength="5" maxlength="30" size="32"
style="background-color: <%= Color2 %>" ID=Text3>
<% end if %>
</TD><TD>
</TD>
<TD align=right bgColor=<%= Color1 %> bordercolor=<%= Color1 %> >
<FONT color=white><%= txtTax %>:</FONT>
</TD>
<TD align=right bordercolor=<%= Color1 %> >
<%= Formatnumber((netto*Ctax),2) %><%= cCurrency %>
</TD>
</TR>
<tr>
<TD align=right width="20%">
<% if Session("payment") = cPayment1 then %>
</TD><TD>
<% else %>
<%= txtValid %>:
</TD>
<TD>
<INPUT type="text" name="ExpireMonth" maxLength=2 size=2 value="<%= Session("ExpireMonth")%>" style="background-color: <%= Color2 %>" ID=Text4>
/
<INPUT type="text" name="ExpireYear" maxLength=2 size=2 value="<%= Session("ExpireYear")%>" style="background-color: <%= Color2 %>" ID=Text5>
<%= txtControlCode %>:
<INPUT type="text" name="cvc" maxLength=3 size=3 value="<%= Session("cvc")%>" style="background-color: <%= Color2 %>" ID=Text6>
<% end if %>
</TD><TD>
</TD>
<TD align=right bgColor=<%= Color1 %> bordercolor=<%= Color1 %> >
<FONT color=white><%= txtTotal %>: </FONT>
</TD>
<TD align=right bordercolor=<%= Color1 %>  >
<% 'Get total
curAmount = Formatnumber((netto*(1+Ctax)),2)
'Store these if order is OK
Session("curTotal") = curAmount
%>
<b><%= curAmount  %><%= cCurrency %></b>
</TD>
</tr>
<TR >
</TR>
</TABLE>
</TD>
</TR>
</TABLE>
</TD>
</tr>
<TR>
<TD valign="top">
<p align="center">
<INPUT name=action style="width: 150" type=submit value="<%= txtCart %>" id="Submit8">
<input type="submit" value="<%= txtproceed %>" name="Submit" style="width: 150" tabindex="10" ID=Submit6>
</p>
</TD>
</TR>
</form>
</TABLE>
<%END IF%>
<%'******************FORM END*****************%>
<%'******************CONFIRM START*****************%>
<%IF sPage = "confirm" or sPage = "accept" THEN
Dim intOrderid,  DebitorX , y

%>


<%IF sPage = "confirm" THEN %>
<%
dim key,strname,strvalue
For Each key in Request.Form
strname = key
strvalue = Request.Form(key)
Session(strname) = strvalue
Next
If Session("flag") = "on" then
Response.Redirect "default.asp?page=form"
Elseif Session("name") = "" OR len(Session("name")) <=2 then
Response.Redirect "default.asp?page=form&error=" & Server.URLEncode (txtEnter & ": " & txtName)
Elseif Session("address1") = "" OR len(Session("address1")) <=4 then
Response.Redirect "default.asp?page=form&error=" & Server.URLEncode (txtEnter & ": " & txtAddress1)
Elseif Session("city") = "" OR len(Session("city")) <=2 then
Response.Redirect "default.asp?page=form&error=" & Server.URLEncode (txtEnter & ": " & txtCity)
Elseif Session("zip") = "" OR len(Session("zip")) <=3 then
Response.Redirect "default.asp?page=form&error=" & Server.URLEncode (txtEnter & ": " & txtPostalCode)
Elseif Session("country") = "" OR len(Session("country")) <=2 then
Response.Redirect "default.asp?page=form&error=" & Server.URLEncode (txtEnter & ": " & txtCountry)
Elseif Session("phone") = "" OR len(Session("phone")) <=5 then
Response.Redirect "default.asp?page=form&error=" & Server.URLEncode (txtEnter & ": " & txtPhone)
Elseif Session("email") = "" OR len(Session("email")) <=5 then
Response.Redirect "default.asp?page=form&error=" & Server.URLEncode (txtEnter & ": " & "E-mail: name@domain.dk")
Elseif len(trim(Session("payment")))=0 then
Response.Redirect "default.asp?page=form&error=" & Server.URLEncode (txtEnter & ": " & txtPayment)
end if
If Session("payment") <> cpayment1 then
if Session("CardNumber") = "" OR len(Session("CardNumber")) <=10 Then
Response.Redirect "default.asp?page=form&error=" & Server.URLEncode (txtEnter & ": " & txtCardNumber)
Elseif Session("ExpireMonth") = "" OR len(Session("ExpireMonth")) < 2 Then
Response.Redirect "default.asp?page=form&error=" & Server.URLEncode (txtEnter & ": " & txtValid)
Elseif Session("ExpireYear") = "" OR len(Session("ExpireYear")) < 2 Then
Response.Redirect "default.asp?page=form&error=" & Server.URLEncode (txtEnter & ": " & txtValid)
end if
end if
'******* Store debitor information
Set RsD = Server.CreateObject ("ADODB.Recordset")
RsD.Open "iDebitors", dbo, 3, 2, &H0002
For y = 1 to 999
DebitorX = left("i" & Session("name"),21) & Cstr(y)
If RsD.recordcount > 0 then
RsD.movefirst
End if
RsD.Find "DebitorID = '" & DebitorX & "'"
If RsD.EOF Then
Exit for
End if
Next
RsD.AddNew
RsD("CompanyID") = cCompanyID
RsD("DebitorID") = DebitorX & ""
RsD("Name") = left(Session("name"),50) & ""
RsD("Email") = left(Session("email"),50) & ""
RsD("Address1") =  left(Session("address1"),50) & ""
If Session("address2") <> "" Then
RsD("Address2") = left(Session("address2"),50) & ""
End If
RsD("City") = left(Session("zip") & " " & Session("city"),25)
RsD("Country") = left(Session("country"),50) & ""
RsD("Phone") = left(Session("phone"),50) & ""
RsD.Update
RsD.Close
Dim scartItem, ShipmentAddress, NoteInfo,ResellerInfo
aCart = Session("OF_CART")
scartItem = Session("OF_CARTITEM")
Set RsO = Server.CreateObject ("adodb.recordset")
RsO.Open "iorders", dbo, 1, 2, &H0002
RsO.AddNew
RsO("CompanyID") = cCompanyID
RsO("DebitorID") = DebitorX
RsO("OrderDate") = Date
RsO("CurrencyText") = cCurrency
'*****Save Payment information
if len(trim(Session("payment")))>0 then
NoteInfo = txtPayment & ": " & Session("payment")
end if
'*****Save Reseller information
if len(trim(Session("reseller")))>0 then
ResellerInfo =  " Reseller: " & Session("reseller")
end if
RsO("OrderNote2") = NoteInfo & ResellerInfo & ""
RsO.Update
RsO.Close
'*****Get Ordernumber
Set rso = dbo.Execute("SELECT max(orderID) FROM iorders")
intOrderid = Cint(rso(0))
Session("intOrderid") = intOrderid
if isnull(intOrderid) then
intOrderid=1
end if
rso.Close
If intOrderid < 1 Then
Response.Redirect "default.asp?error=" & Server.URLEncode ("Error: No order id.")
Else
Set RsOS = Server.CreateObject ("adodb.recordset")
RsOS.Open "iOrdersSubtable", dbo, 1, 3, &H0002
For i = 1 To scartItem
RsOS.AddNew
RsOS("CompanyID") = cCompanyID
RsOS("orderid") = intOrderid
RsOS("InventoryID") = aCart(1,i)
RsOS("Amount") = aCart(4,i)
RsOS("SalesPrice") = aCart(5,i)
RsOS("SalesTaxPercent") = cTax*100
RsOS.Update
Next
RsOS.Close
End if
If dbo.Errors.Count > 0 then
dbo.Close
set dbo = nothing
Response.Redirect "default.asp?error=" & Server.URLEncode ("Error in database: ") & dbo.Error.Description
Else
End If
%>
<%END IF%>
<TABLE border=0 cellPadding=10 cellSpacing=0 width=100% height="100%">
<TR>
<TD valign="top">
<%IF sPage = "confirm" THEN %>
<h1><%= txtControl %></h1>
<% else %>
<h1><%= txtThanks %></h1>
<% end if %> 
<%
dim s
s = s & vblf & "<TABLE border=1 cellPadding=8 cellSpacing=0 bordercolor=#FFFFFF width='100%' bordercolorlight=#000000>"
s = s & vblf & "<TR>"
s = s & vblf & "<TD valign=top>"
s = s & vblf & "<TABLE border=0 cellPadding=2 cellSpacing=0 width='100%'>"
s = s & vblf & "<TD valign=top><br><b>"
if isempty(Request.QueryString("oid")) then
intOrderid = Session("intOrderid")
else
intOrderid = Request.QueryString("oid")
end if
Set RsO = Server.CreateObject ("ADODB.Recordset")
RsO.Open "iorders", dbo, 1, 2, &H0002
RsO.Filter = "OrderID = " & intOrderid
if sPage = "accept" then
RsO("PrintFlag") = 2 'Status = Order
else
RsO("PrintFlag") = 1
end if
RsO.Update
Set RsD= Server.CreateObject ("ADODB.Recordset")
RsD.Open "iDebitors",  dbo, 3, 2, &H0002 
DebitorX = RsO("DebitorID")
RsD.Filter = "DebitorID = '" & cstr(DebitorX) & "'"
s = s & vblf & RsD("Name")& "<br>"
s = s & vblf & RsD("address1")& "<br>"
If RsD("address2") <> "" Then
s = s & vblf & RsD("address2")& "<br>"
end if
s = s & vblf & RsD("city")& "<br>"
s = s & vblf & RsD("country")& "<br>"
s = s & vblf & RsD("email")& "</b></TD>"
s = s & vblf & "<TD width='140'><br>"
IF sPage = "accept" THEN
s = s & vblf & "<b>"& ucase(txtConfirmation) & "</b><br>"
END IF
s = s & vblf & "<b>" & txtOrder & ": " & cstr(RsO("OrderID")) & "</b><br>"
s = s & vblf &  txtDate & " " & cstr(RsO("OrderDate")) &  "<br><br>"
s = s & vblf & "</TD>"
s = s & vblf & "</table>"
s = s & vblf & "<TABLE border=1 cellPadding=2 cellSpacing=0 bordercolor=#FFFFFF width='100%'>"
s = s & vblf & "<TR bgColor=" & cstr(Color1) & " bordercolor=" & cstr(Color1) & ">"
s = s & vblf & "<TD><FONT color=white>" & txtProduct & "</FONT></TD>"
s = s & vblf & "<TD align=center><FONT color=white>" & txtQty & "</FONT></TD>"
s = s & vblf & "<TD align=right width=100><FONT color=white>" & txtPrice & "</FONT></TD>"
s = s & vblf & "<TD align=right width=100><FONT color=white>" & txtTotal & "</FONT></TD>"
s = s & vblf & "</TR>"
Set RsOS = Server.CreateObject ("adodb.recordset")
RsOS.Open "iOrdersSubtable", dbo, 3, 2, &H0002
RsOS.Filter = "OrderID = " & RsO("OrderID")
Set RsI = Server.CreateObject("ADODB.Recordset")
RsI.Open "iInventory", dbc, 0, 1, &H0002
RsI.Filter = "InventoryID = '" & RsOS("InventoryID") & "'"
netto = 0
While Not RsOS.EOF
s = s & vblf & "<TR bordercolor=" & cstr(Color1) & ">"
s = s & vblf & "<TD><b>" & RsOS("InventoryID") & "</b> " & RsI("Note") & "</TD>"
s = s & vblf & "<TD align=center>" & cstr(RsOS("Amount")) & "</TD>"
s = s & vblf & "<TD align=right>" & Formatnumber(RsOS("SalesPrice"),2) & cCurrency & "</TD>"
s = s & vblf & "<TD align=right>" & Formatnumber(RsOS("SalesPrice") * RsOS("Amount"),2) & cCurrency &"</TD>"
s = s & vblf & "</TR>"
netto = netto + (RsOS("SalesPrice") * RsOS("Amount"))
RsOS.MoveNext
wend
if Session("payment") = cPayment1 then
s = s & vblf & "<FORM action='default.asp?page=accept' method=post ID=Form3>"
else
s = s & vblf & "<FORM action='" & cCaptureURL & "' method=post ID=Form4>"
end if
s = s & vblf & "<TR>"
s = s & vblf & "<TD colspan=2>" & txtPayment & ": " & Session("payment") & "</TD>"
s = s & vblf & "<TD align=right bgColor=" & cstr(Color1) & " bordercolor= " & cstr(Color1) & "><FONT color=white>" & txtSubTotal & ":</FONT></TD>"
s = s & vblf & "<TD align=right bordercolor=" & cstr(Color1) & ">" & Formatnumber(netto,2) & cCurrency & "</TD>"
s = s & vblf & "</TR><TR>"
s = s & vblf & "<TD colspan=2>"
IF sPage = "confirm" AND Session("payment") <> cPayment1 THEN
s = s & vblf & txtCardNumber & ": " & Session("CardNumber")
END IF
s = s & vblf & "</TD>"
s = s & vblf & "<TD align=right bgColor=" & cstr(Color1) & " bordercolor=" & cstr(Color1) & "><FONT color=white>" & txtTax & ":</FONT></TD>"
s = s & vblf & "<TD align=right bordercolor=" & cstr(Color1) & ">" & Formatnumber((netto*Ctax),2) & cCurrency & "</TD>"
s = s & vblf & "</TR><TR>"
s = s & vblf & "<TD colspan=2>"
IF sPage = "confirm" AND Session("payment") <> cPayment1 THEN
s = s & vblf & txtValid  & ": " & Session("ExpireMonth") & "/" & Session("ExpireYear") & "  " & txtControlCode & ": " & Session("cvc")
END IF
s = s & vblf & "</TD>"
s = s & vblf & "<TD align=right bgColor=" & cstr(Color1) & " bordercolor=" & cstr(Color1) & "><FONT color=white>" & txtTotal & ":</FONT></TD>"
s = s & vblf & "<TD align=right bordercolor=" & cstr(Color1) & "><b>" & Formatnumber((netto*(1+Ctax)),2) & cCurrency & "</b></TD>"
s = s & vblf & "</TR><TR><TD colspan=4 align=center>" & cCompanyName & "</TD></TR>"
s = s & vblf & "</TABLE></TD></TR></TABLE>"
Response.Write s
%>
<P align="center">
<%IF sPage = "confirm" THEN
dim sDir, sAcceptURL, sDeclineURL
sDir = left(Request("HTTP_REFERER"),instr(1,Request("HTTP_REFERER"),"?page"))
sAcceptURL = sDir & "page=accept&oid=" & cstr(intOrderid)
sDeclineURL= sDir & "page=decline"
%>
<INPUT type=hidden name=cardnumber value=<%= Session("CardNumber")%> ID=INPUT2>
<INPUT type=hidden name=expiremonth value=<%= Session("ExpireMonth")%> ID=INPUT3>
<INPUT type=hidden name=expireyear value=<%= Session("ExpireYear")%> ID=INPUT4>
<INPUT type=hidden name=cvc value=<%= Session("cvc")%> ID=INPUT5>
<INPUT type=hidden name=currency value=<%= cCurrencyCode %> ID=INPUT6>
<INPUT type=hidden name=merchantnumber value=<%= cMerchantNumber %> ID=INPUT7>
<INPUT type=hidden name=accepturl value=<%= sAcceptURL %> ID=INPUT8>
<INPUT type=hidden name=declineurl value=<%= sDeclineURL %> ID=INPUT9>
<INPUT type=hidden name=ordernumber value=<%= intOrderid %> ID=INPUT10>
<INPUT type=hidden name=amount value=<%= (netto*(1+Ctax)) %> ID=INPUT11>
<INPUT name="action" type=submit value="<%= txtSend %>" ID=Submit7>
<%END IF%>
<%IF sPage = "accept" THEN %>
<input style="width: 150" type=button name=print value="<%= txtPrint %>" onClick="java script:window.print()" ID=Button1>
<%i = SendMail(s)%>
<%END IF%>
</TR>
</TABLE>
</P></FORM>
</TD>
<%END IF%>
<%'******************CONFIRM*END*****************%>
<%'******************INFO*START*****************%>
<%IF sPage = "info" THEN %>
<TD bgColor=<%= Color2 %> valign="top" >
<TABLE border=0 cellPadding=10 cellSpacing=0  width=100% height="10%" >
<tr>
<TD>
<h1 align="left"><%= ucase(txtinformation) %></h1>
<p align="left">Vores almindelige slags- og leveringsbetingelser<br>
--------------------------------------------------------------------------------<br>
Returret<br>
Vi opfylder selvfølgelig købelovens bestemmelser så du har 14 dages fuld <br>
returret på alle varer !!<br>
Vi bytter altid dine vare hvis du har bestilt forkert uanset hvem der har<br>
lavet fejlen.<br>
<br>
<br>
Forsendelse<br>
Alle varer sendes med Post Danmark A/S.<br>
<br>
<br>
Betaling<br>
<br>
<br>
Efterkrav<br>
Hvis du vælger efterkrav tillægges kr. 48,75. Derudover skal der ved<br>
modtagelsen betales kr. 12,00 til Postvæsenet.<br>
<br>
<br>
Forudbetaling<br>
Hvis du vælger forudbetaling tillægges kr. 25,00. De vil få tilsendte<br>
en e-mail med betalings oplysningerne<br>
<br>
<br>
Afhentning<br>
Hvis du alligevel ikke er helt tryg ved at bestille i vores internet butik<br>
er du meget velkommen til at besøge vores<br>
butik. Her er åben for udlevering af varer Mandag-Fredag kl. 10.00 - 17.30.<br>
Du kan selvfølgelig også bestille varer telefonisk !<br>
<br>
<br>
Forsendelse til udlandet<br>
Forsendelse uden for Danmark sendes for modtagerens egen regning. Og kun<br>
mod forudbetaling.<br>
<br>
<br>
KAL Data & Mobil ApS<br>
Øresundsvej 44<br>
2300 København S.<br>
Telefon 70 27 67 68 Telefax 70 27 61 69<br>
CVR. 16035688<br>
--------------------------------------------------------------------------------<br>
<br>
</p>
</TD>
</tr>
</table>
<%END IF%>
<%'******************INFO*END*********************%>
</td>
</TR>
</TABLE>
</font>
</BODY>
</HTML>
<%
FUNCTION FileExists (ByVal FileName)
on error resume next
FileName = Server.MapPath (FileName)
Set FileObject = Server.CreateObject("Scripting.FileSystemObject")
Set CheckFile = FileObject.OpenTextFile (FileName, 1, FALSE, FALSE)
if err = 0 then
FileExists = TRUE
else
FileExists = FALSE
end if
Set CheckFile = Nothing
Set FileObject = Nothing
end Function
%>
<%
FUNCTION ImageExists (ByVal ImageName)
on error resume next
set rsImage = Server.CreateObject("adodb.recordset")
query = "Select Foto from iInventory Where InventoryID='" & cstr(ImageName) & "'"
rsImage.Open query, dbc, 2, 3
ImageExists = TRUE
if rsImage.eof then ImageExists = FALSE
if isnull(rsImage(0)) then ImageExists = FALSE
if rsImage(0).ActualSize < 1 then ImageExists = FALSE
rsImage.Close
Set rsImage = Nothing
end Function
%>
<BODY>
<%
FUNCTION SendMail (ByVal b)
on error resume next
Dim JMail, h
h = h & vbLF & "<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.0 Transitional//EN'>"
h = h & vbLF & "<HTML><HEAD><TITLE>" & txtConfirmation & "</TITLE>"
h = h & vbLF & "<META http-equiv=Content-Type content='text/html; charset=windows-1252'>"
h = h & vbLF & "<META content='OF2002' name=GENERATOR></HEAD>"
h = h & vbLF & "<BODY style='font-family: Verdana; font-size: 8px'>"
h = h & vbLF & b & "</BODY></HTML>"
Set JMail = Server.CreateObject("JMail.SMTPMail")
JMail.Silent = true
JMail.Logging = true
JMail.ServerAddress = "mail.atznet.dk"
JMail.Sender = "ordre@kal.dk"
JMail.Subject = ucase(txtConfirmation)
JMail.AddRecipient Session("email")
JMail.AddRecipient "order@kal.dk"
'JMail.AddRecipientBCC "xxxxx@sms.mobilix.dk"
JMail.HTMLBody = h
JMail.Priority = 1
'JMail.AddHeader "Originating-IP", Request.ServerVariables("REMOTE_ADDR")
IF NOT JMail.execute THEN
        Response.Write( "<BR>" & "ERROR MESSAGE: " & JMail.ErrorMessage & "<BR>" )
    END IF
Set JMail = Nothing
Session.Abandon
end Function
%>

Default.ini
<%'***********************************************************
'      OfficeFinancials 2002 Internet Shopping Store
'  (c) 1999-2002 Lykke Gruppen ApS, All Rights Reserved.
'***********************************************************%>
<%
'--- Make Database Connections ----
Dim dbc, dbo, strConc, strCono, sPWD
sPWD = "xxxxxxxxxxxxxxx"
strCono = "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" & Server.MapPath("admin\oforders.mdb") & ";PWD="
Set dbo = Server.CreateObject("ADODB.Connection")
dbo.Open strCono & sPWD

strConc = "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" & Server.MapPath("admin\ofproducts.mdb") & ";PWD="
Set dbc = Server.CreateObject("ADODB.Connection")
dbc.Open strConc & sPWD

'--- Accounting  ----
Const cCurrency = " DKK"
Const cCompanyid = 3
Const cTax = 0.25
Const cCompanyName = "KAL Data & Mobil ApS - DanTalk"

'--- Credit Card ----
Const cCurrencyCode = "208"  'ISO codes
Const cMerchantNumber = ""
Const cCaptureURL = ""  'ex. https://pay.domain.com/capture.asp

'--- Payment options ----(Payment1 should always be a cash payment)
Const cPayment1 = "Forudbetaling/Opkrævning/Konto"
Const cPayment2 = ""
Const cPayment3 = ""
Const cPayment4 = ""
Const cPayment5 = ""

'--- Shipment options ----
Const cshipment1 = "Opkrævning"
Const cshipment2 = "Forudbetaling"
Const cshipment3 = "Konto"
Const cshipment4 = ""

'--- Form Colors ----
Const Color1 = "#0080C0"
Const Color2 = "#C0C0C0"
Const Color3 = "#FFFFFF"

'--- Texts ----
Const txtMainFrameText = "Vi har åben på følgende tidspunkter.: <BR><BR>Telefon åben i Erhvervs center Mandag til Fredag 9.00 til 17.00<BR><BR>Butik åben Mandag til Fredag 10.00 til 17.00<BR><BR>Alle priser er uden moms på 25%. Moms er på lagt i indkøbskurven"
Const txtHeaderFrameText = "DanTalk - KAL Data & Mobil ApS"
Const txtButtomFrameText = "Øresundsvej 44 - 2300 København S. - Telefon 70276768"
Const txtEmailText = "info@kal.dk"
Const txtSalesPriceLists = ""
Const txtAdd = "Læg i kurven"
Const txtAddress = "Adresse"
Const txtCard = "Betalingskort"
Const txtCardNumber = "Betalingskort nr."
Const txtCart = "Indkøbskurv"
Const txtCity = "By"
Const txtConfirmation = "Ordrebekræftelse"
Const txtControl = "Kontroller ordren før afsendelse"
Const txtControlCode = "Kontrolcifre"
Const txtCountry = "Land"
Const txtDate = "Dato"
Const txtDecline = "Ordren blev ikke godkendt. Prøv venligst igen."
Const txtEnter = "Indtast følgende information"
Const txtInformation = "information"
Const txtName = "Firma / Navn"
Const txtOrder = "Ordre"
Const txtPayment = "Betaling"
Const txtPhone = "Telefon"
Const txtPostalCode = "Postnr."
Const txtPrice = "Pris"
Const txtPrint = "Udskriv"
Const txtProceed = "Fortsæt"
Const txtProduct = "Produkt"
Const txtQty = "Antal"
Const txtRecalculate = "Opdater"
Const txtRegister = "Gå til kassen"
Const txtRemove = "Slet alt"
Const txtReturn = "Tilbage"
Const txtSend = "Send ordren nu!"
Const txtShipping = "Forsendelse"
Const txtState = "Stat"
Const txtSubtotal = "Netto"
Const txtTax = "Moms"
Const txtThanks = "Tak for ordren!"
Const txtTotal = "Total"
Const txtValid = "Gyldig til (mm/åå)"
%>
Avatar billede henrikgn Nybegynder
05. april 2004 - 18:57 #1
Længste spørgsmål på eksperten endnu?? :)
Avatar billede Ny bruger Nybegynder

Din løsning...

Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.

Loading billede Opret Preview
Kategori
Kurser inden for grundlæggende programmering

Log ind eller opret profil

Hov!

For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester