<script type="text/javascript" src="https://unpkg.com/xlsx@0.15.1/dist/xlsx.full.min.js"></script>
<div class="container">
  <div class="row">
    <div class="cs-space-20 d-md-none"></div>
    <div class="cs-space-20 d-md-none"></div>
  </div>
</div>
<style>
  .emfa-table th,
  td {
    text-align: left !important;
  }

  .pl-1 {
    padding-left: 30px !important;
  }

  .pl-2 {
    padding-left: 60px !important;
  }
  .emfa-table  th.titlebio, .emfa-table th.titlebio span {
      font-weight: bold;
      text-align: center!important;
  }
</style>
<div class="d-none d-md-block cs-space-40"></div>
<section id="single-params">
  <div class="container">
    <div class="row">
      <div class="col-12 col-md-4">
        <div class="lateral-menu">
          <div class="header-lateral-menu">
            <div class="row">
              <div class="col-4 d-flex align-items-center">
                <img class="logo" src="
									<?php echo $current_img; ?>">
              </div>
              <div class="col-8">
                <h4>ESEA</h4>
              </div>
            </div>
          </div>
          <div class="body-lateral-menu"> <?php foreach ($esea_categories as $x => $category) {
                      if ($_GET["active"] == $x) {
                          foreach (
                              $category["esea_sub_crb_cat"]
                              as $key => $value
                          ) {
                              if ($value["esea_title"] == $_GET["son"]) {
                                  $desc_cat2 = $value["esea_desc"];
                                  $maintitle = $value["esea_title"];
                              }
                          }
                      } ?> <div class="row">
              <div class="align-items-end col-2 col-md-3 d-flex flex-column">
                <a class="more " data-toggle="collapse" href="#
										<?php echo "op-" .
                            $x; ?>" role="button" aria-expanded="false" aria-controls="
										<?php echo "op-" .
    $x; ?>"> <?php if (!empty($category["esea_sub_crb_cat"])): ?> <p>+</p> <?php else: ?> <p>-</p> <?php endif; ?> </a>
              </div>
              <div class="col-10 col-md-9">
                <h3 class="
										<?php echo $x == $_GET["active"] &&
                        empty($category["esea_sub_crb_cat"])
                            ? "active"
                            : "active-noborder"; ?>" aria-expanded="false" aria-controls="
										<?php echo $category[
    "esea_title"
]; ?>"> <?php echo $category["esea_title"]; ?> </h3>
              </div>
            </div>
            <div class="multi-collapse row collapse 
								<?php echo $x ==
                  $_GET["active"]
                      ? "show"
                      : ""; ?> collapse-info" id="
								<?php echo "op-" . $x; ?>">
              <div class="col-2 col-md-3"></div>
              <div class="col-10 col-md-9"> <?php
                        $subject = $category["esea_api"];
                        $ss = $this->api->esea_get_params($subject);
                        ?> <?php if (!empty($category["esea_sub_crb_cat"])): ?> <ul> <?php $count = 0; ?> <?php foreach (
                               $category["esea_sub_crb_cat"]
                               as $k => $last_child
                           ): ?> <li class="
											<?php echo $last_child["esea_title"] ==
                           $_GET["son"]
                               ? "active"
                               : ""; ?>">
                    <a href="
												<?php echo get_permalink(
                                  $pageID
                              ); ?>/?scid=
												<?php echo $x; ?>&active=
												<?php echo $x; ?>&son=
												<?php echo $last_child[
    "esea_title"
]; ?>&subject=
												<?php echo $ss[0]["nombreEsp"]; ?>&chartid=
												<?php echo $ss[0][
    "idFormulario"
]; ?>&epID=
												<?php echo $k; ?>"> <?php echo $last_child["esea_title"]; ?> </a>
                  </li> <?php $count = $count + 1;endforeach; ?> </ul> <?php endif; ?> </div>
            </div> <?php
                  } ?>
          </div>
        </div>
        <div class="cs-space-20"></div>
      </div>
      <div class="cs-space-20 d-md-none"></div>
      <div class="col-12 col-md-8" id="parameters">
        <h2>PII: <?php echo $maintitle; ?> </h2>
        <div class="d-none d-md-block cs-space-10"></div>
        <p class="params-p"> <?php echo $desc_cat2; ?>
        <p>
          <span>
            <strong>Datos en millones de USD</strong>
          </span>
        </p>
        </p>
        <div class="cs-space-20 d-md-none"></div>
        <div class="d-none d-md-block cs-space-40"></div>
        <div class="graphic-container graph-maxWidth max-width-esea">
          <div class="header-graphic"> <?php foreach ($esea_categories as $key => $category) {
                      if ($_GET["active"] == $key) {
                          foreach (
                              $category["esea_sub_crb_cat"]
                              as $key => $value
                          ) {
                              if ($_GET["son"] == $value["esea_title"]) {
                                  $metaemail = $value["esea_emailmeta"];
                                  $metadesc = $value["esea_descmeta"];
                                  $metalc = $value["esea_alccmeta"];
                                  $metcar = $value["esea_carmeta"];
                                  $metunidad = $value["esea_unidadmeta"];
                                  $metpermeta = $value["esea_permeta"];
                                  $metoport = $value["esea_opormeta"];
                                  $metarev = $value["esea_revmeta"];
                                  $metafu = $value["esea_fumeta"];
                                  $metaacc = $value["esea_accmeta"];
                                  $metanot = $value["esea_notmeta"];
                                  $commeta = $value["esea_commeta"];
                                  $calregmeta = $value["esea_calregmeta"];
                                  $reddatafumetameta =
                                      $value["esea_reddatafumeta"];
                                  $notes = $value["esea_tablenotes"];
                                  $metaact = $value["esea_actualizacionemeta"];
                                  $pdfneta = $value["esea_pdfmeta"];
                              }
                          }
                      }
                  } ?> <div class="container">
              <div class="row">
                <div class="col-6 col-md-3 col-md-3 col-space-down">
                  <button class="btn btn-primary hBack" type="button">Volver</button>
                </div>
                <div class="col-6 col-md-3 col-md-3 col-space-down">
                  <div class="graphic-box">
                    <img src="
												<?php echo get_template_directory_uri(); ?>/src/images/131972@2x.png" alt="">
                    <h5>Exportar</h5>
                    <div class="arrow-down"></div>
                    <div class="dropdown js-hover-dropdown" id="js-downland">
                      <ul>
                        <li id="txt">
                          <a href="#">Txt</a>
                        </li>
                        <li id="csv">
                          <a href="#">csv</a>
                        </li>
                        <li id="ex">
                          <a href="#">Excel</a>
                        </li>
                      </ul>
                       <span style="height: 38px;padding-left: 20px;display: flex;align-items: center;background: #f2f2f2;color: black;font-weight: bold;" id="dre">Json</span>

                    </div>
                  </div>
                </div>
                <div class="col-6 col-md-3 col-md-3 col-space-down">
                  <div class="graphic-box share-box-wrapper js-share-box-wrapper">
                    <div class="graphic-box-helper"></div>
                    <img src="
													<?php echo get_template_directory_uri(); ?>/src/images/149722@2x.png" alt="">
                    <h5>Compartir</h5>
                    <div class="arrow-down js-arrowToex"></div>
                    <div class="share-box">
                      <div class="social"> <?php
                                    $actual_link = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
                                    $fac_link = urldecode($actual_link);
                                    ?> <a target="_blank" href="https://www.facebook.com/sharer.php?cid=
																<?php echo $_GET[
                                        "scsid"
                                    ]; ?>&u=
																<?= urlencode(
    $actual_link
) ?>">
                          <img src="
																	<?php echo get_template_directory_uri(); ?>/src/images/face-ico@2x.png" alt="">
                        </a>
                        <a target="_blank" href="https://twitter.com/intent/tweet?url=
																	<?= urlencode(
                                        $actual_link
                                    ) ?>">
                          <img src="
																		<?php echo get_template_directory_uri(); ?>/src/images/twi-ico@2x.png" alt="">
                        </a>
                        <a target="_blank" href="mailto:?subject=SECMCA DATOS: Resultado de 
																		<?php echo $_GET[
                                        "son"
                                    ]; ?> ( 
																		<?php echo $maintitle; ?> ) &amp;body=resultado de 
																		<?php echo $maintitle; ?>->
																		<?= urlencode(
    $actual_link
) ?>">
                          <img src="
																			<?php echo get_template_directory_uri(); ?>/src/images/mail-ico@2x.png" alt="">
                        </a>
                      </div>
                      <div class="share-link">
                        <p class="text-link">Compartir link</p>
                        <div class="copy">
                          <img src="
																				<?php echo get_template_directory_uri(); ?>/src/images/link@2x.png" alt="">
                          <button onclick="copyLink()" style="background: transparent;height: 31px;width: 43px;font-size: 11px;border: none;"> Copiar </buxtton>
                        </div>
                      </div>
                      <div class="box-link">
                        <p>
                          <input type="text" value="
																					<?php echo $actual_link; ?>" id="myInput" readonly style="background: transparent;border: none;">
                        </p>
                      </div>
                    </div>
                  </div>
                </div>
                <div class="col-6 col-md-3 col-md-3 col-space-down boxx">
                  <div class="graphic-box graphic-blue-box">
                    <div class="circle-wrapper">
                      <div class="circle-info">i</div>
                      <h5>Metadatos</h5>
                    </div>
                    <div class="arrow"></div>
                  </div>
                  <div class="white-box">
                    <div class="accordion md-accordion" id="accordionEx" role="tablist" aria-multiselectable="true">
                      <div class="card">
                        <div class="card-header" role="tab" id="headingOne1">
                          <a data-toggle="collapse" data-parent="#accordionEx" href="#collapseOne1" aria-expanded="true" aria-controls="collapseOne1">
                            <h5 class="mb-0 d-flex justify-content-between"> Contacto <i class="fas fa-angle-down rotate-icon"></i>
                            </h5>
                          </a>
                        </div>
                        <div id="collapseOne1" class="collapse show contact-table" role="tabpanel" aria-labelledby="headingOne1" data-parent="#accordionEx">
                          <div class="card-body fixed-card">
                            <div class="row">
                              <div class="col-12 col-md-12 col-wrapper-contact">
                                <div class="row">
                                  <div class="col-12 col-md-6 d-flex align-items-center justify-content-center">
                                    <p>Contacto</p>
                                  </div>
                                  <div class="col-12 col-md-6 d-flex align-items-center justify-content-center">
                                    <p>
                                    <pre>
																												<?php echo $metaemail; ?>
																											</pre>
                                    </p>
                                  </div>
                                </div>
                                <div class="row">
                                  <div class="col-12 col-md-6 d-flex align-items-center justify-content-center">
                                    <p>Fecha de actualización de los metadatos</p>
                                  </div>
                                  <div class="col-12 col-md-6 d-flex align-items-center justify-content-center">
                                    <p>
                                    <pre>
																												<?php echo $metaact; ?>
																											</pre>
                                    </p>
                                  </div>
                                </div>
                              </div>
                            </div>
                          </div>
                        </div>
                      </div>
                      <div class="card">
                        <div class="card-header" role="tab" id="headingTwo2">
                          <a class="collapsed" data-toggle="collapse" data-parent="#accordionEx" href="#collapseTwo2" aria-expanded="false" aria-controls="collapseTwo2">
                            <h5 class="mb-0 d-flex justify-content-between"> Características de los datos <i class="fas fa-angle-down rotate-icon"></i>
                            </h5>
                          </a>
                        </div>
                        <div id="collapseTwo2" class="collapse" role="tabpanel" aria-labelledby="headingTwo2" data-parent="#accordionEx">
                          <div class="card-body">
                            <div class="col-12 col-md-12 col-wrapper-contact">
                              <div class="row">
                                <div class="col-12 col-md-6 d-flex align-items-center justify-content-center">
                                  <p>Descripción</p>
                                </div>
                                <div class="col-12 col-md-6 d-flex align-items-center justify-content-center">
                                  <p>
                                  <pre>
																											<?php echo $metadesc; ?>
																										</pre>
                                  </p>
                                </div>
                              </div>
                              <div class="row">
                                <div class="col-12 col-md-6 d-flex align-items-center justify-content-center">
                                  <p>Alcance Cobertura y desagregaciones</p>
                                </div>
                                <div class="col-12 col-md-6 d-flex align-items-center justify-content-center">
                                  <p>
                                  <pre>
																											<?php echo $metalc; ?>
																										</pre>
                                  </p>
                                </div>
                              </div>
                              <div class="row">
                                <div class="col-12 col-md-6 d-flex align-items-center justify-content-center col-wrapper-contact">
                                  <p>Características</p>
                                </div>
                                <div class="col-12 col-md-6 d-flex align-items-center justify-content-center">
                                  <p>
                                  <pre>
																											<?php echo $metcar; ?>
																										</pre>
                                  </p>
                                </div>
                              </div>
                              <div class="row">
                                <div class="col-12 col-md-6 d-flex align-items-center justify-content-center col-wrapper-contact">
                                  <p>Unidad de medida</p>
                                </div>
                                <div class="col-12 col-md-6 d-flex align-items-center justify-content-center">
                                  <p>
                                  <pre>
																											<?php echo $metunidad; ?>
																										</pre>
                                  </p>
                                </div>
                              </div>
                              <div class="row">
                                <div class="col-12 col-md-6 d-flex align-items-center justify-content-center col-wrapper-contact">
                                  <p>Periodicidad</p>
                                </div>
                                <div class="col-12 col-md-6 d-flex align-items-center justify-content-center">
                                  <p>
                                  <pre>
																											<?php echo $metpermeta; ?>
																										</pre>
                                  </p>
                                </div>
                              </div>
                              <div class="row">
                                <div class="col-12 col-md-6 d-flex align-items-center justify-content-center">
                                  <p>Oportunidad</p>
                                </div>
                                <div class="col-12 col-md-6 d-flex align-items-center justify-content-center">
                                  <p>
                                  <pre>
																											<?php echo $metoport; ?>
																										</pre>
                                  </p>
                                </div>
                              </div>
                              <div class="row">
                                <div class="col-12 col-md-6 d-flex align-items-center justify-content-center">
                                  <p>Revisión</p>
                                </div>
                                <div class="col-12 col-md-6 d-flex align-items-center justify-content-center">
                                  <p>
                                  <pre>
																											<?php echo $metarev; ?>
																										</pre>
                                  </p>
                                </div>
                              </div>
                              <div class="row">
                                <div class="col-12 col-md-6 d-flex align-items-center justify-content-center">
                                  <p>Fuente primaria de información</p>
                                </div>
                                <div class="col-12 col-md-6 d-flex align-items-center justify-content-center">
                                  <p>
                                  <pre>
																											<?php echo $metafu; ?>
																										</pre>
                                  </p>
                                </div>
                              </div>
                              <div class="row">
                                <div class="col-12 col-md-6 d-flex align-items-center justify-content-center">
                                  <p>Acceso a los datos</p>
                                </div>
                                <div class="col-12 col-md-6 d-flex align-items-center justify-content-center">
                                  <p>
                                  <pre>
																											<?php echo $metaacc; ?>
																										</pre>
                                  </p>
                                </div>
                              </div>
                              <div class="row">
                                <div class="col-12 col-md-6 d-flex p-4 justify-content-center">
                                  <p>Notas por país</p>
                                </div>
                                <div class="col-12 col-md-6 d-flex align-items-center justify-content-center">
                                  <p>
                                  <pre>
																											<?php echo $metanot; ?>
																										</pre>
                                  </p>
                                </div>
                              </div>
                            </div>
                          </div>
                        </div>
                      </div>
                      <div class="card">
                        <div class="card-header" role="tab" id="headingThree3">
                          <a class="collapsed" data-toggle="collapse" data-parent="#accordionEx" href="#collapseThree3" aria-expanded="false" aria-controls="collapseThree3">
                            <h5 class="mb-0 d-flex justify-content-between"> Comparación entre países y cálculo regional <i class="fas fa-angle-down rotate-icon"></i>
                            </h5>
                          </a>
                        </div>
                        <div id="collapseThree3" class="collapse" role="tabpanel" aria-labelledby="headingThree3" data-parent="#accordionEx">
                          <div class="card-body">
                            <div class="row">
                              <div class="col-12 col-md-12 col-wrapper-contact">
                                <div class="row">
                                  <div class="col-12 col-md-6 d-flex align-items-center justify-content-center">
                                    <p>Comparabilidad regional</p>
                                  </div>
                                  <div class="col-12 col-md-6 d-flex align-items-center justify-content-center">
                                    <p> <?php echo $commeta; ?> </p>
                                  </div>
                                </div>
                                <div class="row">
                                  <div class="col-12 col-md-6 d-flex p-4 justify-content-center">
                                    <p>Cálculo regional</p>
                                  </div>
                                  <div class="col-12 col-md-6 d-flex align-items-center justify-content-center">
                                    <p> <?php echo $calregmeta; ?> </p>
                                  </div>
                                </div>
                                <div class="row">
                                  <div class="col-12 col-md-6 d-flex align-items-center justify-content-center">
                                    <p>Fuente datos regionales</p>
                                  </div>
                                  <div class="col-12 col-md-6 d-flex align-items-center justify-content-center">
                                    <p> <?php echo $reddatafumetameta; ?> </p>
                                  </div>
                                </div>
                              </div>
                            </div>
                          </div>
                        </div>
                      </div>
                      <div class="downland-meta">
                        <a href="
																					<?php echo wp_get_attachment_url(
                            $pdfneta
                        ); ?>" download>
                          <div class="button">
                            <img src="
																							<?php echo get_template_directory_uri(); ?>/src/images/131972@2x.png" alt="">
                            <span>Exportar</span>
                          </div>
                        </a>
                      </div>
                    </div>
                  </div>
                </div>
              </div>
              <div class="d-none d-md-block cs-space-30"></div>
              <div class="row">
                <div class="col-12">
                  <div class="space"></div>
                </div>
              </div>
              <div class="d-none d-md-block cs-space-30"></div>
              <div class="row">
                <div class="graphic w-100">
                  <div class="tab-content" id="pills-tabContent">
                    <div class="tab-pane fade show active" id="pills-table-emfa" role="tabpanel" aria-labelledby="pills-table-emfa-tab">
                      <div class="row">
                        <div class="col-12 col-md-12">
                          <a class="js-newquery" role="button" data-toggle="collapse" href="#newQuery" aria-expanded="false" aria-controls="newQuery">Realizar nueva consulta</a>
                        </div>
                      </div>
                      <div class="newQuery-form collapse" id="newQuery">
                        <div class="cs-space-20"></div>
                        <form id="params-form" class="tab-content col-12 d-none d-md-block" method="POST">
                          <div class="row parameters">
                            <div class="col-12 col-md-12">
                              <div class="params-box">
                                <ul class="nav nav-pills mb-3" id="pills-tab" role="tablist">
                                  <li class="nav-item">
                                    <a class="nav-link active" id="pills-home-tab" data-toggle="pill" href="#pill-country" role="tab" aria-controls="pill-country" aria-selected="true">Pais</a>
                                  </li>
                                  <li class="nav-item">
                                    <a class="nav-link" id="IPC-more-tab" data-toggle="pill" href="#pill-region" role="tab" aria-controls="pills-profile" aria-selected="false">Regiones</a>
                                  </li>
                                </ul>
                                <div class="tab-content" id="pills-tabContent">
                                  <div class="tab-pane fade show active box-content-emfa" id="pill-country" role="tabpanel" aria-labelledby="pills-home-tab">
                                    <div class="custom-control custom-checkbox">
                                      <input type="radio" class="custom-control-input" id="country0" name="country[]" value="3">
                                      <label class="custom-control-label" for="country0">Costa Rica</label>
                                    </div>
                                    <div class="custom-control custom-checkbox">
                                      <input type="radio" class="custom-control-input" id="country1" name="country[]" value="13">
                                      <label class="custom-control-label" for="country1">El Salvador</label>
                                    </div>
                                    <div class="custom-control custom-checkbox">
                                      <input type="radio" class="custom-control-input" id="country2" name="country[]" value="50">
                                      <label class="custom-control-label" for="country2">Guatemala</label>
                                    </div>
                                    <div class="custom-control custom-checkbox">
                                      <input type="radio" class="custom-control-input" id="country3" name="country[]" value="17">
                                      <label class="custom-control-label" for="country3">Honduras</label>
                                    </div>
                                    <div class="custom-control custom-checkbox">
                                      <input type="radio" class="custom-control-input" id="country4" name="country[]" value="4">
                                      <label class="custom-control-label" for="country4">Nicaragua</label>
                                    </div>
                                    <div class="custom-control custom-checkbox">
                                      <input type="radio" class="custom-control-input" id="country5" name="country[]" value="52">
                                      <label class="custom-control-label" for="country5">República Dominicana</label>
                                    </div>
                                    <div class="custom-control custom-checkbox">
                                      <input type="radio" class="custom-control-input" id="country6" name="country[]" value="161">
                                      <label class="custom-control-label" for="country6">Panamá</label>
                                    </div>
                                  </div>
                                  <div class="tab-pane fade" id="pill-region" role="tabpanel" aria-labelledby="IPC-more-tab">
                                    <div class="custom-control custom-checkbox">
                                      <input type="radio" class="custom-control-input" id="country7" name="country[]" value="95">
                                      <label class="custom-control-label" for="country7">CA</label>
                                    </div>
                                    <div class="custom-control custom-checkbox">
                                      <input type="radio" class="custom-control-input" id="country8" name="country[]" value="56">
                                      <label class="custom-control-label" for="country8">CARD</label>
                                    </div>
                                    <div class="custom-control custom-checkbox">
                                      <input type="radio" class="custom-control-input" id="country9" name="country[]" value="78">
                                      <label class="custom-control-label" for="country9">CAPARD</label>
                                    </div>
                                  </div>
                                </div>
                                <div class="options-wrapper options-country-wrapper"></div>
                              </div>
                            </div>
                            <div class="col-12">
                              <div class="row">
                                <div class="col-12 text-center mb-4 mt-4">
                                  <h3>Seleccione un rango de fechas para la seleccion</h3>
                                </div>
                                <div class="col-12 range-select">
                                  <p>Desde :</p>
                                  <select class="extra_years_esea" id="extra-year-first"></select>
                                  <div class="selector" style="
    display: flex;
    justify-content: space-between;
    padding: 20px 0;
