@@ -79,6 +79,10 @@ |
||
| 79 | 79 | return false; |
| 80 | 80 | } |
| 81 | 81 | |
| 82 | + /** |
|
| 83 | + * @param integer $produto_id |
|
| 84 | + * @param string $email |
|
| 85 | + */ |
|
| 82 | 86 | public function enviar_email_aviseme($produto_id, $email) |
| 83 | 87 | { |
| 84 | 88 | try { |
@@ -9,7 +9,7 @@ discard block |
||
| 9 | 9 | { |
| 10 | 10 | $this->loadModel('AviseMe'); |
| 11 | 11 | |
| 12 | - $query = array ( |
|
| 12 | + $query = array( |
|
| 13 | 13 | 'joins' => array( |
| 14 | 14 | array( |
| 15 | 15 | 'table' => 'produtos', |
@@ -37,8 +37,8 @@ discard block |
||
| 37 | 37 | |
| 38 | 38 | $id = $this->request->data('id'); |
| 39 | 39 | |
| 40 | - $dados = array ('ativo' => '0'); |
|
| 41 | - $parametros = array ('id' => $id); |
|
| 40 | + $dados = array('ativo' => '0'); |
|
| 41 | + $parametros = array('id' => $id); |
|
| 42 | 42 | |
| 43 | 43 | if ($this->AviseMe->updateAll($dados, $parametros)) { |
| 44 | 44 | echo json_encode(true); |
@@ -59,12 +59,12 @@ discard block |
||
| 59 | 59 | |
| 60 | 60 | $this->AviseMe->set($this->request->data); |
| 61 | 61 | |
| 62 | - if (!$this->AviseMe->validates()) |
|
| 62 | + if ( ! $this->AviseMe->validates()) |
|
| 63 | 63 | { |
| 64 | 64 | return $this->AviseMe->validationErrors; |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | - if (!$this->AviseMe->save($this->request->data)) |
|
| 67 | + if ( ! $this->AviseMe->save($this->request->data)) |
|
| 68 | 68 | { |
| 69 | 69 | return false; |
| 70 | 70 | } |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | ->subject('Produto Aviso'); |
| 100 | 100 | |
| 101 | 101 | $mensagem = ' |
| 102 | - <p><strong>Nome</strong>: '. $produto[0]['Produto']['nome'] .'</p> |
|
| 102 | + <p><strong>Nome</strong>: '. $produto[0]['Produto']['nome'].'</p> |
|
| 103 | 103 | '; |
| 104 | 104 | |
| 105 | 105 | if ($email->send($mensagem)) { |
@@ -96,11 +96,11 @@ discard block |
||
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | public function s_adicionar_cadastro() { |
| 99 | - $dados_venda = $this->request->data('venda'); |
|
| 99 | + $dados_venda = $this->request->data('venda'); |
|
| 100 | 100 | $dados_lancamento = $this->request->data('lancamento'); |
| 101 | - $produtos = $this->request->data('produto'); |
|
| 101 | + $produtos = $this->request->data('produto'); |
|
| 102 | 102 | |
| 103 | - if (!$this->validar_itens_venda($produtos)) { |
|
| 103 | + if ( ! $this->validar_itens_venda($produtos)) { |
|
| 104 | 104 | $this->Session->setFlash('Algum produto adicionado não possui estoque disponivel'); |
| 105 | 105 | $this->redirect('/venda/adicionar_cadastro'); |
| 106 | 106 | } |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | |
| 111 | 111 | $salvar_venda = $this->salvar_venda($produtos, $dados_lancamento, $dados_venda); |
| 112 | 112 | |
| 113 | - if (!$salvar_venda) { |
|
| 113 | + if ( ! $salvar_venda) { |
|
| 114 | 114 | $this->Session->setFlash('Ocorreu um erro ao salvar a venda tente novamento'); |
| 115 | 115 | $this->redirect('/venda/adicionar_cadastro'); |
| 116 | 116 | } |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | |
| 166 | 166 | $objProdutoEstoqueController = new ProdutoEstoqueController(); |
| 167 | 167 | |
| 168 | - if (!$objProdutoEstoqueController->validar_estoque($produto, $item['quantidade'])) { |
|
| 168 | + if ( ! $objProdutoEstoqueController->validar_estoque($produto, $item['quantidade'])) { |
|
| 169 | 169 | return false; |
| 170 | 170 | } |
| 171 | 171 | } |
@@ -182,7 +182,7 @@ discard block |
||
| 182 | 182 | $informacoes['desconto'] = (float) $informacoes['desconto']; |
| 183 | 183 | $informacoes['valor'] = $informacoes['valor'] - $informacoes['desconto']; |
| 184 | 184 | |
| 185 | - if (!$this->Venda->save($informacoes)) { |
|
| 185 | + if ( ! $this->Venda->save($informacoes)) { |
|
| 186 | 186 | $this->Session->setFlash('Ocorreu algum erro ao salvar a venda'); |
| 187 | 187 | return false; |
| 188 | 188 | } |
@@ -203,8 +203,8 @@ discard block |
||
| 203 | 203 | } |
| 204 | 204 | |
| 205 | 205 | public function relatorio_diario() { |
| 206 | - include(APP . 'Vendor/PHPExcel/PHPExcel.php'); |
|
| 207 | - include(APP . 'Vendor/PHPExcel/PHPExcel/IOFactory.php'); |
|
| 206 | + include(APP.'Vendor/PHPExcel/PHPExcel.php'); |
|
| 207 | + include(APP.'Vendor/PHPExcel/PHPExcel/IOFactory.php'); |
|
| 208 | 208 | |
| 209 | 209 | $objPHPExcel = new PHPExcel(); |
| 210 | 210 | // Definimos o estilo da fonte |
@@ -217,7 +217,7 @@ discard block |
||
| 217 | 217 | ->setCellValue('A1', "Valor Venda") |
| 218 | 218 | ->setCellValue('B1', "Custo Médio ") |
| 219 | 219 | ->setCellValue("C1", "Valor Lucro") |
| 220 | - ->setCellValue('D1', "ID Venda" ); |
|
| 220 | + ->setCellValue('D1', "ID Venda"); |
|
| 221 | 221 | |
| 222 | 222 | |
| 223 | 223 | $vendas = $this->Venda->find('all', |
@@ -234,9 +234,9 @@ discard block |
||
| 234 | 234 | $i = 2; |
| 235 | 235 | foreach ($vendas as $key => $venda) { |
| 236 | 236 | $objPHPExcel->setActiveSheetIndex(0) |
| 237 | - ->setCellValue('A'.$i, 'R$ ' . $venda['Venda']['valor']) |
|
| 238 | - ->setCellValue('B'.$i, 'R$ ' . $venda['Venda']['custo']) |
|
| 239 | - ->setCellValue('C'.$i, 'R$ ' . $venda['Venda']['valor'] - $venda['Venda']['custo']) |
|
| 237 | + ->setCellValue('A'.$i, 'R$ '.$venda['Venda']['valor']) |
|
| 238 | + ->setCellValue('B'.$i, 'R$ '.$venda['Venda']['custo']) |
|
| 239 | + ->setCellValue('C'.$i, 'R$ '.$venda['Venda']['valor'] - $venda['Venda']['custo']) |
|
| 240 | 240 | ->setCellValue('D'.$i, $venda['Venda']['id']); |
| 241 | 241 | $i++; |
| 242 | 242 | } |
@@ -260,7 +260,7 @@ discard block |
||
| 260 | 260 | exit; |
| 261 | 261 | } |
| 262 | 262 | |
| 263 | - public function recoverDataToDashboardOneWeek(){ |
|
| 263 | + public function recoverDataToDashboardOneWeek() { |
|
| 264 | 264 | $vendas = $this->Venda->find('all', |
| 265 | 265 | array('conditions' => |
| 266 | 266 | array( |
@@ -1,6 +1,6 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -require(APP . 'Controller/AviseMeController.php'); |
|
| 3 | +require(APP.'Controller/AviseMeController.php'); |
|
| 4 | 4 | |
| 5 | 5 | /** |
| 6 | 6 | * |
@@ -21,54 +21,54 @@ |
||
| 21 | 21 | { |
| 22 | 22 | $this->pagSeguroController->setToken('25AB84E7DE7647848D0819210140F79D'); |
| 23 | 23 | |
| 24 | - $this->pagSeguroController->setEmail('[email protected]'); |
|
| 24 | + $this->pagSeguroController->setEmail('[email protected]'); |
|
| 25 | 25 | |
| 26 | - $produto = array( |
|
| 27 | - 0 => array( |
|
| 28 | - 'Produto' => array( |
|
| 29 | - 'id' => 23, |
|
| 30 | - 'nome' => 'Produto Teste', |
|
| 31 | - 'variacao' => 'M', |
|
| 32 | - 'quantidade' => 1.00, |
|
| 33 | - 'preco' => 2.44 |
|
| 34 | - ) |
|
| 35 | - ) |
|
| 36 | - ); |
|
| 37 | - |
|
| 38 | - $this->pagSeguroController->setProdutos($produto); |
|
| 39 | - |
|
| 40 | - $this->pagSeguroController->adicionarProdutosGateway(); |
|
| 41 | - |
|
| 42 | - $endereco = array( |
|
| 43 | - 'cep' => '07252-000', |
|
| 44 | - 'endereco' => 'Avenida do Contorno', |
|
| 45 | - 'numero' => 19, |
|
| 46 | - 'complemento' => 'Viela', |
|
| 47 | - 'bairro' => 'Nova cidade', |
|
| 48 | - 'cidade' => 'Guarulhos', |
|
| 49 | - 'estado' => 'SP' |
|
| 50 | - ); |
|
| 51 | - |
|
| 52 | - $this->pagSeguroController->setEndereco($endereco); |
|
| 53 | - |
|
| 54 | - $cliente = array( |
|
| 55 | - 'nome' => 'Reginaldo Junior', |
|
| 56 | - 'email' => '[email protected]', |
|
| 57 | - 'ddd' => '11', |
|
| 58 | - 'telefone' => '946640932', |
|
| 59 | - 'cpf' => '43944409843' |
|
| 60 | - ); |
|
| 61 | - |
|
| 62 | - $this->pagSeguroController->setCliente($cliente); |
|
| 63 | - |
|
| 64 | - $this->pagSeguroController->setReference('#2324'); |
|
| 65 | - |
|
| 66 | - $this->pagSeguroController->setValorFrete(23.44); |
|
| 67 | - |
|
| 68 | - $url = $this->pagSeguroController->finalizarPedido(); |
|
| 69 | - |
|
| 70 | - $this->assertContains('http', $url); |
|
| 26 | + $produto = array( |
|
| 27 | + 0 => array( |
|
| 28 | + 'Produto' => array( |
|
| 29 | + 'id' => 23, |
|
| 30 | + 'nome' => 'Produto Teste', |
|
| 31 | + 'variacao' => 'M', |
|
| 32 | + 'quantidade' => 1.00, |
|
| 33 | + 'preco' => 2.44 |
|
| 34 | + ) |
|
| 35 | + ) |
|
| 36 | + ); |
|
| 37 | + |
|
| 38 | + $this->pagSeguroController->setProdutos($produto); |
|
| 39 | + |
|
| 40 | + $this->pagSeguroController->adicionarProdutosGateway(); |
|
| 41 | + |
|
| 42 | + $endereco = array( |
|
| 43 | + 'cep' => '07252-000', |
|
| 44 | + 'endereco' => 'Avenida do Contorno', |
|
| 45 | + 'numero' => 19, |
|
| 46 | + 'complemento' => 'Viela', |
|
| 47 | + 'bairro' => 'Nova cidade', |
|
| 48 | + 'cidade' => 'Guarulhos', |
|
| 49 | + 'estado' => 'SP' |
|
| 50 | + ); |
|
| 51 | + |
|
| 52 | + $this->pagSeguroController->setEndereco($endereco); |
|
| 53 | + |
|
| 54 | + $cliente = array( |
|
| 55 | + 'nome' => 'Reginaldo Junior', |
|
| 56 | + 'email' => '[email protected]', |
|
| 57 | + 'ddd' => '11', |
|
| 58 | + 'telefone' => '946640932', |
|
| 59 | + 'cpf' => '43944409843' |
|
| 60 | + ); |
|
| 61 | + |
|
| 62 | + $this->pagSeguroController->setCliente($cliente); |
|
| 63 | + |
|
| 64 | + $this->pagSeguroController->setReference('#2324'); |
|
| 65 | + |
|
| 66 | + $this->pagSeguroController->setValorFrete(23.44); |
|
| 67 | + |
|
| 68 | + $url = $this->pagSeguroController->finalizarPedido(); |
|
| 69 | + |
|
| 70 | + $this->assertContains('http', $url); |
|
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | } |
| 74 | - |
|
| 75 | 74 | \ No newline at end of file |
| 75 | + |
|
| 76 | 76 | \ No newline at end of file |
@@ -1,7 +1,7 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -require(APP . 'Controller/AppController.php'); |
|
| 4 | -require(APP . 'Controller/PagseguroController.php'); |
|
| 3 | +require(APP.'Controller/AppController.php'); |
|
| 4 | +require(APP.'Controller/PagseguroController.php'); |
|
| 5 | 5 | |
| 6 | 6 | /** |
| 7 | 7 | * PagseguroControllerTest |
@@ -17,11 +17,11 @@ |
||
| 17 | 17 | parent::setUp(); |
| 18 | 18 | } |
| 19 | 19 | |
| 20 | - public function testRecoverDataDuringOneWeekToDashboard() |
|
| 21 | - { |
|
| 22 | - $data = $this->VendaController->recoverDataToDashboardOneWeek(); |
|
| 23 | - $this->assertNotEmpty($data); |
|
| 24 | - } |
|
| 20 | + public function testRecoverDataDuringOneWeekToDashboard() |
|
| 21 | + { |
|
| 22 | + $data = $this->VendaController->recoverDataToDashboardOneWeek(); |
|
| 23 | + $this->assertNotEmpty($data); |
|
| 24 | + } |
|
| 25 | 25 | |
| 26 | 26 | } |
| 27 | - |
|
| 28 | 27 | \ No newline at end of file |
| 28 | + |
|
| 29 | 29 | \ No newline at end of file |
@@ -1,7 +1,7 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -require(APP . 'Controller/AppController.php'); |
|
| 4 | -require(APP . 'Controller/VendaController.php'); |
|
| 3 | +require(APP.'Controller/AppController.php'); |
|
| 4 | +require(APP.'Controller/VendaController.php'); |
|
| 5 | 5 | |
| 6 | 6 | /** |
| 7 | 7 | * VendaControllerTest |