1 <?php /* vim: set binary expandtab tabstop=4 shiftwidth=4 textwidth=80:
2 -------------------------------------------------------------------------------
5 -------------------------------------------------------------------------------
6 This file is part of meconlib.
8 meconlib is free software; you can redistribute it and/or modify it under
9 the terms of the GNU General Public License as published by the Free
10 Software Foundation; either version 2 of the License, or (at your option)
13 meconlib is distributed in the hope that it will be useful, but WITHOUT
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
15 FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License; if not,
18 write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
19 Boston, MA 02111-1307 USA
20 -------------------------------------------------------------------------------
21 Creado: Thu Jun 19 15:17:11 2003
22 Autor: Gonzalo Merayo <gmeray@mecon.gov.ar>
23 -------------------------------------------------------------------------------
25 -----------------------------------------------------------------------------*/
27 #require_once 'PEAR.php';
28 require_once 'DB.php';
29 require_once 'MECON/Tiempo/Hora.php';
31 // +X2C Class 131 :MECON_Agente
55 function getDependencia() // ~X2C
57 return $this->datos['codep'];//TODO esta no es la columna correcta
66 function getTipo() // ~X2C
68 if(!in_array('tipo_agente',array_keys($this->datos)))
69 return 'CON '.$this->datos['marco_legal'];
71 return $this->datos['tipo_agente'];
83 function Agente($agente) // ~X2C
85 if(! is_null($agente))
86 $this->buscarAgente($agente);
95 function getNombre() // ~X2C
97 return $this->datos['nombre'];
101 // +X2C Operation 139
106 function getHoraDesde() // ~X2C
108 if(is_null($this->datos['hentra']))
109 return new MECON_Tiempo_Hora($this->datos['hora_desde']);
111 return new MECON_Tiempo_Hora($this->datos['hentra']);
115 // +X2C Operation 140
120 function getHoraHasta() // ~X2C
122 if(is_null($this->datos['hsale']))
123 return new MECON_Tiempo_Hora($this->datos['hora_hasta']);
125 return new MECON_Tiempo_Hora($this->datos['hsale']);
129 // +X2C Operation 149
134 function getCuil() // ~X2C
136 $aux = $this->datos['cuil'];
137 $aux = preg_replace('/(\d{2})(\d*)(\d{1})/','$1-$2-$3',$aux);
142 // +X2C Operation 151
147 function getOtrosDatos() // ~X2C
149 if(!is_null($this->datos['tipo_agente'])) {
150 $aux['tipo_doc'] = $this->datos['tipodoc'];
151 $aux['fecha_nac'] = $this->datos['fecha_nac'];
152 $aux['edad'] = $this->datos['edad'];
153 $aux['estado_civil'] = $this->datos['estado_civil'];
154 $aux['domicilio'] = $this->datos['domicilio'];
155 $aux['puerta'] = $this->datos['num_puerta'];
156 $aux['piso'] = $this->datos['piso'];
157 $aux['depto'] = $this->datos['depto'];
158 $aux['localidad'] = $this->datos['localidad'];
159 $aux['provincia'] = $this->datos['provincia'];
160 $aux['calle1'] = $this->datos['calle1'];
161 $aux['calle2'] = $this->datos['calle2'];
162 $aux['cp'] = $this->datos['cp'];
163 $aux['telefono'] = $this->datos['telefono'];
164 $aux['cargo'] = $this->datos['cargo'];
165 $aux['nivel'] = $this->datos['nivel'];
166 $aux['grado'] = $this->datos['grado'];
167 $aux['func_ejec'] = $this->datos['func_ejec'];
168 $aux['obra_social'] = $this->datos['obra_social'];
169 $aux['afiliado'] = $this->datos['afiliado'];
170 $aux['conyuge'] = $this->datos['conyuge'];
171 $aux['fecha_nac_conyuge'] = $this->datos['fecha_nac_cony'];
172 $aux['tipo_doc_conyuge'] = $this->datos['tipodoc_cony'];
173 $aux['nro_doc_cony'] = $this->datos['nrodoc_cony'];
181 // +X2C Operation 154
188 function buscarAgente($agente) // ~X2C
190 $this->agente = $agente;
191 $dsn = 'mysql://intranet:intranet@intranet-db.mecon.ar/novedades';
192 $db = DB::connect($dsn);
193 if (DB::isError($db))
194 die ($db->getMessage("No pudo conectarse a la base"));
197 WHERE nrodoc = $agente";
198 $result = $db->query($sql);
199 if(DB::isError($result))
200 die($result->getMessage("query mal hecho"));
201 if($result->numRows() > 0) {
202 $this->datos = $result->fetchRow(DB_FETCHMODE_ASSOC);
204 $dsn = 'mysql://intranet:intranet@intranet-db.mecon.ar/Contratados';
205 $db = DB::connect($dsn);
206 if (DB::isError($db))
207 die ($db->getMessage("No pudo conectarse a la base"));
210 WHERE nrodoc = $agente";
211 $result = $db->query($sql);
212 if(DB::isError($result))
213 die($result->getMessage("query mal hecho"));
214 if($result->numRows() > 0) {
215 $this->datos = $result->fetchRow(DB_FETCHMODE_ASSOC);
223 } // -X2C Class :MECON_Agente