Skip to content

Commit

Permalink
Adicionado observacões em vendas (#965)
Browse files Browse the repository at this point in the history
* Adicionado observacões em vendas

* Apply php-cs-fixer changes

Co-authored-by: Pr3d4dor <Pr3d4dor@users.noreply.github.com>
  • Loading branch information
Pr3d4dor and Pr3d4dor authored Sep 26, 2020
1 parent ad94ad7 commit 2872149
Show file tree
Hide file tree
Showing 10 changed files with 71 additions and 8 deletions.
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,12 @@ Todas as alterações serão documentadas neste arquivo
Formato baseado em [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
e [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [4.14.1] - 2020-09-20
## [4.15.0] - 2020-09-21

## Added
- Adicionado observacões em vendas. [@Pr3d4dor](https://github.com/Pr3d4dor)

## [4.14.1] - 2020-09-21

## Fixed
- Corrigido busca de calendário de OS. [@Pr3d4dor](https://github.com/Pr3d4dor)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

![MapOS](https://raw.githubusercontent.com/RamonSilva20/mapos/master/assets/img/logo.png)

![version](https://img.shields.io/badge/version-4.14.1-blue.svg?longCache=true&style=flat-square)
![version](https://img.shields.io/badge/version-4.15.0-blue.svg?longCache=true&style=flat-square)
![license](https://img.shields.io/badge/license-MIT-green.svg?longCache=true&style=flat-square)
![theme](https://img.shields.io/badge/theme-Matrix--Admin-lightgrey.svg?longCache=true&style=flat-square)
![issues](https://img.shields.io/github/issues/RamonSilva20/mapos.svg?longCache=true&style=flat-square)
Expand Down
2 changes: 1 addition & 1 deletion application/config/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
/**
* App current version
*/
$config['app_version'] = '4.14.1';
$config['app_version'] = '4.15.0';

/**
* Nome do sistema
Expand Down
5 changes: 5 additions & 0 deletions application/config/form_validation.php
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,11 @@
'label' => 'Data da Venda',
'rules' => 'required|trim',
],
[
'field' => 'observacoes',
'label' => 'Observacoes',
'rules' => 'trim',
],
[
'field' => 'clientes_id',
'label' => 'clientes',
Expand Down
6 changes: 4 additions & 2 deletions application/controllers/Vendas.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ public function adicionar()

$data = [
'dataVenda' => $dataVenda,
'observacoes' => $this->input->post('observacoes'),
'clientes_id' => $this->input->post('clientes_id'),
'usuarios_id' => $this->input->post('usuarios_id'),
'faturado' => 0,
Expand Down Expand Up @@ -116,6 +117,7 @@ public function editar()

$data = [
'dataVenda' => $dataVenda,
'observacoes' => $this->input->post('observacoes'),
'usuarios_id' => $this->input->post('usuarios_id'),
'clientes_id' => $this->input->post('clientes_id'),
];
Expand Down Expand Up @@ -276,7 +278,7 @@ public function adicionarProduto()

if ($this->vendas_model->add('itens_de_vendas', $data) == true) {
$this->load->model('produtos_model');

if ($this->data['configuration']['control_estoque']) {
$this->produtos_model->updateEstoque($produto, $quantidade, '-');
}
Expand All @@ -303,7 +305,7 @@ public function excluirProduto()
$produto = $this->input->post('produto');

$this->load->model('produtos_model');

if ($this->data['configuration']['control_estoque']) {
$this->produtos_model->updateEstoque($produto, $quantidade, '+');
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

class Migration_add_observacoes_to_vendas_table extends CI_Migration
{
public function up()
{
$this->dbforge->add_column('vendas', [
'observacoes' => [
'type' => 'TEXT',
'null' => true,
'default' => null,
],
]);
}

public function down()
{
$this->dbforge->drop_column('vendas', 'observacoes');
}
}
15 changes: 15 additions & 0 deletions application/views/vendas/adicionarVenda.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
<link rel="stylesheet" href="<?php echo base_url(); ?>assets/js/jquery-ui/css/smoothness/jquery-ui-1.9.2.custom.css" />
<script type="text/javascript" src="<?php echo base_url() ?>assets/js/jquery-ui/js/jquery-ui-1.9.2.custom.js"></script>
<script type="text/javascript" src="<?php echo base_url() ?>assets/js/jquery.validate.js"></script>
<link rel="stylesheet" href="<?php echo base_url() ?>assets/trumbowyg/ui/trumbowyg.css">
<script type="text/javascript" src="<?php echo base_url() ?>assets/trumbowyg/trumbowyg.js"></script>
<script type="text/javascript" src="<?php echo base_url() ?>assets/trumbowyg/langs/pt_br.js"></script>

<div class="row-fluid" style="margin-top:0">
<div class="span12">
<div class="widget-box">
Expand Down Expand Up @@ -38,6 +42,14 @@
<input id="usuarios_id" class="span12" type="hidden" name="usuarios_id" value="<?= $this->session->userdata('id'); ?>" />
</div>
</div>

<div class="span12" style="padding: 1%; margin-left: 0">
<label for="observacoes">
<h4>Observações</h4>
</label>
<textarea class="editor" name="observacoes" id="observacoes" cols="30" rows="5"></textarea>
</div>

<div class="span12" style="padding: 1%; margin-left: 0">
<div class="span6 offset3" style="text-align: center">
<button class="btn btn-success" id="btnContinuar"><i class="fas fa-share"></i> Continuar</button>
Expand Down Expand Up @@ -106,5 +118,8 @@
$(".datepicker").datepicker({
dateFormat: 'dd/mm/yy'
});
$('.editor').trumbowyg({
lang: 'pt_br'
});
});
</script>
17 changes: 15 additions & 2 deletions application/views/vendas/editarVenda.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
<link rel="stylesheet" href="<?php echo base_url(); ?>assets/js/jquery-ui/css/smoothness/jquery-ui-1.9.2.custom.css" />
<script type="text/javascript" src="<?php echo base_url() ?>assets/js/jquery-ui/js/jquery-ui-1.9.2.custom.js"></script>
<script src="<?php echo base_url() ?>assets/js/sweetalert2.all.min.js"></script>

<link rel="stylesheet" href="<?php echo base_url() ?>assets/trumbowyg/ui/trumbowyg.css">
<script type="text/javascript" src="<?php echo base_url() ?>assets/trumbowyg/trumbowyg.js"></script>
<script type="text/javascript" src="<?php echo base_url() ?>assets/trumbowyg/langs/pt_br.js"></script>

<div class="row-fluid" style="margin-top:0">
<div class="span12">
Expand Down Expand Up @@ -42,6 +44,14 @@
<input id="usuarios_id" class="span12" type="hidden" name="usuarios_id" value="<?php echo $result->usuarios_id ?>" />
</div>
</div>

<div class="span12" style="padding: 1%; margin-left: 0">
<label for="observacoes">
<h4>Observações</h4>
</label>
<textarea class="editor" name="observacoes" id="observacoes" cols="30" rows="5"><?php echo $result->observacoes ?></textarea>
</div>

<div class="span12" style="padding: 1%; margin-left: 0">
<div class="span8 offset2" style="text-align: center">
<?php if ($result->faturado == 0) { ?>
Expand Down Expand Up @@ -329,7 +339,7 @@
<?php if (!$configuration['control_estoque']) {
echo 'estoque = 1000000';
}; ?>

if (estoque < quantidade) {
Swal.fire({
type: "warning",
Expand Down Expand Up @@ -392,5 +402,8 @@
$(".datepicker").datepicker({
dateFormat: 'dd/mm/yy'
});
$('.editor').trumbowyg({
lang: 'pt_br'
});
});
</script>
3 changes: 2 additions & 1 deletion banco.sql
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,7 @@ CREATE TABLE IF NOT EXISTS `vendas` (
`valorTotal` VARCHAR(45) NULL,
`desconto` VARCHAR(45) NULL,
`faturado` TINYINT(1) NULL,
`observacoes` TEXT NULL,
`clientes_id` INT(11) NOT NULL,
`usuarios_id` INT(11) NULL,
`lancamentos_id` INT(11) NULL,
Expand Down Expand Up @@ -577,7 +578,7 @@ INSERT INTO `permissoes` (`idPermissao`, `nome`, `permissoes`, `situacao`, `data
INSERT INTO `usuarios` (`idUsuarios`, `nome`, `rg`, `cpf`, `cep`, `rua`, `numero`, `bairro`, `cidade`, `estado`, `email`, `senha`, `telefone`, `celular`, `situacao`, `dataCadastro`, `permissoes_id`,`dataExpiracao`) VALUES
(1, 'admin_name', 'MG-25.502.560', '600.021.520-87', '70005-115', 'Rua Acima', '12', 'Alvorada', 'Teste', 'MG', 'admin_email', 'admin_password', '000000-0000', '', 1, 'admin_created_at', 1, '3000-01-01');

INSERT INTO `migrations`(`version`) VALUES ('20200428012421');
INSERT INTO `migrations`(`version`) VALUES ('20200921012421');

SET SQL_MODE=@OLD_SQL_MODE;
SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;
Expand Down
2 changes: 2 additions & 0 deletions updates/update_4.14.1_to_4.15.0.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-- Alterando tabela vendas
ALTER TABLE vendas ADD observacoes TEXT DEFAULT NULL NULL;

0 comments on commit 2872149

Please sign in to comment.