File "Registros1.php.bak"

Full Path: C:/wamp64/www/INVENTALMACEN/Registros1.php.bak
File size: 9.55 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");
$FECHA		=date("Y-m-d");
$doc = $_SESSION['dcto'];
$CON=$_SESSION['dcto'];
$UBI=$_SESSION['CON4']; 
$COD=$_SESSION['CON5'];
$PLAN=$_SESSION['CON6'];

$TKILOS=0;
$TUNI=0;
$TCANASTAS=0;
$TBULTOS=0;
$TCAJAS=0;
$TBASES=0;
$N=0;
$D1="";
$D2="";
$D3="";

//***A TODAS LAS UBICACIONES 
if($UBI=="Todas"){$D1="A"; } else {$D1="B";}
if($COD=="Todos"){$D2="A"; } else {$D2="B";}
if($PLAN=="Todos"){$D3="A"; } else {$D3="B";}
$CONSULTAS=$D1.$D2.$D3;
//AAA => Consulta todas las ubicaciones todos los codigos y todos los planilladores 
//ABA => Consulta todas las ubicaciones según el producto
//AAB => Consulta todas las ubicaciones todos lso productos segun digitador
//BAA => Consulta todas una ubicacion especial con todos los codigos y planilladores 
echo $UBI;
echo $COD;
echo $PLAN;
echo $CONSULTAS;
?>

