Explorar el Código

Update GK PDF

Alan Lam hace 2 años
padre
commit
f2ea90fb93
Se han modificado 1 ficheros con 219 adiciones y 222 borrados
  1. 219 222
      template_processing/age_verification_greene_king/test_pdf.php

+ 219 - 222
template_processing/age_verification_greene_king/test_pdf.php

@@ -1,4 +1,4 @@
-<?php
+<?php /** @noinspection PhpUnhandledExceptionInspection */
 
 
 /**
 /**
  * @var Template $template
  * @var Template $template
@@ -21,7 +21,10 @@ use Mpdf\Mpdf;
 $year_cycle_constraint = $customer->getYearCycleConstraint(TIMEZONE);
 $year_cycle_constraint = $customer->getYearCycleConstraint(TIMEZONE);
 $display_year_cycle = $customer->getDisplayYearCycle();
 $display_year_cycle = $customer->getDisplayYearCycle();
 
 
+$alcohol_purchased = $values["alcohol_purchased"] ?? "";
+
 $pass_image = $test->pass ? "pass.png" : "fail.png";
 $pass_image = $test->pass ? "pass.png" : "fail.png";
+$alcohol_pass_image = empty($alcohol_purchased) ? "pass.png" : "fail.png";
 
 
 // Bar Receipt
 // Bar Receipt
 $receipt_path_pattern = $test->getDirectory() . "/bar_receipt.*";
 $receipt_path_pattern = $test->getDirectory() . "/bar_receipt.*";
@@ -35,64 +38,54 @@ foreach(glob($receipt_path_pattern) as $receipt_path) {
 $test_count = count($location->getCompletedTests());
 $test_count = count($location->getCompletedTests());
 $current_test_count = count($location->getCompletedTests(["dts_start" => $year_cycle_constraint]));
 $current_test_count = count($location->getCompletedTests(["dts_start" => $year_cycle_constraint]));
 
 
-?>
-
-<h3 class="section">Test Result</h3>
+$render_field_value = static function($field, $value): void {
+	?>
+	<div class="bl">
+		<div class="field"><?=htmlspecialchars($field)?>:</div>
+		<div class="value"><?=htmlspecialchars($value)?></div>
+	</div>
+	<?php
+};
 
 
-<div align="center" style="margin: auto; width: 75%;">
-	<img src="/img/<?=htmlspecialchars($pass_image)?>" alt="" />
-</div>
+if($test->pass) {
+	?>
+	<h3 class="section">Test Result</h3>
 
 
-<div style="float: left; width: 70%; position: relative;">
-	<h3 class="section"><?=htmlspecialchars($location_text)?></h3>
+	<div align="center" style="margin: auto; width: 75%;">
+		<img src="/img/<?=htmlspecialchars($pass_image)?>" alt="" />
+	</div>
+	<?php
+}
+else {
+	?>
+	<div style="float: left; width: 49.25%; position: relative;">
+		<h3 class="section">Machine Test Result</h3>
 
 
-	<div class="bl">
-		<div class="field"><?=htmlspecialchars($customer->region_field_name)?> / <?=htmlspecialchars($customer->area_manager_field_name)?>:</div>
-		<div class="value">
-			<div style="float: left; width: 25%;">
-				<?=TestPDF::getValueHtml($location->region)?> / <?=TestPDF::getValueHtml($location->area_manager)?>
-			</div>
-			<div style="float: right; width: 74%; text-align: right;">
-				<?=TestPDF::getValueHtml($location->region_name)?> / <?=TestPDF::getValueHtml($location->area_manager_name)?>
-			</div>
+		<div align="center" style="margin: auto; width: 90%;">
+			<img src="/img/<?=htmlspecialchars($pass_image)?>" alt="" />
 		</div>
 		</div>
 	</div>
 	</div>
+	<div style="float: right; width: 49.25%; position: relative;">
+		<h3 class="section">Alcohol Test Result</h3>
 
 
-	<div class="bl">
-		<div class="field">Address:</div>
-		<div class="value">
-			<div style="float: left; width: 50%;">
-				<?=htmlspecialchars($location->address_1)?><br />
-				<?php
-				if($location->address_2) {
-					?>
-					<?=htmlspecialchars($location->address_2)?><br />
-					<?php
-				}
-				?>
-				<?=htmlspecialchars($location->city)?>
-			</div>
-			<div style="float: right; width: 49%; text-align: right;">
-				<?=htmlspecialchars($location->legal_entity_name)?><br />
-				<strong>OPM:</strong> <?=htmlspecialchars($location->operations_manager_name)?>
-			</div>
+		<div align="center" style="margin: auto; width: 90%;">
+			<img src="/img/<?=htmlspecialchars($alcohol_pass_image)?>" alt="" />
 		</div>
 		</div>
 	</div>
 	</div>
+	<br />
+	<?php
+}
 
 
-	<div class="bl">
-		<div class="field">Postcode:</div>
-		<div class="value"><?=htmlspecialchars($location->postal_code)?></div>
-	</div>
+?>
 
 
-	<div class="bl">
-		<div class="field">Shop Name - Left:</div>
-		<div class="value"><?=htmlspecialchars($test->shop_left)?></div>
-	</div>
 
 
-	<div class="bl">
-		<div class="field">Shop Name - Right:</div>
-		<div class="value"><?=htmlspecialchars($test->shop_right)?></div>
-	</div>
+
+<div style="float: left; width: 49.25%; position: relative;">
+	<h3 class="section"><?=htmlspecialchars($location_text)?></h3>
+
+	<?php
+	$render_field_value("Address", $location->getDisplayAddress());
+	?>
 
 
 	<div class="bl">
 	<div class="bl">
 		<div class="field">Tests (All-Time)</div>
 		<div class="field">Tests (All-Time)</div>
@@ -109,32 +102,48 @@ $current_test_count = count($location->getCompletedTests(["dts_start" => $year_c
 		</div>
 		</div>
 	</div>
 	</div>
 
 
-</div>
 
 
-<div style="float: right; width: 29%">
-	<h3 class="section">Tester</h3>
 
 
-	<div class="bl">
-		<div class="field">Gender:</div>
-		<div class="value"><?=htmlspecialchars($tester->getGenderText())?></div>
-	</div>
+	<section>
+		<h3 class="section">Tester</h3>
 
 
-	<div>
-		<strong>Attire:</strong><br />
-		<?=htmlspecialchars($test->attire)?>
-	</div>
+		<div class="bl">
+			<div class="field">Gender:</div>
+			<div class="value"><?=htmlspecialchars($tester->getGenderText())?></div>
+		</div>
 
 
-	<h3 class="section">Brand</h3>
-	<strong><?=htmlspecialchars($location->brand)?></strong>
+		<div>
+			<strong>Attire:</strong><br />
+			<?=htmlspecialchars($test->attire)?>
+		</div>
+	</section>
+
+</div>
+
+<div style="float: right; width: 49.25%">
+
+	<section>
+		<h3 class="section">House Information</h3>
+
+		<?php
+		$render_field_value("Division", $location->brand);
+		$render_field_value("OM", $location->operations_manager_name);
+		$render_field_value("BDM", $location->region_name);
+		$render_field_value("SGEM", $location->senior_gaming_manager_name);
+		$render_field_value("GEM", $location->gaming_manager_name);
+		$render_field_value("Density", $location->machine_count);
+		?>
+	</section>
 
 
 
 
 </div>
 </div>
 
 
 <div style="clear: both;"></div>
 <div style="clear: both;"></div>
 
 
-<h3 class="section">Test Details</h3>
 
 
-<div style="float: left; width: 49.5%">
+<div style="float: left; width: 49.25%">
+	<h3 class="section">Machine Test Details</h3>
+
 	<div class="subheader">
 	<div class="subheader">
 		<strong>Date &amp; Time</strong>
 		<strong>Date &amp; Time</strong>
 	</div>
 	</div>
@@ -158,152 +167,7 @@ $current_test_count = count($location->getCompletedTests(["dts_start" => $year_c
 
 
 	<div style="clear: both;"></div><br />
 	<div style="clear: both;"></div><br />
 
 
-	<div style="clear: both;"></div><br />
-
-	<div class="subheader">
-		<strong>Door Security Staff</strong>
-	</div>
-
-	<div class="bl">
-		<div class="field">Present:</div>
-		<div class="value"><?=TestPDF::getBooleanHtml($values["security_staff_present"] ?? false)?></div>
-	</div>
-
-	<div class="bl">
-		<div class="field">Asked For ID:</div>
-		<div class="value"><?=TestPDF::getBooleanHtml($values["security_staff_challenge"] ?? false)?></div>
-	</div>
-
-	<div class="bl">
-		<div class="field">Line of Sight of Bar:</div>
-		<div class="value"><?=TestPDF::getBooleanHtml($values["play_machine_line_of_sight"] ?? false)?></div>
-	</div>
-
-	<div class="subheader">
-		<strong>Staff</strong>
-	</div>
-
-	<div class="bl">
-		<div class="field">Name:</div>
-		<div class="value"><?=TestPDF::getValueHtml($test->challenger_name)?></div>
-	</div>
-
-	<div class="bl">
-		<div class="field">Gender:</div>
-		<div class="value"><?=TestPDF::getValueHtml(Util::getGenderText($test->challenger_gender))?></div>
-	</div>
-
-	<strong>Description:</strong><br />
-	<?=TestPDF::getValueHtml($test->challenger_description)?><br />
-
-	<br />
-
-	<div class="subheader">
-		<strong>Signage</strong>
-	</div>
-
-	<div class="wide-field-names">
-		<div class="bl">
-			<div class="field">Challenge 21/25:</div>
-			<div class="value"><?=TestPDF::getValueHtml($values["challenge_21_25"] ?? "")?></div>
-		</div>
-
-		<?php
-		$value = $values["citizen_card_brochure_displayed"] ?? "";
-		if(strlen($value)) $value = $value ? "Yes" : "No";
-		?>
-
-		<div class="bl">
-			<div class="field">Citizen Card Brochure Displayed:</div>
-			<div class="value"><?=TestPDF::getValueHtml($value)?></div>
-		</div>
-
-		<?php
-		$value = $values["challenge_21_poster"] ?? "";
-		if(strlen($value)) $value = $value ? "Yes" : "No";
-		?>
-
-		<div class="bl">
-			<div class="field">Challenge 21/25 Posters Displayed:</div>
-			<div class="value"><?=TestPDF::getValueHtml($value)?></div>
-		</div>
-
-		<strong>Challenge 21/25 Poster Notes:</strong><br />
-		<?=TestPDF::getValueHtml($values["challenge_21_poster_notes"] ?? "")?>
-	</div>
-
-	<br />
-
-	<?php
-	$bar_time = $values["bar_time"] ?? "";
-	$bar_staff_name = $values["bar_staff_name"] ?? "";
-	$bar_staff_gender = $values["bar_staff_gender"] ?? "";
-	$bar_staff_description = $values["bar_staff_description"] ?? "";
-	$bar_age_verification = $values["bar_age_verification"];
-
-	$alcohol_purchased = $values["alcohol_purchased"] ?? "";
-	$bar_expenditure = ($values["bar_expenditure"] ?? "") ?: 0;
-	$bar_purchase_item = ($values["bar_purchase_item"] ?? "");
-	?>
-
-	<div class="subheader">
-		<strong>Bar Details</strong>
-	</div>
-
-	<div class="wide-field-names">
-		<div class="bl">
-			<div class="field">Arrival:</div>
-			<div class="value"><?=TestPDF::getValueHtml($bar_time)?></div>
-		</div>
-		<div class="bl">
-			<div class="field">Staff Name:</div>
-			<div class="value"><?=TestPDF::getValueHtml($bar_staff_name)?></div>
-		</div>
-
-		<div class="bl">
-			<div class="field">Staff Gender:</div>
-			<div class="value"><?=TestPDF::getValueHtml($bar_staff_gender)?></div>
-		</div>
-
-		<strong>Staff Description:</strong><br />
-		<?=TestPDF::getValueHtml($bar_staff_description)?><br />
-		<br />
-
-		<div class="bl">
-			<div class="field">Staff Asked For ID:</div>
-			<div class="value"><?=TestPDF::getBooleanHtml($bar_age_verification)?></div>
-		</div>
-
-		<div class="bl">
-			<div class="field">Alcohol Purchased:</div>
-			<div class="value"><?=TestPDF::getBooleanHtml($alcohol_purchased)?></div>
-		</div>
 
 
-		<div>
-			<div class="field">Drink Purchased:</div>
-			<div class="value"><?=TestPDF::getValueHtml($bar_purchase_item)?></div>
-		</div>
-
-		<div class="bl">
-			<div class="field">Bar Spend:</div>
-			<div class="value">£<?=number_format($bar_expenditure, 2)?></div>
-		</div>
-	</div>
-
-	<?php
-	if($receipt_config) {
-		?>
-		<div class="subheader">
-			<strong>Receipt</strong>
-		</div>
-		<img src="var:bar_receipt" width="<?=$receipt_config["width"]?>" height="<?=$receipt_config["height"]?>" alt="" />
-		<?php
-	}
-	?>
-
-</div>
-
-<div style="float: right; width: 49.5%">
 	<div class="subheader">
 	<div class="subheader">
 		<strong>ID Request</strong>
 		<strong>ID Request</strong>
 	</div>
 	</div>
@@ -342,18 +206,6 @@ $current_test_count = count($location->getCompletedTests(["dts_start" => $year_c
 		</div>
 		</div>
 	</div>
 	</div>
 
 
-	<br />
-
-	<div>
-		<div style="color: green;">1: Challenge on entry</div>
-		<div style="color: green;">2: Challenge while browsing</div>
-		<div style="color: orange;">3: Challenge during play</div>
-		<div style="color: red;">4: Challenge after play</div>
-		<div style="color: red;">5: No challenge</div>
-	</div>
-
-	<br />
-
 	<div class="bl">
 	<div class="bl">
 		<div class="field">Eye Contact:</div>
 		<div class="field">Eye Contact:</div>
 		<div class="value"><?=($test->challenger_eye_contact ? "Yes" : "No")?></div>
 		<div class="value"><?=($test->challenger_eye_contact ? "Yes" : "No")?></div>
@@ -420,11 +272,156 @@ $current_test_count = count($location->getCompletedTests(["dts_start" => $year_c
 		</div>
 		</div>
 	</div>
 	</div>
 
 
+	<br />
+
+	<section>
+		<div class="subheader">
+			<strong>Staff</strong>
+		</div>
+
+		<div class="bl">
+			<div class="field">Name:</div>
+			<div class="value"><?=TestPDF::getValueHtml($test->challenger_name)?></div>
+		</div>
+
+		<div class="bl">
+			<div class="field">Gender:</div>
+			<div class="value"><?=TestPDF::getValueHtml(Util::getGenderText($test->challenger_gender))?></div>
+		</div>
+
+		<strong>Description:</strong><br />
+		<?=TestPDF::getValueHtml($test->challenger_description)?><br />
+
+		<br />
+	</section>
+
+
 </div>
 </div>
 
 
-<div class="clear"></div>
+<div style="float: right; width: 49.25%">
+
+	<h3 class="section">Alcohol Test Details</h3>
+
+	<section>
+
+		<?php
+		$bar_time = $values["bar_time"] ?? "";
+		$bar_staff_name = $values["bar_staff_name"] ?? "";
+		$bar_staff_gender = $values["bar_staff_gender"] ?? "";
+		$bar_staff_description = $values["bar_staff_description"] ?? "";
+		$bar_age_verification = $values["bar_age_verification"];
+
+		$alcohol_purchased = $values["alcohol_purchased"] ?? "";
+		$bar_expenditure = ($values["bar_expenditure"] ?? "") ?: 0;
+		$bar_purchase_item = ($values["bar_purchase_item"] ?? "");
+		?>
+
+		<div class="subheader">
+			<strong>Bar Details</strong>
+		</div>
+
+		<div class="wide-field-names">
+			<div class="bl">
+				<div class="field">Arrival:</div>
+				<div class="value"><?=TestPDF::getValueHtml($bar_time)?></div>
+			</div>
+
+			<div class="bl">
+				<div class="field">Asked For ID:</div>
+				<div class="value"><?=TestPDF::getBooleanHtml($bar_age_verification)?></div>
+			</div>
+
+			<div class="bl">
+				<div class="field">Alcohol Purchased:</div>
+				<div class="value"><?=TestPDF::getBooleanHtml($alcohol_purchased)?></div>
+			</div>
+
+			<div class="bl">
+				<div class="field">Drink Purchased:</div>
+				<div class="value"><?=TestPDF::getValueHtml($bar_purchase_item)?></div>
+			</div>
+
+			<div class="bl">
+				<div class="field">Bar Spend:</div>
+				<div class="value">£<?=number_format($bar_expenditure, 2)?></div>
+			</div>
+		</div>
+
+		<br />
+
+		<div class="subheader">
+			<strong>Staff</strong>
+		</div>
+
+		<div class="bl">
+			<div class="field">Name:</div>
+			<div class="value"><?=TestPDF::getValueHtml($bar_staff_name)?></div>
+		</div>
+
+		<div class="bl">
+			<div class="field">Gender:</div>
+			<div class="value"><?=TestPDF::getValueHtml($bar_staff_gender)?></div>
+		</div>
+
+		<strong>Description:</strong><br />
+		<?=TestPDF::getValueHtml($bar_staff_description)?><br />
+		<br />
+
+		<?php
+		if($receipt_config) {
+			?>
+			<div class="subheader">
+				<strong>Receipt</strong>
+			</div>
+			<img src="var:bar_receipt" width="<?=$receipt_config["width"]?>" height="<?=$receipt_config["height"]?>" alt="" />
+			<?php
+		}
+		?>
+	</section>
+
+	<section>
+		<h3 class="section">ID Stage Reference</h3>
+
+		<div>
+			<div style="color: green;">1: Challenge on entry</div>
+			<div style="color: green;">2: Challenge while browsing</div>
+			<div style="color: orange;">3: Challenge during play</div>
+			<div style="color: red;">4: Challenge after play</div>
+			<div style="color: red;">5: No challenge</div>
+		</div>
+
+		<br />
+	</section>
+
+
+</div>
+
+<div class="clear" style="page-break-before: always"></div>
+
+<h3 class="section">Other Test Details</h3>
+
+<section>
+	<div class="subheader">
+		<strong>Door Security Staff</strong>
+	</div>
+
+	<div class="bl">
+		<div class="field">Present:</div>
+		<div class="value"><?=TestPDF::getBooleanHtml($values["security_staff_present"] ?? false)?></div>
+	</div>
+
+	<div class="bl">
+		<div class="field">Asked For ID:</div>
+		<div class="value"><?=TestPDF::getBooleanHtml($values["security_staff_challenge"] ?? false)?></div>
+	</div>
+
+	<div class="bl">
+		<div class="field">Line of Sight of Bar:</div>
+		<div class="value"><?=TestPDF::getBooleanHtml($values["play_machine_line_of_sight"] ?? false)?></div>
+	</div>
+</section>
 
 
-<br />
+<div style="clear: both;"></div><br />
 
 
 <div>
 <div>
 	<div class="subheader">
 	<div class="subheader">