<?php
require('../../fpdf.php');
include "../../root.class.php";


$db = new db_safeguard();
// $jobcard_res = $db->query("jobcards", "SELECT * FROM jobcards WHERE record_id = {$_GET['record_id']}");
// $jobcard = $jobcard_res->fetch_assoc();

$pdf = new FPDF();
$pdf->AliasNbPages();
$pdf->AddPage('p');

$pdf->SetFont('Arial', 'B', 20);
$pdf->Cell(200, 15, "ANALYSIS RESULT", 0, 1, 'C');
$pdf->Cell(10, 5, '', 0, 1, 'L');
$pdf->SetFont('Arial', '', 10);

$pdf->Cell(70, 8, "Document No : ", "", 0, 'L');
$pdf->Cell(70, 8, "document_no", "", 1, 'L');
$pdf->Cell(70, 8, "Date & Time : ", "", 0, 'L');
$pdf->Cell(70, 8, "date_time", "", 1, 'L');
$pdf->Cell(70, 8, "Person Capturing Results : ", "", 0, 'L');
$pdf->Cell(70, 8, "person_capturing_results", "", 1, 'L');
$pdf->Cell(10, 5, '', 0, 1, 'L');

$pdf->Cell(70, 8, "Laboratory Name : ", "", 0, 'L');
$pdf->Cell(70, 8, "laboratory_name", "", 1, 'L');
$pdf->Cell(70, 8, "Laboratory Reference Number :", "", 0, 'L');
$pdf->Cell(70, 8, "laboratory_reference_number", "", 1, 'L');
$pdf->Cell(70, 8, "Lab SANAS Accreditation number : ", "", 0, 'L');
$pdf->Cell(70, 8, "lab_sanas_accreditation_number", "", 1, 'L');
$pdf->Cell(70, 8, "Date of Analysis : ", "", 0, 'L');
$pdf->Cell(70, 8, "analysis_date", "", 1, 'L');
$pdf->Cell(10, 5, '', 0, 1, 'L');

$pdf->Cell(70, 8, "Sample name :", "", 0, 'L');
$pdf->Cell(70, 8, "sample_name", "", 1, 'L');
$pdf->Cell(70, 8, "Customer :", "", 0, 'L');
$pdf->Cell(70, 8, "customer", "", 1, 'L');
$pdf->Cell(70, 8, "Batch Number :", "", 0, 'L');
$pdf->Cell(70, 8, "batch_number", "", 1, 'L');
$pdf->Cell(70, 8, "Product Code :", "", 0, 'L');
$pdf->Cell(70, 8, "product_code", "", 1, 'L');
$pdf->Cell(70, 8, "Production Date :", "", 0, 'L');
$pdf->Cell(70, 8, "production_date", "", 1, 'L');
$pdf->Cell(70, 8, "Expiration Date :", "", 0, 'L');
$pdf->Cell(70, 8, "expiration_date", "", 1, 'L');
$pdf->Cell(70, 8, "Purpose of Test :", "", 0, 'L');
$pdf->Cell(70, 8, "purpose_of_test", "", 1, 'L');
$pdf->Cell(10, 5, '', 0, 1, 'L');

$pdf->Cell(70, 8, "Type of Sample :", "", 0, 'L');
$pdf->Cell(70, 8, "sample_type", "", 1, 'L');
$pdf->Cell(70, 8, "Type of Analysis :", "", 0, 'L');
$pdf->Cell(70, 8, "analysis_type", "", 1, 'L');
$pdf->Cell(10, 5, '', 0, 1, 'L');

$pdf->SetFont('Arial', 'B', 20);
$pdf->Cell(200, 15, "Type of Analysis", 0, 1, 'C');
$pdf->Cell(10, 5, '', 0, 1, 'L');
$pdf->SetFont('Arial', '', 10);

$pdf->Cell(45, 8, "ORGANISM", 1, 0, 'L');
$pdf->Cell(40, 8, "RESULTS", 1, 0, 'L');
$pdf->Cell(35, 8, "UNIT OF MEASURE", 1, 0, 'L');
$pdf->Cell(45, 8, "Specifications/Critical Limits", 1, 0, 'L');
$pdf->Cell(32, 8, "Within Critial Limits", 1, 1, 'L');

// $notes_res = $db->query("notes", "SELECT * FROM notes WHERE jobcard_id = {$_GET['record_id']} ORDER BY record_id ASC");
// if ($notes_res->num_rows == 0) {
//     $error = 1;
// } else {
//     while ($notes = $notes_res->fetch_assoc()) {
$pdf->Cell(45, 8, "", "LB", 0, 'L');
$pdf->Cell(40, 8, "", "LBR", 0, 'L');
$pdf->Cell(35, 8, "", "LBR", 0, 'L');
$pdf->Cell(45, 8, "", "LBR", 0, 'L');
$pdf->Cell(32, 8, "", "LBR", 1, 'L');
//     }
// }
$pdf->Cell(50, 20, '', 0, 1, 'L');

