initial commit
[namibia] / module / Auction / src / Auction / Pdf / Complete.php
1 <?php
2 namespace Auction\Pdf;
3
4
5
6 class Complete extends \Utility\Service\PdfTemplate
7 {
8
9
10         /**
11          * PDF title.
12          * @var string
13          */
14         protected $_title = 'Stock Information';
15         /**
16          * @var \Stock\Entity\Stock
17          */
18         protected $jobRecord;
19         /**
20          * @var boolean
21          */
22         protected $showTradeDataOnly = true;
23         /**
24          * @var boolean
25          */
26         protected $showCustomerDetails = false;
27         /**
28          * @var boolean
29          */
30         protected $showValuationDetails = false;
31         /**
32          * @var boolean
33          */
34         protected $showMainImage = true;
35         /**
36          * @var boolean
37          */
38         protected $showPricingDetails = true;
39         /**
40          * @var boolean
41          */
42         protected $showVehicleDetails = true;
43         /**
44          * @var boolean
45          */
46         protected $showVehicleNotes = true;
47         /**
48          * @var boolean
49          */
50         protected $showDamageDetails = true;
51         /**
52          * @var boolean
53          */
54         protected $showAccessoryDetails = true;
55         /**
56          * @var boolean
57          */
58         protected $showSignatureLines = false;
59         /**
60          * @var boolean
61          */
62         protected $showTermsAndConditions = false;
63         /**
64          * @var boolean
65          */
66         protected $showOffersReceived = false;
67         /**
68          * @var boolean
69          */
70         protected $showOfferMade = false;
71
72
73         /**
74          * Utility for easy parameter retrieval.
75          * @param string $param
76          * @param unknown $default
77          * @return unknown
78          */
79         protected function getStockParam($param, $default)
80         {
81                 return !is_null($this->jobRecord->$param)
82                         ? $this->jobRecord->$param
83                         : $default;
84         }
85
86         /**
87          * Utility for easy parameter retrieval.
88          * @param string $param
89          * @param unknown $default
90          * @return unknown
91          */
92         protected function getStockSubParam($ref, $param, $default)
93         {
94                 $ref = !is_null($this->jobRecord->$ref)
95                         ? $this->jobRecord->$ref
96                         : null;
97                 return is_object($ref)
98                         ? $ref->$param
99                         : $default;
100         }
101
102         /**
103          * Utility for easy parameter retrieval.
104          * @param string $param
105          * @param unknown $default
106          * @return unknown
107          */
108         protected function getValuationParam($param, $default)
109         {
110                 return !is_null($this->jobRecord->valuation)
111                                 && !is_null($this->jobRecord->valuation->$param)
112                         ? $this->jobRecord->valuation->$param
113                         : $default;
114         }
115
116
117         /**
118          * Build the content.
119          */
120         public function build()
121         {
122                 #-> Set data item to work with.
123                 $this->auctionRecord = $this->_input['jobRecord'];
124                 $this->jobRecord = $this->_input['jobRecord']->stock;
125                 $dateTimeFormat = \Utility\Definitions\Locale::getDateTimeFormat();
126                 $currencyPrefix = \Utility\Definitions\Locale::getCurrencyPrefix();
127                 $authData = \Utility\Registry::getAuthData();
128                 $dateOfPrint = 'Date of print: <span style="color:#333;">' . date('Y-m-d H:i:s') . '</span>';
129                 $printedBy   = 'Printed by: <span style="color:#333;">' . $authData['firstName']
130                                          . ' ' . $authData['familyName'] . '</span>';
131                 $referenceNo = 'Reference no.: <span style="color:#333;">' . $this->jobRecord->referenceNumber . '</span>';
132
133
134                 /* --------------------------------- CUSTOMER, VALUATION, PRICING --------------------------------- */
135                 $type = $this->jobRecord->type;
136                 $this->append(
137                                 '<br /><div style="font-size:16px;font-weight:bold;">'
138                                 . $type->model->make->name . ' '
139                                 . $type->model->name . ' '
140                                 . $type->name . ' ('
141                                 . $type->introYear->name . ' - '
142                                 . (!is_null($type->discYear) ? $type->discYear->name : 'Current') . ')'
143                                 . '</div><hr /><br />'
144                                 );
145
146
147                 /* --------------------------------- CUSTOMER, VALUATION, PRICING --------------------------------- */
148                 #-> Customer
149                 $customerDetail = '&nbsp;';
150                 if ($this->showCustomerDetails)
151                 {
152                         $table = $this->newTable(
153                                         array(60, 40),
154                                         'padding:0;margin:0;font-size:10px;',
155                                         '',
156                                         'padding:2px 3px 2px 0;margin:0;'
157                         );
158                         $department = $this->getValuationParam('department', null);
159                         $department = !is_null($department)
160                                 ? $department
161                                 : '&nbsp;';
162                         $table
163                                 ->addTitle('Customer', 'padding:0 0 10px 0;font-weight:bold;font-size:11px;', 0, 1)
164                                 ->addKeyValueDataSet(array(
165                                                 'Customer name:'    => $this->getValuationParam('firstName', ''),
166                                                 'Customer surname:' => $this->getValuationParam('familyName', ''),
167                                                 'ID:'               => $this->getValuationParam('idNumber', ''),
168                                                 'Mobile:'           => $this->getValuationParam('mobile', ''),
169                                                 'Email:'            => $this->getValuationParam('email', ''),
170                                                 'Department:'       => $department,
171                                                 'Address:'              => '&nbsp;',
172                                                 '<span style="color:#FFF;font-size:20px;">a1</span>'                    => '&nbsp;',
173                                                 '<span style="color:#FFF;font-size:10px;">1</span><span style="color:#000;font-size:10px;">______________________________________</span>'                               => '&nbsp;',
174                                                 '<span style="color:#FFF;font-size:20px;">a</span>'                     => '&nbsp;',
175                                                 '<span style="color:#FFF;font-size:10px;">2</span><span style="color:#000;font-size:10px;">______________________________________</span>'                               => '&nbsp;',
176                                                 '<span style="color:#FFF;font-size:20px;">b</span>'                     => '&nbsp;',
177                                                 '<span style="color:#FFF;font-size:10px;">3</span><span style="color:#000;font-size:10px;">______________________________________</span>'                               => '&nbsp;'
178                                 ), 0, 'font-weight:bold;', 'color:#666;');
179                         $customerDetail = $table->publish();
180                 }
181                 #-> Customer alternated with dealership details for traders.
182                 if ($this->showTradeDataOnly)
183                 {
184                         $table = $this->newTable(
185                                         array(60, 40),
186                                         'padding:0;margin:0;font-size:10px;',
187                                         '',
188                                         'padding:2px 3px 2px 0;margin:0;'
189                         );
190                         $department = $this->getValuationParam('department', null);
191                         $department = !is_null($department)
192                                 ? $department
193                                 : '&nbsp;';
194                         $contact = $this->getStockSubParam('company', 'contact', null);
195                         $table
196                                 ->addTitle('Dealership', 'padding:0 0 10px 0;font-weight:bold;font-size:11px;', 0, 1)
197                                 ->addKeyValueDataSet(array(
198                                                 'Dealership name:'  => $this->getStockSubParam('company', 'name', ''),
199                                                 'Contact:'              => !is_null($contact) ? $contact->firstName . ' ' . $contact->familyName : '',
200                                                 'Mobile:'           => !is_null($contact) ? $contact->mobile : '',
201                                                 'Email:'            => !is_null($contact) ? $contact->email : ''
202                                 ), 0, 'font-weight:bold;', 'color:#666;');
203                         $customerDetail = $table->publish();
204                 }
205
206                 #-> Valuation
207                 $valuationDetail = '&nbsp;';
208                 if ($this->showValuationDetails)
209                 {
210                         $table = $this->newTable(
211                                         array(55, 45),
212                                         'padding:0;margin:0;font-size:10px;',
213                                         '',
214                                         'padding:2px 3px 2px 0;margin:0;'
215                         );
216                         $pgItem = $this->em
217                                 ->getRepository('\Auction\Entity\Auction')
218                                 ->findOneBy(array('stock' => $this->jobRecord));
219                         $pgLoaded = !is_null($pgItem)
220                                 ? $pgItem->created->format($dateTimeFormat)
221                                 : '&nbsp;';
222                         $valCreated = $this->getValuationParam('created', null);
223                         $valCreated = !is_null($valCreated)
224                                 ? $valCreated->format($dateTimeFormat)
225                                 : '&nbsp;';
226                         $table
227                                 ->addTitle('Valuation details', 'padding:0 0 10px 0;font-weight:bold;font-size:11px;', 0, 1)
228                                 ->addKeyValueDataSet($this->showTradeDataOnly
229                                                 ? array(
230                                                                 'Date created:'               => $valCreated,
231                                                                 'Date loaded on price guide:' => $pgLoaded
232                                                 )
233                                                 : array(
234                                                                 'Date created:'               => $valCreated,
235                                                                 'Valuation no.:'              => $this->getValuationParam('valuationNumber', ''),
236                                                                 'Reference no.:'              => $this->getStockParam('referenceNumber', ''),
237                                                                 'Date loaded on price guide:' => $pgLoaded
238                                                 ), 0, 'font-weight:bold;', 'color:#F00;');
239                         $valuationDetail = $table->publish();
240                 }
241                 $mainImage = '&nbsp;';
242                 if ($this->showMainImage)
243                 {
244                         $pic = $this->getStockParam('mainImage', '');
245                         if (is_object($pic))
246                         {
247                                 $mainImage = '<img src="' . __DIR__ . '/../../../../../public/img/bin/'. $pic->filename . '" style="padding:0;margin:0;width:100%;" />';
248                         }
249                 }
250
251                 #-> Pricing details
252                 $pricingDetail = '&nbsp;';
253                 $total = $this->getValuationParam('overAllowance', '0.00') + $this->getValuationParam('amountOffered', '0.00');
254                 $total = number_format($total, 2, '.', '');
255                 if ($this->showPricingDetails)
256                 {
257                         $table = $this->newTable(
258                                         array(60, 40),
259                                         'padding:0;margin:0;font-size:10px;',
260                                         '',
261                                         'padding:2px 3px 2px 0;margin:0;'
262                         );
263                         $table
264                                 ->addTitle('Pricing details', 'padding:0 0 10px 0;font-weight:bold;font-size:11px;', 0, 1)
265                                 ->addKeyValueDataSet($this->showTradeDataOnly
266                                                 ? array(
267                                                                 'Trade:'                     => $currencyPrefix . $this->getStockParam('tradePrice', '0.00'),
268                                                                 'Retail:'                    => $currencyPrefix . $this->getStockParam('retailPrice', '0.00'),
269                                 'List:'                     => $currencyPrefix . $this->getStockParam('listPrice', '0.00'),
270                                                                 'Reserve price:'             => $currencyPrefix . $this->auctionRecord->reservePrice,
271                                                                 'Amount offered:'            => $currencyPrefix . $this->getValuationParam('amountOffered', '0.00'),
272                                                                 'O.A.:'                      => $currencyPrefix . $this->getValuationParam('overAllowance', '0.00'),
273                                                                 'Total offer:'                   => $currencyPrefix . $total, // total offer =  amount offered + O.A
274                                                 )
275                                                 : array(
276                                                                 'Trade:'                     => $currencyPrefix . $this->getStockParam('tradePrice', '0.00'),
277                                                                 'Retail:'                    => $currencyPrefix . $this->getStockParam('retailPrice', '0.00'),
278                                 'List:'                     => $currencyPrefix . $this->getStockParam('listPrice', '0.00'),
279                                                                 'Amount offered:'            => $currencyPrefix . $this->getValuationParam('amountOffered', '0.00'),
280                                                                 'O.A.:'                      => $currencyPrefix . $this->getValuationParam('overAllowance', '0.00'),
281                                                                 'Total offer:'                   => $currencyPrefix . $total, // total offer =  amount offered + O.A
282                                                                 'Projected retail:'          => $currencyPrefix,
283                                                                 'Planned margin:'            => $currencyPrefix,
284                                                                 'Price guide highest offer:' => $currencyPrefix . $this->getStockParam('highestOffer', '0.00')
285                                                 ), 0, 'font-weight:bold;', 'color:#F00;');
286                         $pricingDetail = $table->publish();
287                 }
288
289                 #-> First row of data-blocks.
290                 if ($this->showCustomerDetails
291                         || $this->showValuationDetails
292                         || $this->showMainImage
293                         || $this->showPricingDetails)
294                 {
295                         $container = $this
296                                 ->newTable(
297                                         array(30, 5, 30, 5, 30),
298                                         'margin:0;font-size:10px;vertical-align:top;',
299                                         '',
300                                         'padding:10px 0 0 0;'
301                                         )
302                                 ->setCellValue(0, 0, $customerDetail)
303                                 ->setCellValue(0, 2, $pricingDetail)
304                                 ->setCellValue(0, 4, $valuationDetail . $mainImage);
305                         $this->append($container->publish() . '<br />');
306                 }
307
308
309                 /* --------------------------------- VEHICLE, DAMAGES, ACCESSORIES --------------------------------- */
310
311                 #-> Vehicle details
312                 $vehicleDetail = '&nbsp;';
313                 if ($this->showVehicleDetails)
314                 {
315                         $keys = $this->getStockParam('spareKeys', null);
316                         if (is_null($keys))
317                         {
318                                 $keys = '';
319                         }
320                         else
321                         {
322                                 $keys = $keys
323                                         ? 'Yes'
324                                         : 'No';
325                         }
326                         $table = $this->newTable(
327                                         array(55, 45),
328                                         'padding:0;margin:0;font-size:10px;',
329                                         '',
330                                         'padding:2px 3px 2px 0;margin:0;'
331                         );
332                         $table
333                                 ->addTitle('Vehicle specifications', 'padding:0 0 10px 0;font-weight:bold;font-size:11px;', 0, 1)
334                                 ->addKeyValueDataSet(array(
335                                                 'Year:'                 => $this->getStockSubParam('vehicleYear', 'name', ''),
336                                                 'Category:'             => $type->category->name,
337                                                 'Make:'                 => $type->model->make->name,
338                                                 'Model:'                => $type->model->name,
339                                                 'Type:'                 => $type->name,
340                                                 'Registration no.:'     => $this->getStockParam('registrationNumber', ''),
341                                                 'Fuel type:'            => $this->getStockSubParam('fuelType', 'name', ''),
342                                                 'Transmission type:'    => $this->getStockSubParam('transmissionType', 'name', ''),
343                                                 'VIN no.:'              => $this->getStockParam('vinNumber', ''),
344                                                 'Engine no.:'           => $this->getStockParam('engineNumber', ''),
345                                                 'MM code:'              => $type->mmCode,
346                                                 'Kms:'                  => $this->getStockParam('km', ''),
347                                                 'Condition:'            => $this->getStockSubParam('condition', 'name', ''),
348                                                 'Main exterior colour:' => $this->getStockSubParam('exteriorColour', 'name', ''),
349                                                 'Main interior colour:' => $this->getStockSubParam('interiorColour', 'name', ''),
350                                                 'Upholstery:'           => $this->getStockSubParam('upholstery', 'name', ''),
351                                                 'Papers:'               => $this->getStockSubParam('papers', 'name', ''),
352                                                 'Papers comments:'      => $this->getStockParam('papersNotes', ''),
353                                                 'Natis:'                => $this->getStockSubParam('natis', 'name', ''),
354                                                 'Spare keys:'           => $keys,
355                                                 'FSH:'                  => $this->getStockSubParam('fullServiceHistory', 'name', ''),
356                                                 'FSH comments:'         => $this->getStockParam('fshNotes', ''),
357                                                 'Stock number:'         => $this->getStockParam('stockNumber', '')
358                                 ), 0, '', 'color:#666;');
359                         $vehicleDetail = $table->publish();
360                 }
361
362                 #-> Damages
363                 $damagesDetail = '&nbsp;';
364                 if ($this->showDamageDetails)
365                 {
366                         $damageData = array();
367                         $damages = $this->jobRecord->damagesToArray();
368                         foreach ($damages as $damage)
369                         {
370                                 $damageData[$damage['damage']['name'] . ':'] = $currencyPrefix . $damage['amount'];
371                         }
372                         $damageData['Total estimated repair cost:']  =
373                                 '<span style="color:#F00;">' . $currencyPrefix . $this->getStockParam('damageTotal', '') . '</span>';
374                         $damageData['Damages comments:']             = $this->getStockParam('damageNotes', '');
375                         $damageData['Previous repairs noted:']       = $this->getStockParam('previousRepairsNoted', false)
376                                 ? 'Yes'
377                                 : 'No';
378                         $damageData['Previous repairs comments:']    = $this->getStockParam('previousRepairsNotes', '');
379                         $table = $this->newTable(
380                                         array(50, 50),
381                                         'padding:0;margin:0;font-size:10px;',
382                                         '',
383                                         'padding:2px 3px 2px 0;margin:0;'
384                         );
385                         $type = $this->jobRecord->type;
386                         $table
387                                 ->addTitle('Damages', 'padding:0 0 10px 0;font-weight:bold;font-size:11px;', 0, 1)
388                                 ->addKeyValueDataSet($damageData, 0, '', 'color:#666;');
389                         $damagesDetail = $table->publish();
390                 }
391
392                 #-> Accessories
393                 $accessoriesDetail = '&nbsp;';
394                 if ($this->showAccessoryDetails)
395                 {
396                         $accs = array();
397                         $accData = array();
398                         $accessories = $this->jobRecord->accessoriesToArray();
399                         foreach ($accessories as $accessory)
400                         {
401                                 $accs[] = $accessory['accessory']['name'];
402                         }
403                         if (!empty($accs))
404                         {
405                                 for ($i = 0; $i <= count($accs); $i += 2)
406                                 {
407                                         if (isset($accs[$i]))
408                                         {
409                                                 $accData[$accs[$i]] = isset($accs[$i + 1])
410                                                         ? $accs[$i + 1]
411                                                         : '';
412                                         }
413                                 }
414                         }
415                         $accData['<span style="color:#000;font-size:10px;">Comments:</span>'] =
416                                 '<span style="color:#666;font-size:10px;">' . $this->getStockParam('accessoryNotes', '') . '</span>';
417                         $table = $this->newTable(
418                                         array(50, 50),
419                                         'padding:0;margin:0;font-size:9px;',
420                                         '',
421                                         'padding:2px 3px 2px 0;margin:0;'
422                         );
423                         $type = $this->jobRecord->type;
424                         $table
425                                 ->addTitle('Accessories', 'padding:0 0 10px 0;font-weight:bold;font-size:11px;', 0, 1)
426                                 ->addKeyValueDataSet($accData, 0, 'color:#666;', 'color:#666;');
427                         $accessoriesDetail = $table->publish();
428                 }
429
430                 #-> Second row of data-blocks.
431                 if ($this->showVehicleDetails
432                         || $this->showDamageDetails
433                         || $this->showAccessoryDetails)
434                 {
435                         $container = $this
436                                 ->newTable(
437                                         array(30, 5, 30, 5, 30),
438                                         'margin:0;font-size:10px;vertical-align:top;',
439                                         '',
440                                         'padding:10px 0 0 0;'
441                                         )
442                                 ->setCellValue(0, 0, $vehicleDetail)
443                                 ->setCellValue(0, 2, $damagesDetail)
444                                 ->setCellValue(0, 4, $accessoriesDetail);
445                         $this->append($container->publish() . '<br />');
446                 }
447                 
448                 /* --------------------------------- VEHICLE NOTES --------------------------------- */
449                 #-> Vehicle Notes
450                 $VehicleNotes = '&nbsp;';
451                 if ($this->showVehicleNotes)
452                 {
453                         $table = $this->newTable(
454                                         array(55, 45),
455                                         'padding:0;margin:0;font-size:10px;',
456                                         '',
457                                         'padding:15px 15px 15px 0;margin:0;'
458                         );
459                                 
460                         $dSet = array(
461                                         '1______________________________________________________________________________________________________________________________________'         => '&nbsp;',
462                                         '2______________________________________________________________________________________________________________________________________'         => '&nbsp;',
463                                         '3______________________________________________________________________________________________________________________________________'         => '&nbsp;'
464                         );
465                 
466                         $table
467                         ->addTitle('Notes:', 'padding:0 0 10px 0;font-weight:bold;font-size:11px;', 0, 1)
468                         ->addKeyValueDataSet($dSet, 0, '', 'color:#666;');
469                         $VehicleNotes = $table->publish();
470                 }
471                 #-> Third row of data-blocks.
472                 if ($this->showVehicleNotes)
473                 {
474                 $container = $this
475                 ->newTable(
476                                 array(30, 5, 30, 5, 30),
477                                 'margin:0;font-size:10px;vertical-align:top;',
478                                         '',
479                                         'padding:10px 0 0 0;'
480                         )
481                         ->setCellValue(0, 0, $VehicleNotes);
482                                 $this->append($container->publish() . '<br />');
483                 }
484                 
485                 
486
487
488
489                 /* --------------------------------- SIGNATURES --------------------------------- */
490                 #-> Signatures.
491                 if ($this->showSignatureLines)
492                 {
493                         $this->append(
494                                         $this->newSignatureLine()
495                                                 ->addSignatureLine('Customer (name)', 'Signature', 'Date')
496                                                 ->addSignatureLine('Manager (name)', 'Signature', 'Date')
497                                                 ->publish()
498                                         );
499                 }
500
501                 $this->append(
502                                 '<div style="position:absolute;bottom:0;left:0;padding:0;margin:0;width:100%;">'
503                                 . '<table cellpadding="0px" cellspacing="0px" style="border:0px;width:100%;">'
504                                 . '<tr>'
505                                 . '<td style="width:30%;border-bottom: solid 1px #333;font-size:10px;font-weight:bold;color:#666;"><i>'
506                                 . $dateOfPrint . '</i></td>'
507                                 . '<td style="width:5%">&nbsp;</td>'
508                                 . '<td style="width:30%;border-bottom: solid 1px #333;font-size:10px;font-weight:bold;color:#666;"><i>'
509                                 . $printedBy . '</i></td>'
510                                 . '<td style="width:5%">&nbsp;</td>'
511                                 . '<td style="width:30%;border-bottom: solid 1px #333;font-size:10px;font-weight:bold;color:#666;"><i>'
512                                 . $referenceNo . '</i></td>'
513                                 . '</tr>'
514                                 . '</table>'
515                                 . '</div>'
516                                 );
517
518
519
520
521                 /* --------------------------------- TERMS AND CONDITIONS --------------------------------- */
522                 #-> Terms and Conditions.
523                 if ($this->showTermsAndConditions)
524                 {
525                         $this->nextPage();
526                         $this->append('<br/>');
527
528                         $table = $this->newTable(
529                                         array(90, 10),
530                                         'padding:0;margin:0;font-size:9px;',
531                                         '',
532                                         'padding:2px 3px 2px 0;margin:0;'
533                         );
534                         $type = $this->jobRecord->type;
535                         $table
536                                 ->addTitle('Terms and Conditions', 'padding:0 0 10px 0;font-weight:bold;font-size:11px;', 0, 1)
537                                 ->addKeyValueDataSet(array(
538                                                 'I acknowledge, confirm and agree that:' => '',
539                                                 '1. Ownership' => '',
540                                                 '1.1. I am the owner of my trade-in vehicle and I am legally allowed to sell my trade-in vehicle.' => 'Yes / No',
541                                                 '1.2. I am a South African resident.' => 'Yes / No',
542                                                 '1.3. My trade-in vehicle is not subject to a claim of any nature whatsoever by any other person or entity and I '
543                                                 . 'indemnify the Dealer against any claims of any ' => 'Yes / No',
544                                                 '1.4. If my trade-in vehicle is subject to any claim by any other person or entity, the Dealer will not be bound '
545                                                 . 'to this valuation.' => 'Yes / No',
546                                                 '2. VAT Registration' => '',
547                                                 'This transaction is subject to the payment of VAT.' => 'Yes / No',
548                                                 '3. Status of the Vehicle' => '',
549                                                 '3.1. My trade-in vehicle was new when I purchased it.' => 'Yes / No',
550                                                 '3.2. My trade-in vehicle has been used for self-drive hire or taxi work.' => 'Yes / No',
551                                                 '3.3. My trade-in vehicle has a full service history.' => 'Yes / No',
552                                                 '3.4. My trade in vehicle has not been involved in any accident.' => 'Yes / No',
553                                                 '3.5. If my trade-in vehicle has been involved in an accident, there was a total loss claim made (Stolen & Recovered).' => 'Yes / No',
554                                                 '3.6. A current registration paper has been handed over by me.' => 'Yes / No',
555                                                 '3.7. I have supplied the owners and service manuals to the Dealer.' => 'Yes / No',
556                                                 '3.8. My trade-in vehicle is subject to a service and/or maintenance plan and/or warranty.' => 'Yes / No',
557                                                 '4. Status of the Vehicle' => '',
558                                                 'The Dealer will only be bound by its appraised trade-in value of my trade-in vehicle as far as the trade-in has '
559                                                 . 'been approved and accepted in writing by either the dealer principle, designated sales manager or used car manager'
560                                                 . ' and the parties have entered into the Dealer\'s standard Offer to Purchase in respect of my trade-in vehicle.' => '',
561                                                 '5. Outstanding Finance' => '',
562                                                 '5.1. The Dealer, in its absolute and sole discretion, may agree to settle the existing finance in lieu of payment '
563                                                 . '(or part payment) of the trade-in vehicle to me.' => '',
564                                                 '5.2. If the agreed trade-in allowance of the trade-in vehicle is lower than the settlement figure in clause 5.1 above, '
565                                                 . 'I must pay the Registered Credit Provider the difference between the settlement figure and the trade-in allowance with '
566                                                 . 'proof of such payment (made to the registered Credit Provider) submitted to the Dealer prior to the signing of the Offer to Purchase.' => '',
567                                                 '5.3. I will remain liable to the registered Credit Provider in respect of the related finance at all times until the '
568                                                 . 'credit Agreement has been legally terminated.' => '',
569                                                 '5.4. For purposes of clarity, the Dealer does not accept any liability with respect to the related finance set out in '
570                                                 . 'clause 5.4 above at any time or for any reason.' => '',
571                                                 '5.5. The Dealer will use its best endeavors to pay the trade-in allowance to the registered Credit Provider as soon as '
572                                                 . 'is reasonably possible. However the Dealer accepts no liability for any costs or liability incurred by me as a result '
573                                                 . 'of any delay in the payment by the Dealer.' => '',
574                                                 '6. No Financial Advice' => '',
575                                                 'This trade-in valuation does not constitute financial advice to me as contemplated in the Financial Advisory and '
576                                                 . 'Intermediary Services Act 37 of 2002 but is subject to the Consumer Protection Act 68 of 2008.' => '',
577                                                 '7. Risk' => '',
578                                                 'The risk of damage or loss in and to the trade-in vehicle will pass from me to the Dealer only once the Dealer has '
579                                                 . 'taken possession of my trade-in vehicle and has received the proper documentation from me to enable it to re-register my trade-in vehicle.' => '',
580                                                 '8. The Dealer\'s right to withdraw from the offer' => '',
581                                                 'The Dealer is bound by this offer only in so far as:' => '',
582                                                 '8.1. I have signed an Offer to Purchase with the same Dealer in respect of this valuation; and' => '',
583                                                 '8.2. Fewer than 7 (seven) days have passed since the issuing of this valuation; and' => '',
584                                                 '8.3. My trade-in vehicle is in the same condition as the date of inspection; and' => '',
585                                                 '8.4. This trade-in valuation was signed by the Valuator and the Manager of the Dealer.' => '',
586                                                 '&nbsp;<br />&nbsp;' => '',
587                                                 'I HAVE READ THE ABOVE TERMS AND CONDITIONS AND CONFIRM MY UNDERSTANDING AND AGREE TO BE BOUND THERETO.' => '',
588                                                 '&nbsp;<br />&nbsp;' => '',
589                                                 'Acceptance' => '',
590                                                 'By signing this form, I agree to the [Dealership Name] valuation terms and conditions above.' => '',
591                                                 '&nbsp;<br />&nbsp;<br />&nbsp;<br />&nbsp;<br />&nbsp;<br />' => '',
592                                                 '<b>Signature:</b>' => '',
593                                                 '&nbsp;' => '',
594                                                 'Date: ' . date('Y-m-d') => ''
595                                 ), 0, 'color:#333;', 'color:#000;');
596                         $this->append($table->publish() . '<br />');
597
598                         $this->append(
599                                         '<div style="position:absolute;bottom:0;left:0;padding:0;margin:0;width:100%;">'
600                                         . '<table cellpadding="0px" cellspacing="0px" style="border:0px;width:100%;">'
601                                         . '<tr>'
602                                         . '<td style="width:30%;border-bottom: solid 1px #333;font-size:10px;font-weight:bold;color:#666;"><i>'
603                                         . $dateOfPrint . '</i></td>'
604                                         . '<td style="width:5%">&nbsp;</td>'
605                                         . '<td style="width:30%;border-bottom: solid 1px #333;font-size:10px;font-weight:bold;color:#666;"><i>'
606                                         . $printedBy . '</i></td>'
607                                         . '<td style="width:5%">&nbsp;</td>'
608                                         . '<td style="width:30%;border-bottom: solid 1px #333;font-size:10px;font-weight:bold;color:#666;"><i>'
609                                         . $referenceNo . '</i></td>'
610                                         . '</tr>'
611                                         . '</table>'
612                                         . '</div>'
613                         );
614                 }
615
616                 return;
617         }
618
619
620 }