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 'DB.php';
28 require_once 'MECON/Tiempo/Hora.php';
36 * Documento del agente.
48 function getDependencia()
50 if(in_array('codep',array_keys($this->datos)))
51 return $this->datos['codep'];//TODO esta no es la columna correcta
62 if(in_array('marco_legal',array_keys($this->datos)))
63 return 'CON '.$this->datos['marco_legal'];
64 elseif(in_array('tipo_agente',array_keys($this->datos)))
65 return $this->datos['tipo_agente'];
77 function MECON_Agente(&$db,$agente)
80 //$this->_db = DB::connect('mysql://intranet:intranet@intranet-db.mecon.ar/novedades');
81 if(! is_null($agente)) {
82 $this->buscarAgente($agente);
92 if(in_array('nombre',array_keys($this->datos)))
93 return $this->datos['nombre'];
102 function getHoraDesde()
104 if(in_array('hora_desde',$this->datos))
105 return new MECON_Tiempo_Hora($this->datos['hora_desde']);
106 elseif(in_array('hentra',$this->datos))
107 return new MECON_Tiempo_Hora($this->datos['hentra']);
116 function getHoraHasta()
118 if(in_array('hora_hasta',$this->datos))
119 return new MECON_Tiempo_Hora($this->datos['hora_hasta']);
120 elseif(in_array('hsale',$this->datos))
121 return new MECON_Tiempo_Hora($this->datos['hsale']);
132 if(in_array('cuil',$this->datos))
134 $aux = $this->datos['cuil'];
135 $aux = preg_replace('/(\d{2})(\d*)(\d{1})/','$1-$2-$3',$aux);
147 function getOtrosDatos()
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'];
186 function buscarAgente($agente)
188 $this->agente = $agente;
190 FROM novedades.web003
191 WHERE nrodoc = ".$agente;
192 $result = $this->_db->query($sql);
193 if(DB::isError($result))
194 trigger_error($result->getMessage("query mal hecho"), E_USER_ERROR);
195 if($result->numRows() > 0) {
196 $this->datos = $result->fetchRow(DB_FETCHMODE_ASSOC);
199 FROM Contratados.Contratados
200 WHERE nrodoc = ".$agente;
201 $result = $this->_db->query($sql);
202 if(DB::isError($result)) {
203 trigger_error($result->getMessage("query mal hecho"), E_USER_ERROR);
205 if($result->numRows() > 0) {
206 $this->datos = $result->fetchRow(DB_FETCHMODE_ASSOC);