2 namespace Report\Report;
7 * Stock Control Report.
10 class NoMatch extends \Utility\Service\Report
18 protected $_title = 'NoMatch Report';
22 protected $_subject = 'NoMatch';
26 protected $_description = 'Details of vehicles NOT found on Bid4Cars auction that was sold/invoiced through automate.';
30 protected $_notes = array(
31 'Confidential information, generated using Bid 4 Cars, for more information visit bid4cars.com.na'
36 protected $_headers = array(
51 protected $_fields = array(
67 public function build()
69 ini_set('memory_limit','512M');
71 #-> Prepare parameters.
77 $where = array('stock.id is null');
79 $query = 'SELECT [SELECTION] '
80 . 'FROM \Adherence\Entity\Adherence adherence '
81 . 'LEFT JOIN adherence.stock stock '
83 //. 'ORDER BY adherence.id ASC, auction.id ASC';
85 #-> Construct details.
86 $authData = \Utility\Registry::getAuthData();
87 if (isset($this->_input['dateFrom']) && !empty($this->_input['dateFrom']))
89 $this->_queries['Date Range From'] = $this->_input['dateFrom'];
90 $where[] = 'adherence.dateSold >= :dateFrom';
91 $params['dateFrom'] = new \DateTime($this->_input['dateFrom']);
93 if (isset($this->_input['dateTo']) && !empty($this->_input['dateTo']))
95 $this->_queries['Date Range Until'] = $this->_input['dateTo'];
96 $where[] = 'adherence.dateSold <= :dateTo';
97 $params['dateTo'] = new \DateTime($this->_input['dateTo'] . ' 23:59:59');
101 $query = str_replace(array(
102 '[SELECTION]', '[WHERE]'
104 implode(', ', $selection) . ' ',
106 ? 'WHERE ' . implode(' AND ', $where) . ' '
111 $query = $this->em->createQuery($query);
113 && $query->setParameters($params);
114 $data = $query->getScalarResult();
117 //\Utility\Debug::errorLog('data', $data);
121 foreach ($data as $id => $row)
123 $this->_data[] = array(
125 'invoicenumber' => '',
126 'stocknumber' => $row['adherence_stockNumber'],
127 'make' => $row['adherence_make'],
128 'vin' => $row['adherence_vinNumber'],
129 'registration' => $row['adherence_registrationNumber'],
130 'engine' => $row['adherence_engineNumber'],
131 'saledate' => $row['adherence_dateSold'],
132 'standingvalue' => $row['adherence_amount'],
134 'soldto' => $row['adherence_soldTo']