<?php

require_once ("../../config/Cado.php");

require_once ("cTipoperacion.php");

$oTipoperacion = new cTipoperacion();



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



$dts=$oTipoperacion->mostrarTodos();

$num_rows= mysql_num_rows($dts);



?>





<section class="content" id="table" style="min-height:0px;padding-bottom:0px;margin-bottom:-30px;">

  <div class="row">

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

      <div class="box">

        <div class="box-body">

          <table id="tabla_tipoperacion" class="table table-bordered table-striped">

             <thead>

                <tr>

                    <th>NOMBRE</th>

                    <th>TIPO</th>

                    <th>MANUAL</th>

                    <th align="right">ID</th>

                    <th>&nbsp;</th>

                </tr>

            </thead>

            <?php

            if($num_rows>=1){

                ?>  

                <tbody>

                    <?php

                    while($dt = mysql_fetch_array($dts)){

                        ?>

                        <tr>

                            <td><?php echo $dt['tb_tipoperacion_nom']?></td>

                            <td><?php if($dt['tb_tipoperacion_tip']==1)echo 'ENTRADA';

                                if($dt['tb_tipoperacion_tip']==2)echo 'SALIDA';

                                ?></td>

                                <td><?php if($dt['tb_tipoperacion_man']==1)echo 'SI';?></td>

                                <td align="right"><?php echo $dt['tb_tipoperacion_id']?></td>

                                <td align="center">

                                    <button title="Editar" class="btn btn-primary" style="padding:2px 5px;margin:0px 2px" onClick="tipoperacion_form('editar','<?php echo $dt['tb_tipoperacion_id']?>')"><i class="fa fa-pencil"></i></button>

                                    <button  title="Eliminar" class="btn btn-primary" style="padding:2px 5px;margin:0px 2px" onClick="eliminar_tipoperacion('<?php echo $dt['tb_tipoperacion_id']?>')"><i class="fa fa-trash"></i></button> 

                                </td>

                            </tr>

                            <?php

                        }

                        mysql_free_result($dts);

                        ?>

                    </tbody>

                    <?php }?>

                </table>

            </div>

        </div>

    </div>

</div>

</section>



<script type="text/javascript">

  $(function() {  

    $("#tabla_tipoperacion").DataTable( {

      "columnDefs": [

      { "orderable": false, "targets": [2] }

      ],

      "searching": false,

      "order":[[0,"asc"]]

  });

}); 

</script>