Skip to content
This repository has been archived by the owner on Mar 26, 2020. It is now read-only.

Commit

Permalink
Finalização dos dialógos de novas vendas
Browse files Browse the repository at this point in the history
  • Loading branch information
costvin15 committed Nov 16, 2018
1 parent 614ae85 commit 42ee448
Show file tree
Hide file tree
Showing 12 changed files with 814 additions and 74 deletions.
11 changes: 10 additions & 1 deletion data/clientes.data
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
40
41
0
93
991885880
Expand Down Expand Up @@ -359,3 +359,12 @@ Rua Acnhieta
123
123
Acre
Vinicius Costa Castro
98
985166409
Rua
Anchieta
1677
Centro
Altamira
Pará
25 changes: 25 additions & 0 deletions data/vendas.data
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
2
1542343839
Vinicius Costa Castro
Rua Anchieta - 1677, Centro, Altamira - Pará
(98) 985166409
1
Monitor Dell 0
699,990000
50
0,000000
0
34999,500000
34999,500000
1542344175
Vinicius Costa Castro
Rua Anchieta - 1677, Centro, Altamira - Pará
(98) 985166409
1
Monitor Dell 0
699,990000
5
0,000000
0
3499,950000
3499,950000
8 changes: 5 additions & 3 deletions headers/carrinho.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,19 @@ typedef struct {
unsigned int tamanho;
struct produto_vendido *produtos;
double desconto;
int descontopercento;
double preco;
double preco_final;
} Carrinho;

Carrinho *criar_carrinho();
void apagar_carrinho(Carrinho *);
void redefinir_carrinho(Carrinho *);

void adicionar_produto_carrinho(Carrinho *, struct produto, int quantidade);
void adicionar_produto_vendido_carrinho(Carrinho *, struct produto_vendido);

void adicionar_produto_carrinho(Carrinho *, struct produto, int);
void remover_produto_carrinho(Carrinho *, int);

void definir_desconto(Carrinho *, double);
void definir_desconto(Carrinho *, int);

#endif
13 changes: 12 additions & 1 deletion headers/vendas.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,16 @@
#include <stdio.h>
#include <stdlib.h>

struct comprador {
char nome[100];
char endereco[210];
char telefone[15];
};

struct venda {
unsigned int index;
time_t horario;
struct cliente cliente;
struct comprador cliente;
Carrinho carrinho;
};

Expand All @@ -24,6 +30,11 @@ Vendas *reutilizar_vendas();
Vendas *criar_vendas();
void apagar_vendas(Vendas *);

void adicionar_venda(Vendas *, struct comprador, Carrinho *, time_t);

void popular_vendas(Vendas *lista);
void salvar_vendas(Vendas *);

void nova_venda(Vendas *, struct cliente, Carrinho *);
void remover_venda(Vendas *, int);

Expand Down
145 changes: 145 additions & 0 deletions interfaces/carrinho.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
<?xml version="1.0" encoding="UTF-8" ?>

<interface>
<object class="GtkListStore" id="list_store_carrinho">
<columns>
<column type="gchararray" />
<column type="gint" />
<column type="gchararray" />
</columns>
</object>

<object class="GtkAdjustment" id="quantidade_adjustment">
<property name="lower">1</property>
<property name="upper">2147483647</property>
<property name="value">1</property>
<property name="step-increment">1</property>
</object>

<object class="GtkDialog" id="dialog">
<property name="can_focus">False</property>
<property name="border_width">5</property>
<property name="resizable">False</property>
<property name="window_position">center</property>
<property name="default_width">450</property>

<child internal-child="vbox">
<object class="GtkBox">
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">2</property>

<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label">Carrinho atual</property>
</object>
</child>

<child>
<object class="GtkBox">
<property name="height_request">100</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="orientation">vertical</property>

<child>
<object class="GtkTreeView" id="tree_view_carrinho">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="model">list_store_carrinho</property>

<child internal-child="selection">
<object class="GtkTreeSelection" />
</child>

<child>
<object class="GtkTreeViewColumn">
<property name="title" translatable="yes">Nome</property>
<child>
<object class="GtkCellRendererText" />
<attributes>
<attribute name="text">0</attribute>
</attributes>
</child>
</object>
</child>

<child>
<object class="GtkTreeViewColumn">
<property name="title" translatable="yes">Quantidade</property>
<child>
<object class="GtkCellRendererText" />
<attributes>
<attribute name="text">1</attribute>
</attributes>
</child>
</object>
</child>

<child>
<object class="GtkTreeViewColumn">
<property name="title" translatable="yes">Preço Unitário</property>
<child>
<object class="GtkCellRendererText" />
<attributes>
<attribute name="text">2</attribute>
</attributes>
</child>
</object>
</child>
</object>
</child>
</object>
</child>

<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label">Adicionar ao carrinho</property>
</object>
</child>

<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="orientation">horizontal</property>

<child>
<object class="GtkEntry" id="inputProduto">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="placeholder-text">Digite o nome do produto</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>

<child>
<object class="GtkSpinButton" id="inputQuantidade">
<property name="visible">True</property>
<property name="adjustment">quantidade_adjustment</property>
</object>
</child>
</object>
</child>

<child>
<object class="GtkButton" id="inputSubmit">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label">Adicionar ao carrinho</property>
</object>
</child>
</object>
</child>
</object>
</interface>
26 changes: 25 additions & 1 deletion interfaces/main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
<column type="gchararray"/>
<!-- column-name gchararray1 -->
<column type="gchararray"/>
<column type="gchararray"/>
<column type="gchararray"/>
</columns>
</object>
<object class="GtkWindow" id="window">
Expand Down Expand Up @@ -307,7 +309,7 @@
</child>
<child>
<object class="GtkTreeViewColumn">
<property name="title" translatable="yes">Horário da Venda</property>
<property name="title" translatable="yes">Produtos</property>
<child>
<object class="GtkCellRendererText"/>
<attributes>
Expand All @@ -316,6 +318,28 @@
</child>
</object>
</child>
<child>
<object class="GtkTreeViewColumn">
<property name="title" translatable="yes">Preço</property>
<child>
<object class="GtkCellRendererText"/>
<attributes>
<attribute name="text">2</attribute>
</attributes>
</child>
</object>
</child>
<child>
<object class="GtkTreeViewColumn">
<property name="title" translatable="yes">Horário</property>
<child>
<object class="GtkCellRendererText"/>
<attributes>
<attribute name="text">3</attribute>
</attributes>
</child>
</object>
</child>
</object>
<packing>
<property name="expand">True</property>
Expand Down
Loading

0 comments on commit 42ee448

Please sign in to comment.