************************
p_compras.php
************************
<html>
<script>
function multiplicar(){
v_pre = document.getElementById("precio").value;
v_can = document.getElementById("CANTIDAD").value;
v_sub = v_pre*v_can;
v_iva= v_sub/100*12;
v_total= v_sub + v_iva;
document.getElementById("SUBTOTAL").value = v_sub;
document.getElementById("IVA").value = v_iva;
document.getElementById("TOTAL").value = v_total;
}
</script>
<body>
<h2> COMPRA DE PRODUCTOS </h2>
<H3>
<form name="form1" id="form1" method= "post"
action="Pg_compras.php" target="v2">
<?php
$opcion= $_POST["op"];
$cod_pro=$_POST["producto"];
//echo $opcion . "<br>";
echo "codigo de producto:" . $cod_pro . "<br>";
include("abre_conexion.php");
$result=mysql_query("select pro_codigo, pro_nombre, mar_des from producto, marca where pro_cmarca= mar_codigo and pro_codigo='$cod_pro'");
while($row=mysql_fetch_array($result))
{
echo "CODIGO " . $row[0] . "<br>";
echo "PRODUCTO: ". $row[1] . "<br>";
echo "MARCA: ". $row[2] . "<br>";
}
include("cierra_conexion.php");
$fechaactual = getdate();
// print_r($fechaactual);
echo "Hoy es: $fechaactual[weekday], $fechaactual[mday] de $fechaactual[month] de $fechaactual[year]";
?>
<P>
PRECIO:
<input type="text" name="precio" id="precio" value=0 onChange="multiplicar();">
</label>
<p>
<P>
CANTIDAD:
<input type="text" name="CANTIDAD" id="CANTIDAD" value=0 onChange="multiplicar();">
</label>
<p>
SUBTOTAL:
<input type="text" name="SUBTOTAL" id="SUBTOTAL">
</label>
<p>
IVA:
<input type="text" name="IVA" id="IVA">
</label>
<p>
TOTAL:
<input type="text" name="TOTAL" id="TOTAL">
</label>
<p>
<input type='SUBMIT' value='guardar' name='guardar' >
<p> <a href='index.html'>VOLVER A MENU </A>"
</form>
</H3>
</body>
</html>
No hay comentarios:
Publicar un comentario