<?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");
	require_once("../shared/class_folder/class_mensajes.php");
	$io_mensaje= new class_mensajes();
	$io_fun_activo=new class_funciones_activos();
	$io_fun_activo->uf_load_seguridad("SAF","sigesp_saf_d_activos.php",$ls_permisos,$la_seguridad,$la_permisos);
	require_once("sigesp_saf_c_activo.php");
    $ls_codemp = $_SESSION["la_empresa"]["codemp"];
    $io_saf_tipcat= new sigesp_saf_c_activo();
    $ls_rbtipocat=$io_saf_tipcat->uf_select_valor_config($ls_codemp);
	$_SESSION['disable_trans']=0;
	if(!$ls_rbtipocat)
	{
	 $io_mensaje->message("No se puede registrar ningun Activo, sin definir la configuración!!!");
	 print "<script language=JavaScript>";
	 print('if(opener!=null){close();}else{window.location="sigespwindow_blank.php";}');
	 print "</script>";
	}
	
	//////////////////////////////////////////////         SEGURIDAD               /////////////////////////////////////////////
   //--------------------------------------------------------------
   function uf_limpiarvariables()
   {
		/////////////////////////////////////////////////////////////////////////////////
		//	Function:  uf_limpiarvariables
		//	Description: Función que limpia todas las variables necesarias en la página
		/////////////////////////////////////////////////////////////////////////////////
   		global $ls_codact,$ld_fecregact,$ls_denact,$ls_maract,$ls_modact,$ld_feccmpact,$li_cosact,$ls_codconbie,$ls_codpai,$ls_codest;
		global $ls_codmun,$ls_nomarch,$ls_tiparch,$ls_tamarch,$ls_radiotipo,$ls_obsact,$ls_catalogo,$ls_numordcom,$ls_codpro;
		global $ls_monord,$ls_foto,$ls_statusact,$ls_denconbie,$ls_despai,$ls_desest,$ls_desmun,$ls_dencatsig,$ls_spgcuenta;
		global $ls_codfuefin,$ls_denfuefin,$ls_codsitcon,$ls_codconcom,$ls_densitcon,$ls_denconcom,$ls_codpro,$ls_denpro,$ld_fecordcom,$li_monord;
		global $ls_numsolpag,$ld_fecemisol,$ls_chkchecked,$ls_chkmueble,$ls_chkinmueble,$ls_chksemoviente,$ls_rbcsc,$ls_rbcgr;
		global $ls_codgru,$ls_codsubgru,$ls_codsec,$ls_codsudeban,$ls_codite,$ls_rbtipocat, $ls_clasif, $ls_titulo, $ls_estbt,$ls_mostrar_inm;
		
		$ls_codfuefin="";
		$ls_denfuefin="";
		$ls_codsitcon="";
		$ls_densitcon="";
		$ls_codconcom="";
		$ls_denconcom="";
		$ls_numordcom="";
		$ls_codpro="";
		$ls_denpro="";
		$ld_fecordcom="";
		$li_monord="";
		$ls_numsolpag="";
		$ld_fecemisol="";
		$ls_foto="blanco.jpg";
		$ls_codact="";
		$ld_fecregact=date('d/m/Y');
		$ls_denact="";
		$ls_maract="";
		$ls_modact="";
		$ld_feccmpact="";
		$li_cosact="0,00";
		$ls_codconbie="";
		$ls_denconbie="";
		$ls_codpai="";
		$ls_despai="";
		$ls_codest="";
		$ls_desest="";
		$ls_codmun="";
		$ls_desmun="";
		$ls_nomarch =""; 
		$ls_tiparch ="";
		$ls_tamarch =""; 
		$ls_radiotipo=""; 
		$ls_obsact=""; 
		$ls_catalogo=""; 
		$ls_dencatsig="";
		$ls_spgcuenta="";
		$ls_codpro=""; 
		$li_monord="0,00"; 
		$ls_statusact=""; 
		$ls_chkchecked="checked";
		$ls_chkmueble="";
		$ls_chkinmueble="";
		$ls_chksemoviente="";
		$ls_rbcsc="";
		$ls_rbcgr="";
		$ls_codgru="";
		$ls_codsubgru="";
		$ls_codsec="";
		$ls_codsudeban="";
		$ls_codite="";
		$ls_rbtipocat="";
		$ls_mostrar_csc = "";
		$ls_mostrar_cgr = "";
		$ls_clasif="";
		$ls_mostrar_inm = 'style="display:none"';
		$ls_titulo="";
		$ls_estbt= 'style="display:none"';	
		$denominacion = "";
   }
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<script type="text/javascript" language="JavaScript1.2" src="../shared/js/disabled_keys.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>
<script type="text/javascript" language="JavaScript1.2" src="js/funciones.js"></script>
<script type="text/javascript" language="JavaScript1.2" src="../shared/js/valida_tecla.js"></script>
<link href="../shared/css/tablas.css" rel="stylesheet" type="text/css">
<link href="../shared/css/ventanas.css" rel="stylesheet" type="text/css">
<link href="../shared/css/cabecera.css" rel="stylesheet" type="text/css">
<link href="../shared/css/general.css" rel="stylesheet" type="text/css">
<link href="../shared/js/css_intra/datepickercontrol.css" rel="stylesheet" type="text/css">

<script src="../base/librerias/js/jquery/jquery.js" type="text/javascript"></script>
<script src="../base/librerias/js/jquery/jquery.ui.draggable.js" type="text/javascript"></script>
<script src="../base/librerias/js/jquery/jquery.alerts.js" type="text/javascript"></script>
<link href="../base/librerias/js/jquery/jquery.alerts.css" rel="stylesheet" type="text/css" media="screen" />
<link href="../shared/js/css_intra/datepickercontrol.css" rel="stylesheet" type="text/css">
<script type="text/javascript" language="JavaScript1.2" src="../shared/js/librerias_comunes_covensol.js"></script>
<script type="text/javascript" language="JavaScript1.2" src="../shared/js/number_format.js"></script>
<script language="JavaScript" type="text/JavaScript" src="../shared/js/js_ajax.js"></script>
<script language="JavaScript" src="../shared/js/sigesp_js.js"></script>

</head>

<body>
<table width="762" 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 height="20" width="22" class="toolbar"><div align="center"><a href="javascript: ue_nuevo();"><img src="../shared/imagebank/tools20/nuevo.gif" alt="Nuevo" width="20" title="Nuevo" height="20" border="0"></a></div></td>
    <td class="toolbar" width="22"><div align="center"><a href="javascript: ue_guardar();"><img src="../shared/imagebank/tools20/grabar.gif" alt="Grabar"  width="20" title="Guardar" height="20" border="0"></a></div></td>
    <td class="toolbar" width="22"><div align="center"><a href="javascript: ue_buscar();"><img src="../shared/imagebank/tools20/buscar.gif" alt="Buscar" width="20"  height="20" title="Buscar" border="0"></a></div></td>
    <td class="toolbar" width="22"><div align="center"><a href="javascript: ue_eliminar();"><img src="../shared/imagebank/tools20/eliminar.gif" alt="Eliminar" width="20" height="20" title="Eliminar" 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" title="Salir" border="0"></a></div></td>
    <td class="toolbar" width="22"><div align="center"><img src="../shared/imagebank/tools20/ayuda.gif" alt="Ayuda" title="Ayuda" width="20" height="20"></div></td>
    <td class="toolbar" width="22"><div align="center"></div></td>
    <td class="toolbar" width="640">&nbsp;</td>
  </tr>
