]> git.llucax.com Git - mecon/intranet.git/blob - sistema/www/servicios/bandas/banda_agente.php
-Agregué el popup de la novedad del día.
[mecon/intranet.git] / sistema / www / servicios / bandas / banda_agente.php
1 <?
2 require_once '../../../local_lib/HTML_DietMarco.php';
3 require_once 'MECON/HTML/Image.php';
4 require_once 'MECON/HTML/Link.php';
5 require_once 'MECON/Dependencia.php';
6 require_once 'MECON/NovedadesDia.php';
7 require_once '../../../local_lib/Servicios/Bandas/Agente.php';
8 require_once 'HTML/Table.php';
9
10 if(!isset($_SESSION['documento']))
11 {
12         header('Location: ../../servicios.php');
13 }
14
15 $nrodoc = $_SESSION['documento'];
16 setlocale (LC_ALL, 'es_AR');
17 $fecha = $_POST['fecha'];
18
19 $fecha_spliteada = split('-',$fecha);
20 $mes = strftime("%B", mktime(0,0,0,$fecha_spliteada[1],1,$fecha_spliteada[0]));
21 $agente =& new Servicios_Bandas_Agente($nrodoc,new date($fecha));
22 if(!$agente->buscarAgente($nrodoc))
23 {
24         echo "El agente no está en las bases de RRHH";
25         die;
26 }
27
28 /* Instancio DietMarco que sirve para mostrar la pagina dentro del marco de Intranet*/
29 $m = new HTML_DietMarco('servicios','Bandas Horarias');
30 $m->addTitle('Bandas Horarias');
31 $m->addStyleSheet('../../css/servicios_bandas.css');
32
33 /* Instancio un objeto Table para el cuerpo de la pagina*/
34 $tabla_cuerpo = new HTML_Table(array('width'=>'760','border'=>'0','cellspacing'=>'0','cellpadding'=>'0'));
35
36 /* Encabezado propio de la pagina */
37 $imagen = new MECON_HTML_Image('../../images/servicios_imprimir1.gif',
38                                                  '',
39                                                 array('width'=>'24','height'=>'24','alt'=>'imprimir'));
40 $row_cuerpo = array('Datos Personales',
41                                         'P&aacute;gina de Impresi&oacute;n ',
42                                         $imagen->toHtml());
43 $tabla_cuerpo->addRow($row_cuerpo,array('height'=>'24'));
44 $imagen = new MECON_HTML_Image('/MECON/images/blanco.gif',
45                                                 '',
46                                                 array('width'=>'586','height'=>'1','alt'=>'blanco','align'=>'top'));
47 $imagen2 = new MECON_HTML_Image('/MECON/images/blanco.gif',
48                                                 '',
49                                                 array('width'=>'150','height'=>'1','alt'=>'blanco','align'=>'top'));
50 $imagen3 = new MECON_HTML_Image('/MECON/images/blanco.gif',
51                                                 '',
52                                                 array('width'=>'24','height'=>'1','alt'=>'blanco','align'=>'top'));
53
54 $row_cuerpo = array($imagen->toHtml(),$imagen2->toHtml(),$imagen3->toHtml());
55
56 $tabla_cuerpo->addRow($row_cuerpo,array('bgcolor'=>'#FF9900',
57                                                                         'height'=>'1'));
58 $tabla_cuerpo->addRow($row_cuerpo,array('bgcolor'=>'#FFFFFF',
59                                                                         'height'=>'10'));
60
61 $tabla_cuerpo->updateCellAttributes(0,
62                                                                         0,
63                                                                         array('width'=>'586','class'=>'titulo_tres'));
64 $tabla_cuerpo->updateCellAttributes(0,
65                                                                         1,
66                                                                         array('width'=>'150','class'=>'imprimir_bandas'));
67 $tabla_cuerpo->updateCellAttributes(0,
68                                                                         2,
69                                                                         array('width'=>'24','class'=>'imprimir_bandas'));
70 $tabla_cuerpo->updateCellAttributes(1,
71                                                                         0,
72                                                                         array('height'=>'1'));
73 $tabla_cuerpo->updateCellAttributes(1,
74                                                                         1,
75                                                                         array('height'=>'1'));
76 $tabla_cuerpo->updateCellAttributes(1,
77                                                                         2,
78                                                                         array('height'=>'1'));
79
80 $m->addBodyContent($tabla_cuerpo);
81
82 /* Fin del encabezado propio de la pagina*/
83 /* 
84 Aca empieza las tablas con la informacion personal del agente y
85 con las referencias de cada color de las celdas
86 */
87
88 /* Armo la tabla de la información personal */
89
90 $tabla_info_personal_adentro = new HTML_Table(array('width'=>'360',
91                                                                                         'border'=>'0',
92                                                                                         'valign'=>'top',
93                                                                                         'cellspacing'=>'2',
94                                                                                         'cellpadding'=>'0'));
95 $row = array('Datos personales');
96 $imagen = new MECON_HTML_Image('../../images/servicios_bandas_borde_tabla.gif','');
97
98 $tabla_info_personal_adentro->addRow($row, array('colspan'=>'2', 'class'=>'titulo_form', 'align'=>'left'));
99
100 $row = array('Agente',$agente->getNombre());
101 $tabla_info_personal_adentro->addRow($row);
102
103 $row = array('N° de documento',$agente->agente);
104 $tabla_info_personal_adentro->addRow($row);
105
106 $dep =& new MECON_Dependencia($agente->getDependencia());
107 $row = array('Dependencia',$dep->getNombre());
108 $tabla_info_personal_adentro->addRow($row);
109
110 $row = array('Código',$agente->getDependencia());
111 $tabla_info_personal_adentro->addRow($row);
112
113 $hora_desde =& new MECON_Tiempo_Hora($agente->datos['hora_desde']);
114 $hora_hasta =& new MECON_Tiempo_Hora($agente->datos['hora_hasta']);
115 $row = array('Horario oficial',$hora_desde->get().' - '.$hora_hasta->get());
116 $tabla_info_personal_adentro->addRow($row);
117
118 $tipo_ag = $agente->getTipo();
119 if(preg_match('/^BEC/',$tipo_ag))
120 {
121         $tipo_ag = 'PASANTE';
122 }elseif(preg_match('/^CON/',$tipo_ag))
123 {
124         $tipo_ag = 'CONTRATADO';
125 }elseif(preg_match('/^ADS/',$tipo_ag))
126 {
127         $tipo_ag = 'ADSCRIPTO';
128 }elseif(preg_match('/^TRA/',$tipo_ag))
129 {
130         $tipo_ag = 'PLANTA TRANSITORIA';
131 }else
132 {
133         $tipo_ag = 'PLANTA PERMANENTE';
134 }
135
136 $row = array('Categoría',$tipo_ag);
137 $tabla_info_personal_adentro->addRow($row);
138
139 for($fila=1; $fila <= 6; $fila++)
140 {
141         $tabla_info_personal_adentro->updateCellAttributes($fila,0,array('class'=>'titulo_columna', 
142                                                                                                                                         'width'=>'120',
143                                                                                                                                         'background'=>$imagen->getSrc()));
144 }
145
146 $tabla_info_personal_adentro->updateColAttributes(1,array('class'=>'txt_fila', 
147                                                                                                         'bgcolor'=>'#FFFFFF',
148                                                                                                         'width'=>'180'));
149
150 $tabla_info_personal = new HTML_Table(array('width'=>'360',
151                                                                                         'border'=>'0',
152                                                                                         'cellspacing'=>'0',
153                                                                                         'cellpadding'=>'0',
154                                                                                         'bgcolor'=>'#003366'));
155 $tabla_info_personal->addRow(array($tabla_info_personal_adentro));
156
157 /* Armo la tabla de referencias */
158 $tabla_referencias_adentro = new HTML_Table(array('width'=>'360',
159                                                                                         'border'=>'0',
160                                                                                         'valign'=>'top',
161                                                                                         'cellspacing'=>'2',
162                                                                                         'cellpadding'=>'0'));
163 $row = array('Referencias');
164 $tabla_referencias_adentro->addRow($row, array('colspan'=>'2', 'class'=>'titulo_form', 'align'=>'left'));
165
166 $row = array('&nbsp;','Promedio diario');
167 $tabla_referencias_adentro->addRow($row,array('bgcolor'=>'#FFFFFF'));
168 $row = array('&nbsp;','Sábados/Domingos/Feriados');
169 $tabla_referencias_adentro->addRow($row,array('bgcolor'=>'lightblue'));
170 $row = array('&nbsp;','Lic. extraordinaria');
171 $tabla_referencias_adentro->addRow($row,array('bgcolor'=>'#009999'));
172 $row = array('&nbsp;','Otras inasistencias');
173 $tabla_referencias_adentro->addRow($row,array('bgcolor'=>'#CC66CC'));
174 $row = array('&nbsp;','Inasistencias');
175 $tabla_referencias_adentro->addRow($row,array('bgcolor'=>'#FF9900'));
176 $row = array('&nbsp;','Lic. enfermedad');
177 $tabla_referencias_adentro->addRow($row,array('bgcolor'=>'#00CC33'));
178 $row = array('&nbsp;','Lic. anual ordinaria');
179 $tabla_referencias_adentro->addRow($row,array('bgcolor'=>'#3366FF'));
180 $row = array('&nbsp;','Ausentes sin informar');
181 $tabla_referencias_adentro->addRow($row,array('bgcolor'=>'#FF0000'));
182
183 $tabla_referencias_adentro->updateColAttributes(0,array('width'=>'20',
184                                                                                                                 'class'=>'titulo_columna'));
185
186
187 $tabla_referencias_adentro->updateColAttributes(1,array('bgcolor'=>'#FFFFFF',
188                                                                                                                 'width'=>'340',
189                                                                                                                 'class'=>'txt_fila'));
190
191 $tabla_referencias = new HTML_Table(array('width'=>'360',
192                                                                                         'border'=>'0',
193                                                                                         'cellspacing'=>'0',
194                                                                                         'cellpadding'=>'0',
195                                                                                         'bgcolor'=>'#003366'));
196 $tabla_referencias->addRow(array($tabla_referencias_adentro));
197
198
199 /* Agrego las tablas de referencia al cuerpo */
200 $t = new HTML_Table(array('width'=>'760',
201                                                         'border'=>'0',
202                                                         'cellspacing'=>'0',
203                                                         'cellpadding'=>'0'));
204 $row = array();
205 $imagen = new MECON_HTML_Image('/MECON/images/blanco.gif',
206                                                 '',
207                                                 array('width'=>'360','height'=>'1','alt'=>'blanco'));
208 array_push($row,$imagen);
209 array_push($row,'');
210 $imagen = new MECON_HTML_Image('/MECON/images/blanco.gif',
211                                                 '',
212                                                 array('width'=>'40','height'=>'1','alt'=>'blanco'));
213 array_push($row,$imagen);
214 $imagen = new MECON_HTML_Image('/MECON/images/blanco.gif',
215                                                 '',
216                                                 array('width'=>'360','height'=>'1','alt'=>'blanco'));
217 array_push($row,$imagen);
218
219 $t->addRow($row);
220 $t->updateCellAttributes(0,0,array('colspan'=>'2'));
221
222 $row = array($tabla_info_personal,'','&nbsp;',$tabla_referencias);
223 $t->addRow($row,array('valign'=>'top'));
224 $t->updateCellAttributes(1,0,array('colspan'=>'2'));
225
226 /* Esta fila contiene las referencias */
227 $row_cuerpo = array($t);
228
229 $m->addBodyContent($t);
230
231 $m->addBodyContent('<BR>');
232
233 /* Armo la tabla de información */
234 $tabla_info_adentro = new HTML_Table(array('width'=>'760',
235                                                                                         'border'=>'0',
236                                                                                         'valign'=>'top',
237                                                                                         'cellspacing'=>'2',
238                                                                                         'cellpadding'=>'0'));
239 $row = array('Mes: '.$mes.' - Año: '.$fecha_spliteada[0]);
240 $tabla_info_adentro->addRow($row, array('colspan'=>'10', 'class'=>'titulo_form', 'align'=>'left'));
241
242
243 $horas=$agente->getHoras();
244 for($i=1;$i<4;$i++)
245 {
246         $aux=($i-1)*10;
247         $row=array(1+$aux,2+$aux,3+$aux,4+$aux,5+$aux,6+$aux,7+$aux,8+$aux,9+$aux,10+$aux);
248
249         $tabla_info_adentro->addRow($row,array('width'=>'76',
250                                                                                         'background'=>'../../images/servicios_bandas_borde_tabla.gif',
251                                                                                         'class'=>'titulo_columna'));
252         
253         $row=array();
254         $celda_ASN=array();
255         $celda_NOV=array();
256         $celda_FER=array();
257         for($j=1;$j<11;$j++)
258         {
259                 if(isset($horas[$j+$aux]['tiempo']))
260                 {
261                         array_push($row,$horas[$j+$aux]['tiempo']);
262                         if($horas[$j+$aux]['tiempo']=='0:00')
263                         {
264                                 if($horas[$j+$aux]['ASN']==1 || $horas[$j+$aux]['inconsistencia']==1)
265                                 {
266                                         array_push($celda_ASN,$j-1);
267                                         
268                                 }
269                                 if($horas[$j+$aux]['ASN']==0 && $horas[$j+$aux]['tipo']=='laborable')
270                                 {
271                                         array_push($celda_NOV,array($j-1,$horas[$j+$aux]['fecha']));
272                                         $row[$j-1]="<a href=\"\" onClick=\"window.open('./nov_dia.php?nrodoc=".$nrodoc."&fecha=".$horas[$j+$aux]['fecha']."','novedad','width=250,height=100');return(false);\">".$row[$j-1]."</a>";
273                                 }
274                         }
275                         ($horas[$j+$aux]['ASN']==0 && $horas[$j+$aux]['tipo']=='no laborable')?array_push($celda_FER,$j-1):0;
276                 }else
277                 {
278                         array_push($row,'&nbsp');
279                 }
280         }
281         $tabla_info_adentro->addRow($row,array('bgcolor'=>'#FFFFFF', 'class'=>'txt_fila'));
282         $tabla_info_adentro->addRow(array('&nbsp;'),array('colspan'=>'10',
283                                                                                                                 'bgcolor'=>'#FFFFFF',
284                                                                                                                 'class'=>'txt_fila'));
285         foreach ($celda_ASN as $c)
286         {
287                 $tabla_info_adentro->updateCellAttributes(($i-1)*3+2,$c,array('bgcolor'=>'red'));
288         }
289
290         foreach ($celda_NOV as $c)
291         {
292                 $novedad =& new MECON_NovedadesDia($nrodoc,new date($c[1]));
293                 if(preg_match('/^13/',$novedad->novedades[0]->codigo))
294                 {
295                         $color='#009999';
296                 }elseif(preg_match('/^15||^2606\/83$||^Adp$||^Com$||^Coms$||^FES\/REL$||^Fran$||^Grem$/',$novedad->novedades[0]->codigo))
297                 {
298                         $color='#CC66CC';
299                 }elseif(preg_match('/^14||^Asa$||^Pap$||^Sus$/',$novedad->novedades[0]->codigo))
300                 {
301                         $color='#FF9900';
302                 }elseif(preg_match('/^10||^Pat$/',$novedad->novedades[0]->codigo))
303                 {
304                         $color='#00CC33';
305                 }elseif(preg_match('/^9/',$novedad->novedades[0]->codigo))
306                 {
307                         $color='#3366FF';
308                 }
309
310                 $tabla_info_adentro->updateCellAttributes(($i-1)*3+2,$c[0],array('bgcolor'=>$color));
311         }
312         
313         foreach ($celda_FER as $c)
314         {
315                 $tabla_info_adentro->updateCellAttributes(($i-1)*3+2,$c,array('bgcolor'=>'lightblue'));
316         }
317
318 }
319
320 if(isset($horas[31]['tiempo']))
321 {
322         $row = array(31,'Días Trabajados','','','Días Laborables Trabajados','','','Promedio','','');
323         
324         $tabla_info_adentro->addRow($row,array('class'=>'titulo_columna',
325                                                                                         'background'=>'../../images/servicios_bandas_borde_tabla.gif'));
326         $row = array($horas[31]['tiempo'],
327                                 $agente->getDiasTrabajados(),'','',
328                                 $agente->getDiasLaborablesTrabajados(),'','',
329                                 $agente->getPromedioMensual(),'','');
330
331         if($horas[31]['tiempo']=='0:00' && $horas[31]['ASN']==0 && $horas[31]['tipo']=='laborable')
332         {
333                 $row[0]="<a href=\"\" onClick=\"window.open('./nov_dia.php?nrodoc=".
334                                         $nrodoc."&fecha=".$horas[31]['fecha'].
335                                         "','novedad','width=\"250\" height=\"100\"');return(false);\">
336                                         ".$horas[31]['tiempo']."</a>";
337         }
338         $tabla_info_adentro->addRow($row,array('class'=>'txt_fila',
339                                                                                         'bgcolor'=>'#FFFFFF'));
340
341         if($horas[31]['tiempo']=='0:00')
342         {
343                 if($horas[31]['ASN']==1)
344                 {
345                         $tabla_info_adentro->updateCellAttributes(11,0,array('bgcolor'=>'red'));
346                 }
347                 if($horas[31]['ASN']==0 && $horas[31]['tipo']=='laborable')
348                 {
349                         preg_replace('/(..)$/','31',$fecha);
350                         $novedad =& new MECON_NovedadesDia($nrodoc,new date($fecha));
351                         if(preg_match('/^13/',$novedad->novedades[0]->codigo))
352                         {
353                                 $color='#009999';
354                         }elseif(preg_match('/^15||^2606\/83$||^Adp$||^Com$||^Coms$||^FES\/REL$||^Fran$||^Grem$/',$novedad->novedades[0]->codigo))
355                         {
356                                 $color='#CC66CC';
357                         }elseif(preg_match('/^14||^Asa$||^Pap$||^Sus$/',$novedad->novedades[0]->codigo))
358                         {
359                                 $color='#FF9900';
360                         }elseif(preg_match('/^10||^Pat$/',$novedad->novedades[0]->codigo))
361                         {
362                                 $color='#00CC33';
363                         }elseif(preg_match('/^9/',$novedad->novedades[0]->codigo))
364                         {
365                                 $color='#3366FF';
366                         }
367                         $tabla_info_adentro->updateCellAttributes(11,0,array('bgcolor'=>$color));
368                 }
369         }
370         if($horas[31]['ASN']==0 && $horas[31]['tipo']=='no laborable')
371         {
372                 $tabla_info_adentro->updateCellAttributes(11,0,array('bgcolor'=>'lightblue'));
373         }
374         
375         $tabla_info_adentro->updateCellAttributes(10,1,array('colspan'=>'3'));
376         $tabla_info_adentro->updateCellAttributes(10,4,array('colspan'=>'3'));
377         $tabla_info_adentro->updateCellAttributes(10,7,array('colspan'=>'3'));
378
379         $tabla_info_adentro->updateCellAttributes(11,1,array('colspan'=>'3'));
380         $tabla_info_adentro->updateCellAttributes(11,4,array('colspan'=>'3'));
381         $tabla_info_adentro->updateCellAttributes(11,7,array('colspan'=>'3'));
382
383 }else
384 {
385         $row = array('Días Trabajados','','','','Días Laborables Trabajados','','','Promedio','','');
386         $tabla_info_adentro->addRow($row,array('class'=>'titulo_columna',
387                                                                                         'background'=>'../../images/servicios_bandas_borde_tabla.gif'));
388         $tabla_info_adentro->updateCellAttributes(10,0,array('colspan'=>'4'));
389         $tabla_info_adentro->updateCellAttributes(10,4,array('colspan'=>'3'));
390         $tabla_info_adentro->updateCellAttributes(10,7,array('colspan'=>'3'));
391         
392         $row = array($agente->getDiasTrabajados(),'','','',
393                                 $agente->getDiasLaborablesTrabajados(),'','',
394                                 $agente->getPromedioMensual(),'','');
395
396         $tabla_info_adentro->addRow($row,array('class'=>'txt_fila',
397                                                                                         'bgcolor'=>'#FFFFFF'));
398         $tabla_info_adentro->updateCellAttributes(11,0,array('colspan'=>'4'));
399         $tabla_info_adentro->updateCellAttributes(11,4,array('colspan'=>'3'));
400         $tabla_info_adentro->updateCellAttributes(11,7,array('colspan'=>'3'));
401
402 }
403
404
405 $tabla_info = new HTML_Table(array('width'=>'760',
406                                                                         'border'=>'0',
407                                                                         'cellspacing'=>'0',
408                                                                         'cellpadding'=>'0',
409                                                                         'bgcolor'=>'#003366'));
410
411 $tabla_info->addRow(array($tabla_info_adentro));
412 $m->addBodyContent($tabla_info);
413
414 $m->addBodyContent('<BR>');
415
416 /* Comienzo a mostrar los links con las notas, accesos y salidas autorizadas*/
417 $tabla_notas = new HTML_Table(array('width'=>'760',
418                                                                         'border'=>'0',
419                                                                         'cellspacing'=>'0',
420                                                                         'cellpadding'=>'0',
421                                                                         'bgcolor'=>'#003366'));
422
423 $imagen_notas = new MECON_HTML_Image('../../images/servicios_notas.gif',
424                                                          '',
425                                                         array('width'=>'24','height'=>'24','valign'=>'top'));
426
427 $imagen_anterior = new MECON_HTML_Image('../../images/servicios_bandas_anterior.gif',
428                                                                 '',
429                                                                 array('width'=>'16','height'=>'10','valign'=>'top'));
430                                                                 
431 $imagen_visto = new MECON_HTML_Image('../../images/servicios_bandas_visto.gif',
432                                                                 '',
433                                                                 array('width'=>'16','height'=>'10','valign'=>'top'));
434 $link_volver = new MECON_HTML_LINK('./','volver');
435
436 $row = array($imagen_notas,'Nota: Fecha de último cruce con las novedades',$imagen_anterior->toHtml().' '.$link_volver->toHtml(),$imagen_visto->toHtml().' accesos',$imagen_visto->toHtml().' salidas autorizadas');
437                         
438 $tabla_notas->addRow($row,array('class'=>'imprimir_bandas',
439                                                                                 'bgcolor'=>'#FFFFFF'));
440
441 $tabla_notas->updateCellAttributes(0,0,array('width'=>'24','height'=>'24','class'=>'aclarar'));
442 $tabla_notas->updateCellAttributes(0,1,array('width'=>'370','height'=>'30','class'=>'aclarar'));
443 $tabla_notas->updateCellAttributes(0,2,array('width'=>'130','class'=>'imprimir_bandas'));
444 $tabla_notas->updateCellAttributes(0,3,array('width'=>'130','class'=>'imprimir_bandas'));
445 $tabla_notas->updateCellAttributes(0,4,array('width'=>'130','class'=>'imprimir_bandas'));
446
447 $m->addBodyContent($tabla_notas);
448 $m->display();
449 ?>
450