<?php
if (Auth::user()->hasRole('User')) :
    // trf option
    $nameuser = $_SESSION["nameuser"];
    //$pdf->Cell(120,6,'Intendo sottoporre questo modello a sorveglianza (presso CIMAC)',1,0,'C');
    //$pdf->Cell(70,6,$trfData['surveillanceselectoption'],1,0,'C',TRUE);
    if (!mb_check_encoding($statement, 'UTF-8')) {
        $statement = utf8_encode($statement); // Forza la codifica in UTF-8
    }

    $statement = html_entity_decode($statement);
    $statement = mb_convert_encoding($statement, 'windows-1252', 'UTF-8');

    //$statement = iconv('UTF-8', 'iso-8859-1', $statement);

    $addstatement = html_entity_decode($addstatement);
    $addstatement = iconv('UTF-8', 'windows-1252', $addstatement);
    //$addstatement = iconv('UTF-8', 'iso-8859-1', $addstatement);
    $pdf->Ln();
    $pdf->MultiCell(190, 6, $statement, 1);
    if ($trfData['certotherclient'] == 'Y') {
        $pdf->MultiCell(190, 6, $addstatement, 1);
    }
    $pdf->Ln();
    $pdf->Cell(40, 6, $signedonpdf, 1, 0, 'C');
    $signedonnew = date("d/m/Y", strtotime($trfData['signedon']));
    $pdf->Cell(40, 6, $signedonnew, 1, 0, 'C', TRUE);
    $pdf->Cell(40, 6, ' Da ', 1, 0, 'C');
    $pdf->Cell(70, 6, $nameuser, 1, 0, 'C', TRUE);
    $pdf->Ln();
    $pdf->SetFont('', '', 7);
    $pdf->Cell(190, 6, $signedtokenpdf, 0, 0, 'C');
    $pdf->Ln();
    if ($otherclient == 'Y') {
        $pdf->Ln();
        $pdf->Ln();
        $pdf->SetFont('', '', 9);
        $pdf->Cell(190, 6, $producersign, 0, 0, 'C');
        $pdf->Ln();
        $pdf->SetFont('Arial', '', 8);
        $pdf->Cell(40, 6, $signedonpdf, 1, 0, 'C');
        $pdf->Cell(40, 6, '', 1, 0, 'C', TRUE);
        $pdf->Cell(40, 6, ' Da ', 1, 0, 'C');
        $pdf->Cell(70, 6, $namesurnamecertcontact, 1, 0, 'C', TRUE);
        $pdf->Ln();
        $pdf->Ln();
        $pdf->Cell(40, 6, $signtext, 1, 0, 'C');
        $pdf->Cell(70, 6, '', 1, 0, 'C', TRUE);
        $pdf->Ln();
    }

endif;
