MOON
Server: Apache/2.2.34 (Unix) mod_ssl/2.2.34 OpenSSL/0.9.8e-fips-rhel5 mod_bwlimited/1.4 FrontPage/5.0.2.2635
System: Linux server.asjudinet.com 2.6.32-042stab141.3 #1 SMP Fri Nov 15 22:45:34 MSK 2019 i686
User: asjudine (504)
PHP: 5.2.17
Disabled: NONE
Upload Files
File: /home/asjudine/www/credito_rotativo_formulario_aprobacion_desembolsos.php
<?php
global $dbi;
$espacio = ' ';
$linea = '-';
require_once("Conectarse.php");


/////////////////////////////////////
// INFORMACION DE CREDITO ROTATIVO //
/////////////////////////////////////

$control = mysql_query('SELECT cedula, apellidos, nombres, grado, rango, libranza_credito, direccion , telefono, celular, ciudad , email, cuenta, banco, numerosolicitud, fecha_solicitud, nombre_padre, nombre_madre, direccion_padres, ciudad_padres, telefono_padres, celular_padres, referencia_compa, celular_compa, valor_anticipo, saldo_pendiente, monto_solicitado, fecha_reporte  FROM credito_rotativo WHERE cedula =  "' . $_GET["ced2"] . '"   ');
	if (!$control) {
		die('Invalid query prin: ' . mysql_error());
	}
$num=mysql_num_rows($control); 
list($cedula, $apellidos, $nombres, $grado, $rango, $cred, $direccion, $telefono, $celular, $ciudad, $email, $cuenta, $banco, $numerosolicitud, $fecha_solicitud, $nompadre, $nommadre, $direcpadres, $ciudadpadres, $telpadres, $celpadres, $refcompa, $celcompa, $valor_anticipo, $saldo_pendiente, $montosolicitado, $fecha_reporte ) = mysql_fetch_row($control);

$fullnombre = $apellidos ." ".$nombres; 

$solicitudes = mysql_query('SELECT cedula, solicitud1, fecha1, desembolso1 FROM credito_rotativo_solicitud WHERE cedula = "'.$cedula.'" and estado = 0 ');
while(list($cedula_soli, $soli1, $fecha1, $desembolso1) = mysql_fetch_row($solicitudes))
{
	$ultimoDesembolso = $desembolso1;
}

/*$solofecha = mysql_query('SELECT fecha_reporte FROM credito_rotativo_solicitud WHERE cedula = "'.$cedula.'" and numerocontrato = "'.$numcon.'" ');
list($fecha_reporte) = mysql_fetch_row($solofecha);*/
	/*if($desembolso1!="" and $desembolso2 ==""){$numero_solicitud = 1; $desem = $desembolso1;}
elseif($desembolso2!="" and $desembolso3 ==""){$numero_solicitud = 2; $desem = $desembolso2;}
elseif($desembolso3!="" and $desembolso4 ==""){$numero_solicitud = 3; $desem = $desembolso3;}
elseif($desembolso4!="" and $desembolso5 ==""){$numero_solicitud = 4; $desem = $desembolso4;}*/


	






/////////////////////////////////////////////////////////////////////



$permanencia = 24;

/*$controlcartera = mysql_query('SELECT cedula, codigo_militar, nombre, numero_libranza, grado, direccion, telefono, celular, ciudad, email, unidad_descuento FROM cartera_serviasjudinet WHERE  cedula =  "' . $_GET["ced2"] . '"  ');
if (!$controlcartera) {
	die('Invalid query 2: ' . mysql_error());
}  
list($cedula, $codigo, $nombre, $numlib, $grado, $direccion, $telefono, $celular, $ciudad, $email, $unidad ) = mysql_fetch_row($controlcartera);*/

?>