</table>
<?php
	require_once("../shared/class_folder/sigesp_include.php");
	$in=     new sigesp_include();
	$con= $in->uf_conectar();
	require_once("../shared/class_folder/class_mensajes.php");
	$io_msg= new class_mensajes();
	require_once("sigesp_saf_c_activo.php");
	$io_saf= new sigesp_saf_c_activo();
	require_once("../shared/class_folder/class_funciones.php");
	$io_fun= new class_funciones();
	require_once("../shared/class_folder/class_funciones_db.php");
	$io_fundb= new class_funciones_db($con);
	require_once("class_funciones_activos.php");
	$io_fac= new class_funciones_activos("../");
	$ls_codemp=$_SESSION["la_empresa"]["codemp"];
	
	$io_saf->uf_load_config("SAF","DEPRECIACION","MODIFICACION_INCORPORACION",$ls_estsudeban);
	if (array_key_exists("operacionact",$_POST))
	{
		$ls_operacion=$_POST["operacionact"];	
	}
	else
	{
		$ls_operacion="";
		uf_limpiarvariables();
		$ls_mostrar_inm = 'style="display:none"';
		$ls_edit="";
		$depreciacion="";
		$ls_rbtipocat=$io_saf->uf_select_valor_config($ls_codemp);
		$ls_mostrar_csc = "";
		$ls_mostrar_cgr =  "";
		switch ($ls_rbtipocat) 
		{
			case '0':
		        uf_limpiarvariables();
			break;
			
			case '1':
				 $ls_rbcsc="checked";
				 $ls_disabled="disabled";
				 $ls_mostrar_csc = "";
				 $ls_mostrar_cgr = 'style="display:none"';
			break;
			
			case '2':
				$ls_rbcgr="checked";
				$ls_disabled="disabled";
				$ls_mostrar_csc = 'style="display:none"';
				$ls_mostrar_cgr = "";
			break;
		}
	}
	
	
	function CargarDatos(){
	
		global $ls_codact,$ld_fecregact,$ls_denact,$ls_maract,$ls_modact,$ld_feccmpact,$li_cosact,$ls_codconbie,$ls_codpai,$ls_codest;
		global $ls_codmun,$ls_nomarch,$ls_tiparch,$ls_tamarch,$ls_radiotipo,$ls_obsact,$ls_catalogo,$ls_numordcom,$ls_codpro;
		global $ls_monord,$ls_foto,$ls_statusact,$ls_denconbie,$ls_despai,$ls_desest,$ls_desmun,$ls_dencatsig,$ls_spgcuenta;
		global $ls_codfuefin,$ls_denfuefin,$ls_codsitcon,$ls_codconcom,$ls_densitcon,$ls_denconcom,$ls_codpro,$ls_denpro,$ld_fecordcom,$li_monord;
		global $ls_numsolpag,$ld_fecemisol,$ls_chkchecked,$ls_chkmueble,$ls_chkinmueble,$ls_chksemoviente,$ls_rbcsc,$ls_rbcgr;
		global $ls_codgru,$ls_codsubgru,$ls_codsec,$ls_codsudeban,$ls_codite,$ls_rbtipocat, $ls_clasif, $ls_titulo, $ls_estbt,$ls_mostrar_inm;
		global $io_fun,$io_fac,$io_saf,$ls_radiotipo,$ls_mostrar_inm,$depreciacion,$ls_estbt,$ls_chkinmueble,$ls_clasif,$ls_tipspg;
		global $ls_chkchecked,$ls_edit,$ls_nomfot,$ls_tipfot,$ls_tamfot,$ls_nomtemfot,$ls_rbcsc,$ls_rbtipocat,$ls_rbcgr,$ls_mostrar_csc,$ls_mostrar_cgr;
		global $ls_codgru,$ls_codsubgru,$ls_codsec,$ls_codsudeban,$li_cosactaux,$li_monordaux,$ld_fecregactaux,$ld_feccmpactaux,$ld_fecordcomaux,$ld_fecemisolaux;
		global $ls_codsudeban,$ls_catalogo,$txtdenominacion,$ls_clasif,$ls_estdepact,$ls_estdepact;
		
		uf_limpiarvariables(); 
		$ls_codact=$io_fac->uf_obtenervalor("txtcodact","");
		$ls_denact=$io_fac->uf_obtenervalor("txtdenact","");
		$ld_fecregact=$io_fac->uf_obtenervalor("txtfecregact","");
		$ls_maract=$io_fac->uf_obtenervalor("txtmaract","");
		$ls_modact=$io_fac->uf_obtenervalor("txtmodact","");
		$ld_feccmpact=$io_fac->uf_obtenervalor("txtfeccmpact","");
		$li_cosact=$io_fac->uf_obtenervalor("txtcosact","");
		$ls_codconbie=$io_fac->uf_obtenervalor("txtcodconbie","");
		if($ls_codconbie==""){$ls_codconbie="02";}
		$ls_denconbie=$io_fac->uf_obtenervalor("txtdenconbie","");
		if($ls_denconbie==""){$ls_denconbie="Bueno";}
		$ls_codpai=$io_fac->uf_obtenervalor("txtcodpai","");
		$ls_despai=$io_fac->uf_obtenervalor("txtdespai","");
		$ls_codest=$io_fac->uf_obtenervalor("txtcodest","");
		$ls_desest=$io_fac->uf_obtenervalor("txtdesest","");
		$ls_codmun=$io_fac->uf_obtenervalor("txtcodmun","");
		$ls_desmun=$io_fac->uf_obtenervalor("txtdesmun","");
		$ls_obsact=$io_fac->uf_obtenervalor("txtobsact","");
		$ls_catalogo=$io_fac->uf_obtenervalor("txtcatalogo","");
		$ls_dencatsig=$io_fac->uf_obtenervalor("txtdencat","");
		$ls_spgcuenta=$io_fac->uf_obtenervalor("txtcuenta","");
		$ls_codfuefin=$io_fac->uf_obtenervalor("txtcodfuefin","");
		$ls_denfuefin=$io_fac->uf_obtenervalor("txtdenfuefin","");
		$ls_codsitcon=$io_fac->uf_obtenervalor("txtcodsitcon","");
		$ls_densitcon=$io_fac->uf_obtenervalor("txtdensitcon","");
		$ls_codconcom=$io_fac->uf_obtenervalor("txtcodconcom","");
		$ls_denconcom=$io_fac->uf_obtenervalor("txtdenconcom","");
		$ls_numordcom=$io_fac->uf_obtenervalor("txtnumord","");
		$ls_codpro=$io_fac->uf_obtenervalor("txtcodpro","");
		$ls_denpro=$io_fac->uf_obtenervalor("txtdenpro","");
		$ld_fecordcom=$io_fac->uf_obtenervalor("txtfecordcom","");
		$li_monord=$io_fac->uf_obtenervalor("txtmonord","");
		$ls_numsolpag=$io_fac->uf_obtenervalor("txtnumsolpag","");
		$ld_fecemisol=$io_fac->uf_obtenervalor("txtfecemisol","");
		$ls_statusact=$io_fac->uf_obtenervalor("hidstatusact","");
		$ls_estdepact=$io_fac->uf_obtenervalor("chkdepreciable","0");
		$ls_clasif=$io_fac->uf_obtenervalor("cmbclasi","0");
		$ls_radiobt=$io_fac->uf_obtenervalor("radiotipo","0");
		$txtdenominacion=$io_fac->uf_obtenervalor("txtdenominacion","");
		
		$io_saf->codforadq = $_POST['cmbforadq'];
		$io_saf->codestuso = $_POST['cmbestuso'];
		$io_saf->codcolor = $_POST['cmbcolor'];					
		$io_saf->codusoedi = $_POST['cmbusoedi'];
		$io_saf->codaseg = $_POST['cmbaseg'];
		$io_saf->codtipcob = $_POST['cmbtipcob'];
		$io_saf->codtiplug = $_POST['cmbtiplug'];
		$io_saf->codcatuni = $_POST['cmbcatuni'];
		$io_saf->comp = $_POST['chkcomp']?'1':'0';			
		$io_saf->tienecomp = $_POST['tienecomp']?'1':'0';			
		$io_saf->tiempogaran = $_POST['tiempogaran'];
		$io_saf->codunimedgar = $_POST['cmbunimedgar'];
		$io_saf->esptec = $_POST['esptec'];
		$io_saf->otrasesp = $_POST['otrasesp'];
		$io_saf->esvehiculo = $_POST['esvehiculo']?'1':'0';
		$io_saf->codmarca = $_POST['cmbmarca'];
		$io_saf->codmodelo = $_POST['cmbmodelo'];
		
		
		//VEHÍCULOS
		$io_saf->codtipveh = $_POST['cmbtipveh'];				
		$io_saf->serialcar = $_POST['serialcar'];
		$io_saf->serialmot = $_POST['serialmot'];
		$io_saf->sigplaca = $_POST['sigplaca'];
		$io_saf->nrotitprop = $_POST['nrotitprop'];
		$io_saf->capacidad = $_POST['capacidad'];	
		$io_saf->codunimedcap = $_POST['cmbunimedcap'];		
		$io_saf->sisrastreo = $_POST['sisrastreo']?'1':'0';
		$io_saf->espsisrast = $_POST['espsisrast'];			
		$io_saf->anofabveh = $_POST['anofabveh'];			
		
		//SEMOVIENTES
		$io_saf->codtipani = $_POST['cmbtipani'];
		$io_saf->codprosem = $_POST['cmbprosem'];
		$io_saf->codraza = $_POST['cmbraza'];
		$io_saf->codgenero = $_POST['cmbgenero'];
		$io_saf->peso = $_POST['peso'];
		$io_saf->codunimedpeso = $_POST['cmbunimedpeso'];			
		$io_saf->nrohierro = $_POST['nrohierro'];
		$io_saf->senas = $_POST['senas'];
		$io_saf->fecnacsem = $_POST['fecnacsem'];
					
		//INMUEBLES
		$io_saf->urbaniza = $_POST['urbaniza'];
		$io_saf->calleave = $_POST['calleave'];
		$io_saf->casaedif = $_POST['casaedif'];			
		$io_saf->oficregistro = $_POST['oficregistro'];
		$io_saf->refregistro = $_POST['refregistro'];
		$io_saf->tomo = $_POST['tomo'];
		$io_saf->folio = $_POST['folio'];
		$io_saf->protocoloreg = $_POST['protocoloreg'];
		$io_saf->nroregistro = $_POST['nroregistro'];
		$io_saf->fecregistro = $_POST['fecregistro'];
		$io_saf->propanterior = $_POST['propanterior'];
		$io_saf->areaconst = $_POST['areaconst'];
		$io_saf->codunimedarea = $_POST['cmbunimedarea'];
		
		//DATOS DE ORIGEN DE LA ADQUISICIÓN
		$io_saf->ori_codori = $_POST['ori_codori'];
		$io_saf->codori = $_POST['ori_codori'];
		$io_saf->ori_codforadq = $_POST['cmbforadq'];
		$io_saf->ori_claforadq = $_POST['ori_claforadq'];
		$io_saf->ori_denconc = $_POST['ori_denconc'];
		$io_saf->ori_nroconc = $_POST['ori_nroconc'];
		$io_saf->ori_fecconc = $_POST['ori_fecconc'];
		$io_saf->ori_codprov = $_POST['ori_codprov'];
		$io_saf->ori_nrocontconc = $_POST['ori_nrocontconc'];
		$io_saf->ori_feccontconc = $_POST['ori_feccontconc'];
		$io_saf->ori_nronotentconc = $_POST['ori_nronotentconc'];
		$io_saf->ori_fecnotentconc = $_POST['ori_fecnotentconc'];
		$io_saf->ori_nrofact = $_POST['ori_nrofact'];
		$io_saf->ori_fecfact = $_POST['ori_fecfact'];
		$io_saf->ori_numordcomp = $_POST['ori_numordcomp'];
		$io_saf->ori_fecordcomp = $_POST['ori_fecordcomp'];
		$io_saf->ori_nompropant = $_POST['ori_nompropant'];
		$io_saf->ori_nomben = $_POST['ori_nomben'];
		$io_saf->ori_nomautor = $_POST['ori_nomautor'];
		$io_saf->ori_nrosentactcont = $_POST['ori_nrosentactcont'];
		$io_saf->ori_fecsentactcont = $_POST['ori_fecsentactcont'];
		$io_saf->ori_nomreg = $_POST['ori_nomreg'];
		$io_saf->ori_tomo = $_POST['ori_tomo'];
		$io_saf->ori_folio = $_POST['ori_folio'];
		$io_saf->ori_fecreg = $_POST['ori_fecreg'];
		$io_saf->ori_nomceddac = $_POST['ori_nomceddac'];
		$io_saf->ori_nomdon = $_POST['ori_nomdon'];
		$io_saf->ori_nomcopper = $_POST['ori_nomcopper']; 
		$io_saf->ori_nomlicit = $_POST['ori_nomlicit'];
		$io_saf->ori_nrolict = $_POST['ori_nrolict'];
		$io_saf->ori_feclicit = $_POST['ori_feclicit'];
		$io_saf->ori_nompertrans = $_POST['ori_nompertrans'];
		$io_saf->ori_nombenrecibtrans = $_POST['ori_nombenrecibtrans'];
		
		
		
		
		switch ($ls_radiobt) 
		{
			case 1:
				$ls_radiotipo="1";
				$ls_chkmueble="checked";
				$ls_mostrar_inm = 'style="display:none"';
				$depreciacion="";
				$ls_estbt= 'style="display:none"';	
			break;
			case 2:
				$ls_radiotipo="2";
				$ls_chkinmueble="checked";
				$ls_mostrar_inm = 'style="display:compact"';
				if ($ls_clasif==3)
				{
					$depreciacion="disabled";														
				}
				if ($ls_clasif==2)
				{
					$ls_titulo="Instalaciones Fijas";
				}
				elseif ($ls_clasif==1)
				{
					$ls_titulo="Edificios";
				}elseif ($ls_clasif==3)
				{
					$ls_titulo="Terrenos";
				}
				$ls_estbt= 'style="display:compact"';
			break;
			case 3:
				$ls_radiotipo="3";
				$ls_chksemoviente="checked";
				$ls_mostrar_inm = 'style="display:none"';
				$depreciacion="";	
				$ls_estbt= 'style="display:none"';
			break;
		} 
		$ls_tipspg = 0;
		if($ls_estdepact==1)
		{
		  $ls_chkchecked="checked";
		  $ls_edit="";
		}
		else
		{ 
			$ls_chkchecked="";
			$ls_edit="disabled";
		}
		
		
		$ls_nomfot=$_FILES['txtfotact']['name']; 
		if ($ls_nomfot!="")
		{
			$ls_nomfot=$ls_codact.substr($ls_nomfot,strrpos($ls_nomfot,"."));
		}
		$ls_tipfot=$_FILES['txtfotact']['type']; 
		$ls_tamfot=$_FILES['txtfotact']['size']; 
		$ls_nomtemfot=$_FILES['txtfotact']['tmp_name'];
		
		$ls_rbtipocat=$io_fac->uf_obtenervalor("hidrbtipocat","");
		switch ($ls_rbtipocat) 
		{
			case '1':
				 $ls_rbtipocat="1";
				 $ls_rbcsc="checked";
				 $ls_mostrar_csc = "";
				 $ls_mostrar_cgr = 'style="display:none"';
			break;
			
			case '2':
				$ls_rbtipocat="2";
				$ls_rbcgr="checked";
				$ls_mostrar_csc = 'style="display:none"';
				$ls_mostrar_cgr = "";
			break;
		}
		$ls_codgru=$io_fac->uf_obtenervalor("txtcodgru","");
		$ls_codsubgru=$io_fac->uf_obtenervalor("txtcodsubgru","");
		$ls_codsec=$io_fac->uf_obtenervalor("txtcodsec","");
		$ls_codite=$io_fac->uf_obtenervalor("txtcodite","");
		$ls_codsudeban=$io_fac->uf_obtenervalor("txtcodsudeban","");
		$li_cosactaux=str_replace(".","",$li_cosact);
		$li_cosactaux=str_replace(",",".",$li_cosactaux);
		$li_monordaux=str_replace(".","",$li_monord);
		$li_monordaux=str_replace(",",".",$li_monordaux); 
		$ld_fecregactaux=$io_fun->uf_convertirdatetobd($ld_fecregact);
		$ld_feccmpactaux=$io_fun->uf_convertirdatetobd($ld_feccmpact);
		$ld_fecordcomaux=$io_fun->uf_convertirdatetobd($ld_fecordcom);
		$ld_fecemisolaux=$io_fun->uf_convertirdatetobd($ld_fecemisol);
		
		if($ls_codsudeban!="" and $ls_codsudeban!="-----")
		{
		   $ls_catalogo="---------------";
		}
			
	
	}
	
	switch ($ls_operacion) 
	{
		
		case "BUSCAR":
			CargarDatos();
			$dato['codact'] = $ls_codact;
			$io_saf->ObtenerDatosActivo($dato);
			$io_saf->FormatDatosPresentActivos($dato);
			break;
		
		case "NUEVO":
			uf_limpiarvariables();				
			$ls_emp=true;
			$ls_edit = "";
			$ls_tabla="saf_activo";
			$ls_columna="codact";
			$depreciacion="";
			$ls_codact=$io_fundb->uf_generar_codigo($ls_emp,$ls_codemp,$ls_tabla,$ls_columna);
			$ls_rbtipocat=$io_saf->uf_select_valor_config($ls_codemp);
			switch ($ls_rbtipocat) 
			{
				case '0':
					uf_limpiarvariables();
				break;
				
				case '1':
					 $ls_rbcsc="checked";
					 $ls_disabled="disabled";
					 $ls_mostrar_csc = "";
				     $ls_mostrar_cgr = 'style="display:none"';
				break;
				
				case '2':
					$ls_rbcgr="checked";
					$ls_disabled="disabled";
					$ls_mostrar_csc = 'style="display:none"';
				    $ls_mostrar_cgr = "";
				break;
			}
		break;
		
		case "GUARDAR":
			
			CargarDatos();
			
			if($ls_rbtipocat=="1")
			{
				if(($ls_codact=="")||($ld_fecregact=="")||($ls_denact=="")||($ld_feccmpact=="")||($li_cosact=="")||
				   ($ls_catalogo=="")||($ls_spgcuenta==""))
				{
					$io_msg->message("Faltan campos por llenar");
				}
				else
				{
					$lb_valido=$io_saf->uf_saf_select_cuentaspg($ls_codemp,$ls_spgcuenta,$ls_tipspg);
					$lb_valido=true;
					if($lb_valido)
					{
						if($ls_statusact=="")
						{
							$lb_encontrado=$io_saf->uf_saf_select_activo($ls_codemp,$ls_codact);
							if(!$lb_encontrado)
							{
								$lb_valido=$io_saf->uf_saf_insert_activo($ls_codemp,$ld_fecregactaux,$ls_codact,$ls_denact,$ls_maract,$ls_modact,
																		 $ld_feccmpactaux,$li_cosactaux,$ls_codconbie,$ls_codpai,$ls_codest,$ls_codmun,
																		 $ls_radiotipo,$ls_obsact,$ls_catalogo,$ls_numordcom,$ls_codpro,$ls_denpro,
																		 $li_monordaux,$ls_nomfot,$ls_spgcuenta,$ls_codfuefin,$ls_codsitcon,$ls_codconcom,
																		 $ld_fecordcomaux,$ls_numsolpag,$ld_fecemisolaux,$ls_estdepact,$la_seguridad,
																		 $ls_codgru,$ls_codsubgru,$ls_codsec,$ls_codite,
																		 $ls_clasif,$ls_codsudeban);
								if($lb_valido)
								{
									$io_msg->message("El activo ha sido registrado");
									$lb_valido=$io_saf->uf_upload($ls_nomfot,$ls_tipfot,$ls_tamfot,$ls_nomtemfot);
									CargarDatos();	
									$ls_statusact="C";										
									$dato['codact'] = $ls_codact;
									$io_saf->ObtenerDatosActivo($dato);
									$io_saf->FormatDatosPresentActivos($dato);
									break;
								}
								else
								{
									$io_msg->message("No se pudo registrar el activo");
								}
							}
							else
							{
								$io_msg->message("El codigo del activo ya esta registrado");
							}
							
						}
						if($ls_statusact=="C")
						{
							$lb_encontrado=$io_saf->uf_saf_select_activo($ls_codemp,$ls_codact);
							if($lb_encontrado)
							{
								$lb_valido=$io_saf->uf_saf_update_activo($ls_codemp,$ld_fecregactaux,$ls_codact,$ls_denact,$ls_maract,$ls_modact,
																		 $ld_feccmpactaux,$li_cosactaux,$ls_codconbie,$ls_codpai,$ls_codest,$ls_codmun,
																		 $ls_radiotipo,$ls_obsact,$ls_catalogo,$ls_numordcom,$ls_codpro,$ls_denpro,
																		 $li_monordaux,$ls_nomfot,$ls_spgcuenta,$ls_codfuefin,$ls_codsitcon,$ls_codconcom,
																		 $ld_fecordcomaux,$ls_numsolpag,$ld_fecemisolaux,$ls_estdepact,$la_seguridad,
																		 $ls_codgru,$ls_codsubgru,$ls_codsec,$ls_codite,
																		 $ls_clasif,$ls_codsudeban);
								if($lb_valido)
								{
									$io_msg->message("El activo ha sido actualizado");
									$lb_valido=$io_saf->uf_upload($ls_nomfot,$ls_tipfot,$ls_tamfot,$ls_nomtemfot);
								}
								else
								{
									$io_msg->message("No se pudo actualizar el activo");
								}
							}
							else
							{
								$io_msg->message("El activo no esta registrado");
							}
						}				
					}
					elseif($ls_tipspg == 0)
					{
						$io_msg->message("La cuenta presupuestaria no es del grupo de las 404 ó no existe en el plan de cuentas.");
					}
				}
						
			}
			elseif($ls_rbtipocat=="2")
			{
			   
				if(($ls_codact=="")||($ld_fecregact=="")||($ls_denact=="")||($ld_feccmpact=="")||($li_cosact=="")||
				   ($ls_spgcuenta=="")||($ls_radiotipo=="")||($ls_codgru=="")||($ls_codsubgru=="")||
				   ($ls_codsec==""))
				{
					$io_msg->message("Faltan campos por llenar");
				}
				else
				{
					if($ls_rbtipocat=="2")
					{
					   $ls_catalogo="---------------";
					}
					$lb_valido=$io_saf->uf_saf_select_cuentaspg($ls_codemp,$ls_spgcuenta,$ls_tipspg);
					$lb_valido=true;
					if($lb_valido)
					{
						if($ls_statusact=="")
						{
							$lb_encontrado=$io_saf->uf_saf_select_activo($ls_codemp,$ls_codact);
							if(!$lb_encontrado)
							{
								$lb_valido=$io_saf->uf_saf_insert_activo($ls_codemp,$ld_fecregactaux,$ls_codact,$ls_denact,$ls_maract,$ls_modact,
																		 $ld_feccmpactaux,$li_cosactaux,$ls_codconbie,$ls_codpai,$ls_codest,$ls_codmun,
																		 $ls_radiotipo,$ls_obsact,$ls_catalogo,$ls_numordcom,$ls_codpro,$ls_denpro,
																		 $li_monordaux,$ls_nomfot,$ls_spgcuenta,$ls_codfuefin,$ls_codsitcon,$ls_codconcom,
																		 $ld_fecordcomaux,$ls_numsolpag,$ld_fecemisolaux,$ls_estdepact,$la_seguridad,
																		 $ls_codgru,$ls_codsubgru,$ls_codsec,$ls_codite, $ls_clasif,$ls_codsudeban);
								if($lb_valido)
								{
									$io_msg->message("El activo ha sido registrado");
									$lb_valido=$io_saf->uf_upload($ls_nomfot,$ls_tipfot,$ls_tamfot,$ls_nomtemfot);
									CargarDatos();	
									$ls_statusact="C";		
									$dato['codact'] = $ls_codact;
									$io_saf->ObtenerDatosActivo($dato);
									$io_saf->FormatDatosPresentActivos($dato);
									break;
								}
								else
								{
									$io_msg->message("No se pudo registrar el activo");
								}
							}
							else
							{
								$io_msg->message("El codigo del activo ya esta registrado");
							}
							
						}
						if($ls_statusact=="C")
						{
							$lb_encontrado=$io_saf->uf_saf_select_activo($ls_codemp,$ls_codact);
							if($lb_encontrado)
							{
								$lb_valido=$io_saf->uf_saf_update_activo($ls_codemp,$ld_fecregactaux,$ls_codact,$ls_denact,$ls_maract,$ls_modact,
																		 $ld_feccmpactaux,$li_cosactaux,$ls_codconbie,$ls_codpai,$ls_codest,$ls_codmun,
																		 $ls_radiotipo,$ls_obsact,$ls_catalogo,$ls_numordcom,$ls_codpro,$ls_denpro,
																		 $li_monordaux,$ls_nomfot,$ls_spgcuenta,$ls_codfuefin,$ls_codsitcon,$ls_codconcom,
																		 $ld_fecordcomaux,$ls_numsolpag,$ld_fecemisolaux,$ls_estdepact,$la_seguridad,
																		 $ls_codgru,$ls_codsubgru,$ls_codsec, $ls_codite, $ls_clasif,$ls_codsudeban);
								if($lb_valido)
								{
									$io_msg->message("El activo ha sido actualizado");
									$lb_valido=$io_saf->uf_upload($ls_nomfot,$ls_tipfot,$ls_tamfot,$ls_nomtemfot);
								}
								else
								{
									$io_msg->message("No se pudo actualizar el activo");
								}
							}
							else
							{
								$io_msg->message("El activo no esta registrado");
							}
						}				
					}
					elseif($ls_tipspg == 0)
					{
						$io_msg->message("La cuenta presupuestaria no es del grupo de las 404");
					}
				}
			}
				
		$dato['codact'] = $ls_codact;
		$io_saf->ObtenerDatosActivo($dato);
		$io_saf->FormatDatosPresentActivos($dato);		
		
		break;
		case "ELIMINAR":
			$ls_codact=$_POST["txtcodact"];
			$lb_valido=$io_saf->uf_saf_delete_activo($ls_codemp,$ls_codact,$la_seguridad);
			if($lb_valido)
			{
				$io_msg->message("El Activo fue eliminado");
				uf_limpiarvariables();		
			}	
			else
			{
				$io_msg->message("No se pudo eliminar el Activo");
				uf_limpiarvariables();		
			}
		break;
	}
	
	
