<?php
require_once ("../../config/Cado.php");
require_once ("cEmpresa.php");
$oEmpresa = new cEmpresa();
$dts1=$oEmpresa->mostrar_filtro();
$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_empresa" class="table table-bordered table-striped">
             <thead>
                <tr>               
                    <th>RUC</th>
                    <th>NOMBRE COMERCIAL</th>                                
                    <th>RAZON SOCIAL</th>
                    <th>DIRECCION</th>
                    <th>TELEFONO</th>
                    <th>EMAIL</th>
                    <th>REPRESENTANTE</th>
                    <th>ID</th>
                    <th>&nbsp;</th>
                </tr>
            </thead>
             <tbody>
                <?php
                    if($num_rows>0){
                    while($dt1 = mysqli_fetch_array($dts1)){?>
                        <tr>                            
                            <td><?php echo $dt1['tb_empresa_ruc']?></td>
                            <td><?php echo $dt1['tb_empresa_nomcom']?></td>
                            <td><?php echo $dt1['tb_empresa_razsoc']?></td>
                            <td nowrap ><?php echo $dt1['tb_empresa_dir']." ".$dt1['tb_empresa_dir2']?></td>                     
                            <td><?php echo $dt1['tb_empresa_tel']?></td>
                            <td><?php echo $dt1['tb_empresa_ema']?></td>
                            <td><?php echo $dt1['tb_empresa_rep']?></td>
                            <td><?php echo $dt1['tb_empresa_id']?></td>
                            <td align="center" nowrap="nowrap">
							<button class="btn btn-sm btn-primary" onClick="empresa_form('editar','<?php echo $dt1['tb_empresa_id']?>')" ><i class="fas fa-edit"></i></button>
							<button class="btn btn-sm btn-primary" onClick="eliminar_empresa('<?php echo $dt1['tb_empresa_id']?>')" ><i class="fas fa-trash"></i></button>
							
							</td>
                        </tr>
                <?php
                }
                }
                mysqli_free_result($dts1);
                ?>
                </tbody>
</table>
	
	</div>

</div>
</div>
</div>
</div>
</div>
</section>
<script type="text/javascript">
    $(function() {  
	 $('#tabla_empresa').DataTable({
      "responsive": true,
      "autoWidth": false
    });
	
    }); 
</script>