Git Repository Public Repository

namibia

URLs

Copy to Clipboard
 
df0489e1eeeeab5a9bd44e1d84fce49924fe1bac
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
<?php
namespace Auction\Pdf;



class Declaration extends \Utility\Service\PdfTemplate
{

	protected function getStockParam($param, $default)
	{
		return !is_null($this->jobRecord->stock->$param)
			? $this->jobRecord->stock->$param
			: $default;
	}

	/**
	 * Utility for easy parameter retrieval.
	 * @param string $param
	 * @param unknown $default
	 * @return unknown
	 */
	protected function getStockSubParam($ref, $param, $default)
	{
		$ref = !is_null($this->jobRecord->stock->$ref)
			? $this->jobRecord->stock->$ref
			: null;
		return is_object($ref)
			? $ref->$param
			: $default;
	}

	/**
	 * Utility for easy parameter retrieval.
	 * @param string $param
	 * @param unknown $default
	 * @return unknown
	 */
	protected function getValuationParam($param, $default)
	{
		return !is_null($this->jobRecord->stock->valuation)
				&& !is_null($this->jobRecord->stock->valuation->$param)
			? $this->jobRecord->stock->valuation->$param
			: $default;
	}


	/**
	 * Build the content.
	 */
	public function build()
	{
		#-> Set data item to work with.
		$this->jobRecord = $this->_input['jobRecord'];
		$dateTimeFormat = \Utility\Definitions\Locale::getDateTimeFormat();
		$dateFormat = \Utility\Definitions\Locale::getDateFormat();
		$currencyPrefix = \Utility\Definitions\Locale::getCurrencyPrefix();
		$authData = \Utility\Registry::getAuthData();
		
		$auctionDate = $this->jobRecord->endDate->format($dateFormat);
		$dateOfPrint = 'Date of print: <span style="color:#333;">' . date('Y-m-d H:i:s') . '</span>';
		$printedBy   = 'Printed by: <span style="color:#333;">' . $authData['firstName']
					 . ' ' . $authData['familyName'] . '</span>';
		$referenceNo = 'Reference no.: <span style="color:#333;">' . $this->jobRecord->stock->referenceNumber . '</span>';

		/* --------------------------------- Buyer & Seller details --------------------------------- */
		#-> Buyer & Seller details
		$table = $this->newTable(
					array(60, 40),
					'padding:0;margin:0;font-size:10px;',
					'',
					'padding:2px 3px 2px 0;margin:0;'
			);
			$table
				->addTitle('Buyer', 'padding:0 0 10px 0;font-weight:bold;font-size:11px;', 0, 1)
				->addKeyValueDataSet(array(
						'Buyer dealership:'    	=> $this->jobRecord->soldToCompany->name,
						'Buyer name:'    		=> $this->jobRecord->soldToCompany->contact->firstName,
						'Buyer surname:' 		=> $this->jobRecord->soldToCompany->contact->familyName,
						'Buyer Mobile:'         => $this->jobRecord->soldToCompany->contact->mobile,
						'Buyer Email:'          => $this->jobRecord->soldToCompany->contact->email,
				), 0, 'font-weight:bold;', 'color:#666;');
			$buyerDetail = $table->publish();
		
		
			$table = $this->newTable(
					array(60, 40),
					'padding:0;margin:0;font-size:10px;',
					'',
					'padding:2px 3px 2px 0;margin:0;'
			);
			$table
			->addTitle('Seller', 'padding:0 0 10px 0;font-weight:bold;font-size:11px;', 0, 1)
			->addKeyValueDataSet(array(
					'Seller dealership:'    => $this->jobRecord->company->name,
					'Seller name:'    		=> $this->jobRecord->company->contact->firstName,
					'Seller surname:' 		=> $this->jobRecord->company->contact->familyName,
					'Seller Mobile:'        => $this->jobRecord->company->contact->mobile,
					'Seller Email:'         => $this->jobRecord->company->contact->email,
			), 0, 'font-weight:bold;', 'color:#666;');
			$sellerDetail = $table->publish();
			
			$container = $this
			->newTable(
					array(45, 10, 45),
					'margin:0;font-size:10px;vertical-align:top;',
					'',
					'padding:10px 0 0 0;'
			)
			->setCellValue(0, 0, $buyerDetail)
			->setCellValue(0, 2, $sellerDetail);
			$this->append($container->publish() . '<br />');
			
		 /* --------------------------------- DECLARATION --------------------------------- */

			$this->append(
					'<div>'
					. '<h2>DECLARATION</h2>'
					. 'We, the undersigned, declare that:' . '<br><br>'
					. '1.	The Purchaser purchased the abovementioned vehicle from the Seller by web-auction conducted by Bid4Cars on the '
					. $auctionDate . '<br>'
					. '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�s Regulation 32 Notice.'
					. '<br>'
					. '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.'
					. '<br>'
					. '4.	The provisions of the terms are to be read as if specifically set out and incorporated herein.' . '<br><br><br>'
					. 'DATED at: ' . $auctionDate . '<br>'
					. '</div>'
			);
		

		/* --------------------------------- SIGNATURES --------------------------------- */
		
			#-> Signatures.
		
			$this->append(
					$this->newSignatureLine()
						->addSignatureLine('Purchaser', 'Signature', 'Date')
						->addSignatureText('a', 'Who warrants being the authorized representative of the Purchaser.')
						->addSignatureLine('Seller', 'Signature', 'Date')
						->addSignatureText('b', 'Who warrants being the authorized representative of the Seller.')
						->publish()
					);	
			
		$this->append(
				'<div style="position:absolute;bottom:0;left:0;padding:0;margin:0;width:100%;">'
				. '<table cellpadding="0px" cellspacing="0px" style="border:0px;width:100%;">'
				. '<tr>'
				. '<td style="width:30%;border-bottom: solid 1px #333;font-size:10px;font-weight:bold;color:#666;"><i>'
				. $dateOfPrint . '</i></td>'
				. '<td style="width:5%">&nbsp;</td>'
				. '<td style="width:30%;border-bottom: solid 1px #333;font-size:10px;font-weight:bold;color:#666;"><i>'
				. $printedBy . '</i></td>'
				. '<td style="width:5%">&nbsp;</td>'
				. '<td style="width:30%;border-bottom: solid 1px #333;font-size:10px;font-weight:bold;color:#666;"><i>'
				. $referenceNo . '</i></td>'
				. '</tr>'
				. '</table>'
				. '</div>'
				);
	}
}

Commits for namibiamodule/Auction/src/Auction/Pdf/Declaration.php

Diff revisions: vs.
Revision Author Commited Message
df0489 ... Mark Fri 14 Oct, 2016 10:01:00 +0000

initial commit