<div class="content-wrapper">

  <section class="content-header">
    
    <h1>
      
      Administrar cobranzas
    
    </h1>

    <ol class="breadcrumb">
      
      <li><a href="inicio"><i class="fa fa-dashboard"></i> Inicio</a></li>
      
      <li class="active">Administrar cobranzas</li>
    
    </ol>

  </section>

  <section class="content">

    <div class="box">

      <div class="box-header with-border">
  
        <a href="crear-cobros">

          <button class="btn btn-primary">
            
            Agregar cobranzas

          </button>

        </a>

      </div>

      <div class="box-body">
        
       <table class="table table-bordered table-striped dt-responsive tablas">
         
        <thead>
         
         <tr>
           
           <th style="width:10px">#</th>
           <th>Código A</th>
           <th>Código R</th>      
           <th>Cliente</th>
           <th>Documento</th>
           <th>Dirección</th>
           <th>Valor Total</th>                      
           <th>Fecha</th>
           <th>Estado</th>            
           <th>Acciones</th>

         </tr> 

        </thead>

        <tbody>

        <?php

        $item = null;
        $valor = null;

        $cobros = ControladorCobros::ctrMostrarCobros($item, $valor);
        //Parse error: syntax error, unexpected end of file in C:\xampp\htdocs\SisRecoleccion\vistas\modulos\contratos.php on line 111

       foreach ($cobros as $key => $value){
         
          echo ' <tr>
                  <td>'.($key+1).'</td>
                  <td>'.$value["codigoA"].'</td>
                  <td>'.$value["codigoR"].'</td>';

                 $itemPersona="idpersona";
                 $valorPersona=$value["idpersona"];
                 $respuestaPersona=ControladorPersonas::ctrMostrarPersonas($itemPersona, $valorPersona);              
                 
                echo '<td>'.$respuestaPersona["nombres"].'</td>';

                echo '<td>'.$respuestaPersona["documento"].'</td>';

                echo '<td>'.$respuestaPersona["direccion"].'</td>';

                echo '<td>'.number_format($value["total"],2,'.',',').'</td>';

                                


                $itemTipoServicio="idservicios";
                $valorTipoServicio=$value["idservicios"];
                $respuestaTipoServicio=ControladorServicios::ctrMostrarServicios($itemTipoServicio, $valorTipoServicio);

                echo '<td>'.$value["fecha_cobro"].'</td>';

                 if($value["estado"] != 0){

                    echo '<td><span class="badge bg-green" idUsuario="'.$value["idcobros"].'" estadoCobro="1">Aceptado</span></td>';



                  }else{

                    echo '<td><span class="badge bg-red" idUsuario="'.$value["idcobros"].'" estadoCobro="0">Eliminado</span></td>';

                  }                                
                

                       echo '<td>


                      <div> 

                        <button class="btn btn-info btnImprimirTicket" idcobros="'.$value["idcobros"].'">
                        <i class="fa fa-print"></i></button> 

                        <button class="btn btn-success btnImprimirComprobanteC" idcobros="'.$value["idcobros"].'">
                        <i class="fa fa-file"></i></button>                        
                        
                        <button class="btn btn-warning btnDetalleCobro"  idcobros="'.$value["idcobros"].'"><i class="fa fa-eye"></i></button>';

                      

                          if($value["estado"] != 0){

                            echo ' <button class="btn btn-danger btnEliminarCobros" idcobros="'.$value["idcobros"].'" estadoCobro="0"><i class="fa fa-trash"></i></button>';



                          }else{

                            if($_SESSION["perfil"] == "Administrador"){

                            echo ' <button class="btn btn-info btnEliminarCobros" idcobros="'.$value["idcobros"].'" estadoCobro="1"><i class="fa fa-refresh"></i></button>';
                            }

                        }


                      


                      


                      echo '</div>  

                    </td>            

                  

                </tr>';
        }


        ?> 

        </tbody>

       </table>

      </div>

    </div>

  </section>

</div>





<div id="modalEditarContrato" class="modal fade" role="dialog">
  
<div class="modal-dialog modal-lg">
    <div class="modal-content">

      <form role="form" method="post">

        <!--=====================================
        CABEZA DEL MODAL
        ======================================-->

        <div class="modal-header" style="background:#3c8dbc; color:white">

          <button type="button" class="close" data-dismiss="modal">&times;</button>

          <h4 class="modal-title">Cronograma de Pagos</h4>

        </div>

        <!--=====================================
        CUERPO DEL MODAL
        ======================================-->

        <div class="modal-body">

          <div class="box-body">

            <table class="table table-bordered table-striped dt-responsive tablas tablaContratos" width="100%">
         
        <thead>
         
         <tr>
           
           <th style="width:10px">#</th>
           <th>Fechas de pagos</th>
           <th>Monto</th>
           <th>Estado</th>
           
         </tr> 

        </thead>

        <tbody id="tablebody1">
         
   
        </tbody>

       </table>            
            
  
          </div>

        </div>



        <!--=====================================
        PIE DEL MODAL
        ======================================-->

        <div class="modal-footer">

          <button type="button" class="btn btn-danger pull-right" data-dismiss="modal">Close</button>
          

        </div>

      </form>

      </div>

  </div>

</div>
