ppeasy/public/pdfcreation/descriptiontablenocert.php

106 lines
4.2 KiB
PHP

<?php
$pdf->SetFont('Arial', '', 9);
$pdf->SetFont('', 'B', '10');
//$pdf->Cell(190,6,$appformn,1,0,'C');
//$pdf->Ln();
$pdf->SetFont('', '', 8);
$pdf->Cell(50, 6, $pdfdescriptionpart, 1, 0, 'L');
$pdf->SetFillColor(232, 242, 255);
$pdf->Cell(140, 6, $trfData['sample_description'], 1, 0, 'L', TRUE);
$pdf->Ln();
$pdf->Cell(50, 7, '', 1, 0, 'L');
$pdf->SetFillColor(232, 242, 255);
$certrev1 = html_entity_decode($certname = $certificationrevision->getColumnVal("description"), ENT_QUOTES);
// $certrev = iconv('UTF-8', 'windows-1252', $certrev1);
$certrev = iconv('UTF-8', 'windows-1252//IGNORE', $certrev1);
//$certrev = iconv('UTF-8', 'windows-1252', $certrev);
$pdf->Cell(70, 7, '', 1, 0, 'L', TRUE);
//$pdf->Cell(70,50,'Terza',1,0,'C');
if (isset($trfData['photofilename'])) {
// $pdf->Cell( 70, 42, $pdf->Image($image1, $pdf->GetX() + 10, $pdf->GetY(), 42), 1, 0, 'L');
// $pdf->Cell( 70, 42, $pdf->Image($image1, $pdf->GetX(), $pdf->GetY(), -120, 42), 1, 0, 'L');
$pdf->Cell(70, 42, $pdf->centreImage($image1, 70, 42, "S"), 1, 0, 'C');
} else {
$image1 = "uploadimages/notav.jpg";
// $pdf->Cell( 70, 42, $pdf->Image($image1, $pdf->GetX() + 10, $pdf->GetY(), 42), 1, 0, 'L');
$pdf->Cell(70, 42, $pdf->Image($image1, $pdf->GetX(), $pdf->GetY(), 0, 42), 1, 0, 'L');
}
$pdf->Cell(1, 7, '', 0, 0, 'L');
$pdf->Ln();
$pdf->Cell(50, 7, $dateinsertpdf, 1, 0, 'L');
if ((Auth::user()->hasRole('Admin')) || (Auth::user()->hasRole('User')) || (Auth::user()->hasRole('Superuser'))) :
if ($sndrpt == 'Y') {
$signed = $trfData['signedonsecondcert'];
} else {
$signed = $trfData['signedon'];
}
if ($sndrpt == 'N') {
// Prova a creare un oggetto DateTime dalla variabile $signed
$dateObject = DateTime::createFromFormat('Y-m-d', $signed);
// Verifica se la creazione della data ha avuto successo
if ($dateObject !== false) {
// Se ha successo, formatta la data
$newDate = $dateObject->format('d-m-Y');
} else {
// Se la creazione della data fallisce, imposta $newDate come una stringa vuota
$newDate = ''; // Impostato come vuoto
}
}
endif;
if ((Auth::user()->hasRole('CustomerService'))) :
if ($sndrpt == 'Y') {
$signed = "";
} else {
$signed = "";
}
if ($sndrpt == 'N') {
$newDate = "";
}
endif;
$pdf->Cell(70, 7, $newDate, 1, 0, 'L', TRUE);
$pdf->Ln();
$pdf->Cell(50, 7, $pdfarticlekind, 1, 0, 'L');
// Verifica la lingua scelta e imposta il nome appropriato dell'articolo
$articleName = ($_SESSION['langselect'] == 'it') ? $trfData['name_articletype'] : $trfData['name_articletypeeng'];
// Stampa la cella con il nome dell'articolo corretto
$pdf->Cell(70, 7, $articleName, 1, 0, 'L', TRUE);
$pdf->Ln();
$pdf->Cell(50, 7, $pdfmodeltitle, 1, 0, 'L');
// Verifica la lingua scelta e imposta il nome del modello appropriato
$modelName = ($_SESSION['langselect'] == 'it') ? $trfData['namemodelarticle'] : $trfData['namemodelarticle_eng'];
// Stampa la cella con il nome del modello corretto
$pdf->Cell(70, 7, $modelName, 1, 0, 'L', TRUE);
$pdf->Ln();
$measuretotal = $trfData['measurefrom'] . "-" . $trfData['measureto'];
$pdf->Cell(50, 6, $pdfrangemeasure, 1, 0, 'L');
$pdf->Cell(70, 6, $measuretotal, 1, 0, 'L', TRUE);
$pdf->Ln();
$pdf->Cell(50, 6, $pdfregisteredmark, 1, 0, 'L');
$pdf->Cell(70, 6, $trfData['registeredmark'], 1, 0, 'L', TRUE);
$pdf->Ln();
$idartchs = explode(",", $trfData['idarticle_characteristics']);
foreach ($idartchs as $idartch) {
$artchname = new WA_MySQLi_RS("artchname", $cmctrfdb, 1);
$artchname->setQuery("SELECT * FROM `article_characteristic` WHERE `article_characteristic`.idarticlecharacteristic='$idartch'");
$artchname->execute();
$pdf->Cell(50, 6, $kinddpipdf, 1, 0, 'L');
// Determina quale campo utilizzare in base alla lingua selezionata
$articleCharacteristic = ($_SESSION['langselect'] == 'it') ?
$artchname->getColumnVal("name_articlecharacteristic") :
$artchname->getColumnVal("name_articlecharacteristic_eng");
// Stampa la cella con il valore caratteristico dell'articolo corretto
$pdf->Cell(140, 6, $articleCharacteristic, 1, 0, 'L', TRUE);
$pdf->Ln();
}