@@ -169,7 +169,7 @@ discard block |
||
| 169 | 169 | |
| 170 | 170 | if ($produto[0]['Produto']['estoque'] <= 0) |
| 171 | 171 | { |
| 172 | - $this->Session->setFlash('O produto (' . $produto[0]['Produto']['nome'] .') não tem mais estoque disponivel!'); |
|
| 172 | + $this->Session->setFlash('O produto ('.$produto[0]['Produto']['nome'].') não tem mais estoque disponivel!'); |
|
| 173 | 173 | continue; |
| 174 | 174 | } |
| 175 | 175 | |
@@ -186,11 +186,11 @@ discard block |
||
| 186 | 186 | } |
| 187 | 187 | |
| 188 | 188 | public function s_adicionar_cadastro() { |
| 189 | - $dados_venda = $this->request->data('venda'); |
|
| 189 | + $dados_venda = $this->request->data('venda'); |
|
| 190 | 190 | $dados_lancamento = $this->request->data('lancamento'); |
| 191 | - $produtos = $this->request->data('produto'); |
|
| 191 | + $produtos = $this->request->data('produto'); |
|
| 192 | 192 | |
| 193 | - if (!$this->validar_itens_venda($produtos) && !$dados_venda['orcamento']) { |
|
| 193 | + if ( ! $this->validar_itens_venda($produtos) && ! $dados_venda['orcamento']) { |
|
| 194 | 194 | $this->Session->setFlash('Algum produto adicionado não possui estoque disponivel'); |
| 195 | 195 | $this->redirect('/venda/adicionar_cadastro'); |
| 196 | 196 | } |
@@ -200,7 +200,7 @@ discard block |
||
| 200 | 200 | |
| 201 | 201 | $salvar_venda = $this->salvar_venda($produtos, $dados_lancamento, $dados_venda); |
| 202 | 202 | |
| 203 | - if (!$salvar_venda) { |
|
| 203 | + if ( ! $salvar_venda) { |
|
| 204 | 204 | $this->Session->setFlash('Ocorreu um erro ao salvar a venda tente novamento'); |
| 205 | 205 | $this->redirect('/venda/adicionar_cadastro'); |
| 206 | 206 | } |
@@ -255,7 +255,7 @@ discard block |
||
| 255 | 255 | |
| 256 | 256 | $objProdutoEstoqueController = new ProdutoEstoqueController(); |
| 257 | 257 | |
| 258 | - if (!$objProdutoEstoqueController->validar_estoque($produto, $item['quantidade'])) { |
|
| 258 | + if ( ! $objProdutoEstoqueController->validar_estoque($produto, $item['quantidade'])) { |
|
| 259 | 259 | return false; |
| 260 | 260 | } |
| 261 | 261 | } |
@@ -273,7 +273,7 @@ discard block |
||
| 273 | 273 | $informacoes['valor'] = $informacoes['valor'] - $informacoes['desconto']; |
| 274 | 274 | $informacoes['orcamento'] = $informacoes['orcamento']; |
| 275 | 275 | |
| 276 | - if (!$this->Venda->save($informacoes)) { |
|
| 276 | + if ( ! $this->Venda->save($informacoes)) { |
|
| 277 | 277 | $this->Session->setFlash('Ocorreu algum erro ao salvar a venda'); |
| 278 | 278 | return false; |
| 279 | 279 | } |
@@ -294,8 +294,8 @@ discard block |
||
| 294 | 294 | } |
| 295 | 295 | |
| 296 | 296 | public function relatorio_diario() { |
| 297 | - include(APP . 'Vendor/PHPExcel/PHPExcel.php'); |
|
| 298 | - include(APP . 'Vendor/PHPExcel/PHPExcel/IOFactory.php'); |
|
| 297 | + include(APP.'Vendor/PHPExcel/PHPExcel.php'); |
|
| 298 | + include(APP.'Vendor/PHPExcel/PHPExcel/IOFactory.php'); |
|
| 299 | 299 | |
| 300 | 300 | $objPHPExcel = new PHPExcel(); |
| 301 | 301 | // Definimos o estilo da fonte |
@@ -308,7 +308,7 @@ discard block |
||
| 308 | 308 | ->setCellValue('A1', "Valor Venda") |
| 309 | 309 | ->setCellValue('B1', "Custo Médio ") |
| 310 | 310 | ->setCellValue("C1", "Valor Lucro") |
| 311 | - ->setCellValue('D1', "ID Venda" ); |
|
| 311 | + ->setCellValue('D1', "ID Venda"); |
|
| 312 | 312 | |
| 313 | 313 | |
| 314 | 314 | $vendas = $this->Venda->find('all', |
@@ -325,9 +325,9 @@ discard block |
||
| 325 | 325 | $i = 2; |
| 326 | 326 | foreach ($vendas as $key => $venda) { |
| 327 | 327 | $objPHPExcel->setActiveSheetIndex(0) |
| 328 | - ->setCellValue('A'.$i, 'R$ ' . $venda['Venda']['valor']) |
|
| 329 | - ->setCellValue('B'.$i, 'R$ ' . $venda['Venda']['custo']) |
|
| 330 | - ->setCellValue('C'.$i, 'R$ ' . $venda['Venda']['valor'] - $venda['Venda']['custo']) |
|
| 328 | + ->setCellValue('A'.$i, 'R$ '.$venda['Venda']['valor']) |
|
| 329 | + ->setCellValue('B'.$i, 'R$ '.$venda['Venda']['custo']) |
|
| 330 | + ->setCellValue('C'.$i, 'R$ '.$venda['Venda']['valor'] - $venda['Venda']['custo']) |
|
| 331 | 331 | ->setCellValue('D'.$i, $venda['Venda']['id']); |
| 332 | 332 | $i++; |
| 333 | 333 | } |
@@ -351,7 +351,7 @@ discard block |
||
| 351 | 351 | exit; |
| 352 | 352 | } |
| 353 | 353 | |
| 354 | - public function recoverDataToDashboardOneWeek($id_usuario){ |
|
| 354 | + public function recoverDataToDashboardOneWeek($id_usuario) { |
|
| 355 | 355 | $vendas = $this->Venda->find('all', |
| 356 | 356 | array('conditions' => |
| 357 | 357 | array( |
@@ -417,7 +417,7 @@ discard block |
||
| 417 | 417 | |
| 418 | 418 | $ImpressaoFiscalController->userName = $usuario['Usuario']['nome']; |
| 419 | 419 | |
| 420 | - $ImpressaoFiscalController->corpoTxt .= "Valor: R$ " . number_format($dados_venda['Venda']['valor'], 2, ',', '.') . "\n\n"; |
|
| 420 | + $ImpressaoFiscalController->corpoTxt .= "Valor: R$ ".number_format($dados_venda['Venda']['valor'], 2, ',', '.')."\n\n"; |
|
| 421 | 421 | |
| 422 | 422 | $dados_lancamento = $this->LancamentoVenda->find('first', |
| 423 | 423 | array('conditions' => |
@@ -428,7 +428,7 @@ discard block |
||
| 428 | 428 | ) |
| 429 | 429 | ); |
| 430 | 430 | |
| 431 | - $ImpressaoFiscalController->corpoTxt .= "Forma de Pagamento: " . $dados_lancamento['LancamentoVenda']['forma_pagamento'] . "\n\n"; |
|
| 431 | + $ImpressaoFiscalController->corpoTxt .= "Forma de Pagamento: ".$dados_lancamento['LancamentoVenda']['forma_pagamento']."\n\n"; |
|
| 432 | 432 | |
| 433 | 433 | $produtos = $this->VendaItensProduto->find('all', |
| 434 | 434 | array('conditions' => |
@@ -449,10 +449,10 @@ discard block |
||
| 449 | 449 | $total = $produto['Produto']['preco'] * $item['VendaItensProduto']['quantidade_produto']; |
| 450 | 450 | |
| 451 | 451 | $ImpressaoFiscalController->corpoTxt .= "" |
| 452 | - . "Produto: " . $produto['Produto']['nome'] |
|
| 453 | - . "\nQuantidade: " . $item['VendaItensProduto']['quantidade_produto'] |
|
| 454 | - . "\nPreço: R$ " . number_format($produto['Produto']['preco'], 2, ',', '.') |
|
| 455 | - . "\nTotal: R$ " . number_format($total, 2, ',', '.') |
|
| 452 | + . "Produto: ".$produto['Produto']['nome'] |
|
| 453 | + . "\nQuantidade: ".$item['VendaItensProduto']['quantidade_produto'] |
|
| 454 | + . "\nPreço: R$ ".number_format($produto['Produto']['preco'], 2, ',', '.') |
|
| 455 | + . "\nTotal: R$ ".number_format($total, 2, ',', '.') |
|
| 456 | 456 | . "\n--------------------------\n"; |
| 457 | 457 | } |
| 458 | 458 | |
@@ -1,20 +1,20 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -class HomeController extends AppController{ |
|
| 3 | +class HomeController extends AppController { |
|
| 4 | 4 | |
| 5 | - public function beforeFilter(){ |
|
| 5 | + public function beforeFilter() { |
|
| 6 | 6 | return true; |
| 7 | 7 | } |
| 8 | 8 | |
| 9 | - function index(){ |
|
| 9 | + function index() { |
|
| 10 | 10 | $this->layout = 'winners'; |
| 11 | 11 | } |
| 12 | 12 | |
| 13 | - function servicos(){ |
|
| 13 | + function servicos() { |
|
| 14 | 14 | $this->layout = 'winners'; |
| 15 | 15 | } |
| 16 | 16 | |
| 17 | - function timeline(){ |
|
| 17 | + function timeline() { |
|
| 18 | 18 | $this->layout = 'winners'; |
| 19 | 19 | } |
| 20 | 20 | |
@@ -27,10 +27,10 @@ discard block |
||
| 27 | 27 | $dados = $this->request->data('dados'); |
| 28 | 28 | |
| 29 | 29 | // Check for empty fields |
| 30 | - if(empty($dados['name']) || |
|
| 31 | - empty($dados['email']) || |
|
| 32 | - empty($dados['message']) || |
|
| 33 | - !filter_var($dados['email'], FILTER_VALIDATE_EMAIL)) { |
|
| 30 | + if (empty($dados['name']) || |
|
| 31 | + empty($dados['email']) || |
|
| 32 | + empty($dados['message']) || |
|
| 33 | + ! filter_var($dados['email'], FILTER_VALIDATE_EMAIL)) { |
|
| 34 | 34 | $this->Session->setFlash('Você deve preencher todos os dados!'); |
| 35 | 35 | return $this->redirect('/'); |
| 36 | 36 | } |
@@ -45,14 +45,14 @@ discard block |
||
| 45 | 45 | $email_body = "Mensagem site: ".$message; |
| 46 | 46 | $headers = "From: [email protected]\n"; // This is the email address the generated message will be from. We recommend using something like [email protected]. |
| 47 | 47 | $headers .= "Reply-To: $email_address"; |
| 48 | - mail($to,$email_subject,$email_body,$headers); |
|
| 48 | + mail($to, $email_subject, $email_body, $headers); |
|
| 49 | 49 | //resposta automatica ao cliente |
| 50 | 50 | $to = $email_address; |
| 51 | 51 | $email_subject = '[email protected]'; |
| 52 | 52 | $email_body = "A sua mensagem foi recebida, em breve responderemos"; |
| 53 | 53 | $headers = "From: [email protected]\n"; // This is the email address the generated message will be from. We recommend using something like [email protected]. |
| 54 | 54 | $headers .= "Reply-To: $email_address"; |
| 55 | - mail($to,$email_subject,$email_body,$headers); |
|
| 55 | + mail($to, $email_subject, $email_body, $headers); |
|
| 56 | 56 | |
| 57 | 57 | $this->Session->setFlash('Seu e-mail foi enviado com sucesso em breve responderemos!'); |
| 58 | 58 | return $this->redirect('/'); |