예제 #1
0
 public function indexAction()
 {
     try {
         $this->view->pesquisa = '';
         if ($this->request->isPost()) {
             $linhas = $this->request->getPost('linhas', 'string');
             $mes = str_replace('20', '', $this->request->getPost('mes', 'string'));
             $this->view->extratos = Statement::find("operLd IS NOT NULL AND numAcs = '{$linhas}' AND mes = '{$mes}'");
             $this->view->totais = Statement::find("operLd IS NULL AND numAcs = '{$linhas}' AND mes = '{$mes}'");
             $statement = new Statement();
             $this->view->totalLinha = $statement->getTotal($linhas, $mes);
             $this->view->pesquisa = $linhas . ' | ' . $this->request->getPost('mes', 'string');
             $this->view->export = true;
         }
         $cpf = $this->session->get('auth-identity')['userInfo']['cpf'];
         $cellPhoneLine = CellPhoneLine::findByCpf($cpf);
         $accessLine = AccessLine::findByCpf($cpf);
         $linhas = [];
         foreach ($cellPhoneLine as $value) {
             $linhas['Minhas Linhas'][$value->linha] = $value->linha;
         }
         foreach ($accessLine as $value) {
             $linhas['Linhas de Outros'][$value->linha] = $value->linha;
         }
         $this->view->linhas = $linhas;
         if (empty($linhas)) {
             throw new Exception('Não há linhas telefônicas cadastradas no seu CPF.');
         }
     } catch (\Exception $e) {
         $this->flash->error($e->getMessage());
     }
 }