public function action_do() { $result = array(); if (!empty($_POST['client']) && !empty($_POST['user'])) { $rpt = new Model_Report(); $result = $rpt->doIt($_POST); } $this->request->response = View::factory('report.report')->bind('post', $_POST)->bind('result', $result); }
/** * подгружаем шаблон отчета */ public function action_load_report_template() { $reportId = $this->request->param('id'); $templateSettings = Model_Report::getReportTemplateSettings($reportId); if (empty($templateSettings)) { $this->html('<div class="error_block">Ошибка</div>'); } $this->html(Model_Report::buildTemplate($templateSettings)); }
public function action_report($id = null) { if (Input::method() == 'POST') { $val = Model_Report::validate('create'); if ($val->run()) { $Report = Model_Report::forge(array('shopid' => Input::post('shopid'), 'category' => Input::post('category'), 'reason' => Input::post('reason'))); if ($Report and $Report->save()) { Session::set_flash('success', e('Added Report #' . $Report->id . '.')); } else { Session::set_flash('error', e('Could not save Report.')); } $this->template->header = View::forge('docs-header-simple.php'); $this->template->error = View::forge('error.php'); $this->template->content = View::forge('shop/completeRep.php'); $this->template->sns = ""; $this->template->footer = View::forge('footer.php'); $this->template->daialog = View::forge('daialog.php'); } else { // バリデーションNGの場合 Session::set_flash('error', $val->show_errors()); exit($val->show_errors()); } } else { $data['id'] = $id; $this->template->header = View::forge('docs-header-simple.php'); $this->template->error = View::forge('error.php'); $this->template->content = View::forge('shop/report.php', $data); $this->template->sns = ""; $this->template->footer = View::forge('footer.php'); $this->template->daialog = View::forge('daialog.php'); } }
/** * выставляем счет клиенту */ 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']); }