Alan Lam 8 лет назад
Родитель
Сommit
5311ba67fa
2 измененных файлов с 44 добавлено и 27 удалено
  1. 31 27
      controllers/test_pdf.php
  2. 13 0
      engine/test.php

+ 31 - 27
controllers/test_pdf.php

@@ -99,19 +99,17 @@ $pdf->SetFont("Arial", "B", $header_font_size);
 $tester_x = 150;
 $tester_x = 150;
 $tester_y = $pdf->GetY();
 $tester_y = $pdf->GetY();
 
 
-$pdf->Cell(135, 10, " $location->name", 0, 1, "L", true);
+$header = " $location->name";
+if($location->internal_id) {
+	$header .= " (ID: $location->internal_id)";
+}
+
+$pdf->Cell(135, 10, $header, 0, 1, "L", true);
 $pdf->SetY($pdf->GetY() + 2);
 $pdf->SetY($pdf->GetY() + 2);
 
 
 $pdf->SetFont("Arial", "", $normal_font_size);
 $pdf->SetFont("Arial", "", $normal_font_size);
 $pdf->SetTextColor(0, 0, 0);
 $pdf->SetTextColor(0, 0, 0);
 
 
-
-$pdf->Line($pdf->GetX(), $pdf->GetY(), $pdf->GetX() + 135, $pdf->GetY());
-$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->Line($pdf->GetX(), $pdf->GetY(), $pdf->GetX() + 135, $pdf->GetY());
 $pdf->Cell(30, $cell_height, "Region / Manager:", 0, 0);
 $pdf->Cell(30, $cell_height, "Region / Manager:", 0, 0);
 $pdf->SetX($pdf->GetX() + 5);
 $pdf->SetX($pdf->GetX() + 5);
@@ -121,11 +119,6 @@ $pdf->Write($cell_height, $location->area_manager);
 $pdf->SetY($pdf->GetY() + $cell_height);
 $pdf->SetY($pdf->GetY() + $cell_height);
 $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, "Phone:", 0, 0);
-$pdf->SetX($pdf->GetX() + 5);
-$pdf->Cell(100, $cell_height, $location->phone, 0, 1);
-$pdf->Line($pdf->GetX(), $pdf->GetY(), $pdf->GetX() + 135, $pdf->GetY());
-
 $pdf->Cell(30, $cell_height, "Address:", 0, 0);
 $pdf->Cell(30, $cell_height, "Address:", 0, 0);
 $pdf->SetX($pdf->GetX() + 5);
 $pdf->SetX($pdf->GetX() + 5);
 $pdf->MultiCell(100, $cell_height, $location->getDisplayAddress(["address_1", "address_2", "city"], "\n"), 0, 1);
 $pdf->MultiCell(100, $cell_height, $location->getDisplayAddress(["address_1", "address_2", "city"], "\n"), 0, 1);
@@ -136,11 +129,6 @@ $pdf->SetX($pdf->GetX() + 5);
 $pdf->Cell(100, $cell_height, $location->postal_code, 0, 1);
 $pdf->Cell(100, $cell_height, $location->postal_code, 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, "County:", 0, 0);
-$pdf->SetX($pdf->GetX() + 5);
-$pdf->Cell(100, $cell_height, $location->county, 0, 1);
-$pdf->Line($pdf->GetX(), $pdf->GetY(), $pdf->GetX() + 135, $pdf->GetY());
-
 $pdf->Cell(30, $cell_height, "Shop Name - Left:", 0, 0);
 $pdf->Cell(30, $cell_height, "Shop Name - Left:", 0, 0);
 $pdf->SetX($pdf->GetX() + 5);
 $pdf->SetX($pdf->GetX() + 5);
 $pdf->Cell(100, $cell_height, $test->shop_left, 0, 1);
 $pdf->Cell(100, $cell_height, $test->shop_left, 0, 1);