$pdf->Cell(45, 8, "ORGANISM", 1, 0, 'L');
$pdf->Cell(40, 8, "RESULTS", 1, 0, 'L');
$pdf->Cell(35, 8, "UNIT OF MEASURE", 1, 0, 'L');
$pdf->Cell(45, 8, "Specifications/Critical Limits", 1, 0, 'L');
$pdf->Cell(32, 8, "Within Critial Limits", 1, 1, 'L');

$pdf->Cell(45, 8, "", "LB", 0, 'L');
$pdf->Cell(40, 8, "", "LBR", 0, 'L');
$pdf->Cell(35, 8, "", "LBR", 0, 'L');
$pdf->Cell(45, 8, "", "LBR", 0, 'L');
$pdf->Cell(32, 8, "", "LBR", 1, 'L');

$pdf->Cell(50, 20, '', 0, 1, 'L');

$pdf->Cell(197, 8, "NUTRITIONAL INFORMATION", 1, 1, 'C');
$pdf->Cell(69, 8, "", 1, 0, 'L');
$pdf->Cell(64, 8, "per 100", 1, 0, 'C');
$pdf->Cell(64, 8, "per 20", 1, 1, 'C');

$pdf->Cell(69, 8, "Kilojoules (kJ)", 1, 0, 'L');
$pdf->Cell(64, 8, "", 1, 0, 'L');
$pdf->Cell(64, 8, "", 1, 1, 'L');

$pdf->Cell(69, 8, "Protein (g)", 1, 0, 'L');
$pdf->Cell(64, 8, "", 1, 0, 'L');
$pdf->Cell(64, 8, "", 1, 1, 'L');

$pdf->Cell(69, 8, "Fat (g)", 1, 0, 'L');
$pdf->Cell(64, 8, "", 1, 0, 'L');
$pdf->Cell(64, 8, "", 1, 1, 'L');

$pdf->Cell(69, 8, "Unsaturated fats (g)", 1, 0, 'L');
$pdf->Cell(64, 8, "", 1, 0, 'L');
$pdf->Cell(64, 8, "", 1, 1, 'L');

$pdf->Cell(69, 8, "Saturated fats (g)", 1, 0, 'L');
$pdf->Cell(64, 8, "", 1, 0, 'L');
$pdf->Cell(64, 8, "", 1, 1, 'L');

$pdf->Cell(69, 8, "Monounsaturated fats (g)", 1, 0, 'L');
$pdf->Cell(64, 8, "", 1, 0, 'L');
$pdf->Cell(64, 8, "", 1, 1, 'L');

$pdf->Cell(69, 8, "Polyunsaturated fats (g)", 1, 0, 'L');
$pdf->Cell(64, 8, "", 1, 0, 'L');
$pdf->Cell(64, 8, "", 1, 1, 'L');

$pdf->Cell(69, 8, "Carbohydrates (g)", 1, 0, 'L');
$pdf->Cell(64, 8, "", 1, 0, 'L');
$pdf->Cell(64, 8, "", 1, 1, 'L');

$pdf->Cell(69, 8, "of which sugars(g)", 1, 0, 'L');
$pdf->Cell(64, 8, "", 1, 0, 'L');
$pdf->Cell(64, 8, "", 1, 1, 'L');

$pdf->Cell(69, 8, "Fibre (g)", 1, 0, 'L');
$pdf->Cell(64, 8, "", 1, 0, 'L');
$pdf->Cell(64, 8, "", 1, 1, 'L');

$pdf->Cell(69, 8, "Soluble (g)", 1, 0, 'L');
$pdf->Cell(64, 8, "", 1, 0, 'L');
$pdf->Cell(64, 8, "", 1, 1, 'L');

$pdf->Cell(69, 8, "Non-soluble (g)", 1, 0, 'L');
$pdf->Cell(64, 8, "", 1, 0, 'L');
$pdf->Cell(64, 8, "", 1, 1, 'L');

$pdf->Cell(69, 8, "Cholesterol (mg)", 1, 0, 'L');
$pdf->Cell(64, 8, "", 1, 0, 'L');
$pdf->Cell(64, 8, "", 1, 1, 'L');

$pdf->Cell(69, 8, " ", 1, 0, 'L');
$pdf->Cell(64, 8, "", 1, 0, 'L');
$pdf->Cell(64, 8, "", 1, 1, 'L');

$pdf->Output();