fakturaFacade->getById($id); if (!$faktura) { $this->flashMessage('Faktura nebyla nalezena.', 'danger'); $this->redirect('Faktura:default'); } $polozky = $this->fakturaFacade->getPolozky($id); // Výpočet celkové částky $celkem = 0; foreach ($polozky as $p) { $celkem += (float) $p->CENA; } $this->template->faktura = $faktura; $this->template->polozky = $polozky; $this->template->celkem = $celkem; } }