@@ -260,22 +248,29 @@ $pdf->SetFont("Arial");
 
 
 $pdf->Line($pdf->GetX(), $pdf->GetY(), $pdf->GetX() + 92.5, $pdf->GetY());
 $pdf->Line($pdf->GetX(), $pdf->GetY(), $pdf->GetX() + 92.5, $pdf->GetY());
 
 
+$pdf->Cell(30, $cell_height, "Result:", 0, 0);
+$pdf->SetX($pdf->GetX() + 5);
+$pdf->Cell(60, $cell_height, $test->getPassText(), 0, 1);
+$pdf->Line($pdf->GetX(), $pdf->GetY(), $pdf->GetX() + 92.5, $pdf->GetY());
+
 $pdf->Cell(30, $cell_height, "ID Stage:", 0, 0);
 $pdf->Cell(30, $cell_height, "ID Stage:", 0, 0);
 $pdf->SetX($pdf->GetX() + 5);
 $pdf->SetX($pdf->GetX() + 5);
-$pdf->Cell(60, $cell_height, $test->challenge_stage, 0, 1);
+$pdf->Cell(60, $cell_height, $test->challenge_stage . " - " . $test->getChallengeStageText(), 0, 1);
 $pdf->Line($pdf->GetX(), $pdf->GetY(), $pdf->GetX() + 92.5, $pdf->GetY());
 $pdf->Line($pdf->GetX(), $pdf->GetY(), $pdf->GetX() + 92.5, $pdf->GetY());
 
 
 $pdf->SetY($pdf->GetY() + 2);
 $pdf->SetY($pdf->GetY() + 2);
 
 
 $pdf->SetFont("Arial", "", $small_font_size);
 $pdf->SetFont("Arial", "", $small_font_size);
 $pdf->SetTextColor(0, 128, 0);
 $pdf->SetTextColor(0, 128, 0);
