<?php
include_once("../src/conexion.php");

$link=ConectarseServidor();
ConectarseBaseDatos($link);
$deudor=cliente(); //consultamos los clientes
$codeudor=cliente();
$cobrador=cobrador();
$forma_pago=forma_pago();

?>
<!DOCTYPE html>
<html>
    <head>
        <title>Presta Ya ! - Amortizacion</title>      
        <link rel="stylesheet" href="../bootstrap/css/bootstrap.min.css" />
        
        <script type="text/JavaScript" src="../js/jQuery.js"></script>
        <script src="../js/bootstrap.min.js"></script>
  		<script src="../js/bootstrapValidator.js"></script>
        <script type="text/JavaScript" src="../js/chosen.jquery.js"></script>
        <script type="text/JavaScript" src="../js/forms.js"></script> 
		<script type="text/JavaScript" src="../js/Reporte.js"></script> 
        <script>
      $(function() {
        $('.chosen-select').chosen();
        $('.chosen-select-deselect').chosen({ allow_single_deselect: true });
      });
    </script>
    </head>
    <body data-twttr-rendered="true">
		<div class="container">

			<div class="row">
			    <div class="col-xs-12 col-sm-8 col-md-6 col-sm-offset-2 col-md-offset-3">
					<form id="reg_amortizacion" role="form">
						<input type="hidden" id="hidden" name="new"  value="new">
						<h2>Analisis de Cr&eacute;dito</h2>                                
                                                
                        <div class="row">
							<div class="col-xs-12 col-sm-6 col-md-6">
								<div class="form-group">
                                    <label><h4>Deudor</h4></label>
                                    <select name="txtDeudor" id="txtDeudor" data-placeholder="Seleccione el Deudor" class="chosen-select">
                                      <option value=""></option>
                                      <?php
                                          while ($row = mysql_fetch_array($deudor)){
                                              ?>
                                              <option value="<?php echo  $row['cedula']; ?>"><?php echo  $row['cedula']."-".$row['cliente']; ?></option>
                                              <?php
                                          }
                                      ?>
                                    </select>
								</div>
							</div>
							<div class="col-xs-12 col-sm-6 col-md-6">
								<div class="form-group">
                                    <label><h4>Codeudor</h4></label>
                                  <select name="txtCoDeudor" id="txtCoDeudor" data-placeholder="Seleccione el Co-Deudor" class="chosen-select">
                                      <option value=""></option>
                                      <?php
                                          while ($row = mysql_fetch_array($codeudor)){
                                              ?>
                                              <option value="<?php echo  $row['cedula']; ?>"><?php echo  $row['cedula']."-".$row['cliente']; ?></option>
                                              <?php
                                          }                                          
                                      ?>
                                  </select>
								</div>
							</div>
						</div>
                        
                        
                        <div class="row">
							<div class="col-xs-12 col-sm-6 col-md-6">
								<div class="form-group">
                                    <h4>Dinero a solicitar</h4>
			                       <input type="text" name="txtCapital" id="txtCapital" class="form-control input-lg" placeholder="Dinero a solicitar" tabindex="1" required>
								</div>
							</div>
							<div class="col-xs-12 col-sm-6 col-md-6">
								<div class="form-group">
                                    <h4>No. Cuotas</h4>
									<input type="text" name="txtMeses" id="txtMeses" class="form-control input-lg" placeholder="No. Cuotas" tabindex="2" required>
								</div>
							</div>
						</div>
                        
						<div class="form-group">
                            <h4>Tasa Interes %</h4>
							<input type="text" name="txtInteres" id="txtInteres" class="form-control input-lg" placeholder="Tasa Interes" tabindex="3" required>
						</div>
                        
                        <div class="form-group">
                            <label><h4>Forma de Pago</h4></label>
                            <select name="txtForma" id="txtForma" data-placeholder="Forma de pago" class="chosen-select">
                             <option value=""></option>
                             <?php
							   while ($row = mysql_fetch_array($forma_pago)){
								   ?>
                                   <option value="<?php echo  $row['id_forma']; ?>"><?php echo  $row['forma_pago']; ?></option>
                                   <?php
							   }
							 ?>
                             
                            </select>      
						</div>
                        
                        
                        <div class="form-group">
                            <label><h4>Cobrador - Zona</h4></label>
                            <select name="txtCobrador" id="txtCobrador" data-placeholder="Seleccione el Cobrador" class="chosen-select">
                             <option value=""></option>
                             <?php
							   while ($row = mysql_fetch_array($cobrador)){
								   ?>
                                   <option value="<?php echo  $row['id_cobrador']; ?>"><?php echo  $row['cobrador']." - ".$row['zona']; ?></option>
                                   <?php
							   }
							   
							   desconectarse($link);//cierra la conexion
							 ?>
                             
                            </select>      
						</div>
						
						<hr class="colorgraph">
						<div class="row">
							<div class="col-xs-12 col-md-6"><div class="btn btn-primary btn-block btn-lg" tabindex="7" id="btnAmortizacion">Simulador</div></div>
                            <div class="col-xs-12 col-md-6"><div class="btn btn-primary btn-block btn-lg" tabindex="7" id="btnGuardaCredito">Guardar Credito</div></div>
						</div>
					</form>
				</div>
			</div>
		</div>
    </body>
    <div class="container">
              <div class="row">
                  <table class="table">
                      <thead>
                          <tr>
                              <th>
                                  No. Cuota
                              </th>
                              <th>
                                  Valor Cuota
                              </th>
                              <th>
                                  Interes
                              </th>
                              <th>
                                  Amortizaci&oacute;n
                              </th>
                              <th>
                                  Capital
                              </th>
                          </tr>	
                      </thead>
                      <tbody id="BodyTable">
          
                      </tbody>
                  </table>
              </div>
	</div>
</html>