ppeasy/public/bckpdf-creation.php

180 lines
5.3 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?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('fpdf/fpdf.php');
include('languages/it/pdflang.php');
//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/parsedata.php');
$nappform=$trfData['trfnumber'];
$nappform="APPLICATION FORM".' '.$nappform;
class PDF extends FPDF
{
// Page header
function Header()
{
// Logo
$this->Image('../images/cimac-logo.png',5,5,60);
$this->SetFont('Arial','',7);
$this->Cell(0,-5,'A.N.C.I. Servizi S.r.l. a socio unico',0,0,"R");
$this->Cell(0,2,'Sede operativa / Operational headquarters: Via Aguzzafame 60/b - 27029 Vigevano (PV)',0,0,"R");
$this->Cell(0,9,'ORGANISMO NOTIFICATO / NOTIFIED BODY N. 0465',0,0,"R");
$this->SetFont('Arial','B',14);
$this->Cell(-180,25,$GLOBALS['nappform'],0,0,"C");
// Line break
$this->Ln(20);
}
// Page footer
function Footer()
{
// Position at 1.5 cm from bottom
$this->SetY(-15);
// Arial italic 8
$this->SetFont('Arial','',8);
// Page number
$this->Cell(0,10,'M18a rev. 5 del 29.06.2022 - Pagina '.$this->PageNo().'/{nb}',0,0,'C');
}
}
// Instanciation of inherited class
$pdf = new PDF();
$pdf->AliasNbPages();
$pdf->AddPage();
$pdf->SetFont('Times','',9);
$pdf->Cell(0,0,'Ai sensi e per gli effetti dellart. 6 del REG 01 "Regolamento per la valutazione della conformità dei Dispositivi di Protezione',0,1);
$pdf->Cell(0,9,'Individuale secondo il Regolamento (UE) 2016/425" disponibile sul nostro sito web www.cimac.it /',0,1);
$pdf->Cell(0,0,'For the purposes of Article 6 of the REG 01 "Regulation for the assessment of the conformity of Personal Protective Equipment ',0,1);
$pdf->Cell(0,9,'according to Regulation (EU) 2016/425" available on our website www.cimac.it',0,1);
// from here start customization based on certification required required
// certificate 5 and 6 Table: contacts auditdpi and documents
if ($idcertificate==5 || $idcertificate==6) {
include('include/pdf5and6.php');
} else {
//othercertificate
$pdf->SetFont('Arial','',9);
$pdf->SetFont('','B','10');
$pdf->Cell(190,6,$appformn,1,0,'C');
$pdf->Ln();
$pdf->SetFont('','',9);
$pdf->Cell(50,6,'Tipo Certifcazione',1,0,'C');
$pdf->SetFillColor(232, 242, 255);
$pdf->Cell(70,6,'',1,0,'C',TRUE);
//$pdf->Cell(70,50,'Terza',1,0,'C');
$pdf->Cell( 70, 42, $pdf->Image($image1, $pdf->GetX() + 10, $pdf->GetY(), 42), 1, 0, 'C');
$pdf->Cell(1,6,'',0,0,'C');
$pdf->Ln();
$pdf->Cell(50,6,'Data inserimento',1,0,'C');
$pdf->Cell(70,6,'',1,0,'C',TRUE);
$pdf->Ln();
$pdf->Cell(50,6,$pdfdescriptionpart,1,0,'C');
$pdf->Cell(70,6,$trfData['sample_description'],1,0,'C',TRUE);
$pdf->Ln();
$pdf->Cell(50,6,$pdfarticlekind,1,0,'C');
$pdf->Cell(70,6,$trfData['name_articletype'],1,0,'C',TRUE);
$pdf->Ln();
$pdf->Cell(50,6,$pdfmodeltitle,1,0,'C');
$pdf->Cell(70,6,'Seconda',1,0,'C',TRUE);
$pdf->Ln();
$measuretotal=$trfData['measurefrom']."-".$trfData['measureto'];
$pdf->Cell(50,6,$pdfrangemeasure,1,0,'C');
$pdf->Cell(70,6,$measuretotal,1,0,'C',TRUE);
$pdf->Ln();
$pdf->Cell(50,6,$pdfregisteredmark,1,0,'C');
$pdf->Cell(70,6,$trfData['registeredmark'],1,0,'C',TRUE);
$pdf->Ln();
$pdf->Ln();
// standards table
$pdf->SetFont('','B','10');
$pdf->Cell(190,6,$pdfstandardsel,1,0,'C');
$pdf->Ln();
$pdf->Cell(100,6,$pdfstandard,1,0,'C');
$pdf->Cell(45,6,$pdfprotection,1,0,'C');
$pdf->Cell(45,6,$pdfdpi,1,0,'C');
$pdf->Ln();
$pdf->SetFont('','','9');
$wa_startindex = 0;
while(!$stdinfo->atEnd()) {
$wa_startindex = $stdinfo->Index;
$stdnamecode=$stdinfo->getColumnVal("standardcode")."-".$stdinfo->getColumnVal("standardname");
$pdf->Cell(100,6,$stdnamecode,1,0,'L',TRUE);
$pdf->Cell(45,6,$stdinfo->getColumnVal("idprotectiocategory"),1,0,'L', TRUE);
$pdf->Cell(45,6,$stdinfo->getColumnVal("iddpicategory"),1,0,'L', TRUE);
$pdf->Ln();
$stdinfo->moveNext();
}
$stdinfo->moveFirst(); //return RS to first record
unset($wa_startindex);
unset($wa_repeatcount);
$pdf->Ln();
// additionalinfo table
$pdf->SetFont('','B','10');
$pdf->Ln();
$pdf->Cell(100,6,$pdfaddrequirements,1,0,'C');
$pdf->Ln();
$pdf->SetFont('','','9');
$wa_startindex = 0;
while(!$addreqlist->atEnd()) {
$wa_startindex = $stdinfo->Index;
$pdf->Cell(100,6,$addreqlist->getColumnVal("name_additionalrequirements_it"),1,0,'L',TRUE);
$pdf->Ln();
$addreqlist->moveNext();
}
$addreqlist->moveFirst(); //return RS to first record
unset($wa_startindex);
unset($wa_repeatcount);
$pdf->Ln();
}
//outpt pdf
//$pdf->Output();
$filepathname="applicationform-".$trfData['trfnumber'].".pdf";
$filename="pdf/".$filepathname;
$pdf->Output($filename,'F');
$UpdateQuery = new WA_MySQLi_Query($cmctrfdb);
$UpdateQuery->Action = "update";
$UpdateQuery->Table = "`trf-details`";
$UpdateQuery->bindColumn("pdffilename", "s", "$filepathname", "WA_DEFAULT");
$UpdateQuery->addFilter("idtrfdetails", "=", "i", "".($idtrf) ."");
$UpdateQuery->execute();
$UpdateGoTo = "";
if (function_exists("rel2abs")) $UpdateGoTo = $UpdateGoTo?rel2abs($UpdateGoTo,dirname(__FILE__)):"";
$UpdateQuery->redirect($UpdateGoTo);
?>