?>
<p>&nbsp;</p>
<form action="" method="post" name="form1" id="form1" enctype="multipart/form-data">
<?php
//////////////////////////////////////////////         SEGURIDAD               /////////////////////////////////////////////
	$io_fun_activo->uf_print_permisos($ls_permisos,$la_permisos,$ls_logusr,'if(opener!=null){close();}else{window.location="sigespwindow_blank.php";}');
	unset($io_fun_activo);
//////////////////////////////////////////////         SEGURIDAD               /////////////////////////////////////////////
?>
  <table width="752" height="784" border="0" align="center" cellpadding="0" cellspacing="0" class="formato-blanco">
    <tr>
      <td width="750" height="690"><div align="left">
          <table width="716" border="0" align="center" cellpadding="0" cellspacing="0" class="formato-blanco">
            <tr>
              <td width="714" class="titulo-ventana">Definici&oacute;n de Activos </td>
            </tr>
            <tr>
              <td>&nbsp;</td>
            </tr>
            <tr>
              <td class="titulo-celdanew">Datos</td>
            </tr>
            <tr>
              <td><table width="713" border="0" cellspacing="0" cellpadding="0">
                  <tr>
                    <td colspan="4" height="22"><div align="center">
                        <input name="hidstatusact" type="hidden" id="hidstatusact" value="<?php print $ls_statusact ?>">
                        <input name="hidrbtipocat" type="hidden" id="hidrbtipocat" value="<?php print $ls_rbtipocat ?>">
                    Los Campos en (*) son necesarios para la Incluir el Activo</div></td>
                  </tr>
                  <tr>
                    <td width="224" height="22"><div align="right"> (*)C&oacute;digo (N&deg; Chapa)</div></td>
                    <td width="312"><input name="txtcodact" type="text" id="txtcodact" onKeyPress="return keyRestrict(event,'1234567890'+'abcdefghijklmnopqrstuvwxyz ');" onBlur="ue_rellenarcampo(this,15);" value="<?php print $ls_codact?>" size="19" maxlength="15" style="text-align:center "></td>
                    <td width="138" rowspan="5"><img name="foto" id="foto" src="fotosactivos/<?php print $ls_foto ?>" width="121" height="94" class="formato-blanco"></td>
                    <td width="39">&nbsp;</td>
                  </tr>
                  <tr>
                    <td height="22"><div align="right"> (*)Fecha de Registro </div></td>
                    <td>
                    	<input name="txtfecregact" type="text" class="fecha_centro" id="txtfecregact"  style="text-align:center " value="<?php echo $ld_fecregact ?>"  size="15" maxlength="10" onKeyPress="ue_separadores(this,'/',patron,true);" >
                  		<input name="reset10" type="reset" onClick="return showCalendar('txtfecregact', '%d/%m/%Y');" value=" ... " />
                    </td>
                    <td>&nbsp;</td>
                  </tr>
                  <tr>
                    <td><div align="right"> (*)Denominaci&oacute;n</div></td>
                    <td rowspan="2"><textarea name="txtdenact" cols="50" rows="2" id="txtdenact" onKeyUp="ue_validarcomillas(this);" onBlur="javascript: ue_validarcomillas(this);"><?php print $ls_denact ?></textarea></td>
                    <td rowspan="2">&nbsp;</td>
                  </tr>
                  <tr>
                    <td><div align="right"></div></td>
                  </tr>
                  <tr>
                    <td height="22"><div align="right">Marca</div></td>
                    <td><input name="txtmaract" type="text" id="txtmaract" onKeyUp="ue_validarcomillas(this);" onBlur="javascript: ue_validarcomillas(this);" value="<?php print $ls_maract ?>" size="15" maxlength="90"></td>
                    <td>&nbsp;</td>
                  </tr>
                  <tr>
                    <td height="22"><div align="right">Modelo</div></td>
                    <td colspan="3"><input name="txtmodact" type="text" id="txtmodact" onKeyUp="ue_validarcomillas(this);" onBlur="javascript: ue_validarcomillas(this);" value="<?php print $ls_modact ?>" size="15" maxlength="90"></td>
                  </tr>
                  <tr>
                    <td height="22"><div align="right"> (*)Fecha de Compra </div></td>
                    <td colspan="3">
                    	<input name="txtfeccmpact" type="text" class="fecha_centro" id="txtfeccmpact"  style="text-align:center " value="<?php echo $ld_feccmpact ?>"  size="15" maxlength="10" onKeyPress="ue_separadores(this,'/',patron,true);" >
                  		<input name="resetfeccmpact" type="reset" onClick="return showCalendar('txtfeccmpact', '%d/%m/%Y');" value=" ... " />
                    </td>
                  </tr>
                  <tr>
                    <td height="23"><div align="right"> (*)Costo</div></td>
                    <td colspan="3"><input name="txtcosact" type="text" id="txtcosact" value="<?php print $li_cosact ?>" size="17" onKeyPress="return(ue_formatonumero(this,'.',',',event));" style="text-align:right "></td>
                  </tr>
                  <tr <? print $ls_mostrar_csc ?> >
                    <td height="22"><div align="right">Fuente de Financiamiento </div></td>
                    <td colspan="3"><input name="txtcodfuefin" type="text" id="txtcodfuefin" value="<?php print $ls_codfuefin ?>" size="5" readonly style="text-align:center ">
                        <a href="javascript: ue_buscarfuente();"><img src="../shared/imagebank/tools15/buscar.gif" alt="Buscar" width="15" height="15" border="0"></a>
                        <input name="txtdenfuefin" type="text" class="sin-borde" id="txtdenfuefin" size="40" value="<?php print $ls_denfuefin ?>" readonly>                    </td>
                  </tr>
                  <tr <? print $ls_mostrar_csc ?> >
                    <td height="22"><div align="right">Situaci&oacute;n Contable </div></td>
                    <td colspan="3"><input name="txtcodsitcon" type="text" id="txtcodsitcon" size="5" value="<?php print $ls_codsitcon ?>" style="text-align:center " readonly>
                        <a href="javascript: ue_buscarsituacion();"><img src="../shared/imagebank/tools15/buscar.gif" width="15" height="15" border="0"></a>
                        <input name="txtdensitcon" type="text" class="sin-borde" id="txtdensitcon" size="40" value="<?php print $ls_densitcon ?>" readonly>                    </td>
                  </tr>
                  <tr>
                    <td height="22"><div align="right">Condici&oacute;n de la Compra </div></td>
                    <td colspan="3"><input name="txtcodconcom" type="text" id="txtcodconcom" size="5" value="<?php print $ls_codconcom ?>" style="text-align:center " readonly>
                        <a href="javascript:ue_buscarcondicioncompra();"><img src="../shared/imagebank/tools15/buscar.gif" width="15" height="15" border="0"></a>
                        <input name="txtdenconcom" type="text" class="sin-borde" id="txtdenconcom" size="40"  value="<?php print $ls_denconcom ?>" readonly>                    </td>
                  </tr>
                  <tr>
                    <td height="22"><div align="right">Estado de Conservacion </div></td>
                    <td colspan="3"><input name="txtcodconbie" type="text" id="txtcodconbie" onKeyUp="ue_validarcomillas(this);" value="<?php print $ls_codconbie ?>" size="5" maxlength="1" readonly style="text-align:center ">
                        <a href="javascript: ue_buscarcondicion();"><img src="../shared/imagebank/tools15/buscar.gif" alt="Buscar" width="15" height="15" border="0"></a>
                        <input name="txtdenconbie" type="text" class="sin-borde" id="txtdenconbie" size="40"  value="<?php print $ls_denconbie ?>" readonly>
                        <input name="txtdescripcion" type="hidden" id="txtdescripcion"></td>
                  </tr>
                  <tr>
                    <td height="22"><div align="right">Pa&iacute;s</div></td>
                    <td colspan="3"><input name="txtcodpai" type="text" id="txtcodpai" onKeyUp="ue_validarcomillas(this);" value="<?php print $ls_codpai ?>" size="5" maxlength="3" readonly style="text-align:center ">
                        <a href="javascript: ue_buscarpais();"><img src="../shared/imagebank/tools15/buscar.gif" alt="Buscar" width="15" height="15" border="0"></a>
                        <input name="txtdespai" type="text" class="sin-borde" id="txtdespai"  value="<?php print $ls_despai ?>" readonly></td>
                  </tr>
                  <tr>
                    <td height="28"><div align="right">Estado</div></td>
                    <td colspan="3"><input name="txtcodest" type="text" id="txtcodest" onKeyUp="ue_validarcomillas(this);" value="<?php print $ls_codest ?>" size="5" maxlength="3" readonly style="text-align:center ">
                        <a href="javascript: ue_buscarestado();"><img src="../shared/imagebank/tools15/buscar.gif" alt="Buscar" width="15" height="15" border="0"></a>
                        <input name="txtdesest" type="text" class="sin-borde" id="txtdesest"  value="<?php print $ls_desest ?>" readonly></td>
                  </tr>
                  <tr>
                    <td height="22"><div align="right">Municipio</div></td>
                    <td colspan="3"><input name="txtcodmun" type="text" id="txtcodmun" onKeyUp="ue_validarcomillas(this);" value="<?php print $ls_codmun ?>" size="5" maxlength="3" readonly style="text-align:center ">
                        <a href="javascript: ue_buscarmunicipio();"><img src="../shared/imagebank/tools15/buscar.gif" alt="Buscar" width="15" height="15" border="0"></a>
                        <input name="txtdesmun" type="text" class="sin-borde" id="txtdesmun"  value="<?php print $ls_desmun ?>" readonly></td>
                  </tr>
                  <tr>
                    <td height="18"><div align="right"> (*)Tipo </div></td>
                    <td colspan="3"><input name="radiotipo" type="radio" class="sin-borde" value="1" onClick="actualizaValor(this)" <?php print $ls_chkmueble ?>>
                      Mueble
                      <input name="radiotipo" type="radio" class="sin-borde" value="2" onClick="actualizaValor(this)" <?php print $ls_chkinmueble ?>>
                      Inmueble
                      <input name="radiotipo" type="radio" class="sin-borde" value="3" onClick="actualizaValor(this)" <?php print $ls_chksemoviente ?>>
                      Semoviente
                      <input name="hidradio" type="hidden" id="hidradio"></td>
                  </tr>
                  <tr >
                    <td height="22" id="fila1" <? print $ls_mostrar_inm ?>>&nbsp;</td>
                    <td colspan="3" id="fila2" <? print $ls_mostrar_inm ?>> Clasificaci&oacute;n del Inmueble
                      <select name="cmbclasi" size="1" id="cmbclasi">
					    <option value="" selected>--Seleccione una opción--</option>
                        <option <?php if($ls_clasif=="1"){ print "selected";}?> onClick="javascript: ativar_depre('1');" value="1">Edificios </option>
                        <option <?php if($ls_clasif=="2"){ print "selected";}?> onClick="javascript: ativar_depre('2');" value="2">Instalaciones Fijas</option>
                        <option <?php if($ls_clasif=="3"){ print "selected";}?> onClick="javascript: descativar_depre();" value="3">Terrenos</option>
                      </select></td>
                  </tr>
                  <tr>
                    <td height="22"><div align="right">Es Vehículo:</div></td>
                    <td colspan="3"><input name="esvehiculo" type="checkbox" id="esvehiculo" onClick="ObjForm.ValidarTipo()" value="1" <?php if($io_saf->DatosActivo['esvehiculo']){echo 'checked';} ?> disabled></td>
                  </tr>
                  <tr>
                    <td height="22"><div align="right">Observaciones</div></td>
                    <td colspan="3" rowspan="2"><textarea name="txtobsact" cols="50" rows="2" id="txtobsact" onKeyUp="ue_validarcomillas(this);" onBlur="javascript: ue_validarcomillas(this);" onKeyPress="javascript: pulsar(this)"><?php print $ls_obsact?>  </textarea></td>
                  </tr>
                  <tr>
                    <td><div align="right"></div></td>
                  </tr>
				  <?php if($ls_estsudeban!=1){?>
                  <tr>
                    <td height="22"><div align="right">(*)Tipo Categoria</div></td>
                    <td colspan="3"><input name="rbtipocat" type="radio" class="sin-borde" value="CSC" <?php print $ls_rbcsc; ?> disabled="disabled">
					Cat&aacute;logo SIGECOF
					<input name="rbtipocat" type="radio" class="sin-borde" value="CGR" <?php print $ls_rbcgr; ?> disabled="disabled">
					Categor&iacute;a CGR </td>
                  </tr>
				  <p>
                  <tr  <? print $ls_mostrar_csc ?>>
                    <td height="22"><div align="right"> (*)Cat&aacute;logo SIGECOF </div></td>
                    <td colspan="3"><input name="txtcatalogo" type="text" id="txtcatalogo" onKeyUp="ue_validarcomillas(this);" value="<?php print $ls_catalogo?>" size="20" readonly style="text-align:center ">
                        <a href="javascript: ue_catalogo();"><img src="../shared/imagebank/tools15/buscar.gif" alt="Buscar" width="15" height="15" border="0"></a>
                        <input name="txtdencat" type="text" class="sin-borde" id="txtdencat" size="50" value="<?php print $ls_dencatsig?>" readonly>
                        <input name="hidstatus" type="hidden" id="hidstatus">                        </td>
                  </tr>
				  <p>                  </p>
                  <tr <? print $ls_mostrar_cgr ?> >
                    <td height="22"><div align="right">(*)Grupo</div></td>
                    <td colspan="3"><div align="left">
                      <input name="txtcodgru" type="text" id="txtcodgru" onKeyUp="ue_validarcomillas(this);" value="<?php print $ls_codgru?>" size="5" readonly>
                      <a href="javascript: ue_catalogo_grupo();"><img src="../shared/imagebank/tools15/buscar.gif" alt="Buscar" width="15" height="15" border="0"></a>
                      <input name="txtdengru" type="text" class="sin-borde" id="txtdengru" size="50" readOnly="true">
                    </div></td>
                  </tr>
                  <tr <? print $ls_mostrar_cgr ?> >
                    <td height="22"><div align="right">(*)SubGrupo</div></td>
                    <td colspan="3"><div align="left">
                      <input name="txtcodsubgru" type="text" id="txtcodsubgru" onKeyUp="ue_validarcomillas(this);" value="<?php print $ls_codsubgru?>" size="5" readonly>
                      <a href="javascript: ue_catalogo_subgrupo();"><img src="../shared/imagebank/tools15/buscar.gif" alt="Buscar" width="15" height="15" border="0"></a>
                      <input name="txtdensubgru" type="text" class="sin-borde" id="txtdensubgru" size="50" readOnly="true">
                    </div></td>
                  </tr>
                  <tr <? print $ls_mostrar_cgr ?> >
                    <td height="22"><div align="right">(*)Seccion</div></td>
                    <td colspan="3"><div align="left">
                      <input name="txtcodsec" type="text" id="txtcodsec" onKeyUp="ue_validarcomillas(this);" value="<?php print $ls_codsec?>" size="5" readonly>
                      <a href="javascript: ue_catalogo_seccion();"><img src="../shared/imagebank/tools15/buscar.gif" alt="Buscar" width="15" height="15" border="0"></a>
                      <input name="txtdensec" type="text" class="sin-borde" id="txtdensec" size="50" readOnly="true">
                    </div></td>
                  </tr>
                  <tr <? print $ls_mostrar_cgr ?> >
                    <td height="22"><div align="right">(*)Item</div></td>
                    <td colspan="3"><div align="left">
                      <input name="txtcodite" type="text" id="txtcodite" value="<?php print $ls_codite; ?>" size="5" readonly>
                      <a href="javascript: ue_catalogo_item();"><img src="../shared/imagebank/tools15/buscar.gif" alt="Buscar" width="15" height="15" border="0"></a>
                      <input name="txtdenite" type="text" class="sin-borde" id="txtdenite" size="50" readonly><input name="estsudeban" type="hidden" id="estsudeban" value="<?php print $ls_estsudeban; ?>">
                      <input name="txtcodsudeban" type="hidden" id="txtcodsudeban">
                      <input name="txtdensudeban" type="hidden" id="txtdensudeban">
</div></td>
                  </tr>
					<?php
					}
					else
					{						
					?>
                  <tr>
                    <td height="22"><div align="right">(*)Categoria SUDEBAN</div></td>
                    <td colspan="3"><div align="left">
                      <input name="txtcodsudeban" type="text" id="txtcodsudeban" onKeyUp="ue_validarcomillas(this);" value="<?php print $ls_codsudeban; ?>" size="5" readonly>
                      <a href="javascript: ue_catalogo_sudeban();"><img src="../shared/imagebank/tools15/buscar.gif" alt="Buscar" width="15" height="15" border="0"></a>
                      <input name="txtdensudeban" type="text" class="sin-borde" id="txtdensudeban" size="50" readOnly="true">
                    </div>
					<input name="txtcatalogo" type="hidden" id="txtcatalogo" value="<?php print $ls_catalogo?>" size="20" readonly style="text-align:center ">
					<input name="txtdencat" type="hidden"id="txtdencat" size="50" value="<?php print $ls_dencatsig?>" readonly>
					<input name="txtcodgru" type="hidden" id="txtcodgru" value="<?php print $ls_codgru?>" size="5" readonly>
					<input name="txtdengru" type="hidden" id="txtdengru" size="50" readOnly="true">
					<input name="txtcodsubgru" type="hidden" id="txtcodsubgru" value="<?php print $ls_codsubgru?>" size="5" readonly>
					<input name="txtdensubgru" type="hidden" id="txtdensubgru" size="50" readOnly="true">
					<input name="txtcodsec" type="hidden" id="txtcodsec" value="<?php print $ls_codsec?>" size="5" readonly>
					<input name="txtdensec" type="hidden" id="txtdensec" size="50" readOnly="true">
					<input name="txtcodite" type="hidden" id="txtcodite" value="<?php print $ls_codite; ?>" size="5" readonly>
					<input name="txtdenite" type="hidden" id="txtdenite" size="50" readonly>					<input name="estsudeban" type="hidden" id="estsudeban" value="<?php print $ls_estsudeban; ?>"></td>
                  </tr>
					<?php
					}
					?>
                  <tr>
                    <td height="22"><div align="right">(*)C&oacute;digo Presupuestario</div></td>
                    <td colspan="3"><input name="txtcuenta" type="text" id="txtcuenta" style="text-align:center " size="20" value="<?php print $ls_spgcuenta?>" readonly>
                    <a href="javascript: ue_catalogo_spg();"><img src="../shared/imagebank/tools15/buscar.gif" alt="Buscar" width="15" height="15" border="0"></a>                      <!--<a href="javascript: ue_buscarspg();"><img src="../shared/imagebank/tools15/buscar.gif" alt="Buscar" width="15" height="15" border="0"></a>-->
                    <input name="txtdenominacion" type="text" class="sin-borde" id="txtdenominacion" size="50" value="<?php print $txtdenominacion;?>" readonly></td>
                  </tr>
                  <tr>
                    <td height="22"><div align="right">Foto</div></td>
                    <td colspan="3"><input name="txtfotact" type="file" id="txtfotact"></td>
                  </tr>
                  <tr>
                    <td height="22"><div align="right">Activo Depreciable</div></td>
                    <td colspan="3"><input name="chkdepreciable" type="checkbox" id="chkdepreciable" value="1" <?php print $ls_chkchecked; print  $ls_edit?>></td>
                  </tr>
                  <tr>
                    <td height="22"><div align="right">Es Componente:</div></td>
                    <td colspan="3"><input name="chkcomp" type="checkbox" id="chkcomp" value="1" <?php if($io_saf->DatosActivo['comp']){echo 'checked';} ?> ></td>
                  </tr>
                  <tr>
                    <td height="22"><div align="right">Tiene Componente:</div></td>
                    <td colspan="3"><input name="tienecomp" type="checkbox" id="tienecomp" value="1" <?php if($io_saf->DatosActivo['tienecomp']){echo 'checked';} ?> ></td>
                  </tr>
                  <tr>
                    <td height="22"><div align="right">Tiempo de Garant&iacute;a:</div></td>
                    <td colspan="3"><input name="tiempogaran" type="text" id="tiempogaran" onKeyPress="return(ue_formatonumero(this,'.',',',event));" value="<?php echo $io_saf->DatosActivo['tiempogaran']; ?>" size="8" maxlength="5">
                      <?php $io_saf->ComboUnimedGarantia($io_saf->DatosActivo,'C','cmbunimedgar');  ?></td>
                  </tr>
                  <tr>
                    <td height="22"><div align="right">Forma de Adquisici&oacute;n:</div></td>
                    <td colspan="3"><?php $io_saf->ComboForAdq($io_saf->DatosActivo,'ObjForm.BuscarFormOrigen()');  ?></td>
                  </tr>
                  <tr>
                    <td height="22"><div align="right">Estatus de Uso:</div></td>
                    <td colspan="3"><?php $io_saf->ComboEstUso($io_saf->DatosActivo);  ?></td>
                  </tr>
                  <tr>
                    <td height="22"><div align="right">Color:</div></td>
                    <td colspan="3"><?php $io_saf->ComboColor($io_saf->DatosActivo);  ?></td>
                  </tr>
                  <tr>
                    <td height="22"><div align="right">Aseguradora:</div></td>
                    <td colspan="3"><?php $io_saf->ComboAseguradora($io_saf->DatosActivo);  ?></td>
                  </tr>
                  <tr>
                    <td height="22"><div align="right">Tipo de Cobertura:</div></td>
                    <td colspan="3"><?php $io_saf->ComboTipCobertura($io_saf->DatosActivo);  ?></td>
                  </tr>
                  <tr>
                    <td height="22"><div align="right">Tipo de Lugar:</div></td>
                    <td colspan="3"><?php $io_saf->ComboTipLugar($io_saf->DatosActivo);  ?></td>
                  </tr>
                  <tr>
                    <td height="22"><div align="right">Categoria de Ubicación:</div></td>
                    <td colspan="3"><?php $io_saf->ComboCategUniAdm($io_saf->DatosActivo);  ?></td>
                  </tr>
                  <tr>
                    <td height="22" valign="top" ><div align="right">Especifiic. Técnicas:</div></td>
                    <td colspan="3"><textarea name="esptec" cols="50" id="esptec" maxlength="240" onKeyPress="return keyRestrict(event,'1234567890'+'abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ&Ntilde;@#/-&deg;');"><?php echo $io_saf->DatosActivo['esptec']; ?></textarea></td>
                  </tr>
                  <tr>
                    <td height="22" valign="top" ><div align="right">Otras Especific.:</div></td>
                    <td colspan="3"><textarea name="otrasesp" cols="50" id="otrasesp" maxlength="240" onKeyPress="return keyRestrict(event,'1234567890'+'abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ&Ntilde;@#/-&deg;');"><?php echo $io_saf->DatosActivo['otrasesp']; ?></textarea></td>
                  </tr>  
              </table></td>
            </tr>
            <tr>
              <td class="titulo-celdanew">Datos Particulares Vehículo (Transporte, Tracci&oacute;n, Elevaci&oacute;n)</td>
            </tr>
            <tr>
              <td height="18" ></td>
            </tr>
            <tr>
              <td height="18"  id="filavehiculo">
              <table width="719" border="0" cellspacing="0" cellpadding="0">
                  <tr>
                    <td height="22"><div align="right">Tipo de Veh&iacute;culo:</div></td>
                    <td><?php $io_saf->ComboTipVeh($io_saf->DatosActivo);  ?></td>
                  </tr>
                  <tr>
                    <td height="22"><div align="right">Serial Carrocer&iacute;a:</div></td>
                    <td><label>
                      <input type="text" name="serialcar" id="serialcar" value="<?php echo $io_saf->DatosActivo['serialcar']; ?>" onKeyPress="return keyRestrict(event,'1234567890'+'abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZÑ@#/-°');">
                    </label></td>
                  </tr>
                  <tr>
                    <td height="22"><div align="right">Serial Motor:</div></td>
                    <td><input type="text" name="serialmot" id="serialmot" value="<?php echo $io_saf->DatosActivo['serialmot']; ?>" onKeyPress="return keyRestrict(event,'1234567890'+'abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ&Ntilde;@#/-&deg;');"></td>
                  </tr>
                  <tr>
                    <td height="22"><div align="right">Placa / Siglas:</div></td>
                    <td><input type="text" name="sigplaca" id="sigplaca" value="<?php echo $io_saf->DatosActivo['sigplaca']; ?>" onKeyPress="return keyRestrict(event,'1234567890'+'abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ&Ntilde;@#/-&deg;');"></td>
                  </tr>
                  <tr>
                    <td height="22"><div align="right">Año Fabricación:</div></td>
                    <td><input name="anofabveh" type="text" id="anofabveh" onKeyPress="return keyRestrict(event,'1234567890');" value="<?php echo $io_saf->DatosActivo['anofabveh']; ?>" size="6" maxlength="4"></td>
                  </tr>
                  <tr>
                    <td height="22"><div align="right">N&deg; T&iacute;tulo de Prop:</div></td>
                    <td><input type="text" name="nrotitprop" id="nrotitprop" value="<?php echo $io_saf->DatosActivo['nrotitprop']; ?>" onKeyPress="return keyRestrict(event,'1234567890'+'abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ&Ntilde;@#/-&deg;');"></td>
                  </tr>
                  <tr>
                    <td height="22"><div align="right">Capacidad:</div></td>
                    <td><input type="text" name="capacidad" id="capacidad" value="<?php echo $io_saf->DatosActivo['capacidad']; ?>"  onKeyPress="return(ue_formatonumero(this,'.',',',event));" >
                    <?php $io_saf->ComboUnimed($io_saf->DatosActivo,'C','cmbunimedcap');  ?></td>
                  </tr>
                  
                  <tr>
                    <td height="22"><div align="right">Sistema de Reastreo:</div></td>
                    <td><input name="sisrastreo" type="checkbox" id="sisrastreo" value="1" <?php if($io_saf->DatosActivo['sisrastreo']){echo 'checked';} ?> ></td>
                  </tr>
                  <tr>
                    <td width="185" valign="top" ><div align="right">Espec&iacute;ic. Sist. Rastreo:&nbsp;</div></td>
                    <td width="534"><textarea name="espsisrast" cols="50" id="espsisrast" maxlength="240" onKeyPress="return keyRestrict(event,'1234567890'+'abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ&Ntilde;@#/-&deg;');"><?php echo $io_saf->DatosActivo['espsisrast']; ?></textarea></td>
                  </tr>                                  
              </table>
              </td>
            </tr>
             <tr>
              <td class="titulo-celdanew">Datos Particulares Inmueble</td>
            </tr>
            <tr>
              <td height="18" ></td>
            </tr>
            <tr>
              <td height="18"  id="filainmueble">
              <table width="723" border="0" cellspacing="0" cellpadding="0">
                  <tr>
                    <td height="22"><div align="right">Uso Edificaci&oacute;n:</div></td>
                    <td width="538"><?php $io_saf->ComboUsoEdif($io_saf->DatosActivo);  ?></td>
                  </tr>
                  <tr>
                    <td height="22"><div align="right">Urbanizaci&oacute;n:</div></td>
                    <td><input name="urbaniza" type="text" id="urbaniza" value="<?php echo $io_saf->DatosActivo['urbaniza']; ?>" onKeyPress="return keyRestrict(event,'1234567890'+'abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ&Ntilde;@#/-&deg;');" size="80"></td>
                  </tr>
                  <tr>
                    <td height="22"><div align="right">Calle/Avenida:</div></td>
                    <td><input name="calleave" type="text" id="calleave" value="<?php echo $io_saf->DatosActivo['calleave']; ?>" onKeyPress="return keyRestrict(event,'1234567890'+'abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ&Ntilde;@#/-&deg;');" size="80"></td>
                  </tr>
                  <tr>
                    <td height="22"><div align="right">Casa/Edif:</div></td>
                    <td><input name="casaedif" type="text" id="casaedif" value="<?php echo $io_saf->DatosActivo['casaedif']; ?>" onKeyPress="return keyRestrict(event,'1234567890'+'abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ&Ntilde;@#/-&deg;');" size="80"></td>
                  </tr>
                  <tr>
                    <td height="25"><div align="right">Oficina de Registro:</div></td>
                    <td><input name="oficregistro" type="text" id="oficregistro" value="<?php echo $io_saf->DatosActivo['oficregistro']; ?>" onKeyPress="return keyRestrict(event,'1234567890'+'abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ&Ntilde;@#/-&deg;');" size="80"></td>
                  </tr>
                  <tr>
                    <td height="22"><div align="right">Referencia Regsitro</div></td>
                    <td><input type="text" name="refregistro" id="refregistro" value="<?php echo $io_saf->DatosActivo['refregistro']; ?>" onKeyPress="return keyRestrict(event,'1234567890'+'abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ&Ntilde;@#/-&deg;');"></td>
                  </tr>
                  <tr>
                    <td height="22"><div align="right">Tomo:</div></td>
                    <td><input type="text" name="tomo" id="tomo" value="<?php echo $io_saf->DatosActivo['tomo']; ?>" onKeyPress="return keyRestrict(event,'1234567890'+'abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ&Ntilde;@#/-&deg;');"></td>
                  </tr>
                  <tr>
                    <td height="22"><div align="right">Folio:</div></td>
                    <td><input type="text" name="folio" id="folio" value="<?php echo $io_saf->DatosActivo['folio']; ?>" onKeyPress="return keyRestrict(event,'1234567890'+'abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ&Ntilde;@#/-&deg;');"></td>
                  </tr>
                  <tr>
                    <td height="22"><div align="right">Protocolo de Registro:</div></td>
                    <td><input type="text" name="protocoloreg" id="protocoloreg" value="<?php echo $io_saf->DatosActivo['protocoloreg']; ?>" onKeyPress="return keyRestrict(event,'1234567890'+'abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ&Ntilde;@#/-&deg;');"></td>
                  </tr>
                  <tr>
                    <td height="22"><div align="right">N&deg; Registro:</div></td>
                    <td><input type="text" name="nroregistro" id="nroregistro" value="<?php echo $io_saf->DatosActivo['nroregistro']; ?>" onKeyPress="return keyRestrict(event,'1234567890'+'abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ&Ntilde;@#/-&deg;');"></td>
                  </tr>
                  <tr>
                    <td height="22"><div align="right">Fecha de Registro:</div></td>
                    <td>
                        <input name="fecregistro" type="text" class="fecha_centro" id="fecregistro"  style="text-align:center " value="<?php echo $io_saf->DatosActivo['fecregistro'] ?>"  size="15" maxlength="10" onKeyPress="ue_separadores(this,'/',patron,true);" >
                  		<input name="reset1" type="reset" onClick="return showCalendar('fecregistro', '%d/%m/%Y');" value=" ... " />
                    </td>
                  </tr>
                                  
                  <tr>
                    <td height="22"><div align="right">Propietario Anterior</div></td>
                    <td><input name="propanterior" type="text" id="propanterior" value="<?php echo $io_saf->DatosActivo['propanterior']; ?>" onKeyPress="return keyRestrict(event,'1234567890'+'abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ&Ntilde;@#/-&deg;');" size="75"></td>
                  </tr>
                  <tr>
                    <td height="22"><div align="right">&Aacute;rea de Construcci&oacute;n:</div></td>
                    <td><input type="text" name="areaconst" id="areaconst" value="<?php echo $io_saf->DatosActivo['areaconst']; ?>"  onKeyPress="return(ue_formatonumero(this,'.',',',event));">
                    <?php $io_saf->ComboUnimed($io_saf->DatosActivo,'S','cmbunimedarea');  ?></td>
                  </tr>                  
              </table>
              </td>
            </tr>
             <tr>
              <td class="titulo-celdanew">Datos Particulares Semoviente</td>
            </tr>
            <tr>
              <td height="18" ></td>
            </tr>
            <tr>
              <td height="18"  id="filasemoviente">
              <table width="725" border="0" cellspacing="0" cellpadding="0">
                  <tr>
                    <td height="22"><div align="right">Tipo de Animal:</div></td>
                    <td><?php $io_saf->ComboTipoAnimal($io_saf->DatosActivo);  ?></td>
                  </tr>
                  <tr>
                    <td height="22"><div align="right">Proposito Semoviente:</div></td>
                    <td><?php $io_saf->ComboPropSemoviente($io_saf->DatosActivo);  ?></td>
                  </tr>
                  <tr>
                    <td height="22"><div align="right">Raza:</div></td>
                    <td><?php $io_saf->ComboRaza($io_saf->DatosActivo);  ?></td>
                  </tr>
                  <tr>
                    <td height="22"><div align="right">Género:</div></td>
                    <td><?php $io_saf->ComboGenero($io_saf->DatosActivo);  ?></td>
                  </tr>
                  <tr>
                    <td height="22"><div align="right">Fecha Nacimiento:</div></td>
                    <td>
                   		<input name="fecnacsem" type="text" class="fecha_centro" id="fecnacsem"  style="text-align:center " value="<?php echo $io_saf->DatosActivo['fecnacsem'] ?>"  size="15" maxlength="10" onKeyPress="ue_separadores(this,'/',patron,true);" >
                  		<input name="reset2" type="reset" onClick="return showCalendar('fecnacsem', '%d/%m/%Y');" value=" ... " />
                   </td>
                  </tr>
                  <tr>
                    <td height="22"><div align="right">Peso:</div></td>
                    <td><input type="text" name="peso" id="peso" value="<?php echo $io_saf->DatosActivo['peso']; ?>" onKeyPress="return(ue_formatonumero(this,'.',',',event));" >
                    <?php $io_saf->ComboUnimed($io_saf->DatosActivo,'P','cmbunimedpeso');  ?></td>
                  </tr>
                  <tr>
                    <td height="22"><div align="right">N&deg; Hierro:</div></td>
                    <td><input type="text" name="nrohierro" id="nrohierro" value="<?php echo $io_saf->DatosActivo['nrohierro']; ?>" onKeyPress="return keyRestrict(event,'1234567890'+'abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ&Ntilde;@#/-&deg;');"></td>
                  </tr>
                  <tr>
                    <td width="185" ><div align="right">Se&ntilde;as&nbsp;</div></td>
                    <td width="540"><input name="senas" type="text" id="senas" value="<?php echo $io_saf->DatosActivo['senas']; ?>" onKeyPress="return keyRestrict(event,'1234567890'+'abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ&Ntilde;@#/-&deg;');" size="75"></td>
                  </tr>                   
              </table>
              </td>
            </tr>
            <tr>
              <td class="titulo-celdanew">Origen de la Adquisición</td>
            </tr>
            <tr>
              <td>&nbsp;</td>
            </tr>
            <tr>
              <td><div id="divorigen" align="center"></div></td>
            </tr>
            <tr>
              <td class="titulo-celdanew">Orden de Compra</td>
            </tr>
            <tr>
              <td>&nbsp;</td>
            </tr>
            <tr>
              <td height="75">
              <table width="708" border="0" cellspacing="0" cellpadding="0">
                  <tr>
                    <td width="185" height="18"><div align="right"> Numero</div></td>
                    <td width="523"><input name="txtnumord" type="text" id="txtnumord" onKeyUp="javascript: ue_validarnumero(this);" value="<?php print $ls_numordcom ?>" size="18" maxlength="15">
                    <a href="javascript: ue_buscarorden();"><img src="../shared/imagebank/tools15/buscar.gif" alt="Buscar" width="15" height="15" border="0"></a></td>
                  </tr>
                  <tr>
                    <td height="22"><div align="right">Fecha</div></td>
                    <td>
                        <input name="txtfecordcom" type="text" class="fecha_centro" id="txtfecordcom"  style="text-align:center " value="<?php echo $ld_fecordcom ?>"  size="15" maxlength="10" onKeyPress="ue_separadores(this,'/',patron,true);" >
                  		<input name="reset4" type="reset" onClick="return showCalendar('txtfecordcom', '%d/%m/%Y');" value=" ... " />

                   </td>
                  </tr>
                  <tr>
                    <td height="22"><div align="right">Proveedor</div></td>
                    <td><input name="txtcodpro" type="text" id="txtcodpro" onKeyUp="ue_validarcomillas(this);" value="<?php print $ls_codpro?>" size="18" style="text-align:center " readonly>
                        <input name="txtdenpro" type="text" class="sin-borde" id="txtdenpro" size="35" value="<?php print $ls_denpro?>" readonly></td>
                  </tr>
                  <tr>
                    <td height="22"><div align="right">Monto Orden </div></td>
                    <td><input name="txtmonord" type="text" id="txtmonord" value="<?php print $li_monord?>" size="18" onKeyPress="return(ue_formatonumero(this,'.',',',event));" style="text-align:right "></td>
                  </tr>
              </table></td>
            </tr>
            <tr>
              <td><div align="center"> </div></td>
            </tr>
            <tr>
              <td class="titulo-celdanew">Orden de Pago </td>
            </tr>
            <tr>
              <td>&nbsp;</td>
            </tr>
            <tr>
              <td><table width="711" border="0" cellspacing="0" cellpadding="0">
                  <tr>
                    <td width="230" height="18"><div align="right">Numero</div></td>
                    <td width="481"><input name="txtnumsolpag" type="text" id="txtnumsolpag" onKeyUp="javascript: ue_validarnumero(this);" size="18" maxlength="15" value="<?php print $ls_numsolpag?>" >
                        <a href="javascript: ue_buscarpago();"><img src="../shared/imagebank/tools15/buscar.gif" alt="Buscar" width="15" height="15" border="0"></a></td>
                  </tr>
                  <tr>
                    <td height="22"><div align="right">Fecha</div></td>
                    <td>
                    	<input name="txtfecemisol" type="text" class="fecha_centro" id="txtfecemisol"  style="text-align:center " value="<?php echo $ld_fecemisol ?>"  size="15" maxlength="10" onKeyPress="ue_separadores(this,'/',patron,true);" >
                  		<input name="reset4" type="reset" onClick="return showCalendar('txtfecemisol', '%d/%m/%Y');" value=" ... " />
                    </td>
                  </tr>
              </table></td>
            </tr>
            <tr>
              <td>
              	<input name="operacionact" type="hidden" id="operacionact">
                <input name="fechahoy" type="hidden" id="fechahoy" value="<?php echo date("d/m/Y"); ?>">
                <input name="hcodact" type="hidden" id="hcodact" value="<?php echo $io_saf->DatosActivo['codact']; ?>">
                <input name="hcodori" type="hidden" id="hcodori" value="<?php echo $io_saf->DatosActivo['codori']; ?>">
                <input name="nombre_form" type="hidden" id="nombre_form" value="DEFINICION_ACTIVOS">
              </td>
            </tr>
          </table>
      </div></td>
    </tr>
    <tr>
      <td height="79"><table width="630" border="0" align="center" class="formato-blanco">
        <tr>
          <td width="157" height="32"><div align="center">
              <input name="btnbanco" type="button" class="boton" id="btnbanco" value="      Banco       " height="100px"  onClick="ue_abriractivosbanco();">
          </div></td>
          <td width="158"><div align="center">
              <input name="btnmantenimirnto" type="button" class="boton" id="btnmantenimirnto" value="Mantenimiento"   onClick="ue_abriractivosmantenimiento();">
          </div></td>
          <td width="157"><div align="center">
              <input name="btnpoliza" type="button" class="boton" id="btnpoliza" value="      P&oacute;liza      " onClick="ue_abriractivospoliza();">
          </div></td>
          <td width="158"><div align="center">
              <input name="btnrotulacion" type="button" class="boton" id="btnrotulacion" value="  Rotulaci&oacute;n  "  onClick="ue_abriractivosrotulacion();">
          </div></td>
        </tr>
        <tr>
          <td height="32"><div align="center">
            <input name="btndepreciacion" type="button" class="boton" id="btndepreciacion2" value="   Depreciaci&oacute;n   " onClick="ue_abrirdepreciacion();" <? print $depreciacion ?>>
          </div></td>
          <td id="fila3" height="32" colspan="2" <? print $ls_estbt ?>><div align="center"><input name="btnhojatrabajo" type="button" class="boton" id="btnhojatrabajo" value="   <? print $ls_titulo ?>   " onClick="ue_abririnmuebles();"></div></td>
          <td><div align="center">
            <input name="btnseriales" type="button" class="boton" id="btnseriales" value=" Seriales y Partes " onClick="ue_abrirseriales();">
          </div></td>
        </tr>
      </table></td>
    </tr>
    <tr>
      <td height="15">&nbsp;</td>
    </tr>
  </table>
  <div id="resultados" align="center"></div>
