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