Jelajahi Sumber

Update "Mystery Shop" PDF layout and styling

Alan Lam 8 tahun lalu
induk
melakukan
17d0f28d4e
1 mengubah file dengan 13 tambahan dan 29 penghapusan
  1. 13 29
      template_processing/mystery_shop/test_pdf.php

+ 13 - 29
template_processing/mystery_shop/test_pdf.php

@@ -13,34 +13,28 @@ $pdf->SetY($pdf->GetY() + 2);
 $pdf->SetFont("Arial", "", $normal_font_size);
 $pdf->SetTextColor(0, 0, 0);
 
-$pdf->Line($pdf->GetX(), $pdf->GetY(), $pdf->GetX() + 135, $pdf->GetY());
 $pdf->Cell(30, $cell_height, "Region / Manager:", 0, 0);
 $pdf->SetX($pdf->GetX() + 5);
 $pdf->Write($cell_height, $location->region);
 $pdf->Write($cell_height, "/ ");
 $pdf->Write($cell_height, $location->area_manager);
 $pdf->SetY($pdf->GetY() + $cell_height);
-$pdf->Line($pdf->GetX(), $pdf->GetY(), $pdf->GetX() + 135, $pdf->GetY());
 
 $pdf->Cell(30, $cell_height, "Address:", 0, 0);
 $pdf->SetX($pdf->GetX() + 5);
 $pdf->MultiCell(100, $cell_height, $location->getDisplayAddress(["address_1", "address_2", "city"], "\n"), 0, 1);
-$pdf->Line($pdf->GetX(), $pdf->GetY(), $pdf->GetX() + 135, $pdf->GetY());
 
 $pdf->Cell(30, $cell_height, "Postcode:", 0, 0);
 $pdf->SetX($pdf->GetX() + 5);
 $pdf->Cell(100, $cell_height, $location->postal_code, 0, 1);
-$pdf->Line($pdf->GetX(), $pdf->GetY(), $pdf->GetX() + 135, $pdf->GetY());
 
 $pdf->Cell(30, $cell_height, "Shop Name - Left:", 0, 0);
 $pdf->SetX($pdf->GetX() + 5);
 $pdf->Cell(100, $cell_height, $test->shop_left, 0, 1);
-$pdf->Line($pdf->GetX(), $pdf->GetY(), $pdf->GetX() + 135, $pdf->GetY());
 
 $pdf->Cell(30, $cell_height, "Shop Name - Right:", 0, 0);
 $pdf->SetX($pdf->GetX() + 5);
 $pdf->Cell(100, $cell_height, $test->shop_right, 0, 1);
-$pdf->Line($pdf->GetX(), $pdf->GetY(), $pdf->GetX() + 135, $pdf->GetY());
 
 $test_details_y = $pdf->GetY();
 
@@ -57,17 +51,14 @@ $pdf->SetY($pdf->GetY() + 2);
 $pdf->SetFont("Arial", "", $normal_font_size);
 $pdf->SetTextColor(0, 0, 0);
 
-$pdf->Line($pdf->GetX(), $pdf->GetY(), $pdf->GetX() + 50, $pdf->GetY());
 $pdf->Cell(20, $cell_height, "Gender:", 0, 0);
 $pdf->SetX($pdf->GetX() + 5);
 $pdf->Cell(20, $cell_height, $tester->getGenderText(), 0, 1);
-$pdf->Line($pdf->GetX(), $pdf->GetY(), $pdf->GetX() + 50, $pdf->GetY());
 
 $pdf->Cell(20, $cell_height, "Attire:", 0, 1);
 $pdf->SetX(150);
 $pdf->SetFont("Arial", "", $small_font_size);
 $pdf->MultiCell(50, 4, $test->attire, 0, 1);
-$pdf->Line($pdf->GetX(), $pdf->GetY(), $pdf->GetX() + 50, $pdf->GetY());
 
 
 // Test Details
