Просмотр исходного кода

Adjusted image sizes and text sizes. Added region and internal ID.

Alan Lam 8 лет назад
Родитель
Сommit
c88efdbd16
1 измененных файлов с 21 добавлено и 18 удалено
  1. 21 18
      controllers/test_pdf.php

+ 21 - 18
controllers/test_pdf.php

@@ -12,6 +12,7 @@ $values = array_column($test_values, "value");
 
 $values = array_combine($keys, $values);
 
+$tiny_font_size = 8;
 $small_font_size = 10;
 $normal_font_size = 10;
 $header_font_size = 14;
@@ -45,32 +46,33 @@ $pdf->SetFillColor(226, 240, 217);
 $pdf->SetAutoPageBreak(false);
 
 // Logo
-$pdf->Image("public/img/logo.png", 11, 10, 80);
+$pdf->Image("public/img/logo.png", 11, 10, 60);
 
 // Right contact info
 $y = 10;
 
-$pdf->SetFont("Arial", "B");
+$pdf->SetFont("Arial", "B", $tiny_font_size);
 $pdf->SetTextColor(255, 0, 0);
 
-$pdf->SetXY(115, $y = 10);
-$pdf->Cell(80, 5, "Test ID: $test->id", 0, 0, "R");
+$pdf->SetLeftMargin(120);
+$pdf->SetY(10);
+
+$pdf->Cell(80, 4, "Test / Location ID: $test->id / $location->id", 0, 1, "R");
 
 $pdf->SetFont("Arial", "");
 $pdf->SetTextColor(0, 0, 0);
 
-$pdf->SetXY(115, $y += 5);
-$pdf->Cell(80, 5, "Tel: 01579 342 104", 0, 0, "R", false, "tel:01579+342+104");
+
+$pdf->Cell(80, 4, "Tel: 01579 342 104", 0, 1, "R", false, "tel:01579+342+104");
 
 $pdf->SetFont("Arial", "U");
 $pdf->SetTextColor(0, 128, 255);
 
-$pdf->SetXY(115, $y += 5);
-$pdf->Cell(80, 5, "check-policy.com", 0, 0, "R", false, "https://check-policy.com");
-$pdf->SetXY(115, $y += 5);
-$pdf->Cell(80, 5, "info@check-policy.com", 0, 0, "R");
+$pdf->Cell(80, 4, "check-policy.com", 0, 1, "R", false, "https://check-policy.com");
+$pdf->Cell(80, 4, "info@check-policy.com", 0, 1, "R");
 
-$pdf->SetXY(10, $y = 35);
+$pdf->SetLeftMargin(10);
+$pdf->SetXY(10, $pdf->GetY() + $cell_margin);
 
 // Header
 $pdf->SetTextColor(56, 87, 35);
@@ -78,15 +80,16 @@ $pdf->SetFont("Arial", "B", $header_font_size);
 $pdf->Cell(190, 10, " Test Result", 0, 1, "L", true);
 
 // Pass/Fail
-$pdf->SetFont("Arial", "B", 32);
+$image_width = 130;
+
 if($test->pass) {
-	$pdf->Image("public/img/pass.png", 65, $pdf->GetY() + 4, 80);
+	$pdf->Image("public/img/pass.png", (210 - $image_width) / 2, $pdf->GetY() + 2, $image_width);
 }
 else {
-	$pdf->Image("public/img/fail.png", 65, $pdf->GetY() + 4, 80);
+	$pdf->Image("public/img/fail.png", (210 - $image_width) / 2, $pdf->GetY() + 2, $image_width);
 }
 
-$pdf->SetY($pdf->GetY() + 25);
+$pdf->SetY($pdf->GetY() + 30);
 
 $pdf->SetTextColor(56, 87, 35);
 
@@ -104,15 +107,15 @@ $pdf->SetTextColor(0, 0, 0);
 
 
 $pdf->Line($pdf->GetX(), $pdf->GetY(), $pdf->GetX() + 135, $pdf->GetY());
-$pdf->Cell(30, $cell_height, "Location ID:", 0, 0);
+$pdf->Cell(30, $cell_height, "ID:", 0, 0);
 $pdf->SetX($pdf->GetX() + 5);
 $pdf->Cell(100, $cell_height, $test->location_id, 0, 1);
 $pdf->Line($pdf->GetX(), $pdf->GetY(), $pdf->GetX() + 135, $pdf->GetY());
 
 $pdf->Line($pdf->GetX(), $pdf->GetY(), $pdf->GetX() + 135, $pdf->GetY());
-$pdf->Cell(30, $cell_height, "Manager:", 0, 0);
+$pdf->Cell(30, $cell_height, "Region / Manager:", 0, 0);
 $pdf->SetX($pdf->GetX() + 5);
-$pdf->Cell(100, $cell_height, $location->area_manager, 0, 1);
+$pdf->Cell(100, $cell_height, "$location->region / $location->area_manager", 0, 1);
 $pdf->Line($pdf->GetX(), $pdf->GetY(), $pdf->GetX() + 135, $pdf->GetY());
 
 $pdf->Cell(30, $cell_height, "Phone:", 0, 0);