public function referencingAction() { $request = $this->getRequest(); $refreport = new Connect_Form_ReferencingReport(); $slareport = new Connect_Form_ReferencingServiceLevelReport(); $overnightreport = new Connect_Form_ReferencingOvernightReport(); $this->view->refreport = $refreport; $this->view->slareport = $slareport; $this->view->overnightreport = $overnightreport; if ($request->isPost()) { $formdata = $request->getPost(); $refreport->populate($formdata); $slareport->populate($formdata); $overnightreport->populate($formdata); if ($refreport->isValid($formdata) && isset($formdata['referencingreport_producereport'])) { $startdate = new Zend_Date($refreport->getElement('referencingreport_start')->getValue(), Zend_Date::DAY . '/' . Zend_Date::MONTH . '/' . Zend_Date::YEAR); $enddate = new Zend_Date($refreport->getElement('referencingreport_end')->getValue(), Zend_Date::DAY . '/' . Zend_Date::MONTH . '/' . Zend_Date::YEAR); $report = new Datasource_Connect_Mi_RefSales(); $this->view->reportdata = $report->refSalesForMonthYear($this->_agentSchemeNumber, $startdate, $enddate); $this->view->productoverview_reportdata = $report->refSalesOverviewByProductForMonthYear($this->_agentSchemeNumber, $startdate, $enddate); $this->view->appltype_reportdata = $report->refSalesOverviewByApplicantTypeForMonthYear($this->_agentSchemeNumber, $startdate, $enddate); $this->view->subtype_reportdata = $report->refSalesOverviewBySubmissionTypeForMonthYear($this->_agentSchemeNumber, $startdate, $enddate); $this->view->headLink()->appendStylesheet('/assets/connect/css/print.css', 'print'); $this->render('referencing_report'); } else { if ($refreport->isValid($formdata) && isset($formdata['referencingreport_exporttoexcel'])) { $startdate = new Zend_Date($refreport->getElement('referencingreport_start')->getValue(), Zend_Date::DAY . '/' . Zend_Date::MONTH . '/' . Zend_Date::YEAR); $enddate = new Zend_Date($refreport->getElement('referencingreport_end')->getValue(), Zend_Date::DAY . '/' . Zend_Date::MONTH . '/' . Zend_Date::YEAR); $this->_sendCsvHeaders('referencing-report.csv'); $report = new Datasource_Connect_Mi_RefSales(); $this->view->reportdata = $report->refSalesForMonthYear($this->_agentSchemeNumber, $startdate, $enddate); $this->view->productoverview_reportdata = $report->refSalesOverviewByProductForMonthYear($this->_agentSchemeNumber, $startdate, $enddate); $this->view->appltype_reportdata = $report->refSalesOverviewByApplicantTypeForMonthYear($this->_agentSchemeNumber, $startdate, $enddate); $this->view->subtype_reportdata = $report->refSalesOverviewBySubmissionTypeForMonthYear($this->_agentSchemeNumber, $startdate, $enddate); $this->_helper->getHelper('layout')->disableLayout(); $this->render('referencing_csv'); } else { if ($slareport->isValid($formdata) && isset($formdata['slareport_producereport'])) { $report = new Datasource_Connect_Mi_RefSales(); $this->view->reportdata = $report->refSlaForMonthYear($this->_agentSchemeNumber, $formdata['slareport_month'], $formdata['slareport_year']); $this->view->headLink()->appendStylesheet('/assets/connect/css/print.css', 'print'); $this->render('referencingsla_report'); } else { if ($slareport->isValid($formdata) && isset($formdata['slareport_exporttoexcel'])) { $this->_sendCsvHeaders('referencing-sla-report.csv'); $report = new Datasource_Connect_Mi_RefSales(); $this->view->reportdata = $report->refSlaForMonthYear($this->_agentSchemeNumber, $formdata['slareport_month'], $formdata['slareport_year']); $this->_helper->getHelper('layout')->disableLayout(); $this->render('referencingsla_csv'); } else { $auth = Zend_Auth::getInstance(); $auth->setStorage(new Zend_Auth_Storage_Session('hl_connect')); // Zend_Debug::dump($overnightreport->isValid($formdata)); $report = new Datasource_Connect_Mi_RefDailyReport(); $this->view->isAgentInIris = $auth->getStorage()->read()->isInIris; $this->view->reportlivedata = $report->fetchLiveByASN($this->_agentSchemeNumber); $this->view->reporttemporarydata = $report->fetchTemporaryByASN($this->_agentSchemeNumber); $this->view->reportcompleteddata = $report->fetchCompleteByASN($this->_agentSchemeNumber); $this->render('referencing_overnight_report'); // die("HELLO"); } } } } } }
/** * 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); } }