File "Exceltodo.php"

Full Path: C:/wamp64/www/INVENTALMACEN/Exceltodo.php
File size: 7.29 KB
MIME-type: text/x-php
Charset: utf-8

<?php 
session_start();
header("Cache-control: private"); // Arregla IE 6

//*******Datos de Conexion Base de Datos************
include("conexion.php");

header("Content-type: application/octet-stream"); 
header("Content-Disposition: attachment; filename=RegistrosInventarios.xls"); 
header("Pragma: no-cache"); 
header("Expires: 0");
$FECHA		=date("Y-m-d");

$CON=$_SESSION['CON'];
$UBI=$_SESSION['CON4']; 
$PLA=$_SESSION['CON5'];
$CONS=$_SESSION['CON5'];
$TKILOS=0;
$TUNI=0;
$TCANASTAS=0;
$TBULTOS=0;
$TCAJAS=0;
$TBASES=0;
$N=0;
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>RegistrosInventarios</title>
</head>

<body>
<FORM>
<center>
  <p><strong>Control de Registros Inventario General AVICAMPO PEREIRA
    </strong>
  </p>
  <p>Parametros de Consulta</p>
  <table width="536" border="1" cellpadding="0" cellspacing="0" bgcolor="#CCCCCC">
    <tr>
      <td height="140"><table width="271" border="0" cellspacing="0">
        <tr>
          <td width="140" height="34"><strong>Consecutivo </strong></td>
          <td width="121"><label for="CON5"><strong>
            <select name="CON" id="CON5">
              <?PHP 						  
                    $tabla = $conexion->query("SELECT * FROM documento ; ");
                    while ($row_consulta_form = $tabla->fetch_array()) {
                    $NOMBREP = $row_consulta_form['dcto'];
					echo '<option value="'.$NOMBREP.'">'.$NOMBREP;'</option>';
					}
					?>
            </select>
          </strong></label></td>
        </tr>
      </table>
        <table width="271" border="0" cellspacing="0">
          <tr>
            <td width="133" height="35"><strong>Ubicación</strong></td>
            <td width="128"><label for="CON6"></label>
              <select name="CON4" id="CON6">
                <?PHP 						  
                    $tabla = $conexion->query("SELECT * FROM ubicacion ; ");
                    while ($row_consulta_form = $tabla->fetch_array()) {
                    $ubi = $row_consulta_form['ubicacion'];
					echo '<option value="'.$ubi.'">'.$ubi;'</option>';
					}
					?>
              </select></td>
          </tr>
        </table>
        <table width="271" border="0" cellspacing="0">
          <tr>
            <td width="137" height="34"><strong>Planillador</strong></td>
            <td width="124"><label for="CON7"></label>
              <select name="CON5" id="CON7">
                <?PHP 						  
                    $tabla = $conexion->query("SELECT DISTINCT PLANILLADOR FROM mvdcto ; ");
                    while ($row_consulta_form = $tabla->fetch_array()) {
                    $NOMBREP = $row_consulta_form['PLANILLADOR'];
					echo '<option value="'.$NOMBREP.'">'.$NOMBREP;'</option>';
					}
					?>
              </select></td>
          </tr>
        </table>
        <table width="271" border="0" cellspacing="0">
          <tr>
            <td width="141" height="33"><strong>Consecutivo</strong></td>
            <td width="120"><label for="CON8"></label>
              <select name="CON6" id="CON8">
                <?PHP 						  
                    $tabla = $conexion->query("SELECT * FROM documento ; ");
                    while ($row_consulta_form = $tabla->fetch_array()) {
                    $NOMBREP = $row_consulta_form['dcto'];
					echo '<option value="'.$NOMBREP.'">'.$NOMBREP;'</option>';

					}
					?>
              </select></td>
          </tr>
        </table></td>
    </tr>
