<?php
	session_start();

	include("auth.inc.php");
	include_once("conn.inc.php");

	$q_inf_liq = "SELECT * FROM liquidacion WHERE id='1'";
	$r_inf_liq = mysql_query($q_inf_liq,$conn);
	$res_inf_liq = mysql_fetch_array($r_inf_liq);

	$query = "SELECT * FROM liquidacion ORDER BY id";
	$r_query = mysql_query($query,$conn);
?>
<div class="liquidacion" id="liquid1">
	<p>Seleccione el tipo de liquidación que le corresponda.</p>
	<fieldset class="d_liquidacion" id="liquidacion" title="Datos de Liquidación" style="text-align:left;">
		<legend>Datos Liquidaci&oacute;n</legend>
		<?php
		while ($res_query = mysql_fetch_array($r_query)) {
			if (isset($_POST["liquid_id"]) && ($_POST["liquid_id"] == $res_query["id"])) {
				$checked = "checked";
			} elseif ($res_query["id"] == "1") {
				$checked = "checked";
			} else {
				$checked = "";
			}
		?>
			<label><?=$res_query["descripcion"]?></label>
			<input type="radio" id="radio<?=$res_query["id"]?>" name="liquidacion" value="<?=$res_query["id"]?>" <?=$checked?> onchange="javascript:infoLiquidacion('<?=$res_query["id"]?>','<?=$res_query["descripcion"]?>','<?=$res_query["aplicable"]?>','<?=$res_query["tipo1"]?>','<?=$res_query["tipo2"]?>','<?=$res_query["documentacion"]?>');">
		<?php
		}
		?>
	</fieldset>
	<div class="tr"><div class="td">&nbsp;</div></div>
	<div class="tr">
		<div class="td">&nbsp;</div>
		<div class="td" style="vertical-align: middle;" align="right">
    		<a href = "javascript:verTiposLiquidacion('0');" class="caja-fina boton" style="width: 400px;">Ver información sobre el tipo de liquidaci&oacute;n seleccionado</a>
    	</div>
    	<div class="td" style="vertical-align: middle;" align="left">
    		<a href = "javascript:checkMatricula();" class="caja-fina boton" style="width: 120px;">Seguir</a>
    	</div>
    	<div class="td">&nbsp;</div>
	</div>
</div>
<div class="liquidacion" id="liquid2">
	<?php

		$_SESSION["liquid_id"] = $res_inf_liq["id"];
		$_SESSION["liquidacion"] = $res_inf_liq["descripcion"];
		$_SESSION["liquid_tip1"] = $res_inf_liq["tipo1"];
		$_SESSION["liquid_tip2"] = $res_inf_liq["tipo2"];

		$liquid_id   = $res_inf_liq["id"];
		$liquid_desc = $res_inf_liq["descripcion"];
		$liquid_apli = $res_inf_liq["aplicable"];
		$liquid_tip1 = $res_inf_liq["tipo1"];
		$liquid_tip2 = $res_inf_liq["tipo2"];
		$liquid_docu = $res_inf_liq["documentacion"];

		if ($_POST["liquid_id"] <> null) {
			$_SESSION["liquid_id"] = $_POST["liquid_id"];
			$_SESSION["liquidacion"] = $_POST["descripcion"];
			$_SESSION["liquid_tip1"] = $_POST["tipo1"];
			$_SESSION["liquid_tip2"] = $_POST["tipo2"];

			$liquid_id   = $_POST["liquid_id"];
			$liquid_desc = $_POST["descripcion"];
			$liquid_apli = $_POST["aplicable"];
			$liquid_tip1 = $_POST["tipo1"];
			$liquid_tip2 = $_POST["tipo2"];
			$liquid_docu = $_POST["documentacion"];
		}
	?>
	<div class="table" style="width:90%;">
		<div class="tr">
			<div class="td cab_tabla">Descripci&oacute;n</div>
			<div class="td cab_tabla">Aplicable</div>
			<div class="td cab_tabla">Exenci&oacute;n</div>
			<div class="td cab_tabla">Documentaci&oacute;n</div>
		</div>
		<div class="tr">
			<div class="td datos_tabla" style="text-align:left;vertical-align: middle;">&nbsp;<?=$liquid_desc?></div>
			<div class="td datos_tabla" style="text-align:left;vertical-align: middle;">&nbsp;<?=$liquid_apli?></div>
			<div class="td datos_tabla" style="text-align:left;vertical-align: middle;">&nbsp;
				<?php
				if ($liquid_tip1 == "0") {

				} else {
					echo "Descuento de un ".$liquid_tip1."% en gastos administrativos.\n";
				}

				if ($liquid_tip2 == "0") {

				} else {
					echo "Descuento de un ".$liquid_tip2."% en gastos académicos.";
				}
				?>
			</div>
			<div class="td datos_tabla" style="text-align:left;vertical-align: middle;">&nbsp;<?=$liquid_docu?></div>
		</div>
	</div>
	<div class="tr"><div class="td">&nbsp;</div></div>
	<div class="tr">
		<div class="td">&nbsp;</div>
		<div class="td" style="vertical-align: middle;" align="left">
    		<a href = "javascript:verTiposLiquidacion('1');" class="caja-fina boton" style="width: 250px;">Selección de tipo de liquidación</a>
    	</div>
    	<div class="td" style="vertical-align: middle;" align="left">
    		<a href = "javascript:checkMatricula();" class="caja-fina boton" style="width: 120px;">Seguir</a>
    	</div>
    	<div class="td">&nbsp;</div>
	</div>
</div>