initial commit
[namibia] / module / Stock / src / Stock / Report / StockGrid.php
1 <?php
2 namespace Stock\Report;
3
4
5
6 /**
7  * Stock Contyrol Report.
8  * @author andre.fourie
9  */
10 class StockGrid extends \Utility\Service\Report
11 {
12
13
14
15         /**
16          * @var string
17          */
18         protected $_title  = 'Stock Data Export';
19         /**
20          * @var string
21          */
22         protected $_subject = 'Vehicles in stock.';
23         /**
24          * @var string
25          */
26         protected $_description = 'Export of vehicles in stock.';
27         /**
28          * @var array
29          */
30         protected $_notes = array(
31                         'Confidential information, generated using Bid 4 Cars, for more information visit bid4cars.co.za'
32                         );
33         /**
34          * @var array
35          */
36         protected $_headers = array(
37                         'Dealer',
38                         'Group',
39                         'Division',
40                         'Reference Number',
41                         'Registration Number',
42                         'VIN Number',
43                         'Make',
44                         'Model',
45                         'Type',
46                         'Year',
47                         'Main Exterior Colour',
48                         'KM',
49                         'Trade Price',
50                         'Retail Price',
51                         'Retail Amount Required',
52                         'Status',
53                         'Created',
54                         'Date loaded on price guide',
55                         'Number of offers',
56                         'Highest offer',
57             'Manager\'s Offer',
58                         'Date loaded on auction',
59                         'Highest bid'
60                         );
61         /**
62          * @var array
63          */
64         protected $_fields = array(
65                         'company_name',
66                         'companyGroup_name',
67                         'groupDivision_name',
68                         'stock_referenceNumber',
69                         'stock_registrationNumber',
70                         'stock_vinNumber',
71                         'make_name',
72                         'model_name',
73                         'type_name',
74                         'vehicleYear_name',
75                         'exteriorColour_name',
76                         'stock_km',
77                         'stock_tradePrice',
78                         'stock_retailPrice',
79                         'stock_retailAmountRequired',
80                         'stock_jobState',
81                         'stock_created',
82                         'stock_loadedOnPriceGuide',
83                         'stock_numberOfOffers',
84                         'stock_highestOffer',
85             'valuation_amountOffered',
86                         'auction_created',
87                         'auction_currentBidPrice'
88                         );
89         /**
90          * @var array
91          */
92         protected $_totals = array(
93                         'stock_tradePrice',
94                         'stock_retailPrice',
95             'stock_listPrice',
96                         'stock_retailAmountRequired',
97                         'stock_highestOffer',
98       'valuation_amountOffered',
99                         'auction_currentBidPrice'
100                         );
101         /**
102          * @var array
103          */
104         protected $_currencyFields = array(
105                         'stock_tradePrice',
106                         'stock_retailPrice',
107             'stock_listPrice',
108                         'stock_retailAmountRequired',
109                         'stock_highestOffer',
110       'valuation_amountOffered',
111                         'auction_currentBidPrice'
112                         );
113
114
115
116         /**
117          * Build the dataset, or not.
118          */
119         public function build()
120         {
121                 #-> Data passed by DataBin Grid functionality.
122                 $dateTimeFormat = \Utility\Definitions\Locale::getDateTimeFormat();
123                 foreach ($this->_data as $rowId => $rowData)
124                 {
125                         $this->_data[$rowId]['stock_created'] = $rowData['stock_created']->format($dateTimeFormat);
126                 }
127         }
128
129 }