 <?php

$usuario = $_COOKIE["usuario"];

$nivel = $_COOKIE["nivel"];

if($nivel=="Master"){$usuario="";}







	include_once("../header.php");

        include_once("../php/config.php");
		///mysql_query("delete from ventas where total<=0") or die(mysql_error());

        $sql = mysql_query("select * from productos where stock<=0 order by id_producto asc") or die(mysql_error());



	?>


  <style>
 td{
	 font-size:13px;
 }

  th{
	 font-size:13px;
 }

   .form-control{
	 font-size:13px;
 }


 </style>


    <div class="container">




<span class="text-primary h3"> <i class="bi bi-box"></i> Lista de productos sin inventario</span>
<hr>
		<div class="row">

			<div class="col-md-12">

        <div class="pan1el panel-default">
          <div class="p1anel-heading">




            </div>

  <div class="pan1el-body">



        <a class="btn btn-success mb-2" href="../productos/productos.php"<i class="bi bi-database-add"></i> Crear nuevo producto</a>

         <br><br>

<form method="POST" action="">
<div class="row">
    <div class="col-md-4">
        <input type="search" name="txtBuscar" id="txtBuscar" class="form-control" placeholder="Escriba un nombre para buscar" value="<?php echo $_POST['txtBuscar']?>">
    </div>
</div>

				<div class="table-responsive  p-3 mt-2">



					 <table  class="table table-striped table-hover " data-page-length='8' style="width: 100%;">


              <th>CODIGO</th>

              <th>DESCRIPCION</th>
			  <th>CANTIDAD</th>
              <th>PRECIO</th>
              <th>ACCION</th>



						<tbody>

            <?php while($r=mysql_fetch_array($sql)){

              $codigo = $r["codigo"];
              $id = $r["id_producto"];


              $c++;



              $precio+=$r["precio"];



              ?>

							<tr>


                  <td><a href='../productos/productos.php?filtro=<?php echo $codigo;?>'><i class='bi bi-stickies'></i>  <?php echo  $r["codigo"]?></a></td>



                 <td><a class="text-success" href='../productos/productos.php?id=<?php echo $id;?>&from_agotados=1'><i class='bi bi-stickies'></i><?php echo ($r["descripcion"])?></td>
                  <td><?php echo @decimal($r["stock"])?></td>
                  <td><?php echo @decimal($r["precio"])?></td>






               <td><a class="text-success" href='../productos/recibir.php?id=<?php echo $id;?>'><i class="bi bi-download"></i> Recibir</a></td>


							</tr>

                                                        <?php }?>

						</tbody>

            <tfoot>

              <br>

              <th>

                Cant. lineas: <?php echo $c?>

              </th>

              <th class="text-success">



              </th>







            </tfoot>

					</table>


				</div>
</form>
			</div>

		</div>



        </div>

      </div>









</div>

    </div>



	<!---Modal Cliente-->

	<div class="modal" id="modalBusqueda" data-backdrop="static" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">

      <div class="modal-dialog modal-md" role="document">

        <div class="modal-content">

          <div class="modal-header">

            <h2 class="modal-title text-success" id="exampleModalLabel"><i class="fa  fa-calendar"></i> Busqueda por fecha</h2>

            <button class="close" type="button" data-dismiss="modal" aria-label="Close">

              <span aria-hidden="true">×</span>

            </button>

          </div>

          <div class="modal-body">





		  <form name="frm" action="" method="POST" id="frm">







			   <div class="row">

          <label for="id" class="col-sm-3 col-form-label" >Desde</label>

          <div class="col-sm-9">

            <input autocomplete="off" type="date"  class="form-control mb-2 font-weight-bolde" id="fecha1" name="nombre" value="">

          </div>

        </div>



         <div class="row">

          <label for="codigo" class="col-sm-3 col-form-label" >Hasta</label>

          <div class="col-sm-9">

            <input autocomplete="off" type="date"  class="form-control mb-2" id="fecha2" name="fecha2" value="">

          </div>

        </div>











		  </form>



		  </div>

          <div class="modal-footer">

            <button class="btn btn-success" type="button" onclick="buscar()"><i class="fa fa-w fa-save"></i> Grabar</button>





            <a class="btn btn-warning" data-dismiss="modal"> <i class="fa fa-w fa-home"></i> Salir</a>

          </div>

        </div>

      </div>

    </div>



        <?php

        include_once("../footer.php");



        function state($est) {



            if ($est == "1") {

                $b = "<span class='badge badge-success'>Activo</span>";

            } else {



                $b = "<span class='badge badge-danger'>Inactivo</span>";

            }



            return $b;

        }

        ?>



<script>







function nueva(){

    window.location.href="_nueva_venta.php?caja="+myCaja+"&usuario="+myUser;

   }



function reimprimir(f){

   window.open('ticket_factura.php?folio='+f, '_blank', 'toolbar=no,scrollbars=no,resizable=no,top=500,left=500,width=700,height=800');

}


$(function(){
    $("#txtBuscar").focus();
    $("#txtBuscar").select();
})





     </script>
