latest update
[namibia] / module / Auction / src / Auction / Report / AuctionGrid.php
1 <?php
2 namespace Auction\Report;
3
4
5 /**
6  * Stock Contyrol Report.
7  * @author andre.fourie
8  */
9 class AuctionGrid extends \Utility\Service\Report
10 {
11
12
13
14         /**
15          * @var string
16          */
17         protected $_title = 'Auction Data Export';
18         /**
19          * @var string
20          */
21         protected $_subject = 'Vehicles on auction.';
22         /**
23          * @var string
24          */
25         protected $_description = 'Export of vehicles on auction.';
26         /**
27          * @var array
28          */
29         protected $_notes = array(
30                 'Confidential information, generated using Bid 4 Cars, for more information visit bid4cars.com.na'
31         );
32         /**
33          * @var array
34          */
35         protected $_headers = array(
36                 'Seller',
37                 'Region',
38                 'Reference Number',
39                 'Registration Number',
40                 'VIN Number',
41                 'Make',
42                 'Model',
43                 'Type',
44                 'Year',
45                 'KM',
46                 'Trade Price',
47                 'List Price',
48                 'Reserve Price',
49                 'Highest Bid'
50         );
51         /**
52          * @var array
53          */
54         protected $_fields = array(
55                 'auction_auctionCompanyName',
56                 'region_name',
57                 'auction_referenceNumber',
58                 'auction_registrationNumber',
59                 'stock_vinNumber',
60                 'auction_makeName',
61                 'auction_modelName',
62                 'auction_typeName',
63                 'auction_yearName',
64                 'auction_stockKm',
65                 'stock_tradePrice',
66                 'stock_listPrice',
67                 'auction_reservePrice',
68                 'stock_highestBid'
69         );
70         /**
71          * @var array
72          */
73         protected $_totals = array(
74                 'stock_tradePrice',
75                 'stock_listPrice',
76                 'stock_highestBid',
77                 'auction_reservePrice'
78         );
79         /**
80          * @var array
81          */
82         protected $_currencyFields = array(
83                 'stock_tradePrice',
84                 'stock_listPrice',
85                 'stock_highestBid',
86                 'auction_reservePrice'
87         );
88
89
90
91         /**
92          * Build the dataset, or not.
93          */
94         public function build()
95         {
96                 #-> Data passed by DataBin Grid functionality.
97                 $dateTimeFormat = \Utility\Definitions\Locale::getDateTimeFormat();
98                 foreach ($this->_data as $rowId => $rowData)
99                 {
100                         $this->_data[$rowId]['auction_created'] = $rowData['auction_created']->format($dateTimeFormat);
101                         $this->_data[$rowId]['auction_updated'] = !is_null($rowData['auction_updated'])
102                                 ? $rowData['auction_updated']->format($dateTimeFormat)
103                                 : '';
104                 }
105         }
106
107 }