<?php
require('../../fpdf.php');
include "../../root.class.php";


$db = new db_safeguard();
$request_res = $db->query("delivery_request", "SELECT * FROM delivery_request WHERE supplier_batch_no = '{$_GET['supplier_batch_no']}'");
$request_data = $request_res->fetch_assoc();

$pdf = new FPDF();
$pdf->AliasNbPages();
$pdf->AddPage('p');

$pdf->SetFont('Arial', 'B', 20);
$pdf->Cell(200, 15, "FARMER / SUPPLIER SAMPLE REQUEST" , 0, 1, 'C');
$pdf->Cell(200, 15, "FOR {$_GET['supplier_batch_no']}" , 0, 1, 'C');
$pdf->Cell(10, 8, '', 0, 1, 'L');
$pdf->SetFont('Arial', '', 10);

$pdf->Cell(70, 8, "Date Created : ", "", 0, 'L');
$pdf->Cell(70, 8, $request_data['date_created'], "", 1, 'L');
$pdf->Cell(70, 8, "Supplier Batch No : ", "", 0, 'L');
$pdf->Cell(70, 8, $request_data['supplier_batch_no'], "", 1, 'L');
$pdf->Cell(10, 5, '', 0, 1, 'L');

$pdf->Cell(70, 8, "Product Name : ", "", 0, 'L');
$pdf->Cell(70, 8, $request_data['product_name'], "", 1, 'L');
$pdf->Cell(70, 8, "Cultivar : ", "", 0, 'L');
$pdf->Cell(70, 8, $request_data['cultivar'], "", 1, 'L');
$pdf->Cell(70, 8, "Supplier Name : ", "", 0, 'L');
$pdf->Cell(70, 8, $request_data['supplier_name'], "", 1, 'L');
$pdf->Cell(10, 5, '', 0, 1, 'L');

$pdf->Cell(70, 8, "Contact Person : ", "", 0, 'L');
$pdf->Cell(70, 8, $request_data['contact_person'], "", 1, 'L');
$pdf->Cell(70, 8, "Contact Number : ", "", 0, 'L');
$pdf->Cell(70, 8, $request_data['contact_number'], "", 1, 'L');
$pdf->Cell(10, 5, '', 0, 1, 'L');

$pdf->Cell(70, 8, "Delivery certificate email : ", "", 0, 'L');
$pdf->Cell(70, 8, $request_data['delivery_certificate_email'], "", 1, 'L');
$pdf->Cell(70, 8, "Delivery contact number : ", "", 0, 'L');
$pdf->Cell(70, 8, $request_data['delivery_contact_number'], "", 1, 'L');
$pdf->Cell(70, 8, "global G.A.P no : ", "", 0, 'L');
$pdf->Cell(70, 8, $request_data['global_gap_no'], "", 1, 'L');
$pdf->Cell(10, 5, '', 0, 1, 'L');

$pdf->Cell(70, 8, "Farm Name : ", "", 0, 'L');
$pdf->Cell(70, 8, $request_data['farm_name'], "", 1, 'L');
$pdf->Cell(70, 8, "Crop year : ", "", 0, 'L');
$pdf->Cell(70, 8, $request_data['crop_year'], "", 1, 'L');
$pdf->Cell(70, 8, "Country of Origin : ", "", 0, 'L');
$pdf->Cell(70, 8, $request_data['country_of_origin'], "", 1, 'L');
$pdf->Cell(10, 5, '', 0, 1, 'L');

$pdf->Cell(70, 8, "Vehicle registration no : ", "", 0, 'L');
$pdf->Cell(70, 8, $request_data['vehicle_registration'], "", 1, 'L');
$pdf->Cell(70, 8, "Number of Loads : ", "", 0, 'L');
$pdf->Cell(70, 8, $request_data['loads_no'], "", 1, 'L');
$pdf->Cell(70, 8, "Estimated total weight : ", "", 0, 'L');
$pdf->Cell(70, 8, $request_data['estimated_total_weight'] . " kg", "", 1, 'L');
$pdf->Cell(10, 5, '', 0, 1, 'L');

$pdf->Cell(70, 8, "Estimated delivery date from: ", "", 0, 'L');
$pdf->Cell(70, 8, $request_data['estimated_delivery_date_start'], "", 1, 'L');
$pdf->Cell(70, 8, "Estimated delivery date to: ", "", 0, 'L');
$pdf->Cell(70, 8, $request_data['estimated_delivery_date_end'], "", 1, 'L');
$pdf->Cell(10, 5, '', 0, 1, 'L');

$pdf->Output();