TransWar File Browser

Path: C:\

<?php
require('fpdf.php');
class PDF extends FPDF
{
function Notas($notas){
    $nf=explode("\\", $notas);$t=array();$l=0;
    foreach ($nf as $valor){
        if(!isset($t[0])){$t[0]=$valor;}else{
        if(strlen($t[$l])+strlen($valor)>38){$l++;$t[$l]=$valor;}
        else{$t[$l]=$t[$l].'\\'.$valor;}}
    }
    return $t;
}
function LoadData($file)
{
    $lines = file($file);
    $data = array();
    foreach($lines as $line)
        $data[] = explode(';',trim($line));
    return $data;
}
function FancyTable($data, $base)
{   $peso=number_format($data[1][6], 3, ',', '.');
    $placa=$data[0][2];
    $notas=$data[2][1];
    $nf=explode("\\", $notas);$t=array();$l=0;
    foreach ($nf as $valor){
        if(!isset($t[0])){$t[0]=$valor;}else{
        if(strlen($t[$l])+strlen($valor)>38){$l++;$t[$l]=$valor;}
        else{$t[$l]=$t[$l].'\\'.$valor;}}
    }
    if($data[1][4]==15){$setpoint='setpoint2';$tempo='tempo2';}else{$setpoint='setpoint1';$tempo='tempo1';}
    if(isset($base[$placa]))
        {$bas=$base[$placa][$setpoint];$tem=$base[$placa][$tempo];}
    else
        {$bas='';$tem='';}
    $this->SetFillColor(255,255,255);
    $this->SetDrawColor(0);
    $this->SetLineWidth(.2);
    $this->SetTextColor(0);
    $this->SetFont('Arial','B',13);
    $this->Cell(40,24,'',1,0,'C',true);
        $this->Cell(115,24,'MONITORAMENTO DE TEMPERATURA',1,0,'C',true);
    $this->SetFont('Arial','B',8);
        $this->Cell(40,4,utf8_decode('Código:'),'TLR',0,'L',true);
    $this->Ln(4);
    $this->SetFont('Arial','','8');
    $this->Cell(155);
        $this->Cell(40,4,'FO.13.01.MT','LRB',0,'C',true);
    $this->Ln(4);
    $this->SetFont('Arial','B','8');
    $this->Cell(155);
        $this->Cell(40,4,utf8_decode('Revisão:'),'LR',0,'L',true);
    $this->Ln(4);
    $this->SetFont('Arial','','8');
    $this->Cell(155);
        $this->Cell(40,4,'00','LRB',0,'C',true);
    $this->Ln(4);
    $this->SetFont('Arial','B','8');
    $this->Cell(155);
        $this->Cell(40,4,utf8_decode('Válido até:'),'LR',0,'L',true);
    $this->Ln(4);
    $this->SetFont('Arial','','8');
    $this->Cell(155);
        $this->Cell(40,4,'25/07/25','LRB',0,'C',true);
    $this->Image('logo.png',13,17,36);
    $this->Ln(9);

    $this->SetFillColor(164,164,164);
    $this->SetTextColor(0);
    $this->SetDrawColor(0);
    $this->SetLineWidth(.2);
    $this->SetFont('Arial','B','10');
        $this->Cell(23,10,'DATA',1,0,'C',true);
        $this->Cell(80,10,'MOTORISTA',1,0,'C',true);
        $this->Cell(23,10,utf8_decode('Nº COLETA'),1,0,'C',true);
        $this->Cell(23,10,'MANIFESTO',1,0,'C',true);
        $this->SetFont('Arial','B','8');
        $this->Cell(23,5,'PLACA',1,0,'C',true);
        $this->Cell(23,5,'PLACA',1,0,'C',true);
    $this->Ln(5);
    $this->SetFont('Arial','B',8);
    $this->Cell(149);
        $this->Cell(23,5,utf8_decode('veículo/cavalo'),1,0,'C',true);
    $this->SetFont('Arial','B',7);
        $this->Cell(23,5,'carreta refrigerada',1,0,'C',true);
    $this->Ln();
    $this->SetFillColor(224,235,255);
    $this->SetTextColor(0);
    $this->SetFont('Arial','B','9');
    $fill = false;
    $this->Cell(23,6,$data[0][0],'LR',0,'C',$fill);
    $this->Cell(80,6,utf8_decode($data[0][1]),'LR',0,'C',$fill);
    $this->Cell(23,6,$data[0][4],'LR',0,'C',$fill);
    $this->Cell(23,6,$data[0][5],'LR',0,'C',$fill);
    $this->Cell(23,6,$data[0][2],'LR',0,'C',$fill);
    $this->Cell(23,6,$data[0][3],'LR',0,'C',$fill);
    $this->Ln();
    $this->SetFillColor(164,164,164);
    $this->SetTextColor(0);
    $this->SetDrawColor(0);
    $this->SetLineWidth(.2);
        $this->SetFont('Arial','B',8);
        $this->Cell(20,7,'COLETA:',1,0,'C',true);
    $this->SetFillColor(255,255,255);
        $this->Cell(55,7,utf8_decode($data[1][0]),1,0,'C',true);
    $this->SetFillColor(164,164,164);
        $this->Cell(20,7,'CIDADE/UF:',1,0,'C',true);
    $this->SetFillColor(255,255,255);
        $this->Cell(54,7,utf8_decode($data[1][1]),1,0,'C',true);
    $this->SetFont('Arial','B','8');
    $this->SetFillColor(164,164,164);
        $this->Cell(20,7,'PESO:',1,0,'C',true);
    $this->SetFillColor(255,255,255);
        $this->Cell(26,7,utf8_decode($peso),1,0,'C',true);
    $this->Ln(7);
        $this->SetFont('Arial','B',8);
    $this->SetFillColor(164,164,164);
        $this->Cell(20,7,'ENTREGA:',1,0,'C',true);
    $this->SetFillColor(255,255,255);
        $this->Cell(55,7,utf8_decode($data[1][2]),1,0,'C',true);
    $this->SetFillColor(164,164,164);
        $this->Cell(20,7,'CIDADE/UF:',1,0,'C',true);
    $this->SetFillColor(255,255,255);
        $this->Cell(54,7,utf8_decode($data[1][3]),1,0,'C',true);
    $this->SetFont('Arial','B','8');
    $this->SetFillColor(164,164,164);
        $this->Cell(20,7,'VOLUME:',1,0,'C',true);
    $this->SetFillColor(255,255,255);
        $this->Cell(26,7,utf8_decode($data[1][7]),1,0,'C',true);
    $this->Ln();
    $this->SetFillColor(164,164,164);
    $this->SetLineWidth(.2);
    $this->SetFont('Arial','B','9');
        $this->Cell(29,5,'FAIXA DE','TLR',0,'C',true);
        $this->Cell(23,5,'MIN',1,0,'C',true);
        $this->Cell(23,5,'MAX',1,0,'C',true);
        $this->Cell(20,5,'SETPOINT',1,0,'C',true);
        $this->Cell(35,5,'TEMPO ESTIMADO',1,0,'C',true);
    $this->Ln(5);
    $this->SetFont('Arial','B','9');
        $this->Cell(29,5,'TEMPERATURA','BLR',0,'C',true);
        $this->Cell(23,5,$data[1][4],1,0,'C',false);
        $this->Cell(23,5,$data[1][5],1,0,'C',false);
        $this->Cell(20,5,$bas,1,0,'C',false);
        $this->Cell(35,5,$tem,1,0,'C',false);
    $this->Ln(-5);
    $this->Cell(130);
        $this->Cell(10,10,utf8_decode('Nº NF'),1,0,'C',true);
    $this->SetFont('Arial','B','7');
    $n0=$n1=$n2='';
    if(isset($t[0])){$n0=$t[0];}
    if(isset($t[1])){$n1=$t[1];}
    if(isset($t[2])){$n2=$t[2];}
    $this->Cell(55,4,$n0,'TLR',0,'L',false);$this->Ln(4);$this->Cell(140);
    $this->Cell(55,3,$n1,'LR',0,'L',false);$this->Ln(3);$this->Cell(140);
    $this->Cell(55,3,$n2,'BLR',0,'L',false);$this->Ln(3);$this->Cell(140);
    $this->Ln();
        $this->Cell(20,4,'','TLR',0,'C',true);
    $this->SetFont('Arial','B','8');
        $this->Cell(15,15,'Solta',1,0,'C',false);
        $this->Cell(20,4,'','TLR',0,'C',false);
        $this->Cell(20,4,'','TLR',0,'C',false);
        $this->Cell(20,15,'Com Catraca',1,0,'C',false);
        $this->Cell(15,15,'Fitada',1,0,'C',false);
        $this->Cell(20,15,'Remontada',1,0,'C',false);
        $this->Cell(22,4,'IBC','TLR',0,'C',false);
        $this->Cell(23,4,'IBC','TLR',0,'C',false);
        $this->Cell(20,4,'Outro:','TLR',0,'C',false);
    $this->Ln(4);
    $this->SetFont('Arial','B','9');
        $this->Cell(20,4,utf8_decode('CONDIÇÃO'),'LR',0,'C',true);
    $this->SetFont('Arial','B','8');
        $this->Cell(15);
        $this->Cell(20,4,'Paletizada','LR',0,'C',false);
        $this->Cell(20,4,'Paletizada','LR',0,'C',false);
        $this->Cell(55);
    $this->SetFont('Arial','B','7');
        $this->Cell(22,4,'(Grade)','LR',0,'C',false);
        $this->Cell(23,4,'(Inox Valvulado)','LR',0,'C',false);
        $this->Cell(20,11,'','BLR',0,'C',false);
    $this->Ln(4);
    $this->SetFont('Arial','B','9');
        $this->Cell(20,4,'DA CARGA','LR',0,'C',true);
    $this->SetFont('Arial','B','8');
        $this->Cell(15);
        $this->Cell(20,4,'com Strech','LR',0,'C',false);
        $this->Cell(20,4,'sem Strech','LR',0,'C',false);
        $this->Cell(55);
    $this->SetFont('Arial','','7');
        $this->Cell(22,4,'Intermediate Bulk','LR',0,'C',false);
        $this->Cell(23,4,'Intermediate Bulk','LR',0,'C',false);
    $this->Ln(4);
        $this->Cell(20,3,'','BLR',0,'C',true);
        $this->Cell(15);
        $this->Cell(20,3,'','BLR',0,'C',false);
        $this->Cell(20,3,'','BLR',0,'C',false);
        $this->Cell(55);
    $this->SetFont('Arial','','7');
        $this->Cell(22,3,'Container','BLR',0,'C',false);
        $this->Cell(23,3,'Container','BLR',0,'C',false);
    $this->Ln();
    $this->SetFont('Arial','B',12);
        $this->Cell(195,6,utf8_decode('DADOS SOBRE O SISTEMA DE REFRIGERAÇÃO:'),1,0,'L',true);
    $this->Ln(6);
    $this->SetFont('Arial','B',8);
        $this->Cell(39,7,utf8_decode('Data:'),1,0,'L',false);
        $this->Cell(78,7,utf8_decode('Horário que ligou o aparelho:'),1,0,'L',false);
        $this->Cell(78,7,utf8_decode('Temperatura no visor:'),1,0,'L',false);
    $this->Ln();
    $this->SetFont('Arial','B',12);
        $this->Cell(195,6,utf8_decode('LOCAL CARREGAMENTO:'),1,0,'L',true);
    $this->Ln(6);
    $this->SetFont('Arial','B',8);
        $this->Cell(65,4,utf8_decode('Condições da carga no momento:'),'TRL',0,'C',false);
    $this->SetFont('Arial','',8);
        $this->Cell(65,4,utf8_decode('Documento Fiscal da Mercadoria confere com os'),'TRL',0,'C',false);
    $this->SetFont('Arial','B',8);
        $this->Cell(15,4,utf8_decode('Avarias (  )'),'TL',0,'L',false);
    $this->SetFont('Arial','',8);
        $this->Cell(50,4,utf8_decode('Se Sim, descreva:'),'TR',0,'L',false);
    $this->Ln(4);
    $this->SetFont('Arial','',8);
        $this->Cell(65,4,utf8_decode('(  ) Exposta ao Sol        (  ) Exposta a Chuva'),'RL',0,'C',false);
        $this->Cell(65,4,utf8_decode('números de lote, data de validade e quantidades'),'RL',0,'C',false);
        $this->Cell(65,23,'','BRL',0,'L',false);
    $this->Ln(4);
        $this->Cell(65,4,utf8_decode('(  ) Exposta a Umidade'),'BRL',0,'C',false);
        $this->Cell(65,4,utf8_decode('recebidas? (  )Sim  (  )Não'),'BRL',0,'C',false);
    $this->Ln(4);
    $this->SetFont('Arial','B',8);
        $this->Cell(35,5,utf8_decode('Data:'),1,0,'L',false);
        $this->Cell(55,5,utf8_decode('Horário Chegada:'),1,0,'L',false);
        $this->Cell(40,5,utf8_decode('Temperatura'),1,0,'L',false);
    $this->Ln(5);
        $this->Cell(35,5,utf8_decode('Data:'),1,0,'L',false);
        $this->Cell(55,5,utf8_decode('Horário Abertura:'),1,0,'L',false);
        $this->Cell(40,5,utf8_decode('Temperatura'),1,0,'L',false);
    $this->Ln(5);
        $this->Cell(35,5,utf8_decode('Data:'),1,0,'L',false);
        $this->Cell(55,5,utf8_decode('Horário Fechamento:'),1,0,'L',false);
        $this->Cell(40,5,utf8_decode('Temperatura'),1,0,'L',false);
    $this->Ln();
    $this->SetFont('Arial','B',12);
        $this->Cell(195,6,utf8_decode('LOCAL DESCARREGAMENTO:'),1,0,'L',true);
    $this->Ln(6);
    $this->SetFont('Arial','B',8);
        $this->Cell(65,4,utf8_decode('Condições da carga no momento:'),'TRL',0,'C',false);
    $this->SetFont('Arial','',8);
        $this->Cell(65,4,utf8_decode('Documento Fiscal da Mercadoria confere com os'),'TRL',0,'C',false);
    $this->SetFont('Arial','B',8);
        $this->Cell(15,4,utf8_decode('Avarias (  )'),'TL',0,'L',false);
    $this->SetFont('Arial','',8);
        $this->Cell(50,4,utf8_decode('Se Sim, descreva:'),'TR',0,'L',false);
    $this->Ln(4);
    $this->SetFont('Arial','',8);
        $this->Cell(65,4,utf8_decode('(  ) Exposta ao Sol        (  ) Exposta a Chuva'),'RL',0,'C',false);
        $this->Cell(65,4,utf8_decode('números de lote, data de validade e quantidades'),'RL',0,'C',false);
        $this->Cell(65,23,'','BRL',0,'L',false);
    $this->Ln(4);
        $this->Cell(65,4,utf8_decode('(  ) Exposta a Umidade'),'BRL',0,'C',false);
        $this->Cell(65,4,utf8_decode('recebidas? (  )Sim  (  )Não'),'BRL',0,'C',false);
    $this->Ln(4);
    $this->SetFont('Arial','B',8);
        $this->Cell(35,5,utf8_decode('Data:'),1,0,'L',false);
        $this->Cell(55,5,utf8_decode('Horário Chegada:'),1,0,'L',false);
        $this->Cell(40,5,utf8_decode('Temperatura'),1,0,'L',false);
    $this->Ln(5);
        $this->Cell(35,5,utf8_decode('Data:'),1,0,'L',false);
        $this->Cell(55,5,utf8_decode('Horário Abertura:'),1,0,'L',false);
        $this->Cell(40,5,utf8_decode('Temperatura'),1,0,'L',false);
    $this->Ln(5);
        $this->Cell(35,5,utf8_decode('Data:'),1,0,'L',false);
        $this->Cell(55,5,utf8_decode('Horário Fechamento:'),1,0,'L',false);
        $this->Cell(40,5,utf8_decode('Temperatura'),1,0,'L',false);
    $this->Ln(5);
    $this->SetFont('Arial','B',8);
        $this->Cell(195,6,utf8_decode('DESCRIÇÃO DA AVARIA:'),1,0,'L',true);
    $this->Ln(6);
        $this->Cell(195,6,'',1,0,'L',false);
    $this->Ln(6);
        $this->Cell(195,6,'',1,0,'L',false);
    $this->Ln(6);
        $this->Cell(195,6,'',1,0,'L',false);
    $this->Ln(6);
        $this->Cell(195,6,'',1,0,'L',false);
    $this->Ln(6);
    $this->SetFont('Arial','B',8);
        $this->Cell(195,5,'AUTORIZADO  O TRANSPORTE POR (NOME)',1,0,'L',false);
    $this->Ln();
    $this->SetFont('Arial','B',8);
        $this->Cell(140,5,utf8_decode('DECLARAÇÃO DE COMPROMETIMENTO DO MOTORISTA'),'TRL',0,'C',false);
        $this->Cell(55,5,utf8_decode('ASSINATURA (MOTORISTA)'),'TRL',0,'C',false);
    $this->Ln(5);
    $this->SetFont('Arial','',7);
        $this->Cell(140,5,utf8_decode('Declaro estar ciente da responsabilidade em coletar as temperaturas durante a viagem, e a confrontar com a informação'),'RL',0,'C',false);
        $this->Cell(55,10,'','BRL',0,'C',false);
    $this->Ln(5);
        $this->Cell(140,5,utf8_decode('fornecida pelo cliente (Pedido de Coleta, SM e Monitoramento de temperatura). Estando de acordo assino ao lado.'),'BRL',0,'C',false);
    $this->Ln(5);
    $this->SetFont('Arial','B',10);
        $this->Cell(30,14,utf8_decode('CONCLUSÕES'),1,0,'C',true);
    $this->Cell(10,7,'',1,0,'C',false);
    $this->SetFont('Arial','',8);
        $this->Cell(155,7,utf8_decode('Transporte de acordo com o padrão solicitado pelo cliente.'),1,0,'L',false);
    $this->Ln(7);
        $this->Cell(30);
        $this->Cell(10,7,'',1,0,'C',false);
        $this->Cell(155,7,utf8_decode('Transporte em desacordo com o padrão solicitado pelo cliente. RAC nº _____________'),1,0,'L',false);
    $this->Ln();
    $this->SetFont('Arial','B',10);
        $this->Cell(30,14,'QUALIDADE',1,0,'C',true);
    $this->SetFont('Arial','B',8);
        $this->Cell(85,7,utf8_decode('NOME DO RESPONSÁVEL PELA VERIFICAÇÃO'),'TRL',0,'C',false);
        $this->Cell(80,7,'ASSINATURA','TRL',0,'C',false);
    $this->Ln(7);
        $this->Cell(30);
        $this->Cell(85,7,'','BRL',0,'C',false);
        $this->Cell(80,7,'','BRL',0,'C',false);
     $this->Ln(21);
        $this->Cell(65,5,utf8_decode('ELABORADO POR:'),1,0,'C',true);
        $this->Cell(65,5,utf8_decode('VALIDADO POR:'),1,0,'C',true);
        $this->Cell(65,5,utf8_decode('APROVADO POR:'),1,0,'C',true);
    $this->Ln(5);
        $this->Cell(65,5,utf8_decode('Aline Almeida'),1,0,'C',false);
        $this->Cell(65,5,utf8_decode('Giovana Trevisan'),1,0,'C',false);
        $this->Cell(65,5,utf8_decode('Daniel Lopes'),1,0,'C',false);
    }
}
$pdf = new PDF();
$data = $pdf->LoadData('quali2.txt');
$json = file_get_contents('base.json');
$base = json_decode($json, true);
$pdf->SetFont('Arial','','12');
$pdf->AddPage();
$pdf->FancyTable($data,$base);
$pdf->Output();
?>