5 class Admin extends \Utility\Service\PdfTemplate
12 protected $_title = 'Stock Information';
15 * @var \Stock\Entity\Stock
22 protected $showTradeDataOnly = true;
27 protected $showCustomerDetails = false;
32 protected $showValuationDetails = false;
37 protected $showMainImage = true;
42 protected $showPricingDetails = true;
47 protected $showVehicleDetails = true;
52 protected $showVehicleNotes = true;
57 protected $showDamageDetails = true;
62 protected $showAccessoryDetails = true;
67 protected $showSignatureLines = false;
72 protected $showTermsAndConditions = false;
77 protected $showOffersReceived = true;
82 protected $showOfferMade = true;
85 * Utility for easy parameter retrieval.
86 * @param string $param
87 * @param unknown $default
90 protected function getStockParam($param, $default)
92 return !is_null($this->jobRecord->$param) ? $this->jobRecord->$param : $default;
96 * Utility for easy parameter retrieval.
97 * @param string $param
98 * @param unknown $default
101 protected function getStockSubParam($ref, $param, $default)
103 $ref = !is_null($this->jobRecord->$ref) ? $this->jobRecord->$ref : null;
104 return is_object($ref) ? $ref->$param : $default;
108 * Utility for easy parameter retrieval.
109 * @param string $param
110 * @param unknown $default
113 protected function getValuationParam($param, $default)
115 return !is_null($this->jobRecord->valuation) && !is_null($this->jobRecord->valuation->$param) ? $this->jobRecord->valuation->$param : $default;
121 public function build()
123 #-> Set data item to work with.
124 $this->auctionRecord = $this->_input['jobRecord'];
125 $this->jobRecord = $this->_input['jobRecord']->stock;
126 $dateTimeFormat = \Utility\Definitions\Locale::getDateTimeFormat();
127 $currencyPrefix = \Utility\Definitions\Locale::getCurrencyPrefix();
128 $authData = \Utility\Registry::getAuthData();
129 $dateOfPrint = 'Date of print: <span style="color:#333;">' . date('Y-m-d H:i:s') . '</span>';
130 $printedBy = 'Printed by: <span style="color:#333;">' . $authData['firstName']
131 . ' ' . $authData['familyName'] . '</span>';
132 $referenceNo = 'Reference no.: <span style="color:#333;">' . $this->jobRecord->referenceNumber . '</span>';
135 \Utility\Debug::errorLog('jobrecord' , $this->jobRecord->jobState);
136 /* --------------------------------- CUSTOMER, VALUATION, PRICING --------------------------------- */
137 $type = $this->jobRecord->type;
139 '<br /><div style="font-size:16px;font-weight:bold;">'
140 . $type->model->make->name . ' '
141 . $type->model->name . ' '
143 . $type->introYear->name . ' - '
144 . (!is_null($type->discYear) ? $type->discYear->name : 'Current') . ')'
145 . '</div><hr /><br />'
149 /* --------------------------------- CUSTOMER, VALUATION, PRICING --------------------------------- */
151 $customerDetail = ' ';
152 if ($this->showCustomerDetails)
154 $table = $this->newTable(
155 array(60, 40), 'padding:0;margin:0;font-size:10px;', '',
156 'padding:2px 3px 2px 0;margin:0;'
158 $department = $this->getValuationParam('department', null);
159 $department = !is_null($department) ? $department : ' ';
161 ->addTitle('Customer',
162 'padding:0 0 10px 0;font-weight:bold;font-size:11px;', 0, 1)
163 ->addKeyValueDataSet(array(
164 'Customer name:' => $this->getValuationParam('firstName', ''),
165 'Customer surname:' => $this->getValuationParam('familyName', ''),
166 'ID:' => $this->getValuationParam('idNumber', ''),
167 'Mobile:' => $this->getValuationParam('mobile', ''),
168 'Email:' => $this->getValuationParam('email', ''),
169 'Department:' => $department,
170 'Address:' => ' ',
171 '<span style="color:#FFF;font-size:20px;">a1</span>' => ' ',
172 '<span style="color:#FFF;font-size:10px;">1</span><span style="color:#000;font-size:10px;">______________________________________</span>' => ' ',
173 '<span style="color:#FFF;font-size:20px;">a</span>' => ' ',
174 '<span style="color:#FFF;font-size:10px;">2</span><span style="color:#000;font-size:10px;">______________________________________</span>' => ' ',
175 '<span style="color:#FFF;font-size:20px;">b</span>' => ' ',
176 '<span style="color:#FFF;font-size:10px;">3</span><span style="color:#000;font-size:10px;">______________________________________</span>' => ' '
177 ), 0, 'font-weight:bold;', 'color:#666;');
178 $customerDetail = $table->publish();
180 #-> Customer alternated with dealership details for traders.
181 if ($this->showTradeDataOnly)
183 $table = $this->newTable(
184 array(60, 40), 'padding:0;margin:0;font-size:10px;', '',
185 'padding:2px 3px 2px 0;margin:0;'
187 $department = $this->getValuationParam('department', null);
188 $department = !is_null($department) ? $department : ' ';
189 $contact = $this->getStockSubParam('company', 'contact', null);
191 ->addTitle('Dealership',
192 'padding:0 0 10px 0;font-weight:bold;font-size:11px;', 0, 1)
193 ->addKeyValueDataSet(array(
194 'Dealership name:' => $this->getStockSubParam('company', 'name', ''),
195 'Contact:' => !is_null($contact) ? $contact->firstName . ' ' . $contact->familyName : '',
196 'Mobile:' => !is_null($contact) ? $contact->mobile : '',
197 'Email:' => !is_null($contact) ? $contact->email : ''
198 ), 0, 'font-weight:bold;', 'color:#666;');
199 $customerDetail = $table->publish();
203 $valuationDetail = ' ';
204 if ($this->showValuationDetails)
206 $table = $this->newTable(
207 array(55, 45), 'padding:0;margin:0;font-size:10px;', '',
208 'padding:2px 3px 2px 0;margin:0;'
211 ->getRepository('\Auction\Entity\Auction')
212 ->findOneBy(array('stock' => $this->jobRecord));
213 $pgLoaded = !is_null($pgItem) ? $pgItem->created->format($dateTimeFormat) : ' ';
214 $valCreated = $this->getValuationParam('created', null);
215 $valCreated = !is_null($valCreated) ? $valCreated->format($dateTimeFormat) : ' ';
217 ->addTitle('Valuation details',
218 'padding:0 0 10px 0;font-weight:bold;font-size:11px;', 0, 1)
219 ->addKeyValueDataSet($this->showTradeDataOnly ? array(
220 'Date created:' => $valCreated,
221 'Date loaded on price guide:' => $pgLoaded
223 'Date created:' => $valCreated,
224 'Valuation no.:' => $this->getValuationParam('valuationNumber', ''),
225 'Reference no.:' => $this->getStockParam('referenceNumber', ''),
226 'Date loaded on price guide:' => $pgLoaded
227 ), 0, 'font-weight:bold;', 'color:#F00;');
228 $valuationDetail = $table->publish();
230 $mainImage = ' ';
231 if ($this->showMainImage)
233 $pic = $this->getStockParam('mainImage', '');
236 $mainImage = '<img src="' . __DIR__ . '/../../../../../public/img/bin/' . $pic->filename . '" style="padding:0;margin:0;width:100%;" />';
241 $pricingDetail = ' ';
242 $total = $this->getValuationParam('overAllowance', '0.00') + $this->getValuationParam('amountOffered',
244 $total = number_format($total, 2, '.', '');
245 if ($this->showPricingDetails)
247 $table = $this->newTable(
248 array(60, 40), 'padding:0;margin:0;font-size:10px;', '',
249 'padding:2px 3px 2px 0;margin:0;'
252 ->addTitle('Pricing details',
253 'padding:0 0 10px 0;font-weight:bold;font-size:11px;', 0, 1)
254 ->addKeyValueDataSet($this->showTradeDataOnly ? array(
255 'Trade:' => $currencyPrefix . $this->getStockParam('tradePrice',
257 'Retail:' => $currencyPrefix . $this->getStockParam('retailPrice',
259 'List:' => $currencyPrefix . $this->getStockParam('listPrice',
261 'Reserve price:' => $currencyPrefix . $this->auctionRecord->reservePrice,
262 'Highest bid:' => $currencyPrefix . $this->getStockParam('highestBid',
267 /* 'Amount offered:' => $currencyPrefix . $this->getValuationParam('amountOffered', '0.00'), */
268 /* 'O.A.:' => $currencyPrefix . $this->getValuationParam('overAllowance', '0.00'), */
269 /* 'Total offer:' => $currencyPrefix . $total, // total offer = amount offered + O.A */
271 'Trade:' => $currencyPrefix . $this->getStockParam('tradePrice',
273 'Retail:' => $currencyPrefix . $this->getStockParam('retailPrice',
275 'List:' => $currencyPrefix . $this->getStockParam('listPrice',
277 'Amount offered:' => $currencyPrefix . $this->getValuationParam('amountOffered',
279 'O.A.:' => $currencyPrefix . $this->getValuationParam('overAllowance',
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',
286 ), 0, 'font-weight:bold;', 'color:#F00;');
287 $pricingDetail = $table->publish();
290 #-> First row of data-blocks.
291 if ($this->showCustomerDetails || $this->showValuationDetails || $this->showMainImage || $this->showPricingDetails)
295 array(30, 5, 30, 5, 30),
296 'margin:0;font-size:10px;vertical-align:top;', '',
297 'padding:10px 0 0 0;'
299 ->setCellValue(0, 0, $customerDetail)
300 ->setCellValue(0, 2, $pricingDetail)
301 ->setCellValue(0, 4, $valuationDetail . $mainImage);
302 $this->append($container->publish() . '<br />');
305 /* --------------------------------- Buyer Details --------------------------------- */
308 $table = $this->newTable(
309 array(30, 30), 'padding:0;margin:0;font-size:10px;', '',
310 'padding:2px 3px 2px 0;margin:0;'
314 ->addTitle('Buyers Details',
315 'padding:0 0 10px 0;font-weight:bold;font-size:11px;', 0, 1)
316 ->addKeyValueDataSet(array(
317 'Dealership name:' => $this->auctionRecord->soldToCompany->name,
318 'Contact:' => !is_null($this->auctionRecord->soldToProfile) ? $this->auctionRecord->soldToProfile->firstName . ' ' . $this->auctionRecord->soldToProfile->familyName : '',
319 'Mobile:' => !is_null($this->auctionRecord->soldToProfile) ? $this->auctionRecord->soldToProfile->mobile : '',
320 'Email:' => !is_null($this->auctionRecord->soldToProfile) ? $this->auctionRecord->soldToProfile->email : ''
321 ), 0, 'font-weight:bold;', 'color:#666;');
322 $buyerDetails = $table->publish();
324 $this->append($buyerDetails . '<br />');
328 /* --------------------------------- VEHICLE, DAMAGES, ACCESSORIES --------------------------------- */
331 $vehicleDetail = ' ';
332 if ($this->showVehicleDetails)
334 $keys = $this->getStockParam('spareKeys', null);
341 $keys = $keys ? 'Yes' : 'No';
343 $table = $this->newTable(
344 array(55, 45), 'padding:0;margin:0;font-size:10px;', '',
345 'padding:2px 3px 2px 0;margin:0;'
348 ->addTitle('Vehicle specifications',
349 'padding:0 0 10px 0;font-weight:bold;font-size:11px;', 0, 1)
350 ->addKeyValueDataSet(array(
351 'Year:' => $this->getStockSubParam('vehicleYear', 'name', ''),
352 'Category:' => $type->category->name,
353 'Make:' => $type->model->make->name,
354 'Model:' => $type->model->name,
355 'Type:' => $type->name,
356 'Registration no.:' => $this->getStockParam('registrationNumber', ''),
357 'Fuel type:' => $this->getStockSubParam('fuelType', 'name', ''),
358 'Transmission type:' => $this->getStockSubParam('transmissionType',
360 'VIN no.:' => $this->getStockParam('vinNumber', ''),
361 'Engine no.:' => $this->getStockParam('engineNumber', ''),
362 'MM code:' => $type->mmCode,
363 'Kms:' => $this->getStockParam('km', ''),
364 'Condition:' => $this->getStockSubParam('condition', 'name', ''),
365 'Main exterior colour:' => $this->getStockSubParam('exteriorColour',
367 'Main interior colour:' => $this->getStockSubParam('interiorColour',
369 'Upholstery:' => $this->getStockSubParam('upholstery', 'name', ''),
370 'Papers:' => $this->getStockSubParam('papers', 'name', ''),
371 'Papers comments:' => $this->getStockParam('papersNotes', ''),
372 'Natis:' => $this->getStockSubParam('natis', 'name', ''),
373 'Spare keys:' => $keys,
374 'FSH:' => $this->getStockSubParam('fullServiceHistory', 'name', ''),
375 'FSH comments:' => $this->getStockParam('fshNotes', ''),
376 'Stock number:' => $this->getStockParam('stockNumber', '')
377 ), 0, '', 'color:#666;');
378 $vehicleDetail = $table->publish();
382 $damagesDetail = ' ';
383 if ($this->showDamageDetails)
385 $damageData = array();
386 $damages = $this->jobRecord->damagesToArray();
387 foreach ($damages as $damage)
389 $damageData[$damage['damage']['name'] . ':'] = $currencyPrefix . $damage['amount'];
391 $damageData['Total estimated repair cost:'] = '<span style="color:#F00;">' . $currencyPrefix . $this->getStockParam('damageTotal',
393 $damageData['Damages comments:'] = $this->getStockParam('damageNotes', '');
394 $damageData['Previous repairs noted:'] = $this->getStockParam('previousRepairsNoted',
395 false) ? 'Yes' : 'No';
396 $damageData['Previous repairs comments:'] = $this->getStockParam('previousRepairsNotes',
398 $table = $this->newTable(
399 array(50, 50), 'padding:0;margin:0;font-size:10px;', '',
400 'padding:2px 3px 2px 0;margin:0;'
402 $type = $this->jobRecord->type;
404 ->addTitle('Damages',
405 'padding:0 0 10px 0;font-weight:bold;font-size:11px;', 0, 1)
406 ->addKeyValueDataSet($damageData, 0, '', 'color:#666;');
407 $damagesDetail = $table->publish();
411 $accessoriesDetail = ' ';
412 if ($this->showAccessoryDetails)
416 $accessories = $this->jobRecord->accessoriesToArray();
417 foreach ($accessories as $accessory)
419 $accs[] = $accessory['accessory']['name'];
423 for ($i = 0; $i <= count($accs); $i += 2)
425 if (isset($accs[$i]))
427 $accData[$accs[$i]] = isset($accs[$i + 1]) ? $accs[$i + 1] : '';
431 $accData['<span style="color:#000;font-size:10px;">Comments:</span>'] = '<span style="color:#666;font-size:10px;">' . $this->getStockParam('accessoryNotes',
433 $table = $this->newTable(
434 array(50, 50), 'padding:0;margin:0;font-size:9px;', '',
435 'padding:2px 3px 2px 0;margin:0;'
437 $type = $this->jobRecord->type;
439 ->addTitle('Accessories',
440 'padding:0 0 10px 0;font-weight:bold;font-size:11px;', 0, 1)
441 ->addKeyValueDataSet($accData, 0, 'color:#666;', 'color:#666;');
442 $accessoriesDetail = $table->publish();
445 #-> Second row of data-blocks.
446 if ($this->showVehicleDetails || $this->showDamageDetails || $this->showAccessoryDetails)
450 array(30, 5, 30, 5, 30),
451 'margin:0;font-size:10px;vertical-align:top;', '',
452 'padding:10px 0 0 0;'
454 ->setCellValue(0, 0, $vehicleDetail)
455 ->setCellValue(0, 2, $damagesDetail)
456 ->setCellValue(0, 4, $accessoriesDetail);
457 $this->append($container->publish() . '<br />');
460 /* --------------------------------- VEHICLE NOTES --------------------------------- */
462 $VehicleNotes = ' ';
463 if ($this->showVehicleNotes)
465 $table = $this->newTable(
466 array(55, 45), 'padding:0;margin:0;font-size:10px;', '',
467 'padding:15px 15px 15px 0;margin:0;'
471 '1______________________________________________________________________________________________________________________________________' => ' ',
472 '2______________________________________________________________________________________________________________________________________' => ' ',
473 '3______________________________________________________________________________________________________________________________________' => ' '
478 'padding:0 0 10px 0;font-weight:bold;font-size:11px;', 0, 1)
479 ->addKeyValueDataSet($dSet, 0, '', 'color:#666;');
480 $VehicleNotes = $table->publish();
482 #-> Third row of data-blocks.
483 if ($this->showVehicleNotes)
487 array(30, 5, 30, 5, 30),
488 'margin:0;font-size:10px;vertical-align:top;', '',
489 'padding:10px 0 0 0;'
491 ->setCellValue(0, 0, $VehicleNotes);
492 $this->append($container->publish() . '<br />');
499 /* --------------------------------- SIGNATURES --------------------------------- */
501 if ($this->showSignatureLines)
504 $this->newSignatureLine()
505 ->addSignatureLine('Customer (name)', 'Signature', 'Date')
506 ->addSignatureLine('Manager (name)', 'Signature', 'Date')
512 '<div style="position:absolute;bottom:0;left:0;padding:0;margin:0;width:100%;">'
513 . '<table cellpadding="0px" cellspacing="0px" style="border:0px;width:100%;">'
515 . '<td style="width:30%;border-bottom: solid 1px #333;font-size:10px;font-weight:bold;color:#666;"><i>'
516 . $dateOfPrint . '</i></td>'
517 . '<td style="width:5%"> </td>'
518 . '<td style="width:30%;border-bottom: solid 1px #333;font-size:10px;font-weight:bold;color:#666;"><i>'
519 . $printedBy . '</i></td>'
520 . '<td style="width:5%"> </td>'
521 . '<td style="width:30%;border-bottom: solid 1px #333;font-size:10px;font-weight:bold;color:#666;"><i>'
522 . $referenceNo . '</i></td>'
531 /* --------------------------------- TERMS AND CONDITIONS --------------------------------- */
532 #-> Terms and Conditions.
533 if ($this->showTermsAndConditions)
536 $this->append('<br/>');
538 $table = $this->newTable(
539 array(90, 10), 'padding:0;margin:0;font-size:9px;', '',
540 'padding:2px 3px 2px 0;margin:0;'
542 $type = $this->jobRecord->type;
544 ->addTitle('Terms and Conditions',
545 'padding:0 0 10px 0;font-weight:bold;font-size:11px;', 0, 1)
546 ->addKeyValueDataSet(array(
547 'I acknowledge, confirm and agree that:' => '',
548 '1. Ownership' => '',
549 '1.1. I am the owner of my trade-in vehicle and I am legally allowed to sell my trade-in vehicle.' => 'Yes / No',
550 '1.2. I am a South African resident.' => 'Yes / No',
551 '1.3. My trade-in vehicle is not subject to a claim of any nature whatsoever by any other person or entity and I '
552 . 'indemnify the Dealer against any claims of any ' => 'Yes / No',
553 '1.4. If my trade-in vehicle is subject to any claim by any other person or entity, the Dealer will not be bound '
554 . 'to this valuation.' => 'Yes / No',
555 '2. VAT Registration' => '',
556 'This transaction is subject to the payment of VAT.' => 'Yes / No',
557 '3. Status of the Vehicle' => '',
558 '3.1. My trade-in vehicle was new when I purchased it.' => 'Yes / No',
559 '3.2. My trade-in vehicle has been used for self-drive hire or taxi work.' => 'Yes / No',
560 '3.3. My trade-in vehicle has a full service history.' => 'Yes / No',
561 '3.4. My trade in vehicle has not been involved in any accident.' => 'Yes / No',
562 '3.5. If my trade-in vehicle has been involved in an accident, there was a total loss claim made (Stolen & Recovered).' => 'Yes / No',
563 '3.6. A current registration paper has been handed over by me.' => 'Yes / No',
564 '3.7. I have supplied the owners and service manuals to the Dealer.' => 'Yes / No',
565 '3.8. My trade-in vehicle is subject to a service and/or maintenance plan and/or warranty.' => 'Yes / No',
566 '4. Status of the Vehicle' => '',
567 'The Dealer will only be bound by its appraised trade-in value of my trade-in vehicle as far as the trade-in has '
568 . 'been approved and accepted in writing by either the dealer principle, designated sales manager or used car manager'
569 . ' and the parties have entered into the Dealer\'s standard Offer to Purchase in respect of my trade-in vehicle.' => '',
570 '5. Outstanding Finance' => '',
571 '5.1. The Dealer, in its absolute and sole discretion, may agree to settle the existing finance in lieu of payment '
572 . '(or part payment) of the trade-in vehicle to me.' => '',
573 '5.2. If the agreed trade-in allowance of the trade-in vehicle is lower than the settlement figure in clause 5.1 above, '
574 . 'I must pay the Registered Credit Provider the difference between the settlement figure and the trade-in allowance with '
575 . 'proof of such payment (made to the registered Credit Provider) submitted to the Dealer prior to the signing of the Offer to Purchase.' => '',
576 '5.3. I will remain liable to the registered Credit Provider in respect of the related finance at all times until the '
577 . 'credit Agreement has been legally terminated.' => '',
578 '5.4. For purposes of clarity, the Dealer does not accept any liability with respect to the related finance set out in '
579 . 'clause 5.4 above at any time or for any reason.' => '',
580 '5.5. The Dealer will use its best endeavors to pay the trade-in allowance to the registered Credit Provider as soon as '
581 . 'is reasonably possible. However the Dealer accepts no liability for any costs or liability incurred by me as a result '
582 . 'of any delay in the payment by the Dealer.' => '',
583 '6. No Financial Advice' => '',
584 'This trade-in valuation does not constitute financial advice to me as contemplated in the Financial Advisory and '
585 . 'Intermediary Services Act 37 of 2002 but is subject to the Consumer Protection Act 68 of 2008.' => '',
587 '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 '
588 . '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.' => '',
589 '8. The Dealer\'s right to withdraw from the offer' => '',
590 'The Dealer is bound by this offer only in so far as:' => '',
591 '8.1. I have signed an Offer to Purchase with the same Dealer in respect of this valuation; and' => '',
592 '8.2. Fewer than 7 (seven) days have passed since the issuing of this valuation; and' => '',
593 '8.3. My trade-in vehicle is in the same condition as the date of inspection; and' => '',
594 '8.4. This trade-in valuation was signed by the Valuator and the Manager of the Dealer.' => '',
595 ' <br /> ' => '',
596 'I HAVE READ THE ABOVE TERMS AND CONDITIONS AND CONFIRM MY UNDERSTANDING AND AGREE TO BE BOUND THERETO.' => '',
597 ' <br /> ' => '',
599 'By signing this form, I agree to the [Dealership Name] valuation terms and conditions above.' => '',
600 ' <br /> <br /> <br /> <br /> <br />' => '',
601 '<b>Signature:</b>' => '',
603 'Date: ' . date('Y-m-d') => ''
604 ), 0, 'color:#333;', 'color:#000;');
605 $this->append($table->publish() . '<br />');
608 '<div style="position:absolute;bottom:0;left:0;padding:0;margin:0;width:100%;">'
609 . '<table cellpadding="0px" cellspacing="0px" style="border:0px;width:100%;">'
611 . '<td style="width:30%;border-bottom: solid 1px #333;font-size:10px;font-weight:bold;color:#666;"><i>'
612 . $dateOfPrint . '</i></td>'
613 . '<td style="width:5%"> </td>'
614 . '<td style="width:30%;border-bottom: solid 1px #333;font-size:10px;font-weight:bold;color:#666;"><i>'
615 . $printedBy . '</i></td>'
616 . '<td style="width:5%"> </td>'
617 . '<td style="width:30%;border-bottom: solid 1px #333;font-size:10px;font-weight:bold;color:#666;"><i>'
618 . $referenceNo . '</i></td>'
625 /* --------------------------------- OFFERS RECEIVED/MADE --------------------------------- */
627 if ($this->showOffersReceived || $this->showOfferMade)
631 if ($this->showOffersReceived)
635 ->getRepository('\PriceGuide\Entity\PriceGuide')
636 ->findBy(array('stock' => $this->jobRecord));
637 if (!empty($pgItems))
639 foreach ($pgItems as $pgItem)
641 $iterator = $pgItem->offers->getIterator();
642 foreach ($iterator as $offer)
644 $status = $offer->status;
646 $offer->company->name,
647 $offer->created->format($dateTimeFormat),
648 $currencyPrefix . $offer->amount,
649 $offer->profile->mobile,
650 $offer->profile->email,
657 $this->append('<br/>');
658 $table = $this->newTable(
659 array(20, 15, 15, 10, 30, 10),
660 'padding:0;margin:0;font-size:10px;',
662 'padding:2px 5px 2px 2px;margin:0;'
665 ->addTitle('Offers received', 'padding:0 0 10px 0;font-weight:bold;font-size:11px;', 0, 1)
666 ->setColumnHeaders(array(
667 'Buyer', 'Date', 'Offer', 'Mobile', 'Email', 'Status'
668 ), array(20, 15, 15, 10, 30, 10),
669 'padding:2px 2px 2px 5px;background-color:#F00;color:#FFF;font-weight:bold;font-size:10px;')
670 ->setDataSet($offers);
671 $this->append($table->publish() . '<br />');
674 '<div style="position:absolute;bottom:0;left:0;padding:0;margin:0;width:100%;">'
675 . '<table cellpadding="0px" cellspacing="0px" style="border:0px;width:100%;">'
677 . '<td style="width:30%;border-bottom: solid 1px #333;font-size:10px;font-weight:bold;color:#666;"><i>'
678 . $dateOfPrint . '</i></td>'
679 . '<td style="width:5%"> </td>'
680 . '<td style="width:30%;border-bottom: solid 1px #333;font-size:10px;font-weight:bold;color:#666;"><i>'
681 . $printedBy . '</i></td>'
682 . '<td style="width:5%"> </td>'
683 . '<td style="width:30%;border-bottom: solid 1px #333;font-size:10px;font-weight:bold;color:#666;"><i>'
684 . $referenceNo . '</i></td>'
694 if ($this->showOfferMade)
698 ->getRepository('\PriceGuide\Entity\PriceGuide')
699 ->findOneBy(array('stock' => $this->jobRecord));
700 if (!is_null($pgItem))
702 $companyId = \Utility\Registry::resolveCompanyContext();
703 $iterator = $pgItem->offers->getIterator();
704 foreach ($iterator as $offer)
706 $status = $offer->status;
708 $offer->company->name,
709 $offer->created->format($dateTimeFormat),
710 $currencyPrefix . $offer->amount,
711 $offer->profile->mobile,
712 $offer->profile->email,
717 $table = $this->newTable(
718 array(20, 15, 15, 10, 30, 10),
719 'padding:0;margin:0;font-size:10px;',
721 'padding:2px 5px 2px 2px;margin:0;'
725 $this->append('<br/>');
727 ->addTitle('Offers made', 'padding:0 0 10px 0;font-weight:bold;font-size:11px;', 0, 1)
728 ->setColumnHeaders(array(
729 'Buyer', 'Date', 'Offer', 'Mobile', 'Email', 'Status'
730 ), array(20, 15, 15, 10, 30, 10),
731 'padding:2px 2px 2px 5px;background-color:#F00;color:#FFF;font-weight:bold;font-size:10px;')
732 ->setDataSet($offers);
733 $this->append($table->publish() . '<br />');
736 '<div style="position:absolute;bottom:0;left:0;padding:0;margin:0;width:100%;">'
737 . '<table cellpadding="0px" cellspacing="0px" style="border:0px;width:100%;">'
739 . '<td style="width:30%;border-bottom: solid 1px #333;font-size:10px;font-weight:bold;color:#666;"><i>'
740 . $dateOfPrint . '</i></td>'
741 . '<td style="width:5%"> </td>'
742 . '<td style="width:30%;border-bottom: solid 1px #333;font-size:10px;font-weight:bold;color:#666;"><i>'
743 . $printedBy . '</i></td>'
744 . '<td style="width:5%"> </td>'
745 . '<td style="width:30%;border-bottom: solid 1px #333;font-size:10px;font-weight:bold;color:#666;"><i>'
746 . $referenceNo . '</i></td>'
758 /* --------------------------------- BID HISTORY --------------------------------- */
760 $table = $this->newTable(
761 array(20, 15, 10, 10, 20, 15, 10), 'padding:0;margin:0;font-size:10px;',
762 '', 'padding:2px 3px 2px 0;margin:0;'
766 ->addTitle('Bid History',
767 'padding:0 0 10px 0;font-weight:bold;font-size:11px;', 0, 1);
769 $table->setColumnHeaders(array(
777 ), array(20, 15, 10, 10, 20, 15, 10), 'font-weight: bold; color: #ffffff; background-color: #D42E30;');
780 foreach ($this->auctionRecord->bids as $bid)
784 $bid->profile->firstName . ' ' . $bid->profile->familyName,
786 $bid->profile->mobile,
787 $bid->profile->email,
788 $bid->created->format('Y-m-d H:i:s'),
793 $table->setDataSet($data);
796 $bidHistory = $table->publish();
798 //do not show the bid history if a vehicle is sold.
799 if('Sold' !== $this->jobRecord->jobState)
800 $this->append($bidHistory . '<br />');