/** * */ public function exportToExcelAction() { $params = $this->getRequest()->getParams(); $query = FolioImportQuery::create()->filter($params)->find(); $report = new SimpleListReport(); $headers = array('ID', 'Folio', 'Departure Port', 'Forwarder', 'Destination Port', 'Customs Broker', 'Status'); $i = 0; while ($folioImport = $query->read()) { $content[$i][] = $folioImport->getIdFolioImport(); $content[$i][] = $folioImport->getFolio(); $content[$i][] = PortCustomQuery::create()->findByPK($folioImport->getIdPortDestination())->getName(); $content[$i][] = ForwarderQuery::create()->findByPK($folioImport->getIdForwarder())->getName(); $content[$i][] = PortCustomQuery::create()->findByPK($folioImport->getIdPortCustom())->getName(); $idCustomsBroker = $folioImport->getIdCustomsBroker(); if (!empty($idCustomsBroker)) { $content[$i][] = CustomsBrokerQuery::create()->findByPK($folioImport->getIdCustomsBroker())->getName(); } else { $content[$i][] = 'Not Available'; } $content[$i][] = $folioImport->getStatusName(); $i++; } $title = $this->i18n->_('Folio Import Report'); $filename = 'folio_import_report'; $report->setTableHeaders($headers); $report->setTableContent($content); $report->setTableTitle($title); $report->setFilename($filename); $report->createSpreadsheet(); }
/** * */ public function getListResultsAction() { $params = $this->getRequest()->getParams(); $params['name'] = "%" . $params['name'] . "%"; $customsBrokers = CustomsBrokerQuery::create()->filter($params)->page($params['page'], $this->getMaxPerPage())->find(); die(json_encode($customsBrokers->toArray())); }