| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424 |
- <?php /** @noinspection PhpUnhandledExceptionInspection */
- /**
- * @var Template $template
- * @var Test $test
- * @var Mpdf $mpdf
- * @var array $values
- * @var string $location_text
- * @var Customer $customer
- * @var Location $location
- * @var User $tester
- * @var string $date_start
- * @var string $time_start
- * @var string $time_end
- * @var string $duration_text
- */
- use Helpers\PdfHelper;
- use Mpdf\Mpdf;
- $year_cycle_constraint = $customer->getYearCycleConstraint(TIMEZONE);
- $display_year_cycle = $customer->getDisplayYearCycle();
- $alcohol_purchased = $values["alcohol_purchased"] ?? "";
- $pass_image = $test->pass ? "pass.png" : "fail.png";
- $alcohol_pass_image = empty($alcohol_purchased) ? "pass.png" : "fail.png";
- // Bar Receipt
- $receipt_path_pattern = $test->getDirectory() . "/bar_receipt.*";
- $receipt_config = null;
- foreach(glob($receipt_path_pattern) as $receipt_path) {
- $receipt_config = PdfHelper::getImageConfig($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]));
- $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
- };
- if($test->pass) {
- ?>
- <h3 class="section">Test Result</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">Gaming Machine Test Result</h3>
- <div align="center" style="margin: auto; width: 90%;">
- <img src="/img/<?=htmlspecialchars($pass_image)?>" alt="" />
- </div>
- </div>
- <div style="float: right; width: 49.25%; position: relative;">
- <h3 class="section">Alcohol Test Result</h3>
- <div align="center" style="margin: auto; width: 90%;">
- <img src="/img/<?=htmlspecialchars($alcohol_pass_image)?>" alt="" />
- </div>
- </div>
- <br />
- <?php
- }
- ?>
- <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="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>
- <section>
- <h3 class="section">Tester</h3>
- <div class="bl">
- <div class="field">Gender:</div>
- <div class="value"><?=htmlspecialchars($tester->getGenderText())?></div>
- </div>
- <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 style="clear: both;"></div>
- <!-- Page 1 / Machine Test -->
- <div style="float: left; width: 49.25%">
- <h3 class="section">Gaming Machine Test Details</h3>
- <div class="subheader">
- <strong>Date & Time</strong>
- </div>
- <div style="float: left; width: 24%">
- <strong>Date:</strong><br />
- <?=htmlspecialchars($date_start)?>
- </div>
- <div style="float: left; width: 24%">
- <strong>Entry:</strong><br />
- <?=htmlspecialchars($time_start)?>
- </div>
- <div style="float: left; width: 24%">
- <strong>Exit:</strong><br />
- <?=htmlspecialchars($time_end)?>
- </div>
- <div style="float: left; width: 24%">
- <strong>Duration:</strong><br />
- <?=htmlspecialchars($duration_text)?>
- </div>
- <div style="clear: both;"></div><br />
- <div class="subheader">
- <strong>ID Request</strong>
- </div>
- <?php
- $pass_colour = $test->pass ? "green" : "red";
- switch($test->challenge_stage) {
- case 1:
- case 2:
- $challenge_colour = "green";
- break;
- case 3:
- $challenge_colour = "orange";
- break;
- case 4:
- case 5:
- default:
- $challenge_colour = "red";
- break;
- }
- ?>
- <div class="bl">
- <div class="field">Result:</div>
- <div class="value" style="color: <?=$pass_colour?>">
- <strong><?=htmlspecialchars($test->getPassText())?></strong>
- </div>
- </div>
- <div>
- <div class="field">ID Stage:</div>
- <div class="value" style="color: <?=$challenge_colour?>">
- <strong><?=htmlspecialchars($test->challenge_stage . " - " . $test->getChallengeStageText())?></strong>
- </div>
- </div>
- <div class="bl">
- <div class="field">Eye Contact:</div>
- <div class="value"><?=($test->challenger_eye_contact ? "Yes" : "No")?></div>
- </div>
- <div>
- <strong>Description:</strong><br />
- <?=TestPDF::getValueHtml($test->challenge_description)?>
- </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>
- <strong>Description:</strong><br />
- <?=TestPDF::getValueHtml($test->challenger_description)?><br />
- <br />
- </section>
- </div>
- <!-- Page 1 / Alcohol Test -->
- <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_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>
- <strong>Description:</strong><br />
- <?=TestPDF::getValueHtml($bar_staff_description)?><br />
- <br />
- </section>
- </div>
- <div class="clear" style="page-break-before: always"></div>
- <!-- Page 2 / Machine Test -->
- <div style="float: left; width: 49.25%">
- <div class="subheader">
- <strong>Play Details</strong>
- </div>
- <div class="wide-field-names">
- <div class="bl">
- <div class="field">Machine Played:</div>
- <div class="value"><?=TestPDF::getValueHtml($values["play_machine"] ?? "")?></div>
- </div>
- <div class="bl">
- <div class="field">Machine Position:</div>
- <div class="value"><?=TestPDF::getValueHtml($values["play_machine_position"] ?? "")?></div>
- </div>
- <?php
- $play_jackpot = $values["play_jackpot"] ?? "";
- if(!empty($play_jackpot)) {
- $play_jackpot = "£" . number_format($play_jackpot, 2);
- }
- ?>
- <div class="bl">
- <div class="field">Jackpot Value:</div>
- <div class="value"><?=TestPDF::getValueHtml($play_jackpot)?></div>
- </div>
- <?php
- $play_machine_stake = $values["play_machine_stake"] ?? "";
- if(!empty($play_machine_stake)) {
- $play_machine_stake = "£" . number_format($play_machine_stake, 2);
- }
- ?>
- <div class="bl">
- <div class="field">Stake Played:</div>
- <div class="value"><?=TestPDF::getValueHtml($play_machine_stake)?></div>
- </div>
- <div class="bl">
- <div class="field">Minutes Played:</div>
- <div class="value"><?=TestPDF::getValueHtml($values["play_minutes"] ?? "")?></div>
- </div>
- <?php
- $play_spent = $values["play_spent"] ?? "";
- if(!empty($play_spent)) $play_spent = "£" . number_format($play_spent, 2);
- ?>
- <div>
- <div class="field">Amount Spent:</div>
- <div class="value"><?=TestPDF::getValueHtml($play_spent)?></div>
- </div>
- </div>
- <section>
- <h3 class="subheader">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>
- </section>
- </div>
- <!-- Page 2 / Alcohol Test -->
- <div style="float: right; width: 49.25%">
- <?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 class="clear"></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>
- <div style="clear: both;"></div><br />
- <div>
- <div class="subheader">
- <strong>Additional Notes</strong>
- </div>
- <?=TestPDF::getValueHtml($test->additional_notes)?>
- </div>
|