test_pdf.php 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328
  1. <?php
  2. $main_y = $pdf->GetY();
  3. // Retest info
  4. if($test->retest) {
  5. $pdf->SetLeftMargin(83);
  6. $pdf->SetY(10);
  7. $pdf->Image("public/img/retest.png", 83, $pdf->GetY(), 63);
  8. }
  9. $pdf->SetLeftMargin(10);
  10. $pdf->SetY($main_y);
  11. // Header
  12. $pdf->SetTextColor(56, 87, 35);
  13. $pdf->SetFont("Arial", "B", $header_font_size);
  14. $pdf->Cell(190, 10, " Test Result", 0, 1, "L", true);
  15. // Pass/Fail
  16. $image_width = 130;
  17. if($test->pass) {
  18. $pdf->Image("public/img/pass.png", (210 - $image_width) / 2, $pdf->GetY() + 2, $image_width);
  19. }
  20. else {
  21. $pdf->Image("public/img/fail.png", (210 - $image_width) / 2, $pdf->GetY() + 2, $image_width);
  22. }
  23. $pdf->SetY($pdf->GetY() + 30);
  24. $pdf->SetTextColor(56, 87, 35);
  25. // Location / Tester Headers
  26. $pdf->SetFont("Arial", "B", $header_font_size);
  27. $tester_x = 150;
  28. $tester_y = $pdf->GetY();
  29. $pdf->Cell(135, 10, $location_text, 0, 1, "L", true);
  30. $pdf->SetY($pdf->GetY() + 2);
  31. $pdf->SetFont("Arial", "", $normal_font_size);
  32. $pdf->SetTextColor(0, 0, 0);
  33. $pdf->Line($pdf->GetX(), $pdf->GetY(), $pdf->GetX() + 135, $pdf->GetY());
  34. $pdf->Cell(30, $cell_height, "Region / Manager:", 0, 0);
  35. $pdf->SetX($pdf->GetX() + 5);
  36. $pdf->Write($cell_height, $location->region);
  37. $pdf->Write($cell_height, " / ");
  38. $pdf->Write($cell_height, $location->area_manager);
  39. $pdf->SetY($pdf->GetY() + $cell_height);
  40. $pdf->Line($pdf->GetX(), $pdf->GetY(), $pdf->GetX() + 135, $pdf->GetY());
  41. $pdf->Cell(30, $cell_height, "Address:", 0, 0);
  42. $pdf->SetX($pdf->GetX() + 5);
  43. $pdf->MultiCell(100, $cell_height, $location->getDisplayAddress(["address_1", "address_2", "city"], "\n"), 0, 1);
  44. $pdf->Line($pdf->GetX(), $pdf->GetY(), $pdf->GetX() + 135, $pdf->GetY());
  45. $pdf->Cell(30, $cell_height, "Postcode:", 0, 0);
  46. $pdf->SetX($pdf->GetX() + 5);
  47. $pdf->Cell(100, $cell_height, $location->postal_code, 0, 1);
  48. $pdf->Line($pdf->GetX(), $pdf->GetY(), $pdf->GetX() + 135, $pdf->GetY());
  49. $pdf->Cell(30, $cell_height, "Shop Name - Left:", 0, 0);
  50. $pdf->SetX($pdf->GetX() + 5);
  51. $pdf->Cell(100, $cell_height, $test->shop_left, 0, 1);
  52. $pdf->Line($pdf->GetX(), $pdf->GetY(), $pdf->GetX() + 135, $pdf->GetY());
  53. $pdf->Cell(30, $cell_height, "Shop Name - Right:", 0, 0);
  54. $pdf->SetX($pdf->GetX() + 5);
  55. $pdf->Cell(100, $cell_height, $test->shop_right, 0, 1);
  56. $pdf->Line($pdf->GetX(), $pdf->GetY(), $pdf->GetX() + 135, $pdf->GetY());
  57. $test_details_y = $pdf->GetY();
  58. // Tester Info
  59. $pdf->SetXY($tester_x, $tester_y);
  60. $pdf->SetLeftMargin(150);
  61. $pdf->SetTextColor(56, 87, 35);
  62. $pdf->SetFont("Arial", "B", $header_font_size);
  63. $pdf->Cell(50, 10, " Tester", 0, 1, "L", true);
  64. $pdf->SetY($pdf->GetY() + 2);
  65. $pdf->SetFont("Arial", "", $normal_font_size);
  66. $pdf->SetTextColor(0, 0, 0);
  67. $pdf->Line($pdf->GetX(), $pdf->GetY(), $pdf->GetX() + 50, $pdf->GetY());
  68. $pdf->Cell(20, $cell_height, "Gender:", 0, 0);
  69. $pdf->SetX($pdf->GetX() + 5);
  70. $pdf->Cell(20, $cell_height, $tester->getGenderText(), 0, 1);
  71. $pdf->Line($pdf->GetX(), $pdf->GetY(), $pdf->GetX() + 50, $pdf->GetY());
  72. $pdf->Cell(20, $cell_height, "Attire:", 0, 1);
  73. $pdf->SetX(150);
  74. $pdf->SetFont("Arial", "", $small_font_size);
  75. $pdf->MultiCell(50, 4, $test->attire, 0, 1);
  76. $pdf->Line($pdf->GetX(), $pdf->GetY(), $pdf->GetX() + 50, $pdf->GetY());
  77. // Test Details
  78. $pdf->SetLeftMargin(10);
  79. $pdf->setXY(10, $test_details_y + 5 + 2);
  80. $pdf->SetTextColor(56, 87, 35);
  81. $pdf->SetFont("Arial", "B", $header_font_size);
  82. $pdf->Cell(190, 10, " Test Details", 0, 1, "L", true);
  83. $pdf->SetY($pdf->GetY() + 2);
  84. // Date / Time
  85. $id_requests_y = $pdf->GetY();
  86. $pdf->SetFont("Arial", "B", $normal_font_size);
  87. $pdf->SetTextColor(0, 0, 0);
  88. $pdf->Cell(95, $cell_height, "Date & Time", 0, 1);
  89. $pdf->SetY($pdf->GetY() + 2);
  90. $pdf->SetFont("Arial");
  91. $pdf->Cell(23, $cell_height, "Date");
  92. $pdf->Cell(23, $cell_height, "Entry");
  93. $pdf->Cell(23, $cell_height, "Exit");
  94. $pdf->Cell(23, $cell_height, "Duration", 0, 1);
  95. $pdf->SetFont("Arial", "", $small_font_size);
  96. $pdf->Cell(23, $cell_height, $date_start);
  97. $pdf->Cell(23, $cell_height, $time_start);
  98. $pdf->Cell(23, $cell_height, $time_end);
  99. $pdf->Cell(23, $cell_height, str_pad($diff->h, 2, "0", STR_PAD_LEFT) . ":" . str_pad($diff->i, 2, "0", STR_PAD_LEFT) . ":" . str_pad($diff->s, 2, "0", STR_PAD_LEFT), 0, 1);
  100. $pdf->SetY($pdf->GetY() + 2);
  101. // Staff
  102. $pdf->SetFont("Arial", "B", $normal_font_size);
  103. $pdf->Cell(95, $cell_height, "Staff", 0, 1);
  104. $pdf->SetY($pdf->GetY() + 2);
  105. $pdf->SetFont("Arial");
  106. $pdf->Line($pdf->GetX(), $pdf->GetY(), $pdf->GetX() + 92.5, $pdf->GetY());
  107. $pdf->Cell(30, $cell_height, "Name:", 0, 0);
  108. $pdf->SetX($pdf->GetX() + 5);
  109. $pdf->Cell(57.5, $cell_height, $test->challenger_name, 0, 1);
  110. $pdf->Line($pdf->GetX(), $pdf->GetY(), $pdf->GetX() + 92.5, $pdf->GetY());
  111. $pdf->Cell(30, $cell_height, "Gender:", 0, 0);
  112. $pdf->SetX($pdf->GetX() + 5);
  113. $pdf->Cell(57.5, $cell_height, $test->challenger_gender, 0, 1);
  114. $pdf->Line($pdf->GetX(), $pdf->GetY(), $pdf->GetX() + 92.5, $pdf->GetY());
  115. $pdf->Cell(30, $cell_height, "Description:", 0, 1);
  116. $pdf->SetFont("Arial", "", $small_font_size);
  117. $pdf->MultiCell(90, 4, $test->challenger_description, 0, 1);
  118. $pdf->Line($pdf->GetX(), $pdf->GetY(), $pdf->GetX() + 92.5, $pdf->GetY());
  119. $pdf->SetY($pdf->GetY() + 2);
  120. $pdf->SetFont("Arial", "B", $normal_font_size);
  121. $pdf->Cell(95, $cell_height, "Tester's Notes", 0, 1);
  122. $pdf->SetY($pdf->GetY() + 2);
  123. $pdf->SetFont("Arial");
  124. $pdf->SetFont("Arial", "", $small_font_size);
  125. $pdf->MultiCell(90, 4, Util::convertUTF8($test->additional_notes), 0, 1);
  126. $pdf->SetY($pdf->GetY() + 2);
  127. // Challenge
  128. $pdf->SetLeftMargin(107.5);
  129. $pdf->SetY($id_requests_y);
  130. $pdf->SetFont("Arial", "B", $normal_font_size);
  131. $pdf->Cell(95, $cell_height, "ID Request", 0, 1);
  132. $pdf->SetY($pdf->GetY() + 2);
  133. $pdf->SetFont("Arial");
  134. $pdf->Line($pdf->GetX(), $pdf->GetY(), $pdf->GetX() + 92.5, $pdf->GetY());
  135. $pdf->Cell(30, $cell_height, "Result:", 0, 0);
  136. $pdf->SetX($pdf->GetX() + 5);
  137. $pdf->Cell(60, $cell_height, $test->getPassText(), 0, 1);
  138. $pdf->Line($pdf->GetX(), $pdf->GetY(), $pdf->GetX() + 92.5, $pdf->GetY());
  139. $pdf->Cell(30, $cell_height, "ID Stage:", 0, 0);
  140. $pdf->SetX($pdf->GetX() + 5);
  141. $pdf->Cell(60, $cell_height, $test->challenge_stage . " - " . $test->getChallengeStageText(), 0, 1);
  142. $pdf->Line($pdf->GetX(), $pdf->GetY(), $pdf->GetX() + 92.5, $pdf->GetY());
  143. $pdf->SetY($pdf->GetY() + 2);
  144. $pdf->SetFont("Arial", "", $small_font_size);
  145. $pdf->SetTextColor(0, 128, 0);
  146. $pdf->MultiCell(95, 4, "1: Challenge on entry", 0, 1);
  147. $pdf->SetTextColor(255, 128, 0);
  148. $pdf->MultiCell(95, 4, "2: Challenge while browsing
  149. 3: Challenge during play", 0, 1);
  150. $pdf->SetTextColor(255, 0, 0);
  151. $pdf->MultiCell(95, 4, "4: Challenge on exit
  152. 5: No challenge", 0, 1);
  153. $pdf->SetFont("Arial", "", $normal_font_size);
  154. $pdf->SetTextColor(0, 0, 0);
  155. $pdf->SetY($pdf->GetY() + 2);
  156. $pdf->SetFont("Arial", "", $normal_font_size);
  157. $pdf->Line($pdf->GetX(), $pdf->GetY(), $pdf->GetX() + 92.5, $pdf->GetY());
  158. $pdf->Cell(30, $cell_height, "Eye Contact:", 0, 0);
  159. $pdf->SetX($pdf->GetX() + 5);
  160. $pdf->Cell(60, $cell_height, $test->challenger_eye_contact ? "Y" : "N", 0, 1);
  161. $pdf->Line($pdf->GetX(), $pdf->GetY(), $pdf->GetX() + 92.5, $pdf->GetY());
  162. $pdf->Cell(95, $cell_height, "Description:", 0, 1);
  163. $pdf->SetFont("Arial", "", $small_font_size);
  164. $pdf->MultiCell(90, 4, $test->challenge_description, 0, 1);
  165. $pdf->Line($pdf->GetX(), $pdf->GetY(), $pdf->GetX() + 92.5, $pdf->GetY());
  166. $pdf->SetY($pdf->GetY() + 2);
  167. // Details / Signage
  168. $pdf->SetFont("Arial", "B", $normal_font_size);
  169. $pdf->Cell(95, $cell_height, "Play Details & Signage", 0, 1);
  170. $pdf->SetY($pdf->GetY() + 2);
  171. $pdf->SetFont("Arial");
  172. $field_width = 50;
  173. $value_width = 40;
  174. $pdf->Line($pdf->GetX(), $pdf->GetY(), $pdf->GetX() + 92.5, $pdf->GetY());
  175. $pdf->Cell($field_width, $cell_height, "Machine Played:", 0, 0);
  176. $pdf->SetX($pdf->GetX() + 5);
  177. $pdf->Cell($value_width, $cell_height, $values["play_machine"] ?? "N/A", 0, 1);
  178. $pdf->Line($pdf->GetX(), $pdf->GetY(), $pdf->GetX() + 92.5, $pdf->GetY());
  179. $value = $values["play_jackpot"] ?? "N/A";
  180. if($value != "N/A") $value = "\xa3" . number_format($value);
  181. $pdf->Cell($field_width, $cell_height, "Jackpot Value:", 0, 0);
  182. $pdf->SetX($pdf->GetX() + 5);
  183. $pdf->Cell($value_width, $cell_height, $value, 0, 1);
  184. $pdf->Line($pdf->GetX(), $pdf->GetY(), $pdf->GetX() + 92.5, $pdf->GetY());
  185. $value = $values["play_machine_stake"] ?? "N/A";
  186. if($value != "N/A") $value = "\xa3" . number_format($value, 2);
  187. $pdf->Cell($field_width, $cell_height, "Stake Played:", 0, 0);
  188. $pdf->SetX($pdf->GetX() + 5);
  189. $pdf->Cell($value_width, $cell_height, $value, 0, 1);
  190. $pdf->Line($pdf->GetX(), $pdf->GetY(), $pdf->GetX() + 92.5, $pdf->GetY());
  191. $pdf->Cell($field_width, $cell_height, "Minutes Played:", 0, 0);
  192. $pdf->SetX($pdf->GetX() + 5);
  193. $pdf->Cell($value_width, $cell_height, $values["play_minutes"] ?? "N/A", 0, 1);
  194. $pdf->Line($pdf->GetX(), $pdf->GetY(), $pdf->GetX() + 92.5, $pdf->GetY());
  195. $value = $values["play_spent"] ?? "N/A";
  196. if($value != "N/A") $value = "\xa3" . number_format($value, 2);
  197. $pdf->Cell($field_width, $cell_height, "Amount Spent:", 0, 0);
  198. $pdf->SetX($pdf->GetX() + 5);
  199. $pdf->Cell($value_width, $cell_height, $value, 0, 1);
  200. $pdf->Line($pdf->GetX(), $pdf->GetY(), $pdf->GetX() + 92.5, $pdf->GetY());
  201. $pdf->Cell($field_width, $cell_height, "Think 21/25:", 0, 0);
  202. $pdf->SetX($pdf->GetX() + 5);
  203. $pdf->Cell($value_width, $cell_height, $values["think_21_25"] ?? "N/A", 0, 1);
  204. $pdf->Line($pdf->GetX(), $pdf->GetY(), $pdf->GetX() + 92.5, $pdf->GetY());
  205. $value = $values["citizen_card_brochure_displayed"] ?? "";
  206. if(strlen($value) > 0) $value = $value ? "Yes" : "No";
  207. $pdf->Cell($field_width, $cell_height, "Citizen Card Brochure Displayed:", 0, 0);
  208. $pdf->SetX($pdf->GetX() + 5);
  209. $pdf->Cell($value_width, $cell_height, $value ?? "N/A", 0, 1);
  210. $pdf->Line($pdf->GetX(), $pdf->GetY(), $pdf->GetX() + 92.5, $pdf->GetY());
  211. $value = $values["think_21_badge"] ?? "";
  212. if(strlen($value) > 0) $value = $value ? "Yes" : "No";
  213. $pdf->Cell($field_width, $cell_height, "Think 21/25 Badge Worn by Staff:", 0, 0);
  214. $pdf->SetX($pdf->GetX() + 5);
  215. $pdf->Cell($value_width, $cell_height, $value ?? "N/A", 0, 1);
  216. $pdf->Line($pdf->GetX(), $pdf->GetY(), $pdf->GetX() + 92.5, $pdf->GetY());
  217. $value = $values["think_21_poster"] ?? "";
  218. if(strlen($value) > 0) $value = $value ? "Yes" : "No";
  219. $pdf->Cell($field_width, $cell_height, "Think 21/25 Posters Displayed:", 0, 0);
  220. $pdf->SetX($pdf->GetX() + 5);
  221. $pdf->Cell($value_width, $cell_height, $value ?? "N/A", 0, 1);
  222. $pdf->Line($pdf->GetX(), $pdf->GetY(), $pdf->GetX() + 92.5, $pdf->GetY());
  223. $pdf->Cell($field_width, $cell_height, "Think 21/25 Poster Notes:", 0, 1);
  224. $pdf->SetFont("Arial", "", $small_font_size);
  225. $pdf->MultiCell(95, 4, $values["think_21_poster_notes"] ?? "N/A", 0, 1);
  226. $pdf->Line($pdf->GetX(), $pdf->GetY(), $pdf->GetX() + 92.5, $pdf->GetY());
  227. // Footer
  228. $pdf->SetLeftMargin(10);
  229. $pdf->SetY(265);
  230. $pdf->SetFillColor(0, 146, 69);
  231. $pdf->Rect($pdf->GetX(), $pdf->GetY(), 190, 1, "DF");
  232. $pdf->SetY($pdf->GetY() + 6);
  233. $pdf->SetFont("Arial", "B", $normal_font_size);
  234. $pdf->Cell(0, $cell_height, "Check Policy Limited");
  235. $pdf->SetY($pdf->GetY() + $cell_height);
  236. $pdf->SetFont("Arial", "", $normal_font_size);
  237. $pdf->Cell(0, $cell_height, "8 Market Street, Liskeard, Cornwall, PL14 3JJ");
  238. $pdf->SetY($pdf->GetY() + $cell_height);
  239. $pdf->Cell(0, $cell_height, "Company Number: 09506865");
  240. ?>