Foros del Web » Programando para Internet » PHP »

reporte

Estas en el tema de reporte en el foro de PHP en Foros del Web. A quien me pueda colaborar. Tengo un formulario que me permite registrar las ventas de huevos de un galpón. En éste registro la fecha de ...
  #1 (permalink)  
Antiguo 17/05/2012, 00:01
 
Fecha de Ingreso: julio-2011
Ubicación: Popayán Cauca
Mensajes: 24
Antigüedad: 12 años, 9 meses
Puntos: 0
Información reporte

A quien me pueda colaborar.
Tengo un formulario que me permite registrar las ventas de huevos de un galpón. En éste registro la fecha de la venta, y el lote de gallinas. También el número de huevos y su respectivo valor. Los huevos se discriminan por tipo; hay cuatro tipos. El objetivo es generar un reporte que me permita mostrar las ventas semanales, o sea 7 ventas, partiendo desde una determinada fecha. Se deben generar al menos 52 reportes, pues este es el tiempo de producción de las gallinas. el formulario tiene un botón que llama a otro archivo donde introduzco el numero del lote y la fecha a partir de la cual se genera el reporte. Este me envía a otro que es el que debe tomar los dos parámetros(numero de lote y la fecha de inicio del reporte)para generar el reporte en sí. les adjunto el código. Gracias.

FORMULARIO VENTAS
<html>
<head>
<titel>formulario ventas</title>
<link rel="stylesheet" href="../herramientas/calendario/system.css"/>
<script type="text/javascript" src="../herramientas/calendario/zapatec.js"></script>
<script type="text/javascript" src="../herramientas/calendario/calendar.js"></script>
<script type="text/javascript" src="../herramientas/calendario/calendar-es.js"></script>
<link rel="Stylesheet" href="estilos/formscss.css">
</head>
<body>
<form name="ventas" method="POST" action="form_ventas1.php" onSubmit="return validar(this)">

<table border="1" width="100%" height="5%" bgcolor="#5F9EA0">
<tr>
<td width="12%" height='1%'align="center"><h3>Fecha</h3></td>
<td valign="middle" align="center"><input id="fch_venta" name="fch_venta" class="estil_caja" type="text"size="11%" title='Fecha de venta' readonly/>
<img id='btn_fch_venta' title="Calendario para Seleccionar la Fecha de venta" src='../herramientas/calendario/calendario_1.gif' border='0' style="cursor:pointer" ></td>

<td class ="titulo1">Identificación del Lote</td>
<td><input name="lote" id="lote"class="estil_caja" type='text' size='10' title='lote' ;"></td>
</tr>
</table>
<table border="1" width="100%" height="5%" bgcolor="#CDCDCD">
<tr>
<td width="13%"><span class="estil_01">Huevos Tipo A</span></td>
<td><input name="huevosA" id="huevosa"class="estil_caja" type='text' size='10' title='HuevosA' onkeyUp="return ValNumero(this);"></td>
<td><span class="estil_01">Precio Unitario. A</span></td>
<td><input name="precio_unitarioA" id="preciou"class="estil_caja" type='text' onChange="calcular(huevosA.value,preciou.value,sub totala);"size='10' title='Precio_unitarioA'></td>
<td><span class="estil_01">Total Venta Tipo A</span></td>
<td><input onFocus="Sumar();" onBlur="NoSumar();" name="subtotalA" id="subtotala" class="estil_caja" type='text' size='10' title='Subtotal venta huevos tipo A'></td>
<td colspan="2" align="center"><span class="estil_01">Observaciones</span></td>
</tr>
<tr>
<td><span class="estil_01">Huevos Tipo AA</span></td>
<td><input name="huevosAA" id="huevosaa"class="estil_caja" type='text'size='10'title='Cantidad huevos AA' onkeyUp="return ValNumero(this);"></td>
<td width="16%"><span class="estil_01">Precio Unitario AA</span></td>
<td><input name="precio_unitarioAA" id="preciou2" onChange="multiplicar(huevosaa.value,preciou2.valu e,precioaa);"class="estil_caja" type='text' size='10' title='Precio unitario huevos AA'></td>
<td><span class="estil_01">Subtotal Venta Tipo AA</span></td>
<td><input onFocus="Sumar();" onBlur="NoSumar();" name="subtotalAA" id="precioaa" class="estil_caja" type='text' size='10' title='Subtotal venta huevos tipo AA'></td>
<td rowspan="3" colspan="2" align="center" ><textarea name="observaciones" class="estilotextarea1"></textarea>
</tr>
<tr>
<td><span class="estil_01">Huevos Tipo AAA</span></td>
<td><input name="huevosAAA" id="huevos3"class="estil_caja" type='text' size='10' title='Cantidad huevos AAA' onkeyUp="return ValNumero(this);"></td>
<td width="6%"><span class="estil_01">Precio Unitario. AAA</span></td>
<td><input name="precio_unitarioAAA" id="preciou3" onChange="multiplicar1(huevos3.value,preciou3.valu e,subt3);"class="estil_caja" type='text' size='10' title='ingrese el precio unitario de huevos tipo AAA'></td>
<td><span class="estil_01">Total Venta Tipo AAA</span></td>
<td><input onFocus="Sumar();" onBlur="NoSumar();" name="subtotalAAA" id="subt3" class="estil_caja" type='text' size='10' title='Subtotal venta huevos tipo AAA'></td>
</tr>
<tr>
<td align="center" width="30%"><span class="estil_01"><h4>Precio Total Ventas</h4></span></td>
<td align="center"><input onFocus="Sumar();" type="text" size='10' class="estil_caja" name="total" id="ventotal" size='13' title='Valor venta total'></td>
</tr>
</table>
<p align="center">
<input type='submit' name='boton' class='boton' value='Guardar'>
<input id="consulta" name="consulta" class='boton' type="button" value="Reporte" style='cursor:pointer' onClick="Ifr_consulta.location.href='reporte_seman al_ventas.php';">
<input type="reset" name="boton" value="Cancelar" class="boton">
</p>
<table width="100%" height="5%" border="1" align="center" cellspacing="1" cellpadding="1" >
<tr align='center'>
<td valign='top' >
<center>
<iframe name='Ifr_consulta' width='99%' height='250' align='center' frameborder='0' src='blanco1.html'></iframe>
</center>
</td>
</tr>
</table>
</form>
<script type="text/javascript">
Zapatec.Calendar.setup({
weekNumbers : false,
showOthers : true,
showsTime : false,
step : 1,
electric : true,
inputField : "fch_venta",
button : "btn_fch_venta",
timeFormat : 24,
timeInterval : 05,
ifFormat : '%Y-%m-%d',
daFormat : '%Y-%m-%d'
});
</script>
</body>
</html>

