Foros del Web » Programando para Internet » PHP »

PHP OO filas dinamicas con bd

Estas en el tema de filas dinamicas con bd en el foro de PHP en Foros del Web. buenas... tengo el siguiente problema, tengo una tabla php, cumple la funcion de una factura comun, la idea es que cuando yo ponga el codigo ...
  #1 (permalink)  
Antiguo 30/11/2014, 06:50
Avatar de cecitn  
Fecha de Ingreso: noviembre-2014
Ubicación: misiones
Mensajes: 44
Antigüedad: 9 años, 5 meses
Puntos: 0
filas dinamicas con bd

buenas...
tengo el siguiente problema, tengo una tabla php, cumple la funcion de una factura comun, la idea es que cuando yo ponga el codigo de un producto ya registrado en la bd, en el campo de alado me salte el precio y que al colocar la cantidad vendida me calcule el subtotal de ese producto y asi con cada producto q ingreso, tambien quiero q las filas sean dinamicas o sea se adapten a la cantidad de productos q vendo y una vez q termino de cargar los productos me sume todos y me calcule el iva y total final. soy nueva en php, hasta ahora el codigo que tengo es el siguiente..

<html>
<head>
<title> Ventas </title>
<link href='estilosventas.css' rel='stylesheet' type='text/css'>
<SCRIPT src="prueba.js"></SCRIPT>
</head>
<body>

<center>
<form name="formulario" action="/sistemamix/menuventas/procesaventas.php" method="post" onsubmit="return control();">
<div style="margin-top: 15px; margin-bottom: 15px;">
<table>
<thead>
<td colspan="2">GIRASOLES <br> <b>Sarmiento</b></td>
<th>N&uacute;mero de Factura</th>
<td>001-<label for="numfact"></label><input type="text" name="inumfact" title="Ingrese n&uacute;mero de factura" id="numfact" size="10" maxlength="15"></td>
<th>
<?php
function hora_local($zona_horaria = 0)
{
if ($zona_horaria > -12.1 and $zona_horaria < 12.1)
{
$hora_local = time() + ($zona_horaria * 3600);
return $hora_local;
}
return 'error';
}
echo gmdate('d-m-Y H:i:s', hora_local(-3));
?>
</th>
</thead>
<thead>
<th>Nombre</th>
<td>
<label="nombre"</label><input type="text" name="inombre"
title="Ingrese Nombre" id="nombre" size="25" maxlength="25">
</td>
<th>Fecha</th>
<td>
<label="fecha"</label><input type="date" name="ifecha"
title="Ingrese fecha" id="fecha" size="25" maxlength="25">
<th>
condic iva
</th>
</thead>
<thead>
</div>
<th>Apellido</th>
<td>
<label="apellido"</label><input type="text" name="iapellido"
title="Ingrese apellido" id="apellido" size="25" maxlength="25">
</td>
<th>CUIL</th>
<td>
<label="cuil"</label><input type="text" name="icuil"
title="Ingrese cuil" id="cuil" size="25" maxlength="25">
</td>
<th>
<select name="OS">
<option value="1">Responsable inscripto</option>
<option value="2">Consumidor final</option>
</select>
</th>
<tr>
<td colspan="2">
<b>Id Vendedor</b>
</td>
<td>
<label="id_vendedor"</label><input type="text" name="iid_vendedor"
title="Ingrese id_vendedor" id="id_vendedor" size="25" maxlength="25">
</td>
<td>
</td>
<td>
</td>
</tr>
</thead>
<tr>
<td><b>C&oacute;digo</b></td>
<td><b>Detalle</b></td>
<td><b>Cantidad</b></td>
<td><b>Precio</b></td>
<td><b>Subtotal producto</b></td>
</tr>
<tr>
<td>
<label="codigo"</label><input type="text" name="icodigo"
title="Ingrese codigo" id="codigo" size="25" maxlength="25">
</td>
<td>
<!-- detalle -->
<label="detalle"</label><input type="text" name="idetalle"
title="Ingrese detalle" id="detalle" size="25" maxlength="25">
</td>
<td>
<!-- cantidad -->
<label="cantidad"</label><input type="text" name="icantidad"
title="Ingrese cantidad" id="cantidad" size="25" maxlength="25">
</td>
<td>
<!-- precio -->
<label="pu"</label><input type="text" name="ipu"
title="Ingrese precio" id="pu" size="25" maxlength="25">
</td>
<td>
<!-- cantidadxprecio -->
<label="psubt"</label><input type="text" name="ipsubt"
title="Ingrese psubt" id="psubt" size="25" maxlength="25">
</td>
</tr>
<tr>
<td></td><td></td><td></td>
<td><b>Subtotal</b></td>
<td>
<label="subt"</label><input type="text" name="isubt"
title="Ingrese subt" id="subt" size="25" maxlength="25">
</td>
</tr>
<tr>
<td></td><td></td><td></td>
<td><b>IVA<b></td>
<td>
<label="iva"</label><input type="text" name="iiva"
title="Ingrese iva" id="iva" size="25" maxlength="25">
</td>
</tr>
<tr>
<td></td><td></td><td></td>
<td><b>Total<b></td>
<td>
<label="total"</label><input type="text" name="itotal"
title="Ingrese total" id="total" size="25" maxlength="25">
</td>
</tr>
</table>
<?php
if(isset($_GET['error'])){
echo "<p style=\"color: red;\">error no ingresaste datos</p>";
}
?>
<button type="submit"><b>Enviar</b></button>
</form>
</center>
<script type="text/javascript">
function control(){
if(document.formulario.inumfact.value=='' || document.formulario.inombre.value==''
|| document.formulario.iapellido.value==''|| document.formulario.icuil.value==''
|| document.formulario.iid_vendedor.value==''|| document.formulario.icodigo.value==''
|| document.formulario.icantidad.value==''|| document.formulario.idetalle.value==''
|| document.formulario.ipu.value==''|| document.formulario.ipsubt.value==''
|| document.formulario.isubt.value==''|| document.formulario.iiva.value==''
|| document.formulario.itotal.value==''){
/*las dos rayas paralelas significan letra o */
alert('debes completar todos los campos');
return false;
}
}
</script>
</body>
</html>

Etiquetas: bd, dinamicas, filas, tabla
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 03:19.