Ver Mensaje Individual
  #1 (permalink)  
Antiguo 02/12/2004, 20:44
lezamaster
 
Fecha de Ingreso: noviembre-2004
Mensajes: 15
Antigüedad: 19 años, 5 meses
Puntos: 0
problemas con visualizacion y calculos y algo mas

Lo que kiero hacer es lo siguiente primero seleccionar el campo clave y nombre del cliente luego introducir la fecha ,introducir la cantidad, luego seleecionar el nombre y costo de servicio y visualizar en el campo costo el costo de mi servicio y al darle el boton de aceptar en el campo importe me aparezca el resultado de la multiplicaion de la cantidad q introduci y el costo del servicio que fue seleccionado y en el campo total me parezca el mismo resultado

este se llama venta.php
<CENTER>
<FONT face="Lucida Calligraphy">
<?
//Conexion con la base
mysql_connect("localhost","","");
echo '<FORM METHOD="POST" ACTION="venta1.php">';
?>

</select>
<table align="center" width="530" cellspacing="10" cellpadding="2" border="0">
<tr>
<td align="left"><FONT face="Lucida Calligraphy">Clave y Nombre del cliente:</FONT></td>
<td>
<?
//Creamos la sentencia SQL y la ejecutamos
$sSQL="Select clave_cliente, nombre_cliente From cliente Order By clave_cliente";
$result=mysql_db_query("lavanderia",$sSQL);
echo '<select name="clave_cliente">';

//Generamos el menu desplegable
while ($row=mysql_fetch_array($result))
{echo '<option>'.$row["clave_cliente"]. " »» " .$row["nombre_cliente"];}
?>
</td>
</tr>
<tr>
<td align="left"><FONT face="Lucida Calligraphy">Fecha:</FONT></td>
<td><input type="text" name="fecha" size="20" maxlength="50" onkeypress="esunafuncion"></></td>
</tr>
<tr>
<td align="left"><FONT face="Lucida Calligraphy">Cantidad:</FONT></td>
<td><input type="Text" name="cantidad_ingresada" size="20" maxlength="50" onkeypress="esunafuncion"></td>
</tr>
<tr>
<td align="left"><FONT face="Lucida Calligraphy">Nombre y Costo del servicio:</FONT></td>
<td>
<?
//Creamos la sentencia SQL y la ejecutamos
$sSQL="Select clave_servicio, nombre_servicio, costo_servicio From servicio Order By clave_servicio";
$result=mysql_db_query("lavanderia",$sSQL);
echo '<select name="clave_servicio">';

//Generamos el menu desplegable
while ($row=mysql_fetch_array($result))
{echo '<option>'. "Servicio: " .$row["nombre_servicio"]. " »» Costo: " .$row["costo_servicio"];}
?>
</td>
</tr>
<tr>
<td align="left"><FONT face="Lucida Calligraphy">Costo:</FONT></td>
<td><input type="Text" name="Costo_servicio" size="20" maxlength="50" onkeypress="esunafuncion"></td>
</tr>
<tr>
<td align="left"><FONT face="Lucida Calligraphy">Importe:</FONT></td>
<td><input type="Text" name="importe" size="20" maxlength="50" onkeypress="esunafuncion"></td>
</tr>
<tr>
<td align="left"><FONT face="Lucida Calligraphy">Total:</FONT></td>
<td><input type="Text" name="total" size="20" maxlength="50" onkeypress="esunafuncion"></td>
</tr>
</table>
<BR>
<INPUT TYPE="button" value="Aceptar" onClick="esunafuncion)">
</FORM>
</div>
</font>
</CENTER>

este se llama venta1.php
<html>
<head><title>CONTROL DE COBRO</title></head>
<body bgcolor="#C0D9D9">

<?
//Conexion con la base
mysql_connect("localhost","","");
//Ejecucion de la sentencia SQL
mysql_select_db("lavanderia");
mysql_query("insert into venta (nombre_cliente,fecha,cantidad_ingresada,nombre_se rvicio,costo_servicio,importe,total) values ('$nombre_cliente','$fecha','$cantidad_ingresada', '$nombre_servicio','$costo_servicio','$importe','$ total')");
?>

<script>
window.alert("VENTA DADA DE ALTA EXITOSAMENTE")
</script>

</body>
</html>

este formulario lo llamo con un action en el formulario venta.php