reporte_semanal_ventas.php
<html xmlns="http://www.w3.org/1999/xhtml">
<head><title>busqueda lote</title>
<link rel="stylesheet" href="../herramientas/calendario/system.css"/>
<script type="text/javascript" src="../herramientas/calendario/zapatec.js"></script>
<script type="text/javascript" src="../herramientas/calendario/calendar.js"></script>
<script type="text/javascript" src="../herramientas/calendario/calendar-es.js"></script>
<link rel="Stylesheet" href="estilos/formscss.css">
</head>
<body>
<form name="formulario_busqueda_lote" method="post" action="reporte_ventas.php">
<table align="center">
<tr>
<td><input name="lote" id="lote"class="estil_caja" type='text' size='10' title='lote' ;"></td>

<td valign="middle" align="center"><input id="fch_venta1" class="estil_caja" name="fch_venta1" class="campo_fcha" type="text"
size ="13%" title='Fecha venta1' readonly>
<img id='btn_fch_venta1' title="Calendario para Seleccionar la fecha de venta"
src='../herramientas/calendario/calendario_1.gif' border='0' style="cursor:pointer" >
</td>
<td><input name="boton" type="submit" value="buscar"></td>
</tr>
</table>
</form>
<script type="text/javascript">
Zapatec.Calendar.setup({
weekNumbers : false,
showOthers : true,
showsTime : false,
step : 1,
electric : true,
inputField : "fch_venta1",
button : "btn_fch_venta1",
timeFormat : 24,
timeInterval : 05,
ifFormat : '%Y-%m-%d',
daFormat : '%Y-%m-%d'
});
</script>
</body>
</html>

reporte_ventas.php

<?php
$fecha1=$_POST["fch_venta1"];
$id_lote =$_POST["id_lote"];
$huevosA =$_POST["huevosA"];
$precio_unitarioA =$_POST["precio_unitarioA"];
$subtotalA =$_POST["subtotalA"];
$huevosAA =$_POST["huevosAA"];
$precio_unitarioAA =$_POST["precio_unitarioAA"];
$subtotalAA =$_POST["subtotalAA"];
$huevosAAA =$_POST["huevosAAA"];
$precio_unitarioAAA =$_POST["precio_unitarioAAA"];
$subtotalAAA =$_POST["subtotalAAA"];
$total =$_POST["total"];
$conectar= mysql_connect("localhost","root","sena");
mysql_select_db("tecnoavicola19",$conectar);
$resultado = mysql_query("SELECT ventas.id_lote,fch_venta,huevosA,precio_unitarioA, subtotalA,huevosAA,precio_unitarioAA,subtotalAA,hu evosAAA,precio_unitarioAAA,subtotalAAA,
total FROM ventas WHERE(ventas.id_lote='$id_lote' )",$conectar) or die (mysql_error()) ;
{
echo"
<table width='100%' border='0'>
<td align='center'><h3>Reporte de Ventas</h3></td>";
echo"</table>";
echo "
<table width='100%' bgcolor='#5F9EA0' border='1'>
<tr>
<td align='center'>Fecha</td>
<td align='center'>Lote</td>
<td align='center'>Huevos A</td>
<td align='center'>Huevos AA</td>
<td align='center'>Huevos AAA</td>
</tr>";


$sum_huevosA = $sum_huevosA + $fila[total_huevosA];
$sum_huevosAA = $sum_huevosAA + $fila[total_huevosAA];
$sum_huevosAAA = $sum_huevosAAA + $fila[total_huevosAAA];
$sum_huevos_super = $sum_huevos_super + $fila[total_super];
$sum_descarte = $sum_descarte + $fila[total_descarte];
$sum_subtotalA = $sum_subtotalA + $fila[subtotalA];
$sum_subtotalAA = $sum_subtotalAA + $fila[subtotalAA];
$sum_subtotalAAA = $sum_subtotalAAA + $fila[subtotalAAA];
$Total_total=$sum_subtotalA + $sum_subtotalAA + $sum_subtotalAAA + $sum_subtotalAAA + $sum_subtotal_descarte;
while($fila = mysql_fetch_array($resultado))
{
echo"
<tr>
<td align='center'>$fila[fch_venta]</td>
<td align='center'>$fila[id_lote]</td>
<td align='center'>$fila[huevosA]</td>
<td align='center'>$fila[huevosAA]</td>
<td align='center'>$fila[huevosAAA]</td>
</tr>";
echo "</table>";
mysql_close($conectar);
}
}
exit;
?>

Etiquetas: formulario, html, mysql, registro, reporte
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 18:04.