</form>
<p>&nbsp;</p>
<div align="center"></div>
<p align="center">&nbsp;</p>
</body>
<script language="javascript">

ruta = "../";

function ue_abrirdepreciacion()
{
	f=document.form1;
	codact=ue_validarvacio(f.txtcodact.value);
	status=ue_validarvacio(f.hidstatusact.value);
	if (status=="C")
	{
		if(f.chkdepreciable.checked)
		{
			window.open("sigesp_saf_d_depreciacion.php?codact="+codact+"","catalogo","menubar=no,toolbar=no,scrollbars=yes,width=625,height=350,left=60,top=70,location=no,resizable=no");
		}
		else
		{alert("El activo no es depreciable");}
	}
	else
	{
		alert("El activo debe estar grabado");	
	}
}

function ue_abririnmuebles()
{
	f=document.form1;
	valor=f.cmbclasi.value;	
	codact=ue_validarvacio(f.txtcodact.value);
	status=ue_validarvacio(f.hidstatusact.value);
	denact=ue_validarvacio(f.txtdenact.value)
	if (status=="C")
	{
		if (valor==1)
		{
			window.open("sigesp_saf_d_inmueble_edificio.php?codact="+codact+"&denact="+denact+"","catalogo","menubar=no,toolbar=no,scrollbars=yes,width=900,height=450,left=60,top=70,location=no,resizable=no");			
		}
		
	}
	else
	{
		alert("El activo debe estar grabado");	
	}
}