</table>
  <a href="Registrosex.php"><img src="img/excel.png" width="88" height="36" /></a>
  <input type="submit" name="enviar" id="enviar" value="***CONSULTAR INFORMACIÓN***" formmethod="post" formaction="Registros11.php" />
  <table width="1182" border="1" cellpadding="0" cellspacing="0">
    <tr bgcolor="#80FFFF">
      <td><strong>Consecutivo:<?php echo $CON;?></strong></td>
      <td><strong>Ubicación:<?php echo $UBI;?></strong></td>
      <td><strong>Planillador:<?php echo $PLA;?></strong></td>
      <td><strong>Cons:<?php echo $CONS;?></strong></td>
    </tr>
  </table>
  <table width="1171" border="1" cellpadding="0" cellspacing="0" >
    <tr bgcolor="#CCCCCC">
    <td width="55"><center><strong>Reg</strong> </center></td>
      <td width="306"><center><strong>Cod Ubicacion</strong> </center></td>
      <td width="66"><center><strong>Producto</strong></center></td>
       <td width="452"><center><strong>Descripcion</strong></center></td>
      <td width="32"><center> <strong>kilos</strong></center></td>
       <td width="35"><center><strong>unids</strong></center></td>
      <td width="40"><center><strong>Canat</strong></center></td>
      <td width="34"><center><strong>cajas</strong> </center></td>
      <td width="37"><center> <strong>bulto </strong> </center></td>
      <td width="38"><center><p><strong>bases</strong></p> </center></td>
      <td width="52"><center><p><strong>Usuario</strong></p> </center></td>
    </tr>
     <?PHP 						  
                    $tabla = $conexion->query("SELECT * FROM mvdcto WHERE TPDCTO='$CON' AND CODUBI='$UBI' ; ");
                    while ($row_consulta_form = $tabla->fetch_array()) {
                    $BODEGA = $row_consulta_form['CODUBI'];
					$PRODUCTO = $row_consulta_form['CODPROD'];
					$DPRODUCTO = $row_consulta_form['NPROD'];
					$KILOS = $row_consulta_form['CANTIDAD'];
					$UNIDS = $row_consulta_form['CANTEMPAQ'];
					$CAJAS = $row_consulta_form['CANTEMPAQ'];
					$CANASTAS = $row_consulta_form['CNASTAPLL'];
					$BULTOS = $row_consulta_form['BULTOS'];
					$BASES= $row_consulta_form['BASES'];
					$USUARIO= $row_consulta_form['USUARIO'];
					$TKILOS=$TKILOS+$KILOS;
					$TUNI=$TUNI+$UNIDS;
					$TCANASTAS=$TCANASTAS+$CANASTAS;
					$TCAJAS=$TCAJAS+$CAJAS;
					$TBULTOS=$TBULTOS+$BULTOS;
					$TBASES=$TBASES+$BASES;
					$N=$N+1;
					?>  
    <tr>
     <td ><?php echo $N;?></td>
      <td ><?php echo $BODEGA;?></td>
      <td ><?php echo $PRODUCTO;?></td>
      <td ><?php echo $DPRODUCTO;?></td>
      <td align="right"><?php echo $KILOS;?></td>
      <td align="right"><?php echo $UNIDS;?></td>
      <td align="right"><?php echo $CANASTAS;?></td>
      <td align="right"><?php echo $CAJAS;?></td>
      <td align="right"><?php echo $BULTOS;?></td>
     <td align="right"><?php echo $BASES;?></td>  
      <td ><?php echo $USUARIO;?></td>
    </tr>
    <?php }?>
    
      <tr bgcolor="#80FFFF">
      <td>&nbsp;</td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
      <td>Totales según filtros aplicados</td>
      <td align="right"><strong><?PHP echo number_format($TKILOS);?></strong></td>
      <td align="right"><strong><?PHP echo number_format($TUNI);?></strong></td>
      <td align="right"><strong><?PHP echo number_format($TCANASTAS);?></strong></td>
      <td align="right"><strong><?PHP echo number_format($TCAJAS);?></strong></td>
      <td align="right"><strong><?PHP echo number_format($TBULTOS);?></strong></td>
      <td align="right"><strong><?PHP echo number_format($TBASES);?></strong></td>
      <td align="right"><strong></strong></td>
    </tr>
</table>
  <p>&nbsp;</p>
  <p>&nbsp;</p>
  <p>&nbsp;</p>
</center>
</body>
</html>