Código fuente de 'Pedidos.asp'
<html>
<head>
<title>Pedidos - Códigos asp, programacion asp, descargas asp, rutinas asp</title>
</head>
<body style="font-family: Arial; font-size: 11pt">
<center><b><font face="Arial" size="3">Pedidos</font></b></center>
<!-- '**************************************
' Name: Hamburger Online
' By: martin castañeda
' http://www.Planet-Source-Code.com/vb/scripts/ShowCode.asp?txtCodeId=6079&lngWId=4
--><br>
<table border="1" width="100%">
<tr>
<td width="121">Nombre:</td>
<td colspan="3"><input name="namex" size="40"></td>
</tr>
<tr>
<td width="121">Dirección:</td>
<td colspan="3"><input name="address" size="40"></td>
</tr>
<tr>
<td width="121">Correo:</td>
<td colspan="3"><input name="email" size="40"></td>
</tr>
<tr>
<td width="121">Pedido</td>
<td width="198">Precio</td>
<td width="215">Cantidad</td>
<td width="168">Total</td>
</tr>
<tr>
<td width="121">Hamburguesa</td>
<td width="198">P9.00</td>
<td width="215"><input name="hamburger"></td>
<td width="168"><input name="totalhamburger"></td>
</tr>
<tr>
<td width="121">Hamb. queso</td>
<td width="198">P11.00</td>
<td width="215"><input name="cheeseburger"></td>
<td width="168"><input name="totalcheeseburger"></td>
</tr>
<tr>
<td width="121">Patatas fritas</td>
<td width="198">P13.00</td>
<td width="215"><input name="frenchfries"></td>
<td width="168"><input name="totalfrenchfries"></td>
</tr>
</tr>
<tr>
<td width="121">Bebida</td>
<td width="198">P9.00</td>
<td width="215"><input name="softdrink"></td>
<td width="168"><input name="totalsoftdrink"></td>
</tr>
<tr>
<td>Total</td>
<td width="198"><input name="grandtotal" size="23"></td>
<td width="215"> </td>
<td width="168"> </td>
</tr>
</table>
<br>
<input type="button" name="order" value="Pedir">
<input type="button" name="resetx" value="Borrar"> <br>
<br>
<a href="index.htm">VBScript Hamburger Created by Martin Castañeda</a> </center>
<script language="vbscript">
<!--
Sub hamburger_onchange
call compute
End Sub
Sub cheeseburger_onchange
call compute
End Sub
Sub frenchfries_onchange
call compute
End Sub
Sub softdrink_onchange
call compute
End Sub
Sub order_onclick
if namex.value<>"" and address.value<>"" and email.value<>"" Then
msgbox("Transacción aceptada. Gracias.")
call initialize
else
msgbox("Debes introducir tu nombre, dirección y coreo electrónico.")
End if
End Sub
Sub resetx_onclick
call initialize
End Sub
Sub initialize
namex.value=""
address.value=""
email.value=""
hamburger.value=""
cheeseburger.value=""
frenchfries.value=""
softdrink.value=""
totalhamburger.value=""
totalcheeseburger.value=""
totalfrenchfries.value=""
totalsoftdrink.value=""
grandtotal.value=""
End Sub
Sub compute
if Not isnumeric(hamburger.value) or hamburger.value="" Then hamburger.value = "0"
if Not isnumeric(cheeseburger.value) or cheeseburger.value="" Then cheeseburger.value = "0"
if Not isnumeric(frenchfries.value) or frenchfries.value="" Then frenchfries.value = "0"
if Not isnumeric(softdrink.value) or softdrink.value="" Then softdrink.value = "0"
totalhamburger.value = hamburger.value * 9
totalcheeseburger.value = cheeseburger.value * 9
totalfrenchfries.value = frenchfries.value * 9
totalsoftdrink.value = softdrink.value * 9
grandtotal.value = csng(totalhamburger.value) + csng(totalcheeseburger.value) + csng(totalfrenchfries.value) + csng(totalsoftdrink.value)
totalhamburger.value = curr(totalhamburger.value)
totalcheeseburger.value = curr(totalcheeseburger.value)
totalfrenchfries.value = curr(totalfrenchfries.value)
totalsoftdrink.value= curr(totalsoftdrink.value)
grandtotal.value = curr(grandtotal.value)
End Sub
function CURR(BYVAL INCOMINGTEXT)
if Not ISNUMERIC(INCOMINGTEXT) Then INCOMINGTEXT = 0
RAWNUM = CDBL(INCOMINGTEXT)
ANYNUM = ABS(RAWNUM)
PESOS = INT(ANYNUM)
CENTAVOS = (ANYNUM-PESOS) * 100
PESOSTR = CSTR(PESOS)
STRLENGTH = LEN(PESOSTR)
POSITION=1
NEWPESOSTR = ""
Do While POSITION < STRLENGTH+1
NEWPESOSTR = MID(PESOSTR,STRLENGTH-(POSITION-1),1) & NEWPESOSTR
if POSITION Mod 3 = 0 and POSITION < STRLENGTH Then
NEWPESOSTR = "," & NEWPESOSTR
End if
POSITION=POSITION+1
LOOP
CENTSTR = LEFT(CSTR(CENTAVOS),2)
Do While LEN(CENTSTR) < 2
CENTSTR=CENTSTR & "0"
LOOP
CURR="P" & NEWPESOSTR & "." & CENTSTR
if SGN(RAWNUM) < 0 Then
CURR = "(" & CURR & ")"
End if
End function
-->
</script>
</body>
</html>