function ue_abrirseriales()
{
	f=document.form1;
	codact=ue_validarvacio(f.txtcodact.value);
	denact=ue_validarvacio(f.txtdenact.value)
	status=ue_validarvacio(f.hidstatusact.value);
	if (status=="C")
	{
		window.open("sigesp_saf_d_seriales.php?codact="+codact+"&denact="+denact+"","catalogo","menubar=no,toolbar=no,scrollbars=yes,width=870,height=400,left=0,top=100,location=no,resizable=yes");
	}
	else
	{
		alert("El activo debe estar grabado");	
	}
}

function ue_abriractivosbanco()
{
	f=document.form1;
	codact=ue_validarvacio(f.txtcodact.value);
	denact=ue_validarvacio(f.txtdenact.value)
	status=ue_validarvacio(f.hidstatusact.value);
	if (status=="C")
	{
		window.open("sigesp_saf_d_activosbanco.php?codact="+codact+"&denact="+denact+"","catalogo","menubar=no,toolbar=no,scrollbars=yes,width=680,height=300,left=50,top=50,location=no,resizable=no");
	}
	else
	{
		alert("El activo debe estar grabado");	
	}
}

function ue_abriractivospoliza()
{
	f=document.form1;
	codact=ue_validarvacio(f.txtcodact.value);
	denact=ue_validarvacio(f.txtdenact.value)
	status=ue_validarvacio(f.hidstatusact.value);
	if (status=="C")
	{
		window.open("sigesp_saf_d_activospoliza.php?codact="+codact+"&denact="+denact+"","catalogo","menubar=no,toolbar=no,scrollbars=yes,width=600,height=300,left=50,top=50,location=no,resizable=no");
	}
	else
	{
		alert("El activo debe estar grabado");	
	}
}

