<?php
$citytitle = html_entity_decode($citytitle);
$citytitleb = utf8_decode($citytitle);
//invoice contacts
// ***start with invoice address
$kindcont = 'invoice';
// parse contacts data  with variable kindofcontacts
$contactsinfo = mysqli_query($cmctrfdb, "SELECT * FROM contacts LEFT JOIN countries ON countries.idcountries=contacts.country WHERE contacts.idtrf='$idtrf' AND contacts.kindofcontacts=
'$kindcont'");
$contactsinfoData = mysqli_fetch_assoc($contactsinfo);
$companyname = $contactsinfoData['companyname'];
$pdf->SetFont('Arial', '', 8);
$pdf->SetFont('', 'B', '10');
$pdf->Cell(190, 6, $headerinvoicepdf, 1, 0, 'C');
$pdf->Ln();
$pdf->SetFont('', '', 8);
$pdf->Cell(40, 6, $companypdf, 1, 0, 'L');
$pdf->SetFillColor(232, 242, 255);
$pdf->Cell(150, 6, $companyname, 1, 0, 'L', TRUE);
$pdf->Ln();
$pdf->Cell(40, 6, $addresspdf, 1, 0, 'L');
$pdf->Cell(150, 6, iconv('UTF-8', 'ISO-8859-1//TRANSLIT', $contactsinfoData['address']), 1, 0, 'L', TRUE);

$pdf->Ln();
$pdf->Cell(40, 6, $citytitleb, 1, 0, 'L');
$pdf->Cell(55, 6, $contactsinfoData['city'], 1, 0, 'L', TRUE);
$pdf->Cell(40, 6, $zippdf, 1, 0, 'L');
$pdf->Cell(55, 6, $contactsinfoData['cap'], 1, 0, 'L', TRUE);
$pdf->Ln();
$pdf->Cell(40, 6, $vatpdf, 1, 0, 'L');
$pdf->Cell(55, 6, $contactsinfoData['piva'], 1, 0, 'L', TRUE);
$pdf->Cell(40, 6, $countrypdf, 1, 0, 'L');
$pdf->Cell(55, 6, $contactsinfoData['namecountry'], 1, 0, 'L', TRUE);
$pdf->Ln();
$pdf->Cell(40, 6, $phonepdf, 1, 0, 'L');
$pdf->Cell(55, 6, $contactsinfoData['telephone'], 1, 0, 'L', TRUE);
$pdf->Cell(40, 6, $emailpdf, 1, 0, 'L');
$pdf->Cell(55, 6, $contactsinfoData['email'], 1, 0, 'L', TRUE);
$pdf->Ln();
$pdf->Cell(40, 6, $contactnamepdf, 1, 0, 'L');
$pdf->Cell(55, 6, $contactsinfoData['contactname'], 1, 0, 'L', TRUE);
$pdf->Cell(40, 6, $contactsurnamepdf, 1, 0, 'L');
$pdf->Cell(55, 6, $contactsinfoData['contactsurname'], 1, 0, 'L', TRUE);
$pdf->Ln();
