cols([ 'a.id', 'a.projekt', 'a.datum', 'a.belegnr', 'a.auftrag', // Auftragsnummer 'a.status', 'a.name', 'a.kundennummer', 'a.internebezeichnung', 'a.anfrage', 'a.gesamtsumme', 'a.waehrung', ]) ->from('angebot AS a') ->where('a.belegnr != ?', ''); } /** * @inheritDoc */ protected function configureItemQuery(SelectQuery $baseQuery, $indexId) { $baseQuery->where('a.id = ?', (int)$indexId); } /** * @inheritDoc */ protected function configureCountQuery(SelectQuery $baseQuery) { $baseQuery->cols(['COUNT(a.id)' => 'total_count']); } /** * @inheritDoc */ protected function configureSinceQuery(SelectQuery $baseQuery, DateTimeInterface $since) { $baseQuery->where('a.logdatei > ?', $since->format('Y-m-d H:m:i')); } /** * @inheritDoc */ protected function getRowFormatter() { return static function (array $row) { $projectId = (int)$row['projekt']; $documentDate = date('d.m.Y', strtotime($row['datum'])); $title = $row['belegnr']; $link = sprintf('index.php?module=angebot&action=edit&id=%d', $row['id']); $data = new IndexData($title, $link, $projectId); $data->setSubTitle($row['name']); $data->addAdditionalInfo($documentDate); $data->addAdditionalInfo(ucfirst($row['status'])); $data->addAdditionalInfo(number_format($row['gesamtsumme'], 2, ',', '.') . ' ' . $row['waehrung']); $data->addSearchWord('angebot'); $data->addSearchWord($row['belegnr']); $data->addSearchWord($row['auftrag']); $data->addSearchWord($row['name']); $data->addSearchWord($row['kundennummer']); $data->addSearchWord($row['internebezeichnung']); $data->addSearchWord($row['anfrage']); $identifier = new IndexIdentifier('offers', (int)$row['id']); return new IndexItem($identifier, $data); }; } }