<!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="CON"><strong>
            <select name="CON" id="CON">
              <?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="CON4"></label>
              <select name="CON4" id="CON4">
                <option>Todas</option>
                <?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>Codigo</strong></td>
            <td width="124"><label for="CON5"></label>
              <select name="CON5" id="CON5">
                <option>Todos</option>
                <?PHP 						  
                    $tabla = $conexion->query("SELECT DISTINCT CODPROD, NPROD FROM mvdcto WHERE TPDCTO='$CON'; ");
                    while ($row_consulta_form = $tabla->fetch_array()) {
                    $NOMBREP = $row_consulta_form['CODPROD'];
					$DESCRIPCION = $row_consulta_form['NPROD'];
					echo '<option value="'.$NOMBREP.'">'.$NOMBREP."-".$DESCRIPCION;'</option>';
					}
					?>
              </select></td>
          </tr>
        </table>
        <table width="271" border="0" cellspacing="0">
          <tr>
            <td width="141" height="33"><strong>Planillador</strong></td>
            <td width="120"><label for="CON6"></label>
              <select name="CON6" id="CON6">
                <option>Todos</option>
                <?PHP 						  
                $tabla = $conexion->query("SELECT DISTINCT PLANILLADOR FROM mvdcto WHERE TPDCTO='$CON';");
                    while ($row_consulta_form = $tabla->fetch_array()) {
                    $NOMBREP = $row_consulta_form['PLANILLADOR'];
					echo '<option value="'.$NOMBREP.'">'.$NOMBREP;'</option>';
					}
					?>
              </select></td>
          </tr>
        </table></td>
    </tr>
  </table>
  <table width="178" border="0" cellpadding="0" cellspacing="0">
    <tr>
      <td width="91">Resumido</td>
      <td width="87">Todos </td>
      <td width="87">Todos </td>
    </tr>
    <tr>
      <td><a href="Registrosex.php"><img src="img/excel.png" alt="" width="88" height="36" /></a></td>
      <td><a href="Registrosex1.php"><img src="img/excel.png" alt="" width="88" height="36" /></a></td>
      <td><a href="Exceltodo.php"><img src="img/excel.png" alt="" width="88" height="36" /></a></td>
    </tr>
  </table>
  <a href="Registrosex.php"></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>Producto:<?php echo $COD;?></strong></td>
      <td><strong>Planillador:<?php echo $PLAN;?></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="212"><center><strong>Cod Ubicacion</strong> </center></td>
      <td width="98"><center><strong>Producto</strong></center></td>
       <td width="492"><center><strong>Descripcion</strong></center></td>
      <td width="32"><center> <strong>kilos</strong></center></td>
       <td width="57"><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>
      
    </tr>
     <?PHP 			if($CONSULTAS=="AAA"){			  
                    $tabla = $conexion->query("SELECT DISTINCT CODPROD, CODUBI, NPROD  FROM mvdcto WHERE TPDCTO='$CON'  ORDER BY CODUBI ASC; ");}
					else if($CONSULTAS=="ABA"){
					$tabla = $conexion->query("SELECT DISTINCT CODPROD, CODUBI, NPROD  FROM mvdcto WHERE TPDCTO='$CON' AND CODPROD='$COD' ORDER BY CODUBI ASC; ");}
					else if($CONSULTAS=="AAB"){
					$tabla = $conexion->query("SELECT DISTINCT CODPROD, CODUBI, NPROD  FROM mvdcto WHERE TPDCTO='$CON' AND PLANILLADOR='$PLAN' ORDER BY CODUBI ASC; ");}
					else if($CONSULTAS=="BAA"){
					$tabla = $conexion->query("SELECT DISTINCT CODPROD, CODUBI, NPROD  FROM mvdcto WHERE TPDCTO='$CON' AND CODUBI='$UBI' ORDER BY CODUBI ASC; ");}
					else if($CONSULTAS=="BAB"){
					$tabla = $conexion->query("SELECT DISTINCT CODPROD, CODUBI, NPROD  FROM mvdcto WHERE TPDCTO='$CON' AND CODUBI='$UBI' AND PLANILLADOR='$PLAN'ORDER BY CODUBI ASC; ");}

					 while ($row_consulta_form = $tabla->fetch_array()) {
                    $CODIGO = $row_consulta_form['CODPROD'];
					$UBICACION= $row_consulta_form['CODUBI'];
					$NOMBREP=$row_consulta_form['NPROD'];
					$N=$N+1;

					$tabla2 = $conexion->query("SELECT SUM(CANTIDAD) AS CANTIDAD, SUM(CANTEMPAQ) AS UNIDADES, SUM(CNASTAPLL) AS CANASTAS, SUM(CAJAS) AS CAJAS, SUM(BULTOS) AS BULTOS, SUM(BASES) AS BASES FROM mvdcto WHERE TPDCTO='$CON' AND CODUBI='$UBICACION' AND CODPROD='$CODIGO' ; ");

                    while ($row_consulta_form2 = $tabla2->fetch_array()) {
                    $KILOS = $row_consulta_form2['CANTIDAD'];
					$UNDS = $row_consulta_form2['UNIDADES'];
					$CANASTAS = $row_consulta_form2['CANASTAS'];
					$CAJAS = $row_consulta_form2['CAJAS'];
					$BULTOS = $row_consulta_form2['BULTOS'];
					$BASES = $row_consulta_form2['BASES'];
					$TKILOS=$TKILOS+$KILOS;
					$TUNI=$TUNI+$UNDS;
					$TCANASTAS =$TCANASTAS+$CANASTAS;
					$TCAJAS=$TCAJAS+$CAJAS;
					$TBASES=$TBASES+$BASES;
					
					}
					//$BODEGA1 = $row_consulta_form['CANTIDAD'];

					?>   
        <td width="55"><?PHP echo $N;?></td>
      <td width="212"><?PHP echo $UBICACION;?></td>
      <td width="98" align="center"><?PHP echo $CODIGO;?></td>
       <td width="492"><?PHP echo $NOMBREP;?></td>
       <td width="32" align="right"><?PHP echo number_format($KILOS,2);?></td>
        <td width="57" align="right"><?PHP echo $UNDS;?></td>
         <td width="57" align="right"><?PHP echo $CANASTAS;?></td>
       <td width="57" align="right"><?PHP echo $CAJAS;?></td>
     <td width="57" align="right"><?PHP echo $BULTOS;?></td>
      <td width="57" align="right"><?PHP echo $BASES;?></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>
      
    </tr>
</table>
  <p>&nbsp;</p>
  <p>&nbsp;</p>
  <p>&nbsp;</p>
</center>
</body>
</html>