2 // vim: set expandtab tabstop=4 softtabstop=4 shiftwidth=4:
3 // +----------------------------------------------------------------------+
5 // +----------------------------------------------------------------------+
6 // | Copyright (c) 1997-2003 The PHP Group |
7 // +----------------------------------------------------------------------+
8 // | This source file is subject to version 2.02 of the PHP license, |
9 // | that is bundled with this package in the file LICENSE, and is |
10 // | available at through the world-wide-web at |
11 // | http://www.php.net/license/2_02.txt. |
12 // | If you did not receive a copy of the PHP license and are unable to |
13 // | obtain it through the world-wide-web, please send a note to |
14 // | license@php.net so we can mail you a copy immediately. |
15 // +----------------------------------------------------------------------+
16 // | Created: Thu Jun 19 15:17:11 2003
17 // | Author: Gonzalo Merayo <gmeray@mecon.gov.ar>
18 // +----------------------------------------------------------------------+
27 #require_once 'PEAR.php';
28 require_once 'DB.php';
29 require_once 'MECON/Tiempo/Hora.php';
34 // +X2C Class 131 :Agente
58 function getDependencia() // ~X2C
60 return $this->datos['codep'];//TODO esta no es la columna correcta
69 function getTipo() // ~X2C
71 if(is_null($this->datos['tipo_agente']))
72 return 'CON '.$this->datos['marco_legal'];
74 return $this->datos['tipo_agente'];
86 function Agente($agente) // ~X2C
88 $this->agente = $agente;
89 $dsn = 'mysql://intranet:intranet@intranet-db/novedades';
90 $db = DB::connect($dsn);
91 if (DB::isError($db)) die ($db->getMessage("No pudo conectarse a la base"));
94 WHERE nrodoc = $agente";
95 $result = $db->query($sql);
96 if(DB::isError($result))
97 die($result->getMessage("query mal hecho"));
98 if($result->numRows() > 0)
100 $this->datos = $result->fetchRow(DB_FETCHMODE_ASSOC);
104 $dsn = 'mysql://intranet:intranet@intranet-db/Contratados';
105 $db = DB::connect($dsn);
106 if (DB::isError($db)) die ($db->getMessage("No pudo conectarse a la base"));
109 WHERE nrodoc = $agente";
110 $result = $db->query($sql);
111 if(DB::isError($result))
112 die($result->getMessage("query mal hecho"));
113 if($result->numRows() > 0)
115 $this->datos = $result->fetchRow(DB_FETCHMODE_ASSOC);
118 trigger_error("Ahhhhh, agente no encontrado!");
123 // +X2C Operation 138
128 function getNombre() // ~X2C
130 return $this->datos['nombre'];
134 // +X2C Operation 139
139 function getHoraDesde() // ~X2C
141 if(is_null($this->datos['hentra']))
142 return new Hora($this->datos['hora_desde']);
144 return new Hora($this->datos['hentra']);
148 // +X2C Operation 140
153 function getHoraHasta() // ~X2C
155 if(is_null($this->datos['hsale']))
156 return new Hora($this->datos['hora_hasta']);
158 return new Hora($this->datos['hsale']);
162 // +X2C Operation 149
167 function getCuil()// ~X2C
169 $aux = $this->datos['cuil'];
170 $aux = preg_replace('/(\d{2})(\d*)(\d{1})/','$1-$2-$3',$aux);
175 // +X2C Operation 151
180 function getOtrosDatos()// ~X2C
182 if(!is_null($this->datos['tipo_agente'])) {
183 $aux['tipo_doc'] = $this->datos['tipodoc'];
184 $aux['fecha_nac'] = $this->datos['fecha_nac'];
185 $aux['edad'] = $this->datos['edad'];
186 $aux['estado_civil'] = $this->datos['estado_civil'];
187 $aux['domicilio'] = $this->datos['domicilio'];
188 $aux['puerta'] = $this->datos['num_puerta'];
189 $aux['piso'] = $this->datos['piso'];
190 $aux['depto'] = $this->datos['depto'];
191 $aux['localidad'] = $this->datos['localidad'];
192 $aux['provincia'] = $this->datos['provincia'];
193 $aux['calle1'] = $this->datos['calle1'];
194 $aux['calle2'] = $this->datos['calle2'];
195 $aux['cp'] = $this->datos['cp'];
196 $aux['telefono'] = $this->datos['telefono'];
197 $aux['cargo'] = $this->datos['cargo'];
198 $aux['nivel'] = $this->datos['nivel'];
199 $aux['grado'] = $this->datos['grado'];
200 $aux['func_ejec'] = $this->datos['func_ejec'];
201 $aux['obra_social'] = $this->datos['obra_social'];
202 $aux['afiliado'] = $this->datos['afiliado'];
203 $aux['conyuge'] = $this->datos['conyuge'];
204 $aux['fecha_nac_conyuge'] = $this->datos['fecha_nac_cony'];
205 $aux['tipo_doc_conyuge'] = $this->datos['tipodoc_cony'];
206 $aux['nro_doc_cony'] = $this->datos['nrodoc_cony'];
211 } // -X2C Class :Agente