| @@ 26-39 (lines=14) @@ | ||
| 23 | $this->layout = 'wadmin'; |
|
| 24 | } |
|
| 25 | ||
| 26 | public function s_adicionar_cupom() |
|
| 27 | { |
|
| 28 | $dados = $this->request->data('dados'); |
|
| 29 | $dados['ativo'] = 1; |
|
| 30 | $dados['usuario_id'] = $this->instancia; |
|
| 31 | ||
| 32 | if ($this->Cupom->save($dados)) { |
|
| 33 | $this->Session->setFlash('Cupom criado com sucesso!'); |
|
| 34 | return $this->redirect('/cupom/listar_cadastros'); |
|
| 35 | } else { |
|
| 36 | $this->Session->setFlash('Ocorreu algum erro ao criar o cupom!'); |
|
| 37 | return $this->redirect('/cupom/listar_cadastros'); |
|
| 38 | } |
|
| 39 | } |
|
| 40 | ||
| 41 | public function editar_cupom($id) |
|
| 42 | { |
|
| @@ 57-70 (lines=14) @@ | ||
| 54 | $this->layout = 'wadmin'; |
|
| 55 | } |
|
| 56 | ||
| 57 | public function s_editar_cupom($id) |
|
| 58 | { |
|
| 59 | $dados = $this->request->data('dados'); |
|
| 60 | ||
| 61 | $this->Cupom->id = $id; |
|
| 62 | ||
| 63 | if ($this->Cupom->save($dados)) { |
|
| 64 | $this->Session->setFlash('Cupom editado com sucesso!'); |
|
| 65 | return $this->redirect('/cupom/listar_cadastros'); |
|
| 66 | } else { |
|
| 67 | $this->Session->setFlash('Ocorreu algum erro ao editar o cupom!'); |
|
| 68 | return $this->redirect('/cupom/listar_cadastros'); |
|
| 69 | } |
|
| 70 | } |
|
| 71 | ||
| 72 | public function excluir_cupom($id) |
|
| 73 | { |
|
| @@ 72-85 (lines=14) @@ | ||
| 69 | } |
|
| 70 | } |
|
| 71 | ||
| 72 | public function excluir_cupom($id) |
|
| 73 | { |
|
| 74 | $dados['ativo'] = 0; |
|
| 75 | ||
| 76 | $this->Cupom->id = $id; |
|
| 77 | ||
| 78 | if ($this->Cupom->save($dados)) { |
|
| 79 | $this->Session->setFlash('Cupom excluido com sucesso!'); |
|
| 80 | return $this->redirect('/cupom/listar_cadastros'); |
|
| 81 | } else { |
|
| 82 | $this->Session->setFlash('Ocorreu algum erro ao excluir o cupom!'); |
|
| 83 | return $this->redirect('/cupom/listar_cadastros'); |
|
| 84 | } |
|
| 85 | } |
|
| 86 | ||
| 87 | ||
| 88 | /** |
|
| @@ 21-34 (lines=14) @@ | ||
| 18 | $this->layout = 'wadmin'; |
|
| 19 | } |
|
| 20 | ||
| 21 | public function excluir_newsletter($id) |
|
| 22 | { |
|
| 23 | $dados['ativo'] = 0; |
|
| 24 | ||
| 25 | $this->Newsletter->id = $id; |
|
| 26 | ||
| 27 | if ($this->Newsletter->save($dados)) { |
|
| 28 | $this->Session->setFlash('Cadastro de newsletter excluido com sucesso!'); |
|
| 29 | return $this->redirect('/newsletter/listar_cadastros'); |
|
| 30 | } else { |
|
| 31 | $this->Session->setFlash('Ocorreu algum erro ao excluir o cadastro de newsletter!'); |
|
| 32 | return $this->redirect('/newsletter/listar_cadastros'); |
|
| 33 | } |
|
| 34 | } |
|
| 35 | ||
| 36 | ||
| 37 | public function newsletter_cadastro($nome, $email, $usuario_id) |
|
| @@ 5-18 (lines=14) @@ | ||
| 2 | ||
| 3 | class CaixaController extends AppController { |
|
| 4 | ||
| 5 | public function iniciar_caixa() { |
|
| 6 | $data = $this->request->data['caixa']; |
|
| 7 | ||
| 8 | $data['usuario_id'] = $this->instancia; |
|
| 9 | $data['ativo'] = 1; |
|
| 10 | ||
| 11 | if (!$this->Caixa->save($data)) { |
|
| 12 | $this->Session->setFlash('Ocorreu um erro ao abrir o caixa, tente novamente, caso persista contate o suporte'); |
|
| 13 | $this->redirect('/venda/adicionar_cadastro'); |
|
| 14 | } |
|
| 15 | ||
| 16 | $this->Session->setFlash('Caixa aberto com sucesso!'); |
|
| 17 | $this->redirect('/venda/adicionar_cadastro'); |
|
| 18 | } |
|
| 19 | ||
| 20 | public function finalizar_caixa() { |
|
| 21 | $data = $this->request->data['caixa']; |
|