function ue_abriractivosrotulacion()
{
	f=document.form1;
	codact=ue_validarvacio(f.txtcodact.value);
	denact=ue_validarvacio(f.txtdenact.value)
	status=ue_validarvacio(f.hidstatusact.value);
	if (status=="C")
	{
		window.open("sigesp_saf_d_activosrotulacion.php?codact="+codact+"&denact="+denact+"","catalogo","menubar=no,toolbar=no,scrollbars=yes,width=600,height=300,left=50,top=50,location=no,resizable=no");
	}
	else
	{
		alert("El activo debe estar grabado");	
	}
}

function ue_abriractivosmantenimiento()
{
	f=document.form1;
	codact=ue_validarvacio(f.txtcodact.value);
	denact=ue_validarvacio(f.txtdenact.value)
	status=ue_validarvacio(f.hidstatusact.value);
	if (status=="C")
	{
		window.open("sigesp_saf_d_activosmantenimiento.php?codact="+codact+"&denact="+denact+"","catalogo","menubar=no,toolbar=no,scrollbars=yes,width=550,height=300,left=50,top=50,location=no,resizable=no");
	}
	else
	{
		alert("El activo debe estar grabado");	
	}
}

function ue_buscarcondicioncompra()
{
	window.open("sigesp_saf_cat_condicioncompra.php","catalogo","menubar=no,toolbar=no,scrollbars=yes,width=518,height=400,left=50,top=50,location=no,resizable=no");
}

function ue_buscarsituacion()
{
	f=document.form1;
	if(f.rbtipocat[0].checked==true)
	{
		window.open("sigesp_saf_cat_situacioncontable.php","catalogo","menubar=no,toolbar=no,scrollbars=yes,width=518,height=400,left=50,top=50,location=no,resizable=no");
    }
	else
	{
		alert("La Configuración de Activos Fijos no Permite esta Opción");	
	}
}

function ue_buscarfuente()
{
	f=document.form1;
	if(f.rbtipocat[0].checked==true)
	{
		window.open("sigesp_saf_cat_fuentefinanciamiento.php","catalogo","menubar=no,toolbar=no,scrollbars=yes,width=518,height=400,left=50,top=50,location=no,resizable=no");
    }
	else
	{
		alert("La Configuración de Activos Fijos no Permite esta Opción");	
	}
}

function ue_buscarcondicion()
{
	window.open("sigesp_saf_cat_condicion.php","catalogo","menubar=no,toolbar=no,scrollbars=yes,width=518,height=400,left=50,top=50,location=no,resizable=no");
}

function ue_buscarspg()
{
	window.open("sigesp_saf_cat_ctasspg.php","catalogo","menubar=no,toolbar=no,scrollbars=yes,width=620,height=400,left=50,top=50,location=no,resizable=no");
}

function ue_buscarpais()
{
	f=document.form1;
	window.open("sigesp_saf_cat_pais.php","catalogo","menubar=no,toolbar=no,scrollbars=yes,width=518,height=400,left=50,top=50,location=no,resizable=no");
	f.txtcodest.value="";
	f.txtdesest.value="";
	f.txtcodmun.value="";
	f.txtdesmun.value="";
}

function ue_buscarestado()
{
	f=document.form1;
	codpai=ue_validarvacio(f.txtcodpai.value);
	if(codpai!="")
	{
		window.open("sigesp_saf_cat_estado.php?codpai="+codpai+"","catalogo","menubar=no,toolbar=no,scrollbars=yes,width=518,height=400,left=50,top=50,location=no,resizable=no");
	}
	else
	{
		alert("Debe seleccionar un pais.");
	}
	f.txtcodmun.value="";
	f.txtdesmun.value="";

}

function ue_buscarmunicipio()
{
	f=document.form1;
	codpai=ue_validarvacio(f.txtcodpai.value);
	codest=ue_validarvacio(f.txtcodest.value);
	if((codpai!="")||(codest!=""))
	{
		window.open("sigesp_saf_cat_municipio.php?codpai="+codpai+"&codest="+codest+"","catalogo","menubar=no,toolbar=no,scrollbars=yes,width=518,height=400,left=50,top=50,location=no,resizable=no");
	}
	else
	{
		alert("Debe seleccionar un pais y un estado.");
	}
}

function ue_catalogo()
{
    f=document.form1;
	if(f.rbtipocat[0].checked==true)
	{
	    window.open("sigesp_saf_cat_sigecof.php","catalogo","menubar=no,toolbar=no,scrollbars=yes,width=518,height=400,left=50,top=50,location=no,resizable=yes");
    }
	else
	{
		alert("No se ha seleccionado la busqueda de catalogo sigescof");	
	}
}

function ue_catalogo_sudeban()
{
	tipo="activos";
    window.open("sigesp_saf_cat_catsudeban.php?tipo="+tipo,"catalogo","menubar=no,toolbar=no,scrollbars=yes,width=518,height=400,left=50,top=50,location=no,resizable=yes");
}

function ue_buscarorden()
{
	window.open("sigesp_saf_cat_ordencompra.php","catalogo","menubar=no,toolbar=no,scrollbars=yes,width=600,height=400,left=50,top=50,location=no,resizable=no");
}

function ue_buscarpago()
{
	window.open("sigesp_saf_cat_solicitudpago.php","catalogo","menubar=no,toolbar=no,scrollbars=yes,width=600,height=400,left=50,top=50,location=no,resizable=no");
}
//--------------------------------------------------------
//  Funciones de las operaciones de la páginas
//--------------------------------------------------------
function ue_nuevo()
{
	f=document.form1;
	li_incluir=f.incluir.value;
	if(li_incluir==1)
	{	
		f.operacionact.value="NUEVO";
		f.action="sigesp_saf_d_activossigecof.php";
		f.submit();
	}
	else
   	{
 		alert("No tiene permiso para realizar esta operacion");
   	}
}
function ue_guardar()
{
	f=document.form1;
	li_incluir=f.incluir.value;
	li_cambiar=f.cambiar.value;
	lb_status=f.hidstatusact.value;
	if(((lb_status=="C")&&(li_cambiar==1))||(lb_status=="")&&(li_incluir==1))
	{
		f.operacionact.value="GUARDAR";
		f.action="sigesp_saf_d_activossigecof.php";
		f.submit();
	}
	else
   	{
 		alert("No tiene permiso para realizar esta operacion");
   	}
}

function ue_buscar()
{
	f=document.form1;
	li_leer=f.leer.value;
	if (li_leer==1)
   	{
		window.open("sigesp_saf_cat_activo.php","catalogo","menubar=no,toolbar=no,scrollbars=yes,width=570,height=400,left=50,top=50,location=no,resizable=yes");
   	}
	else
   	{
 		alert("No tiene permiso para realizar esta operacion");
   	}
}

function ue_eliminar()
{
	f=document.form1;
	li_eliminar=f.eliminar.value;
	if(li_eliminar==1)
	{	
		if(confirm("¿Seguro desea eliminar el Activo?"))
		{
			f.operacionact.value="ELIMINAR";
			f.action="sigesp_saf_d_activossigecof.php";
			f.submit();
		}
	}
	else
   	{
 		alert("No tiene permiso para realizar esta operacion");
   	}
}

function ue_cerrar()
{
	close();
}

////////////////////////    Validar la Fecha     ///////////////////////////
var patron = new Array(2,2,4)
var patron2 = new Array(1,3,3,3,3)
function ue_separadores(d,sep,pat,nums){
if(d.valant != d.value){
	val = d.value
	largo = val.length
	val = val.split(sep)
	val2 = ''
	for(r=0;r<val.length;r++){
		val2 += val[r]	
	}
	if(nums){
		for(z=0;z<val2.length;z++){
			if(isNaN(val2.charAt(z))){
				letra = new RegExp(val2.charAt(z),"g")
				val2 = val2.replace(letra,"")
			}
		}
	}
	val = ''
	val3 = new Array()
	for(s=0; s<pat.length; s++){
		val3[s] = val2.substring(0,pat[s])
		val2 = val2.substr(pat[s])
	}
	for(q=0;q<val3.length; q++){
		if(q ==0){
			val = val3[q]
		}
		else{
			if(val3[q] != ""){
				val += sep + val3[q]
				}
		}
	}
	d.value = val
	d.valant = val
	}
}
//--------------------------------------------------------
//	Función que obtiene el valor de el radio button
//--------------------------------------------------------
function actualizaValor(oRad)
{ 
	ObjForm.ValidarTipo();
	var i; 
	f=document.form1;
	for (i=0;i<f.radiotipo.length;i++)
	{ 
	   if (f.radiotipo[i].checked) 
		  break; 
	} 
	valor= i;
	f.hidradio.value=i;
	if (f.radiotipo[1].checked)
	{
		fila1=document.getElementById("fila1");
		fila2=document.getElementById("fila2");	
		fila1.style.display="";
		fila1.style.display="compact";
		fila2.style.display="";
		fila2.style.display="compact";		
	}
	else
	{
		fila1=document.getElementById("fila1");
		fila2=document.getElementById("fila2");	
		fila1.style.display="";
		fila1.style.display="none";
		fila2.style.display="";
		fila2.style.display="none";	
		f.chkdepreciable.checked=true;
	    f.chkdepreciable.value=1;
	    f.chkdepreciable.disabled=false;
		f.cmbclasi.value="";	
	}
} 
   
