203 lines
7.5 KiB
PHP
203 lines
7.5 KiB
PHP
<head>
|
|
<meta charset="UTF-8">
|
|
</head>
|
|
<?php
|
|
|
|
|
|
require_once('../Connections/cmctrfdb.php'); ?>
|
|
<?php require_once('../webassist/mysqli/rsobj.php');
|
|
require_once('../webassist/mysqli/queryobj.php'); ?>
|
|
<?php
|
|
//global variable
|
|
include('include/generalsettings.php');
|
|
// start fpdf
|
|
require('tcpdf/tcpdf.php');
|
|
include('languages/' . $_SESSION['langselect'] . '/tdpdflang.php');
|
|
include('languages/' . $_SESSION['langselect'] . '/tdgen.php');
|
|
|
|
function convertToPDFEncoding($string)
|
|
{
|
|
return html_entity_decode($string, ENT_QUOTES, 'UTF-8');
|
|
}
|
|
|
|
|
|
//include('include/headscript.php');
|
|
?>
|
|
<?php
|
|
if (isset($_GET["idtrf"])) {
|
|
$idtrf = $_GET["idtrf"];
|
|
}
|
|
if (isset($_POST["idtrf"])) {
|
|
$idtrf = $_POST["idtrf"];
|
|
}
|
|
//zip creation
|
|
include('include/zipcreation.php');
|
|
include('datarecover/parsedatatd.php');
|
|
$nappform = $tdData['tdnumber'];
|
|
if ($trfData['revtrf'] == 0) {
|
|
$nappformfinaltest = $tdpdftitle . ' N. ' . $nappform;
|
|
} else {
|
|
$revnbr = $trfData['revtrf'];
|
|
$nappformfinaltest = $tdpdftitle . ' N. ' . $nappform . 'R' . $revnbr;
|
|
}
|
|
if ($trfData['revtrf'] == 0) {
|
|
$nappformfinal = $pdnappform . ' ' . $nappform;
|
|
} else {
|
|
$revnbr = $trfData['revtrf'];
|
|
$nappformfinal = $pdnappform . ' ' . $nappform . 'R' . $revnbr;
|
|
}
|
|
$nappformfinaltest = html_entity_decode($nappformfinaltest, ENT_QUOTES);
|
|
$nappformfinaltest = iconv('UTF-8', 'windows-1252//IGNORE', $nappformfinaltest);
|
|
$nappformfinal = html_entity_decode($nappformfinal, ENT_QUOTES);
|
|
$nappformfinal = iconv('UTF-8', 'windows-1252//IGNORE', $nappformfinal);
|
|
//$nappformtest=$pdnappformtest.' '.$nappform;
|
|
//$nappformfinal=$nappform;
|
|
//$nappformfinal=$nappformtest;
|
|
$_SESSION["idcertificatesession"] = $idcertificate;
|
|
$_SESSION["sndrptsession"] = $sndrpt;
|
|
$_SESSION["revisioncert"] = $certificationrevision->getColumnVal("rev");
|
|
$_SESSION["revisioncertm30"] = $certificationrevision->getColumnVal("revm30");
|
|
$_SESSION["certname"] = $certificationrevision->getColumnVal("name_certification");
|
|
$_SESSION["certname30"] = $certificationrevision->getColumnVal("m30namecert");
|
|
$daterevformat = $certificationrevision->getColumnVal("date");
|
|
$timeStamp = strtotime($daterevformat);
|
|
$_SESSION["certdate"] = date("d-m-Y", $timeStamp);
|
|
$daterevformatm30 = $certificationrevision->getColumnVal("datem30");
|
|
$timeStampm30 = strtotime($daterevformatm30);
|
|
$_SESSION["certdatem30"] = date("d-m-Y", $timeStampm30);
|
|
$_SESSION["certtitle"] = $_SESSION["certname"] . ' rev. ' . $_SESSION["revisioncert"] . ' del ' . $_SESSION["certdate"];
|
|
$_SESSION["certtitlem30"] = $_SESSION["certname30"] . ' rev. ' . $_SESSION["revisioncertm30"] . ' del ' . $_SESSION["certdatem30"];
|
|
|
|
class PDF extends TCPDF
|
|
{
|
|
// Page header
|
|
public function Header()
|
|
{
|
|
// Supponendo che tu abbia delle variabili di sessione e dei path già definiti per logo e informazioni
|
|
if (isset($_SESSION['companylogo']) && !empty($_SESSION['companylogo'])) {
|
|
$companylogo = "logos/" . $_SESSION['companylogo'];
|
|
if (file_exists($companylogo)) { // Assicurati che $companylogo sia definito e contenga il path al logo
|
|
$this->Image($companylogo, 10, 10, 80, '', 'PNG', '', 'T', false, 300, '', false, false, 0, false, false, false);
|
|
}
|
|
}
|
|
$this->SetFont('helvetica', '', 7);
|
|
$this->SetY(5);
|
|
$this->Cell(0, 10, $_SESSION['companyname'], 0, false, 'R', 0, '', 0, false, 'T', 'M');
|
|
$this->Cell(0, 15, $_SESSION['companyaddress'], 0, false, 'R', 0, '', 0, false, 'T', 'M');
|
|
$this->Cell(0, 20, $_SESSION['phonemail'], 0, false, 'R', 0, '', 0, false, 'T', 'M');
|
|
|
|
$this->SetFont('helvetica', 'B', 10);
|
|
$this->SetY(20); // Regola questa posizione secondo le necessità
|
|
// Usare la variabile globale richiede che sia definita al di fuori e prima della classe, oppure passata in qualche modo
|
|
$this->Cell(0, 15, $GLOBALS['nappformfinaltest'], 0, 0, "C");
|
|
}
|
|
|
|
// Page footer
|
|
public function Footer()
|
|
{
|
|
$this->SetY(-15);
|
|
$this->SetFont('helvetica', 'I', 8);
|
|
$certtitle = $_SESSION["certtitle"];
|
|
$certtitlem30 = $_SESSION["certtitlem30"];
|
|
// Logica condizionale per il footer basata sulle tue variabili di sessione
|
|
if ($_SESSION["sndrptsession"] == 'N' && in_array($_SESSION["idcertificatesession"], [1, 3, 8, 9])) {
|
|
$this->Cell(0, 10, $certtitlem30 . ' - Pagina ' . $this->getAliasNumPage() . '/' . $this->getAliasNbPages(), 0, 0, 'C');
|
|
// Assicurati che il path all'immagine sia corretto
|
|
$this->Image('../images/cimaclaboratories.png', 10, 260, 190);
|
|
} else {
|
|
$this->Cell(0, 10, $certtitle . ' - Pagina ' . $this->getAliasNumPage() . '/' . $this->getAliasNbPages(), 0, 0, 'C');
|
|
// Assicurati che il path all'immagine sia corretto
|
|
$this->Image('../images/cimaccertifications.png', 10, 260, 190);
|
|
}
|
|
}
|
|
}
|
|
|
|
//some general data
|
|
$certname = $certificationrevision->getColumnVal("name_certification");
|
|
// Instanciation of inherited class
|
|
// Inizializza l'oggetto PDF con le impostazioni di default.
|
|
// Nota che TCPDF non ha un metodo AddFont simile a FPDF per i font; gestisce i font in modo diverso.
|
|
$pdf = new PDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
|
|
|
|
// Impostazioni base del documento
|
|
$pdf->SetCreator(PDF_CREATOR);
|
|
$pdf->SetAuthor('Nome Autore'); // Imposta l'autore del documento
|
|
$pdf->SetTitle('Titolo PDF'); // Imposta il titolo del documento
|
|
$pdf->SetSubject('Soggetto del PDF'); // Imposta il soggetto del documento
|
|
$pdf->SetKeywords('TCPDF, PDF, esempio, test, guida'); // Imposta le parole chiave
|
|
|
|
// Imposta l'alias per il numero totale di pagine che viene sostituito automaticamente con il numero effettivo di pagine.
|
|
//$pdf->AliasNbPages();
|
|
|
|
// Aggiunge una pagina
|
|
$pdf->AddPage();
|
|
|
|
// Imposta il font
|
|
// TCPDF supporta direttamente alcuni font standard come 'times', 'helvetica' e altri.
|
|
// Per utilizzare font personalizzati o non standard come 'DejaVuSans', è possibile farlo senza chiamare AddFont.
|
|
// 'DejaVuSans' è incluso in TCPDF per la gestione di codifica UTF-8.
|
|
$pdf->SetFont('dejavusans', '', 9); // Nota: TCPDF è case-insensitive per il nome del font.
|
|
|
|
// Imposta l'interruzione automatica di pagina
|
|
$pdf->SetAutoPageBreak(true, 45); // Imposta un margine inferiore di 45 mm
|
|
|
|
// from here start customization based on certification required required
|
|
// certificate 5 and 6 Table: contacts auditdpi and documents
|
|
|
|
$pdf->SetTopMargin('40');
|
|
|
|
|
|
|
|
//header manufacturer data
|
|
include('tdpdfcreation/headercertificatetable.php');
|
|
$pdf->Ln();
|
|
//header prod place
|
|
include('tdpdfcreation/prodplace.php');
|
|
$pdf->Ln();
|
|
//header risk assesment
|
|
include('tdpdfcreation/riskassesment.php');
|
|
$pdf->Ln();
|
|
//description table
|
|
//include('pdfcreation/descriptiontable.php');
|
|
$pdf->Ln();
|
|
// standards table
|
|
//include('pdfcreation/standardstable.php');
|
|
$pdf->Ln();
|
|
// additionalinfo requirements
|
|
//include('pdfcreation/addreqtable.php');
|
|
$pdf->Ln();
|
|
|
|
// additionalinfo
|
|
//include('pdfcreation/addinfotable.php');
|
|
$pdf->Ln();
|
|
|
|
// parts table
|
|
//include('pdfcreation/partstable.php');
|
|
$pdf->Ln();
|
|
|
|
// chem table
|
|
//include('pdfcreation/chemtable.php');
|
|
$pdf->Ln();
|
|
//trf option
|
|
//include('pdfcreation/trfoption.php');
|
|
$pdf->Ln();
|
|
|
|
//trf option
|
|
//include('pdfcreation/fileattached.php');
|
|
$pdf->Ln();
|
|
$pdf->Ln();
|
|
|
|
//header certificate contact
|
|
//include('pdfcreation/headercertificatetable.php');
|
|
$pdf->Ln();
|
|
//invoice contact
|
|
//include('pdfcreation/invoicecontacttable.php');
|
|
$pdf->Ln();
|
|
//Sign datatable
|
|
//include('pdfcreation/signdatatable.php');
|
|
$pdf->Ln();
|
|
|
|
//outpt pdf for all certificate
|
|
include('tdpdfcreation/pdfoutput.php');
|
|
//include('pdfcreation/pdf1sndbis.php');
|
|
?>
|