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 'DB.php';
28 require_once 'MECON/Tiempo/Hora.php';
36 * Documento del agente.
48 function getDependencia()
50 return $this->datos['codep'];//TODO esta no es la columna correcta
59 if(!in_array('tipo_agente',array_keys($this->datos)))
60 return 'CON '.$this->datos['marco_legal'];
62 return $this->datos['tipo_agente'];
72 // FIXME function MECON_Agente($db, $agente)
73 function MECON_Agente($agente)
75 // FIXME - $this->_db = $db;
76 $this->_db = DB::connect('mysql://intranet:intranet@intranet-db.mecon.ar/novedades');
77 if(! is_null($agente)) {
78 $this->buscarAgente($agente);
88 return $this->datos['nombre'];
95 function getHoraDesde()
97 if(is_null($this->datos['hentra']))
98 return new MECON_Tiempo_Hora($this->datos['hora_desde']);
100 return new MECON_Tiempo_Hora($this->datos['hentra']);
107 function getHoraHasta()
109 if(is_null($this->datos['hsale']))
110 return new MECON_Tiempo_Hora($this->datos['hora_hasta']);
112 return new MECON_Tiempo_Hora($this->datos['hsale']);
121 $aux = $this->datos['cuil'];
122 $aux = preg_replace('/(\d{2})(\d*)(\d{1})/','$1-$2-$3',$aux);
130 function getOtrosDatos()
132 if(!is_null($this->datos['tipo_agente'])) {
133 $aux['tipo_doc'] = $this->datos['tipodoc'];
134 $aux['fecha_nac'] = $this->datos['fecha_nac'];
135 $aux['edad'] = $this->datos['edad'];
136 $aux['estado_civil'] = $this->datos['estado_civil'];
137 $aux['domicilio'] = $this->datos['domicilio'];
138 $aux['puerta'] = $this->datos['num_puerta'];
139 $aux['piso'] = $this->datos['piso'];
140 $aux['depto'] = $this->datos['depto'];
141 $aux['localidad'] = $this->datos['localidad'];
142 $aux['provincia'] = $this->datos['provincia'];
143 $aux['calle1'] = $this->datos['calle1'];
144 $aux['calle2'] = $this->datos['calle2'];
145 $aux['cp'] = $this->datos['cp'];
146 $aux['telefono'] = $this->datos['telefono'];
147 $aux['cargo'] = $this->datos['cargo'];
148 $aux['nivel'] = $this->datos['nivel'];
149 $aux['grado'] = $this->datos['grado'];
150 $aux['func_ejec'] = $this->datos['func_ejec'];
151 $aux['obra_social'] = $this->datos['obra_social'];
152 $aux['afiliado'] = $this->datos['afiliado'];
153 $aux['conyuge'] = $this->datos['conyuge'];
154 $aux['fecha_nac_conyuge'] = $this->datos['fecha_nac_cony'];
155 $aux['tipo_doc_conyuge'] = $this->datos['tipodoc_cony'];
156 $aux['nro_doc_cony'] = $this->datos['nrodoc_cony'];
169 function buscarAgente($agente)
171 $this->agente = $agente;
173 FROM novedades.web003
174 WHERE nrodoc = $agente";
175 $result = $this->_db->query($sql);
176 if(DB::isError($result))
177 trigger_error($result->getMessage("query mal hecho"), E_USER_ERROR);
178 if($result->numRows() > 0) {
179 $this->datos = $result->fetchRow(DB_FETCHMODE_ASSOC);
182 FROM Contratados.Contratados
183 WHERE nrodoc = $agente";
184 $result = $this->_db->query($sql);
185 if(DB::isError($result)) {
186 trigger_error($result->getMessage("query mal hecho"), E_USER_ERROR);
188 if($result->numRows() > 0) {
189 $this->datos = $result->fetchRow(DB_FETCHMODE_ASSOC);