1 <?php /* vim: set binary expandtab tabstop=4 shiftwidth=4 textwidth=80:
2 -------------------------------------------------------------------------------
3 Ministerio de EconomÃa
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 :Agente
56 function getDependencia() // ~X2C
58 return $this->datos['codep'];//TODO esta no es la columna correcta
67 function getTipo() // ~X2C
69 if(is_null($this->datos['tipo_agente']))
70 return 'CON '.$this->datos['marco_legal'];
72 return $this->datos['tipo_agente'];
84 function Agente($agente) // ~X2C
86 if(! is_null($agente))
87 $this->buscarAgente($agente);
96 function getNombre() // ~X2C
98 return $this->datos['nombre'];
102 // +X2C Operation 139
107 function getHoraDesde() // ~X2C
109 if(is_null($this->datos['hentra']))
110 return new Hora($this->datos['hora_desde']);
112 return new Hora($this->datos['hentra']);
116 // +X2C Operation 140
121 function getHoraHasta() // ~X2C
123 if(is_null($this->datos['hsale']))
124 return new Hora($this->datos['hora_hasta']);
126 return new Hora($this->datos['hsale']);
130 // +X2C Operation 149
135 function getCuil() // ~X2C
137 $aux = $this->datos['cuil'];
138 $aux = preg_replace('/(\d{2})(\d*)(\d{1})/','$1-$2-$3',$aux);
143 // +X2C Operation 151
148 function getOtrosDatos() // ~X2C
150 if(!is_null($this->datos['tipo_agente'])) {
151 $aux['tipo_doc'] = $this->datos['tipodoc'];
152 $aux['fecha_nac'] = $this->datos['fecha_nac'];
153 $aux['edad'] = $this->datos['edad'];
154 $aux['estado_civil'] = $this->datos['estado_civil'];
155 $aux['domicilio'] = $this->datos['domicilio'];
156 $aux['puerta'] = $this->datos['num_puerta'];
157 $aux['piso'] = $this->datos['piso'];
158 $aux['depto'] = $this->datos['depto'];
159 $aux['localidad'] = $this->datos['localidad'];
160 $aux['provincia'] = $this->datos['provincia'];
161 $aux['calle1'] = $this->datos['calle1'];
162 $aux['calle2'] = $this->datos['calle2'];
163 $aux['cp'] = $this->datos['cp'];
164 $aux['telefono'] = $this->datos['telefono'];
165 $aux['cargo'] = $this->datos['cargo'];
166 $aux['nivel'] = $this->datos['nivel'];
167 $aux['grado'] = $this->datos['grado'];
168 $aux['func_ejec'] = $this->datos['func_ejec'];
169 $aux['obra_social'] = $this->datos['obra_social'];
170 $aux['afiliado'] = $this->datos['afiliado'];
171 $aux['conyuge'] = $this->datos['conyuge'];
172 $aux['fecha_nac_conyuge'] = $this->datos['fecha_nac_cony'];
173 $aux['tipo_doc_conyuge'] = $this->datos['tipodoc_cony'];
174 $aux['nro_doc_cony'] = $this->datos['nrodoc_cony'];
180 // +X2C Operation 154
187 function buscarAgente($agente) // ~X2C
189 $this->agente = $agente;
190 $dsn = 'mysql://intranet:intranet@intranet-db/novedades';
191 $db = DB::connect($dsn);
192 if (DB::isError($db)) die ($db->getMessage("No pudo conectarse a la base"));
195 WHERE nrodoc = $agente";
196 $result = $db->query($sql);
197 if(DB::isError($result))
198 die($result->getMessage("query mal hecho"));
199 if($result->numRows() > 0)
201 $this->datos = $result->fetchRow(DB_FETCHMODE_ASSOC);
205 $dsn = 'mysql://intranet:intranet@intranet-db/Contratados';
206 $db = DB::connect($dsn);
207 if (DB::isError($db)) 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)
216 $this->datos = $result->fetchRow(DB_FETCHMODE_ASSOC);
225 } // -X2C Class :Agente