<?php
	session_start();
	//////////////////////////////////////////////         SEGURIDAD               /////////////////////////////////////////////
	if(!array_key_exists("la_logusr",$_SESSION))
	{
		print "<script language=JavaScript>";
		print "location.href='../sigesp_inicio_sesion.php'";
		print "</script>";		
	}
	$ls_logusr=$_SESSION["la_logusr"];
	require_once("class_funciones_activos.php");
	$ls_codemp=$_SESSION["la_empresa"]["codemp"];
	$io_fun_activo=new class_funciones_activos();
	$io_fun_activo->uf_load_seguridad("SAF","sigesp_saf_d_configuracion.php",$ls_permisos,$la_seguridad,$la_permisos);
	require_once("sigesp_saf_c_activo.php");
    $io_saf_tipcat= new sigesp_saf_c_activo();
    $ls_rbtipocat= $io_saf_tipcat->uf_select_valor_config($ls_codemp);
	//////////////////////////////////////////////         SEGURIDAD               /////////////////////////////////////////////

   function uf_limpiarvariables()
   {
		//////////////////////////////////////////////////////////////////////////////
		//	Function:  uf_limpiarvariables
		//	Description: Función que limpia todas las variables necesarias en la página
		//////////////////////////////////////////////////////////////////////////////
   		global $ls_rbcsc,$ls_rbcgr,$ls_disabled;
		
		$ls_rbcsc="";
		$ls_rbcgr="";
		$ls_disabled="";
   }
?>
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Configuraci&oacute;n</title>
<script type="text/javascript" language="JavaScript1.2" src="shared/js/disabled_keys.js"></script>
<script type="text/javascript" language="JavaScript1.2" src="../shared/js/valida_tecla.js"></script>
<title >Definici&oacute;n de Activos</title>
<meta http-equiv="imagetoolbar" content="no"> 
<style type="text/css">
<!--
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
	background-color: #EFEBEF;
}

a:link {
	color: #006699;
}
a:visited {
	color: #006699;
}
a:active {
	color: #006699;
}

-->
</style>
<link href="../shared/css/general.css" rel="stylesheet" type="text/css">
<link href="../shared/css/ventanas.css" rel="stylesheet" type="text/css">
<link href="../shared/css/tablas.css" rel="stylesheet" type="text/css">
<link href="../shared/css/cabecera.css" rel="stylesheet" type="text/css">
</head>
<body>
<table width="700" border="0" align="center" cellpadding="0" cellspacing="0" class="contorno">
  <tr>
    <td width="780" height="30" colspan="11" class="cd-logo"><img src="../shared/imagebank/header.jpg" width="778" height="40"></td>
  </tr>
  <tr>
    <td width="432" height="20" colspan="11" bgcolor="#E7E7E7">
		<table width="762" border="0" align="center" cellpadding="0" cellspacing="0">
			  <td width="432" height="20" bgcolor="#E7E7E7" class="descripcion_sistema">Sistema de Activos Fijos</td>
			    <td width="346" bgcolor="#E7E7E7"><div align="right"><span class="letras-pequenas"><b><?PHP print date("j/n/Y")." - ".date("h:i a");?></b></span></div></td>
				<tr>
	  	      <td height="20" bgcolor="#E7E7E7" class="descripcion_sistema">&nbsp;</td>
	  	      <td bgcolor="#E7E7E7" class="letras-pequenas"><div align="right"><b><?PHP print $_SESSION["la_nomusu"]." ".$_SESSION["la_apeusu"];?></b></div></td> </tr>
	  	</table>
	 </td>
  </tr>
 
  <tr>
    <td height="13" colspan="11" bgcolor="#E7E7E7" class="toolbar">&nbsp;</td>
  </tr>
  <tr>
    <td class="toolbar" width="22"><div align="center"><a href="javascript: ue_guardar();" ><img src="../shared/imagebank/tools20/grabar.gif" alt="Grabar" title="Guardar" width="20" height="20" border="0"></a></div></td>
    <td class="toolbar" width="22"><div align="center"><a href="javascript: ue_cerrar();"><img src="../shared/imagebank/tools20/salir.gif" alt="Salir" width="20" height="20" border="0" title="Salir"></a></div></td>
    <td class="toolbar" width="22"><div align="center"><img src="../shared/imagebank/tools20/ayuda.gif" alt="Ayuda" width="20" height="20" title="Ayuda"></div></td>
    <td class="toolbar" width="22">&nbsp;</td>
    <td class="toolbar" width="640">&nbsp;</td>
  </tr>