@@ -88,7 +79,6 @@ $pdf->SetFont("Arial", "B", $normal_font_size);
 $pdf->SetTextColor(0, 0, 0);
 
 $pdf->Cell(95, $cell_height, "Date & Time", 0, 1);
-$pdf->SetY($pdf->GetY() + 2);
 
 $pdf->SetFont("Arial");
 
@@ -104,13 +94,12 @@ $pdf->Cell(23, $cell_height, $time_start);
 $pdf->Cell(23, $cell_height, $time_end);
 $pdf->Cell(23, $cell_height, str_pad($diff->h, 2, "0", STR_PAD_LEFT) . ":" . str_pad($diff->i, 2, "0", STR_PAD_LEFT) . ":" . str_pad($diff->s, 2, "0", STR_PAD_LEFT), 0, 1);
 
-$pdf->SetY($pdf->GetY() + 2);
+$pdf->SetY($pdf->GetY() + $cell_height);
 
 // Venue Details
 
 $pdf->SetFont("Arial", "B", $normal_font_size);
 $pdf->Cell(95, $cell_height, "Venue", 0, 1);
-$pdf->SetY($pdf->GetY() + 2);
 
 $pdf->SetFont("Arial");
 
@@ -123,16 +112,14 @@ switch($cleanliness) {
 	case 5: $cleanliness = "Very clean"; break;
 }
 
-$pdf->Line($pdf->GetX(), $pdf->GetY(), $pdf->GetX() + 92.5, $pdf->GetY());
 $pdf->Cell(30, $cell_height, "Cleanliness:", 0, 0);
 $pdf->SetX($pdf->GetX() + 5);
 $pdf->Cell(57.5, $cell_height, $cleanliness, 0, 1);
-$pdf->Line($pdf->GetX(), $pdf->GetY(), $pdf->GetX() + 92.5, $pdf->GetY());
-$pdf->SetY($pdf->GetY() + 2);
+
+$pdf->SetY($pdf->GetY() + $cell_height);
 
 $pdf->SetFont("Arial", "B", $normal_font_size);
 $pdf->Cell(95, $cell_height, "Tester's Notes", 0, 1);
-$pdf->SetY($pdf->GetY() + 2);
 $pdf->SetFont("Arial");
 
 $pdf->SetFont("Arial", "", $small_font_size);
@@ -145,59 +132,57 @@ $pdf->SetY($id_requests_y);
 
 $pdf->SetFont("Arial", "B", $normal_font_size);
 $pdf->Cell(95, $cell_height, "Staff Details", 0, 1);
-$pdf->SetY($pdf->GetY() + 2);
 $pdf->SetFont("Arial");
 
-$pdf->Line($pdf->GetX(), $pdf->GetY(), $pdf->GetX() + 92.5, $pdf->GetY());
-
 $value = $values["staff_badge_worn"] ?? "";
 if(strlen($value) == 0) $value = "Don't know/Not approached";
 else $value = ($value == 0) ? "No" : "Yes";
 $pdf->Cell(30, $cell_height, "Staff Badge Worn:", 0, 0);
 $pdf->SetX($pdf->GetX() + 5);
 $pdf->Cell(60, $cell_height, $value, 0, 1);
-$pdf->Line($pdf->GetX(), $pdf->GetY(), $pdf->GetX() + 92.5, $pdf->GetY());
 
 $value = $values["staff_name"] ?? "";
 $pdf->Cell(30, $cell_height, "Staff Name:", 0, 0);
 $pdf->SetX($pdf->GetX() + 5);
 $pdf->Cell(60, $cell_height, $value, 0, 1);
-$pdf->Line($pdf->GetX(), $pdf->GetY(), $pdf->GetX() + 92.5, $pdf->GetY());
+
+$pdf->SetY($pdf->GetY() + $cell_height);
 
 $value = $values["drink_offered"] ?? "";
 $value = $value ? "Yes" : "No";
 $pdf->Cell(30, $cell_height, "Drink Offered:", 0, 0);
 $pdf->SetX($pdf->GetX() + 5);
 $pdf->Cell(60, $cell_height, $value, 0, 1);
