ppeasy/public/pdfcreation/auditablem18b.php

148 lines
6.7 KiB
PHP

<?php
//invoice contacts
// ***start with invoice address
$pdf->SetFont('', '', 8);
$pdf->Cell(90, 6, $certificationtypedtitle, 1, 0, 'C');
$pdf->SetFillColor(232, 242, 255);
$certificationtyped = $trfData['certificationtyped'];
// Definisci i valori corrispondenti
switch ($certificationtyped) {
case 1:
$certificationtyped_label = $certd_1;
break;
case 2:
$certificationtyped_label = $certd_2;
break;
case 3:
$certificationtyped_label = $certd_3;
break;
case 4:
$certificationtyped_label = $certd_4;
break;
default:
$certificationtyped_label = $certd_1; // Valore predefinito se non corrisponde a nessun caso
}
// Inserisci la label corretta nel PDF
$pdf->Cell(100, 6, $certificationtyped_label, 1, 0, 'C', TRUE);
$pdf->Ln();
$pdf->Ln();
$kindcont = 'audit';
// parse contacts data with variable kindofcontacts
$contactsinfo = mysqli_query($cmctrfdb, "SELECT * FROM contacts WHERE contacts.idtrf='$idtrf' AND contacts.kindofcontacts='$kindcont'");
// Stampa $audititletop una volta sola all'inizio
$pdf->SetFont('Arial', '', 8);
$pdf->SetTextColor(0, 0, 0);
$pdf->SetFont('', 'B', '10');
$audititletop = html_entity_decode($auditplacepdf, ENT_QUOTES, 'UTF-8');
$audititletop = iconv('UTF-8', 'windows-1252', $audititletop);
$pdf->Cell(190, 6, $audititletop, 1, 0, 'C');
$pdf->Ln();
// Inizializza il contatore per il numero sequenziale delle sedi
$sitenumber = 1;
// Verifica se ci sono dati e itera su ogni record
while ($contactsinfoData = mysqli_fetch_assoc($contactsinfo)) {
$companyname = html_entity_decode($contactsinfoData['companyname'], ENT_QUOTES, 'UTF-8');
// Titolo per ogni sede con numero sequenziale
$pdf->SetFont('Arial', '', 10);
$pdf->Cell(190, 6, $sitentitle . " " . $sitenumber, 1, 0, 'C');
$pdf->Ln();
$sitenumber++; // Incrementa il numero sequenziale per ogni sede
// Stampa dei dati aziendali
$pdf->SetFont('Arial', '', 8);
$pdf->SetTextColor(0, 0, 0);
$pdf->Cell(40, 6, html_entity_decode($companypdf, ENT_QUOTES, 'UTF-8'), 1, 0, 'C');
$pdf->SetFillColor(232, 242, 255);
$pdf->Cell(150, 6, $companyname, 1, 0, 'C', TRUE);
$pdf->Ln();
$pdf->Cell(40, 6, html_entity_decode($addresspdf, ENT_QUOTES, 'UTF-8'), 1, 0, 'C');
$pdf->Cell(150, 6, html_entity_decode($contactsinfoData['address'], ENT_QUOTES, 'UTF-8'), 1, 0, 'C', TRUE);
$pdf->Ln();
$pdf->Cell(40, 6, html_entity_decode($citypdf, ENT_QUOTES, 'UTF-8'), 1, 0, 'C');
$pdf->Cell(55, 6, html_entity_decode($contactsinfoData['city'], ENT_QUOTES, 'UTF-8'), 1, 0, 'C', TRUE);
$pdf->Cell(40, 6, html_entity_decode($zippdf, ENT_QUOTES, 'UTF-8'), 1, 0, 'C');
$pdf->Cell(55, 6, $contactsinfoData['cap'], 1, 0, 'C', TRUE);
$pdf->Ln();
$pdf->Cell(40, 6, html_entity_decode($vatpdf, ENT_QUOTES, 'UTF-8'), 1, 0, 'C');
$pdf->Cell(55, 6, $contactsinfoData['piva'], 1, 0, 'C', TRUE);
$pdf->Cell(40, 6, html_entity_decode($countrypdf, ENT_QUOTES, 'UTF-8'), 1, 0, 'C');
$pdf->Cell(55, 6, $contactsinfoData['country'], 1, 0, 'C', TRUE);
$pdf->Ln();
$pdf->Cell(40, 6, html_entity_decode($phonepdf, ENT_QUOTES, 'UTF-8'), 1, 0, 'C');
$pdf->Cell(55, 6, $contactsinfoData['telephone'], 1, 0, 'C', TRUE);
$pdf->Cell(40, 6, html_entity_decode($emailpdf, ENT_QUOTES, 'UTF-8'), 1, 0, 'C');
$pdf->Cell(55, 6, html_entity_decode($contactsinfoData['email'], ENT_QUOTES, 'UTF-8'), 1, 0, 'C', TRUE);
$pdf->Ln();
$pdf->Cell(40, 6, html_entity_decode($contactnamepdf, ENT_QUOTES, 'UTF-8'), 1, 0, 'C');
$pdf->Cell(55, 6, html_entity_decode($contactsinfoData['contactname'], ENT_QUOTES, 'UTF-8'), 1, 0, 'C', TRUE);
$pdf->Cell(40, 6, html_entity_decode($contactsurnamepdf, ENT_QUOTES, 'UTF-8'), 1, 0, 'C');
$pdf->Cell(55, 6, html_entity_decode($contactsinfoData['contactsurname'], ENT_QUOTES, 'UTF-8'), 1, 0, 'C', TRUE);
$pdf->Ln();
// Calcola il totale delle persone
$totalperson = $contactsinfoData['otheractivitiesperson'] +
$contactsinfoData['purchaseperson'] +
$contactsinfoData['qualityperson'] +
$contactsinfoData['csperson'] +
$contactsinfoData['productionperson'] +
$contactsinfoData['salesperson'] +
$contactsinfoData['projectperson'];
// Stampa dei campi aggiuntivi in modo compatto con label (colonna_title) senza grassetto
$pdf->Cell(40, 6, html_entity_decode($activitiestitle, ENT_QUOTES, 'UTF-8'), 1, 0, 'C');
$pdf->Cell(150, 6, html_entity_decode($contactsinfoData['activities'], ENT_QUOTES, 'UTF-8'), 1, 0, 'C', TRUE);
$pdf->Ln();
$pdf->Cell(40, 6, html_entity_decode($designtitle, ENT_QUOTES, 'UTF-8'), 1, 0, 'C');
$pdf->Cell(55, 6, $contactsinfoData['projectperson'], 1, 0, 'C', TRUE);
$pdf->Cell(40, 6, html_entity_decode($salestitle, ENT_QUOTES, 'UTF-8'), 1, 0, 'C');
$pdf->Cell(55, 6, $contactsinfoData['salesperson'], 1, 0, 'C', TRUE);
$pdf->Ln();
$pdf->Cell(40, 6, html_entity_decode($productiontitle, ENT_QUOTES, 'UTF-8'), 1, 0, 'C');
$pdf->Cell(55, 6, $contactsinfoData['productionperson'], 1, 0, 'C', TRUE);
$pdf->Cell(40, 6, html_entity_decode($customer_caretitle, ENT_QUOTES, 'UTF-8'), 1, 0, 'C');
$pdf->Cell(55, 6, $contactsinfoData['csperson'], 1, 0, 'C', TRUE);
$pdf->Ln();
$pdf->Cell(40, 6, html_entity_decode($qualitytitle, ENT_QUOTES, 'UTF-8'), 1, 0, 'C');
$pdf->Cell(55, 6, $contactsinfoData['qualityperson'], 1, 0, 'C', TRUE);
$pdf->Cell(40, 6, html_entity_decode($purchasestitle, ENT_QUOTES, 'UTF-8'), 1, 0, 'C');
$pdf->Cell(55, 6, $contactsinfoData['purchaseperson'], 1, 0, 'C', TRUE);
$pdf->Ln();
$pdf->Cell(40, 6, html_entity_decode($other_activitytitle, ENT_QUOTES, 'UTF-8'), 1, 0, 'C');
$pdf->Cell(55, 6, html_entity_decode($contactsinfoData['otheractivities'], ENT_QUOTES, 'UTF-8'), 1, 0, 'C', TRUE);
$pdf->Cell(40, 6, html_entity_decode($other_activitypersontitle, ENT_QUOTES, 'UTF-8'), 1, 0, 'C');
$pdf->Cell(55, 6, $contactsinfoData['otheractivitiesperson'], 1, 0, 'C', TRUE);
$pdf->Ln();
// Stampa il campo Total Persons
$pdf->Cell(60, 6, html_entity_decode($totalpersontitle, ENT_QUOTES, 'UTF-8'), 1, 0, 'C');
$pdf->Cell(130, 6, $totalperson, 1, 0, 'C', TRUE); // Campo "Total Persons"
$pdf->Ln();
$pdf->Cell(60, 6, html_entity_decode($language_audittitle, ENT_QUOTES, 'UTF-8'), 1, 0, 'C');
$pdf->Cell(130, 6, html_entity_decode($contactsinfoData['languageforaudit'], ENT_QUOTES, 'UTF-8'), 1, 0, 'C', TRUE);
$pdf->Ln();
$pdf->Cell(60, 6, html_entity_decode($outsourced_processestitle, ENT_QUOTES, 'UTF-8'), 1, 0, 'C');
$pdf->Cell(130, 6, html_entity_decode($contactsinfoData['outsourcing_process'], ENT_QUOTES, 'UTF-8'), 1, 0, 'C', TRUE);
$pdf->Ln();
// Spazio vuoto tra i dati delle aziende
$pdf->Ln(6);
}
?>