$tabla = "<table border=1>\n\t\t\t\t<tr>\n\t\t\t\t\t<td border=0 colspan=5 style=bold>Mantenimiento correctivo</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td {$tit} width=17>Fecha</td>\n\t\t\t\t\t<td {$tit} width=11>Euros</td>\n\t\t\t\t\t<td {$tit} width=85>Observaciones</td>\n\t\t\t\t\t<td {$tit} width=80>Materiales</td>\n\t\t\t\t\t<td {$tit} width=11>Horas</td>\n\t\t\t\t</tr>"; $sumaeuros = 0; $sumahoras = 0; if (!$pautas) { $tabla .= "<tr><td colspan=5>No hay registros de mantenimiento correctivo</td></tr>"; } else { foreach ($pautas as $keypau => $valorpau) { $tabla .= "<tr>\n\t\t\t\t\t\t<td {$nor}>" . $valorpau['fecha_mant'] . "</td>\n\t\t\t\t\t\t<td {$nor}>" . $valorpau['euros'] . "</td>\n\t\t\t\t\t\t<td {$nor}>" . $valorpau['observaciones'] . "</td>\n\t\t\t\t\t\t<td {$nor}>" . $valorpau['materiales'] . "</td>\n\t\t\t\t\t\t<td {$nor}>" . $valorpau['horas'] . "</td>\n\t\t\t\t\t</tr>"; $sumahoras = $sumahoras + $valorpau['horas']; $sumaeuros = $sumaeuros + $valorpau['euros']; } } $tabla .= "</table>"; $p->htmltable($tabla); $p->Ln(2); $p->Cell(80, 5, "TOTAL EUROS: " . $sumaeuros . " euros", 0, 1); $p->Cell(80, 5, "TOTAL HORAS: " . $sumahoras . " horas", 0, 1); $p->Ln(10); $pautas = select_normal("Select * from kz_tec_mant_pautas where equipo = " . $valor['id'] . ""); $color1 = 'A6A6A6'; $color2 = 'FFFFFF'; $tit = "bgcolor=#{$color1} color=#{$color2} align=center valign=middle style=bold height=8"; $nor = "align=center height=5 valign=middle"; $tabla = "<table border=1>\n\t\t\t\t<tr>\n\t\t\t\t\t<td colspan=3 style=bold border=0>Mantenimiento preventivo</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td {$tit} width=93>Descripcion</td>\n\t\t\t\t\t<td {$tit} width=15>Periodo</td>\n\t\t\t\t\t<td {$tit} width=17>Inicio</td>\n\t\t\t\t\t<td {$tit} width=17>Fin</td>\n\t\t\t\t\t<td {$tit} width=62>Responsable</td>\n\t\t\t\t</tr>"; $sumaeuros = 0; $sumahoras = 0; if (!$pautas) { $tabla .= "<tr><td colspan=5>No hay registros de mantenimiento preventivo</td></tr>"; } else { foreach ($pautas as $keypau => $valorpau) { $tabla .= "<tr>\n\t\t\t\t\t\t<td {$nor}>" . $valorpau['descripcion'] . "</td>\n\t\t\t\t\t\t<td {$nor}>" . $valorpau['periodicidad'] . " " . html_entity_decode("días") . "</td>\n\t\t\t\t\t\t<td {$nor}>" . $valorpau['fechainicio'] . "</td>\n\t\t\t\t\t\t<td {$nor}>" . $valorpau['fechafin'] . "</td>\n\t\t\t\t\t\t<td {$nor}>" . $valorpau['responsable'] . "</td>\n\t\t\t\t\t</tr>";
$p->HTMLtable($tabla); $tabla = "<table>\n\t\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t\t<td {$tit}>" . $valor['tipo_accion'] . "</td>\n\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t</table>"; $p->ln(5); $p->htmltable($tabla); $color1 = 'A6A6A6'; $color2 = 'FFFFFF'; $tit = "bgcolor=#{$color1} color=#{$color2} align=center valign=middle style=bold height=8"; $nor = "align=center height=5 valign=middle"; $tabla = "<table border=1>\n\t\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t\t<td {$tit} width=20>Num NC</td>\n\t\t\t\t\t\t\t\t\t<td {$tit} width=23>Fecha apertura</td>\n\t\t\t\t\t\t\t\t\t<td {$tit} width=140>Causa probable</td>\n\t\t\t\t\t\t\t\t\t<td {$tit} width=54>" . html_entity_decode("Tipo acción") . "</td>\n\t\t\t\t\t\t\t\t\t<td {$tit} width=15>Coste</td>\n\t\t\t\t\t\t\t\t\t<td {$tit} width=19>Fecha cierre</td>\n\t\t\t\t\t\t\t\t\t<td {$tit} width=19>Cierre eficaz</td>\n\t\t\t\t\t\t\t\t</tr>"; } } $tabla .= "<tr>\n\t\t\t\t\t\t<td {$nor}>" . $ARRAY_NC[$valor['num_nc']] . "</td>\n\t\t\t\t\t\t<td {$nor}>" . $valor['fecha_apertura'] . "</td>\n\t\t\t\t\t\t<td {$nor}>" . $valor['causa_probable'] . "</td>\n\t\t\t\t\t\t<td {$nor}>" . $valor['tipo_accion'] . "</td>\n\t\t\t\t\t\t<td {$nor}>" . $valor['coste'] . "</td>\n\t\t\t\t\t\t<td {$nor}>" . $valor['fecha_cierre'] . "</td>\n\t\t\t\t\t\t<td {$nor}>" . siono($valor['cierre_eficaz']) . "</td>\n\t\t\t\t\t</tr>"; $tipo_accion_ul = $valor['tipo_accion']; } $coste[$valor['tipo_accion']] = $coste[$valor['tipo_accion']] + $valor['coste']; $sumacoste = $sumacoste + $valor['coste']; } if ($_POST['modo_resumen']) { $tabla .= "</table>"; $p->HTMLtable($tabla); } $p->ln(5); foreach ($coste as $keycoste => $valorcoste) { $p->Cell(40, 5, "COSTE de -> {$keycoste}: {$valorcoste} euros", 0, 1); } $p->ln(5); $p->Cell(40, 5, "COSTE TOTAL OCASIONADO: {$sumacoste} euros", 0, 1); } $p->output(); } }
$perfiles = select_normal("Select * from kz_tec_rrhh_perfilespuestos"); require FPDF_PDF_RUTA . 'lib/pdftable.inc.php'; $p = new PDFTable('P'); $p->SetMargins(3, 43, 0); if ($perfiles) { $table = "<table border=1>\n\t\t<tr>\n\t\t\t<th>Nombre</th>\n\t\t\t<th>Funciones</th>\n\t\t\t<th>Formacion</th>\n\t\t\t<th></th>\n\t\t\t<th>Experiencia</th>\n\t\t\t<th>" . html_entity_decode("Características") . "</th> \n\t\t\t<th></th>\n\t\t</tr>"; foreach ($perfiles as $key => $valor) { $p->AddPage('P'); $p->SetMargins(3, 10, 0); $p->titulo(5, $titulo); $p->setfont('Arial', '', 8); $p->SetTitle(date("d-m-Y") . "_informe"); $p->SetFillColor(166, 166, 166); $p->SetTextColor(255, 255, 255); $p->SetDrawColor(0, 0, 0); $p->Cell(204, 10, "PERFILES DE PUESTO", 1, 1, "C", true); $p->Ln(5); $p->SetFillColor(255, 255, 255); $p->SetTextColor(175, 175, 175); $p->Cell(180, 10, "" . html_entity_decode("Denominación del puesto") . "", 0, 1, "LB"); $p->SetTextColor(0, 0, 0); $p->SetFontSize(15); $p->Cell(180, 5, $valor['nombre'], 0, 1, "L"); $p->Ln(8); $p->SetFontSize(10); $p->SetTextColor(175, 175, 175); $p->Cell(80, 10, "Funciones", 0, 1); $p->SetTextColor(0, 0, 0); $tabla = "<table>\n\t\t\t\t<tr>\n\t\t\t\t\t<td>" . $valor['funciones'] . "</td>\n\t\t\t\t</tr>\n\t\t\t</table>"; $p->htmltable($tabla); $p->Ln(8);
$equipos = select_normal("Select * from kz_tec_mant_equipos {$filtroequipo} order by numero"); if ($_POST['pdf']) { require FPDF_PDF_RUTA . 'lib/pdftable.inc.php'; $p = new PDFTable('L'); $p->SetMargins(3, 43, 0); $p->AddPage('L'); $p->SetMargins(3, 10, 0); $p->titulo(5, $titulo); $p->setfont('Arial', '', 8); $p->SetTitle(date("d-m-Y") . "_informe"); $p->SetFillColor(255, 255, 255); $p->SetTextColor(0, 0, 0); $p->SetDrawColor(0, 0, 0); $equipo = select_normal("Select * from kz_tec_mant_equipos where id = " . $_POST['equipo'] . ""); $equipo = $equipo[0]; $p->Cell(0, 3, "" . html_entity_decode("Año mant.") . ": " . $_POST['anno'], 0, 1); $p->Cell(0, 3, "Equipo: " . $equipo['numero'] . " || " . $equipo['ref'] . " || " . $equipo['fab'] . " || " . $equipo['modelo'], 0, 1); $p->Ln(5); $p->HTMLtable($tabla); $pautas = select_normal("Select * from kz_tec_mant_pautas where equipo= '" . $_POST['equipo'] . "'"); if ($pautas) { foreach ($pautas as $key => $valor) { $fechainicio = explode('-', $valor['fechainicio']); $fechafin = explode('-', $valor['fechafin']); $Y = $fechainicio[0]; $incremento = 0; foreach ($valor as $key3 => $valor3) { $pautas2[$key][$key3] = $valor3; } $arraypauta[$key][count($arraypauta[$key])] = $valor['fechainicio']; $fechasiguiente = date("Y-m-d", mktime(0, 0, 0, $fechainicio[1], $fechainicio[2], $fechainicio[0]));
} $reuniones = select_normal("SELECT * FROM kz_tec_dir_reuniones where 1 = 1 {$filtros} order by fecha desc"); if ($reuniones) { if ($_POST['pdf']) { require FPDF_PDF_RUTA . 'lib/pdftable.inc.php'; $p = new PDFTable('P'); $p->SetMargins(3, 43, 0); $p->AddPage('P'); $p->SetMargins(3, 10, 0); $p->titulo(5, $titulo); $p->setfont('Arial', '', 8); $p->SetTitle(date("d-m-Y") . "_informe"); $p->SetFillColor(255, 255, 255); $p->SetTextColor(0, 0, 0); $p->SetDrawColor(0, 0, 0); $p->Cell(0, 3, "Fecha inicio: " . $_POST['fecha1'], 0, 1); $p->Cell(0, 3, "Fecha fin: " . $_POST['fecha2'], 0, 1); foreach ($reuniones as $key => $valor) { //CASO DE AGRUPAR POR if ($valor['fecha'] != $tipo_accion_ul) { $tabla .= "</table>"; $p->HTMLtable($tabla); $p->ln(5); $color1 = '5F5F5F'; $color2 = 'FFFFFF'; $tit = "bgcolor=#{$color1} color=#{$color2} align=center valign=middle style=bold height=4"; $tabla = "<table>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td {$tit} width=204>" . $valor['fecha'] . "</td>\n\t\t\t\t\t</tr>\n\t\t\t\t</table>"; $p->htmltable($tabla); $color1 = 'A6A6A6'; $color2 = 'FFFFFF'; $tit = "bgcolor=#{$color1} color=#{$color2} align=center valign=middle style=bold height=8";
$pdf = new PDFTable(); /* $pdf->AddFont($defFont,'','malgun.ttf',true); $pdf->AddFont('malgunbd','','malgunbd.ttf',true); */ $pdf->SetCreator("DigitalEMC"); $pdf->SetAuthor($company['CR_COMP_ECEO']); $pdf->SetTitle("Quotation/Invoice Form"); $pdf->SetSubject($estinfo["CR_ESTM_SEQ"]); $pdf->SetMargins(10, 10); $pdf->SetDrawColor(0, 0, 0); $pdf->SetTextColor(0, 0, 0); $pdf->AddPage(); $pdf->Image($homedir . 'data' . $company['CR_COMP_E_LOGO'], 10, 6, 30); $pdf->SetFont($defFont, '', 15); $pdf->Cell(180, 10, $company['CR_COMP_E_TAGLINE'], 0, 0, 'R'); $pdf->Ln(20); $pdf->SetFont('malgunbd', '', 24); $title_width = 180; $pdf->SetX((210 - $title_width) / 2); $pdf->SetLineWidth(0.4); $pdf->Cell($title_width, 18, $title, 'TRBL', 1, 'C'); $pdf->Ln(6); $pdf->SetLineWidth(0.4); $pdf->SetPadding(2); $pdf->SetSpacing(2); $pdf->SetFont($defFont, '', 10, true); $pdf->htmltable($table1); $pdf->Ln(6); $pdf->SetFont($defFont, '', 12, true); $pdf->htmltable($table2);
} $equipos = select_normal("Select * from kz_tec_mant_equipos where 1 = 1 {$filtroequipo} order by numero"); if ($equipos) { if ($_POST['pdf']) { require FPDF_PDF_RUTA . 'lib/pdftable.inc.php'; $p = new PDFTable('P'); $p->SetMargins(3, 43, 0); $p->AddPage('P'); $p->SetMargins(3, 10, 0); $p->titulo(5, $titulo); $p->setfont('Arial', '', 8); $p->SetTitle(date("d-m-Y") . "_informe"); $p->SetFillColor(255, 255, 255); $p->SetTextColor(0, 0, 0); $p->SetDrawColor(0, 0, 0); $p->Cell(0, 3, "Fecha inicio: " . $_POST['fecha1'], 0, 1); $p->Cell(0, 3, "Fecha fin: " . $_POST['fecha2'], 0, 1); $p->ln(5); if ($equipos) { foreach ($equipos as $key => $valor) { $mant = select_normal("Select * from kz_tec_mant_correctivo where equipo = " . $valor['id'] . " {$filtrosmant} order by fecha_mant desc"); if ($mant) { $color1 = 'A6A6A6'; $color2 = 'FFFFFF'; $tit = "bgcolor=#{$color1} color=#{$color2} align=center valign=middle style=bold height=8"; $nor = "align=center height=5 valign=middle"; $tabla = "<table border=1>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td {$tit} width=34>" . html_entity_decode("Número equipo") . "</td>\n\t\t\t\t\t\t\t<td {$tit} width=34>Ref.</td>\n\t\t\t\t\t\t\t<td {$tit} width=34>Fabricante</td>\n\t\t\t\t\t\t\t<td {$tit} width=34>Modelo</td>\n\t\t\t\t\t\t\t<td {$tit} width=34>Tipo</td>\n\t\t\t\t\t\t\t<td {$tit} width=34>Referencia</td>\n\t\t\t\t\t\t</tr>"; $tabla .= "<tr>\n\t\t\t\t\t\t\t<td {$nor}>" . $valor['numero'] . "</td>\n\t\t\t\t\t\t\t<td {$nor}>" . $valor['ref'] . "</td>\n\t\t\t\t\t\t\t<td {$nor}>" . $valor['fab'] . "</td>\t\n\t\t\t\t\t\t\t<td {$nor}>" . $valor['modelo'] . "</td>\n\t\t\t\t\t\t\t<td {$nor}>" . $valor['tipo'] . "</td>\t\n\t\t\t\t\t\t\t<td {$nor}>" . $valor['referencia'] . "</td>\n\t\t\t\t\t\t</tr>"; $tabla .= "</table>"; $p->SetMargins(10, 43, 0); $p->htmltable($tabla);
if ($_POST['fecha2'] != '') { $filtros .= " and fechaencuesta <= '" . $_POST['fecha2'] . "'"; } require FPDF_PDF_RUTA . 'lib/pdftable.inc.php'; $p = new PDFTable('L'); $p->SetMargins(3, 43, 0); $p->AddPage('L'); $p->SetMargins(3, 10, 0); $p->titulo(5, $titulo); $p->setfont('Arial', '', 8); $p->SetTitle(date("d-m-Y") . "_revision_direccion"); $p->SetFillColor(255, 255, 255); $p->SetTextColor(0, 0, 0); $p->SetDrawColor(0, 0, 0); if ($_POST['cliente'] != '') { $p->Cell(0, 3, "Cliente: " . $_POST['cliente'], 0, 1); } else { $p->Cell(0, 3, "Cliente: TODOS", 0, 1); } $p->Cell(0, 3, "Fecha inicio: " . $_POST['fecha1'], 0, 1); $p->Cell(0, 3, "Fecha fin: " . $_POST['fecha2'], 0, 1); $p->ln(5); $p->Cell(40, 5, "Tabla de valoraciones", 0, 1); $color1 = 'A6A6A6'; $color2 = 'FFFFFF'; $color3 = 'CECECE'; $tit = "bgcolor=#{$color1} color=#{$color2} align=center valign=middle style=bold height=8"; $tit2 = "bgcolor=#{$color3} color=#{$color2} align=center valign=middle style=bold height=8"; $nor = "align=center height=5 valign=middle"; $clientes_entre_fechas = select_normal("Select * from kz_tec_mej_encuesta where 1 = 1 {$filtros} order by fechaencuesta"); foreach ($clientes_entre_fechas as $key => $valor_clientes) {
$p->titulo(5, $titulo); $p->setfont('Arial', '', 8); $p->SetTitle(date("d-m-Y") . "_informe"); $p->SetFillColor(255, 255, 255); $p->SetTextColor(0, 0, 0); $p->SetDrawColor(0, 0, 0); $color1 = 'A6A6A6'; $color2 = 'FFFFFF'; $tit = "bgcolor=#{$color1} color=#{$color2} align=center valign=middle style=bold height=8"; $nor = "align=center height=5 valign=middle"; $filtrostab = "<table>"; $filtrostab .= $l_filtros; $filtrostab .= "</table>"; $p->HTMLtable($filtrostab); $p->ln(5); $p->Cell(0, 3, "Cantidad total de NC: " . count($nc), 0, 1); $p->Ln(5); $tabla = "<table border=1>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td {$tit} width=25>CNC</td>\n\t\t\t\t\t\t<td {$tit} width=20>Fecha detec.</td>\n\t\t\t\t\t\t<td {$tit} width=25>Origen de la NC</td>\n\t\t\t\t\t\t<td {$tit} width=32>Especific. de origen</td>\n\t\t\t\t\t\t<td {$tit} width=27>Clasific. de origen</td>\n\t\t\t\t\t\t<td {$tit} width=30>Detectada por</td>\n\t\t\t\t\t\t<td {$tit} width=75>" . html_entity_decode("Resumen descripción") . "</td>\n\t\t\t\t\t\t<td {$tit} width=10>Coste</td>\n\t\t\t\t\t\t<td {$tit} width=10>Unid.</td>\n\t\t\t\t\t\t<td {$tit} width=19>Fecha cierre</td>\n\t\t\t\t\t\t<td {$tit} width=17>Cierre efic.</td>\n\t\t\t\t\t</tr>"; } if ($nc) { foreach ($nc as $key => $valor) { if (!$_POST['modo_resumen']) { $p->AddPage('P'); $p->SetMargins(3, 10, 0); $p->titulo(5, $titulo); $p->setfont('Arial', '', 8); $p->SetTitle(date("d-m-Y") . "_informe"); $p->SetFillColor(255, 255, 255); $p->SetTextColor(0, 0, 0); $p->SetDrawColor(0, 0, 0); $filtrostab = "<table>";
} } $tablam .= "</table>"; if ($_POST['xls']) { echo $tabladocs . $tablam; } if ($_POST['pdf']) { require FPDF_PDF_RUTA . 'lib/pdftable.inc.php'; $p = new PDFTable('P'); $p->SetMargins(3, 43, 0); $p->AddPage('L'); $p->SetMargins(3, 10, 0); $p->titulo(5, $titulo); $p->setfont('Arial', '', 8); $p->SetTitle(date("d-m-Y") . "_informe"); $p->SetFillColor(255, 255, 255); $p->SetTextColor(0, 0, 0); $p->SetDrawColor(0, 0, 0); if ($_POST['tipodoc']) { $p->Cell(0, 3, "Tipo de documento: " . $_POST['tipodoc'], 0, 1); } else { $p->Cell(0, 3, "Tipo de documento: TODOS", 0, 1); } $p->Ln(5); $p->htmltable($tablam); $p->output(); } } else { echo "<script>alert('No se puede mostrar el informe. No hay documentos.');</script>"; echo "<script>window.close();</script>"; }
* PDF ÆÄÀÏ »ý¼º *------------------------------------------------------------------------*/ $pdf = new PDFTable(); $pdf->SetCreator("DigitalEMC"); $pdf->SetAuthor($_SESSION["MemID"]); $pdf->SetTitle("Quotation/Invoice Form"); $pdf->SetSubject($entry["doc_num"]); $pdf->SetMargins(15, 15); $pdf->AddFont('nanum', '', 'FONT00.TTF', true); $pdf->SetDrawColor(0, 0, 0); $pdf->SetTextColor(0, 0, 0); $pdf->SetFont('nanum', '', 24); $pdf->AddPage(); $title_width = 80; $pdf->SetX((210 - $title_width) / 2); $pdf->SetLineWidth(0.5); $pdf->Cell($title_width, 13, _utf8($title), 'B', 1, 'C'); $pdf->Ln(6); $pdf->SetLineWidth(0.1); $pdf->SetPadding(2); $pdf->SetSpacing(2); $pdf->SetFont('nanum', '', 12, true); $pdf->htmltable(_utf8($table1)); $pdf->Ln(6); $pdf->SetFont('nanum', '', 10, true); $pdf->htmltable(_utf8($table2)); $pdf->htmltable(_utf8($table3)); $pdf->htmltable(_utf8($table4)); $pdf->htmltable(_utf8($table5)); //$pdf->Output("pdf/{$PDF_File}","F"); $pdf->Output("doc.pdf", "I");