· 5 years ago · Jun 05, 2020, 01:28 AM
1<?php
2error_reporting(E_ALL);
3////////////////////////*Captura Token PROCESOS//////////////////////////////
4$data = array(
5
6);
7$curl = curl_init();
8curl_setopt_array($curl, array(
9 CURLOPT_URL => "http://192.168.15.41:3400/proc-procesos/api/auth",
10 CURLOPT_RETURNTRANSFER => true,
11 CURLOPT_ENCODING => "",
12 CURLOPT_MAXREDIRS => 10,
13 CURLOPT_TIMEOUT => 30,
14 CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
15 CURLOPT_CUSTOMREQUEST => "POST",
16 CURLOPT_POSTFIELDS => http_build_query($data),
17 CURLOPT_HTTPHEADER => array(
18 "cache-control: no-cache",
19 "content-type: application/x-www-form-urlencoded",
20 "postman-token: 59fdf6dc-476d-c0dd-f906-9a6b3460e2e9"
21 ),
22));
23$response = curl_exec($curl);
24$err = curl_error($curl);
25curl_close($curl);
26$MY_TOKEN = "";
27if ($err) {
28 echo "cURL Error #:" . $err;
29 exit;
30} else {
31 $resultLoginApi = json_decode($response);
32 if($resultLoginApi->{'success'} == true){ //Existe info
33 $MY_TOKEN = $resultLoginApi->{'token'};
34 }else{
35 echo $response;
36 echo "No tienes permisos API proc-procesos";
37 exit;
38 }
39}
40////////////////////////*Captura Token BECH*//////////////////////////////
41$data = array(
42
43$curl = curl_init();
44curl_setopt_array($curl, array(
45 CURLOPT_URL => "http://192.168.15.41:3402/proc-bech/api/auth",
46 CURLOPT_RETURNTRANSFER => true,
47 CURLOPT_ENCODING => "",
48 CURLOPT_MAXREDIRS => 10,
49 CURLOPT_TIMEOUT => 30,
50 CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
51 CURLOPT_CUSTOMREQUEST => "POST",
52 CURLOPT_POSTFIELDS => http_build_query($data),
53 CURLOPT_HTTPHEADER => array(
54 "cache-control: no-cache",
55 "content-type: application/x-www-form-urlencoded",
56 "postman-token: 59fdf6dc-476d-c0dd-f906-9a6b3460e2e9"
57 ),
58));
59$response = curl_exec($curl);
60$err = curl_error($curl);
61curl_close($curl);
62$MY_TOKEN_BECH = "";
63if ($err) {
64 echo "cURL Error #:" . $err;
65 exit;
66} else {
67 $resultLoginApi = json_decode($response);
68 if($resultLoginApi->{'success'} == true){ //Existe info
69 $MY_TOKEN_BECH = $resultLoginApi->{'token'};
70 }else{
71 echo $response;
72 echo "No tienes permisos API proc-bech";
73 exit;
74 }
75}
76//////////////////////////*Servicios BECH////////////////////////
77
78//== Data
79$JSON_DATA = "";
80
81$data = array(
82 'est_id2'=> '123'
83);
84
85$curl = curl_init();
86
87curl_setopt_array($curl, array(
88 CURLOPT_URL => "http://192.168.15.41:3402/proc-bech/api/reportes/registro-iniciativa/getAllAct/est_id2",
89 CURLOPT_RETURNTRANSFER => true,
90 CURLOPT_ENCODING => "",
91 CURLOPT_MAXREDIRS => 10,
92 CURLOPT_TIMEOUT => 100,
93 CURLOPT_FOLLOWLOCATION => true,
94 CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
95 CURLOPT_CUSTOMREQUEST => "POST",
96 CURLOPT_POSTFIELDS => http_build_query($data),
97 CURLOPT_HTTPHEADER => array(
98 "Authorization: ".$MY_TOKEN_BECH."",
99 "cache-control: no-cache",
100 "Content-Type: application/x-www-form-urlencoded"
101 ),
102));
103
104$response = curl_exec($curl);
105$httpcode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
106$err = curl_error($curl);
107curl_close($curl);
108if ($err) {
109 echo "cURL Error #:" . $err;
110 exit;
111} else {
112 $result = json_decode($response);
113 if($httpcode == 200){
114 $JSON_DATA = $response;
115 }else{
116 echo '[ERROR] => '.$result->{'message'}.'';
117 echo "\n";
118 exit;
119 }
120}
121
122//== Tipo Iniciativa
123$JSON_TIPO_INI = "";
124
125$curl = curl_init();
126
127curl_setopt_array($curl, array(
128 CURLOPT_URL => "http://192.168.15.41:3402/proc-bech/api/tipo-iniciativa/getAllTipoIniciativa",
129 CURLOPT_RETURNTRANSFER => true,
130 CURLOPT_ENCODING => "",
131 CURLOPT_MAXREDIRS => 10,
132 CURLOPT_TIMEOUT => 100,
133 CURLOPT_FOLLOWLOCATION => true,
134 CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
135 CURLOPT_CUSTOMREQUEST => "GET",
136 CURLOPT_HTTPHEADER => array(
137 "Authorization: ".$MY_TOKEN_BECH."",
138 "cache-control: no-cache",
139 "Content-Type: application/x-www-form-urlencoded"
140 ),
141));
142
143$response = curl_exec($curl);
144$httpcode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
145$err = curl_error($curl);
146curl_close($curl);
147if ($err) {
148 echo "cURL Error #:" . $err;
149 exit;
150} else {
151 $result = json_decode($response);
152 if($httpcode == 200){
153 $JSON_TIPO_INI = $response;
154 }else{
155 echo '[ERROR] => '.$result->{'message'}.'';
156 echo "\n";
157 exit;
158 }
159}
160
161//== AREA
162$JSON_AREA = "";
163
164$curl = curl_init();
165
166curl_setopt_array($curl, array(
167 CURLOPT_URL => "http://192.168.15.41:3402/proc-bech/api/area/getAllAreas",
168 CURLOPT_RETURNTRANSFER => true,
169 CURLOPT_ENCODING => "",
170 CURLOPT_MAXREDIRS => 10,
171 CURLOPT_TIMEOUT => 100,
172 CURLOPT_FOLLOWLOCATION => true,
173 CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
174 CURLOPT_CUSTOMREQUEST => "GET",
175 CURLOPT_HTTPHEADER => array(
176 "Authorization: ".$MY_TOKEN_BECH."",
177 "cache-control: no-cache",
178 "Content-Type: application/x-www-form-urlencoded"
179 ),
180));
181
182$response = curl_exec($curl);
183$httpcode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
184$err = curl_error($curl);
185curl_close($curl);
186if ($err) {
187 echo "cURL Error #:" . $err;
188 exit;
189} else {
190 $result = json_decode($response);
191 if($httpcode == 200){
192 $JSON_AREA = $response;
193 }else{
194 echo '[ERROR] => '.$result->{'message'}.'';
195 echo "\n";
196 exit;
197 }
198}
199
200//== Estado Act
201$JSON_EST_ACT = "";
202
203$curl = curl_init();
204
205curl_setopt_array($curl, array(
206 CURLOPT_URL => "http://192.168.15.41:3402/proc-bech/api/estado/getAllEstado/mantRegIni/act",
207 CURLOPT_RETURNTRANSFER => true,
208 CURLOPT_ENCODING => "",
209 CURLOPT_MAXREDIRS => 10,
210 CURLOPT_TIMEOUT => 100,
211 CURLOPT_FOLLOWLOCATION => true,
212 CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
213 CURLOPT_CUSTOMREQUEST => "GET",
214 CURLOPT_HTTPHEADER => array(
215 "Authorization: ".$MY_TOKEN_BECH."",
216 "cache-control: no-cache",
217 "Content-Type: application/x-www-form-urlencoded"
218 ),
219));
220
221$response = curl_exec($curl);
222$httpcode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
223$err = curl_error($curl);
224curl_close($curl);
225if ($err) {
226 echo "cURL Error #:" . $err;
227 exit;
228} else {
229 $result = json_decode($response);
230 if($httpcode == 200){
231 $JSON_EST_ACT = $response;
232 }else{
233 echo '[ERROR] => '.$result->{'message'}.'';
234 echo "\n";
235 exit;
236 }
237}
238
239/////////////////////////////////////////////////////////////
240
241//////////////////////////*Tabla 1*//////////////////////////
242$HTML = "<h3>Resumen Iniciativas Abiertas</h3>
243 <table border='1' >
244 <thead>
245 <tr style='background: #deebf6; font-size:70%;'>";
246 $TIIDSuccess = json_decode($JSON_TIPO_INI);
247 if($TIIDSuccess->{'success'} == true){
248 $data = json_decode($JSON_TIPO_INI, true);
249 foreach ($data['data'] as $key => $jTIRes){
250 $HTML .= "<th>". $jTIRes["ti_nom"]."</th>";
251 }
252 }
253
254$HTML .= "<th>Total General</th>
255 </tr>
256 </thead>
257 <tbody>
258 <tr style='font-size:70%;'>";
259 $TIIDSuccess = json_decode($JSON_TIPO_INI);
260 $v_total_1st_tabla = 0;
261 if($TIIDSuccess->{'success'} == true){ //Servicio de Tipo Iniciativa trae data
262 $data = json_decode($JSON_TIPO_INI, true);
263 $i = 0;
264 foreach ($data['data'] as $key => $jTIRes){ //Recorremos for de Tipo Iniciativa
265 $arrIni=array();
266 $v_ti_id_1st_tabla = $jTIRes["ti_id"]; //Obtenemos el ti_id del servicio de Tipo Iniciativa
267 $v_count_1st_tabla = 0;
268 $LACTSuccess = json_decode($JSON_DATA);
269 if($LACTSuccess->{'success'} == true){ //Servicio con la información principal trae data
270 $data = json_decode($JSON_DATA, true);
271 foreach ($data['data'] as $key => $jLARes){
272 $v_ti_id = $jLARes["ti_id"];
273 $v_est_id2 = $jLARes["est2_id_ini"];
274 $v_ini_id_x = $jLARes["ini_id"];
275 if($v_ti_id_1st_tabla == $v_ti_id){
276 if (!in_array($v_ini_id_x, $arrIni)) {
277 array_push($arrIni,$v_ini_id_x);
278 $v_count_1st_tabla++; //Sumamos al Total por Iniciativa
279 $v_total_1st_tabla++; //Sumamos al Total Completo
280 }
281 }
282 }
283 }
284$HTML .= "<td style='text-align:center;'>".$v_count_1st_tabla."</td>";
285 }
286 }
287$HTML .= "<td style='text-align:center'>".$v_total_1st_tabla."</td>";
288$HTML .= "</tr>
289 </tbody>
290 </table>
291 ";
292
293
294
295//////////////////////////*Fin Tabla 1*//////////////////////////
296
297//////////////////////////*Tabla 2*//////////////////////////
298
299$HTML .= "<h3>Cantidad de Iniciativas Por Área</h3>
300 <table border='1' >
301 <thead>
302 <tr style='background: #deebf6;font-size:70%;'>
303 <th>Tipo de Iniciativa</th>";
304 $TIIDSuccess = json_decode($JSON_TIPO_INI);
305 if($TIIDSuccess->{'success'} == true){
306 $data = json_decode($JSON_TIPO_INI, true);
307 foreach ($data['data'] as $key => $jTIRes){
308 $HTML .= "<th>". $jTIRes["ti_nom"]."</th>";
309 }
310 }
311
312$HTML .= "<th>Total General</th>
313 </tr>
314 </thead>
315 <tbody>";
316 $AreaSuccess = json_decode($JSON_AREA);
317 if($AreaSuccess->{'success'} == true){ //Servicio Area
318 $data = json_decode($JSON_AREA, true);
319 foreach ($data['data'] as $key => $jARRes){
320 $arrIni=array();
321 $v_ar_id_2nd_tabla = $jARRes["id"];
322 $v_total_lat_2nd_tabla = 0;
323 $HTML .= "<tr style='font-size:70%;'>
324 <td>".$jARRes["nombre"]."</td>";
325 $TIIDSuccess = json_decode($JSON_TIPO_INI);
326 if($TIIDSuccess->{'success'} == true){//Servicio Tipo Iniciativa
327 $data = json_decode($JSON_TIPO_INI, true);
328 foreach ($data['data'] as $key => $jTIRes){
329 $v_ti_id_2nd_tabla = $jTIRes["ti_id"];
330 $v_count_2nd_tabla = 0;
331 $LACTSuccess = json_decode($JSON_DATA);
332 if($LACTSuccess->{'success'} == true){ //Servicio con la información principal trae data
333 $data = json_decode($JSON_DATA, true);
334 foreach ($data['data'] as $key => $jLARes){
335 $v_ti_id = $jLARes["ti_id"];
336 $v_ar_id = $jLARes["ar_id"];
337 $v_ar_id_pri = $jLARes["ar_id_priority"];
338 $v_est_id2 = $jLARes["est2_id_ini"];
339 $v_ini_id_x = $jLARes["ini_id"];
340 if($v_ti_id_2nd_tabla == $v_ti_id && $v_ar_id_2nd_tabla == $v_ar_id_pri){
341 if (!in_array($v_ini_id_x, $arrIni)) {
342 array_push($arrIni,$v_ini_id_x);
343 $v_count_2nd_tabla++; //Sumamos al Total por Iniciativa
344 $v_total_lat_2nd_tabla++; //Sumamos al Total Completo
345 }
346 }
347 }
348 }
349$HTML .= "<td style='text-align:center'>".$v_count_2nd_tabla."</td>";
350 }
351 }
352$HTML .= "<td style='text-align:center'>".$v_total_lat_2nd_tabla."</td>
353 </tr>";
354 }
355 }
356
357$HTML .= "</tbody>
358 <tfoot>
359 <tr style='font-size:70%;'>
360 <th>Total general</th>";
361 $v_total_2nd_tabla = 0;
362 $TIIDSuccess = json_decode($JSON_TIPO_INI);
363 if($TIIDSuccess->{'success'} == true){
364 $data = json_decode($JSON_TIPO_INI, true);
365 foreach ($data['data'] as $key => $jTIRes){
366 $arrIni=array();
367 $v_ti_id_2nd_tabla = $jTIRes["ti_id"];
368 $v_count_2nd_tabla = 0;
369 $LACTSuccess = json_decode($JSON_DATA);
370 if($LACTSuccess->{'success'} == true){ //Servicio con la información principal trae data
371 $data = json_decode($JSON_DATA, true);
372 foreach ($data['data'] as $key => $jLARes){
373 $v_ti_id = $jLARes["ti_id"];
374 $v_est_id2 = $jLARes["est2_id_ini"];
375 $v_ini_id_x = $jLARes["ini_id"];
376 if($v_ti_id_2nd_tabla == $v_ti_id){
377 if (!in_array($v_ini_id_x, $arrIni)) {
378 array_push($arrIni,$v_ini_id_x);
379 $v_count_2nd_tabla++; //Sumamos al Total por Iniciativa
380 $v_total_2nd_tabla++; //Sumamos al Total Completo
381 }
382 }
383 }
384 }
385$HTML .= "<td style='text-align:center; font-weight: bold;'>".$v_count_2nd_tabla."</td>";
386 }
387 }
388$HTML .= "<td style='text-align:center; font-weight: bold;'>".$v_total_2nd_tabla."</td>";
389$HTML .= "</tr>
390 </tfoot>
391 </table>
392 ";
393
394//////////////////////////*Fin Tabla 2*//////////////////////////
395
396
397//////////////////////////*Tabla 3*//////////////////////////
398
399$HTML .= "<h3>Cantidad de Iniciativas Por Área</h3>
400 <table border='1' >
401 <thead>
402 <tr style='background: #deebf6;font-size:70%;'>
403 <th>Tipo de Iniciativa</th>";
404 $ESTASuccess = json_decode($JSON_EST_ACT);
405 if($ESTASuccess->{'success'} == true){
406 $data = json_decode($JSON_EST_ACT, true);
407 foreach ($data['data'] as $key => $jEST){
408 $HTML .= "<th>". $jEST["est_nombre"]."</th>";
409 }
410 }
411
412$HTML .= "<th>Total General</th>
413 </tr>
414 </thead>
415 <tbody>";
416 $TIIDSuccess = json_decode($JSON_TIPO_INI);
417 if($TIIDSuccess->{'success'} == true){
418 $data = json_decode($JSON_TIPO_INI, true);
419 foreach ($data['data'] as $key => $jTIRes){
420 $arrIni=array();
421 $v_ti_id_3rd_tabla = $jTIRes["ti_id"];
422 $v_total_lat_3rd_tabla = 0;
423 $HTML .= "<tr style='font-size:70%;'>
424 <td>". $jTIRes["ti_nom"]."</td>";
425 $ESTASuccess = json_decode($JSON_EST_ACT);
426 if($ESTASuccess->{'success'} == true){
427 $data = json_decode($JSON_EST_ACT, true);
428 foreach ($data['data'] as $key => $jEST){
429 $v_est_id_3rd_tabla = $jEST["est_id"];
430 $v_count_3rd_tabla = 0;
431 $LACTSuccess = json_decode($JSON_DATA);
432 if($LACTSuccess->{'success'} == true){ //Servicio con la información principal trae data
433 $data = json_decode($JSON_DATA, true);
434 foreach ($data['data'] as $key => $jLARes){
435 $v_ti_id = $jLARes["ti_id"];
436 $v_est_id = $jLARes["est_id"];
437 $v_est_id2 = $jLARes["est2_id_ini"];
438 $v_ar_id = $jLARes["ar_id"];
439 $v_ini_id_x = $jLARes["ini_id"];
440 if($v_ti_id_3rd_tabla == $v_ti_id && $v_est_id_3rd_tabla == $v_est_id && $v_ar_id == 1){
441 if (!in_array($v_ini_id_x, $arrIni)) {
442 array_push($arrIni,$v_ini_id_x);
443 $v_count_3rd_tabla++; //Sumamos al Total por Iniciativa
444 $v_total_lat_3rd_tabla++; //Sumamos al Total Completo
445 }
446 }
447 }
448 }
449$HTML .= "<td style='text-align:center'>".$v_count_3rd_tabla."</td>";
450 }
451 }
452$HTML .= "<td style='text-align:center'>".$v_total_lat_3rd_tabla."</td>
453 </tr>";
454 }
455 }
456$HTML .= "</tbody>
457 <tfoot>
458 <tr style='font-size:70%;'>
459 <th>Total general</th>";
460 $v_total_3rd_tabla = 0;
461 $ESTASuccess = json_decode($JSON_EST_ACT);
462 if($ESTASuccess->{'success'} == true){
463 $arrIni=array();
464 $data = json_decode($JSON_EST_ACT, true);
465 foreach ($data['data'] as $key => $jEST){
466 $v_est_id_3rd_tabla = $jEST["est_id"];
467 $v_count_3rd_tabla = 0;
468 $LACTSuccess = json_decode($JSON_DATA);
469 if($LACTSuccess->{'success'} == true){ //Servicio con la información principal trae data
470 $data = json_decode($JSON_DATA, true);
471 foreach ($data['data'] as $key => $jLARes){
472 $v_est_id = $jLARes["est_id"];
473 $v_est_id2 = $jLARes["est2_id_ini"];
474 $v_ar_id = $jLARes["ar_id"];
475 $v_ini_id_x = $jLARes["ini_id"];
476 if($v_est_id_3rd_tabla == $v_est_id && $v_ar_id == 1){
477 if (!in_array($v_ini_id_x, $arrIni)) {
478 array_push($arrIni,$v_ini_id_x);
479 $v_count_3rd_tabla++; //Sumamos al Total por Iniciativa
480 $v_total_3rd_tabla++; //Sumamos al Total Completo
481 }
482 }
483 }
484 }
485$HTML .= "<td style='text-align:center; font-weight: bold;'>".$v_count_3rd_tabla."</td>";
486 }
487 }
488$HTML .= "<td style='text-align:center; font-weight: bold;'>".$v_total_3rd_tabla."</td>
489 </tr>";
490$HTML .= "</tfoot>
491 </table>
492 ";
493
494//////////////////////////*Fin Tabla 3*//////////////////////////
495
496//////////////////////////*Tabla 5*//////////////////////////
497
498//Limpiamos Array de Estado Eliminando el Estado 122 => Terminado
499$JSON_EST_ACT_FINAL5 = "";
500$ESTASuccess = json_decode($JSON_EST_ACT);
501if($ESTASuccess->{'success'} == true){
502 $data = json_decode($JSON_EST_ACT, true);
503 $i=0;
504 foreach ($data['data'] as $key => $jEST){
505 $v_est_id = $jEST["est_id"];
506 if($v_est_id == 122){
507 unset($data['data'][$i]);
508 }
509 $i++;
510 }
511 $JSON_EST_ACT_FINAL5 = json_encode($data);
512}
513
514$HTML .= "<h3>Cantidad de Actividades en Certificación por Canales</h3>
515 <table border='1' >
516 <thead>
517 <tr style='background: #deebf6;font-size:70%;'>
518 <th>Tipo de Iniciativa</th>";
519 $ESTASuccess = json_decode($JSON_EST_ACT_FINAL5);
520 if($ESTASuccess->{'success'} == true){
521 $data = json_decode($JSON_EST_ACT_FINAL5, true);
522 foreach ($data['data'] as $key => $jEST){
523 $HTML .= "<th>". $jEST["est_nombre"]."</th>";
524 }
525 }
526
527$HTML .= "<th>Total General</th>
528 </tr>
529 </thead>
530 <tbody>";
531 $TIIDSuccess = json_decode($JSON_TIPO_INI);
532 if($TIIDSuccess->{'success'} == true){
533 $data = json_decode($JSON_TIPO_INI, true);
534 foreach ($data['data'] as $key => $jTIRes){
535 $v_total_5th_tabla_ti = 0;
536 $v_ti_id_5th_tabla = $jTIRes["ti_id"];
537 $arrCanAlias=array();
538$HTML .= "<tr style='font-size:70%;'>
539 <th style='background: #efeeee; text-align:left;'>".$jTIRes["ti_nom"]."</th>";
540 $ESTASuccess = json_decode($JSON_EST_ACT_FINAL5);
541 if($ESTASuccess->{'success'} == true){
542 $data = json_decode($JSON_EST_ACT_FINAL5, true);
543 foreach ($data['data'] as $key => $jEST){
544 $v_est_id_5th_tabla = $jEST["est_id"];
545 $v_count_5th_tabla_ti = 0;
546 $LACTSuccess = json_decode($JSON_DATA);
547 if($LACTSuccess->{'success'} == true){ //Servicio con la información principal trae data
548 $data = json_decode($JSON_DATA, true);
549 foreach ($data['data'] as $key => $jLARes){
550 $v_ar_id = $jLARes["ar_id"];
551 $v_ti_id = $jLARes["ti_id"];
552 $v_est_id = $jLARes["est_id"];
553 $v_est_id2 = $jLARes["est2_id_ini"];
554 if($v_ti_id_5th_tabla == $v_ti_id && $v_est_id_5th_tabla == $v_est_id && $v_ar_id == 1){
555 $v_count_5th_tabla_ti++;
556 $v_total_5th_tabla_ti++;
557 }
558 }
559 }
560$HTML .= "<td style='text-align:center; background: #efeeee; font-weight: bold;'>".$v_count_5th_tabla_ti."</td>";
561 }
562 }
563$HTML .= "<td style='text-align:center; background: #efeeee; font-weight: bold;'>".$v_total_5th_tabla_ti."</td>";
564
565$HTML .= "</tr>";
566 $ESTASuccess = json_decode($JSON_EST_ACT_FINAL5);
567 if($ESTASuccess->{'success'} == true){
568 $data = json_decode($JSON_EST_ACT_FINAL5, true);
569 foreach ($data['data'] as $key => $jEST){
570 $v_est_id_5th_tabla = $jEST["est_id"];
571 $LACTSuccess = json_decode($JSON_DATA);
572 if($LACTSuccess->{'success'} == true){ //Servicio con la información principal trae data
573 $data = json_decode($JSON_DATA, true);
574 foreach ($data['data'] as $key => $jLARes){
575 $v_ar_id = $jLARes["ar_id"];
576 $v_ti_id = $jLARes["ti_id"];
577 $v_est_id = $jLARes["est_id"];
578 $v_est_id2 = $jLARes["est2_id_ini"];
579 $v_can_alias = $jLARes["can_alias"];
580 if($v_ti_id_5th_tabla == $v_ti_id && $v_est_id_5th_tabla == $v_est_id && $v_ar_id == 1){
581 if (!in_array($v_can_alias, $arrCanAlias)) {
582 array_push($arrCanAlias,$v_can_alias);
583 }
584 }
585 }
586 }
587 }
588 }
589 sort($arrCanAlias);
590 $arrCanAliasLength = count($arrCanAlias);
591 for($i = 0; $i < $arrCanAliasLength; $i++) {
592$HTML .= "<tr style='font-size:70%;'>
593 <td>".$arrCanAlias[$i]."</td>";
594 $ESTASuccess = json_decode($JSON_EST_ACT_FINAL5);
595 if($ESTASuccess->{'success'} == true){
596 $data = json_decode($JSON_EST_ACT_FINAL5, true);
597 foreach ($data['data'] as $key => $jEST){
598 $v_est_id_5th_tabla = $jEST["est_id"];
599 $LACTSuccess = json_decode($JSON_DATA);
600 if($LACTSuccess->{'success'} == true){ //Servicio con la información principal trae data
601 $v_count_5th_tabla_can = 0;
602 $data = json_decode($JSON_DATA, true);
603 foreach ($data['data'] as $key => $jLARes){
604 $v_ar_id = $jLARes["ar_id"];
605 $v_ti_id = $jLARes["ti_id"];
606 $v_est_id = $jLARes["est_id"];
607 $v_est_id2 = $jLARes["est2_id_ini"];
608 $v_can_alias = $jLARes["can_alias"];
609 if($arrCanAlias[$i] == $v_can_alias && $v_ti_id_5th_tabla == $v_ti_id &&
610 $v_est_id_5th_tabla == $v_est_id && $v_ar_id == 1){
611 $v_count_5th_tabla_can++;
612 $v_total_5th_tabla_can++;
613 }
614 }
615$HTML .= "<td style='text-align:center'>".$v_count_5th_tabla_can."</td>";
616 }
617 }
618 }
619$HTML .= "<td style='text-align:center'>".$v_count_5th_tabla_can."</td>";
620 }
621 }
622 }
623$HTML .= "</tr>
624 </tbody>
625 <tfoot>
626 <tr style='font-size:70%;'>
627 <th>Total general</th>";
628 $v_total_5th_tabla = 0;
629 $ESTASuccess = json_decode($JSON_EST_ACT_FINAL5);
630 if($ESTASuccess->{'success'} == true){
631 $data = json_decode($JSON_EST_ACT_FINAL5, true);
632 foreach ($data['data'] as $key => $jEST){
633 $v_est_id_5th_tabla = $jEST["est_id"];
634 $v_count_5th_tabla = 0;
635 $LACTSuccess = json_decode($JSON_DATA);
636 if($LACTSuccess->{'success'} == true){ //Servicio con la información principal trae data
637 $data = json_decode($JSON_DATA, true);
638 foreach ($data['data'] as $key => $jLARes){
639 $v_ar_id = $jLARes["ar_id"];
640 $v_est_id = $jLARes["est_id"];
641 $v_est_id2 = $jLARes["est2_id_ini"];
642 if($v_est_id_5th_tabla == $v_est_id && $v_ar_id == 1){
643 $v_count_5th_tabla++;
644 $v_total_5th_tabla++;
645 }
646 }
647 }
648$HTML .= "<td style='text-align:center; font-weight: bold;'>".$v_count_5th_tabla."</td>";
649 }
650 }
651$HTML .= "<td style='text-align:center; font-weight: bold;'>".$v_total_5th_tabla."</td>
652 </tr>";
653$HTML .= "</tfoot>
654 </table>";
655
656
657//////////////////////////*FIN Tabla 5*//////////////////////////
658
659//////////////////////////*Tabla 4*//////////////////////////
660
661$HTML .= "<h3>Cantidad de Actividades en Certificación</h3>
662 <table border='1' >
663 <thead>
664 <tr style='background: #deebf6;font-size:70%;'>
665 <th>Actividad de Certificación</th>";
666 $ESTASuccess = json_decode($JSON_EST_ACT);
667 if($ESTASuccess->{'success'} == true){
668 $data = json_decode($JSON_EST_ACT, true);
669 foreach ($data['data'] as $key => $jEST){
670 $HTML .= "<th>". $jEST["est_nombre"]."</th>";
671 }
672 }
673
674$HTML .= "<th>Total General</th>
675 </tr>
676 </thead>
677 <tbody>";
678 $arrListACT=array();
679 $ESTASuccess = json_decode($JSON_EST_ACT);
680 if($ESTASuccess->{'success'} == true){
681 $data = json_decode($JSON_EST_ACT, true);
682 foreach ($data['data'] as $key => $jEST){
683 $v_est_id_4th_tabla = $jEST["est_id"];
684 $LACTSuccess = json_decode($JSON_DATA);
685 if($LACTSuccess->{'success'} == true){ //Servicio con la información principal trae data
686 $data = json_decode($JSON_DATA, true);
687 foreach ($data['data'] as $key => $jLARes){
688 $v_aac_id = $jLARes["aac_id"];
689 $v_aac_nom = $jLARes["aac_nom"];
690 if($v_aac_nom == ""){$v_aac_nom = "N/A";}
691 $v_ar_id = $jLARes["ar_id"];
692 $v_est_id = $jLARes["est_id"];
693 $v_est_id2 = $jLARes["est2_id_ini"];
694 $v_ac_id = $jLARes["ac_id"];
695 if($v_est_id_4th_tabla == $v_est_id && $v_ar_id == 1){
696 if (!in_array($v_aac_nom, $arrListACT)) {
697 array_push($arrListACT,$v_aac_nom);
698 }
699 }
700 }
701 }
702 }
703 }
704 sort($arrListACT);
705 $arrListACTLength = count($arrListACT);
706 for($i = 0; $i < $arrListACTLength; $i++) {
707 $v_nom_act = $arrListACT[$i];
708$HTML .= "<tr style='font-size:70%;'>
709 <td>".$v_nom_act."</td>";
710 $ESTASuccess = json_decode($JSON_EST_ACT);
711 if($ESTASuccess->{'success'} == true){
712 $data = json_decode($JSON_EST_ACT, true);
713 foreach ($data['data'] as $key => $jEST){
714 $v_est_id_4th_tabla = $jEST["est_id"];
715 $v_count_4th_tabla = 0;
716 $LACTSuccess = json_decode($JSON_DATA);
717 if($LACTSuccess->{'success'} == true){ //Servicio con la información principal trae data
718 $data = json_decode($JSON_DATA, true);
719 foreach ($data['data'] as $key => $jLARes){
720 $v_aac_id = $jLARes["aac_id"];
721 $v_aac_nom = $jLARes["aac_nom"];
722 if($v_aac_nom == ""){$v_aac_nom = "N/A";}
723 $v_ar_id = $jLARes["ar_id"];
724 $v_est_id = $jLARes["est_id"];
725 $v_est_id2 = $jLARes["est2_id_ini"];
726 if($v_aac_nom == $v_nom_act && $v_est_id_4th_tabla == $v_est_id && $v_ar_id == 1){
727 $v_count_4th_tabla++;
728 $v_total_lat_4th_tabla++;
729 }
730 }
731 }
732$HTML .= "<td style='text-align:center'>".$v_count_4th_tabla."</td>";
733 }
734$HTML .= "<td style='text-align:center'>".$v_total_lat_4th_tabla."</td>";
735 }
736$HTML .= "</tr>";
737 }
738
739$HTML .= "</tbody>
740 <tfoot>
741 <tr style='font-size:70%;'>
742 <th>Total general</th>";
743 $v_total_4th_tabla = 0;
744 $ESTASuccess = json_decode($JSON_EST_ACT);
745 if($ESTASuccess->{'success'} == true){
746 $data = json_decode($JSON_EST_ACT, true);
747 foreach ($data['data'] as $key => $jEST){
748 $v_est_id_4th_tabla = $jEST["est_id"];
749 $v_count_4th_tabla = 0;
750 $LACTSuccess = json_decode($JSON_DATA);
751 if($LACTSuccess->{'success'} == true){ //Servicio con la información principal trae data
752 $data = json_decode($JSON_DATA, true);
753 foreach ($data['data'] as $key => $jLARes){
754 $v_ar_id = $jLARes["ar_id"];
755 $v_est_id = $jLARes["est_id"];
756 $v_est_id2 = $jLARes["est2_id_ini"];
757 if($v_est_id_4th_tabla == $v_est_id && $v_ar_id == 1){
758 $v_count_4th_tabla++;
759 $v_total_4th_tabla++;
760 }
761 }
762 }
763$HTML .= "<td style='text-align:center; font-weight: bold;'>".$v_count_4th_tabla."</td>";
764 }
765 }
766$HTML .= "<td style='text-align:center; font-weight: bold;'>".$v_total_4th_tabla."</td>
767 </tr>";
768$HTML .= "</tfoot>
769 </table>";
770
771
772//////////////////////////*FIN Tabla 4*//////////////////////////
773
774//////////////////////////*ECHO*//////////////////////////
775
776
777echo $HTML;
778
779/*
780//Definir Variables y Enviar
781$v_mail_to = 'mtorres@sentra.cl';
782$v_mail_cc = 'dmonardes@sentra.cl';
783$v_mail_bcc = 'dmonardes@sentra.cl';
784$v_mail_subject = 'Reporte Prueba';
785$v_mail_type_message = 'html';
786$v_mail_message = ' ';
787$v_mail_template = '1';
788$v_mail_array_param = json_encode(
789 array('[MENSAJE_CONTENIDO_EMAIL]' => $HTML,
790 '[MENSAJE_ATTE]' => 'Equipo de Procesos',
791 '[MENSAJE_FIRMA]' => 'Administrador - BPM CERTIFICACIÓN',
792 '[MENSAJE_CLIENTE]' => 'BANCO ESTADO')
793);
794
795//Enviar Correo
796$data = array( 'mail_to'=> $v_mail_to,
797 'mail_cc'=> $v_mail_cc,
798 'mail_bcc'=> $v_mail_bcc,
799 'mail_subject'=> $v_mail_subject,
800 'mail_type_message'=> $v_mail_type_message,
801 'mail_message'=> $v_mail_message,
802 'mail_template'=> $v_mail_template,
803 'mail_array_param'=> $v_mail_array_param
804 );
805$curl = curl_init();
806curl_setopt_array($curl, array(
807 CURLOPT_URL => "http://192.168.15.41:3400/proc-procesos/api/sendEmail",
808 CURLOPT_RETURNTRANSFER => true,
809 CURLOPT_ENCODING => "",
810 CURLOPT_MAXREDIRS => 10,
811 CURLOPT_TIMEOUT => 30,
812 CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
813 CURLOPT_CUSTOMREQUEST => "POST",
814 CURLOPT_POSTFIELDS => http_build_query($data),
815 CURLOPT_HTTPHEADER => array(
816 "authorization: ".$MY_TOKEN."",
817 "cache-control: no-cache",
818 "postman-token: 19598c90-2cd6-d1ea-f72e-b8b3d282df9c"
819 ),
820));
821$response = curl_exec($curl);
822$err = curl_error($curl);
823curl_close($curl);
824if ($err) {
825 echo "API Error Correo #:" . $err;
826 exit;
827} else {
828 $response = json_decode($response);
829 echo $response;
830}*/
831?>