function ue_catalogo_grupo()
{
	f=document.form1;
	if(f.rbtipocat[1].checked==true)
	{
		window.open("sigesp_saf_cat_grupo.php?tipo=ACTIVOS","catalogo","menubar=no,toolbar=no,scrollbars=yes,width=518,height=400,left=50,top=50,location=no,resizable=yes");
		f.txtcodsubgru.value="";
		f.txtdensubgru.value="";
		f.txtcodsec.value="";
		f.txtdensec.value="";
	}
	else
	{
		alert("No se ha seleccionado la busqueda de catalogo por categoría CGR");	
	}
}
   
function ue_catalogo_subgrupo()
{
	f=document.form1;
	codgru=ue_validarvacio(f.txtcodgru.value);
	dengru=ue_validarvacio(f.txtdengru.value);
	if(f.rbtipocat[1].checked==true)
	{
		if((codgru!="---")||(codgru!=""))
		{
			window.open("sigesp_saf_cat_subgrupo.php?txtcodgru="+codgru+"&txtdengru="+dengru+"&tipo=ACTIVOS","catalogo","menubar=no,toolbar=no,scrollbars=yes,width=518,height=400,left=50,top=50,location=no,resizable=yes");
			f.txtcodsec.value="";
			f.txtdensec.value="";
		}
		else
		{
			alert("Debe seleccionar un grupo.");
		}
	}
	else
	{
		alert("No se ha seleccionado la busqueda de catalogo por categoría CGR");	
	}
}

function ue_catalogo_seccion()
{
	f=document.form1;
	codgru=ue_validarvacio(f.txtcodgru.value);
	dengru=ue_validarvacio(f.txtdengru.value);
	codsubgru=ue_validarvacio(f.txtcodsubgru.value);
	densubgru=ue_validarvacio(f.txtdensubgru.value);
	if(f.rbtipocat[1].checked==true)
	{
		if((codgru!="---")||(codsubgru!="---")||(codgru!="")||(codsubgru!=""))
		{
			window.open("sigesp_saf_cat_seccion.php?txtcodgru="+codgru+"&txtdengru="+dengru+"&txtcodsubgru="+codsubgru+"&txtdensubgru="+densubgru+"&tipo=ACTIVOS","catalogo","menubar=no,toolbar=no,scrollbars=yes,width=518,height=400,left=50,top=50,location=no,resizable=yes");
		}
		else
		{
			alert("Debe seleccionar un grupo y un subgrupo.");
		}
	}
	else
	{
		alert("No se ha seleccionado la busqueda de catalogo por categoría CGR");	
	}
}

function ue_catalogo_item()
{
	f=document.form1;
	codgru=ue_validarvacio(f.txtcodgru.value);
	dengru=ue_validarvacio(f.txtdengru.value);
	codsubgru=ue_validarvacio(f.txtcodsubgru.value);
	densubgru=ue_validarvacio(f.txtdensubgru.value);
	codsec=ue_validarvacio(f.txtcodsec.value);
	densec=ue_validarvacio(f.txtdensec.value);
	if(f.rbtipocat[1].checked==true)
	{
		if(f.radiotipo[0].checked==true)
		{
			if((codgru!="")||(codsubgru!="")||(codsec!=""))
			{
				window.open("sigesp_saf_cat_item.php?txtcodgru="+codgru+"&txtdengru="+dengru+"&txtcodsubgru="+codsubgru+"&txtdensubgru="+densubgru+"&txtcodsec="+codsec+"&txtdensec="+densec+"&tipo=ACTIVOS","catalogo","menubar=no,toolbar=no,scrollbars=yes,width=518,height=400,left=50,top=50,location=no,resizable=yes");
			}
			else
			{
				alert("Debe seleccionar grupo, subgrupo y seccion.");
			}
		}
		else
		{
			alert("El activo debe ser un Bien Mueble para habilitar esta opcion");
		}
	}
	else
	{
		alert("No se ha seleccionado la busqueda de catalogo por categoría CGR");	
	}
}

function ue_catalogo_spg()
{
	f=document.form1;
	codgru=ue_validarvacio(f.txtcodgru.value);
	codsubgru=ue_validarvacio(f.txtcodsubgru.value);
	codsec=ue_validarvacio(f.txtcodsec.value);
	estsudeban=f.estsudeban.value;
	if(estsudeban!=1)
	{
		if(f.rbtipocat[1].checked==true)
		{
			if((codgru!="---")||(codsubgru!="---")||(codsec!="---")||(codgru!="")||(codsubgru!="")||(codsec!=""))
			{
				window.open("sigesp_saf_cat_ctasspg.php","catalogo","menubar=no,toolbar=no,scrollbars=yes,width=518,height=400,left=50,top=50,location=no,resizable=yes");
			}
			else
			{
				alert("Debe seleccionar un grupo, un subgrupo y una secccion.");
			}
		}
		else
		{
			alert("No se ha seleccionado la busqueda de catalogo por categoría CGR");	
		}
	}
	else
	{
		window.open("sigesp_saf_cat_ctasspg.php","catalogo","menubar=no,toolbar=no,scrollbars=yes,width=518,height=400,left=50,top=50,location=no,resizable=yes");
	}
}

function pulsar(e) { 
    tecla=(document.all) ? e.keyCode : e.which; 
    if (tecla==13) return false;
	 
}

function descativar_depre()
{
    f=document.form1;
	f.chkdepreciable.checked=false;
	f.chkdepreciable.value=0;
	f.chkdepreciable.disabled=true;
	fila3=document.getElementById("fila3");
	fila3.style.display="";
	f.btnhojatrabajo.value="Terrenos";	
}

function ativar_depre(valor)
{
    f=document.form1;
	f.chkdepreciable.checked=true;
	f.chkdepreciable.value=1;
	f.chkdepreciable.disabled=false;
	fila3=document.getElementById("fila3");
	fila3.style.display="";
	fila3.style.display="compact";
	fila3.style.display="compact";
	if (valor=="1")
	{
		f.btnhojatrabajo.value="Edificios";
	}
	if (valor=="2")
	{
		f.btnhojatrabajo.value="Instalaciones Fijas";
	}
	
}

