Alan Lam 8 лет назад
Родитель
Сommit
61a7d534d9

+ 2 - 1
controllers/test_invoice.php

@@ -6,6 +6,7 @@ if($test->status != Test::STATUS_COMPLETED) throw new Exception("An invoice cann
 if(Core::$user->id != $test->tester_id && !Core::$user->canAdmin()) throw new Exception("You do not have permission to access this resource.");
 
 $project = $test->getProject();
+$template = $project->getTemplate();
 $location = $test->getLocation();
 $tester = $test->getTester();
 $values = $test->getValues(true);
@@ -146,7 +147,7 @@ $pdf->SetTextColor(0);
 $pdf->SetFont("Arial", "", $normal_font_size);
 
 $y = $pdf->GetY();
-$pdf->MultiCell(115, 5, "Age Verification Test\n$location_address\n" . date("d/m/Y H:i", strtotime($test->dts_start . " UTC")), 0, "L");
+$pdf->MultiCell(115, 5, $template->name . " Test\n$location_address\n" . date("d/m/Y H:i", strtotime($test->dts_start . " UTC")), 0, "L");
 $next_y = $pdf->GetY();
 $pdf->SetXY(125, $y);
 $pdf->Cell(15, 5, 1, 0, 0, "R");

+ 4 - 0
engine/util.php

@@ -1,6 +1,10 @@
 <?php
 class Util {
 
+	public static function convertUTF8($string, $target_encoding = "CP1252") {
+		return mb_convert_encoding($string, $target_encoding, "UTF-8");
+	}
+
 	public static function getPaginationObject($array, $page_size = 25) {
 		$item_count = count($array);
 

+ 20 - 2
template_processing/age_verification/test_pdf.php

@@ -155,7 +155,7 @@ $pdf->SetY($pdf->GetY() + 2);
 $pdf->SetFont("Arial");
 
 $pdf->SetFont("Arial", "", $small_font_size);
-$pdf->MultiCell(90, 4, $test->additional_notes, 0, 1);
+$pdf->MultiCell(90, 4, Util::convertUTF8($test->additional_notes), 0, 1);
 $pdf->SetY($pdf->GetY() + 2);
 
 // Challenge
@@ -294,4 +294,22 @@ $pdf->SetFont("Arial", "", $small_font_size);
 $pdf->MultiCell(95, 4, $values["think_21_poster_notes"] ?? "N/A", 0, 1);
 $pdf->Line($pdf->GetX(), $pdf->GetY(), $pdf->GetX() + 92.5, $pdf->GetY());
 
-?>
+// Footer
+$pdf->SetLeftMargin(10);
+
+$pdf->SetY(265);
+
+$pdf->SetFillColor(0, 146, 69);
+$pdf->Rect($pdf->GetX(), $pdf->GetY(), 190, 1, "DF");
+
+$pdf->SetY($pdf->GetY() + 6);
+
+$pdf->SetFont("Arial", "B", $normal_font_size);
+$pdf->Cell(0, $cell_height, "Check Policy Limited");
+$pdf->SetY($pdf->GetY() + $cell_height);
+$pdf->SetFont("Arial", "", $normal_font_size);
+$pdf->Cell(0, $cell_height, "8 Market Street, Liskeard, Cornwall, PL14 3JJ");
+$pdf->SetY($pdf->GetY() + $cell_height);
+$pdf->Cell(0, $cell_height, "Company Number: 09506865");
+
+?>

+ 45 - 2
template_processing/mystery_shop/test_pdf.php

@@ -123,8 +123,32 @@ $pdf->Cell(95, $cell_height, "Tester's Notes", 0, 1);
 $pdf->SetFont("Arial");
 
 $pdf->SetFont("Arial", "", $small_font_size);
-$pdf->MultiCell(90, 4, $test->additional_notes, 0, 1);
-$pdf->SetY($pdf->GetY() + 2);
+$pdf->MultiCell(90, 4, Util::convertUTF8($test->additional_notes), 0, 1);
+
+$pdf->SetY($pdf->GetY() + $cell_height);
+
+// Location photo
+$pdf->SetFont("Arial", "B", $normal_font_size);
+$pdf->Cell(95, $cell_height, "Location Photo", 0, 1);
+$pdf->SetFont("Arial");
+
+$location_photo_path = $test->getDirectory() . "/location_photo.jpg";
+
+$size = getimagesize($location_photo_path);
+list($image_width, $image_height) = $size;
+
+$width = 0;
+$height = 0;
+if($image_height > $image_width) {
+	$height = 70;
+}
+else {
+	$width = 70;
+}
+
+
+$pdf->Image($location_photo_path, $pdf->GetX(), $pdf->GetY(), $width, $height);
+
 
 // Staff Details
 $pdf->SetLeftMargin(107.5);
@@ -212,4 +236,23 @@ $pdf->Cell(95, $cell_height, "Staff Uniform Description:", 0, 1);
 $pdf->SetFont("Arial", "", $small_font_size);
 $pdf->MultiCell(90, 4, $value, 0, 1);
 
+// Footer
+$pdf->SetLeftMargin(10);
+
+$pdf->SetY(265);
+
+$pdf->SetFillColor(0, 146, 69);
+$pdf->Rect($pdf->GetX(), $pdf->GetY(), 190, 1, "DF");
+
+$pdf->SetY($pdf->GetY() + 6);
+
+$pdf->SetFont("Arial", "B", $normal_font_size);
+$pdf->Cell(0, $cell_height, "Check Policy Limited");
+$pdf->SetY($pdf->GetY() + $cell_height);
+$pdf->SetFont("Arial", "", $normal_font_size);
+$pdf->Cell(0, $cell_height, "8 Market Street, Liskeard, Cornwall, PL14 3JJ");
+$pdf->SetY($pdf->GetY() + $cell_height);
+$pdf->Cell(0, $cell_height, "Company Number: 09506865");
+
+
 ?>