6 class Declaration extends \Utility\Service\PdfTemplate
9 protected function getStockParam($param, $default)
11 return !is_null($this->jobRecord->stock->$param)
12 ? $this->jobRecord->stock->$param
17 * Utility for easy parameter retrieval.
18 * @param string $param
19 * @param unknown $default
22 protected function getStockSubParam($ref, $param, $default)
24 $ref = !is_null($this->jobRecord->stock->$ref)
25 ? $this->jobRecord->stock->$ref
27 return is_object($ref)
33 * Utility for easy parameter retrieval.
34 * @param string $param
35 * @param unknown $default
38 protected function getValuationParam($param, $default)
40 return !is_null($this->jobRecord->stock->valuation)
41 && !is_null($this->jobRecord->stock->valuation->$param)
42 ? $this->jobRecord->stock->valuation->$param
50 public function build()
52 #-> Set data item to work with.
53 $this->jobRecord = $this->_input['jobRecord'];
54 $dateTimeFormat = \Utility\Definitions\Locale::getDateTimeFormat();
55 $dateFormat = \Utility\Definitions\Locale::getDateFormat();
56 $currencyPrefix = \Utility\Definitions\Locale::getCurrencyPrefix();
57 $authData = \Utility\Registry::getAuthData();
59 $auctionDate = $this->jobRecord->endDate->format($dateFormat);
60 $dateOfPrint = 'Date of print: <span style="color:#333;">' . date('Y-m-d H:i:s') . '</span>';
61 $printedBy = 'Printed by: <span style="color:#333;">' . $authData['firstName']
62 . ' ' . $authData['familyName'] . '</span>';
63 $referenceNo = 'Reference no.: <span style="color:#333;">' . $this->jobRecord->stock->referenceNumber . '</span>';
65 /* --------------------------------- Buyer & Seller details --------------------------------- */
66 #-> Buyer & Seller details
67 $table = $this->newTable(
69 'padding:0;margin:0;font-size:10px;',
71 'padding:2px 3px 2px 0;margin:0;'
74 ->addTitle('Buyer', 'padding:0 0 10px 0;font-weight:bold;font-size:11px;', 0, 1)
75 ->addKeyValueDataSet(array(
76 'Buyer dealership:' => $this->jobRecord->soldToCompany->name,
77 'Buyer name:' => $this->jobRecord->soldToCompany->contact->firstName,
78 'Buyer surname:' => $this->jobRecord->soldToCompany->contact->familyName,
79 'Buyer Mobile:' => $this->jobRecord->soldToCompany->contact->mobile,
80 'Buyer Email:' => $this->jobRecord->soldToCompany->contact->email,
81 ), 0, 'font-weight:bold;', 'color:#666;');
82 $buyerDetail = $table->publish();
85 $table = $this->newTable(
87 'padding:0;margin:0;font-size:10px;',
89 'padding:2px 3px 2px 0;margin:0;'
92 ->addTitle('Seller', 'padding:0 0 10px 0;font-weight:bold;font-size:11px;', 0, 1)
93 ->addKeyValueDataSet(array(
94 'Seller dealership:' => $this->jobRecord->company->name,
95 'Seller name:' => $this->jobRecord->company->contact->firstName,
96 'Seller surname:' => $this->jobRecord->company->contact->familyName,
97 'Seller Mobile:' => $this->jobRecord->company->contact->mobile,
98 'Seller Email:' => $this->jobRecord->company->contact->email,
99 ), 0, 'font-weight:bold;', 'color:#666;');
100 $sellerDetail = $table->publish();
105 'margin:0;font-size:10px;vertical-align:top;',
107 'padding:10px 0 0 0;'
109 ->setCellValue(0, 0, $buyerDetail)
110 ->setCellValue(0, 2, $sellerDetail);
111 $this->append($container->publish() . '<br />');
113 /* --------------------------------- DECLARATION --------------------------------- */
117 . '<h2>DECLARATION</h2>'
118 . 'We, the undersigned, declare that:' . '<br><br>'
119 . '1. The Purchaser purchased the abovementioned vehicle from the Seller by web-auction conducted by Bid4Cars on the '
120 . $auctionDate . '<br>'
121 . '2. The Purchaser hereby acknowledges having taken delivery of the vehicle from the Seller and being satisfied that the vehicle is as described in the Seller
\92s Regulation 32 Notice.'
123 . '3. We confirm and acknowledge that we are bound by the terms and conditions of auction and sale, as set out on the Bid4Cars site.'
125 . '4. The provisions of the terms are to be read as if specifically set out and incorporated herein.' . '<br><br><br>'
126 . 'DATED at: ' . $auctionDate . '<br>'
131 /* --------------------------------- SIGNATURES --------------------------------- */
136 $this->newSignatureLine()
137 ->addSignatureLine('Purchaser', 'Signature', 'Date')
138 ->addSignatureText('a', 'Who warrants being the authorized representative of the Purchaser.')
139 ->addSignatureLine('Seller', 'Signature', 'Date')
140 ->addSignatureText('b', 'Who warrants being the authorized representative of the Seller.')
145 '<div style="position:absolute;bottom:0;left:0;padding:0;margin:0;width:100%;">'
146 . '<table cellpadding="0px" cellspacing="0px" style="border:0px;width:100%;">'
148 . '<td style="width:30%;border-bottom: solid 1px #333;font-size:10px;font-weight:bold;color:#666;"><i>'
149 . $dateOfPrint . '</i></td>'
150 . '<td style="width:5%"> </td>'
151 . '<td style="width:30%;border-bottom: solid 1px #333;font-size:10px;font-weight:bold;color:#666;"><i>'
152 . $printedBy . '</i></td>'
153 . '<td style="width:5%"> </td>'
154 . '<td style="width:30%;border-bottom: solid 1px #333;font-size:10px;font-weight:bold;color:#666;"><i>'
155 . $referenceNo . '</i></td>'