ppeasy/public/include/pdf5and6.php

207 lines
7.3 KiB
PHP
Raw Permalink 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
// ***start with Audit address
$kindcont='audit';
// parse contacts data with variable kindofcontacts
$contactsinfo = mysqli_query($cmctrfdb, "SELECT * FROM contacts WHERE contacts.idtrf='$idtrf' AND contacts.kindofcontacts=
'$kindcont'");
$contactsinfoData = mysqli_fetch_assoc($contactsinfo);
$companyname=$contactsinfoData['companyname'];
$pdf->SetFont('Arial','',9);
$pdf->SetFont('','B','10');
$pdf->Cell(190,6,"Luogo concordato con il Fabbricante per laudit e campionamento",1,0,'C');
$pdf->Ln();
$pdf->SetFont('','',9);
$pdf->Cell(40,6,'Company Name',1,0,'C');
$pdf->SetFillColor(232, 242, 255);
$pdf->Cell(150,6,$companyname,1,0,'C',TRUE);
$pdf->Ln();
$pdf->Cell(40,6,'Address',1,0,'C');
$pdf->Cell(150,6,$contactsinfoData['address'],1,0,'C',TRUE);
$pdf->Ln();
$pdf->Cell(40,6,'City',1,0,'C');
$pdf->Cell(55,6,$contactsinfoData['city'],1,0,'C',TRUE);
$pdf->Cell(40,6,'Cap',1,0,'C');
$pdf->Cell(55,6,$contactsinfoData['cap'],1,0,'C',TRUE);
$pdf->Ln();
$pdf->Cell(40,6,'PIVA',1,0,'C');
$pdf->Cell(55,6,$contactsinfoData['piva'],1,0,'C',TRUE);
$pdf->Cell(40,6,'Country',1,0,'C');
$pdf->Cell(55,6,$contactsinfoData['country'],1,0,'C',TRUE);
$pdf->Ln();
$pdf->Cell(40,6,'Telephone',1,0,'C');
$pdf->Cell(55,6,$contactsinfoData['telephone'],1,0,'C',TRUE);
$pdf->Cell(40,6,'Email',1,0,'C');
$pdf->Cell(55,6,$contactsinfoData['email'],1,0,'C',TRUE);
$pdf->Ln();
$pdf->Cell(40,6,'Contact Name',1,0,'C');
$pdf->Cell(55,6,$contactsinfoData['contactname'],1,0,'C',TRUE);
$pdf->Cell(40,6,'Contact Surname',1,0,'C');
$pdf->Cell(55,6,$contactsinfoData['contactsurname'],1,0,'C',TRUE);
$pdf->Ln();
$pdf->Ln();
//invoice contacts
// ***start with invoice address
$kindcont='invoice';
// parse contacts data with variable kindofcontacts
$contactsinfo = mysqli_query($cmctrfdb, "SELECT * FROM contacts WHERE contacts.idtrf='$idtrf' AND contacts.kindofcontacts=
'$kindcont'");
$contactsinfoData = mysqli_fetch_assoc($contactsinfo);
$companyname=$contactsinfoData['companyname'];
$pdf->SetFont('Arial','',9);
$pdf->SetFont('','B','10');
$pdf->Cell(190,6,"INVOICE CONTACTS",1,0,'C');
$pdf->Ln();
$pdf->SetFont('','',9);
$pdf->Cell(40,6,'Company Name',1,0,'C');
$pdf->SetFillColor(232, 242, 255);
$pdf->Cell(150,6,$companyname,1,0,'C',TRUE);
$pdf->Ln();
$pdf->Cell(40,6,'Address',1,0,'C');
$pdf->Cell(150,6,$contactsinfoData['address'],1,0,'C',TRUE);
$pdf->Ln();
$pdf->Cell(40,6,'City',1,0,'C');
$pdf->Cell(55,6,$contactsinfoData['city'],1,0,'C',TRUE);
$pdf->Cell(40,6,'Cap',1,0,'C');
$pdf->Cell(55,6,$contactsinfoData['cap'],1,0,'C',TRUE);
$pdf->Ln();
$pdf->Cell(40,6,'PIVA',1,0,'C');
$pdf->Cell(55,6,$contactsinfoData['piva'],1,0,'C',TRUE);
$pdf->Cell(40,6,'Country',1,0,'C');
$pdf->Cell(55,6,$contactsinfoData['country'],1,0,'C',TRUE);
$pdf->Ln();
$pdf->Cell(40,6,'Telephone',1,0,'C');
$pdf->Cell(55,6,$contactsinfoData['telephone'],1,0,'C',TRUE);
$pdf->Cell(40,6,'Email',1,0,'C');
$pdf->Cell(55,6,$contactsinfoData['email'],1,0,'C',TRUE);
$pdf->Ln();
$pdf->Cell(40,6,'Contact Name',1,0,'C');
$pdf->Cell(55,6,$contactsinfoData['contactname'],1,0,'C',TRUE);
$pdf->Cell(40,6,'Contact Surname',1,0,'C');
$pdf->Cell(55,6,$contactsinfoData['contactsurname'],1,0,'C',TRUE);
$pdf->Ln();
// trf option
$pdf->Ln();
$pdf->Cell(40,6,'Lingua Report',1,0,'C');
$pdf->Cell(150,6,$trfData['languagereport'],1,0,'C',TRUE);
$pdf->Ln();
$pdf->Cell(40,6,'Lingua Certificato',1,0,'C');
$pdf->Cell(150,6,$trfData['languagecertificate'],1,0,'C',TRUE);
$pdf->Ln();
$pdf->Cell(40,6,'Contatto APplication Form',1,0,'C');
$pdf->Cell(150,6,$trfData['contacttrfname'],1,0,'C',TRUE);
$pdf->Ln();
$pdf->Cell(40,6,'Email Application Form',1,0,'C');
$pdf->Cell(150,6,$trfData['emailtrfname'],1,0,'C',TRUE);
$pdf->Ln();
$pdf->Ln();
// auditdpi query
$auditdpilist = new WA_MySQLi_RS("auditdpilist",$cmctrfdb,0);
$auditdpilist->setQuery("SELECT * FROM auditdpi LEFT JOIN auditsurveillancetype ON auditsurveillancetype.idauditsurveillancetype=auditdpi.moduleselection WHERE auditdpi.idtrfdetails='$idtrf'");
$auditdpilist->execute();
if ($idcertificate==5) {
$pdf->SetFont('','B','10');
$pdf->Cell(190,6,"DPI",1,0,'C');
$pdf->SetFillColor(232, 242, 255);
$pdf->Ln();
$pdf->SetFont('','',9);
$pdf->Cell(20,6,'N.',1,0,'C');
$pdf->Cell(30,6,'Cert N.',1,0,'C');
$pdf->Cell(15,6,'Cimac',1,0,'C');
$pdf->Cell(110,6,'Sorveglianza',1,0,'C');
$pdf->Cell(15,6,'Store',1,0,'C');
$pdf->Ln();
$wa_startindex = 0;
while(!$auditdpilist->atEnd()) {
$wa_startindex = $auditdpilist->Index;
$pdf->Cell(20,6,'1',1,0,'C',TRUE);
$pdf->Cell(30,6,$auditdpilist->getColumnVal("certificatenumber"),1,0,'C',TRUE);
$pdf->Cell(15,6,$auditdpilist->getColumnVal("issuebyciamc"),1,0,'C',TRUE);
$pdf->Cell(110,6,$auditdpilist->getColumnVal("surveillancenameit"),1,0,'C',TRUE);
$pdf->Cell(15,6,$auditdpilist->getColumnVal("sampleinstore"),1,0,'C',TRUE);
$pdf->Ln();
$auditdpilist->moveNext();
}
$auditdpilist->moveFirst(); //return RS to first record
unset($wa_startindex);
unset($wa_repeatcount);
$pdf->Ln();
} elseif ($idcertificate==6) {
$pdf->SetFont('','B','10');
$pdf->Cell(190,6,"DPI",1,0,'C');
$pdf->SetFillColor(232, 242, 255);
$pdf->Ln();
$pdf->SetFont('','',9);
$pdf->Cell(20,6,'N.',1,0,'C');
$pdf->Cell(30,6,'Cert N.',1,0,'C');
$pdf->Cell(30,6,'Cimac',1,0,'C');
$pdf->Cell(110,6,'Sorveglianza',1,0,'C');
$pdf->Ln();
$wa_startindex = 0;
while(!$auditdpilist->atEnd()) {
$wa_startindex = $auditdpilist->Index;
$pdf->Cell(20,6,'1',1,0,'C',TRUE);
$pdf->Cell(30,6,$auditdpilist->getColumnVal("certificatenumber"),1,0,'C',TRUE);
$pdf->Cell(30,6,$auditdpilist->getColumnVal("issuebyciamc"),1,0,'C',TRUE);
$pdf->Cell(110,6,$auditdpilist->getColumnVal("surveillancenameit"),1,0,'C',TRUE);
$pdf->Ln();
$auditdpilist->moveNext();
}
$auditdpilist->moveFirst(); //return RS to first record
unset($wa_startindex);
unset($wa_repeatcount);
$pdf->Ln();
}
// file attached details
$fileattachedlist = new WA_MySQLi_RS("fileattachedlist",$cmctrfdb,0);
$fileattachedlist->setQuery("SELECT * FROM fileattached LEFT JOIN auditdpi ON fileattached.idauditdpi=auditdpi.idauditdpi WHERE fileattached.idtrfdetails='$idtrf'");
$fileattachedlist->execute();
if (!empty($fileattachedlist->getColumnVal("idfileattached"))) {
$pdf->SetFont('','B','10');
$pdf->Cell(190,6,"FILES ATTACHED",1,0,'C');
$pdf->SetFillColor(232, 242, 255);
$pdf->Ln();
$pdf->SetFont('','',9);
$pdf->Cell(20,6,'DPI CODE',1,0,'C');
$pdf->Cell(70,6,'Filename',1,0,'C');
$pdf->Cell(100,6,'Description',1,0,'C');
$pdf->Ln();
$wa_startindex = 0;
while(!$fileattachedlist->atEnd()) {
$wa_startindex = $fileattachedlist->Index;
$pdf->Cell(20,6,$fileattachedlist->getColumnVal("dpicode"),1,0,'C',true);
$pdf->SetTextColor(0, 0, 245);
$linkspecific='uploaddocuments/'.$fileattachedlist->getColumnVal("filename_fileattached");
$linkfile=$linkglobal.$linkspecific;
$fileattachedlimited=substr($fileattachedlist->getColumnVal("filename_fileattached"), 0, 30);
$pdf->Cell(70,6,$fileattachedlimited,1,0,'C',true,$linkfile);
$pdf->SetTextColor(0, 0, 0);
$descriptionlimited=substr($fileattachedlist->getColumnVal("description_fileattached"), 0, 30);
$pdf->Cell(100,6,$descriptionlimited,1,0,'C',true);
$pdf->Ln();
$fileattachedlist->moveNext();
}
$fileattachedlist->moveFirst(); //return RS to first record
unset($wa_startindex);
unset($wa_repeatcount);
//download zip
$pdf->SetTextColor(0, 0, 245);
$pdf->Cell(190,6,'Scarica da questo link un file ZIP con tutti gli allegati',1,0,'C',false,$namefilezippathpdf);
}
?>