initial commit
[namibia] / module / Stock / src / Stock / Pdf / Tuhpi.php
1 <?php
2 namespace Stock\Pdf;
3
4
5
6 class Tuhpi extends \Utility\Service\PdfTemplate
7 {
8
9
10         /**
11          * PDF title.
12          * @var string
13          */
14         protected $_title = 'HPI Report';
15         /**
16          * @var \Stock\Entity\Stock
17          */
18         protected $jobRecord;
19         /**
20          * @var boolean
21          */
22         protected $showCustomerDetails = false;
23         /**
24          * @var boolean
25          */
26         protected $showValuationDetails = false;
27         /**
28          * @var boolean
29          */
30         protected $showPricingDetails = false;
31         /**
32          * @var boolean
33          */
34         protected $showVehicleDetails = false;
35         /**
36          * @var boolean
37          */
38         protected $showVehicleNotes = false;
39         /**
40          * @var boolean
41          */
42         protected $showDamageDetails = false;
43         /**
44          * @var boolean
45          */
46         protected $showAccessoryDetails = false;
47         /**
48          * @var boolean
49          */
50         protected $showSignatureLines = false;
51         /**
52          * @var boolean
53          */
54         protected $showTermsAndConditions = false;
55         /**
56          * @var boolean
57          */
58         protected $showOffersReceived = false;
59         /**
60          * @var boolean
61          */
62         protected $showOfferMade = false;
63
64
65         /**
66          * Utility for easy parameter retrieval.
67          * @param string $param
68          * @param unknown $default
69          * @return unknown
70          */
71         protected function getStockParam($param, $default)
72         {
73                 return !is_null($this->jobRecord->$param)
74                         ? $this->jobRecord->$param
75                         : $default;
76         }
77
78         /**
79          * Utility for easy parameter retrieval.
80          * @param string $param
81          * @param unknown $default
82          * @return unknown
83          */
84         protected function getStockSubParam($ref, $param, $default)
85         {
86                 $ref = !is_null($this->jobRecord->$ref)
87                         ? $this->jobRecord->$ref
88                         : null;
89                 return is_object($ref)
90                         ? $ref->$param
91                         : $default;
92         }
93
94         /**
95          * Utility for easy parameter retrieval.
96          * @param string $param
97          * @param unknown $default
98          * @return unknown
99          */
100         protected function getValuationParam($param, $default)
101         {
102                 return !is_null($this->jobRecord->valuation)
103                                 && !is_null($this->jobRecord->valuation->$param)
104                         ? $this->jobRecord->valuation->$param
105                         : $default;
106         }
107
108
109         /**
110          * Build the content.
111          */
112         public function build()
113         {
114                 #-> Set data item to work with.
115                 $authData = \Utility\Registry::getAuthData();
116                 $this->jobRecord = $this->_input['jobRecord'];
117
118         $recordId = $this->_input['contract']->PdfTemplate['recordId'];
119
120         if(!empty($recordId) && '' != $recordId)
121         {
122             $result = $this->em->createQuery(
123                 'SELECT tuhpi '
124                 . 'FROM \Stock\Entity\Tuhpi tuhpi '
125                 . 'JOIN tuhpi.stock stock '
126                 . 'WHERE tuhpi.id = :id '
127                 . 'ORDER BY tuhpi.created ASC '
128             )
129                 ->setParameter( 'id' , $recordId );
130         }
131         else
132         {
133             $result = $this->em->createQuery(
134                 'SELECT tuhpi '
135                 . 'FROM \Stock\Entity\Tuhpi tuhpi '
136                 . 'JOIN tuhpi.stock stock '
137                 . 'WHERE stock.id = :stockId '
138                 . ' AND IDENTITY(tuhpi.company) = :companyId '
139                 . 'ORDER BY tuhpi.created ASC '
140             )
141                 ->setParameter( 'stockId' , $this->jobRecord->id )
142                 ->setParameter( 'companyId' , $authData['company']['id'] );
143         }
144
145 //              $result = $this->em->createQuery(
146 //                              'SELECT tuhpi '
147 //                              . 'FROM \Stock\Entity\Tuhpi tuhpi '
148 //                              . 'JOIN tuhpi.stock stock '
149 //                              . 'WHERE stock.id = :stockId '
150 //                              . ' AND IDENTITY(tuhpi.company) = :companyId '
151 //                              . 'ORDER BY tuhpi.created ASC '
152 //                      )
153 //                      ->setParameter( 'stockId' , $this->jobRecord->id )
154 //                      ->setParameter( 'companyId' , $authData['company']['id'] )
155 //                      ->getResult();
156
157         $result = $result->getResult();
158
159                 foreach ($result as $data)
160                 {
161                         $companyProfileOffice = $data->company->contact->office;
162                         $companyProfilefax = $data->company->contact->fax;
163                         $companyRegion = $data->company->region->name;
164                         $companyCity = $data->company->city->name;
165                         $companyPostalCode = $data->company->postalCode;
166                         $companyStreet = $data->company->street;
167                         $companyDealerType = $data->company->dealerType;
168                         $companyClientType = $data->company->clientType;
169                         $companyCompanyRegistrationNumber = $data->company->companyRegistrationNumber;
170                         $companyBusinessName = $data->company->businessName;
171
172
173                         $f_financeProvider = $data->f_financeProvider;
174                         $f_financeBranch = $data->f_financeBranch;
175                         $f_agreementOrAccountNumber = $data->f_agreementOrAccountNumber;
176                         $f_agreementType = $data->f_agreementType;
177                         $f_telephoneNumber = $data->f_telephoneNumber;
178                         $f_resultCode = $data->f_resultCode;
179
180
181                         $fh_data = unserialize($data->fh_data);
182
183                         $ah_data = unserialize($data->ah_data);
184
185                         $si_policeStation = $data->si_policeStation;
186                         $si_caseNumber = $data->si_caseNumber;
187                         $si_dateStolen = $data->si_dateStolen;
188                         $si_vinMatch = $data->si_vinMatch;
189                         $si_engineMatch = $data->si_engineMatch;
190                         $si_registrationMatch = $data->si_registrationMatch;
191                         $si_resultCode = $data->si_resultCode;
192
193                         $ai_company = $data->ai_company;
194                         $ai_referenceNumber = $data->ai_referenceNumber;
195                         $ai_alertReason = $data->ai_alertReason;
196                         $ai_telephoneNumber = $data->ai_telephoneNumber;
197                         $ai_resultCode = $data->ai_resultCode;
198
199                         $ivid_responseCode = $data->ivid_responseCode;
200                         $ivid_responseDescription = $data->ivid_responseDescription;
201                         $ivid_referenceNumber = $data->ivid_referenceNumber;
202                         $ivid_contactNumber = $data->ivid_contactNumber;
203                         $ivid_resultCode = $data->ivid_resultCode;
204
205
206                         $mi_company = $data->mi_company;
207                         $mi_referenceNumber = $data->mi_referenceNumber;
208                         $mi_contactNumber = $data->mi_contactNumber;
209                         $mi_dateApplied = $data->mi_dateApplied;
210                         $mi_resultCode = $data->mi_resultCode;
211
212
213                         $vesa_certificateNumber = $data->vesa_CertificateNumber;
214                         $vesa_dateFitted = $data->vesa_dateFitted;
215                         $vesa_brandName = $data->vesa_brandName;
216                         $vesa_brandModel = $data->vesa_brandModel;
217                         $vesa_deviceDescriptionType = $data->vesa_deviceDescriptionType;
218                         $vesa_resultCode = $data->vesa_resultCode;
219
220
221                         $rh_data = unserialize($data->rh_data);
222
223
224                         $eh_data = unserialize($data->eh_data);
225
226
227                         $mh_data = unserialize($data->mh_data);
228
229
230                         $vc_month = $data->vc_month;
231                         $vc_year = $data->vc_year;
232                         $vc_newOptionCode = $data->vc_newOptionCode;
233                         $vc_usedOptionCode = $data->vc_usedOptionCode;
234                         $vc_maximumRange = $data->vc_maximumRange;
235                         $vc_minimunRange = $data->vc_minimunRange;
236                         $vc_newPrice = $data->vc_newPrice;
237                         $vc_retailPrice = $data->vc_retailPrice;
238                         $vc_tradePrice = $data->vc_tradePrice;
239                         $vc_resultCode = $data->vc_resultCode;
240
241                         $vvi_guideMonth = $data->vvi_guideMonth;
242                         $vvi_guideYear = $data->vvi_guideYear;
243                         $vvi_newListPrice = $data->vvi_newListPrice;
244                         $vvi_retailPrice = $data->vvi_retailPrice;
245                         $vvi_tradePrice = $data->vvi_tradePrice;
246                         $vvi_costPrice = $data->vvi_costPrice;
247                         $vvi_adjustedRetailPrice_mileageAndCondition = $data->vvi_adjustedRetailPrice_mileageAndCondition;
248                         $vvi_AdjustedTradePrice_MileageAndCondition = $data->vvi_AdjustedTradePrice_MileageAndCondition;
249                         $vvi_adjustedRetailPrice = $data->vvi_adjustedRetailPrice;
250                         $vvi_adjustedTradePrice = $data->vvi_adjustedTradePrice;
251                         $vvi_estimatedRetailPrice = $data->vvi_estimatedRetailPrice;
252                         $vvi_estimatedTradePrice = $data->vvi_estimatedTradePrice;
253                         $vvi_estimatedCostPrice = $data->vvi_estimatedCostPrice ;
254                         $vvi_adjustedEstimatedRetailPrice_mileageAndCondition = $data->vvi_adjustedEstimatedRetailPrice_mileageAndCondition = 0;
255                         $vvi_adjustedEstimatedTradePrice_mileageAndCondition = $data->vvi_adjustedEstimatedTradePrice_mileageAndCondition = 0;
256                         $vvi_adjustedEstimatedCostPrice_mileageAndCondition = $data->vvi_adjustedEstimatedCostPrice_mileageAndCondition = 0;
257                         $vvi_adjustedEstimatedRetailPrice = $data->vvi_adjustedEstimatedRetailPrice;
258                         $vvi_adjustedEstimatedTradePrice = $data->vvi_adjustedEstimatedTradePrice;
259                         $vvi_adjustedEstimatedCostPrice = $data->vvi_adjustedEstimatedCostPrice;
260                         $vvi_resultCode = $data->vvi_resultCode;
261
262                         $error_code = $data->error_code;
263
264                 }
265
266                 $dateTimeFormat = \Utility\Definitions\Locale::getDateTimeFormat();
267                 $currencyPrefix = \Utility\Definitions\Locale::getCurrencyPrefix();
268                 $authData = \Utility\Registry::getAuthData();
269                 $msg = 'NO RECORD FOUND ON OUR DATABASE';
270
271                 //\Utility\Debug::errorLog('$authData', $authData['']);
272
273                 $test = '* Year of Manufacturer - The year of manufacture and the year of first registration normally coincides. If not, the difference is caused by vehicles being
274                                 manufactured/imported late in one year but being sold and first registered as new in a later year.
275                                 TransUnion HPI is a registered financial services provider (22938).
276                                 _______________________________________________________________________________________________________________________
277                                 Please check this confirmation carefully to ensure that you enquired on the correct VIN/Engine number. Should you have any queries, please contact
278                                 Customer Services at: (0861) 507 507
279                                 Report Date: 2014/08/15  11:22 AM ';
280
281                 $dateOfPrint = 'Date of print HPI: <span style="color:#333;">' . date('Y-m-d H:i:s') . '</span>';
282                 $printedBy   = 'Printed by HPI: <span style="color:#333;">' . $authData['firstName']
283                                          . ' ' . $authData['familyName'] . '</span>';
284                 $referenceNo = 'Reference no.: <span style="color:#333;">' . $this->jobRecord->referenceNumber . '</span>';
285
286
287                 $this->_logo = '
288                                 <h1 style="font-size:20px; margin:0 auto; text-align:center">TRANSUNION REPORT</h1>
289                                 <div style="width:100%"></div>
290
291                                 <div style="display:block; width:115px; height:82px; margin-left:640px; margin-top:-40px; " >
292                                         <img  style="" width="115px" height="82px" src="' . __DIR__ . '/../../../../../public/img/app/logos/tuhpi.jpg" style="padding:0;margin:0;width:100%;" />
293                                 </div>
294                                 ';
295
296                 /* --------------------------------- USER, TransUnion --------------------------------- */
297
298
299
300                 $type = $this->jobRecord->type;
301                 $intro ='
302                         <table style="width:100%; margin-top:-20px;">
303                                 <tr>Adobe Acrobat 11 Pro
304                                     <td style="width:180px; font-weight:bold;">FOR ATTENTION : </td>
305                                     <td style="padding-left:20px; font-weight: normal;"></td>
306                                     <td style="width:150px;"></td>
307                                         <td style="width:220px; font-weight:bold;"></td>
308
309                                 </tr>
310                                 <tr>
311                                     <td style="width:180px; font-weight:bold;">' . $companyBusinessName . '</td>
312                                     <td style="padding-left:20px; font-weight: normal;"> </td>
313                                     <td style="width:150px;"></td>
314                                         <td style="width:220px; font-weight:bold;">TransUnion</td>
315
316                                 </tr>
317                                 <tr>
318                                     <td style="width:180px; font-weight: normal;">User : ' . $authData['firstName']. ' ' . $authData['familyName'] . '</td>
319                                     <td style="padding-left:20px; font-weight: normal;"></td>
320                                     <td style="width:150px;"></td>
321                                         <td style="width:220px; font-weight: normal;">Reg. No. 94/04014/07</td>
322
323                                 </tr>
324                                 <tr>
325                                     <td style="width:180px; font-weight: normal;">' . $companyStreet . '</td>
326                                     <td style="padding-left:20px; font-weight: normal;"> </td>
327                                     <td style="width:150px;"></td>
328                                         <td style="width:220px; font-weight: normal;">P.O. Box 1240 </td>
329
330                                 </tr>
331                                 <tr>
332                                     <td style="width:180px; font-weight: normal;"></td>
333                                     <td style="padding-left:20px; font-weight: normal;"></td>
334                                     <td style="width:150px;"></td>
335                                         <td style="width:220px; font-weight: normal;">Randburg</td>
336
337                                 </tr>
338                                 <tr>
339                                     <td style="width:180px; font-weight: normal;">' . $companyRegion . '</td>
340                                     <td style="padding-left:20px; font-weight: normal;"></td>
341                                     <td style="width:150px;"></td>
342                                         <td style="width:220px; font-weight: normal;">2125</td>
343
344                                 </tr>
345                                 <tr>
346                                     <td style="width:180px; font-weight: normal;">' . $companyCity . '</td>
347                                     <td style="padding-left:20px; font-weight: normal;"></td>
348                                     <td style="width:150px;"></td>
349                                         <td style="width:220px; font-weight: normal;"></td>
350
351                                 </tr>
352                                 <tr>
353                                     <td style="width:180px; font-weight: normal;">' . $companyPostalCode . '</td>
354                                     <td style="padding-left:20px; font-weight: normal;"></td>
355                                     <td style="width:150px;"></td>
356                                         <td style="width:220px; font-weight: normal;"> </td>
357
358                                 </tr>
359                                 <tr>
360                                     <td style="width:180px; font-weight: normal;">Tel: ' . $companyProfileOffice . '</td>
361                                     <td style="padding-left:20px; font-weight: normal;"></td>
362                                     <td style="width:150px;"></td>
363                                         <td style="width:220px; font-weight: normal;">Tel: (0861) 504 504 </td>
364
365                                 </tr>
366                                 <tr>
367                                     <td style="width:180px; font-weight: normal;">Fax:' . $companyProfilefax . '</td>
368                                     <td style="padding-left:20px; font-weight: normal;"></td>
369                                     <td style="width:150px;"></td>
370                                         <td style="width:220px; font-weight: normal;">Fax: (0861) 506 506 </td>
371
372                                 </tr>
373                                 <tr>
374                                     <td style="width:180px; font-weight: bold;">Client Reference No.: </td>
375                                     <td style="padding-left:20px; font-weight: normal;"></td>
376                                     <td style="width:150px;"></td>
377                                         <td style="width:220px; font-weight: bold;">Reference No.: ' . $this->jobRecord->referenceNumber . ' </td>
378
379                                 </tr>
380                                 <tr>
381                                     <td style="width:180px; font-weight: normal;"></td>
382                                     <td style="padding-left:20px; font-weight: normal;"></td>
383                                     <td style="width:150px;"></td>
384                                         <td style="width:220px; font-weight: normal;"><span style="font-weight: normal;"><strong>Date of Enquiry :</strong>    ' . date('Y-m-d H:i:s') . '</span>  </td>
385
386                                   </tr>
387                 </table>
388                 <br />
389
390                 <span style="font-size: 10px; font-weight: normal; width:100%; float:left;"> Thank you for your enquiry. The information you have submitted has been checked against our records, the result of the search is displayed below. </span>
391                 <br /><br />
392
393                 <div style="text-align:center; width:100%; "><h2 style="font-size:16px;">TransUnion Vehicle Enquiry</h2></div>
394                 ';
395                 $this->append($intro);
396                 /* $container = $this
397                 ->newTable(
398                                 array(30, 5, 30, 5, 30),
399                                 'margin:0;font-size:10px;vertical-align:top;',
400                                 '',
401                                 'padding:10px 0 0 0;'
402                 )
403                 ->setCellValue(0, 0, $intro);
404
405                 $this->append($container->publish()); */
406
407
408                 /* --------------------------------- INFORMATION SUPPLIED /  INFORMATION VERIFIED --------------------------------- */
409
410                 $vehicleInfo ='
411                         <table style="width:100%">
412                                         <tr style="padding:10px;">
413                                             <td style="width:380px; font-weight: bold; background: #d3d3d3; border-color:#000; padding:5px; padding-right:0px; border-top:1px solid #333; border-left: 1px solid #333; border-bottom:2px solid #333; border-right:1px solid #333">
414                                                         INFORMATION SUPPLIED
415                                                 </td>
416                                                 <td style="width:330px; font-weight: bold;  background: #d3d3d3;border-color:#000;border-left: 0px solid #000;padding:5px; border-top:1px solid #333; border-right: 1px solid #333; border-bottom:2px solid #333 ">
417                                                         INFORMATION VERIFIED
418                                                 </td>
419                                         </tr>
420
421                         </table>
422
423                         <table style="width:100%">
424                                 <tr>
425                                     <td style="width:150px; font-weight: bold;">Manufacturer : </td>
426                                     <td style="width:100px; padding-left:20px; font-weight: normal;">' . $type->model->make->name . '</td>
427                                     <td style="width:100px;"></td>
428                                         <td style="width:200px; font-weight: normal;">' . $data->vci_matchManufacturer . '&nbsp;</td>
429
430                                 </tr>
431                                 <tr>
432                                     <td style="width:150px; font-weight: bold;">Model Description: </td>
433                                     <td style="width:120px; padding-left:20px; font-weight: normal;">' . $type->name . '</td>
434                                     <td style="width:100px;"></td>
435                                         <td style="width:160px; font-weight: normal;">' . $data->vci_matchModel . '&nbsp;</td>
436
437                                 </tr>
438                                 <tr>
439                                     <td style="width:150px; font-weight: bold;">VIN or Chassis No. :</td>
440                                     <td style="width:100px; padding-left:20px; font-weight: normal;">' . $this->getStockParam('vinNumber', '') . '</td>
441                                     <td style="width:100px;"></td>
442                                         <td style="width:180px; font-weight: normal;">' . $data->vci_matchVinorChassis . '&nbsp;</td>
443
444                                 </tr>
445                                 <tr>
446                                     <td style="width:150px; font-weight: bold;">Engine No. : </td>
447                                     <td style="width:100px; padding-left:20px; font-weight: normal;">' . $this->getStockParam('engineNumber', '') . '</td>
448                                     <td style="width:100px;"></td>
449                                         <td style="width:180px; font-weight: normal;">' . $data->vci_matchEngineNumber . '&nbsp;</td>
450
451                                 </tr>
452                                 <tr>
453                                     <td style="width:150px; font-weight: bold;">Registration No. :</td>
454                                     <td style="width:100px; padding-left:20px; font-weight: normal;">' . $this->getStockParam('registrationNumber', '') . '</td>
455                                     <td style="width:100px;"></td>
456                                         <td style="width:180px; font-weight: normal;">' . $data->vci_matchVehicleRegistration . '&nbsp;</td>
457
458                                 </tr>
459                                 <tr>
460                                     <td style="width:150px; font-weight: bold;">Colour :</td>
461                                     <td style="width:100px; padding-left:20px; font-weight: normal;">' . $this->getStockSubParam('exteriorColour', 'name', '') . '</td>
462                                     <td style="width:100px;"></td>
463                                         <td style="width:180px; font-weight: normal;">' . $data->vci_matchColour . '&nbsp;</td>
464
465                                 </tr>
466                                 <tr>
467                                     <td style="width:150px; font-weight: bold;">Year of Manufacture :</td>
468                                     <td style="width:100px; padding-left:20px; font-weight: normal;">' . $this->getStockSubParam('vehicleYear', 'name', '') . '</td>
469                                     <td style="width:100px;"></td>
470                                         <td style="width:180px; font-weight: normal;">' . $data->vci_matchYear . '&nbsp;</td>
471
472                                 </tr>
473
474                 </table>
475                 <br />
476
477                 <div style="text-align:center; margin:0 auto; width:100%; color:#860406 "><h2 style="font-size:16px;">' . $data->vci_matchString . '&nbsp;</h2></div>
478                 <br />
479
480             <table style="width:100%">
481                                 <tr style="padding:10px;">
482                                             <td style="width:730px; font-weight: bold; background: #d3d3d3; border-color:#000; padding:5px; padding-right:0px; border-top:1px solid #333; border-left: 1px solid #333; border-bottom:2px solid #333; border-right:1px solid #333;">
483                                                         ADDITIONAL INFORMATION REGISTERED
484                                                 </td>
485                                 </tr>
486                 </table>
487                 ';
488                 $this->append($vehicleInfo);
489
490
491
492                 /* --------------------------------- FINANCE INTEREST --------------------------------- */
493
494
495
496                 $financeIntrest ='
497                                 <div style="text-align:center; margin:0 auto; width:100%; color:#000; text-decoration:underline; ">
498                                         <h2 style="font-size:12px; font-weight:bold;">FINANCE INTEREST</h2>
499                                 </div>
500
501                         <table style="width:100%">
502                                 <tr>
503                                     <td style="width:250px; font-weight: bold;">Finance Provider : </td>
504                                     <td style="width:100px;"></td>
505                                         <td style="width:200px; font-weight: normal;">' . $f_financeProvider . '</td>
506
507                                 </tr>
508                                 <tr>
509                                     <td style="width:250px; font-weight: bold;">Finance Branch : </td>
510                                    <td style="width:100px;"></td>
511                                         <td style="width:200px; font-weight: normal;">' . $f_financeBranch . '</td>
512
513                                 </tr>
514
515                                 <tr>
516                                     <td style="width:250px; font-weight: bold;">Agreement Or Account Number:</td>
517                                     <td style="width:100px;"></td>
518                                         <td style="width:200px; font-weight: normal;">' . $f_agreementOrAccountNumber . '</td>
519
520                                 </tr>
521                                 <tr>
522                                     <td style="width:250px; font-weight: bold;">Agreement Type: </td>
523                                     <td style="width:100px;"></td>
524                                         <td style="width:200px; font-weight: normal;">' . $f_agreementType . '</td>
525
526                                 </tr>
527                                 <tr>
528                                     <td style="width:250px; font-weight: bold;">Telephone Number:</td>
529                                     <td style="width:100px;"></td>
530                                         <td style="width:200px; font-weight: normal;">' . $f_telephoneNumber . '</td>
531
532                                 </tr>
533                                 <tr>
534                                     <td style="width:250px; font-weight: bold;">Result Code:</td>
535                                     <td style="width:100px;"></td>
536                                         <td style="width:200px; font-weight: normal;">' . $f_resultCode . '</td>
537
538                                 </tr>
539
540                         </table>
541                 <br />
542                 ';
543
544
545                 if ($f_financeProvider == '' || $f_financeBranch == '' || $f_agreementOrAccountNumber == '' || $f_agreementType == '' || $f_telephoneNumber == '')
546                 {
547                         $msgHeading = '<div style="text-align:center; margin:0 auto; width:100%; color:#000; text-decoration:underline; ">
548                                         <h2 style="font-size:12px; font-weight:bold;">FINANCE INTEREST</h2>
549                                 </div>';
550                         $this->append($msgHeading);
551                         $this->append($msg . '<br /><br />');
552                 }
553                 else
554                 {
555                         $this->append($financeIntrest);
556                 }
557                 //$this->_page++;
558
559                 /* --------------------------------- FINANCE HISTORY INTEREST --------------------------------- */
560                 $financeHistoryIntrest = '
561                                         <div style="text-align:center; margin:0 auto; width:100%; color:#000; text-decoration:underline; ">
562                                                 <h2 style="font-size:12px; font-weight:bold;">FINANCE HISTORY INTEREST</h2>
563                                         </div>
564
565                                 <table style="width:100%">';
566                 foreach ($fh_data as $fh)
567                 {
568
569             $resultCodeFh = isset($fh['resultCode']) ? $fh['resultCode'] : '';
570
571                         $financeHistoryIntrest .= '
572                                         <tr>
573                                             <td style="width:250px; font-weight: bold;">Finance House : </td>
574                                             <td style="width:100px;"></td>
575                                                 <td style="width:200px; font-weight: normal;">' . $fh['financeHouse'] . '</td>
576
577                                         </tr>
578                                         <tr>
579                                             <td style="width:250px; font-weight: bold;">Agreement Or Account Number:</td>
580                                             <td style="width:100px;"></td>
581                                                 <td style="width:200px; font-weight: normal;">' . $fh['agreementOrAccountNumber'] . '</td>
582
583                                         </tr>
584                                         <tr>
585                                             <td style="width:250px; font-weight: bold;">Agreement Type: </td>
586                                             <td style="width:100px;"></td>
587                                                 <td style="width:200px; font-weight: normal;">' . $fh['agreementType'] . '</td>
588
589                                         </tr>
590                                         <tr>
591                                             <td style="width:250px; font-weight: bold;">Telephone Number:</td>
592                                             <td style="width:100px;"></td>
593                                                 <td style="width:200px; font-weight: normal;">' . $fh['telephoneNumber'] . '</td>
594
595                                         </tr>
596                                         <tr>
597                                             <td style="width:250px; font-weight: bold;">Start Date : </td>
598                                            <td style="width:100px;"></td>
599                                                 <td style="width:200px; font-weight: normal;">' . $fh['startDate'] . '</td>
600
601                                         </tr>
602                                         <tr>
603                                             <td style="width:250px; font-weight: bold;">End Date : </td>
604                                            <td style="width:100px;"></td>
605                                                 <td style="width:200px; font-weight: normal;">' . $fh['endDate'] . '</td>
606
607                                         </tr>
608                                         <tr>
609                                             <td style="width:250px; font-weight: bold;">Result Code:</td>
610                                             <td style="width:100px;"></td>
611                                                 <td style="width:200px; font-weight: normal;">' . $resultCodeFh . '</td>
612
613                                         </tr>
614                                         <tr><td colspan="3"><hr/></td></tr>';
615                 }
616                 if (empty($fh_data))
617                 {
618                         $financeHistoryIntrest .= '<tr><td colspan="3">' . $msg . '</td></tr>';
619                 }
620                 $financeHistoryIntrest .= '
621                         </table>
622                         <br />
623                         ';
624
625
626
627                 $this->append($financeHistoryIntrest);
628                 //$this->_page++;
629
630
631
632                 /* --------------------------------- POLICE STOLEN INTEREST --------------------------------- */
633
634                 $policeStolen ='
635
636                                 <div style="text-align:center; margin:0 auto; width:100%; color:#000; text-decoration:underline; ">
637                                         <h2 style="font-size:12px; font-weight:bold;">POLICE STOLEN INTEREST</h2>
638                                 </div>
639
640                         <table style="width:100%">
641                                 <tr>
642                                         <td style="width:80px; font-weight: bold;">Description</td>
643                                     <td style="width:80px; font-weight: bold; ">Status</td>
644                                     <td style="width:80px; font-weight: bold;">Police Station </td>
645                                     <td style="width:80px; font-weight: bold;">SAP Case Number</td>
646                                         <td style="width:80px; font-weight: bold;">Date Stolen</td>
647                                         <td style="width:80px; font-weight: bold;">Vin Match</td>
648                                     <td style="width:80px; font-weight: bold;">Engine Match</td>
649                                         <td style="width:80px; font-weight: bold;">Registration Match</td>
650
651                                 </tr>
652                                 <tr>
653                                         <td style="width:80px; font-weight: normal;">Successful Enquiry</td>
654                                     <td style="width:80px; font-weight: normal;">' . $si_resultCode . '</td>
655                                         <td style="width:80px; font-weight: normal;">' . $si_policeStation . '</td>
656                                         <td style="width:80px; font-weight: normal;">' . $si_caseNumber . '</td>
657                                     <td style="width:80px; font-weight: normal;">' . $si_dateStolen . '</td>
658                                         <td style="width:80px; font-weight: normal;">' . $si_vinMatch . '</td>
659                                         <td style="width:80px; font-weight: normal;">' . $si_engineMatch . ' </td>
660                                     <td style="width:80px; font-weight: normal;">' . $si_registrationMatch . '</td>
661                                 </tr>
662
663                         </table>
664                 <br />
665                 ';
666
667
668                 if ($si_resultCode == '' || $si_policeStation == '' || $si_caseNumber == '' || $si_dateStolen == '' || $si_dateStolen == '' || $si_vinMatch == '' || $si_engineMatch == '' || $si_registrationMatch == '' )
669                 {
670                         $msgHeading = '<div style="text-align:center; margin:0 auto; width:100%; color:#000; text-decoration:underline; ">
671                                                 <h2 style="font-size:12px; font-weight:bold;">POLICE STOLEN INTEREST</h2>
672                                                 </div>
673
674                                                 <table style="width:100%">';
675                         $this->append($msgHeading);
676                         $this->append('<tr><td colspan="3">' . $msg . '</td></tr>');
677             $this->append('</table><br />');
678
679                 }
680                 else
681                 {
682                         $this->append($policeStolen);
683                 }
684 //              $this->_page++;
685
686                 /* --------------------------------- ACCIDENT HISTORY --------------------------------- */
687
688
689         $emptyLine ='
690                         <table style="width:100%">
691                                 <tr>
692                                         <td style="width:80px; font-weight: bold;">Description</td>
693                                 </tr>
694                         </table>
695                 <br />
696                 ';
697
698         $this->append($emptyLine);
699
700         $accidentHistory = '<br />
701                                         <div style="text-align:center; margin:0 auto; width:100%; color:#000; text-decoration:underline; ">
702                                                 <h2 style="font-size:12px; font-weight:bold;">ACCIDENT HISTORY</h2>
703                                         </div>
704
705                                 <table style="width:100%">';
706
707
708                 foreach ($ah_data as $ah)
709                 {
710                         $accidentHistory .= '
711                                         <tr>
712                                             <td style="width:250px; font-weight: bold;">Assessment Date: </td>
713                                             <td style="width:100px;"></td>
714                                                 <td style="width:200px; font-weight: normal;">' . $ah['assessmentDate'] . '</td>
715                                         </tr>
716                                         <tr>
717                                             <td style="width:250px; font-weight: bold;">Vehicle Description:</td>
718                                             <td style="width:100px;"></td>
719                                                 <td style="width:200px; font-weight: normal;">' . $ah['vehicleDescription'] . '</td>
720                                         </tr>
721                                         <tr>
722                                             <td style="width:250px; font-weight: bold;">Vin Match: </td>
723                                             <td style="width:100px;"></td>
724                                                 <td style="width:200px; font-weight: normal;">' . $ah['vinMatch'] . '</td>
725                                         </tr>
726                                         <tr>
727                                             <td style="width:250px; font-weight: bold;">Reg Match:</td>
728                                             <td style="width:100px;"></td>
729                                                 <td style="width:200px; font-weight: normal;"> ' . $ah['regMatch'] . ' </td>
730                                         </tr>
731                                         <tr>
732                                             <td style="width:250px; font-weight: bold;">Estimated Repair Cost: </td>
733                                             <td style="width:100px;"></td>
734                                                 <td style="width:200px; font-weight: normal;">' . $ah['estimatedRepairCost'] . '</td>
735                                         </tr>
736                                         <tr>
737                                             <td style="width:250px; font-weight: bold;">Result Code:</td>
738                                             <td style="width:100px;"></td>
739                                                 <td style="width:200px; font-weight: normal;">' . $ah['resultCode'] . '</td>
740
741                                         </tr>
742                                         <tr><td colspan="3"><hr/></td></tr>
743                         ';
744                 }
745                 if (empty($ah_data))
746                 {
747                         $financeHistoryIntrest .= '<tr><td colspan="3">' . $msg . '</td></tr>';
748                 }
749                 $accidentHistory .= '
750                         </table>
751                         <br />';
752
753                 $this->append($accidentHistory);
754                 //$this->_page++;
755
756
757
758                 /* --------------------------------- MICRODOT --------------------------------- */
759
760                 $microdot  ='
761                                 <div style="text-align:center; margin:0 auto; width:100%; color:#000; text-decoration:underline; ">
762                                         <h2 style="font-size:12px; font-weight:bold;">MICRODOT</h2>
763                                 </div>
764
765                         <table style="width:100%">
766                                 <tr>
767                                     <td style="width:250px; font-weight: bold;">Company: </td>
768                                     <td style="width:100px;"></td>
769                                         <td style="width:200px; font-weight: normal;">' . $mi_company . '</td>
770
771                                 </tr>
772                                 <tr>
773                                     <td style="width:250px; font-weight: bold;">Reference Number:</td>
774                                     <td style="width:100px;"></td>
775                                         <td style="width:200px; font-weight: normal;">' . $mi_referenceNumber . '</td>
776
777                                 </tr>
778                                 <tr>
779                                     <td style="width:250px; font-weight: bold;">Contact Number: </td>
780                                     <td style="width:100px;"></td>
781                                         <td style="width:200px; font-weight: normal;">' . $mi_contactNumber . '</td>
782
783                                 </tr>
784                                 <tr>
785                                     <td style="width:250px; font-weight: bold;">Date Applied:</td>
786                                     <td style="width:100px;"></td>
787                                         <td style="width:200px; font-weight: normal;">' . $mi_dateApplied . '</td>
788
789                                 </tr>
790                                 <tr>
791                                     <td style="width:250px; font-weight: bold;">Result Code:</td>
792                                     <td style="width:100px;"></td>
793                                         <td style="width:200px; font-weight: normal;">' . $mi_resultCode . '</td>
794
795                                 </tr>
796
797                         </table>
798                 <br />
799                 ';
800                 if ($mi_company == '' || $mi_referenceNumber == '' || $mi_contactNumber == '' || $mi_dateApplied = '')
801                 {
802
803                         $msgHeading = '<div style="text-align:center; margin:0 auto; width:100%; color:#000; text-decoration:underline; ">
804                         <h2 style="font-size:12px; font-weight:bold;">MICRODOT</h2>
805                         </div>';
806                         $this->append($msgHeading);
807                         $this->append($msg . '<br /><br />');
808                 }
809                 else
810                 {
811                         $this->append($microdot);
812                 }
813
814
815                 /* --------------------------------- VESA SECURITY DEVICE HISTORY --------------------------------- */
816
817                 $vesaInformation ='&nbsp;<br/>
818                                 <div style="text-align:left; margin:0 0 0 290; width:100%; color:#000; text-decoration:underline; ">
819                                         <h2 style="font-size:12px; font-weight:bold;">VESA SECURITY DEVICE HISTORY</h2>
820                                 </div>
821
822                         <table style="width:100%">
823                                 <tr>
824                                     <td style="width:250px; font-weight: bold;">Certificate Number: </td>
825                                     <td style="width:100px;"></td>
826                                         <td style="width:200px; font-weight: normal;">' . $vesa_certificateNumber . '</td>
827
828                                 </tr>
829                                 <tr>
830                                     <td style="width:250px; font-weight: bold;">Date Fitted:</td>
831                                     <td style="width:100px;"></td>
832                                         <td style="width:200px; font-weight: normal;">' . $vesa_dateFitted . '</td>
833
834                                 </tr>
835                                 <tr>
836                                     <td style="width:250px; font-weight: bold;">Brand Name: </td>
837                                     <td style="width:100px;"></td>
838                                         <td style="width:200px; font-weight: normal;">' . $vesa_brandName . '</td>
839
840                                 </tr>
841                                 <tr>
842                                     <td style="width:250px; font-weight: bold;">Brand Model:</td>
843                                     <td style="width:100px;"></td>
844                                         <td style="width:200px; font-weight: normal;">' . $vesa_brandModel . '</td>
845
846                                 </tr>
847                                 <tr>
848                                     <td style="width:250px; font-weight: bold;">Device Description Type: </td>
849                                    <td style="width:100px;"></td>
850                                         <td style="width:200px; font-weight: normal;">' . $vesa_deviceDescriptionType . '</td>
851
852                                 </tr>
853                                 <tr>
854                                     <td style="width:250px; font-weight: bold;">Result Code:</td>
855                                     <td style="width:100px;"></td>
856                                         <td style="width:200px; font-weight: normal;">' . $vesa_resultCode . '</td>
857
858                                 </tr>
859
860                         </table>
861                 <br />
862                 ';
863
864                 if ($vesa_certificateNumber == '' || $vesa_dateFitted == '' || $vesa_brandName == '' || $vesa_brandModel = '' || $vesa_deviceDescriptionType == '')
865                 {
866                         $msgHeading = '<div style="text-align:center; margin:0 auto; width:100%; color:#000; text-decoration:underline; ">
867                                                                 <h2 style="font-size:12px; font-weight:bold;">VESA SECURITY DEVICE HISTORY</h2>
868                                                         </div>';
869                         $this->append($msgHeading);
870                         $this->append($msg . '<br /><br />');
871                 }
872                 else
873                 {
874                         $this->append($vesaInformation);
875                 }
876                 //$this->_page++;
877
878
879                 /* --------------------------------- MILEAGES --------------------------------- */
880
881
882
883                 $mileage = '
884                         <div style="text-align:center; margin:0 auto; width:100%; color:#000; ">
885                         <h2 style="font-size:12px; font-weight:bold;">&nbsp; </h2>
886                         </div>
887                         <div style="text-align:left; margin:0 0 0 350; width:100%; color:#000; text-decoration:underline; ">
888                         <h2 style="font-size:12px; font-weight:bold;">MILEAGES</h2>
889                         </div>
890
891                         <table style="width:100%">';
892                 foreach ($mh_data as $mh)
893                 {
894
895             $resultCodeMh = isset($fh['resultCode']) ? $fh['resultCode'] : '';
896
897                         $mileage .= '
898                                         <tr>
899                                             <td style="width:250px; font-weight: bold;">Source: </td>
900                                             <td style="width:100px;"></td>
901                                                 <td style="width:200px; font-weight: normal;">' . $mh['source'] . '</td>
902
903                                         </tr>
904                                         <tr>
905                                             <td style="width:250px; font-weight: bold;">Vehicle Mileage:</td>
906                                             <td style="width:100px;"></td>
907                                                 <td style="width:200px; font-weight: normal;">' . $mh['vehicleMileage'] . ' </td>
908
909                                         </tr>
910                                         <tr>
911                                             <td style="width:250px; font-weight: bold;">Date Registered: </td>
912                                             <td style="width:100px;"></td>
913                                                 <td style="width:200px; font-weight: normal;">' . $mh['dateRegistered'] . '</td>
914
915                                         </tr>
916
917                                         <tr>
918                                             <td style="width:250px; font-weight: bold;">Result Code:</td>
919                                             <td style="width:100px;"></td>
920                                                 <td style="width:200px; font-weight: normal;">' . $resultCodeMh . '</td>
921
922                                         </tr>
923                                         <tr><td colspan="3"><hr/></td></tr>';
924                 }
925                 if (empty($mh_data))
926                 {
927                         $financeHistoryIntrest .= '<tr><td colspan="3">' . $msg . '</td></tr>';
928                 }
929                 $mileage .= '
930                         </table>
931                         <br />';
932
933                 $this->append($mileage);
934
935
936                 /* --------------------------------- PREVIOUS INQUIRIES --------------------------------- */
937
938                 $enquiryHistory = '
939                         <div style="text-align:center; margin:0 auto; width:100%; color:#000; text-decoration:underline; ">
940                         <h2 style="font-size:12px; font-weight:bold;">PREVIOUS INQUIRIES</h2>
941                         </div>
942
943                         <table style="width:100%">';
944                 foreach ($eh_data as $eh)
945                 {
946                         $enquiryHistory .= '
947                                         <tr>
948                                             <td style="width:250px; font-weight: bold;">Customer type: </td>
949                                             <td style="width:100px;"></td>
950                                                 <td style="width:200px; font-weight: normal;">' . $eh['source'] . '</td>
951                                         </tr>
952                                         <tr>
953                                             <td style="width:250px; font-weight: bold;">Transaction Date:</td>
954                                             <td style="width:100px;"></td>
955                                                 <td style="width:200px; font-weight: normal;"> ' . $eh['transactionDate'] . '</td>
956                                         </tr>
957                                         <tr><td colspan="3"><hr/></td></tr>
958                         ';
959                 }
960                 if (empty($eh_data))
961                 {
962                         $financeHistoryIntrest .= '<tr><td colspan="3">' . $msg . '</td></tr>';
963                 }
964                 $enquiryHistory .= '
965                         </table>
966                         <br />';
967
968
969                 $this->append($enquiryHistory);
970
971                 /* --------------------------------- PREVIOUS REGISTRATIONS --------------------------------- */
972
973                 $registrationHistory = '
974                         <div style="text-align:center; margin:0 auto; width:100%; color:#000; text-decoration:underline; ">
975                         <h2 style="font-size:12px; font-weight:bold;">PREVIOUS REGISTRATIONS</h2>
976                         </div>
977                                 <table style="width:100%">';
978                 foreach ($rh_data as $rh)
979                 {
980                         $registrationHistory .= '
981                                         <tr>
982                                             <td style="width:250px; font-weight: bold;">Registration Number: </td>
983                                             <td style="width:100px;"></td>
984                                                 <td style="width:200px; font-weight: normal;">' . $rh['registrationNumber'] . '</td>
985                                         </tr>
986                                         <tr>
987                                             <td style="width:250px; font-weight: bold;">Date Registered</td>
988                                             <td style="width:100px;"></td>
989                                                 <td style="width:200px; font-weight: normal;">' . $rh['dateRegistered'] . '</td>
990                                         </tr>
991                                         <tr><td colspan="3"><hr/></td></tr>
992                         ';
993                 }
994                 if (empty($rh_data))
995                 {
996                         $financeHistoryIntrest .= '<tr><td colspan="3">' . $msg . '</td></tr>';
997                 }
998                 $registrationHistory .= '
999                         </table>
1000                         <br />';
1001
1002
1003                 $this->append($registrationHistory);
1004                 //$this->_page++;
1005
1006                 /* --------------------------------- IVID RESPONSE x --------------------------------- */
1007
1008                 $vesaInformation ='
1009                                 <div style="text-align:center; margin:0 auto; width:100%; color:#000; text-decoration:underline; ">
1010                                         <h2 style="font-size:12px; font-weight:bold;">IVID RESPONSE</h2>
1011                                 </div>
1012
1013                         <table style="width:100%">
1014                                 <tr>
1015                                     <td style="width:60px; font-weight: bold;">Code </td>
1016                                     <td style="width:340px; font-weight: bold;">Description</td>
1017                                         <td style="width:150px; font-weight: bold;">IVID Reference Number</td>
1018                                         <td style="width:150px; font-weight: bold;">IVID Contact Number</td>
1019                                 </tr>
1020                                 <tr>
1021                                     <td style="width:60px; font-weight: normal;">' . $ivid_responseCode . '</td>
1022                                         <td style="width:340px; font-weight: normal;">' . $ivid_responseDescription . '</td>
1023                                         <td style="width:150px; font-weight: normal;">' . $ivid_referenceNumber . '</td>
1024                                     <td style="width:150px; font-weight: normal;">' . $ivid_contactNumber . '</td>
1025                                 </tr>
1026                         </table>
1027                 <br />
1028                 ';
1029
1030                 if ($ivid_responseCode == '' || $ivid_responseDescription == '' || $ivid_referenceNumber == '' || $ivid_contactNumber == '')
1031                 {
1032                         $msgHeading = '<div style="text-align:center; margin:0 auto; width:100%; color:#000; text-decoration:underline; ">
1033                                                         <h2 style="font-size:12px; font-weight:bold;">IVID RESPONSE</h2>
1034                                                   </div>';
1035                         $this->append($msgHeading);
1036                         $this->append($msg . '<br /><br />');
1037                 }
1038                 else
1039                 {
1040                         $this->append($vesaInformation);
1041                 }
1042
1043
1044                 /* --------------------------------- SIGNATURES --------------------------------- */
1045                 #-> Signatures.
1046                 /* if ($this->showSignatureLines)
1047                 {
1048                         $this->append(
1049                                         $this->newSignatureLine()
1050                                                 ->addSignatureLine('Customer (name)', 'Signature', 'Date')
1051                                                 ->addSignatureLine('Manager (name)', 'Signature', 'Date')
1052                                                 ->publish()
1053                                         );
1054                 }
1055
1056                 $this->append(
1057                                 '<div style="position:absolute;bottom:0;left:0;padding:0;margin:0;width:100%;">'
1058                                 . '<table cellpadding="0px" cellspacing="0px" style="border:0px;width:100%;">'
1059                                 . '<tr>'
1060                                 . '<td style="width:30%;border-bottom: solid 1px #333;font-size:10px;font-weight:bold;color:#000;"><i>'
1061                                 . $dateOfPrint . '</i></td>'
1062                                 . '<td style="width:5%">&nbsp;</td>'
1063                                 . '<td style="width:30%;border-bottom: solid 1px #333;font-size:10px;font-weight:bold;color:#000;"><i>'
1064                                 . $printedBy . '</i></td>'
1065                                 . '<td style="width:5%">&nbsp;</td>'
1066                                 . '<td style="width:30%;border-bottom: solid 1px #333;font-size:10px;font-weight:bold;color:#000;"><i>'
1067                                 . $referenceNo . '</i></td>'
1068                                 . '</tr>'
1069                                 . '</table>'
1070                                 . '</div>'
1071                                 );
1072                 */
1073
1074                 /* $this->append(
1075                                         '<div style="position:absolute;bottom:0;left:0;padding:0;margin:0;width:100%;">'
1076                                         . '<table cellpadding="0px" cellspacing="0px" style="border:0px;width:100%;">'
1077                                         . '<tr>'
1078                                         . '<td style="width:30%;border-bottom: solid 1px #333;font-size:10px;font-weight:bold;color:#000;"><i>'
1079                                         . $dateOfPrint . '</i></td>'
1080                                         . '<td style="width:5%">&nbsp;</td>'
1081                                         . '<td style="width:30%;border-bottom: solid 1px #333;font-size:10px;font-weight:bold;color:#000;"><i>'
1082                                         . $printedBy . '</i></td>'
1083                                         . '<td style="width:5%">&nbsp;</td>'
1084                                         . '<td style="width:30%;border-bottom: solid 1px #333;font-size:10px;font-weight:bold;color:#000;"><i>'
1085                                         . $referenceNo . '</i></td>'
1086                                         . '</tr>'
1087                                         . '</table>'
1088                                         . '</div>'
1089                         ); */
1090
1091
1092
1093
1094
1095
1096
1097                 return;
1098         }
1099
1100
1101 }