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