<?php
 
session_start();
include("DMMYSQLG.php");
include("DSA1000.php");
include("DMMYSQLG.php");
include("DF30000.inc");
include ("varfun.php");
include("DFJQUERY.inc");
?>
<html>
<HEAD> 
<link rel="stylesheet" href="ALM_CSS.css" type="text/css"/>
<meta name="tipo_contenido" content="text/html;" http-equiv="content-type" charset="utf-8">

</HEAD>
<script type="text/javascript" language="JavaScript1.2" src="DSSCRIPT.js"></script>

  	

<body>
<div align="left">

</div>
<div align="center">
  <form name="frm1" id="frm1" method="post" action="">
    <table width="441" border="0">
	<tr>
	  <th>INVENTARIO GENERAL </th>
	  </tr>
	<tr>
	  <td>
	    <span class="Estilo25"><img src="magnifier.png" alt="Buscar" onClick="alert('Buscar')" /></span>
        <select name="agrupador" id="agrupador" onChange="javascript: document.getElementById('frm1').submit()">
          <option value="T">-----TODOS-----</option>
          <?php
    
		  include("DMMYSQLG.php");
			@$resultado=mysqli_query($con ,"select * from fagrupadores where t1='ACTIVO'order by np_desc1");
			if(!isset($_REQUEST['agrupador'])){
				$dt_paises=mysqli_fetch_array($resultado);
				$selPais=$dt_paises['n_reg'];
				if(mysqli_num_rows($resultado)>0)
					mysqli_data_seek($resultado,0);		
			}else{
				$selPais=$_REQUEST['agrupador'];
			}
			while($registro=mysqli_fetch_array($resultado)){
				if($selPais==$registro['n_reg']){
					echo '<option value="' . $registro['n_reg'] . '" selected>' . $registro['np_desc1'] . '</option>';
				}else{
					echo '<option value="' . $registro['n_reg'] . '">' . $registro['np_desc1'] . '</option>';
				}
				}			
		?>
        </select>       		</td>
	  </tr>
	<tr>
	  <td> <span class="Estilo25"><img src="magnifier.png" alt="Buscar" onClick="alert('Buscar')" /></span>
	    <select name="sub" id="sub" onChange="javascript: document.getElementById('frm1').submit()">
          <option  value="T">-----TODOS-----</option>
          <?php
   
		 include("DMMYSQLG.php");
		@$resultado=mysqli_query($con ,"select * from fsubagrupadores where almacen='$selPais' AND t1='ACTIVO' order by np_desc1");
		if(!isset($_REQUEST['sub'])){
			$dt_estado=mysqli_fetch_array($resultado);
			$selEnt=$dt_estado['np_desc1'];
			if(mysqli_num_rows($resultado)>0)
				mysqli_data_seek($resultado,0);		
		}else{
			$selEnt=$_REQUEST['sub'];
		}
		while($registro=mysqli_fetch_array($resultado)){
			if($selEnt==$registro['np_desc1'] ){ 
				echo '<option value="' . $registro['np_desc1'] . '" selected>' . $registro['np_desc1'] . '</option>';
			}else{
				echo '<option value="' . $registro['np_desc1'] . '">' . $registro['np_desc1'] . '</option>';
			}
			}
?>
        </select></td>
	  </tr>
	  
      <tr>
        <td>
            <div align="center">
              <input name="Submit" type="button" class="original" onClick="cargapag('AL30000_PR.php','_self')" value="Buscar"/>
			  
		  </div></td>  </tr>  
	 </table>  
  </form> </div>
