ppeasy/public/pdfcreation/auditablem18b.php

143 lines
6.9 KiB
PHP

<?php
//invoice contacts
// ***start with invoice address
$pdf->SetFont('', '', 8);
$pdf->Cell(90, 6, iconv('UTF-8', 'windows-1252', $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, iconv('UTF-8', 'windows-1252', $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 = iconv('UTF-8', 'windows-1252', html_entity_decode($auditplacepdf, ENT_QUOTES, 'UTF-8'));
$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 = iconv('UTF-8', 'windows-1252', html_entity_decode($contactsinfoData['companyname'], ENT_QUOTES, 'UTF-8'));
// Titolo per ogni sede con numero sequenziale
$pdf->SetFont('Arial', '', 10);
$pdf->Cell(190, 6, iconv('UTF-8', 'windows-1252', $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, iconv('UTF-8', 'windows-1252', $companypdf), 1, 0, 'C');
$pdf->SetFillColor(232, 242, 255);
$pdf->Cell(150, 6, $companyname, 1, 0, 'C', TRUE);
$pdf->Ln();
$pdf->Cell(40, 6, iconv('UTF-8', 'windows-1252', $addresspdf), 1, 0, 'C');
$pdf->Cell(150, 6, iconv('UTF-8', 'windows-1252', html_entity_decode($contactsinfoData['address'], ENT_QUOTES, 'UTF-8')), 1, 0, 'C', TRUE);
$pdf->Ln();
$pdf->Cell(40, 6, iconv('UTF-8', 'windows-1252', $citypdf), 1, 0, 'C');
$pdf->Cell(55, 6, iconv('UTF-8', 'windows-1252', html_entity_decode($contactsinfoData['city'], ENT_QUOTES, 'UTF-8')), 1, 0, 'C', TRUE);
$pdf->Cell(40, 6, iconv('UTF-8', 'windows-1252', $zippdf), 1, 0, 'C');
$pdf->Cell(55, 6, $contactsinfoData['cap'], 1, 0, 'C', TRUE);
$pdf->Ln();
$pdf->Cell(40, 6, iconv('UTF-8', 'windows-1252', $vatpdf), 1, 0, 'C');
$pdf->Cell(55, 6, $contactsinfoData['piva'], 1, 0, 'C', TRUE);
$pdf->Cell(40, 6, iconv('UTF-8', 'windows-1252', $countrypdf), 1, 0, 'C');
$pdf->Cell(55, 6, $contactsinfoData['country'], 1, 0, 'C', TRUE);
$pdf->Ln();
$pdf->Cell(40, 6, iconv('UTF-8', 'windows-1252', $phonepdf), 1, 0, 'C');
$pdf->Cell(55, 6, $contactsinfoData['telephone'], 1, 0, 'C', TRUE);
$pdf->Cell(40, 6, iconv('UTF-8', 'windows-1252', $emailpdf), 1, 0, 'C');
$pdf->Cell(55, 6, iconv('UTF-8', 'windows-1252', html_entity_decode($contactsinfoData['email'], ENT_QUOTES, 'UTF-8')), 1, 0, 'C', TRUE);
$pdf->Ln();
$pdf->Cell(40, 6, iconv('UTF-8', 'windows-1252', $contactnamepdf), 1, 0, 'C');
$pdf->Cell(55, 6, iconv('UTF-8', 'windows-1252', html_entity_decode($contactsinfoData['contactname'], ENT_QUOTES, 'UTF-8')), 1, 0, 'C', TRUE);
$pdf->Cell(40, 6, iconv('UTF-8', 'windows-1252', $contactsurnamepdf), 1, 0, 'C');
$pdf->Cell(55, 6, iconv('UTF-8', 'windows-1252', 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, iconv('UTF-8', 'windows-1252', $activitiestitle), 1, 0, 'C');
$pdf->Cell(150, 6, iconv('UTF-8', 'windows-1252', html_entity_decode($contactsinfoData['activities'], ENT_QUOTES, 'UTF-8')), 1, 0, 'C', TRUE);
$pdf->Ln();
$pdf->Cell(40, 6, iconv('UTF-8', 'windows-1252', $designtitle), 1, 0, 'C');
$pdf->Cell(55, 6, $contactsinfoData['projectperson'], 1, 0, 'C', TRUE);
$pdf->Cell(40, 6, iconv('UTF-8', 'windows-1252', $salestitle), 1, 0, 'C');
$pdf->Cell(55, 6, $contactsinfoData['salesperson'], 1, 0, 'C', TRUE);
$pdf->Ln();
$pdf->Cell(40, 6, iconv('UTF-8', 'windows-1252', $productiontitle), 1, 0, 'C');
$pdf->Cell(55, 6, $contactsinfoData['productionperson'], 1, 0, 'C', TRUE);
$pdf->Cell(40, 6, iconv('UTF-8', 'windows-1252', $customer_caretitle), 1, 0, 'C');
$pdf->Cell(55, 6, $contactsinfoData['csperson'], 1, 0, 'C', TRUE);
$pdf->Ln();
$pdf->Cell(40, 6, iconv('UTF-8', 'windows-1252', $qualitytitle), 1, 0, 'C');
$pdf->Cell(55, 6, $contactsinfoData['qualityperson'], 1, 0, 'C', TRUE);
$pdf->Cell(40, 6, iconv('UTF-8', 'windows-1252', $purchasestitle), 1, 0, 'C');
$pdf->Cell(55, 6, $contactsinfoData['purchaseperson'], 1, 0, 'C', TRUE);
$pdf->Ln();
$pdf->Cell(40, 6, iconv('UTF-8', 'windows-1252', $other_activitytitle), 1, 0, 'C');
$pdf->Cell(55, 6, iconv('UTF-8', 'windows-1252', html_entity_decode($contactsinfoData['otheractivities'], ENT_QUOTES, 'UTF-8')), 1, 0, 'C', TRUE);
$pdf->Cell(40, 6, iconv('UTF-8', 'windows-1252', $other_activitypersontitle), 1, 0, 'C');
$pdf->Cell(55, 6, $contactsinfoData['otheractivitiesperson'], 1, 0, 'C', TRUE);
$pdf->Ln();
// Stampa il campo Total Persons
$pdf->Cell(60, 6, iconv('UTF-8', 'windows-1252', $totalpersontitle), 1, 0, 'C');
$pdf->Cell(130, 6, $totalperson, 1, 0, 'C', TRUE); // Campo "Total Persons"
$pdf->Ln();
$pdf->Cell(60, 6, iconv('UTF-8', 'windows-1252', $language_audittitle), 1, 0, 'C');
$pdf->Cell(130, 6, iconv('UTF-8', 'windows-1252', html_entity_decode($contactsinfoData['languageforaudit'], ENT_QUOTES, 'UTF-8')), 1, 0, 'C', TRUE);
$pdf->Ln();
$pdf->Cell(60, 6, iconv('UTF-8', 'windows-1252', $outsourced_processestitle), 1, 0, 'C');
$pdf->Cell(130, 6, iconv('UTF-8', 'windows-1252', 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);
}