Nogle som kan finde regnefejl i dette script?
Hej,Kan ikke selv finde ud af ASP, så jeg må spørge jer.
Jeg har en mailer.asp fil, som udregner pris og totalbeløb på en bestillingsliste.
Efter at have bestilt en række varer, kommer den med denne udregnede liste:
Varenr.: Varenavn: Stk. pris kr.: Antal:
04-101 Frokosttallerken, hvid 2,85 100
06-308 Champagneglas, Paris 3,50 50
06-303 Vandglas 2,85 50
06-304 Øl- og sodavandsglas 2,85 100
05-401 Thermokande, kaffe 9,50 7
05-405 Professionel kaffemaskine med 2 kolber 120,00 1
06-101 Hvidvinsglas, Paris 2,85 50
06-102 Dessertvinglas, Paris 2,85 50
01-18080 Bord 180x80 55,00 2
04-400 Salt- og pebersæt, sort top 4,00 7
07-200 Gafler 2,00 50
09-200 3-armet, rund fod 40,00 2
05-100 Kaffekop, hvid med kagetallerken 3,75 50
07-201 Dessertgaffel/Kagegaffel 2,00 50
01-BR150 Bord, rundt Ø 1,50 m. 75,00 7
03-102 Stofdug i hvid 140x220 65,00 2
07-300 Teskeer 2,00 50
09-300 5-armet, rund fod 60,00 7
11-100 Glasaskebæger 2,00 7
05-103 Flødekande, hvid 4,00 7
11-107 Køleskab 150,00 1
11-108 Flagstang med spyd og flag, 4 meter 50,00 2
04-100 Middagstallerken, hvid 3,00 50
06-104 Cognacglas, Paris 2,85 50
02-04 Wienerstol, m. polster 11,00 50
04-102 Sidetallerken, hvid 2,85 50
07-100 Kniv 2,00 50
03-202 Papirdug Ø180 til runde borde, hvid og blå 80.00 7
05-104 Sukkerskål, hvid 4,00 7
06-100 Rødvinsglas, Paris 2,85 50
Kørsel 400,00
Total incl. moms (moms udgør 12.217,40): 61.087,00
Det er åbenlyst, at 61.087,00 kr. er alt for meget for de bestilte varer.
Er der nogle af jer, som kan rette denne fejl?
ASP-fil:
<%@ Language=VBScript %>
<% Session.LCID = 1030 %>
<%
Dim sSubject
Dim sBody, sBodyHtml
Dim iTotal, iXtraRengoring
iTotal = 0
iXtraRengoring = 0
'Ønsker vedr. rengøring
Dim bRengoringService, bRengoringGrill
If Request.Form("RengoringService") = "ON" Then
bRengoringService = True
Else
bRengoringService = False
End If
If Request.Form("RengoringGrill") = "ON" Then
bRengoringGrill = True
Else
bRengoringGrill = False
End If
sBodyHtml = sBodyHtml & "<font size=""2"" face=""Verdana"">Dato: " & Now & "</font><br>"
sBodyHtml = sBodyHtml & "<font size=""2"" face=""Verdana""><strong>Kunde oplysninger:</strong><br>"
sBodyHtml = sBodyHtml & "Kontaktperson: " & Chr(9) & Request.Form("Kontaktperson") & "<br>"
sBodyHtml = sBodyHtml & "Adresse: " & Chr(9) & Chr(9) & Request.Form("Adresse") & "<br>"
sBodyHtml = sBodyHtml & "Postnr.: " & Chr(9) & Chr(9) & Request.Form("Postnr") & "<br>"
sBodyHtml = sBodyHtml & "By: " & Chr(9) & Chr(9) & Chr(9) & Request.Form("By") & "<br>"
sBodyHtml = sBodyHtml & "Telefon nr.: " & Chr(9) & Request.Form("Telefon nr.") & "<br>"
sBodyHtml = sBodyHtml & "Email: " & Chr(9) & Chr(9) & Request.Form("Email") & "<br>"
sBodyHtml = sBodyHtml & "Bemærkninger: " & Chr(9) & Chr(9) & Request.Form("Bemærkninger") & "<br>"
sBodyHtml = sBodyHtml & "Brugsdato: " & Chr(9) & Chr(9) & Request.Form("Brugsdato") & "<br>" & "<br></font>"
'Overføre header til renell mail
sBodyRenell = sBodyHtml
sBodyHtml = sBodyHtml & "<font size=""2"" face=""Verdana""><strong>Din ordre:</strong></font>"
sBodyHtml = sBodyHtml & "<table width=""89%"" border=""1"" bordercolor=""#AAAFB4""><tr>"
sBodyHtml = sBodyHtml & " <td width=""11%"" height=""16"" bgcolor=""#F0F0F0""><font size=""2"" face=""Verdana""><strong>Varenr.:</strong></font></td>"
sBodyHtml = sBodyHtml & " <td width=""63%"" bgcolor=""#DEE0E4""><font size=""2"" face=""Verdana""><strong>Varenavn:</strong></font></td>"
sBodyHtml = sBodyHtml & " <td width=""15%"" bgcolor=""#F0F0F0""> <strong><font size=""2"" face=""Verdana"" align=""right"">Stk. pris kr.:</font></strong></td>"
sBodyHtml = sBodyHtml & " <td width=""11%"" bgcolor=""#DEE0E4""><strong><font size=""2"" face=""Verdana"">Antal:</font></strong></td>"
sBodyHtml = sBodyHtml & "</tr></table>"
sBodyRenell = sBodyRenell & "<font size=""2"" face=""Verdana""><strong>Kundens ordre:</strong></font>"
sBodyRenell = sBodyRenell & "<table width=""89%"" border=""0""><tr>"
sBodyRenell = sBodyRenell & " <td width=""11%"" height=""16""><font size=""2"" face=""Verdana""><strong>Varenr.:</strong></font></td>"
sBodyRenell = sBodyRenell & " <td width=""63%""><font size=""2"" face=""Verdana""><strong>Varenavn:</strong></font></td>"
sBodyRenell = sBodyRenell & " <td width=""15%""><strong><font size=""2"" face=""Verdana"" align=""right"">Stk. pris kr.:</font></strong></td>"
sBodyRenell = sBodyRenell & " <td width=""11%""><strong><font size=""2"" face=""Verdana"">Antal:</font></strong></td>"
sBodyRenell = sBodyRenell & "</tr></table>"
For each item In Request.Form
If (LCase(Left(item, 5)) = "antal") And (IsNumeric(Request.Form(item))) Then
sFormItemNumber = Replace(LCase(item), "antal", "")
sBodyHtml = sBodyHtml & "<table width=""89%"" border=""1"" bordercolor=""#AAAFB4""><tr>"
sBodyHtml = sBodyHtml & " <td width=""11%"" height=""16"" bgcolor=""#F0F0F0""><font size=""2"" face=""Verdana"">" & Request.Form("Varenummer" & sFormItemNumber) & "</font></td>"
sBodyHtml = sBodyHtml & " <td width=""63%"" bgcolor=""#DEE0E4""><font size=""2"" face=""Verdana"">" & Request.Form("Varenavn" & sFormItemNumber) & "</font></td>"
sBodyHtml = sBodyHtml & " <td width=""15%"" bgcolor=""#F0F0F0""><font size=""2"" face=""Verdana"" align=""right"">" & Request.Form("Stk. pris" & sFormItemNumber) & "</font></td>"
sBodyHtml = sBodyHtml & " <td width=""11%"" bgcolor=""#DEE0E4""><font size=""2"" face=""Verdana"">" & Request.Form("Antal" & sFormItemNumber) & "</font></td>"
sBodyHtml = sBodyHtml & "</tr></table>"
sBodyRenell = sBodyRenell & "<table width=""89%"" border=""0""><tr>"
sBodyRenell = sBodyRenell & " <td width=""11%"" height=""16""><font size=""2"" face=""Verdana"">" & Request.Form("Varenummer" & sFormItemNumber) & "</font></td>"
sBodyRenell = sBodyRenell & " <td width=""63%""><font size=""2"" face=""Verdana"">" & Request.Form("Varenavn" & sFormItemNumber) & "</font></td>"
sBodyRenell = sBodyRenell & " <td width=""15%""><font size=""2"" face=""Verdana"" align=""right"">" & Request.Form("Stk. pris" & sFormItemNumber) & "</font></td>"
sBodyRenell = sBodyRenell & " <td width=""11%""><font size=""2"" face=""Verdana"">" & Request.Form("Antal" & sFormItemNumber) & "</font></td>"
sBodyRenell = sBodyRenell & "</tr></table>"
'Prisberegninger
If IsNumeric(Request.Form("Stk. pris" & sFormItemNumber)) Then
iPrice = FormatNumber(Request.Form("Stk. pris" & sFormItemNumber))
iTotal = iTotal + (CDbl(iPrice)*Request.Form(item))
End If
'porcelæn & glas
If bRengoringService And (Left(Trim(Request.Form("Varenummer" & sFormItemNumber)), 2) = "04" Or Left(Trim(Request.Form("Varenummer" & sFormItemNumber)), 2) = "06") Then
'If not = ikke pris for salt og peber bøsse
If Not Trim(Request.Form("Varenummer" & sFormItemNumber)) = "04-400" Then
iXtraRengoring = iXtraRengoring + 1*Request.Form(item)
End If
End If
'Kaffe kander
If bRengoringService And (Trim(Request.Form("Varenummer" & sFormItemNumber)) = "05-400" Or Trim(Request.Form("Varenummer" & sFormItemNumber)) = "05-401") Then
iXtraRengoring = iXtraRengoring + 1.5*Request.Form(item)
End If
'bestik
If bRengoringService And Left(Trim(Request.Form("Varenummer" & sFormItemNumber)), 2) = "07" Then
iXtraRengoring = iXtraRengoring + .5*Request.Form(item)
End If
'skåle og fade
If bRengoringService And Left(Trim(Request.Form("Varenummer" & sFormItemNumber)), 2) = "08" Then
iXtraRengoring = iXtraRengoring + 1.5*Request.Form(item)
End If
'kopper
If bRengoringService And (Left(Trim(Request.Form("Varenummer" & sFormItemNumber)),4) = "05-1" Or Left(Trim(Request.Form("Varenummer" & sFormItemNumber)),4) = "05-2" Or Left(Trim(Request.Form("Varenummer" & sFormItemNumber)),4) = "05-3") Then
iXtraRengoring = iXtraRengoring + 1*Request.Form(item)
End If
'grill
If bRengoringGrill And (Trim(Request.Form("Varenummer" & sFormItemNumber)) = "10-100" Or Trim(Request.Form("Varenummer" & sFormItemNumber)) = "10-101") Then
iXtraRengoring = iXtraRengoring + 350*Request.Form(item)
End If
End If
Next
'Tilføjer pris for rengøring
If iXtraRengoring > 0 Then
'kundens mail
sBodyHtml = sBodyHtml & "<table width=""89%"" border=""1"" bordercolor=""#AAAFB4""><tr>"
sBodyHtml = sBodyHtml & " <td width=""11%"" height=""16"" bgcolor=""#F0F0F0""> <font size=""2"" face=""Verdana""></font></td>"
sBodyHtml = sBodyHtml & " <td width=""63%"" bgcolor=""#DEE0E4""><font size=""2"" face=""Verdana"" align=""right"">Rengøring af service, grill, m.m.</font></td>"
sBodyHtml = sBodyHtml & " <td width=""15%"" bgcolor=""#F0F0F0""><font size=""2"" face=""Verdana"" align=""right"">" & FormatNumber(iXtraRengoring, 2) & "</font></td>"
sBodyHtml = sBodyHtml & " <td width=""11%"" bgcolor=""#DEE0E4""><font size=""2"" face=""Verdana""> </font></td>"
sBodyHtml = sBodyHtml & "</tr></table>"
'renell mail
sBodyRenell = sBodyRenell & "<table width=""89%"" border=""0""><tr>"
sBodyRenell = sBodyRenell & " <td width=""11%"" height=""16""> <font size=""2"" face=""Verdana""></font></td>"
sBodyRenell = sBodyRenell & " <td width=""63%""><font size=""2"" face=""Verdana"" align=""right"">Rengøring af service, grill, m.m.</font></td>"
sBodyRenell = sBodyRenell & " <td width=""15%""><font size=""2"" face=""Verdana"" align=""right"">" & FormatNumber(iXtraRengoring, 2) & "</font></td>"
sBodyRenell = sBodyRenell & " <td width=""11%""><font size=""2"" face=""Verdana""> </font></td>"
sBodyRenell = sBodyRenell & "</tr></table>"
End If
'Føjer rengørings omkostninger til total
If iXtraRengoring > 0 Then
iTotal = iTotal + iXtraRengoring
End If
'Kørsel
If Request.Form("selKommune") = "Helsingør" Then
'iPriceKorsel = FormatNumber(300, 2)
iPriceKorsel = 300
iTotal = iTotal + iPriceKorsel
iKorselComment = False
ElseIf Request.Form("selKommune") = "Øvrige" Then
iPriceKorsel = "?"
iKorselComment = True
Else
'iPriceKorsel = FormatNumber(400, 2)
iPriceKorsel = 400
iTotal = iTotal + iPriceKorsel
iKorselComment = False
End If
'Divide by 100
'iTotal = (iTotal/100) 'Hack som fjernes
'kørsel kunde mail
sBodyHtml = sBodyHtml & "<table width=""89%"" border=""1"" bordercolor=""#AAAFB4""><tr>"
sBodyHtml = sBodyHtml & " <td width=""11%"" height=""16"" bgcolor=""#F0F0F0""> <font size=""2"" face=""Verdana""></font></td>"
sBodyHtml = sBodyHtml & " <td width=""63%"" bgcolor=""#DEE0E4""><font size=""2"" face=""Verdana"" align=""right"">Kørsel</font></td>"
sBodyHtml = sBodyHtml & " <td width=""15%"" bgcolor=""#F0F0F0""><font size=""2"" face=""Verdana"" align=""right"">" & FormatNumber(iPriceKorsel,2) & "</font></td>"
sBodyHtml = sBodyHtml & " <td width=""11%"" bgcolor=""#DEE0E4""><font size=""2"" face=""Verdana""> </font></td>"
sBodyHtml = sBodyHtml & "</tr></table>"
'kørsel renell mail
sBodyRenell = sBodyRenell & "<table width=""89%"" border=""0""><tr>"
sBodyRenell = sBodyRenell & " <td width=""11%"" height=""16""> <font size=""2"" face=""Verdana""></font></td>"
sBodyRenell = sBodyRenell & " <td width=""63%""><font size=""2"" face=""Verdana"" align=""right"">Kørsel</font></td>"
sBodyRenell = sBodyRenell & " <td width=""15%""><font size=""2"" face=""Verdana"" align=""right"">" & FormatNumber(iPriceKorsel,2) & "</font></td>"
sBodyRenell = sBodyRenell & " <td width=""11%""><font size=""2"" face=""Verdana""> </font></td>"
sBodyRenell = sBodyRenell & "</tr></table>"
'Tilføjer total linie
sBodyHtml = sBodyHtml & "<table width=""89%"" border=""1"" bordercolor=""#AAAFB4""><tr>"
sBodyHtml = sBodyHtml & " <td width=""11%"" height=""16"" bgcolor=""#F0F0F0""> <font size=""2"" face=""Verdana""></font></td>"
'Denne antager priserne er incl moms.
sBodyHtml = sBodyHtml & " <td width=""63%"" bgcolor=""#DEE0E4""><font size=""2"" face=""Verdana"" align=""right"">Total incl. moms (moms udgør " & FormatNumber(iTotal-iTotal*0.8, 2) & "):</font></td>"
sBodyHtml = sBodyHtml & " <td width=""15%"" bgcolor=""#F0F0F0""><font size=""2"" face=""Verdana"" align=""right""><u><strong>" & FormatNumber(iTotal, 2) & "</strong></u></font></td>"
'Rette til at priserne er excl. moms.
'sBodyHtml = sBodyHtml & " <td width=""63%"" bgcolor=""#DEE0E4""><font size=""2"" face=""Verdana"" align=""right"">Total incl. moms (moms udgør " & FormatNumber(iTotal*0.25, 2) & "):</font></td>"
'sBodyHtml = sBodyHtml & " <td width=""15%"" bgcolor=""#F0F0F0""><font size=""2"" face=""Verdana"" align=""right""><u><strong>" & FormatNumber(iTotal*1.25, 2) & "</strong></u></font></td>"
sBodyHtml = sBodyHtml & " <td width=""11%"" bgcolor=""#DEE0E4""><font size=""2"" face=""Verdana""> </font></td>"
sBodyHtml = sBodyHtml & "</tr></table>"
'Føjer total til renell mail
sBodyRenell = sBodyRenell & "<table width=""89%"" border=""0""><tr>"
sBodyRenell = sBodyRenell & " <td width=""11%"" height=""16""> <font size=""2"" face=""Verdana""></font></td>"
'Disse to angater alle priser er incl. moms
sBodyRenell = sBodyRenell & " <td width=""63%""><font size=""2"" face=""Verdana"" align=""right"">Total incl. moms (moms udgør " & FormatNumber(iTotal-iTotal*0.8, 2) & "):</font></td>"
sBodyRenell = sBodyRenell & " <td width=""15%""><font size=""2"" face=""Verdana"" align=""right""><u><strong>" & FormatNumber(iTotal, 2) & "</strong></u></font></td>"
'Her rettet til de er excl. moms som så ligges til
'sBodyRenell = sBodyRenell & " <td width=""63%"" bgcolor=""#DEE0E4""><font size=""2"" face=""Verdana"" align=""right"">Total incl. moms (moms udgør " & FormatNumber(iTotal*0.25, 2) & "):</font></td>"
'sBodyRenell = sBodyRenell & " <td width=""15%"" bgcolor=""#F0F0F0""><font size=""2"" face=""Verdana"" align=""right""><u><strong>" & FormatNumber(iTotal*1.25, 2) & "</strong></u></font></td>"
sBodyRenell = sBodyRenell & " <td width=""11%""><font size=""2"" face=""Verdana""> </font></td>"
sBodyRenell = sBodyRenell & "</tr></table>"
'Om kørsel
'sBodyHtml = sBodyHtml & "<font size=""2"" face=""Verdana""><i>OBS! Den oplyste pris er uden kørsel.</i></font><br>"
'sBodyHtml = sBodyHtml & "<font size=""2"" face=""Verdana"">Kørsel indenfor Helsingør Kommune kr. 300,00 incl. Moms.</font><br>"
'sBodyHtml = sBodyHtml & "<font size=""2"" face=""Verdana"">Kørsel til Fredensborg-Humlebæk, Græsted-Gilleleje, Karlebo og Hørsholm kommune kr. 400,00 incl. Moms.</font><br>"
'Forbehold
sBodyHtml = sBodyHtml & "<br><br><font size=""1"" face=""Verdana""><i>Med forbehold for prisændringer, fejl, m.m.</i></font><br><br>"
'Hvis kommune = øvrige
If iKorselComment Then
sBodyHtml = sBodyHtml & "<br><br><font size=""1"" face=""Verdana""><i>Der er ikke medregnet pris for kørsel i dette tilbud, du vil blive kontaktet af Renell vedrørende prisen.</i></font><br><br>"
sBodyRenell = sBodyRenell & "<br><br><font color=""red"" size=""1"" face=""Verdana""><i>Der er ikke medregnet pris for kørsel i dette tilbud, kontakt kunden vedrørende prisen.</i></font><br><br>"
End if
'Hilsen
sBodyHtml = sBodyHtml & "<font size=""2"" face=""Verdana"">Med venlig hilsen</font><br>"
sBodyHtml = sBodyHtml & "<font size=""2"" face=""Verdana"">Servicefirmaet Renell A/S</font><br>"
'mail to website
Dim jmail
Set jmail = Server.CreateObject("JMail.smtpmail")
jmail.ServerAddress = "jaynet"
jmail.ContentType = "text/html"
jmail.AddRecipient "mads@renell.dk"
jmail.Sender = "postmaster@renell.dk"
jmail.SenderName = "Renell website"
jmail.Subject = "Bestilling på nettet"
jmail.Body = "<html><body>" & sBodyRenell & "</body></html>"
jmail.Execute
jmail.Close
Set jmail = Nothing
'html to customer
If Len(Request.Form("Email")) > 6 Then
Set jmail = Server.CreateObject("JMail.smtpmail")
jmail.ServerAddress = "jaynet"
jmail.ContentType = "text/html"
jmail.Sender = "postmaster@renell.dk"
jmail.SenderName = "Renell website"
jmail.Subject = "Bestilling hos Servicefirmaet Renell A/S"
jmail.AddRecipient Request.Form("Email")
jmail.Body = "<html><body>" & sBodyHtml & "</body></html>"
jmail.Execute
jmail.close
Set jmail = Nothing
End If
%>
<html>
<head>
<title>Renell Service A/S</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" background="graphics/leftmenu_bg.gif" link="#032956" vlink="#000000" alink="#000000">
<table width="100%" border="0">
<tr>
<td width="100%" align="center"><font face="Verdana" size="2" color="#000000"><br><br>Deres bestilling er afsendt til Renell.</font></td>
</tr>
</table>
</body>
</html>
Jeg kan også maile filen til dig/jer.
Mvh
Bassa