">
  <label><input type="radio" name="piitri" value="1">I Trimestre</label>
  <label><input type="radio" name="piitri" value="2">II Trimestre</label>
  <label><input type="radio" name="piitri" value="3">III Trimestre</label>
   <label><input type="radio" name="piitri" value="4">IV Trimestres</label>
  <label><input type="radio" name="piitri" value="5">Año completo</label>
</div>
                                </div>
                              </div>
                            </div> <?php
                     $subject = $category["esea_api"];
                     $ss = $this->api->esea_get_params($subject);
                     ?> <div class="col-12 send-params">
                              <button id="send" type="submit" data-chartid="
																																			<?php echo $_GET[
                         "chartid"
                     ]; ?>" data-subject="
																																			<?php echo $_GET[
    "subject"
]; ?>" data-active="
																																			<?php echo $_GET["active"]; ?>" data-epid="
																																			<?php echo $_GET[
    "epID"
]; ?>" data-restpage="
																																			<?php echo get_permalink(
    $resultpageID
); ?>" name="Submit" class="btn btn-primary w-100 esea esea-test">Realizar nueva consulta </button>
                            </div>
                          </div>
                        </form>
                      </div>
                      <div class="table-notes">
                        <div class="d-none d-md-block cs-space-20"></div> <?php if ($notes): ?> <h2 class="mb-2">Notas</h2>
                        <pre style="width: 97%;">
																																<?php echo $notes; ?>
																															</pre> <?php endif; ?> <div class="d-none d-md-block cs-space-20"></div>
                      </div>
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
  <pre>
                <?php /* var_dump($data_a); */ ?>
            </pre>
  <div class="container">
    <div class="row">
      <div class="wraper-tadiv w-100">
        <div class="table-wrapper esea-wrapper">
          <table class="emfa-table table-results search-table" id="eseatab">
            <thead>
              <tr style="text-align: left!important; border:none!important;">
                <th colspan="7" style="border: none!important;text-align: left!important;padding: 0;">
                  <p style="font-weight: bold;">Secretaría Ejecutiva del Consejo Monetario Centroamericano</p>
                </th>
              </tr>
              <tr style="border: none!important;">
                <th colspan="7" style="border: none!important;text-align: left!important;padding: 0;">
                  <p style="font-weight: bold;">Reporte de Estado Integrado para Guatemala</p>
                </th>
              </tr>
              <tr>
                  <th colspan="2"></th>
                <th colspan="6" class="titlebio">Año 2021 - Trimestre 1</th>
              </tr>
              <tr>
                <th colspan="2"></th>
                <th colspan="1"></th>
                <th colspan="1">Cuenta Financiera</th>
                <th colspan="3">Cta. de otras variaciones en los activos financieros y pasivos </th>
                <th colspan="1"></th>
              </tr>
              <tr class="tableizer-firstrow">
                <th colspan="2"></th>
                <th colspan="1"> PII al inicio del Año</th>
                <th colspan="1"> Transacciones </th>
                <th colspan="1">Variaciónes de Tipo de Cambio</th>
                <th colspan="1">Variaciones de Precios</th>
                <th colspan="1">Otras Variaciones de Volumen</th>
                <th colspan="1">PII al final del Año</th>
              </tr>
              <tr>
                <th colspan="2">Activos Por categoría funcional</th>
                <th colspan="12"></th>
              </tr>
            </thead>
            <tbody>
              <tr>
                <td colspan="2" class="pl-1">Inversión directa</td> <?php foreach ($data_a as $k => $data): ?> <td colspan="1"> <?php
                echo number_format(
                            (float) $data,
                            2,
                            ".",
                            ""
                        ); ?> </td> <?php endforeach; ?>
              </tr>
              <tr>
                <td colspan="2" class="pl-1">Inversión de cartera</td> <?php foreach ($data_b as $k => $data): ?> <td colspan="1"> <?php echo number_format(
                            (float) $data,
                            2,
                            ".",
                            ""
                        ); ?> </td> <?php endforeach; ?>
              </tr>
              <tr>
                <td colspan="2" class="pl-1">Derivados financieros (distintos de reservas) y OCAE</td> <?php foreach ($data_c as $k => $data): ?> <td colspan="1"> <?php echo number_format(
                            (float) $data,
                            2,
                            ".",
                            ""
                        ); ?> </td> <?php endforeach; ?>
              </tr>
              <tr>
                <td colspan="2" class="pl-1">Otra inversión</td> <?php foreach ($data_d as $k => $data): ?> <td colspan="1"> <?php echo number_format(
                            (float) $data,
                            2,
                            ".",
                            ""
                        ); ?> </td> <?php endforeach; ?>
              </tr>
              <tr>
                <td colspan="2" class="pl-1">Activos de reserva</td> <?php foreach ($data_e as $k => $data): ?> <td colspan="1"> <?php echo number_format(
                            (float) $data,
                            2,
                            ".",
                            ""
                        ); ?> </td> <?php endforeach; ?>
              </tr>
              <tr>
                <td colspan="2">
                  <strong>Por instrumento</strong>
                </td>
                <td colspan="1"></td>
                <td colspan="1"></td>
                <td colspan="1"></td>
                <td colspan="1"></td>
                <td colspan="1"></td>
                <td colspan="1"></td>
              </tr>
              <tr>
                <td colspan="2" class="pl-1">Acciones y participaciones de capital y participaciones en fondos/unidades de inversión</td> <?php foreach ($data_f as $k => $data): ?> <td colspan="1"> <?php echo number_format(
                            (float) $data,
                            2,
                            ".",
                            ""
                        ); ?> </td> <?php endforeach; ?>
              </tr>
              <tr>
                <td colspan="2" class="pl-1">Instrumentos de deuda</td> <?php foreach ($data_g as $k => $data): ?> <td colspan="1"> <?php echo number_format(
                            (float) $data,
                            2,
                            ".",
                            ""
                        ); ?> </td> <?php endforeach; ?>
              </tr>
              <tr>
                <td colspan="2" class="pl-1">Derechos especiales de giro</td> <?php foreach ($data_h as $k => $data): ?> <td colspan="1"> <?php echo number_format(
                            (float) $data,
                            2,
                            ".",
                            ""
                        ); ?> </td> <?php endforeach; ?>
              </tr>
              <tr>
                <td colspan="2" class="pl-1">Moneda y depósitos</td> <?php foreach ($data_i as $k => $data): ?> <td colspan="1"> <?php echo number_format(
                            (float) $data,
                            2,
                            ".",
                            ""
                        ); ?> </td> <?php endforeach; ?>
              </tr>
              <tr>
                <td colspan="2" class="pl-1">Títulos de deuda</td> <?php foreach ($data_j as $k => $data): ?> <td colspan="1"> <?php echo number_format(
                            (float) $data,
                            2,
                            ".",
                            ""
                        ); ?> </td> <?php endforeach; ?>
              </tr>
              <tr>
                <td colspan="2" class="pl-1">Préstamos</td> <?php foreach ($data_k as $k => $data): ?> <td colspan="1"> <?php echo number_format(
                            (float) $data,
                            2,
                            ".",
                            ""
                        ); ?> </td> <?php endforeach; ?>
              </tr>
              <tr>
                <td colspan="2" class="pl-1">Seguros, pensiones y mecanismos normalizados de garantía</td> <?php foreach ($data_l as $k => $data): ?> <td colspan="1"> <?php echo number_format(
                            (float) $data,
                            2,
                            ".",
                            ""
                        ); ?> </td> <?php endforeach; ?>
              </tr>
              <tr>
                <td colspan="2" class="pl-1">Créditos y anticipos comerciales</td> <?php foreach ($data_m as $k => $data): ?> <td colspan="1"> <?php echo number_format(
                            (float) $data,
                            2,
                            ".",
                            ""
                        ); ?> </td> <?php endforeach; ?>
              </tr>
              <tr>
                <td colspan="2" class="pl-1">Otras cuentas por cobrar/por pagar</td> <?php foreach ($data_n as $k => $data): ?> <td colspan="1"> <?php echo number_format(
                            (float) $data,
                            2,
                            ".",
                            ""
                        ); ?> </td> <?php endforeach; ?>
              </tr>
              <tr>
                <td colspan="2" class="pl-1">Otros activos financieros</td> <?php foreach ($data_o as $k => $data): ?> <td colspan="1"> <?php echo number_format(
                            (float) $data,
                            2,
                            ".",
                            ""
                        ); ?> </td> <?php endforeach; ?>
              </tr>
              <tr>
                <td colspan="2" class="pl-1">Oro monetario</td> <?php foreach ($data_p as $k => $data): ?> <td colspan="1"> <?php echo number_format(
                            (float) $data,
                            2,
                            ".",
                            ""
                        ); ?> </td> <?php endforeach; ?>
              </tr>
              <tr>
                <td colspan="2" class="pl-1">Derivados financieros y OCAE</td> <?php foreach ($data_q as $k => $data): ?> <td colspan="1"> <?php echo number_format(
                            (float) $data,
                            2,
                            ".",
                            ""
                        ); ?> </td> <?php endforeach; ?>
              </tr>
              <tr>
                <td colspan="2">Activos totales</td> <?php foreach ($data_r as $k => $data): ?> <td colspan="1"> <?php echo number_format(
                            (float) $data,
                            2,
                            ".",
                            ""
                        ); ?> </td> <?php endforeach; ?>
              </tr>
              <tr>
                <td colspan="2">
                  <strong>Pasivos Por categoría funcional</strong>
                </td>
                <td colspan="1"></td>
                <td colspan="1"></td>
                <td colspan="1"></td>
                <td colspan="1"></td>
                <td colspan="1"></td>
                <td colspan="1"></td>
              </tr>
              <tr>
                <td colspan="2" class="pl-1">Inversión directa</td> <?php foreach ($data_s as $k => $data): ?> <td colspan="1"> <?php echo number_format(
                            (float) $data,
                            2,
                            ".",
                            ""
                        ); ?> </td> <?php endforeach; ?>
              </tr>
              <tr>
                <td colspan="2" class="pl-1">Inversión de cartera</td> <?php foreach ($data_t as $k => $data): ?> <td colspan="1"> <?php echo number_format(
                            (float) $data,
                            2,
                            ".",
                            ""
                        ); ?> </td> <?php endforeach; ?>
              </tr>
              <tr>
                <td colspan="2" class="pl-1">Derivados financieros (distintos de reservas) y OCAE</td> <?php foreach ($data_u as $k => $data): ?> <td colspan="1"> <?php echo number_format(
                            (float) $data,
                            2,
                            ".",
                            ""
                        ); ?> </td> <?php endforeach; ?>
              </tr>
              <tr>
                <td colspan="2" class="pl-1">Otra inversión</td> <?php foreach ($data_v as $k => $data): ?> <td colspan="1"> <?php echo number_format(
                            (float) $data,
                            2,
                            ".",
                            ""
                        ); ?> </td> <?php endforeach; ?>
              </tr>
              <tr>
                <td colspan="2">
                  <strong>Por instrumento</strong>
                </td>
                <td colspan="1"></td>
                <td colspan="1"></td>
                <td colspan="1"></td>
                <td colspan="1"></td>
                <td colspan="1"></td>
                <td colspan="1"></td>
              </tr>
              <tr>
                <td colspan="2" class="pl-1">Acciones y participaciones de capital y participaciones en fondos/unidades de inversión</td> <?php foreach ($data_w as $k => $data): ?> <td colspan="1"> <?php echo number_format(
                            (float) $data,
                            2,
                            ".",
                            ""
                        ); ?> </td> <?php endforeach; ?>
              </tr>
              <tr>
                <td colspan="2" class="pl-1">Instrumentos de deuda</td> <?php foreach ($data_x as $k => $data): ?> <td colspan="1"> <?php echo number_format(
                            (float) $data,
                            2,
                            ".",
                            ""
                        ); ?> </td> <?php endforeach; ?>
              </tr>
              <tr>
                <td colspan="2" class="pl-1">Derechos especiales de giro</td> <?php foreach ($data_y as $k => $data): ?> <td colspan="1"> <?php echo number_format(
                            (float) $data,
                            2,
                            ".",
                            ""
                        ); ?> </td> <?php endforeach; ?>
              </tr>
              <tr>
                <td colspan="2" class="pl-1">Moneda y depósitos</td> <?php foreach ($data_z as $k => $data): ?> <td colspan="1"> <?php echo number_format(
                            (float) $data,
                            2,
                            ".",
                            ""
                        ); ?> </td> <?php endforeach; ?>
              </tr>
              <tr>
                <td colspan="2" class="pl-1">Títulos de deuda</td> <?php foreach ($data_a1 as $k => $data): ?> <td colspan="1"> <?php echo number_format(
                            (float) $data,
                            2,
                            ".",
                            ""
                        ); ?> </td> <?php endforeach; ?>
              </tr>
              <tr>
                <td colspan="2" class="pl-1">Préstamos</td> <?php foreach ($data_a2 as $k => $data): ?> <td colspan="1"> <?php echo number_format(
                            (float) $data,
                            2,
                            ".",
                            ""
                        ); ?> </td> <?php endforeach; ?>
              </tr>
              <tr>
                <td colspan="2" class="pl-1">Seguros, pensiones y mecanismos normalizados de garantía</td> <?php foreach ($data_a3 as $k => $data): ?> <td colspan="1"> <?php echo number_format(
                            (float) $data,
                            2,
                            ".",
                            ""
                        ); ?> </td> <?php endforeach; ?>
              </tr>
              <tr>
                <td colspan="2" class="pl-1">Créditos y anticipos comerciales</td> <?php foreach ($data_a4 as $k => $data): ?> <td colspan="1"> <?php echo number_format(
                            (float) $data,
                            2,
                            ".",
                            ""
                        ); ?> </td> <?php endforeach; ?>
              </tr>
              <tr>
                <td colspan="2" class="pl-1">Otras cuentas por cobrar/por pagar</td> <?php foreach ($data_a5 as $k => $data): ?> <td colspan="1"> <?php echo number_format(
                            (float) $data,
                            2,
                            ".",
                            ""
                        ); ?> </td> <?php endforeach; ?>
              </tr>
              <tr>
                <td colspan="2" class="pl-1">Otros pasivos</td> <?php foreach ($data_a6 as $k => $data): ?> <td colspan="1"> <?php echo number_format(
                            (float) $data,
                            2,
                            ".",
                            ""
                        ); ?> </td> <?php endforeach; ?>
              </tr>
              <tr>
                <td colspan="2" class="pl-1">Derivados financieros y OCAE</td> <?php foreach ($data_a7 as $k => $data): ?> <td colspan="1"> <?php echo number_format(
                            (float) $data,
                            2,
                            ".",
                            ""
                        ); ?> </td> <?php endforeach; ?>
              </tr>
              <tr>
                <td colspan="2">Pasivos totales</td> <?php foreach ($data_a8 as $k => $data): ?> <td colspan="1"> <?php echo number_format(
                            (float) $data,
                            2,
                            ".",
                            ""
                        ); ?> </td> <?php endforeach; ?>
              </tr>
            </tbody>
          </table>
        </div>
        <!-- <a href="#" onclick="Exporter.export(eseatab, 'table.xls', 'table');return false;">Export to Excel</a> -->
        <button style="background: #134e9b;color: white;border: none;margin: 20px 0px;padding: 8px;cursor: pointer;" onclick="ExportToExcel('xlsx')">Export table to excel</button>
      </div>
    </div>
  </div>
  </div>
</section>
<div class="d-none d-md-block cs-space-40"></div>
<?php $json_string = json_encode($data); ?>
<script>
  function ExportToExcel(type, fn, dl) {
    var elt = document.getElementById('eseatab');
    var wb = XLSX.utils.table_to_book(elt, {
      sheet: "sheet1"
    });
    return dl ? XLSX.write(wb, {
      bookType: type,
      bookSST: true,
      type: 'base64'
    }) : XLSX.writeFile(wb, fn || ('ESEAtable.' + (type || 'xlsx')));
  }
  
  
    function downloadJSON(data, filename) {
    const jsonString = JSON.stringify(data);
    const downloadLink = document.createElement("a");
    downloadLink.setAttribute("href", "data:text/json;charset=utf-8," + encodeURIComponent(jsonString));
    downloadLink.setAttribute("download", filename);
    document.body.appendChild(downloadLink);
    downloadLink.click();
    document.body.removeChild(downloadLink);
    }

    var objeto_js = JSON.parse('<?php echo $json_string; ?>');

    document.getElementById("dre").addEventListener('click', function(e){
        e.preventDefault();
    console.log("err");
    downloadJSON(objeto_js, "data.json");
    });
</script>