-$pdf->Line($pdf->GetX(), $pdf->GetY(), $pdf->GetX() + 92.5, $pdf->GetY());
 
 $value = $values["staff_offered_drink_name"] ?? "";
 $value = $value ?: "No drink offered";
 $pdf->Cell(30, $cell_height, "Drink Name:", 0, 0);
 $pdf->SetX($pdf->GetX() + 5);
 $pdf->Cell(60, $cell_height, $value, 0, 1);
-$pdf->Line($pdf->GetX(), $pdf->GetY(), $pdf->GetX() + 92.5, $pdf->GetY());
+
+$pdf->SetY($pdf->GetY() + $cell_height);
 
 $value = $values["staff_offered_promotion"] ?? "";
 $value = $value ? "Yes" : "No";
 $pdf->Cell(30, $cell_height, "Promotion Offered:", 0, 0);
 $pdf->SetX($pdf->GetX() + 5);
 $pdf->Cell(60, $cell_height, $value, 0, 1);
-$pdf->Line($pdf->GetX(), $pdf->GetY(), $pdf->GetX() + 92.5, $pdf->GetY());
 
 $value = $values["staff_offered_promotion_name"] ?? "";
 $value = $value ?: "No promotion offered";
 $pdf->Cell(95, $cell_height, "Promotion Name:", 0, 1);
 $pdf->SetFont("Arial", "", $small_font_size);
 $pdf->MultiCell(90, 4, $value, 0, 1);
-$pdf->Line($pdf->GetX(), $pdf->GetY(), $pdf->GetX() + 92.5, $pdf->GetY());
+
+$pdf->SetY($pdf->GetY() + $cell_height);
 
 $value = $values["staff_help"] ?? "";
 $value = $value ? "Yes" : "No";
 $pdf->Cell(30, $cell_height, "Machine Explanation:", 0, 0);
 $pdf->SetX($pdf->GetX() + 5);
 $pdf->Cell(60, $cell_height, $value, 0, 1);
-$pdf->Line($pdf->GetX(), $pdf->GetY(), $pdf->GetX() + 92.5, $pdf->GetY());
+
+$pdf->SetY($pdf->GetY() + $cell_height);
 
 $value = $values["staff_behaviour"];
 switch($value) {
@@ -212,20 +197,19 @@ switch($value) {
 $pdf->Cell(30, $cell_height, "Staff Behaviour:", 0, 0);
 $pdf->SetX($pdf->GetX() + 5);
 $pdf->Cell(60, $cell_height, $value, 0, 1);
-$pdf->Line($pdf->GetX(), $pdf->GetY(), $pdf->GetX() + 92.5, $pdf->GetY());
+
+$pdf->SetY($pdf->GetY() + $cell_height);
 
 $value = $values["staff_uniform"] ?? "";
 $value = $value ? "Yes" : "No";
 $pdf->Cell(30, $cell_height, "Staff Uniform:", 0, 0);
 $pdf->SetX($pdf->GetX() + 5);
 $pdf->Cell(60, $cell_height, $value, 0, 1);
-$pdf->Line($pdf->GetX(), $pdf->GetY(), $pdf->GetX() + 92.5, $pdf->GetY());
 
 $value = $values["staff_uniform_description"] ?? "";
 $value = $value ?: "N/A";
 $pdf->Cell(95, $cell_height, "Staff Uniform Description:", 0, 1);
 $pdf->SetFont("Arial", "", $small_font_size);
 $pdf->MultiCell(90, 4, $value, 0, 1);
-$pdf->Line($pdf->GetX(), $pdf->GetY(), $pdf->GetX() + 92.5, $pdf->GetY());
 
 ?>