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($agente !== null) {
90 buscarAgente($agente);
92 trigger_error("No se paso ningun documento!");
102 function getNombre() // ~X2C
104 return $this->datos['nombre'];
108 // +X2C Operation 139
113 function getHoraDesde() // ~X2C
115 if(is_null($this->datos['hentra']))
116 return new Hora($this->datos['hora_desde']);
118 return new Hora($this->datos['hentra']);
122 // +X2C Operation 140
127 function getHoraHasta() // ~X2C
129 if(is_null($this->datos['hsale']))
130 return new Hora($this->datos['hora_hasta']);
132 return new Hora($this->datos['hsale']);
136 // +X2C Operation 149
141 function getCuil() // ~X2C
143 $aux = $this->datos['cuil'];
144 $aux = preg_replace('/(\d{2})(\d*)(\d{1})/','$1-$2-$3',$aux);
149 // +X2C Operation 151
154 function getOtrosDatos() // ~X2C
156 if(!is_null($this->datos['tipo_agente'])) {
157 $aux['tipo_doc'] = $this->datos['tipodoc'];
158 $aux['fecha_nac'] = $this->datos['fecha_nac'];
159 $aux['edad'] = $this->datos['edad'];
160 $aux['estado_civil'] = $this->datos['estado_civil'];
161 $aux['domicilio'] = $this->datos['domicilio'];
162 $aux['puerta'] = $this->datos['num_puerta'];
163 $aux['piso'] = $this->datos['piso'];
164 $aux['depto'] = $this->datos['depto'];
165 $aux['localidad'] = $this->datos['localidad'];
166 $aux['provincia'] = $this->datos['provincia'];
167 $aux['calle1'] = $this->datos['calle1'];
168 $aux['calle2'] = $this->datos['calle2'];
169 $aux['cp'] = $this->datos['cp'];
170 $aux['telefono'] = $this->datos['telefono'];
171 $aux['cargo'] = $this->datos['cargo'];
172 $aux['nivel'] = $this->datos['nivel'];
173 $aux['grado'] = $this->datos['grado'];
174 $aux['func_ejec'] = $this->datos['func_ejec'];
175 $aux['obra_social'] = $this->datos['obra_social'];
176 $aux['afiliado'] = $this->datos['afiliado'];
177 $aux['conyuge'] = $this->datos['conyuge'];
178 $aux['fecha_nac_conyuge'] = $this->datos['fecha_nac_cony'];
179 $aux['tipo_doc_conyuge'] = $this->datos['tipodoc_cony'];
180 $aux['nro_doc_cony'] = $this->datos['nrodoc_cony'];
186 // +X2C Operation 154
193 function buscarAgente($agente) // ~X2C
195 $this->agente = $agente;
196 $dsn = 'mysql://intranet:intranet@intranet-db/novedades';
197 $db = DB::connect($dsn);
198 if (DB::isError($db)) die ($db->getMessage("No pudo conectarse a la base"));
201 WHERE nrodoc = $agente";
202 $result = $db->query($sql);
203 if(DB::isError($result))
204 die($result->getMessage("query mal hecho"));
205 if($result->numRows() > 0)
207 $this->datos = $result->fetchRow(DB_FETCHMODE_ASSOC);
211 $dsn = 'mysql://intranet:intranet@intranet-db/Contratados';
212 $db = DB::connect($dsn);
213 if (DB::isError($db)) die ($db->getMessage("No pudo conectarse a la base"));
216 WHERE nrodoc = $agente";
217 $result = $db->query($sql);
218 if(DB::isError($result))
219 die($result->getMessage("query mal hecho"));
220 if($result->numRows() > 0)
222 $this->datos = $result->fetchRow(DB_FETCHMODE_ASSOC);
225 trigger_error("Ahhhhh, agente no encontrado!");
230 } // -X2C Class :Agente