<?php 
require_once('xconn.php');
session_start();
 
  if(!isset($_SESSION['d_usuario'])){
    header('Location: index.php');
    exit;
  }else{
    $iUsuario = $_SESSION['c_usuario'];
  }

  if ($conn ->connect_error) {
    die("Connection failed: " . $conn ->connect_error);
  }

  $iSolicitud = $_GET['id'];

  if($iSolicitud == 0){
    $iSolicitud = 1;
  }

  $result = mysqli_query($conn,"SELECT CONCAT(d_nombre, ' ' , d_appat , ' ' , d_apmat) AS d_nombre ,m_monto, t_catalogobancos.d_banco, CASE WHEN c_estatus = 1 THEN 'ALTA' WHEN c_estatus = 2 THEN 'AUTORIZACION' WHEN c_estatus = 3 THEN 'AVALUOS' WHEN c_estatus = 4 THEN 'FORMALIZACION' WHEN c_estatus = 5 THEN 'CANCELACION'END AS d_estatus, t_solicitud.c_cliente FROM t_solicitudbanco INNER JOIN t_solicitud ON  t_solicitud.c_solicitud = t_solicitudbanco.c_solicitud INNER JOIN t_clientes ON t_clientes.c_cliente = t_solicitud.c_cliente INNER JOIN t_catalogobancos ON t_catalogobancos.c_banco = t_solicitudbanco.d_banco WHERE t_solicitudbanco.c_solicitudbanco = '" . $iSolicitud . "'");

  if($row = mysqli_fetch_array($result)){
      $dNombre = $row['d_nombre'];
      $iMonto = $row['m_monto'];
      $dBanco = $row['d_banco'];
      $dEstatus = $row['d_estatus'];
      $idCliente  = $row['c_cliente'];
  }else{
    //header("Location: dashboard.php");
    exit();
  }

  if (isset($_POST['btn_autorizar'])){
    $idSolicitud = $_POST['txt_idsol1'];
     
    $sql = "UPDATE t_solicitudbanco SET c_estatus=c_estatus+1 WHERE c_solicitudbanco = $idSolicitud AND c_estatus < 4";

    if ($conn->query($sql) === TRUE) {
      header("Location: detallesolicitud.php?id=$idSolicitud");
    }else{
      echo'<script type="text/javascript">
        alert("Error:  $sql <br> $conn->error");
        </script>';
    }
  }
  if(isset($_POST['btn_cancelar'])){
    $idSolicitud = $_POST['txt_idsol2'];
     
    $sql = "UPDATE t_solicitudbanco SET c_estatus=5 WHERE c_solicitudbanco = $idSolicitud";

    if ($conn->query($sql) === TRUE) {
      header("Location: detallesolicitud.php?id=$idSolicitud");
    }else{
      echo'<script type="text/javascript">
        alert("Error:  $sql <br> $conn->error");
        </script>';
    }
  }


?>
<html>
<head>
  <title>Diaso | Brokers</title>
  <!-- Required meta tags -->
  <meta charset="utf-8">
  <meta content="width=device-width, initial-scale=1.0" name="viewport" />
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
  <!--     Fonts and icons     -->
  <link rel="stylesheet" type="text/css" href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700|Roboto+Slab:400,700|Material+Icons" />
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/latest/css/font-awesome.min.css">
  <!-- Material Kit CSS -->
  <link href="assets/css/material-dashboard.css?v=2.1.2" rel="stylesheet" />

</head>

