function tabla_dinamica($sql) { $tabla = "<thead style='font-size: 0.7em;'>\n\t\t<tr>\n\t\t\t<th style='text-align:left;'>Queja y/o Reclamos</th>\n\t\t\t<th style='text-align:left;'>Empresa</th>\n\t\t\t<th style='text-align:left;'>Nombre Del Representante</th>\n\t\t\t<th style='text-align:left;'>Fecha</th> \n\t\t\t<th style='text-align:left;'>Estatus</th> \n\t\t\t<th style='text-align:left;'>Motivos</th> \n\t\t</tr>\n\t</thead>\n\t<tbody style='font-size: 1.1em;'>\n\t\t"; if (empty($sql)) { $tabla .= "<span style='font-size:0.8em'>No hay registros</span>"; return $tabla; } else { foreach ($sql as $key) { $nombre = dameNombreDenuncianteQueja($key['ID_EMPRESA']); foreach ($nombre as $ke2 => $nom) { $nombre = $nom['NOMBRE']; } $tabla .= "\n\t\t\t\t<tr style='font-size: 0.6em;' data-nacionalidad='' data-cedula=''> \n\t\t\t\t\t\n\t\t\t\t\t<td style='width: 90px !important;text-align:left;'> " . $key['ID_DENUNCIA'] . " </td>\n\n\t\t\t\t\t<td style='width: 90px !important;text-align:left;'>" . $key['ID_EMPRESA'] . " " . $key['NOMBRE_EMPRESA'] . " </td>\n\n\t\t\t\t\t<td style='width: 90px !important;text-align:left;'> " . $nombre . " </td>\n\n\t\t\t\t\t<td style='width: 90px !important;text-align:left;'> " . $key['FECHA_DENUNCIA'] . " </td>\n\n\t\t\t\t\t<td style='width: 90px !important;text-align:left;'> " . $key['TIPO'] . " </td>\n\n\t\t\t\t\t<td style='width: 90px !important;text-align:left;'> " . $key['DESCRIPCION'] . " </td>\n\t\t\t\t</tr>\t\n\t\t\t\t"; } $tabla .= "</tbody>\n\t\t\t<tfoot style='display:none'>\n\t\t\t\t<tr>\n\t\t\t\t\t<th>Queja y/o Reclamos</th>\n\t\t\t\t\t<th>Empresa</th>\n\t\t\t\t\t<th>Nombre Del Representante</th>\n\t\t\t\t\t<th>Fecha</th> \n\t\t\t\t\t<th>Estatus</th> \n\t\t\t\t\t<th>Motivos</th> \n\t\t\t\t</tr>\n\t\t\t</tfoot>"; } return $tabla; }
?> <tr class="font_body2" data-nacionalidad="" data-cedula=""> <td class="td_espacio_mas1"><?php echo $key["ID_DENUNCIA"]; ?> </td> <td class="td_espacio_mas2"><?php echo $key["ID_EMPRESA"]; ?> </td> <?php $nombre = ""; if ($nombre != NULL) { $nombre = dameNombreDenuncianteQueja($key['ID_EMPRESA']); foreach ($nombre as $ke2 => $nom) { $nombre = $nom['NOMBRE']; } } else { $nombre = ""; } ?> <td class="td_espacio_mas3"><?php echo $nombre; ?> </td> <td class="td_espacio_mas4"><?php echo $key["FECHA_DENUNCIA"]; ?>
$quejas = dameQuejasFiltro($query); } // Se crea el objeto PHPExcel $objPHPExcel = new PHPExcel(); // Se asignan las propiedades del libro $objPHPExcel->getProperties()->setCreator("Edwin Garcia")->setLastModifiedBy("Edwin Garcia")->setTitle("Ivss")->setSubject("Ivss")->setDescription("Reporte")->setKeywords("Reportes")->setCategory("Reporte Excel"); $titulosColumnas = array('QUEJA Y/O RECLAMOS', 'N° PATRONAL', 'NOMBRE DEL REPRESENTANTE', 'FECHA DENUNCIA', 'FECHA CIERRE'); // Se agregan los titulos del reporte $objPHPExcel->setActiveSheetIndex(0)->setCellValue('A1', $titulosColumnas[0])->setCellValue('B1', $titulosColumnas[1])->setCellValue('C1', $titulosColumnas[2])->setCellValue('D1', $titulosColumnas[3])->setCellValue('E1', $titulosColumnas[4]); /* AGREGAR DATA AL REPORTE */ if (count($quejas) != 0) { $i = 2; foreach ($quejas as $key => $fila) { $nombre = dameNombreDenuncianteQueja(html_entity_decode($fila['ID_EMPRESA'])); if ($nombre != NULL) { foreach ($nombre as $key => $nom) { $nombre = $nom['NOMBRE']; } } else { $nombre = ""; } $objPHPExcel->setActiveSheetIndex(0)->setCellValue('A' . $i, html_entity_decode($fila['ID_DENUNCIA']))->setCellValue('B' . $i, html_entity_decode($fila['ID_EMPRESA']))->setCellValue('C' . $i, $nombre)->setCellValue('D' . $i, $fila['FECHA_DENUNCIA'])->setCellValue('E' . $i, $fila['FECHA_CIERRE']); for ($j = 'A'; $j <= 'E'; $j++) { $objPHPExcel->setActiveSheetIndex(0)->getColumnDimension($j)->setAutoSize(TRUE); } $i++; } } else { echo "no hay";