var ObjForm = {	 
	 'facturas': new Array, 	 
	 'ruta': ruta, 
	 'criterio': '',
	 'claveRow': 0,
	 'contenedor':'resultados',
	 'f': document.form1,
	 'campo': function (idcampo) {
		            if(document.getElementById(idcampo)==null){alert("No existe el campo: " + idcampo); return;}
					return document.getElementById(idcampo).value;
				},
	 'CargarCampo': function (idcampo,valor) {
						if(document.getElementById(idcampo)==null){alert("No existe el campo: " + idcampo); return;}
						document.getElementById(idcampo).value = valor;
						return;
					},
'CargarCampoNumeric': function (nomclav,valor) {
							this.CargarCampo(nomclav,this.FormatoNumero(valor, 2, ',', '.'));				
							return;
						},
	'campoNumeric': function (idcampo) {	                
						valor=parseFloat(formato_numerico_ingles(this.campo(idcampo)));						
						return valor;
					},
	'CargarSelect': function (idcampo,valor) {
						if(document.getElementById(idcampo)==null){alert("No existe el campo: " + idcampo); return;}
						seleccionar_combo(idcampo,valor);
						return;
					},
'LimpiarContenedor':function (id) {
	                    if(document.getElementById(id)==null){alert("No existe el contenedor: " + id); return;}
						document.getElementById(id).innerHTML="";
		           },
'ComparaFechas':function (desde,hasta){							
						return DiasEntreFechas(desde,hasta);						
					},
  'BolquearCampo':function (id,condicion){	
                    if(document.getElementById(id)==null){alert("No existe el campo: " + id); return;}
					document.getElementById(id).disabled=condicion;					
				  },
'campoFila': function (nomclav) {	                
						if(!this.fila){return;}
						idcampo = nomclav + this.fila;
						if(document.getElementById(idcampo)==null){alert("No existe el campo: " + idcampo); return;}
						return document.getElementById(idcampo).value;
					},
'campoFilaGrid': function (nomclav) {	                
						if(!this.fila){return;}
						idcampo = this.gridId + '-cell-' + nomclav + this.fila;
						if(document.getElementById(idcampo)==null){alert("No existe el campo: " + idcampo); return;}
						return document.getElementById(idcampo).value;
					},
'campoFilaGridNumeric': function (nomclav) {	                
							valor=parseFloat(formato_numerico_ingles(this.campoFilaGrid(nomclav)));						
							return valor;
						},
'CargarCampoFilaGrid': function (nomclav,valor) {
						if(!this.fila){return;}
						idcampo = this.gridId + '-cell-' + nomclav + this.fila;
						if(document.getElementById(idcampo)==null){alert("No existe el campo: " + idcampo); return;}
						document.getElementById(idcampo).value = valor;
						return;
					},
'CargarCampoGridFilaNumeric': function (nomclav,valor) {
								this.CargarCampoFilaGrid(nomclav,this.FormatoNumero(valor, 2, ',', '.'));				
								return;
							},
		'ChkGrid': function (nomclav,cond) {	                
					if(!this.fila){return;}
					idcampo = this.gridId + '-cell-' + nomclav + this.fila;
					if(document.getElementById(idcampo)==null){alert("No existe el campo check: " + idcampo); return;}
					document.getElementById(idcampo).checked = cond;
					return true;
				},
'campoFilaGridChk': function (nomclav) {	                
						if(!this.fila){return;}
						idcampo = this.gridId + '-cell-' + nomclav + this.fila;
						if(document.getElementById(idcampo)==null){alert("No existe el campo check: " + idcampo); return;}
						document.getElementById(idcampo).checked;
						return document.getElementById(idcampo).checked;
					},
		'campoChk': function (idcampo) {
						if(document.getElementById(idcampo)==null){alert("No existe el campo check: " + idcampo); return;}
						tildado = (document.getElementById(idcampo).checked)?1:0;
						return tildado;
					},
	'CargarCampoChk': function (idcampo,valor) {
						if(document.getElementById(idcampo)==null){alert("No existe el campo check: " + idcampo); return;}
						tildado = (valor)?true:false;
						document.getElementById(idcampo).checked=tildado;
						return true;
					},
	'campoRadio': function (idcampo) {						
						valor = $("input[name='" + idcampo + "']:checked").val();
						valor = valor===undefined?"":valor;
						return valor;
					},
	'FormatoNumero':function (numero, decimales, separador_decimal, separador_miles){
							numero=parseFloat(numero);
							if(isNaN(numero)){
								return "";
							}
						
							if(decimales!==undefined){
								// Redondeamos
								numero=numero.toFixed(decimales);
							}
						
							// Convertimos el punto en separador_decimal
							numero=numero.toString().replace(".", separador_decimal!==undefined ? separador_decimal : ",");
						
							if(separador_miles){
								// Añadimos los separadores de miles
								var miles=new RegExp("(-?[0-9]+)([0-9]{3})");
								while(miles.test(numero)) {
									numero=numero.replace(miles, "$1" + separador_miles + "$2");
								}
							}
						
							return numero;
				 },
   'campoTxtAjax': function (campo) {
		                id = "h"+campo+this.claveRow;
						if(document.getElementById(id)==null){alert("No existe el campo: " + id); return;}					
						return document.getElementById(id).value;
					},
	 'datos': function (param) {
		 				 
						 switch(this.criterio){
							   
							   case 'DatosOrigen':	
							   case 'FormOrigen':
							        ori_codori="";
									if(document.getElementById("ori_codori")!=null){ori_codori=this.campo('ori_codori');}
									datos = "criterio=" + this.criterio +
											"&codforadq=" + this.campo('cmbforadq') + 
											"&ori_codforadq=" + this.campo('cmbforadq') + 											
											"&ori_codori=" + ori_codori + 
											"&codact=" + this.campo('txtcodact');									 
									break;
							    case 'CargarOrigen':									
									datos = "criterio=DatosOrigen" +
											"&codforadq=" + this.campo('cmbforadq') + 
											"&ori_codforadq=" + this.campo('cmbforadq') + 
											"&ori_codori=" + this.campo('hcodori') + 
											"&codori=" + this.campo('hcodori') + 											
											"&codact=" + this.campo('txtcodact');									 
									break;						 
						 }
						 
						 return datos;
					 }, 	 
	 'EnviarAjax':function (param) {	               
					window.enviar_ajax(this.datos(),this.ArchivoAjax,this.contenedor,'POST','',this.ruta);	
				 },  
	  'BuscarFormOrigen':function (param) {
		 				this.criterio='FormOrigen';
		 				this.contenedor='divorigen';
						this.ArchivoAjax='covensol_saf_d_origen_adquisicion_ajax.php';
						this.EnviarAjax();
					 },
	'BuscarOrigen':function (param) {
		 				this.criterio='DatosOrigen';
		 				this.contenedor='divorigen';
						this.ArchivoAjax='covensol_saf_d_origen_adquisicion_ajax.php';
						this.EnviarAjax();
					 },
	'CargarOrigen':function (param) {
		 				this.criterio='CargarOrigen';
		 				this.contenedor='divorigen';
						this.ArchivoAjax='covensol_saf_d_origen_adquisicion_ajax.php';
						this.EnviarAjax();
					 },
	  'GuardarDatos':function (param) {
		 				this.criterio='guardar';
		 				this.contenedor='resultados';
						this.ArchivoAjax='sigesp_saf_d_activossigecof_ajax.php';
						this.EnviarAjax();
					 },
	  'ModificarDatos':function (param) {
		 				this.criterio='modificar';
		 				this.contenedor='resultados';
						this.EnviarAjax();
					 },
	  'EliminarRegistro':function (param) {
		 				this.criterio='eliminar';
		 				this.contenedor='resultados';
						this.EnviarAjax();
					 },
	   'Guardar':function (param) {
		   				f=document.form1;
						if(!this.ValidaEntrada()){return;}						
						if(document.form1.hnrotal.value == ""){	
						        if(this.campo("cmbesttal")!='ACT'){mensajes_sigesp("VALIDACIÓN DE DATOS","El talonario debe estar en estatus activo !"); return;}
								if(f.incluir.value!='1'){mensajes_sigesp("VALIDACIÓN DE DATOS","No tiene permisos para guardar!"); return;}								
								valido = confirm("CONFIRMACIÓN DE DATOS" + '\n\n' + "Se va a agregar un talonario " + '\n\n' + "¿Esta de acuerdo?");
								if(valido){this.GuardarDatos();}
								return;
						}
						if(document.form1.hnrotal.value != ""){
								if(f.cambiar.value!='1'){mensajes_sigesp("VALIDACIÓN DE DATOS","No tiene permisos para modificar!"); return;}								
								valido = confirm("CONFIRMACIÓN DE DATOS" + '\n\n' + "Se va a modificar un talonario" + '\n\n' + "¿Esta de acuerdo?");
								if(valido){this.ModificarDatos();}
								return;
						}		   				
		   		},		
		'Eliminar':function (param) {
								f=document.form1;
								if(!f.hnrotal.value){
										mensajes_sigesp("VALIDACIÓN DE DATOS","Cargue primero el Talonario !");
										return;	
								}		
								if(!f.eliminar.value){
										mensajes_sigesp("VALIDACIÓN DE DATOS","No tiene permisos para eliminar.");
										return;	
								}
								if(f.hnrotal.value != ""){									
									valido = confirm("CONFIRMACIÓN DE DATOS" + '\n\n' + "Se va a eliminar un Talonario " + '\n\n' + "¿Esta de acuerdo?");
									if(valido){this.EliminarRegistro();}
									return;
								}
		
						},
		 'ValidaEntrada':function (param) {
			 			
								f=document.form1;	
																
								if(!this.campo("txtcodsuc")){		
									mensajes_sigesp("VALIDACIÓN DE DATOS","Seleccione la sucursal por favor!");		
									f.txtcodsuc.focus();
									return false;
								}
								
								return true;
						 },
		'InitForm':function (param) {
									this.Carga = true;
									this.ValidarTipo();
									this.Carga = false;
									if(this.campo("txtcodact")&&this.campo("cmbforadq")){	       
											if(this.campo("hcodori")){this.CargarOrigen();}else{this.BuscarFormOrigen();}
									};		 
						  },
		   'Salir':function (param) {
							window.close();
						  },

  'BuscarCatalogo':function (catalogo) {
					switch(catalogo){
							case 'Proveedor_Origen':							   
								window.open('sigesp_saf_cat_prov.php','','toolbar=no,directories=no,location=no, width=700, height=300, scrollbars=yes, top=0, left=0, estatus=no');
							break;
							
							case 'talonario':							    
								window.open('covensol_cxc_cat_talonarios.php','','toolbar=no,directories=no,location=no, width=700, height=300, scrollbars=yes, top=0, left=0, estatus=no');
							break;
						}	
				  },
	 'ValidarTipo':function () {
								
								//1=MUEBLE 2=INMUEBLE 3=SEMOVIENTE
								this.LimpiarDatosParticulares();
								this.OcultarDatosParticulares();
								switch(this.campoRadio("radiotipo")){
									
									case '1':
										this.BolquearCampo('esvehiculo',false);
										//VEHÍCULOS
										if(this.campoChk("esvehiculo")){
											this.BolquearCampo('cmbtipveh',false);										
											this.BolquearCampo('serialcar',false);
											this.BolquearCampo('serialmot',false);
											this.BolquearCampo('sigplaca',false);
											this.BolquearCampo('nrotitprop',false);
											this.BolquearCampo('capacidad',false);
											this.BolquearCampo('cmbunimedcap',false);
											this.BolquearCampo('sisrastreo',false);
											this.BolquearCampo('espsisrast',false);
											this.BolquearCampo('anofabveh',false);
										}
										else{
											this.BolquearCampo('cmbtipveh',true);										
											this.BolquearCampo('serialcar',true);
											this.BolquearCampo('serialmot',true);
											this.BolquearCampo('sigplaca',true);
											this.BolquearCampo('nrotitprop',true);
											this.BolquearCampo('capacidad',true);
											this.BolquearCampo('cmbunimedcap',true);
											this.BolquearCampo('sisrastreo',true);
											this.BolquearCampo('espsisrast',true);
											this.BolquearCampo('anofabveh',true);										
										}
										//SEMOVIENTES
										this.BolquearCampo('cmbtipani',true);
										this.BolquearCampo('cmbprosem',true);
										this.BolquearCampo('cmbraza',true);
										this.BolquearCampo('cmbgenero',true);
										this.BolquearCampo('peso',true);
										this.BolquearCampo('cmbunimedpeso',true);
										this.BolquearCampo('nrohierro',true);
										this.BolquearCampo('senas',true);
										this.BolquearCampo('fecnacsem',true);
										
										//INMUEBLES
										this.BolquearCampo('cmbusoedi',true);
										this.BolquearCampo('urbaniza',true);
										this.BolquearCampo('calleave',true);
										this.BolquearCampo('casaedif',true);
										this.BolquearCampo('oficregistro',true);
										this.BolquearCampo('refregistro',true);
										this.BolquearCampo('tomo',true);
										this.BolquearCampo('folio',true);
										this.BolquearCampo('protocoloreg',true);
										this.BolquearCampo('nroregistro',true);
										this.BolquearCampo('fecregistro',true);
										this.BolquearCampo('propanterior',true);
										this.BolquearCampo('areaconst',true);
										this.BolquearCampo('cmbunimedarea',true);
										break;
									
									case '2':										
										this.CargarCampoChk('esvehiculo',false);
										this.BolquearCampo('esvehiculo',true);
										//VEHÍCULOS
										this.BolquearCampo('cmbtipveh',true);										
										this.BolquearCampo('serialcar',true);
										this.BolquearCampo('serialmot',true);
										this.BolquearCampo('sigplaca',true);
										this.BolquearCampo('nrotitprop',true);
										this.BolquearCampo('capacidad',true);
										this.BolquearCampo('cmbunimedcap',true);
										this.BolquearCampo('sisrastreo',true);
										this.BolquearCampo('espsisrast',true);
										this.BolquearCampo('anofabveh',true);
										
										//SEMOVIENTES
										this.BolquearCampo('cmbtipani',true);
										this.BolquearCampo('cmbprosem',true);
										this.BolquearCampo('cmbraza',true);
										this.BolquearCampo('cmbgenero',true);
										this.BolquearCampo('peso',true);
										this.BolquearCampo('cmbunimedpeso',true);
										this.BolquearCampo('nrohierro',true);
										this.BolquearCampo('senas',true);
										this.BolquearCampo('fecnacsem',true);
										
										//INMUEBLES										
										this.BolquearCampo('cmbusoedi',false);
										this.BolquearCampo('urbaniza',false);
										this.BolquearCampo('calleave',false);
										this.BolquearCampo('casaedif',false);
										this.BolquearCampo('oficregistro',false);
										this.BolquearCampo('refregistro',false);
										this.BolquearCampo('tomo',false);
										this.BolquearCampo('folio',false);
										this.BolquearCampo('protocoloreg',false);
										this.BolquearCampo('nroregistro',false);
										this.BolquearCampo('fecregistro',false);
										this.BolquearCampo('propanterior',false);
										this.BolquearCampo('areaconst',false);
										this.BolquearCampo('cmbunimedarea',false);
										
										break;
										
									case '3':							    
										
										this.CargarCampoChk('esvehiculo',false);
										this.BolquearCampo('esvehiculo',true);
										
										//VEHÍCULOS
										this.BolquearCampo('cmbtipveh',true);										
										this.BolquearCampo('serialcar',true);
										this.BolquearCampo('serialmot',true);
										this.BolquearCampo('sigplaca',true);
										this.BolquearCampo('nrotitprop',true);
										this.BolquearCampo('capacidad',true);
										this.BolquearCampo('cmbunimedcap',true);
										this.BolquearCampo('sisrastreo',true);
										this.BolquearCampo('espsisrast',true);
										this.BolquearCampo('anofabveh',true);
										
										//SEMOVIENTES
										this.BolquearCampo('cmbtipani',false);
										this.BolquearCampo('cmbprosem',false);
										this.BolquearCampo('cmbraza',false);
										this.BolquearCampo('cmbgenero',false);
										this.BolquearCampo('peso',false);
										this.BolquearCampo('cmbunimedpeso',false);
										this.BolquearCampo('nrohierro',false);
										this.BolquearCampo('senas',false);
										this.BolquearCampo('fecnacsem',false);
										
										//INMUEBLES
										this.BolquearCampo('cmbusoedi',true);
										this.BolquearCampo('urbaniza',true);
										this.BolquearCampo('calleave',true);
										this.BolquearCampo('casaedif',true);
										this.BolquearCampo('oficregistro',true);
										this.BolquearCampo('refregistro',true);
										this.BolquearCampo('tomo',true);
										this.BolquearCampo('folio',true);
										this.BolquearCampo('protocoloreg',true);
										this.BolquearCampo('nroregistro',true);
										this.BolquearCampo('fecregistro',true);
										this.BolquearCampo('propanterior',true);
										this.BolquearCampo('areaconst',true);
										this.BolquearCampo('cmbunimedarea',true);
										
										break;
										
									case '':
										
										this.CargarCampoChk('esvehiculo',false);
										this.BolquearCampo('esvehiculo',true);
										
										//VEHÍCULOS
										this.BolquearCampo('cmbtipveh',true);										
										this.BolquearCampo('serialcar',true);
										this.BolquearCampo('serialmot',true);
										this.BolquearCampo('sigplaca',true);
										this.BolquearCampo('nrotitprop',true);
										this.BolquearCampo('capacidad',true);
										this.BolquearCampo('cmbunimedcap',true);
										this.BolquearCampo('sisrastreo',true);
										this.BolquearCampo('espsisrast',true);
										this.BolquearCampo('anofabveh',true);
										
										//SEMOVIENTES
										this.BolquearCampo('cmbtipani',true);
										this.BolquearCampo('cmbprosem',true);
										this.BolquearCampo('cmbraza',true);
										this.BolquearCampo('cmbgenero',true);
										this.BolquearCampo('peso',true);
										this.BolquearCampo('cmbunimedpeso',true);
										this.BolquearCampo('nrohierro',true);
										this.BolquearCampo('senas',true);
										this.BolquearCampo('fecnacsem',true);
										
										//INMUEBLES
										this.BolquearCampo('cmbusoedi',true);
										this.BolquearCampo('urbaniza',true);
										this.BolquearCampo('calleave',true);
										this.BolquearCampo('casaedif',true);
										this.BolquearCampo('oficregistro',true);
										this.BolquearCampo('refregistro',true);
										this.BolquearCampo('tomo',true);
										this.BolquearCampo('folio',true);
										this.BolquearCampo('protocoloreg',true);
										this.BolquearCampo('nroregistro',true);
										this.BolquearCampo('fecregistro',true);
										this.BolquearCampo('propanterior',true);
										this.BolquearCampo('areaconst',true);
										this.BolquearCampo('cmbunimedarea',true);
										
										break;
								}
								
								
							
						  },
  
'OcultarDatosParticulares':function (param) {
									
									DatVeh=document.getElementById("filavehiculo");
									DatInm=document.getElementById("filainmueble");
									DatSem=document.getElementById("filasemoviente");
									
									switch(this.campoRadio("radiotipo")){
										case '1':
											
											if(this.campoChk("esvehiculo")){
												DatVeh.style.display="";
												DatVeh.style.display="compact";
												DatInm.style.display="";
												DatInm.style.display="none";
												DatSem.style.display="";
												DatSem.style.display="none";
											}
											else{
												DatVeh.style.display="";
												DatVeh.style.display="none";
												DatInm.style.display="";
												DatInm.style.display="none";
												DatSem.style.display="";
												DatSem.style.display="none";											
										    }
											break;
										
										case '2':							    
											DatVeh.style.display="";
											DatVeh.style.display="none";
											DatInm.style.display="";
											DatInm.style.display="compact";
											DatSem.style.display="";
											DatSem.style.display="none";
											break;
										
										case '3':							    
											DatVeh.style.display="";
											DatVeh.style.display="none";
											DatInm.style.display="";
											DatInm.style.display="none";
											DatSem.style.display="";
											DatSem.style.display="compact";
											break;
											
										case '':							    
											DatVeh.style.display="";
											DatVeh.style.display="none";
											DatInm.style.display="";
											DatInm.style.display="none";
											DatSem.style.display="";
											DatSem.style.display="none";	
											break;
									}	
									
						  },
'LimpiarDatosParticulares':function (param) {
									//CargarCampo
									//CargarSelect
									//this.CargarCampoChk('',false);
									
									if(ObjForm.Carga){return;}
									
									this.CargarCampo('cmbtipveh',"");									
									this.CargarCampo('serialcar',"");
									this.CargarCampo('serialmot',"");
									this.CargarCampo('sigplaca',"");
									this.CargarCampo('nrotitprop',"");
									this.CargarCampo('capacidad',"0,00");
									this.CargarCampo('cmbunimedcap',"");
									this.CargarCampoChk('sisrastreo',false);
									this.CargarCampo('espsisrast',"");
									this.CargarCampo('anofabveh',"");
																		
									this.CargarCampo('cmbtipani',"");
									this.CargarCampo('cmbprosem',"");
									this.CargarCampo('cmbraza',"");
									this.CargarCampo('cmbgenero',"");
									this.CargarCampo('peso',"0,00");
									this.CargarCampo('cmbunimedpeso',"");
									this.CargarCampo('nrohierro',"");
									this.CargarCampo('senas',"");
									this.CargarCampo('fecnacsem',"01/01/1900");
									
									
									this.CargarCampo('urbaniza',"");
									this.CargarCampo('calleave',"");
									this.CargarCampo('casaedif',"");
									this.CargarCampo('oficregistro',"");
									this.CargarCampo('refregistro',"");
									this.CargarCampo('tomo',"");
									this.CargarCampo('folio',"");
									this.CargarCampo('protocoloreg',"");
									this.CargarCampo('nroregistro',"");
									this.CargarCampo('fecregistro',"01/01/1900");
									this.CargarCampo('propanterior',"");
									this.CargarCampo('areaconst',"0,00");
									this.CargarCampo('cmbunimedarea',"");
									
						  },
	  
}


$(document).ready(function() {
	window.ObjForm=ObjForm;
	ObjForm.InitForm();
	
});
</script> 
<script language="javascript" src="../shared/js/js_intra/datepickercontrol.js"></script>

</html>