<?php 
//activamos almacenamiento en el buffer
//ob_start();
//session_start();
if (!isset($_SESSION['nombre'])) {
  header("Location: login.html");
}else{
  //if ($_SESSION['cxc']==1) {
  if ($_SESSION['cxc']==1) {
  ?>
      <!-- Main content -->
      <section class="content">
        <!-- Default box -->
        <div class="row">
          <div class="col-md-12">
            <div class="box">
                <div class="box-header with-border">
                  
                    <div class="box-tools pull-right">
                      <h1 class="box-title">Cuentas x Cobrar\EstadoDeCuentaClientes
                    </div> 
                </div>
                <!--box-header-->
                <!--centro-->
                <div class="panel-body table-responsive" id="listadoregistros">
                  <table id="tbllistado" class="table table-striped table-bordered table-condensed table-hover">
                    <thead>
                      <th style="text-align:center" valign="middle">Opciones</th>
                      <th style="text-align:center" valign="middle">Cliente</th>
                      <th style="text-align:center" valign="middle">Fecha Más Antigua</th>
                      <th style="text-align:center" valign="middle">Número de Documento</th> 
                      <th style="text-align:center" valign="middle">Deuda</th>
                      <th style="text-align:center" valign="middle">Pagado</th>
                      <th style="text-align:center" valign="middle">Por Cobrar</th>
                      <th style="text-align:center" valign="middle">Estado</th>
                    </thead>
                    <tbody>
                    </tbody>
                    <tfoot>
                      <!-- <th>Opciones</th>
                      <th>Cliente</th>
                      <th>Deuda</th>
                      <th>Pagado</th>
                      <th>Saldo</th>
                      <th>Estado</th> -->
                      <th></th>
                      <th></th>
                      <th></th>
                      <th></th>
                      <th></th>
                      <th></th>
                      <th></th>
                      <th></th>
                    </tfoot>   
                  </table>
                </div>

              
                <div class="panel-body" style="height: 400px;" id="clienteestado">
                  <div class="form-group col-lg-6 col-md-6 col-xs-12">
                    <label for="">Cliente</label>
                    <input class="form-control" type="hidden" name="idpersona" id="idpersona">
                    <input class="form-control" type="hidden" name="tipo_persona" id="tipo_persona" value="Cliente">
                    <input class="form-control" type="text" name="nombre" id="nombre" maxlength="100" placeholder="Nombre del cliente" required>
                  </div>
                  <div class="form-group col-lg-12 col-md-12 col-xs-12">
                    <table id="detalles" class="table table-striped table-bordered table-condensed table-hover">
                      <thead style="background-color:#A9D0F5">
                        <th>NroDocumento</th>
                        <th>TipoDocumento</th>
                        <th>Deuda</th>
                        <th>Cobrado</th>
                        <th>Por Cobrar</th>
                      </thead>
                      <tfoot>
                        <th>SALDO</th>
                        <th></th>
                        <th></th>
                        <th></th>
                        <th><h4 id="total">0.00 Bs.</h4><input type="hidden" name="total_venta" id="total_venta"></th>
                      </tfoot>
                      <tbody>
                        
                      </tbody>
                    </table>
                  </div>           
                </div>
               
                <div class="box-footer" id="clienteestado1">
                  <button class="btn bg-red btn-app pull-right" onclick="cancelarform()" type="button"><i class="fa fa-arrow-circle-left"></i> Regresar</button>
                </div>

                <!--Modal-->
                <div class="modal fade" id="myModaldetallefactura" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
                  <div class="modal-dialog" style="width: 45% !important;">
                    <div class="modal-content">
                      <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                        <h4 class="modal-title">Detalle de CxC</h4>
                      </div>
                      <div class="modal-body">
                        <table id="tbdetallefactura" class="table table-striped table-bordered table-condensed table-hover" style="width:100%">
                          
                          <thead>
                            <th>Articulo</th>
                            <th>Cantidad</th>
                            <th>Monto</th>
                            <th>Total</th>
                          </thead>
                          <tbody>
                            
                          </tbody>
                          <tfoot>
                            <th></th>
                            <th></th>
                            <th></th>
                            <th></th>
                          </tfoot>
                        </table>
                      </div>
                      <div class="modal-footer">
                        <button class="btn btn-default" type="button" data-dismiss="modal">Cerrar</button>
                      </div>
                    </div>
                  </div>
                </div>

                <div class="modal fade" id="myModalcobros" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
                  <div class="modal-dialog" style="width: 65% !important;">
                    <div class="modal-content">
                      <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                        <h4 class="modal-title">Cobros del Documento: <label id="orden"></label> </h4>
                      </div>
                      <div class="modal-body">
                        <table id="tbcobros" class="table table-striped table-bordered table-condensed table-hover" style="width:100%">
                          <thead>

                            <th>Fecha</th>
                            <th>Referencia</th>
                            <th>Cuenta</th>
                            <th>Forma de Pago</th>
                            <th>Cobrado</th>
                            <th>Tasa</th>
                            
                          </thead>
                          <tbody>
                            
                          </tbody>
                          <tfoot>
                            <th></th>
                            <th></th>
                            <th></th>
                            <th></th>
                            <th></th>
                            <th></th>
                            
                            
                          </tfoot>
                        </table>
                      </div>
                      <div class="modal-footer">
                        <button class="btn btn-default" type="button" data-dismiss="modal">Cerrar</button>
                      </div>
                    </div>
                  </div>
                </div>
                <!--fin centro-->

            </div>
          </div>
        </div>
        <!-- /.box -->
      </section>
      <!-- /.content -->
    </div>
    <?php 
  }else{
    require 'vistas/contenidos/noacceso-view.php'; 
  }
  ?>
          <!-- Main Footer -->
          <?php include "vistas/modulos/mainfooter.php";?>
      </div>

      <!-- ./wrapper -->
      <!-- REQUIRED JS SCRIPTS -->
      <?php include "vistas/modulos/script.php";?>
      <script src="vistas/scripts/estadocuentaclienteh.js"></script>
      </body>
  </html> 
<?php  
}
  ob_end_flush();
?>