</table>
<p>
  <?php
	require_once("sigesp_saf_c_activo.php");
	require_once("../shared/class_folder/class_mensajes.php");
	$io_saf=  new sigesp_saf_c_activo();
	$io_msg=  new class_mensajes();
	
	function Guardar(){
		
		global $io_saf;
		
		$io_saf->io_sql->begin_transaction();	
		
		$resp = $io_saf->GuardarCfg("SAF", "CATEGORIA", "TIPO-CATEGORIA-CSG-CGR", "C", $_POST["selnorm"]);
		if($resp===false){$io_saf->io_sql->rollback(); return false;}	
		$resp = $io_saf->GuardarCfg("SAF", "DEPRECIACION", "AFECTACION_DEPRECIACION", "C", $_POST["selafec"]);
		if($resp===false){$io_saf->io_sql->rollback(); return false;}
		$resp = $io_saf->GuardarCfg("SAF", "DEPRECIACION", "MODIFICACION_INCORPORACION", "C", $_POST["selfeinc"]);
		if($resp===false){$io_saf->io_sql->rollback(); return false;}
		
		$io_saf->io_msg->message("La configuración se guardó con éxito !"); 
		$io_saf->io_sql->commit();		
	}
	
	if($_POST["operacion"]=='GUARDAR'){Guardar();}
	
	$io_saf->normativa = $io_saf->ObtCfg("SAF","CATEGORIA","TIPO-CATEGORIA-CSG-CGR");
	$io_saf->afectacion = $io_saf->ObtCfg("SAF","DEPRECIACION","AFECTACION_DEPRECIACION");
	$io_saf->fecincauto = $io_saf->ObtCfg("SAF","DEPRECIACION","MODIFICACION_INCORPORACION");
	
	
?>
</p>
<p>&nbsp;</p>
<form id="form1" name="form1" method="post" action="">
         <?php
//////////////////////////////////////////////         SEGURIDAD               /////////////////////////////////////////////
	$io_fun_activo->uf_print_permisos($ls_permisos,$la_permisos,$ls_logusr,"location.href='sigespwindow_blank.php'");
	unset($io_fun_activo);
//////////////////////////////////////////////         SEGURIDAD               /////////////////////////////////////////////
?>


  <table width="628" border="0" align="center" class="formato-blanco">
    <tr>
      <td colspan="2" class="titulo-ventana"align="center">Configuraci&oacute;n
        <input name="operacion" type="hidden" id="operacion" value="<?php  print $ls_operacion; ?>" />      </td>
    </tr>
    <tr>
      <td width="302" height="16" align="right"><strong>Normativa de Activos Fijos:</strong></td>
      <td width="314"><label>
        <select name="selnorm" id="selnorm">
          <option value="1" <?php if($io_saf->normativa=='1' or !$io_saf->normativa){echo 'selected';} ?>>Manual SIGECOF</option>
          <option value="2" <?php if($io_saf->normativa=='2'){echo 'selected';} ?>>Publicaciones CGR</option>
        </select>
      </label></td>
    </tr>
    <tr>
      <td colspan="2">&nbsp;</td>
    </tr>
    <tr>
      <td align="right"><strong>Afectaci&oacute;n de la Depreciaci&oacute;n:</strong></td>
      <td><strong>
        <select name="selafec" id="selafec">
          <option value="P" <?php if($io_saf->afectacion=='P' or !$io_saf->afectacion){echo 'selected';} ?>>Presupuestaria</option>
          <option value="C" <?php if($io_saf->afectacion=='C'){echo 'selected';} ?>>Contable</option>
        </select>
      </strong></td>
    </tr>
    <tr>
      <td colspan="2">&nbsp;</td>
    </tr>
    <tr>
      <td align="right"><strong>Fecha de Incorporaci&oacute;n Automatica (SUDEBAN): </strong></td>
      <td><strong>
        <select name="selfeinc" id="selfeinc">
          <option value="1" <?php if($io_saf->fecincauto=='1' or !$io_saf->fecincauto){echo 'selected';} ?>>Sí</option>
          <option value="0" <?php if($io_saf->fecincauto=='0'){echo 'selected';} ?>>No</option>
        </select>
      </strong></td>
    </tr>
  </table>
 
</form>
<p>&nbsp;</p>
</body>
<script language="javascript">

function ue_guardar()
{
	f=document.form1;
	f.operacion.value ="GUARDAR";
    f.action="sigesp_saf_d_configuracion.php";
    f.submit();
}

function ue_cerrar()
{
	close();
}
</script>
</html>