<!DOCTYPE html>
<html>
<head>
<title>APROBACION CREDITO ROTATIVO</title>
<meta http-equiv="X-UA-Compatible" content="IE=8; IE=9; IE=edge" />
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<style type="text/css">
    *{margin: 0;padding: 0;}
    body{background-color:#EAEAEA;font-family:Verdana, Geneva, sans-serif;}
    header {background-color: #B7271F; text-align: center;}
    
    .titulo{width: 100%;text-align: center;background-color: #dbd8c9;color: #b20606;padding: 6px 0;font-size: 18px;}
    table{margin: 0 auto;border: 8px solid #bebebe; text-align: center;}
    .divirmenu{text-align: center;}
    .irmenu{width: 200px;background-color: #1c4fa0;color: #fff; padding: 4px;border-radius: 6px;}
    .irmenu:hover{background-color: #67a0d9; color: #000;}
	.direcciona{width: 200px;background-color: #D4090C;color: #fff; padding: 4px;border-radius: 3px;}
	.direcciona:hover{background-color: #67a0d9; color: #000;}    
    .fecha{background-color: #d6e08b; padding: 2px;color: #000;font-size: 15px; text-align: center;}
    td{padding: 1px; border: 1px solid #a0a0a0;}
    .td{background-color: #e5e5e5; padding: 1px 30px;color: #00135F;font-size: 14px;font-weight: 600; text-align: center;}
    .boton1{width:30%;background-color: #ffffff;color: #000;padding: 2px;border:2px solid #580000;border-radius:10px;}
    .boton1:hover{background-color: #6f0000;color: #fff;cursor: pointer;}
    input[type=text],select{border-radius: 5px; padding: 3px;background-color: #FFF;}
	
	.tdtitulo{background-color: #e3dec0; color: #b20606; padding: 2px; text-align: center; font-size: 12px; font-weight: 900}
    .tdfull{background-color: #fff; color: #000; padding: 1px; text-align: center; font-size: 12px;}
    .botonnew{width: 90px; background-color: #e3dec0;color: #b20606;padding: 1px;border-radius:5px;}
    .botonnew:hover{width: 90px; background-color: #cbbd6a;color: #000;padding: 1px;border-radius:5px;}
	.tdizq{background-color: #e5e5e5; padding: 1px 10px;color: #00135F;font-size: 12px;font-weight: 600; text-align: left;}
    .tdcen{background-color: #e5e5e5; padding: 1px 10px;color: #00135F;font-size: 12px;font-weight: 600; text-align: center;}
    .tdder{background-color: #e5e5e5; padding: 1px 2px;color: #00135F;font-size: 12px;font-weight: 600; text-align: right;}
	.tddered{background-color: #e5e5e5; padding: 1px 2px;color: #D40609;font-size: 12px;font-weight: 600; text-align: right;}
	.tdbono{background-color: #FFFFCC; padding: 1px 2px;color: #00135F;font-size: 12px;font-weight: 600; text-align: right;}
	/*Estilo Complementario*/
	.tdi{background-color: #F9FBC8; padding: 1px 10px;color: #00135F;font-size: 12px;font-weight: 600; text-align: left;}
	.tdc{background-color: #F9FBC8; padding: 1px 10px;color: #00135F;font-size: 12px;font-weight: 600; text-align: center;}
    .tdd{background-color: #F9FBC8; padding: 1px 2px;color: #00135F;font-size: 12px;font-weight: 600; text-align: right;}
	.tdrojad{background-color: #EEE; color: #8A0002; padding: 1px 4px;font-size: 12px;font-weight: 600; text-align: right;}
	.tdrojai{background-color: #EEE; color: #8A0002; padding: 1px 4px;font-size: 12px;font-weight: 600; text-align: left;}
	.rojo{color:#C60000;}
	
	.aprobado{background-color:#2CA316; color:#FFF; padding:4px;}
	.aprobado:hover{background-color:#296411; color:#FFF; padding:4px;}
	.denegado{background-color:#BE161B; color:#FFF; padding:4px;}
	.denegado:hover{background-color:#A42023; color:#FFF; padding:4px;}
	.pendiente{background-color:#5170EC; color:#FFF; padding:4px;}
	.pendiente:hover{background-color:#1B3A8D; color:#FFF; padding:4px;}
	
	.valida{background-color:#A41518; color:#FFF;}
	.hit{background-color: #47547C; color: #fff; padding: 2px; text-align: center; font-size: 12px; font-weight: 900;}
	.hitpay{background-color: #125417; color: #fff; padding: 2px; text-align: center; font-size: 12px; font-weight: 900;}
</style>



<script>

function Verificar() {
		
	if (document.form1.fechareporte.value == "0000-00-00")
	{
		alert("Verifique FECHA A REPORTAR");
		document.form1.fechareporte.focus()
		return (false);
	}
	
	if (document.form1.fechareporte.value == "")
	{
		alert("Verifique FECHA A REPORTAR");
		document.form1.fechareporte.focus()
		return (false);
	}
	
	
	
	
	var dt = new Date();
	if (document.form1.fechareporte.value < dt)
	{
		alert("Verifique Fecha De Reporte");
		document.form1.fechareporte.focus()
		return (false);
	}
	
	if (document.form1.actuacion.value == "")
	{
		alert("Escriba Una Gestion");
		document.form1.actuacion.focus()
		return (false);
	}
	
	return(true);
	
	
	
}
</script>


</head>


<body>

<header>
    <img src="../ELEMENTS/bannerInterasjudinet.png" alt="" width=" 700" height="70">
</header>
<h3 class="titulo">APROBACION DE CREDITO ROTATIVO</h3>


<form action="" method="post" name="form1" onSubmit="return Verificar()">

<table width="850" border="2"  cellpadding="1" cellspacing="1" class="sol_cre1">
<tr>
	<td class="tdder">Fecha Aprobacion :</td>
    <td class="tdizq"><input name="fecha" type="text" class="Estilo66" id="fecha" value="<?php echo date("Y-m-d"); ?>" size="10" maxlength="10" /></td>
  	<td class="tdder">Nombres:</td>
    <td class="tdizq" colspan="3"><input name="nombre" type="text" class="Estilo66" id="nombre" value="<?php echo $fullnombre ?>" size="60" maxlength="65" readonly/></td>
</tr>


<tr>
	<td class="tdder">Cedula No:</td>
    <td class="tdizq"><input name="cedula" type="text" class="Estilo66" id="cedula" value="<?php echo $cedula ?>" size="20" maxlength="20" readonly/></td>
   	
  	<td class="tdder">Grado :</td>
    <td class="tdizq"><input name="grado" type="text" class="Estilo66" id="grado" value="<?php echo $grado; ?>" size="12" maxlength="10" readonly/></td>
    <td class="tdder">Tipo Registro:</td>
	<td class="tdizq"><input name="rango" type="text" id="rango" value="<?php echo $rango ?>" size="12" maxlength="10" readonly/></td>
</tr>


<tr>
	<td class="tdder">Direccion</td>
    <td class="tdizq" colspan="2"><input name="direccion" type="text" class="Estilo66" id="direccion" value="<?php echo $direccion ?>" size="45" maxlength="45" readonly/></td>
   	<td class="tdder">E-mail :</td>
    <td class="tdizq" colspan="2"><input name="email" type="text" class="Estilo66" id="email" value="<?php echo $email ?>" size="36" maxlength="36" readonly/></td>
</tr>


<tr>
	<td class="tdder">Ciudad :</td>
    <td class="tdizq"><input name="ciudad" type="text" class="Estilo66" id="ciudad" value="<?php echo $ciudad ?>" size="14" maxlength="20" readonly/></td>
   	<td class="tdder">Telefono :</td>
    <td class="tdizq"><input name="telefono" type="text" class="Estilo66" id="telefono" value="<?php echo $telefono ?>" size="10" maxlength="20" readonly/></td>
  	<td class="tdder">Celular :</td>
    <td class="tdizq"><input name="celular" type="text" class="Estilo66" id="celular" value="<?php echo $celular ?>" size="20" maxlength="20" /></td>
</tr>


<tr>
	<td class="tdrojad">MONTO SOLICITADO:</td>
    <td class="tdizq"><input name="montosolicitado" type="text" class="rojo" id="montosolicitado" value="<?php echo $montosolicitado ?>" size="14" maxlength="20" readonly/></td>
    <td class="tdder">Credito Libranza:</td>
    <td class="tdizq"><input name="creditolibranza" type="text" class="rojo" id="creditolibranza" value="<?php echo $cred ?>" size="14" maxlength="20"/></td>
    
    <td class="tdder">Credito Numero:</td>
    <td class="tdizq"><input name="credito_numero" type="text" class="rojo" id="credito_numero" value="<?php echo $numerosolicitud ?>" size="14" maxlength="20" readonly/></td>
    <!--<td class="tdder">Nº SOLICITUD:</td>
    <td class="tdizq"><input name="numero_solicitud" type="text" class="rojo" id="numero_solicitud" value="<?php echo $numero_solicitud ?>" size="14" maxlength="20" readonly/></td>-->
</tr>

<tr>
<td class="tdder" colspan="2">VALOR DESEMBOLSO:</td>
    <td class="tdizq"><input name="monto_solicitado" type="text" class="rojo" id="monto_solicitado" value="<?php echo $ultimoDesembolso ?>" size="14" maxlength="20" readonly/></td>
</tr>

<!--<tr>
	<td class="tdder">VALOR ANTICIPO</td>
	<td class="tdizq"><input name="valor_anticipo" type="text" class="rojo" id="valor_anticipo" value="<?php echo $valor_anticipo ?>" size="12" maxlength="10" readonly/>
	</td>
	<td class="tdder">SALDO PENDIENTE</td>
	<td class="tdizq"><input name="saldo_pendiente" type="text" class="rojo" id="saldo_pendiente" value="<?php echo $saldo_pendiente ?>" size="12" maxlength="10" readonly/>
    <td class="tdder">DESEMBOLSO</td>
    <td class="tdizq"><input name="valor_desembolso" type="text" class="rojo" id="valor_desembolso" value="<?php echo $desembolso1 ?>" size="30" maxlength="30" readonly/></td>
</tr>
-->


<!--<tr >
        <td class="tdroja">Cuenta No :</td>
        <td bgcolor="#F7FFE1"><div align="left" class="Estilo70">
            <input name="cuenta" type="text" class="Estilo66" id="cuenta" value="<?php echo $cuenta ?>" size="25" maxlength="25" />
        </div></td>
        <td class="tdroja">Banco :</td>
        <td bgcolor="#F7FFE1" ><div align="left" class="Estilo70">
            <input name="banco" type="text" class="Estilo66" id="banco" value="<?php echo $banco ?>" size="20" maxlength="20" />
        </div></td>
	    </tr>
</tr>-->
      
 </table>
    
    
<br>
<table width="850" border="2" cellpadding="1" cellspacing="1" class="sol_cre1">
<tr>
  <td class="fecha" colspan="6">INFORMACION COMPLEMENTARIA</td>
</tr>
<tr>
    
    
    
</tr>


<!--<tr>
    <td class="tdder">Direccion</td>
    <td class="tdizq"><input name="direccion" type="text"  id="direccion" value="" size="12" maxlength="12" /></td>
    <td class="tdder">Ciudad</td>
    <td class="tdizq"><input name="ciudad" type="text"  id="ciudad" value="" size="30" maxlength="30" /></td>
    <td class="tdder">Telefono</td>
    <td class="tdizq"><input name="telefono" type="text"  id="telefono" value="" size="30" maxlength="30" /></td>
</tr>

<tr>
	<td class="tdder">Celular</td>
    <td class="tdizq"><input name="celular" type="text"  id="celular" value="" size="30" maxlength="30" /></td>
    <td class="tdder">Cuenta Nº</td>
    <td class="tdizq"><input name="numero_cuenta" type="text"  id="numero_cuenta" value="" size="20" maxlength="20" /></td>
    <td class="tdder">Banco</td>
    <td class="tdizq"><input name="banco" type="text"  id="banco" value="" size="30" maxlength="30" /></td>
</tr>-->


<tr>
	<td class="tdder">Nombre Padre</td>
    <td class="tdizq" colspan="2"><input name="nom_padre" type="text"  id="nom_padre" value="<?php echo $nompadre ?>" size="40" maxlength="40" / readonly></td>
    <td class="tdder">Nombre Madre</td>
    <td class="tdizq" colspan="2"><input name="nom_madre" type="text"  id="nom_madre" value="<?php echo $nommadre ?>" size="40" maxlength="40" readonly /></td>
</tr>



<tr>
	<td class="tdder">Direccion de Padres</td>
    <td class="tdizq" colspan="2"><input name="dir_padres" type="text"  id="dir_padres" value="<?php echo $direcpadres ?>" size="40" maxlength="40" readonly/></td>
    <td class="tdder">Ciudad</td>
    <td class="tdizq" colspan="2"><input name="ciudad_padres" type="text"  id="ciudad_padres" value="<?php echo $ciudadpadres ?>" size="40" maxlength="40" readonly/></td>
</tr>

<tr>
	<td class="tdder">Telefono Padres</td>
    <td class="tdizq" colspan="2"><input name="tel_padres" type="text"  id="tel_padres" value="<?php echo $telpadres ?>" size="40" maxlength="40" readonly/></td>
    <td class="tdder">Celular Padres</td>
    <td class="tdizq" colspan="2"><input name="cel_padres" type="text"  id="cel_padres" value="<?php echo $celpadres ?>" size="40" maxlength="40"readonly /></td>
</tr>

<tr>
	<td class="tdder" >Referencia <br> COMPA&Ntilde;ERO</td>
    <td class="tdizq" colspan="2"><input name="ref_compa" type="text"  id="ref_compa" value="<?php echo $refcompa ?>" size="40" maxlength="40" readonly/></td>
    <td class="tdder">N&ordm; Celular Compa&ntilde;ero</td>
    <td class="tdizq" colspan="2"><input name="cel_compa" type="text"  id="cel_compa" value="<?php echo $celcompa ?>" size="40" maxlength="40" readonly/></td>
</tr>


<tr>
	<td class="tdder" >N&ordm; CUENTA</td>
    <td class="tdizq" colspan="2"><input name="num_cuenta" type="text"  id="num_cuenta" value="<?php echo $cuenta ?>" size="40" maxlength="40" readonly/></td>
    <td class="tdder">BANCO</td>
    <td class="tdizq" colspan="2"><input name="banco" type="text"  id="banco" value="<?php echo $banco ?>" size="40" maxlength="40" readonly/></td>
</tr>
	  
	  

<tr align="center">
<td colspan="6"></td>
	  </TR>
    </table>
    
    
    
    
    
<table width="800" border="2" cellpadding="1" cellspacing="1" class="sol_cre1">
<tr>
  <td class="fecha" colspan="6">FECHA A REPORTAR</td>
</tr>
<tr>
    <td class="tdd">FECHA A REPORTAR</td>
    <td class="tdi" ><input name="fechareporte" type="text" class="Estilo66" id="fechareporte" value="<?php echo $fecha_reporte ?>" size="20" maxlength="20" /><span class="rojo">YYYY-mm-dd</span></td>
</tr>

<tr>
	<td colspan="2" class="tdc"><textarea name="actuacion" id="actuacion" cols="90" rows="5"></textarea></td>
</tr>

</table>    
    
    
    
    
<p align="center">
<label>
<input name="aprobado" type="submit" class="aprobado" id="aprobado" value="APROBADO"  />&nbsp;&nbsp;
<input name="denegado" type="submit" class="denegado" id="denegado" value="DENEGADO"  />&nbsp;&nbsp;
<!--<input name="pendiente" type="submit" class="pendiente" id="pendiente" value="PENDIENTE"  />-->
<br>

   <br><br>
   <input name="button" type="button" class="boton1" onclick="window.location.href='consulta_cedula_credito_inter_listado.php'" value="Volver">
   <!--<a href="credito_consulta_cartera.php">volver</a>-->
  
      </label>
    </p>

</form>

<form action="" method="post" name="form2">
<p align="center"><input name="imprimir" type="submit" class="imprimir" id="imprimir" value="IMPRIMIR"  /></p>
</form>
</body>
</html>


<?php
$fechast = date("Y-m-d");

if(isset($_POST["aprobado"]))
{
	if($_POST["fechareporte"] < $fechast)
	{
		echo "<script>alert('Escriba una fecha posterior a Reportar');</script>";	
	}
	else
	{
		$gestion = mysql_query('UPDATE credito_rotativo_solicitud SET actuaciones="'.$_POST["actuacion"].'", aprobado = "SI", fecha_aproba = "'.$fechast.'", libranza_credito = "'.$_POST["creditolibranza"].'", fecha_reporte = "'.$_POST["fechareporte"].'", estado = "1"  WHERE cedula = "'.$_GET["ced2"].'" and id = "'.$_GET["id"].'" ');
		if(!$gestion){
			die('Invalid query 1: ' . mysql_error());
		}
		
		
		//reporte
		/*$reporte = mysql_query('UPDATE credito_rotativo_solicitud SET reportada = "NO",  fecha_reporte = "'.$_POST["fechareporte"].'" WHERE cedula = "'.$_GET["ced2"].'" and numerocontrato = "'.$_GET["numcon"].'" ');
		if(!$reporte){
			die('Invalid query reporte: ' . mysql_error());
		}
		
		
		
		
		if($saldo_pendiente != 0)
		{
			$actualice_estado = mysql_query('UPDATE credito_rotativo SET estado = "1" WHERE cedula = "'.$_GET["ced2"].'" and numerocontrato = "'.$_GET["numcon"].'"')	;
			if(!$actualice_estado){
				die('Invalid query actualiza estado: ' . mysql_error());
			}
	
		}
	
		else
		{*/
			if($saldo_pendiente==0)
			{
				echo "<script>alert('SE APROBÓ EL COMPLETO DEL MONTO SOLICITADO');</script>";
				$actualiza_full = mysql_query('UPDATE credito_rotativo SET desembolso_total="SI" WHERE cedula = "'.$_GET["ced2"].'" ');
			}
	/*
	}
	
		/*$actualizafecha = mysql_query('UPDATE credito_rotativo_solicitud set fecha_reporte = "'.$_POST["fechareporte"].'" WHERE cedula = "'.$_GET["ced2"].'" and numerocontrato = "'.$_GET["numcon"].'" ');*/
	
		echo "<script>alert('APROBADO!');</script>";
		echo "<script languaje='javascript' type='text/javascript'>window.location.href = 'consulta_cedula_credito_inter_listado.php';</script>";
	}
	
}	






if(isset($_POST["denegado"]))
{
	$saldo_pendiente = $saldo_pendiente + $ultimoDesembolso;
	$gestion = mysql_query('UPDATE credito_rotativo_solicitud SET actuaciones="'.$_POST["actuacion"].'", aprobado = "NO", fecha_denega = "'.$fechast.'", libranza_credito = "'.$_POST["creditolibranza"].'", fecha_reporte = "'.$_POST["fechareporte"].'", estado = "4"  WHERE cedula = "'.$_GET["ced2"].'"  and id = "'.$_GET["id"].'" ');
	if(!$gestion){
		die('Invalid query DENEGADO: ' . mysql_error());
	}
	
	echo "<script>alert('DENGADO');</script>";
	echo "<script languaje='javascript' type='text/javascript'>window.location.href = 'consulta_cedula_credito_inter_listado.php';</script>";
	
	/*//reporte
	$reporte = mysql_query('UPDATE credito_rotativo_solicitud SET reportada = "NO" WHERE cedula = "'.$_GET["ced2"].'" and numerocontrato = "'.$_GET["numcon"].'" ');
	if(!$reporte){
		die('Invalid query reporte: ' . mysql_error());
	}*/
	
	$actualizarvalores = mysql_query('UPDATE credito_rotativo SET saldo_pendiente =  "'.$saldo_pendiente.'"  WHERE cedula = "'.$_GET["ced2"].'"  ');
	if(!$actualizarvalores){
		die('Invalid query DENEGADO: ' . mysql_error());
	}
}


if(isset($_POST["imprimir"]))
{
	echo "<script languaje='javascript' type='text/javascript'>window.location.href = 'credito_rotativo_formulario_imprimir.php?ced2=$cedula&numcon=$numcon';</script>";
}

?>






<?php
$result = mysql_query('SELECT id, cedula, apellidos, nombres, libranza_credito, numerosolicitud, tipoo, solicitud1, fecha1, desembolso1, actuaciones, aprobado, fecha_aproba, fecha_denega FROM credito_rotativo_solicitud WHERE cedula = "'.$_GET["ced2"].'" ');

if (!$result) {
	die('Error de consulta: ' . mysql_error());
}

if(mysql_num_rows($result) != 0)
{
	echo "<center><table width=750 border=1 cellpadding=1 cellspacing=1>
	<tr>
	<td class='hit' colspan='6'>DESEMBOLSOS SOLICITUDES</td>
	</tr>
	<tr>
	<td width='20' class='tdtitulo'>fecha Solicitud</td>
	<td width='80' class='tdtitulo'>Solicitud Desembolso</td>
    <td width='100' class='tdtitulo'>Fecha Aprobado</td>
	<td width='75' class='tdtitulo'>Fecha Denegado</td>
	<td width='75' class='tdtitulo'>Aprobado</td>
	<td width='75' class='tdtitulo'>Tipo</td>
  	</tr></center>";

   	while(list($id_a,$cedula_a,$nombre_a,$numcon_a,$cred_a,$numerosolicitud_a,$tipoo_a,$solicitud_a,$fechasolicitud_a,$desembolso_a,$actuacion_a,$apro_a,$fecha_a, $fecha_d) = mysql_fetch_row($result))
   	{		
		echo  "<tr class=lista>
		<td class='tdfull'>$fechasolicitud_a</td>
		<td class='tdfull'>$desembolso_a</td>
		<td class='tdfull'>$fecha_a</td>
		<td class='tdfull'>$fecha_d</td>
		<td class='tdfull'>$apro_a</td>
		<td class='tdfull'>$tipoo_a</td>
		</tr>";
   	}
}
?>






<?php	
/////////////////////////////////////////////////////////////////////
$consulta_ciclo = mysql_query('SELECT id, numerosolicitud, desembolso1, fecha_reporte, fecha_transaccion FROM credito_rotativo_solicitud WHERE cedula = "'.$_GET["ced2"].'" and ((estado = "5" || tipoo = "ANTICIPO") or fecha_transaccion ="") ');

echo "<center><table width=750 border=1 cellpadding=1 cellspacing=1>
 	<tr>
	<td class='hitpay' colspan='5'>DESEMBOLSOS REALIZADOS</td>
	</tr>
 	<tr>
    <td class='tdtitulo'>PAGO</td>
	<td class='tdtitulo'>FECHA DE TRANSACCION</td>
    <td class='tdtitulo'>DIAS INTERES</td>
	<td class='tdtitulo'>VALOR</td>
  	</tr></center>";

while(list($id_ciclo, $numero_solicitud_ciclo, $desembolso_ciclo, $fecha_reportar_ciclo, $fecha_transaccion_ciclo)=mysql_fetch_row($consulta_ciclo))
{
	/*if($fecha_transaccion_ciclo =="" )
	{
		echo "<script>alert('EN TRAMITE DESEMBOLSO');</script>";
	}*/
	
	$fechat1 = strtotime($fecha_transaccion_ciclo);
	
	$interes = 0.001;
	$fechar = strtotime($fecha_reportar_ciclo);
	
	$segundos_transcurridos1 = $fechar  - $fechat1;
	$dias_transcurridos1 = round($segundos_transcurridos1 / 86400);
	$valor = ($desembolso_ciclo * $interes) * $dias_transcurridos1;
	
	if($fecha_transaccion_ciclo =="")
	{
		$desembolso_ciclo = 0;
		$dias_transcurridos1 = 0;
		$valor = 0;
	}
	
	printf("<tr>
	<td class='tdfull'>".$desembolso_ciclo."</td>
    <td class='tdfull'>".$fecha_transaccion_ciclo."</td>
	<td class='tdfull'>".$dias_transcurridos1."</td>
	<td class='tdfull'>".$valor."</td>
	");
	
	$capital = $capital + $desembolso_ciclo;
	$valor_final = $valor_final + $valor;
	
	$total = $capital + $valor_final;
	
	//FINAL
	//$valortotal = $total + $valor_anticipo;
	/*
	<tr>
		<td class='tdtitulo' colspan='3'>TOTAL + ANTICIPO</td>
		<td class='tdfull' colspan='1'>$valortotal</td>
		</tr>
	*/
}


echo "<center><table width=750 border=1 cellpadding=1 cellspacing=1>
 		<tr class=lista>
		<td class='tdtitulo'>CAPITAL</td>
		<td class='tdfull'>$capital</td>
		<td class='tdtitulo'>INTERES</td>
		<td class='tdfull'>$valor_final</td>
		</tr>
		<tr>
		<td class='tdtitulo' colspan='1'>TOTAL</td>
		<td class='tdfull' colspan='3'>$total</td>
		</tr>
		";
?>