 <?php

session_start();
require_once ("../../config/Cado.php");
require_once("cNotacredito.php");
$oNotacredito = new cNotacredito();

require_once("../guiaremision/cGuiaremision.php");
$oGuiaremision = new cGuiaremision();

require_once ("../notadebito/cNotadebito.php");
$oNotadebito = new cNotadebito();

require_once ("../venta/cVenta.php");
$oVenta = new cVenta();
$coddoc = '07';

require_once ("../historial/cHistorial.php");
$oHistorial = new cHistorial();


require_once ("../formatos/formato.php");

$fecha1 = $_POST['txt_fil_notcre_fec1']; 
$fecha2 = $_POST['txt_fil_notcre_fec2']; 

echo $_POST['hdd_fil_cli_id'].'--';

$dts1=$oNotacredito->filtrar(fecha_mysql($fecha1),fecha_mysql($fecha2),$_POST['cmb_fil_puntoventa_id'],$_POST['txt_fil_docnum'],
$_POST['cmb_fil_mon_id'],$_POST['hdd_fil_cli_id'],$_POST['cmb_fil_nc_estsun'],20);

$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_venta" class="table table-bordered table-striped">

		  
           <thead>
    <tr>
	<th></th>
	
	   <th nowrap >N° DOCUMENTO</th>
      <th class="" >FECHA</th>
      <th class="" >CLIENTE</th>
      <th class="" >MOTIVO</th>
      <th nowrap >TOTAL OPERACION</th>
      
    </tr>
  </thead> 
            <tbody>
    <?php
    if($num_rows>0){
    while($dt1 = mysqli_fetch_array($dts1))
    {
     
	 
    ?>
    <tr>
	   
	  <td nowrap >

		<span class="btn btn-sm btn-primary " style="cursor:pointer" onClick="notacredito_seleccion('','<?php echo $dt1['tb_notacredito_id']?>','<?php echo $dt1['tb_notacredito_numdoc']?>','<?php echo moneda_mysql($dt1['tb_notacredito_tot']) ?>')" ><i class="fas fa-check-circle"></i></span>

	  </td>
		
      <td align="right" nowrap="nowrap"><?php echo $dt1['tb_notacredito_numdoc']?></td>
      <td class="" title="FECHA DE REGISTRO : <?php echo $dt1['tb_notacredito_reg'];  ?>" nowrap="nowrap"><?php echo mostrarFecha($dt1['tb_notacredito_fec'])?></td>
      <td nowrap="nowrap"><?php echo $dt1['tb_cliente_nom']?></td>
      <td class="" ><?php echo $dt1['tb_notacredito_motivo'];?></td>
      <td  align="right" nowrap ><?php echo formato_money($dt1['tb_notacredito_tot']);?></td>										
	</tr>
	
	
    <?php
  }
  mysqli_free_result($dts1);
  }
  ?> 
		
</tbody> 

        </table>
				
		</div>
      </div>
    </div>
  </div>
</div>
</div>
</section>


 <script type="text/javascript">
  $(function() {  
    $("#tabla_venta").DataTable({
      "columnDefs": [
      { "orderable": false, "targets": [3,4] }
      ],
      "searching": false,
      "order":[[0,"asc"]]
    });
  }); 
</script>  