<?php 
//ini_set("display_errors",1);
session_start();
require_once ("../../config/Cado.php");
require_once ("cQuiebrestock_cst.php");
$oQuiebrestock_cst = new cQuiebrestock_cst();
require_once("../almacen/cAlmacen.php");
$oAlmacen = new cAlmacen();
require_once ("../formatos/formato.php");

            $dts1=$oAlmacen->mostrarAlmCajEmp($_POST['cmb_fil_puntoventa_id']);
			$dt1 = mysqli_fetch_array($dts1);
 			$punven_id=$dt1['tb_puntoventa_id'];
 			$piso_id=$dt1['tb_piso_id'];
 			$alm_id = $dt1['tb_almacen_id'];
 		
			mysqli_free_result($dts1);



$fecha1 = $_POST['txt_fil_com_fec1']; 
$fecha2 = $_POST['txt_fil_com_fec2'];
$num_rows= 0;
if($_POST['cmb_fil_puntoventa_id']>0){

$dts1=$oQuiebrestock_cst->mostrar_Quiebrestockporventas(fecha_mysql($fecha1),fecha_mysql($fecha2),$alm_id,$_POST['cmb_fil_puntoventa_id']);
$num_rows= mysqli_num_rows($dts1);
}
?>

<section class="content">
	<div class="container-fluid">
	<div class="row">
	    <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
		    <div class="card">
				<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12" style="padding:5px;">	
					
		<div class="table-responsive">	
          <table id="tabla_ven" class="table">
            <thead>
			
              <tr>
                <th class="" >PRODUCTO</th>
                <th class="" >LABORATORIO</th>          
                <th class="" >EMPAQUE</th>          
                <th class="" >CANTIDA VENDIDA</th>          
                <th class="" >STOCK ACTUAL</th>          
              </tr>
            </thead>
            <tbody>
      <?php
       if($num_rows>0){
           $i=0;
      while($dt1 = mysqli_fetch_array($dts1))
      {
         
           
		    $pronom =  $dt1['tb_producto_nom'];
		    $canven =  $dt1['cantidadvendida'];
		    $marnom =  $dt1['tb_marca_nom'];
		    $empnom =  $dt1['tb_empaque_nom'];
		    $stock =  $dt1['stock'];
          
          if($stock<=0){
            
      ?>
      <tr>
        <td NOWRAP class="" ><strong><?php echo $pronom ?></strong></td>
        <td NOWRAP class="" ><?php echo $marnom ?></td>
        <td NOWRAP class="" ><?php echo $empnom ; ?></td> 
        <td NOWRAP align="right"><?php echo formato_money($canven) ?></td>
        <td NOWRAP align="right"><?php echo $stock ?></td>
     </tr>
      <?php	  
          }
    }
    mysqli_free_result($dts1);
    }
    ?>
  </tbody>
            </table>
         </div>

		
	<br/>
	<br/>
	<!--
		<div class="table-responsive">
			<div class="col-lg-5 col-md-5 col-sm-12 col-xs-12" >	
          <table id="tabla_compra" class="table">
            
			<tr>
			<th class="bg bg-yellow" colspan="2" >RESUMENES</th>
			</tr>
            <?php 
			$totcaj = $tot - $totd;
			?>
			<tr>
                <th class="" >TOTAL VENTAS</th>
				<td><?php echo ''.formato_money4($sum_diff) ?></td>
            </tr>
			
            </table>
			
			</div>
		</div>
			-->
		
        </div>
        </div>
      </div>
    </div>
    </div>
  </section>

  
   <script type="text/javascript">
  $(function() {  
    
	 $('#tabla_dev,#tabla_ven').DataTable({
 
        "language": {
                "lengthMenu": "Mostrar _MENU_ registros",
                "zeroRecords": "No se encontraron resultados",
                "info": "Mostrando registros del _START_ al _END_ de un total de _TOTAL_ registros",
                "infoEmpty": "Mostrando registros del 0 al 0 de un total de 0 registros",
                "infoFiltered": "(filtrado de un total de _MAX_ registros)",
                "sSearch": "Buscar:",
                "oPaginate": {
                    "sFirst": "Primero",
                    "sLast":"Último",
                    "sNext":"Siguiente",
                    "sPrevious": "Anterior"
			     },
			     "sProcessing":"Procesando...",
            }
    });  
	

  }); 
</script>  