-$pdf->MultiCell(95, 4, "1: Challenge on entry
-2: Challenge while browsing", 0, 1);
+$pdf->MultiCell(95, 4, "1: Challenge on entry", 0, 1);
+
+$pdf->SetTextColor(255, 128, 0);
+$pdf->MultiCell(95, 4, "2: Challenge while browsing
+3: Challenge during play", 0, 1);
 
 
 $pdf->SetTextColor(255, 0, 0);
 $pdf->SetTextColor(255, 0, 0);
 
 
-$pdf->MultiCell(95, 4, "3: Challenge during play
-4: Challenge on exit
+$pdf->MultiCell(95, 4, "4: Challenge on exit
 5: No challenge", 0, 1);
 5: No challenge", 0, 1);
 
 
 $pdf->SetFont("Arial", "", $normal_font_size);
 $pdf->SetFont("Arial", "", $normal_font_size);
@@ -316,14 +311,20 @@ $pdf->SetX($pdf->GetX() + 5);
 $pdf->Cell($value_width, $cell_height, $values["play_machine"] ?? "N/A", 0, 1);
 $pdf->Cell($value_width, $cell_height, $values["play_machine"] ?? "N/A", 0, 1);
 $pdf->Line($pdf->GetX(), $pdf->GetY(), $pdf->GetX() + 92.5, $pdf->GetY());
 $pdf->Line($pdf->GetX(), $pdf->GetY(), $pdf->GetX() + 92.5, $pdf->GetY());
 
 
+$value = $values["play_jackpot"] ?? "N/A";
+if($value != "N/A") $value = "\xa3" . number_format($value);
+
 $pdf->Cell($field_width, $cell_height, "Jackpot Value:", 0, 0);
 $pdf->Cell($field_width, $cell_height, "Jackpot Value:", 0, 0);
 $pdf->SetX($pdf->GetX() + 5);
 $pdf->SetX($pdf->GetX() + 5);
-$pdf->Cell($value_width, $cell_height, $values["play_jackpot"] ?? "N/A", 0, 1);
+$pdf->Cell($value_width, $cell_height, $value, 0, 1);
 $pdf->Line($pdf->GetX(), $pdf->GetY(), $pdf->GetX() + 92.5, $pdf->GetY());
 $pdf->Line($pdf->GetX(), $pdf->GetY(), $pdf->GetX() + 92.5, $pdf->GetY());
 
 
+$value = $values["play_machine_stake"] ?? "N/A";
+if($value != "N/A") $value = "\xa3" . number_format($value, 2);
+
 $pdf->Cell($field_width, $cell_height, "Stake Played:", 0, 0);
 $pdf->Cell($field_width, $cell_height, "Stake Played:", 0, 0);
 $pdf->SetX($pdf->GetX() + 5);
 $pdf->SetX($pdf->GetX() + 5);
-$pdf->Cell($value_width, $cell_height, $values["play_machine_stake"] ?? "N/A", 0, 1);
+$pdf->Cell($value_width, $cell_height, $value, 0, 1);
 $pdf->Line($pdf->GetX(), $pdf->GetY(), $pdf->GetX() + 92.5, $pdf->GetY());
 $pdf->Line($pdf->GetX(), $pdf->GetY(), $pdf->GetX() + 92.5, $pdf->GetY());
 
 
 $pdf->Cell($field_width, $cell_height, "Minutes Played:", 0, 0);
 $pdf->Cell($field_width, $cell_height, "Minutes Played:", 0, 0);
@@ -331,9 +332,12 @@ $pdf->SetX($pdf->GetX() + 5);
 $pdf->Cell($value_width, $cell_height, $values["play_minutes"] ?? "N/A", 0, 1);
 $pdf->Cell($value_width, $cell_height, $values["play_minutes"] ?? "N/A", 0, 1);
 $pdf->Line($pdf->GetX(), $pdf->GetY(), $pdf->GetX() + 92.5, $pdf->GetY());
 $pdf->Line($pdf->GetX(), $pdf->GetY(), $pdf->GetX() + 92.5, $pdf->GetY());
 
 
-$pdf->Cell($field_width, $cell_height, "Stake Spent:", 0, 0);
+$value = $values["play_spent"] ?? "N/A";
+if($value != "N/A") $value = "\xa3" . number_format($value, 2);
+
+$pdf->Cell($field_width, $cell_height, "Amount Spent:", 0, 0);
 $pdf->SetX($pdf->GetX() + 5);
 $pdf->SetX($pdf->GetX() + 5);
-$pdf->Cell($value_width, $cell_height, $values["play_spent"] ?? "N/A", 0, 1);
+$pdf->Cell($value_width, $cell_height, $value, 0, 1);
 $pdf->Line($pdf->GetX(), $pdf->GetY(), $pdf->GetX() + 92.5, $pdf->GetY());
 $pdf->Line($pdf->GetX(), $pdf->GetY(), $pdf->GetX() + 92.5, $pdf->GetY());
 
 
 $pdf->Cell($field_width, $cell_height, "Think 21/25:", 0, 0);
 $pdf->Cell($field_width, $cell_height, "Think 21/25:", 0, 0);

+ 13 - 0
engine/test.php

@@ -29,6 +29,15 @@ class Test extends Model {
 		16 => "Completed",
 		16 => "Completed",
 	];
 	];
 
 
+	const STAGES = [
+		0 => "",
+		1 => "Challenge on entry",
+		2 => "Challenge while browsing",
+		3 => "Challenge during play",
+		4 => "Challenge on exit",
+		5 => "No challenge",
+	];
+
 	const TEST_TIME_ANYTIME = 1;
 	const TEST_TIME_ANYTIME = 1;
 	const TEST_TIME_DAY = 2;
 	const TEST_TIME_DAY = 2;
 	const TEST_TIME_NIGHT = 3;
 	const TEST_TIME_NIGHT = 3;
@@ -67,6 +76,10 @@ class Test extends Model {
 		$mail->send();
 		$mail->send();
 	}
 	}
 
 
+	public function getChallengeStageText() {
+		return Test::STAGES[$this->challenge_stage];
+	}
+
 	public function getStatusText() {
 	public function getStatusText() {
 		return Test::STATUSES[$this->status];
 		return Test::STATUSES[$this->status];
 	}
 	}