<?php if( $presupuestos->count() >0 ): ?>
  <!--<?php echo QrCode::size(150)->errorCorrection('Q')->generate("Departamento de servicios escolares-Dr. Eduardo López Sandoval-Recepción:20-12-2019 7:51 am-Autorización:20-12-2019, 7:51 am-Identificador:4257"); ?>-->
  
  <h2 class="text-center">Importes del Programa Operativo Anual correspondientes por departamento</h2>

  <div class="row">
    <div class="col-md-2 col-sm-12"></div>
    <div class="col-md-8 col-sm-12">
      <div class="row encabezado" style="margin-bottom: 15px;">
        <div class="col-md-2 col-sm-6 bg-dark-blue">Autorizado</div>
        <div class="col-md-2 col-sm-6 bg-white d-flex justify-content-around" style="border: 1px solid #c5c5c5 !important;">$<span><?php echo e($depto_limite->autorizado); ?></span></div>
        <div class="col-md-2 col-sm-6 bg-dark-blue">Límite</div>
        <div class="col-md-2 col-sm-6 bg-white d-flex justify-content-around" style="border: 1px solid #c5c5c5 !important;">$<span><?php echo e($depto_limite->limite); ?></span></div>
        <div class="col-md-2 col-sm-6 bg-dark-blue">Ejercido</div>
        <div class="col-md-2 col-sm-6 bg-white d-flex justify-content-around" style="border: 1px solid #c5c5c5 !important;">$<span><?php echo e($depto_limite->ejercido); ?></span></div>
      </div>
    </div>
    <div class="col-md-2 col-sm-12"></div>
  </div>

  <?php $link=""; $contenido=""; $a = "active"; $s = "show"; $as = "true" ?>
  <?php $__currentLoopData = $presupuestos; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $p): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
    <?php
      $link.="<label class='nav-item nav-link nav-bg-dark-blue mr-1 $a' id='nav-".$p->id."-tab' data-toggle='tab' href='#nav-".$p->id."' role='tab'>".$p->accion['clave_completa']."</label>";

      $contenido.="<div class='tab-pane fade $s $a' id='nav-".$p->id."' role='tabpanel' >
                    <br>

                    <div class='row justify-content-between'>
                      <div class='col-6'>
                        <h2>Distribución del Programa Operativo Anual Autorizado por Partida</h2>
                      </div>
                      <div class='col-2'>
                        <button type='button' onclick=\"javascript:detalle_clave_presupuestal(".$p->accion->id.", '".$p->accion->clave_completa."');\" class='btn btn-outline-dark ml-5 btn-sm'><i class='fa fa-paste'></i> Detalles</button>
                      </div>
                    </div>";?>

      <?php if( $p->detalles->count()>0 ): ?>
        <?php 
          $contenido.=" 
                    <div class='row'>
                      <div class='col-lg-2 col-md-1 col-sm-12'>&nbsp;</div>
                      <div class='col-lg-8 col-md-10 col-sm-12'>
                        <div class='table'>
                          <div class='row encabezado gris'>
                            <div class='col-md-2 col-sm-2 d-none d-sm-block'>Partida</div>
                            <div class='col-md-2 col-sm-2 d-none d-sm-block'>Autorizado</div>
                            <div class='col-md-2 col-sm-2 d-none d-sm-block'>Adecuado</div>
                            <div class='col-md-2 col-sm-2 d-none d-sm-block'>Requisición</div>
                            <div class='col-md-2 col-sm-2 d-none d-sm-block'>Real</div>
                            <div class='col-md-2 col-sm-2 d-none d-sm-block'>Disponible</div>
                          </div>

                          <div class='row contenido-700'>
                            <div class='col-md-12'>";
                            $auto=0; $adec=0; $requ=0; $ejer=0; $disp=0; ?>

                                <?php $__currentLoopData = $p->detalles; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $d): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                
                                  <?php $contenido.="
                                  <div class='row cuerpo'>
                                    <div class='col-6 d-block d-sm-none gris text-center'>Partida</div>
                                    <div class='col-md-2 col-sm-2 col-6 d-block d-sm-none gris text-center' data-toggle='popover' data-trigger='hover' data-placement='right' data-content='".$d->partida->descripcion."'>$d->partida_id</div>
                                    <div class='col-md-2 col-sm-2 col-6 d-none d-sm-block text-center' data-toggle='popover' data-trigger='hover' data-placement='right' data-content='".$d->partida->descripcion."'>$d->partida_id</div>
                                    
                                    <div class='col-6 d-block d-sm-none text-center'>Autorizado</div>
                                    <div class='col-md-2 col-sm-2 col-6 text-right'>$ <span>".number_format($d->autorizado, 2)."</span></div>
                                    
                                    <div class='col-6 d-block d-sm-none text-center'>Adecuado</div>
                                    <div class='col-md-2 col-sm-2 col-6 text-right'>$ <span>".number_format($d->adecuado, 2)."</span></div>
                                    
                                    <div class='col-6 d-block d-sm-none text-center'>Requisición</div>
                                    <div class='col-md-2 col-sm-2 col-6 text-right'>$ <span>".number_format($d->requisicion, 2)."</span></div>

                                    <div class='col-6 d-block d-sm-none text-center'>Real</div>
                                    <div class='col-md-2 col-sm-2 col-6 text-right'>$ <span>".number_format($d->ejercido, 2)."</span></div>
                                    
                                    <div class='col-6 d-block d-sm-none text-center'>Disponible</div>
                                    <div class='col-md-2 col-sm-2 col-6 text-right'>$ <span>".number_format($d->disponible, 2)."</span></div>
                                  </div>"; 
                                  $auto=$auto+$d->autorizado; $adec=$adec+$d->adecuado; $requ=$requ+$d->requisicion; $ejer=$ejer+$d->ejercido; $disp=$disp+$d->disponible;
                                  ?>
                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                              
                              <?php $contenido.="
                            </div>
                          </div>

                          <div class='row pie gris'>
                            <div class='col-md-2 col-sm-2 col-12'>Totales</div>

                            <div class='col-6 d-block d-sm-none text-center'>Autorizado</div>
                            <div class='col-md-2 col-sm-2 col-6 text-right'>$ <span>".number_format($auto, 2)."</span></div>
                            
                            <div class='col-6 d-block d-sm-none text-center'>Adecuado</div>
                            <div class='col-md-2 col-sm-2 col-6 text-right'>$ <span>".number_format($adec, 2)."</span></div>
                            
                            <div class='col-6 d-block d-sm-none text-center'>Requisición</div>
                            <div class='col-md-2 col-sm-2 col-6 text-right'>$ <span>".number_format($requ, 2)."</span></div>

                            <div class='col-6 d-block d-sm-none text-center'>Real</div>
                            <div class='col-md-2 col-sm-2 col-6 text-right'>$ <span>".number_format($ejer, 2)."</span></div>
                            
                            <div class='col-6 d-block d-sm-none text-center'>Disponible</div>
                            <div class='col-md-2 col-sm-2 col-6 text-right'>$ <span>".number_format($disp, 2)."</span></div>
                          </div>
                        </div>
                      </div>
                      <div class='col-lg-2 col-md-1 col-sm-12'>&nbsp;</div>
                    </div>"; ?>
      <?php endif; ?>

      <?php if( $p->restringidas->count()>0 ): ?>
        <?php 
          $contenido.="<div class='row justify-content-between'>
                        <div class='col-12'>
                          <h2>Partidas Restringidas </h2>
                        </div>
                      </div>

                      <div class='row'>
                        <div class='col-md-1 col-sm-12'>&nbsp;</div>
                        <div class='col-md-10 col-sm-12'>
                          <div class='table'>
                            <div class='row encabezado gris'>
                              <div class='col-md-2 col-sm-2 d-none d-sm-block'>Partida</div>
                              <div class='col-md-2 col-sm-2 d-none d-sm-block'>Autorizado</div>
                              <div class='col-md-2 col-sm-2 d-none d-sm-block'>Adecuado</div>
                              <div class='col-md-2 col-sm-2 d-none d-sm-block'>Subpresupuesto</div>
                              <div class='col-md-2 col-sm-2 d-none d-sm-block'>Requisición</div>
                              <!--<div class='col-md-1 col-sm-1 d-none d-sm-block'>Real</div>-->
                              <div class='col-md-2 col-sm-2 d-none d-sm-block'>Disponible</div>
                            </div>

                            <div class='row contenido-700'>
                              <div class='col-md-12'>";
                              $auto=0; $adec=0; $subp=0; $requ=0; $ejer=0; $disp=0; ?>

                                  <?php $__currentLoopData = $p->restringidas; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $d): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                  
                                    <?php $contenido.="
                                    <div class='row cuerpo'>
                                      <div class='col-6 d-block d-sm-none gris text-center'>Partida</div>
                                      <div class='col-md-2 col-sm-2 col-6 d-block d-sm-none gris text-center' data-toggle='popover' data-trigger='hover' data-placement='right' data-content='".$d->partida->descripcion."' title='$d->servicio'>$d->partida_id</div>
                                      <div class='col-md-2 col-sm-2 col-6 d-none d-sm-block text-center' data-toggle='popover' data-trigger='hover' data-placement='right' data-content='".$d->partida->descripcion."' title='$d->servicio'>$d->partida_id</div>
                                      
                                      <div class='col-6 d-block d-sm-none text-center'>Autorizado</div>
                                      <div class='col-md-2 col-sm-2 col-6 text-right'>$ <span>".number_format($d->autorizado, 2)."</span></div>
                                      
                                      <div class='col-6 d-block d-sm-none text-center'>Adecuado</div>
                                      <div class='col-md-2 col-sm-2 col-6 text-right'>$ <span>".number_format($d->adecuado, 2)."</span></div>

                                      <div class='col-6 d-block d-sm-none text-center'>Subpresupuesto</div>
                                      <div class='col-md-2 col-sm-2 col-6 text-right'>$ <span>".number_format($d->subpresupuesto, 2)."</span></div>
                                      
                                      <div class='col-6 d-block d-sm-none text-center'>Requisición</div>
                                      <div class='col-md-2 col-sm-2 col-6 text-right'>$ <span>".number_format($d->requisicion, 2)."</span></div>

                                      <!--<div class='col-6 d-block d-sm-none text-center'>Real</div>
                                      <div class='col-md-1 col-sm-1 col-6 text-right'>$ <span>".number_format($d->ejercido, 2)."</span></div>-->
                                      
                                      <div class='col-6 d-block d-sm-none text-center'>Disponible</div>
                                      <div class='col-md-2 col-sm-2 col-6 text-right'>$ <span>".number_format($d->disponible, 2)."</span></div>
                                    </div>"; 
                                    $auto=$auto+$d->autorizado; $adec=$adec+$d->adecuado; $subp=$subp+$d->subpresupuesto; $requ=$requ+$d->requisicion; $ejer=$ejer+$d->ejercido; $disp=$disp+$d->disponible;
                                    ?>
                                  <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                
                                <?php $contenido.="
                              </div>
                            </div>

                            <div class='row pie gris'>
                              <div class='col-md-2 col-sm-2 col-12'>Totales</div>

                              <div class='col-6 d-block d-sm-none text-center'>Autorizado</div>
                              <div class='col-md-2 col-sm-2 col-6 text-right'>$ <span>".number_format($auto, 2)."</span></div>
                              
                              <div class='col-6 d-block d-sm-none text-center'>Adecuado</div>
                              <div class='col-md-2 col-sm-2 col-6 text-right'>$ <span>".number_format($adec, 2)."</span></div>

                              <div class='col-6 d-block d-sm-none text-center'>Subprsupuesto</div>
                              <div class='col-md-2 col-sm-2 col-6 text-right'>$ <span>".number_format($subp, 2)."</span></div>
                              
                              <div class='col-6 d-block d-sm-none text-center'>Requisición</div>
                              <div class='col-md-2 col-sm-2 col-6 text-right'>$ <span>".number_format($requ, 2)."</span></div>

                              <!--<div class='col-6 d-block d-sm-none text-center'>Real</div>
                              <div class='col-md-1 col-sm-1 col-6 text-right'>$ <span>".number_format($ejer, 2)."</span></div>-->
                              
                              <div class='col-6 d-block d-sm-none text-center'>Disponible</div>
                              <div class='col-md-2 col-sm-2 col-6 text-right'>$ <span>".number_format($disp, 2)."</span></div>
                            </div>
                          </div>
                        </div>
                        <div class='col-md-1 col-sm-12'>&nbsp;</div>
                      </div>"; ?>
      <?php endif; ?>

    <?php $contenido.="</div>";  ?>



    <?php $a = ""; $s = ""; $as="false"; ?>
  <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>

  <h2>Claves Presupuestales</h2>
  <nav>
    <div class="nav nav-tabs" id="nav-tab" role="tablist">
      <?php echo $link;?>
    </div>
  </nav>
  <div class="tab-content" id="nav-tabContent">
    <?php echo $contenido; ?>
  </div>

<?php else: ?>
  <h2 class="text-center"> 
    <span class="fa fa fa-exclamation-triangle"></span>  No tiene registrada ninguna clave presupuestal <span class="fa fa fa-exclamation-triangle"></span>
  </h2>
<?php endif; ?>
<?php /**PATH /home3/itzitacu/public_html/poa/laravel/resources/views/poa/consulta.blade.php ENDPATH**/ ?>