<div align="center">
  <form method="post" action="" >
    <?php

	//<input name="bot4" type="button" class="bot_WsW" onClick="cargapag('ger_auditorias_IM.php','_self')" value="Imprimir "/>
	$result = mysqli_query($con ,"select * from farticulos $WHERE order by np_desc1");
	?>
    <div style="height:450px; overflow:scroll; width:1050;">
	<table>
	
      <tr>
        <th width="7%"><div align="center">Clave</div></th>
		<th width="26%"><div align="center">Descripcion</div></th>
		<th width="9%"><div align="center">Almacen</div></th>
		<th width="7%"><div align="center">Existencia</div></th>
		<th width="10%"><div align="center">Costo Prom </div></th>
		<th width="10%"><div align="center">Marca</div></th>
		<th width="7%"><div align="center">CAJERO</div></th>
		
      </tr>
	<?php

	 // --->
	  	$fec = $_POST['fec'];
		include('DF20000.php');
		$fecha_inicial = $f_m;
		
		$fec = $_POST['fec2'];
		include('DF20000.php');
		$fecha_final = $f_m;
	  // -->
	
	$mysql=mysqli_fetch_array(mysqli_query($con ,"select * from fagrupadores where n_reg='".$_POST['agrupador']."'"));
	
	
	if($_POST['agrupador']!='T') {
		 $arrBus[]="WHERE t8='".$mysql['np_desc1']."'";		
	}
	if($_POST['sub']!='T') 
	{
	 	$arrBus[]="t7='".$_POST['sub']."'";
	    
	}else{
	    $sub=mysqli_query($con ,"SELECT distinct(np_desc1) FROM fsubagrupadores where almacen='$selPais' and t1='ACTIVO'");
	}	
	
 	$WHERE=implode(" AND ",$arrBus);
	
	
	
	if ($_POST['sub']!='T'){
	echo "<tr>
          <td colspan='2' style='#9B0F1A'><div align='left'><strong>".$mysql['np_desc1']."-".$_POST['sub']."</strong></div></td>
          </tr>";
	}else{
	while($sql=mysqli_fetch_array($sub)){
	
	//echo "<tr>
      //    <td colspan='2' style='#9B0F1A'><div align='left'><strong>".$mysql['np_desc1']."-".$sql['np_desc1']."</strong></div></td>
       //   </tr>";
	}
	}
	
	$result = mysqli_query($con ,"select * from farticulos $WHERE order by np_desc1");
	$c=0;
	while($reg = mysqli_fetch_array($result))
	{
	
	  	
	echo "<tr>";
		
	echo "<td style='".$col."'> <div align='center' style=' '><strong>" . $reg["nparte1"] . "&nbsp;</strong></div></td>";
	echo "<td style='".$col."'> <div align='left' style=' '><strong>" . $reg["np_desc1"] . "&nbsp;</strong></div></td>";
	echo "<td style='".$col."'> <div align='center' style=' '><strong>" . $reg["sub"] . "&nbsp;</strong></div></td>";
	echo "<td style='".$col."'> <div align='center' style=' '><strong>" . $reg["t5"] . "&nbsp;</strong></div></td>";
	echo "<td style='".$col."'> <div align='center' style=' '><strong>$ " . number_format($reg["cos_prom"],2,'.',',') . "&nbsp;</strong></div></td>";
	echo "<td style='".$col."'> <div align='center' style=' '><strong>" . $reg["marca"] . "&nbsp;</strong></div></td>";
	echo "<td style='".$col."'> <div align='center' style=' '><strong>" . $reg["usuArIo"] . "&nbsp;</strong></div></td></tr>";
	
	//echo "<td style='".$col."'> <div align='left' style=' '><strong>". $reg["fapellido"] . ' '. $reg["fnombre"] . "</strong></div></td>";
			
		$c++;
		
	    }
	     
		echo "<tr>";
		echo "<td style='#9B0F1A'> <div align='right'><strong>".$c."</strong></div></td>";
		echo "<td style='#9B0F1A'> <div align='left'><strong>Articulos Encontrados</strong></div></td>";
		echo "<td colspan='4' style='#9B0F1A'> <div align='center'><strong></strong></div></td></tr>";
		
	mysqli_close($con);
	?>
    </table> </div></form>  </div>  </body>  </html>
<?php
 //303 --> 150  ULTIMA ACTUALIZACION 24/JUNIO/2013 REPORTE DE INVENTARIO GENERAL ?>