/** * Visual reports * * @return void */ public function visualAction() { if ($this->_checkIdent()) { $data = array('data' => array(), 'legend' => array()); // Obtain parameters in request for instruction of what data to return $request = $this->getRequest(); $refdata = $request->getParam('refdata'); $landdata = $request->getParam('landdata'); $tendata = $request->getParam('tendata'); $commdata = $request->getParam('commdata'); $yearnum_1 = $request->getParam('yearnum_1'); $yearnum_2 = $request->getParam('yearnum_2'); $yearnum_3 = $request->getParam('yearnum_3'); // Obtain start/end years for 3 year history or data $endyear = date("Y"); $startyear = $endyear - 2; if ($refdata != null) { // Ref data requested $mireport = new Datasource_Connect_Mi_RefSales(); $year = $startyear; $seriesdata = array(); if ($yearnum_1) { $reportdata = $mireport->refSalesCountByMonthForYear($this->_agentSchemeNumber, $year); $seriesdata = array_merge($seriesdata, $reportdata); } $year++; if ($yearnum_2) { $reportdata = $mireport->refSalesCountByMonthForYear($this->_agentSchemeNumber, $year); $seriesdata = array_merge($seriesdata, $reportdata); } $year++; if ($yearnum_3) { $reportdata = $mireport->refSalesCountByMonthForYear($this->_agentSchemeNumber, $year); $seriesdata = array_merge($seriesdata, $reportdata); } array_push($data['data'], $seriesdata); array_push($data['legend'], 'Referencing'); } if ($landdata != null) { // Ref data requested $mireport = new Datasource_Connect_Mi_InsuranceSales(); $year = $startyear; $seriesdata = array(); if ($yearnum_1) { $reportdata = $mireport->landlordsSalesCountByMonthForYear($this->_agentSchemeNumber, $year); $seriesdata = array_merge($seriesdata, $reportdata); } $year++; if ($yearnum_2) { $reportdata = $mireport->landlordsSalesCountByMonthForYear($this->_agentSchemeNumber, $year); $seriesdata = array_merge($seriesdata, $reportdata); } $year++; if ($yearnum_3) { $reportdata = $mireport->landlordsSalesCountByMonthForYear($this->_agentSchemeNumber, $year); $seriesdata = array_merge($seriesdata, $reportdata); } array_push($data['data'], $seriesdata); array_push($data['legend'], 'Landlords'); } if ($tendata != null) { // Ref data requested $mireport = new Datasource_Connect_Mi_InsuranceSales(); $year = $startyear; $seriesdata = array(); if ($yearnum_1) { $reportdata = $mireport->tenantSalesCountByMonthForYear($this->_agentSchemeNumber, $year); $seriesdata = array_merge($seriesdata, $reportdata); } $year++; if ($yearnum_2) { $reportdata = $mireport->tenantSalesCountByMonthForYear($this->_agentSchemeNumber, $year); $seriesdata = array_merge($seriesdata, $reportdata); } $year++; if ($yearnum_3) { $reportdata = $mireport->tenantSalesCountByMonthForYear($this->_agentSchemeNumber, $year); $seriesdata = array_merge($seriesdata, $reportdata); } array_push($data['data'], $seriesdata); array_push($data['legend'], 'Tenants'); } if ($commdata != null) { // Ref data requested // Ref data requested $mireport = new Datasource_Connect_Mi_InsuranceSales(); $year = $startyear; $seriesdata = array(); if ($yearnum_1) { $reportdata = $mireport->commmissionByMonthForYear($this->_agentSchemeNumber, $year); $seriesdata = array_merge($seriesdata, $reportdata); } $year++; if ($yearnum_2) { $reportdata = $mireport->commmissionByMonthForYear($this->_agentSchemeNumber, $year); $seriesdata = array_merge($seriesdata, $reportdata); } $year++; if ($yearnum_3) { $reportdata = $mireport->commmissionByMonthForYear($this->_agentSchemeNumber, $year); $seriesdata = array_merge($seriesdata, $reportdata); } array_push($data['data'], $seriesdata); array_push($data['legend'], 'Commission'); } echo Zend_Json::Encode($data); } }