2 namespace PriceGuide\Report;
7 * Stock Control Report.
10 class PriceGuideGrid extends \Utility\Service\Report
18 protected $_title = 'Price Guide Data Export';
22 protected $_subject = 'Vehicles on price guide.';
26 protected $_description = 'Export of vehicles available on price guide.';
30 protected $_notes = array(
31 'Confidential information, generated using Bid 4 Cars, for more information visit bid4cars.com.na'
36 protected $_headers = array(
42 'Registration Number',
48 'Main Exterior Colour',
52 'Number of price guide offers',
53 'Highest price guide offer',
62 protected $_fields = array(
67 'stock_referenceNumber',
68 'stock_registrationNumber',
74 'exteriorColour_name',
79 'stock_numberOfOffers',
82 'priceGuide_jobState',
89 protected $_totals = array(
93 'stock_retailAmountRequired',
100 protected $_currencyFields = array(
104 'stock_retailAmountRequired',
105 'stock_highestOffer',
112 * Build the dataset, or not.
114 public function build()
116 #-> Data passed by DataBin Grid functionality.
117 $dateTimeFormat = \Utility\Definitions\Locale::getDateTimeFormat();
118 $auth = \Utility\Registry::getAuthData();
119 foreach ($this->_data as $rowId => $rowData)
121 $myOffer = $this->em->getRepository('\PriceGuide\Entity\Offer')
123 'priceGuideStock' => $this->_data[$rowId]['priceGuide_id'],
124 'company' => $auth['company']['id']
126 $this->_data[$rowId]['priceGuide_id'] = is_object($myOffer)
129 $this->em->clear('\PriceGuide\Entity\Offer');
130 $this->_data[$rowId]['priceGuide_created'] = $rowData['priceGuide_created']->format($dateTimeFormat);
131 $this->_data[$rowId]['priceGuide_updated'] = !is_null($rowData['priceGuide_updated'])
132 ? $rowData['priceGuide_updated']->format($dateTimeFormat)
134 if ('Updateable Offers' == $this->_data[$rowId]['priceGuide_jobState'] || 'Open4Offers' == $this->_data[$rowId]['priceGuide_jobState'])
136 $this->_data[$rowId]['stock_highestOffer'] = 0.0;