<?php
	include 'plantilla.php';
	require 'conexion.php';
    
	$id = $_GET['id'];
    
    $query = "SELECT companies.popular_name, pilotos.* FROM pilotos  INNER JOIN companies ON pilotos.nr_company = companies.id WHERE pilotos.id = '$id'";
	$resultado = $mysqli->query($query);
    $row = $resultado->fetch_assoc();    
    
    $id = $row['id'];
    $stdate = $row['stdate'];
	$dlvdate = $row['dlvdate'];
	$reference = utf8_decode($row['reference']);
	$popular_name = utf8_decode($row['popular_name']);
	$modelagem = utf8_decode($row['modelagem']);
	$value = $row['value'];
	$cloth = utf8_decode($row['cloth']);
	$composition = utf8_decode($row['composition']);
	$colors = utf8_decode($row['colors']);
	$linha = utf8_decode($row['linha']);
	$approvedby = $row['approvedby'];
	$dtapproved = $row['dtapproved'];
	$ativo = $row['ativo'];
	$obs = utf8_decode($row['obs']);
    
   	$pdf = new PDF();
	$pdf->AliasNbPages();
	$pdf->AddPage(); 
    
    //primeira linha
    $pdf->SetFont('arial','B',10);
    $pdf->Cell(8,6,"ID:",0,0,'L');
    $pdf->setFont('arial','',10);
    $pdf->Cell(10,6,$id,0);

    $pdf->SetFont('arial','B',10);
    $pdf->Cell(35, 6, "DATA CADASTRO:",0,0,'R');
    $pdf->SetFont('arial','',10);    
    $pdf->Cell(22, 6,$stdate, 0);

    $pdf->SetFont('arial','B',10);
    $pdf->Cell(52, 6, "CLIENTE:",0,0,'R');
    $pdf->SetFont('arial','',10);    
    $pdf->Cell(90, 6, $popular_name, 0);                
    
    $pdf->Ln();
 
    //primeira linha
    $pdf->SetFont('arial','B',10);
    $pdf->Cell(29,6,utf8_decode("REFERÊNCIA:"),0,0,'L');
    $pdf->setFont('arial','',10);
    $pdf->Cell(69,6,$reference,0);

    $pdf->SetFont('arial','B',10);
    $pdf->Cell(29, 6, "MODELAGEM:",0,0,'R');
    $pdf->SetFont('arial','',10);    
    $pdf->Cell(69, 6, $modelagem, 0);

    $pdf->Ln();

    $pdf->SetFont('arial','B',10);
    $pdf->Cell(29, 6, "TECIDO:",0,0,'L');
    $pdf->SetFont('arial','',10);    
    $pdf->Cell(70, 6, $cloth, 0);                

    $pdf->SetFont('arial','B',10);
    $pdf->Cell(29, 6, utf8_decode("COMPOSIÇÃO:"),0,0,'R');
    $pdf->SetFont('arial','',10);    
    $pdf->Cell(70, 6, $composition, 0);                           

    $pdf->Ln();

    $pdf->SetFont('arial','B',10);
    $pdf->Cell(29, 6, "CORES:",0,0,'L');
    $pdf->SetFont('arial','',10);    
    $pdf->Cell(70, 6, $colors, 0);     
    
    $pdf->SetFont('arial','B',10);
    $pdf->Cell(29, 6, "LINHA:",0,0,'R');
    $pdf->SetFont('arial','',10);    
    $pdf->Cell(70, 6, $linha, 0);    

    $pdf->Ln();    
    
    $pdf->SetFont('arial','B',10);
    $pdf->Cell(32, 6, "APROVADO POR:",0,0,'L');
    $pdf->SetFont('arial','',10);    
    $pdf->Cell(30, 6, $approvedby, 0);     
    
    $pdf->SetFont('arial','B',10);
    $pdf->Cell(66, 6, "APROVADO EM:",0,0,'R');
    $pdf->SetFont('arial','',10);    
    $pdf->Cell(70, 6, $dtapproved, 0);                
    
    $pdf->Ln();
    
    $pdf->SetFont('arial','B',10);
    $pdf->Cell(30, 6, utf8_decode("OBSERVAÇÕES:"),0,0,'R');
    
    $pdf->Ln();

    $pdf->SetFont('arial','',10);    
    $pdf->Cell(70, 6, $obs, 0);            
    $pdf->Ln();    
    $pdf->Cell(195, 6, "____________________________________________________________________________________________________",0,0,'R');
	
    $pdf->Output();
?>

