initial commit
[namibia] / module / Auction / src / Auction / Report / BasketGrid.php
1 <?php
2 namespace Auction\Report;
3
4
5
6 /**
7  * Stock Contyrol Report.
8  * @author andre.fourie
9  */
10 class BasketGrid extends \Utility\Service\Report
11 {
12
13
14
15         /**
16          * @var string
17          */
18         protected $_title  = 'Auction Basket Data Export';
19         /**
20          * @var string
21          */
22         protected $_subject = 'Vehicles on auction in basket.';
23         /**
24          * @var string
25          */
26         protected $_description = 'Export of vehicles on auction in basket.';
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                         'Seller',
38                         'Region',
39                         'Reference Number',
40                         'Registration Number',
41                         'VIN Number',
42                         'Make',
43                         'Model',
44                         'Type',
45                         'Year',
46                         'Main Exterior Colour',
47                         'KM',
48                         'Trade Price',
49                         'Retail Price',
50                         'Times listed on auction',
51                         'Highest Bid',
52                         'Status',
53                         'Created',
54                         'Updated'
55                         );
56         /**
57          * @var array
58          */
59         protected $_fields = array(
60                         'company_name',
61                         'region_name',
62                         'stock_referenceNumber',
63                         'stock_registrationNumber',
64                         'stock_vinNumber',
65                         'make_name',
66                         'model_name',
67                         'type_name',
68                         'vehicleYear_name',
69                         'exteriorColour_name',
70                         'stock_km',
71                         'stock_tradePrice',
72                         'stock_retailPrice',
73             'stock_listPrice',
74                         'stock_timesListed',
75                         'stock_highestBid',
76                         'auction_jobState',
77                         'auction_created',
78                         'auction_updated'
79                         );
80         /**
81          * @var array
82          */
83         protected $_totals = array(
84                         'stock_tradePrice',
85                         'stock_retailPrice',
86             'stock_listPrice',
87                         'stock_highestBid'
88                         );
89         /**
90          * @var array
91          */
92         protected $_currencyFields = array(
93                         'stock_tradePrice',
94                         'stock_retailPrice',
95             'stock_listPrice',
96                         'stock_highestBid'
97                         );
98
99
100
101         /**
102          * Build the dataset, or not.
103          */
104         public function build()
105         {
106                 #-> Data passed by DataBin Grid functionality.
107                 $dateTimeFormat = \Utility\Definitions\Locale::getDateTimeFormat();
108                 foreach ($this->_data as $rowId => $rowData)
109                 {
110                         $this->_data[$rowId]['auction_created'] = $rowData['auction_created']->format($dateTimeFormat);
111                         $this->_data[$rowId]['auction_updated'] = !is_null($rowData['auction_updated'])
112                                 ? $rowData['auction_updated']->format($dateTimeFormat)
113                                 : '';
114                 }
115         }
116
117 }