<?
////////////////////////////////////////////////////
// Conciliación: gestión de conciliación de activos
// Version: 1.0
//
// Copyright (C) 2014  Eustotem Multimedia, S.L.
//
// License: MIT, see LICENSE
////////////////////////////////////////////////////


include("../conf/preferences.php");
session_name(SYS_APP_SESSNAME);
session_start();
include("../conf/langs/".$langs[$_SESSION['userlang']][0]."/backup.php");
include("../conf/connections.php");
include("../phplib/auth.php");
require_once("../phplib/utils.php");
require_once("../core/plugins.php");
require_once("../sanmarko/Amortizacion.class.php");
$amort=new Amortizacion();
$f=mysql_fetch_assoc(mysql_query("SELECT * FROM smk_conciliacion WHERE id=85"));
$metodos=array("","Método lineal","Suma de dígitos del año","Doble cuota");
$eventos=array("","Amortización","Variación de valor por mejoras","Variación vida útil","Amortización anticipada");
$historial=array();
$amort->recordset=$f;
$historial=$amort->initHistorial();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<title><? echo $_SESSION['application']['title'] ?></title>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<link href="../resources/themes/default/common.css" rel="stylesheet" type="text/css" />
	<link href="../resources/themes/default/main.css" rel="stylesheet" type="text/css" />
	<link href="../resources/themes/default/form_screen.css" rel="stylesheet" type="text/css" />
	<link type="text/css" href="../jslib/jq/ui/css/<? echo UI_THEME ?>/jquery-ui.custom.css" rel="stylesheet" />
	<link type="text/css" href="../jslib/jq/ui/css/<? echo UI_THEME ?>/jquery-ui.ekain.css" rel="stylesheet" />
	<script type="text/javascript" src = "../jslib/jq/jquery-1.7.2.min.js" ></script>
	<script type="text/javascript" src = "../jslib/jq/jquery.blockUI.js" ></script>
	<script type="text/javascript" src = "../jslib/jq/ui/js/jquery-ui-1.8.21.custom.min.js" ></script>
	<script type="text/javascript" src = "../jslib/jq/ui/jquery.ui.selectmenu.js" ></script>
	<link type="text/css" href="../jslib/jq/ui/css/<? echo UI_THEME ?>/jquery.ui.selectmenu.css" rel="stylesheet" />
	<script type="text/javascript" src = "../jslib/jq/fancybox/jquery.fancybox-1.3.4.pack.js" ></script>
	<link rel="stylesheet" href="../jslib/jq/fancybox/jquery.fancybox-1.3.4.css" type="text/css" media="screen" />
	
	<script type="text/javascript" src="../jslib/utils.js"></script>
	<script type="text/javascript">
	$(document).ready(function(){
		$('#tabla').tabs();
		$('select').selectmenu();
		$('button, input:submit, input:button, input:reset, .button, .link_button').button();
	});
	</script>
	<style type="text/css">
	.tabladescripcion{
		border:1p solid #666;
		border-collapse:collapse;
		background:#EEE;
		display:inline-block;
		margin-right:30px;
		vertical-align:top;
	}
	.right{text-align:right;}
	.tabladescripcion th, .tabladescripcion td{
		border:1px solid #999;
		padding:4px;
		font-size:12px;
	}
	.tabladescripcion th{
		background-color:#036;
		color:#FFF;
	}
	</style>
</head>

<body bgcolor="#FFFFFF" class="bkg-detail-1">
<div id="pageBar">
	<h1>Unit test de conciliación</h1>
	<div style="position:absolute; right:5px; top:3px;">
	</div>
</div>
<table width="100%" cellpadding="0" cellspacing="0" style="">
<tr>
<td id="panel_central" valign="top">
	<p>Éste es una unit test para probar la clase Amortizacion.class.php. Opera siempre sobre el activo de id 85.</p>
	<div>
		<table class="tabladescripcion" style="width:400px;">
			<tr><th width="150"><strong>Campo</strong></th><th width="250"><strong>Valor</strong></th></tr>
			<tr><td><strong>Descripción:</strong></td><td><? echo $f['descripcion'] ?></td></tr>
			<tr><td><strong>Año capit.:</strong></td><td><? echo $f['anno_capit'] ?></td></tr>
			<tr><td><strong>Mes inicio:</strong></td><td><? echo $f['mes_inicio'] ?></td></tr>
			<tr><td><strong>Periodos cálculo:</strong></td><td><? echo $f['mensual']==1 ? 'Meses' : 'Años' ?></td></tr>
			<tr><td><strong>Valor adquisición:</strong></td><td><? echo number_format($f['val_adq'],2,',','.') ?> €</td></tr>
			<tr><td><strong>Valor residual:</strong></td><td><? echo number_format($f['val_resid'],2,',','.') ?> €</td></tr>
			<tr><td><strong>Vida útil:</strong></td><td><? echo $f['annos_amort'] ?></td></tr>
			<tr><td><strong>Método amortización:</strong></td><td><? echo $metodos[$f['tipo_amort']] ?></td></tr>
			<tr><td><strong>Amort. parcial inciial:</strong></td><td>xxxxxxx</td></tr>
		</table>

		<table width="700" class="tabladescripcion">
			<tr>
				<th width="100"><strong>Periodo</strong></th>
				<th width="200"><strong>Evento</strong></th>
				<th width="100"><strong>Inc. valor</strong></th>
				<th width="100"><strong>Cuota</strong></th>
				<th width="100"><strong>Amort. acumulada</strong></th>
				<th width="100"><strong>Valor contable</strong></th>
			</tr>
			<? foreach($historial as $item){ ?>
			<tr>
				<td><? echo $item['periodonombre'] ?></td>
				<td><? echo $eventos[$item['tipo']] ?></td>
				<td class="right"><? echo number_format($item['incremento'],2,',','.') ?></td>
				<td class="right"><? echo number_format($item['valor'],2,',','.') ?></td>
				<td class="right"><? echo number_format($item['acumulada'],2,',','.') ?></td>
				<td class="right"><? echo number_format($item['contable'],2,',','.') ?></td>
			</tr>
			<? } ?>
		</table>
	</div>
</td>
</tr>
</table>
</body>
</html>