<body>
  <div class="wrapper ">
    <div class="sidebar" data-color="azure" data-background-color="black">
      <div class="logo">
        <a href="https://diaso.com.mx/" class="simple-text logo-mini">
          Brokers -
          Diaso
        </a>
        <img src="img/logo.png" width="200" height="100"/>
      </div>
      <div class="sidebar-wrapper">
        <ul class="nav">
          <li class="nav-item">
            <a class="nav-link" href="dashboard.php">
              <i class="material-icons">dashboard</i>
              <p>Dashboard</p>
            </a>
          </li>
          <li class="nav-item">
            <a class="nav-link" href="clientes.php">
              <i class="material-icons">dashboard</i>
              <p>Clientes</p>
            </a>
          </li>
          <li class="nav-item active">
            <a class="nav-link" href="solicitudes.php">
              <i class="material-icons">dashboard</i>
              <p>Solicitudes</p>
            </a>
          </li>
          <li class="nav-item">
            <a class="nav-link" href="catalogos.php">
              <i class="material-icons">dashboard</i>
              <p>Catalogos</p>
            </a>
          </li>
          <li class="nav-item">
            <a class="nav-link" href="users.php">
              <i class="material-icons">dashboard</i>
              <p>Usuarios</p>
            </a>
          </li>
          
          <li class="nav-item active-pro ">
              <p>Disponible en: Web & Movil</p>
          </li>
          <!-- your sidebar here -->
        </ul>
      </div>
    </div>
    <div class="main-panel">
      <!-- Navbar -->
      <nav class="navbar navbar-expand-lg navbar-transparent navbar-absolute fixed-top ">
        <div class="container-fluid">
          <div class="navbar-wrapper">
            <a class="navbar-brand" href="javascript:;">Detalle de la Solicitud</a>
          </div>
          <button class="navbar-toggler" type="button" data-toggle="collapse" aria-controls="navigation-index" aria-expanded="false" aria-label="Toggle navigation">
            <span class="sr-only">Toggle navigation</span>
            <span class="navbar-toggler-icon icon-bar"></span>
            <span class="navbar-toggler-icon icon-bar"></span>
            <span class="navbar-toggler-icon icon-bar"></span>
          </button>
          <div class="collapse navbar-collapse justify-content-end">
            <ul class="navbar-nav">
              <li class="nav-item dropdown">
                <a class="nav-link" href="javascript:;" id="navbarDropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                  <i class="material-icons">notifications</i> Notificaciones
                </a>
                <div class="dropdown-menu dropdown-menu-right" aria-labelledby="navbarDropdownMenuLink">
                  <a class="dropdown-item" href="#">Mike John responded to your email</a>
                  <a class="dropdown-item" href="#">You have 5 new tasks</a>
                  <a class="dropdown-item" href="#">You're now friend with Andrew</a>
                  <a class="dropdown-item" href="#">Another Notification</a>
                  <a class="dropdown-item" href="#">Another One</a>
                </div>
              </li>
              <li class="nav-item dropdown">
                <a class="nav-link" href="javascript:;" id="navbarDropdownProfile" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                  <i class="material-icons">person</i>Hola <?php echo', ' . $_SESSION['d_usuario'] . '.'; ?>
                  <p class="d-lg-none d-md-block">
                    Hola, <?php 'Edgar Mejia'; ?>
                  </p>
                </a>
                <div class="dropdown-menu dropdown-menu-right" aria-labelledby="navbarDropdownProfile">
                  <a class="dropdown-item" href="profile.php">Perfil</a>
                  <a class="dropdown-item" href="configuration.php">Configuracion</a>
                  <div class="dropdown-divider"></div>
                  <a class="dropdown-item" href="xlogout.php">Salir</a>
                </div>
              </li>
              <!-- your navbar here -->
            </ul>
          </div>
        </div>
      </nav>
      
      <!-- End Navbar -->
      <div class="content">
        <div class="container-fluid">
          <div class="row">
            <div class="col-md-3">
              <div class="card card-profile">
                <div class="card-avatar">
                  <a href="javascript:;">
                    <img class="img" src="img/solicitud.png" />
                  </a>
                </div>
                <div class="card-body">
                  <h4 class="card-title">Solicitud <?php echo"$iSolicitud"; ?></h4>
                  <h4 class="card-title"><?php echo "$dNombre"; ?></h6>
                  <p class="card-description">
                    <?php echo'Monto: $ ' . number_format($iMonto,2) . ''; ?> </p>
                  <p class="card-description">
                    <?php echo'Banco: ' . $dBanco . ''; ?> 
                  </p>
                  <div class="alert alert-info" role="alert">
                    <strong><?php echo'Estatus: ' . $dEstatus; ?></strong>
                  </div>
                  <form method="post" action="<?php echo $_SERVER['PHP_SELF'] ?>">
                    <input name="txt_idsol1" type="hidden" value="<?php echo $iSolicitud; ?>">
                    <input type="submit" name="btn_autorizar" value="Autorizar" class="btn btn-primary btn-round">
                  </form>
                  <form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
                    <input name="txt_idsol2" type="hidden" value="<?php echo $iSolicitud; ?>">
                    <input type="submit" name="btn_cancelar" value="Cancelar Solicitud" class="btn btn-primary btn-round">
                  </form>
                </div>
              </div>
            </div>
            <div class="col-md-9">
              <div class="card">
                <div class="card-header card-header-tabs card-header-primary">
                  <div class="nav-tabs-navigation">
                    <div class="nav-tabs-wrapper">
                      <span class="nav-tabs-title">Completa los Datos.</span>
                      <ul class="nav nav-tabs" data-tabs="tabs">
                        <li class="nav-item">
                          <a class="nav-link active" href="#datospersonales" data-toggle="tab">
                            <i class="material-icons">account_circle</i> Datos Personales
                            <div class="ripple-container"></div>
                          </a>
                        </li>
                        <li class="nav-item">
                          <a class="nav-link" href="#conyugue" data-toggle="tab">
                            <i class="material-icons">face</i> Datos Conyugue
                            <div class="ripple-container"></div>
                          </a>
                        </li>
                        <li class="nav-item">
                          <a class="nav-link" href="#dependientes" data-toggle="tab">
                            <i class="material-icons">people</i> Dependientes
                            <div class="ripple-container"></div>
                          </a>
                        </li>
                        <li class="nav-item">
                          <a class="nav-link" href="#referencias" data-toggle="tab">
                            <i class="material-icons">person_add</i> Referencias
                            <div class="ripple-container"></div>
                          </a>
                        </li>
                        <li class="nav-item">
                          <a class="nav-link" href="#beneficiarios" data-toggle="tab">
                            <i class="material-icons">group</i> Beneficiarios
                            <div class="ripple-container"></div>
                          </a>
                        </li>
                        <li class="nav-item">
                          <a class="nav-link" href="#empleo" data-toggle="tab">
                            <i class="material-icons">domain</i> Empleo
                            <div class="ripple-container"></div>
                          </a>
                        </li>
                        <li class="nav-item">
                          <a class="nav-link" href="#patrimonio" data-toggle="tab">
                            <i class="material-icons">workspace_premium</i> Patrimonio
                            <div class="ripple-container"></div>
                          </a>
                        </li>
                      </ul>
                    </div>
                  </div>
                </div>
                <div class="card-body">
                  <div class="tab-content">
                    <div class="tab-pane active" id="datospersonales">
                      <form method="post" id="finfoadic" action="<?php echo $_SERVER['PHP_SELF']; ?>">
                        <div class="row">
                          <div class="col-md-12">
                            <label class="bmd-label-floating">Datos Adicionales</label>
                            <input name="txt_idcliente" type="hidden" value="<?php echo $idCliente; ?>">
                            <input name="txt_idsol" type="hidden" value="<?php echo $idSolicitud; ?>">
                            <div class="card-body">
                              <div class="row">
                            <div class="col-md-3">
                              <div class="form-group">
                                <label class="bmd-label-floating">Nacionalidad</label>
                                <input type="text" class="form-control" name="txt_nacionalidad" >
                              </div>
                            </div>
                            <div class="col-md-3">
                              <div class="form-group">
                                <label class="bmd-label-floating">Pais de Nacimiento</label>
                                <input type="text" class="form-control" name="txt_paisnac" >
                              </div>
                            </div>
                            <div class="col-md-3">
                              <div class="form-group">
                                <label class="bmd-label-floating">Entidad de Nacimiento</label>
                                <input type="text" class="form-control" name="txt_entidadnac" >
                              </div>
                            </div>
                            <div class="col-md-3">
                              <div class="form-group">
                                <label class="bmd-label-floating">Escolaridad</label>
                                <input type="text" class="form-control" name="txt_escolaridad" >
                              </div>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-md-3">
                              <div class="form-group">
                                <label class="bmd-label-floating">Identificacion Oficial</label>
                                <input type="text" class="form-control" name="txt_idof" >
                              </div>
                            </div>
                            <div class="col-md-3">
                              <div class="form-group">
                                <label class="bmd-label-floating">Id Numero</label>
                                <input type="text" class="form-control" name="txt_noid" >
                              </div>
                            </div>
                            <div class="col-md-3">
                              <div class="form-group">
                                <label class="bmd-label-floating">Curp</label>
                                <input type="text" class="form-control" name="txt_curp" >
                              </div>
                            </div>
                            <div class="col-md-3">
                              <div class="form-group">
                                <label class="bmd-label-floating">NSS (Numero de Seguridad Social)</label>
                                <input type="text" class="form-control" name="txt_nss" >
                              </div>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-md-3">
                              <div class="form-group">
                                <label class="bmd-label-floating">Tiempo de Residencia</label>
                                <input type="text" class="form-control" name="txt_resid" >
                              </div>
                            </div>
                            <div class="col-md-3">
                              <div class="form-group">
                                <label class="bmd-label-floating">Peso</label>
                                <input type="text" class="form-control" name="txt_peso" >
                              </div>
                            </div>
                            <div class="col-md-3">
                              <div class="form-group">
                                <label class="bmd-label-floating">Estatura</label>
                                <input type="text" class="form-control" name="txt_estatura" >
                              </div>
                            </div>
                            <div class="col-md-3">
                              <div class="form-group">
                                <label class="bmd-label-floating">Tipo de Vivienda</label>
                                <input type="text" class="form-control" name="txt_tipovi" >
                              </div>
                            </div>
                        </div>
                        
                            </div>
                            <input type="submit" name="btn_infoadic" value="Guardar" class="btn btn-primary pull-right"><br>
                          </div>
                        </div>
                      </form>
                      <div class="card-body">
                        <div class="table-responsive">
                          <table class="table">
                            <thead class=" text-primary">
                              <th>Nacionalidad</th><th>Pais Nacimiento</th><th>Entidad Nacimiento</th><th>Escolaridad</th><th>Identificacion Oficial</th><th>Numero de Identificacion</th><th>Curp</th><th>NSS</th>
                              <th>Tiempo de Residencia</th><th>Peso</th><th>Estatura</th><th>Tipo de Vivienda</th>
                            </thead>
                            <tbody>
                              <?php
                                $result2 = mysqli_query($conn,"SELECT * FROM t_clientesinfadic WHERE c_cliente = '$idCliente'");
                                while ($valores = mysqli_fetch_array($result2)) {
                                  echo '<tr>';
                                  echo '<td>' .$valores['c_nacionalidad']. '</td>';
                                  echo '<td>' .$valores['c_paisnac']. '</td>';
                                  echo '<td>' .$valores['d_entidadnac']. '</td>';
                                  echo '<td>' .$valores['c_escolaridad']. '</td>';
                                  echo '<td>' .$valores['c_idoficial']. '</td>';
                                  echo '<td>' .$valores['d_idnumero']. '</td>';
                                  echo '<td>' .$valores['d_curp']. '</td>';
                                  echo '<td>' .$valores['d_nss']. '</td>';
                                  echo '<td>' .$valores['d_tiempores']. '</td>';
                                  echo '<td>' .$valores['d_peso']. '</td>';
                                  echo '<td>' .$valores['d_estatura']. '</td>';
                                  echo '<td>' .$valores['c_tipovivienda']. '</td>';
                                  echo '</tr>';
                                } 
                              ?>
                            </tbody>
                          </table>
                        </div>
                      </div>
                    </div>
                    <div class="tab-pane" id="conyugue">
                      <form method="post" id="fconyugue" action="<?php echo $_SERVER['PHP_SELF']; ?>">
                        <div class="row">
                          <div class="col-md-12">
                            <label class="bmd-label-floating">Conyugue</label>

                            <div class="card-body">
                              <div class="row">
                                <div class="col-md-3">
                                  <div class="form-group">
                                    <input name="txt_conidcliente" type="hidden" value="<?php echo $idCliente; ?>">
                                    <input name="txt_conidsol" type="hidden" value="<?php echo $idSolicitud; ?>">
                                    <label class="bmd-label-floating">Nombre</label>
                                    <input type="text" class="form-control" name="txt_connombre" >
                                  </div>
                                </div>
                                <div class="col-md-3">
                                  <div class="form-group">
                                    <label class="bmd-label-floating">Apellido Paterno</label>
                                    <input type="text" class="form-control" name="txt_conappat" >
                                  </div>
                                </div>
                                <div class="col-md-3">
                                  <div class="form-group">
                                    <label class="bmd-label-floating">Apellido Materno</label>
                                    <input type="text" class="form-control" name="txt_conapmat" >
                                  </div>
                                </div>
                                <div class="col-md-3">
                                  <div class="form-group">
                                    <label class="bmd-label-floating">RFC</label>
                                    <input type="text" class="form-control" name="txt_conrfc" >
                                  </div>
                                </div>
                              </div>
                              <div class="row">
                                  <div class="col-md-3">
                                    <div class="form-group">
                                      <label class="bmd-label-floating">CURP</label>
                                      <input type="text" class="form-control" name="txt_concurp" >
                                    </div>
                                  </div>
                                  <div class="col-md-3">
                                    <div class="form-group">
                                      <label class="bmd-label-floating">Peso (kg)</label>
                                      <input type="text" class="form-control" name="txt_conpeso" >
                                    </div>
                                  </div>
                                  <div class="col-md-3">
                                    <div class="form-group">
                                      <label class="bmd-label-floating">Estatura (cm)</label>
                                      <input type="text" class="form-control" name="txt_conestatura" >
                                    </div>
                                  </div>
                              </div>
                            </div>
                            <input type="submit" name="btn_conyugue" value="Guardar" class="btn btn-primary pull-right"><br>
                          </div>
                        </div>
                      </form>
                      <div class="card-body">
                        <div class="table-responsive">
                          <table class="table">
                            <thead class=" text-primary">
                              <th>Nombre</th><th>Apellido Paterno</th><th>Apellido Materno</th><th>RFC</th><th>CURP</th><th>Peso</th><th>Estatura</th>
                            </thead>
                            <tbody>
                              <?php
                                $result2 = mysqli_query($conn,"SELECT * FROM t_clientesconyugue WHERE c_cliente = '$idCliente'");
                                while ($valores = mysqli_fetch_array($result2)) {
                                  echo '<tr>';
                                  echo '<td>' .$valores['d_nombre']. '</td>';
                                  echo '<td>' .$valores['d_appat']. '</td>';
                                  echo '<td>' .$valores['d_apmat']. '</td>';
                                  echo '<td>' .$valores['d_rfc']. '</td>';
                                  echo '<td>' .$valores['d_curp']. '</td>';
                                  echo '<td>' .$valores['d_peso']. '</td>';
                                  echo '<td>' .$valores['d_estatura']. '</td>';
                                  echo '</tr>';
                                } 
                              ?>
                            </tbody>
                          </table>
                        </div>
                      </div>
                    </div>
                    <div class="tab-pane" id="dependientes">
                      <form method="post" id="fdependientes" action="<?php echo $_SERVER['PHP_SELF']; ?>">
                        <div class="row">
                          <div class="col-md-12">
                            <label class="bmd-label-floating">Dependientes</label>

                            <div class="card-body">
                              <div class="row">
                            <div class="col-md-3">
                              <div class="form-group">
                                <input name="txt_depidcliente" type="hidden" value="<?php echo $idCliente; ?>">
                                <input name="txt_depidsol" type="hidden" value="<?php echo $idSolicitud; ?>">
                                <label class="bmd-label-floating">Nombre</label>
                                <input type="text" class="form-control" name="txt_depnombre" >
                              </div>
                            </div>
                            <div class="col-md-3">
                              <div class="form-group">
                                <label class="bmd-label-floating">Parentesco</label>
                                <input type="text" class="form-control" name="txt_depparentesco" >
                              </div>
                            </div>
                            <div class="col-md-3">
                              <div class="form-group">
                                <label class="bmd-label-floating">Edad</label>
                                <input type="text" class="form-control" name="txt_depedad" >
                              </div>
                            </div>
                            <div class="col-md-3">
                              <div class="form-group">
                                <label class="bmd-label-floating">Ocupacion</label>
                                <input type="text" class="form-control" name="txt_depocupacion" >
                              </div>
                            </div>
                        </div>
                            </div>
                            <input type="submit" name="btn_dependientes" value="Guardar" class="btn btn-primary pull-right"><br>
                          </div>
                        </div>
                      </form>
                      <div class="card-body">
                        <div class="table-responsive">
                          <table class="table">
                            <thead class=" text-primary">
                              <th>Nombre</th><th>Parentesco</th><th>Edad</th><th>Ocupacion</th>
                            </thead>
                            <tbody>
                              <?php
                                $result2 = mysqli_query($conn,"SELECT * FROM t_clientesdependientes WHERE c_cliente = '$idCliente'");
                                while ($valores = mysqli_fetch_array($result2)) {
                                  echo '<tr>';
                                  echo '<td>' .$valores['d_nombre']. '</td>';
                                  echo '<td>' .$valores['d_parentesco']. '</td>';
                                  echo '<td>' .$valores['d_edad']. '</td>';
                                  echo '<td>' .$valores['d_ocupacion']. '</td>';
                                  echo '</tr>';
                                } 
                              ?>
                            </tbody>
                          </table>
                        </div>
                      </div>
                    </div>
                    <div class="tab-pane" id="referencias">
                      <form method="post" id="freferencias" action="<?php echo $_SERVER['PHP_SELF']; ?>">
                        <div class="row">
                          <div class="col-md-12">
                            <label class="bmd-label-floating">Referencias</label>

                            <div class="card-body">
                              <div class="row">
                            <div class="col-md-3">
                              <div class="form-group">
                                <input name="txt_refidcliente" type="hidden" value="<?php echo $idCliente; ?>">
                                <input name="txt_refidsol" type="hidden" value="<?php echo $idSolicitud; ?>">
                                <label class="bmd-label-floating">Nombre</label>
                                <input type="text" class="form-control" name="txt_refnombre" >
                              </div>
                            </div>
                            <div class="col-md-3">
                              <div class="form-group">
                                <label class="bmd-label-floating">Apellidos</label>
                                <input type="text" class="form-control" name="txt_refapellidos" >
                              </div>
                            </div>
                            <div class="col-md-3">
                              <div class="form-group">
                                <label class="bmd-label-floating">Parentesco</label>
                                <input type="text" class="form-control" name="txt_refparentesco" >
                              </div>
                            </div>
                            <div class="col-md-3">
                              <div class="form-group">
                                <label class="bmd-label-floating">Correo</label>
                                <input type="text" class="form-control" name="txt_refcorreo" >
                              </div>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-md-3">
                              <div class="form-group">
                                <label class="bmd-label-floating">Telefono</label>
                                <input type="text" class="form-control" name="txt_reftelefono" >
                              </div>
                            </div>
                            <div class="col-md-3">
                              <div class="form-group">
                                <label class="bmd-label-floating">Celular</label>
                                <input type="text" class="form-control" name="txt_refcelular" >
                              </div>
                            </div>
                            <div class="col-md-3">
                              <div class="form-group">
                                <label class="bmd-label-floating">Tiempo de Conocerlo</label>
                                <input type="text" class="form-control" name="txt_reftiempo" >
                              </div>
                            </div>
                            <div class="col-md-3">
                              <div class="form-group">
                                <label class="bmd-label-floating">Tipo Referencia</label>
                                <input type="text" class="form-control" name="txt_reftipo" >
                              </div>
                            </div>
                        </div>
                            </div>
                            <input type="submit" name="btn_referencias" value="Guardar" class="btn btn-primary pull-right"><br>
                          </div>
                        </div>
                      </form>
                      <div class="card-body">
                        <div class="table-responsive">
                          <table class="table">
                            <thead class=" text-primary">
                              <th>Nombre</th><th>Apellidos</th><th>Parentesco</th><th>Correo</th><th>Telefono</th><th>Celular</th><th>Tiempo de Conocerlo</th><th>Tipo de Referencia</th>
                            </thead>
                            <tbody>
                              <?php
                                $result2 = mysqli_query($conn,"SELECT * FROM t_clientesreferencias WHERE c_cliente = '$idCliente'");
                                while ($valores = mysqli_fetch_array($result2)) {
                                  echo '<tr>';
                                  echo '<td>' .$valores['d_nombre']. '</td>';
                                  echo '<td>' .$valores['d_apellidos']. '</td>';
                                  echo '<td>' .$valores['d_parentesco']. '</td>';
                                  echo '<td>' .$valores['d_correo']. '</td>';
                                  echo '<td>' .$valores['d_telefono']. '</td>';
                                  echo '<td>' .$valores['d_celular']. '</td>';
                                  echo '<td>' .$valores['c_tiempoconocerlo']. '</td>';
                                  echo '<td>' .$valores['c_tiporeferencia']. '</td>';
                                  echo '</tr>';
                                } 
                              ?>
                            </tbody>
                          </table>
                        </div>
                      </div>
                    </div>
                    <div class="tab-pane" id="beneficiarios">
                      <form method="post" id="fbeneficiarios" action="<?php echo $_SERVER['PHP_SELF']; ?>">
                        <div class="row">
                          <div class="col-md-12">
                            <label class="bmd-label-floating">Beneficiarios</label>

                            <div class="card-body">
                              <div class="row">
                                <div class="col-md-3">
                                  <div class="form-group">
                                    <input name="txt_beidcliente" type="hidden" value="<?php echo $idCliente; ?>">
                                    <input name="txt_beidsol" type="hidden" value="<?php echo $idSolicitud; ?>">
                                    <label class="bmd-label-floating">Nombre</label>
                                    <input type="text" class="form-control" name="txt_benombre" >
                                  </div>
                                </div>
                                <div class="col-md-3">
                                  <div class="form-group">
                                    <label class="bmd-label-floating">Apellido Paterno</label>
                                    <input type="text" class="form-control" name="txt_beappat" >
                                  </div>
                                </div>
                                <div class="col-md-3">
                                  <div class="form-group">
                                    <label class="bmd-label-floating">Apellido Materno</label>
                                    <input type="text" class="form-control" name="txtbeapmat" >
                                  </div>
                                </div>
                                <div class="col-md-3">
                                  <div class="form-group">
                                    <label class="bmd-label-floating">Parentesco</label>
                                    <input type="text" class="form-control" name="txt_beparentesco" >
                                  </div>
                                </div>
                               </div>
                            <div class="row">
                                <div class="col-md-3">
                                  <div class="form-group">
                                    <label class="bmd-label-floating">Fecha de Nacimiento</label>
                                    <input type="date" class="form-control" name="txt_benacimiento" >
                                  </div>
                                </div>
                                <div class="col-md-3">
                                  <div class="form-group">
                                    <label class="bmd-label-floating">Telefono</label>
                                    <input type="text" class="form-control" name="txt_betelefono" maxlength="10">
                                  </div>
                                </div>
                                <div class="col-md-3">
                                  <div class="form-group">
                                    <label class="bmd-label-floating">Direccion</label>
                                    <input type="text" class="form-control" name="txt_bedireccion" >
                                  </div>
                                </div>
                                <div class="col-md-3">
                                  <div class="form-group">
                                    <label class="bmd-label-floating">Porcentaje</label>
                                    <input type="text" class="form-control" name="txt_beporcentaje" maxlength="3">
                                  </div>
                                </div>
                            </div>
                              
                            </div>
                            <input type="submit" name="btn_beneficiarios" value="Guardar" class="btn btn-primary pull-right"><br>
                          </div>
                        </div>
                      </form>
                      <div class="card-body">
                        <div class="table-responsive">
                          <table class="table">
                            <thead class=" text-primary">
                              <th>Nombre</th><th>Apellido Paterno</th><th>Apellido Materno</th><th>Parentesco</th><th>Fecha Nac</th><th>Telefono</th><th>Direccion</th><th>Procentaje</th>
                            </thead>
                            <tbody>
                              <?php
                                $result2 = mysqli_query($conn,"SELECT date_format(f_fechanac, '%d/%m/%Y') AS f_fechanaci, d_nombre, d_appat, d_apmat, d_parentesco, f_fechanac, d_telefono, d_direccion, c_porcentaje FROM t_solicitudbeneficiario WHERE c_cliente = '$idCliente'");
                                while ($valores = mysqli_fetch_array($result2)) {
                                  echo '<tr>';
                                  echo '<td>' .$valores['d_nombre']. '</td>';
                                  echo '<td>' .$valores['d_appat']. '</td>';
                                  echo '<td>' .$valores['d_apmat']. '</td>';
                                  echo '<td>' .$valores['d_parentesco']. '</td>';
                                  echo '<td>' .$valores['f_fechanaci']. '</td>';
                                  echo '<td>' .$valores['d_telefono']. '</td>';
                                  echo '<td>' .$valores['d_direccion']. '</td>';
                                  echo '<td>' .$valores['c_porcentaje']. '</td>';
                                  echo '</tr>';
                                } 
                              ?>
                            </tbody>
                          </table>
                        </div>
                      </div>
                    </div>
                    <div class="tab-pane" id="empleo"> 
                      <form method="post" id="fempleo" action="<?php echo $_SERVER['PHP_SELF']; ?>">
                        <div class="row">
                          <div class="col-md-12">
                            <label class="bmd-label-floating">Empleo</label>

                            <div class="card-body">
                              <div class="row">
                            <div class="col-md-3">
                              <div class="form-group">
                                <input name="txt_emidcliente" type="hidden" value="<?php echo $idCliente; ?>">
                                <input name="txt_emidsol" type="hidden" value="<?php echo $idSolicitud; ?>">
                                <label class="bmd-label-floating">Nombre Empresa</label>
                                <input type="text" class="form-control" name="txt_emnombre" >
                              </div>
                            </div>
                            <div class="col-md-3">
                              <div class="form-group">
                                <label class="bmd-label-floating">Puesto</label>
                                <input type="text" class="form-control" name="txt_empuesto" maxlength="10">
                              </div>
                            </div>
                            <div class="col-md-3">
                              <div class="form-group">
                                <label class="bmd-label-floating">Fecha de Ingreso</label>
                                <input type="date" class="form-control" name="txt_emingreso" >
                              </div>
                            </div>
                            <div class="col-md-3">
                              <div class="form-group">
                                <label class="bmd-label-floating">Antiguedad</label>
                                <input type="text" class="form-control" name="txt_emantiguedad" maxlength="3">
                              </div>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-md-3">
                              <div class="form-group">
                                <label class="bmd-label-floating">Tipo de Contrato</label>
                                <input type="text" class="form-control" name="txt_emtipocontrato" >
                              </div>
                            </div>
                            <div class="col-md-3">
                              <div class="form-group">
                                <label class="bmd-label-floating">Calle</label>
                                <input type="text" class="form-control" name="txt_emcalle" maxlength="10">
                              </div>
                            </div>
                            <div class="col-md-3">
                              <div class="form-group">
                                <label class="bmd-label-floating">No. Ext</label>
                                <input type="text" class="form-control" name="txt_emnoext" >
                              </div>
                            </div>
                            <div class="col-md-3">
                              <div class="form-group">
                                <label class="bmd-label-floating">No. Int</label>
                                <input type="text" class="form-control" name="txt_emnoint" maxlength="3">
                              </div>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-md-3">
                              <div class="form-group">
                                <label class="bmd-label-floating">Colonia</label>
                                <input type="text" class="form-control" name="txt_emcolonia" >
                              </div>
                            </div>
                            <div class="col-md-3">
                              <div class="form-group">
                                <label class="bmd-label-floating">Codigo Postal</label>
                                <input type="text" class="form-control" name="txt_emcp" maxlength="10">
                              </div>
                            </div>
                            <div class="col-md-3">
                              <div class="form-group">
                                <label class="bmd-label-floating">Estado</label>
                                <input type="text" class="form-control" name="txt_emestado" >
                              </div>
                            </div>
                            <div class="col-md-3">
                              <div class="form-group">
                                <label class="bmd-label-floating">Municipio</label>
                                <input type="text" class="form-control" name="txt_emmunicipio" maxlength="3">
                              </div>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-md-3">
                              <div class="form-group">
                                <label class="bmd-label-floating">Telefono</label>
                                <input type="text" class="form-control" name="txt_emtelefono" maxlength="10">
                              </div>
                            </div>
                            <div class="col-md-3">
                              <div class="form-group">
                                <label class="bmd-label-floating">Actividad Economica</label>
                                <input type="text" class="form-control" name="txt_emactividadeco">
                              </div>
                            </div>
                            <div class="col-md-3">
                              <div class="form-group">
                                <label class="bmd-label-floating">Giro Mercantil</label>
                                <input type="text" class="form-control" name="txt_emgiro" >
                              </div>
                            </div>
                            <div class="col-md-3">
                              <div class="form-group">
                                <label class="bmd-label-floating">Sector Laboral</label>
                                <input type="text" class="form-control" name="txt_emsector">
                              </div>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-md-3">
                              <div class="form-group">
                                <label class="bmd-label-floating">Descripcion de Funciones</label>
                                <input type="text" class="form-control" name="txt_emfunciones" >
                              </div>

                            </div>
                            <div class="col-md-3">
                              <div class="form-group">
                                <label class="bmd-label-floating">Datos Empleo Anterior</label>
                                <input type="text" class="form-control" name="txt_emdatosant" maxlength="10">
                              </div>
                            </div>
                            <div class="col-md-3">
                              <div class="form-group">
                                <label class="bmd-label-floating">Sueldo</label>
                                <input type="text" class="form-control" name="txt_emsueldo" >
                              </div>
                            </div>
                            <div class="col-md-3">
                              <div class="form-group">
                                <label class="bmd-label-floating">Bonos</label>
                                <input type="text" class="form-control" name="txt_embonos" maxlength="3">
                              </div>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-md-3">
                              <div class="form-group">
                                <label class="bmd-label-floating">Comisiones</label>
                                <input type="text" class="form-control" name="txt_emcomisiones" >
                              </div>
                            </div>
                            <div class="col-md-3">
                              <div class="form-group">
                                <label class="bmd-label-floating">Honorarios</label>
                                <input type="text" class="form-control" name="txt_emhonorarios" maxlength="10">
                              </div>
                            </div>
                            <div class="col-md-3">
                              <div class="form-group">
                                <label class="bmd-label-floating">Promedio Mensual</label>
                                <input type="text" class="form-control" name="txt_empromedio" >
                              </div>
                            </div>
                            <div class="col-md-3">
                              <div class="form-group">
                                <label class="bmd-label-floating">Institucion</label>
                                <input type="text" class="form-control" name="txt_eminstitucion" maxlength="3">
                              </div>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-md-3">
                              <div class="form-group">
                                <label class="bmd-label-floating">Tipo Producto</label>
                                <input type="text" class="form-control" name="txt_emtipoproducto" >
                              </div>
                            </div>
                            <div class="col-md-3">
                              <div class="form-group">
                                <label class="bmd-label-floating">No. Cuenta</label>
                                <input type="text" class="form-control" name="txt_emcuenta" maxlength="10">
                              </div>
                            </div>
                            <div class="col-md-3">
                              <div class="form-group">
                                <label class="bmd-label-floating">Saldo Actual</label>
                                <input type="text" class="form-control" name="txt_emsaldoactual" >
                              </div>
                            </div>
                            <div class="col-md-3">
                              <div class="form-group">
                                <label class="bmd-label-floating">Pago Mensual</label>
                                <input type="text" class="form-control" name="txt_empagomensual" maxlength="3">
                              </div>
                            </div>
                        </div>
                            </div>
                            <input type="submit" name="btn_empleo" value="Guardar" class="btn btn-primary pull-right"><br>
                          </div>
                        </div>
                      </form>
                    </div>
                    <div class="tab-pane" id="patrimonio">
                      <form method="post" id="fpatrimonio" action="<?php echo $_SERVER['PHP_SELF']; ?>">
                        <div class="row">
                          <div class="col-md-12">
                            <label class="bmd-label-floating">Patrimonio</label>

                            <div class="card-body">
                              <div class="row">
                            <div class="col-md-3">
                              <div class="form-group">
                                <input name="txt_patidcliente" type="hidden" value="<?php echo $idCliente; ?>">
                                <input name="txt_patidsol" type="hidden" value="<?php echo $idSolicitud; ?>">
                                <label class="bmd-label-floating">Saldo en Cheques</label>
                                <input type="text" class="form-control" name="txt_patcheques" >
                              </div>
                            </div>
                            <div class="col-md-3">
                              <div class="form-group">
                                <label class="bmd-label-floating">Saldo en Inversiones</label>
                                <input type="text" class="form-control" name="txt_patinversiones" maxlength="10">
                              </div>
                            </div>
                            <div class="col-md-3">
                              <div class="form-group">
                                <label class="bmd-label-floating">Valor de Vivienda</label>
                                <input type="text" class="form-control" name="txt_patvivienda" >
                              </div>
                            </div>
                            <div class="col-md-3">
                              <div class="form-group">
                                <label class="bmd-label-floating">Terrenos</label>
                                <input type="text" class="form-control" name="txt_patterrenos">
                              </div>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-md-3">
                              <div class="form-group">
                                <label class="bmd-label-floating">Locales</label>
                                <input type="text" class="form-control" name="txt_patlocales" >
                              </div>
                            </div>
                            <div class="col-md-3">
                              <div class="form-group">
                                <label class="bmd-label-floating">Datos Vehiculo</label>
                                <input type="text" class="form-control" name="txt_patvehiculo">
                              </div>
                            </div>
                            <div class="col-md-3">
                              <div class="form-group">
                                <label class="bmd-label-floating">Otros Bienes</label>
                                <input type="text" class="form-control" name="txt_patbienes" >
                              </div>
                            </div>
                        </div>
                            </div>
                            <input type="submit" name="btn_patrimonio" value="Guardar" class="btn btn-primary pull-right"><br>
                          </div>
                        </div>
                      </form>
                      <div class="card-body">
                        <div class="table-responsive">
                          <table class="table">
                            <thead class=" text-primary">
                              <th>Saldo en Cheques</th><th>Saldo Inversiones</th><th>Valor de Vivienda</th><th>Terreno</th><th>Locales</th><th>Datos de Vehiculo</th><th>Otros Bienes</th>
                            </thead>
                            <tbody>
                              <?php
                                $result2 = mysqli_query($conn,"SELECT * FROM t_solicitudpatrimonio WHERE c_cliente = '$idCliente'");
                                while ($valores = mysqli_fetch_array($result2)) {
                                  echo '<tr>';
                                  echo '<td>' .$valores['m_saldocheques']. '</td>';
                                  echo '<td>' .$valores['m_saldoinversiones']. '</td>';
                                  echo '<td>' .$valores['m_valorvivienda']. '</td>';
                                  echo '<td>' .$valores['d_terreno']. '</td>';
                                  echo '<td>' .$valores['d_locales']. '</td>';
                                  echo '<td>' .$valores['d_datosvehiculo']. '</td>';
                                  echo '<td>' .$valores['d_otrosbienes']. '</td>';
                                  echo '</tr>';
                                } 
                              ?>
                            </tbody>
                          </table>
                        </div>
                      </div>
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
      <footer class="footer">
        <div class="container-fluid">
          <nav class="float-left">
            <ul>
              <li>
                <a href="https://diaso.com.mx/">
                  Brokers
                </a>
              </li>
            </ul>
          </nav>
          <div class="copyright float-right">
            &copy;
            <script>
              document.write(new Date().getFullYear())
            </script>, Diaso.
            <a href="xlogout.php" class="btn btn-primary btn-round">Salir</a>
          </div>
          <!-- your footer here -->
        </div>
      </footer>
    </div>
  </div>

  <script src="assets/js/core/jquery.min.js"></script>
  <script src="assets/js/core/popper.min.js"></script>
  <script src="assets/js/core/bootstrap-material-design.min.js"></script>
  <script src="assets/js/plugins/perfect-scrollbar.jquery.min.js"></script>


</body>
</html>