<?php include("logon.php"); ?>
<!DOCTYPE html>
<html>
  <head> 
  <!-- Favico -->
    <link rel="icon" type="image/png" href="imagenes/fav.png" />
    <?php include('conn.php'); ?>
    <?php include('head.php'); ?>
  </head>
  <body class="hold-transition skin-blue layout-top-nav">
    <?php
      if (isset($_POST['xAuxAtajo'])) {
        echo "<input type='hidden' id='xAtajo' value='".$_POST['xAuxAtajo']."'>";
      }
      else {
        echo "<input type='hidden' id='xAtajo' value='-1'>";
      }

      $sql = "select ID_GRUPO_CONSULTA, DESC_GRUPO_CONSULTA from CFG_GRUPO_CONSULTA where LOWER(DESTINO) = 'cuenta-corriente.php'";
      $RsAtajo = sqlsrv_query( $conn, $sql);    
      $grupo = -1;
      while( $row = sqlsrv_fetch_array( $RsAtajo, SQLSRV_FETCH_ASSOC)) {  
        $grupo = $row['ID_GRUPO_CONSULTA'];
      }
    ?>
    <input type="hidden" id="grupo" value='<?php echo $grupo; ?>'>
    <div style="background-color: #3c4256;" class="wrapper">
      <header class="main-header">
        <nav class="navbar navbar-default navbar-fixed-top">
          <div class="container">
            <?php include('header.php'); ?>
          </div>
          <div class="container">
            <div class="row" style=" color: #ffffff">
              <div class="description-block col-xs-4" style="    padding-right: 0px;text-align: left;">
                <span class="titulos">Cuenta Corriente <!-- <span class="" id="lblTitulo"> </span> --></span>
              </div>
              <div style="padding-left: 0px;text-align: right;" class="description-block col-xs-8">
                <a id='btnVerResultado' class="btn btn-default" href="#;" onclick="verResultado();" role="button" style="display: none;"><i style="color: #3c4256;" class="fa fa-chevron-circle-right"></i></a>
                <a id='btnVerFiltros' class="btn btn-default" href="#;" role="button" onclick="verFiltros();" style="display: none;"><i style="padding-right: 5px;color: #3c4256;" class="fa fa-chevron-circle-left"></i>Volver a Filtros</a>
                <div class="btn-group" id="btnConsultas">
                  <!--<button style="margin-right: 3px;" type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
                    <span class="">Ejecutar Consulta<i style="color: #db5916;padding-left: 5px;" class="fa fa-caret-square-o-down"></i></span>
                  </button>
                  <ul class="dropdown-menu">
                    <li><a href="#" id='btn-funcion-1' style="color: #3c4256">Cajas vs Medios de Pago</a></li>
                    <li><a href="#" id='btn-funcion-2' style="color: #3c4256">Cajas vs Tipos de Comprobantes</a></li>
                    <li><a href="#" id='btn-funcion-3' style="color: #3c4256">Medios de Pago vs Per&iacute;odos</a></li>
                  </ul>-->
                  <select id='xConsulta' style="width: auto;  text-align: left;" tabindex="-1" aria-hidden="true" class="consultasmenu js-states form-control" name="state">
                    <option value="-1" disabled selected>Seleccione Consulta</option>
                    <option value="1">Saldos por Código</option>
                    <option value="2">Saldos por Razón Social</option>
                  </select>
                </div>
                <a class="btn btn-default" href="#" id="btnConsultar" onclick="doConsultar();" role="button"><i style="color: #db5916; font-size: 18px;" class="fa fa-arrow-circle-right"></i></a>
                <button type="button" class="btn btn-default" id='btnLimpiarTodo'><i class="fa fa-eraser"></i></button>
                <div class="btn-group" id='conteGuardar' style="display: none;">
                  <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
                    <i class="fa fa-fw fa-save"></i>
                  </button>
                  <ul class="dropdown-menu dropdown-menu-right">
                    <li><a style="color: #3c4256;" href="#;"  onclick="toExcel();">Guardar como xls...</a></li>
                    <!--<li><a style="color: #3c4256;" href="#">Guardar como PDF...</a></li>
                    <li><a style="color: #3c4256;" href="#">Guardar como Imprimir...</a></li>-->
                    <li style="background-color: #e5e5e5;" class="divider"></li>
                    <li><a style="color: #3c4256;" id='btnFavoritos' data-toggle="modal" onclick="getFavoritos();" href="#">Agregar a favoritos...</a></li>
                  </ul>
                </div>
              </div>
            </div>
          </div>       
          <!-- /.container-fluid -->
        </nav>
      </header>
      <!-- Full Width Column -->
      <div class="content-wrapper" style="padding-top: 105px;">
        <div class="container" id="conteFiltro" style="display: none;">
          <!-- Content Header (Page header) -->
          <!-- Main content -->
          <section class="content">
            <div class="row">
              <div class=" col-md-12">
                <!-- MODULO PERIODOS -->
                <?php include('inc-periodos-simple.php'); ?>
              </div>
            </div>

            <div class="row">
              <section class="col-lg-6 connectedSortable ui-sortable">
                <!-- /MODULO UNIDAD DE NEGOCIOS -->
                <?php include("inc-base-datos.php") ?>
              </section>
              
              <section class="col-lg-6 connectedSortable ui-sortable">
                <!-- /MODULO COMPROBANTES CAJA -->
                <?php include("inc-mostrar-cuenta-corriente.php"); ?>
              </section>
            </div>
            
            <div class="row">
              <section class="col-lg-6 connectedSortable ui-sortable">
                <!-- /MODULO SALDO CERO -->
                <?php include("inc-saldo-cero.php") ?>
              </section>
              
              <section class="col-lg-6 connectedSortable ui-sortable">
              </section>
            </div>
        </div>
        <div class="container" id="conteResultado" style="display: block;">
          <section class="content" id="conteTabla" >
            <div class="loader"></div><p class="ploader">Cargando...</p>
          </section>
        </div>
      </div>
    </div>

    <span id="conteFavoritos"></span>
    <span id="conteDetalle">
      <div class="modal fade" id="detalle_modal" tabindex="-1" role="dialog" aria-labelledby="detalle_modalLabel">
        <div class="modal-dialog modal-lg" role="document">
          <div class="modal-content">
            <div class="modal-header">
              <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
              <h4 class="titulos modal-title" id="intervaloLabel"><span id="lblTitular"></span></h4>
            </div>
            <div class="modal-body">
              <div class="form-group" style="width: 100%; min-height: 80% !important; max-height: 80% !important;">
                <div class="row" id="conteTablaDetalle">
                </div>
              </div>
            </div>
            <div class="modal-footer">
              <div class="btn-group open" id="conteGuardar" style="">
                <button type="button" class="btn btn-default " onclick="toExcelModal();" title="Guardar como xls...">
                  <i class="fa fa-fw fa-save"></i>
                </button>
              </div>
              <button type="button" class="btn btn-default" data-dismiss="modal">Aceptar</button>
            </div>
          </div>
        </div>
      </div>
    </span>

    <?php include("footer.php"); ?>
    <?php include('scripts.php'); ?>
            
  </body>
</html>

<script type="text/javascript" src="js/inc-base-datos.js"></script>          
<script type="text/javascript" src="js/inc-periodos-simple.js"></script>
<script type="text/javascript" src="js/inc-saldo-cero.js"></script>
<script type="text/javascript" src="js/cuenta-corriente.js"></script>  
<script type="text/javascript" src="js/favoritos.js"></script>  
