/** * гшенерация отчетов * * @throws HTTP_Exception_404 */ public function action_generate() { $params = $this->request->query(); $report = Model_Report::generate($params); if (empty($report)) { throw new HTTP_Exception_500('Отчет не сформировался'); } foreach ($report['headers'] as $header) { header($header); } $this->html($report['report']); }
/** * выставляем счет клиенту */ public function action_add_bill() { $contractId = $this->request->query('contract_id'); $sum = $this->request->query('sum'); $invoiceNum = Model_Contract::addBill($contractId, $sum); $params = ['type' => Model_Report::REPORT_TYPE_BILL, 'format' => 'pdf', 'contract_id' => $contractId, 'invoice_number' => $invoiceNum]; $report = Model_Report::generate($params); if (empty($report)) { throw new HTTP_Exception_500('Счет не сформировался'); } foreach ($report['headers'] as $header) { header($header); } $this->html($report['report']); }