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
59 function getDependencia() // ~X2C
61 return $this->datos['codep'];//TODO esta no es la columna correcta
70 function getTipo() // ~X2C
72 if(is_null($this->datos['tipo_agente']))
73 return 'CON '.$this->datos['marco_legal'];
75 return $this->datos['tipo_agente'];
87 function Agente($agente) // ~X2C
89 if(! is_null($agente))
90 $this->buscarAgente($agente);
99 function getNombre() // ~X2C
101 return $this->datos['nombre'];
105 // +X2C Operation 139
110 function getHoraDesde() // ~X2C
112 if(is_null($this->datos['hentra']))
113 return new Hora($this->datos['hora_desde']);
115 return new Hora($this->datos['hentra']);
119 // +X2C Operation 140
124 function getHoraHasta() // ~X2C
126 if(is_null($this->datos['hsale']))
127 return new Hora($this->datos['hora_hasta']);
129 return new Hora($this->datos['hsale']);
133 // +X2C Operation 149
138 function getCuil() // ~X2C
140 $aux = $this->datos['cuil'];
141 $aux = preg_replace('/(\d{2})(\d*)(\d{1})/','$1-$2-$3',$aux);
146 // +X2C Operation 151
151 function getOtrosDatos() // ~X2C
153 if(!is_null($this->datos['tipo_agente'])) {
154 $aux['tipo_doc'] = $this->datos['tipodoc'];
155 $aux['fecha_nac'] = $this->datos['fecha_nac'];
156 $aux['edad'] = $this->datos['edad'];
157 $aux['estado_civil'] = $this->datos['estado_civil'];
158 $aux['domicilio'] = $this->datos['domicilio'];
159 $aux['puerta'] = $this->datos['num_puerta'];
160 $aux['piso'] = $this->datos['piso'];
161 $aux['depto'] = $this->datos['depto'];
162 $aux['localidad'] = $this->datos['localidad'];
163 $aux['provincia'] = $this->datos['provincia'];
164 $aux['calle1'] = $this->datos['calle1'];
165 $aux['calle2'] = $this->datos['calle2'];
166 $aux['cp'] = $this->datos['cp'];
167 $aux['telefono'] = $this->datos['telefono'];
168 $aux['cargo'] = $this->datos['cargo'];
169 $aux['nivel'] = $this->datos['nivel'];
170 $aux['grado'] = $this->datos['grado'];
171 $aux['func_ejec'] = $this->datos['func_ejec'];
172 $aux['obra_social'] = $this->datos['obra_social'];
173 $aux['afiliado'] = $this->datos['afiliado'];
174 $aux['conyuge'] = $this->datos['conyuge'];
175 $aux['fecha_nac_conyuge'] = $this->datos['fecha_nac_cony'];
176 $aux['tipo_doc_conyuge'] = $this->datos['tipodoc_cony'];
177 $aux['nro_doc_cony'] = $this->datos['nrodoc_cony'];
183 // +X2C Operation 154
190 function buscarAgente($agente) // ~X2C
192 $this->agente = $agente;
193 $dsn = 'mysql://intranet:intranet@intranet-db/novedades';
194 $db = DB::connect($dsn);
195 if (DB::isError($db)) die ($db->getMessage("No pudo conectarse a la base"));
198 WHERE nrodoc = $agente";
199 $result = $db->query($sql);
200 if(DB::isError($result))
201 die($result->getMessage("query mal hecho"));
202 if($result->numRows() > 0)
204 $this->datos = $result->fetchRow(DB_FETCHMODE_ASSOC);
208 $dsn = 'mysql://intranet:intranet@intranet-db/Contratados';
209 $db = DB::connect($dsn);
210 if (DB::isError($db)) die ($db->getMessage("No pudo conectarse a la base"));
213 WHERE nrodoc = $agente";
214 $result = $db->query($sql);
215 if(DB::isError($result))
216 die($result->getMessage("query mal hecho"));
217 if($result->numRows() > 0)
219 $this->datos = $result->fetchRow(DB_FETCHMODE_ASSOC);
228 } // -X2C Class :Agente