reporte_semanal_ventas.php
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<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 class="cuerpo12">
<form name="formulario_busqueda_lote" method="post" action="reporte_ventas.php">
<table align="center">
<tr >
<td>INGRESE NUMERO SEMANA
</td>
<!--<td align="center"><input name="semana" class="estil_cajota" type='text' title='Destino'></td>-->
<td>
<select name="id_ventas" id="ventas" title='ventas' class="estilo_caja" >
<option value='0'> </option>
<?php
include 'conexion.php';
$sql = "select fec_venta from ventas where id_ventas >=1 and id_ventas<=7";
$result = mysql_query("$sql");
$row = mysql_fetch_array($result);
$consulta=mysql_query("SELECT * FROM ventas");
while($registro=mysql_fetch_row($consulta))
{
echo "<option class='uno'>".$registro[0]."</option>";
}
mysql_close($conectar);
?>
</select>
</td>
<td>
</td>
<td>
</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_ventas =$_POST["id_ventas"];
$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"];
$huevos_super =$_POST["huevos_super"];
$precio_unitarioSUPER =$_POST["precio_unitarioSUPER"];
$subtotal_super =$_POST["subtotal_super"];
$descarte =$_POST["descarte"];
$precio_unitarioDESCARTE =$_POST["precio_unitarioDESCARTE"];
$subtotal_descarte =$_POST["subtotal_descarte"];
$total =$_POST["total"];
$conectar= mysql_connect("localhost","root","sena");
mysql_select_db("tecnoavicola19",$conectar);
$resultado = mysql_query("SELECT ventas.id_ventas,fch_venta,huevosA,precio_unitarioA,subtotalA,huevosAA,precio_unitarioAA,subtotalAA,huevosAAA,precio_unitarioAAA,subtotalAAA,
huevos_super,precio_unitarioSUPER,subtotal_super,descarte,precio_unitarioDESCARTE,subtotal_descarte,total FROM ventas WHERE(ventas.id_ventas='$id_ventas' AND fch_venta='$fecha1')",$conectar) or die (mysql_error()) ;
{
echo"
<table width='180' height='200' align='center' cellspacing='0' border='1' cellpadding='0'>
<td align='right' width='9%' height='100' valign='top'><img src='../imagenes/SENA.gif' width='167' height='200' alt='gif' >
</td>
<td align='left' valign='top'><img src='../imagenes/logo4.png' width='765' height='200' alt='gif'></td>";
echo"</table><BR>";
echo"
<table width='100%' bgcolor='#5F9EA0' 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'>Dia</td>
<td align='center'>Huevos A</td>
<td align='center'>Huevos AA</td>
<td align='center'>Huevos AAA</td>
<td align='center'>Huevos Super</td>
<td align='center'>Descarte</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];
$sum_subtotal_super = $sum_subtotal_super $fila[subtotal_super];
$sum_subtotal_descarte= $sum_subtotal_descarte $fila[subtotal_descarte];
$Total_total=$sum_subtotalA $sum_subtotalAA $sum_subtotalAAA $sum_subtotalAAA $sum_subtotal_descarte;
//Contador lineas (registros)
$numreg = 0;
while($fila = mysql_fetch_array($resultado))
{
echo"
<tr>
<td align='center'>$fila[fch_venta]</td>
<td align='center'>$fila[id_ventas]</td>
<td align='center'>$fila[huevosA]</td>
<td align='center'>$fila[huevosAA]</td>
<td align='center'>$fila[huevosAAA]</td>
<td align='center'>$fila[huevos_super]</td>
<td align='center'>$fila[descarte]</td>
</tr>";
echo "</table>";
mysql_close($conectar);
}
}
exit;
?>
