Browse Source

Add test counts to test PDF

Alan Lam 2 years ago
parent
commit
8b552c84ec
1 changed files with 22 additions and 0 deletions
  1. 22 0
      template_processing/age_verification_greene_king/test_pdf.php

+ 22 - 0
template_processing/age_verification_greene_king/test_pdf.php

@@ -18,6 +18,9 @@
 use Helpers\PdfHelper;
 use Mpdf\Mpdf;
 
+$year_cycle_constraint = $customer->getYearCycleConstraint(TIMEZONE);
+$display_year_cycle = $customer->getDisplayYearCycle();
+
 $pass_image = $test->pass ? "pass.png" : "fail.png";
 
 // Bar Receipt
@@ -28,6 +31,10 @@ foreach(glob($receipt_path_pattern) as $receipt_path) {
 	$mpdf->imageVars["bar_receipt"] = $receipt_config["contents"];
 }
 
+// Test counts
+$test_count = count($location->getCompletedTests());
+$current_test_count = count($location->getCompletedTests(["dts_start" => $year_cycle_constraint]));
+
 ?>
 
 <h3 class="section">Test Result</h3>
@@ -87,6 +94,21 @@ foreach(glob($receipt_path_pattern) as $receipt_path) {
 		<div class="value"><?=htmlspecialchars($test->shop_right)?></div>
 	</div>
 
+	<div class="bl">
+		<div class="field">Tests (All-Time)</div>
+		<div class="value"><?=$test_count?></div>
+	</div>
+
+	<div class="bl">
+		<div class="field">Tests (Cur. Year Period)</div>
+		<div class="value">
+			<?=$current_test_count?>
+			<small style="color: #808080">
+				(<?=$display_year_cycle?>)
+			</small>
+		</div>
+	</div>
+
 </div>
 
 <div style="float: right; width: 29%">