Esempio n. 1
0
        private void Carregar()
        {
            if (idvenda > 0)
            {
                CCaixa caixa = new CCaixa();
                idcaixa   = caixa.pegaIdAberto();
                valorpago = 0;
                dt        = contareceber.carregarParcelas(idvenda);
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    valorpago += decimal.Parse(dt.Rows[i]["par_valor"].ToString());
                }

                venda = new CVenda();
                venda.pesquisarvendaIdVenda(idvenda);
                desconto        = venda.ven_desconto;
                grid.DataSource = dt;

                CItemVenda c           = new CItemVenda();
                DataTable  dtitemvenda = c.pesquisar(idvenda);
                gridproduto.DataSource = dtitemvenda;
            }
            else
            {
                CCaixa caixa = new CCaixa();
                idcaixa = caixa.pegaIdAberto();
            }

            mostrar();
        }
Esempio n. 2
0
        public FPreVenda(int ven_id, int idcliente)
        {
            InitializeComponent();
            grid.AutoGenerateColumns = false;
            lbltitulo.MouseDown     += new MouseEventHandler(Form3_MouseDown);
            lbltitulo.MouseMove     += new MouseEventHandler(Form3_MouseMove);
            pnltitulo.BackColor      = Color.FromArgb(50, Color.Black);

            this.idvenda = ven_id;
            CVenda venda = new CVenda();

            venda.pesquisarvendaIdVenda(idvenda);
            if (venda.ven_status == 1 && ven_id > 0)
            {
                cliente.pesquisarID(idcliente);
                btncliente.Text = cliente.nome;
                venda           = new CVenda();
                dt = venda.pesquisarPreVendaIDCliente(idcliente);
                grid.DataSource  = dt;
                btntodos.Enabled = false;
                grid.Enabled     = false;
            }
            else
            {
                btnadicionar.Enabled = false;
            }
        }
Esempio n. 3
0
        private void btntodos_Click(object sender, EventArgs e)
        {
            CVenda venda = new CVenda();

            dt = venda.pesquisarPreVenda();
            grid.DataSource = dt;
        }
Esempio n. 4
0
        private void btnadicionar_Click(object sender, EventArgs e)
        {
            if (cliente.id < 1)
            {
                fmok.Mostrar("Selecione um cliente!"); return;
            }
            CVenda venda = new CVenda();

            venda.inserirPreVenda(idvenda, cliente.id);
            fmok.Mostrar("Adicionado com Sucesso!");
            FMessageSimNao f = new FMessageSimNao();

            if (f.Mostrar("Imprimir?", "Deseja imprimir demonstrativo da Pré Venda?"))
            {
                PrintDialog pd = new PrintDialog();
                if (pd.ShowDialog() == DialogResult.OK)
                {
                    carregarvenda(idvenda);
                    carregarcliente();
                    carregaritemvenda();

                    empresa.carregar();
                    mostraritemvenda(dtitemvenda);

                    PrintDocument printDocument = new PrintDocument();
                    printDocument.PrintPage      += PrintDocumentOnPrintPage;
                    printDocument.PrinterSettings = pd.PrinterSettings;
                    printDocument.Print();
                }
            }
            idvenda = 0;
            Close();
        }
Esempio n. 5
0
        private void btncancelardesconto_Click(object sender, EventArgs e)
        {
            CVenda venda = new CVenda();

            venda.pesquisarvendaIdVenda(idvenda);
            decimal desconto = -1 * venda.ven_desconto;

            venda.aplicardesconto(idvenda, desconto);
            Carregar();
        }
Esempio n. 6
0
        private void btncliente_Click(object sender, EventArgs e)
        {
            FConsultaCliente f = new FConsultaCliente();

            f.ShowDialog();
            if (f.ok)
            {
                int idcliente = 0;
                int.TryParse(f.dt.Rows[f.index]["cli_id"].ToString(), out idcliente);
                cliente.pesquisarID(idcliente);
                btncliente.Text = cliente.nome;
                CVenda venda = new CVenda();
                dt = venda.pesquisarPreVendaIDCliente(idcliente);
                grid.DataSource = dt;
            }
        }
Esempio n. 7
0
        private void btndesconto_Click(object sender, EventArgs e)
        {
            FInput f = new FInput();

            if (f.Mostrar("Aplicar Desconto", "Informe a porcentagem de desconto"))
            {
                try
                {
                    //ttbdesconto.Text = (decimal.Parse(ttbdesconto.Text) + decimal.Parse(f.valor)).ToString("00.00");
                    CVenda  c        = new CVenda();
                    decimal desconto = decimal.Parse(ttbsubtotal.Text) * (decimal.Parse(f.valor) / 100);
                    c.aplicardesconto(idvenda, desconto);
                    Carregar();
                }
                catch {  }
            }
        }
        private void frmRelatorios_Load(object sender, EventArgs e)
        {
            foreach (var item in CVenda.ListaVendas())
            {
                dgvVendas.Rows.Add(item.Item1, item.Item2, item.Item3, item.Item4, item.Item5, item.Item6);
            }

            foreach (var item in CVenda.VendedoresQueMaisVendem())
            {
                dgvVendedores.Rows.Add(item.Item1, item.Item2);
            }

            foreach (var item in CVenda.ProdutosMaisVendidos())
            {
                dgvProdutos.Rows.Add(item.Item1, item.Item2);
            }
        }
Esempio n. 9
0
        private void btnconfirmar_Click(object sender, EventArgs e)
        {
            CCaixa  c     = new CCaixa();
            decimal valor = 0;

            CVenda venda = new CVenda();

            venda.pesquisarvendaaberta(idcaixa);
            if (venda.ven_status == 1)
            {
                fmok.Mostrar("Não é possível fechar o caixa com uma venda aberta!");
                return;
            }

            try
            {
                decimal.Parse(ttbdinheiro.Text);
            }
            catch { fmok.Mostrar("Valor em dinheiro inválido!"); return; }
            try
            {
                decimal.Parse(ttbcheque.Text);
            }
            catch { fmok.Mostrar("Valor em cheque inválido!"); return; }
            try
            {
                decimal.Parse(ttbcartao.Text);
            }
            catch { fmok.Mostrar("Valor em cartão inválido!"); return; }
            try
            {
                decimal.Parse(ttbfiado.Text);
            }
            catch { fmok.Mostrar("Valor em Fiado inválido!"); return; }

            try
            {
                valor = dinheiro + cheque + credito + fiado;
            }
            catch { fmok.Mostrar("Valor de Fechamento Inválido!"); return; }
            c.fechar(idfuncionario, valor, DateTime.Now, DateTime.Now, 0, "");
            fmok.Mostrar("Caixa fechado com sucesso!");
            ok = true;
            Close();
        }
Esempio n. 10
0
        private void btnconfirmar_Click(object sender, EventArgs e)
        {
            if (idvenda <= 0)
            {
                if (troco < 0)
                {
                    return;
                }
            }


            if (idvenda > 0)
            {
                CVenda c = new CVenda();
                c.atualizarDesconto(idvenda, desconto);
            }

            if (troco >= 0)
            {
                ok = true;
            }
            else
            {
                ok = false;
            }

            if (idvenda > 0)
            {
                Close();
            }
            else
            {
                if (ok)
                {
                    Close();
                }
                else
                {
                    Carregar();
                }
            }
        }
Esempio n. 11
0
        private void btnConfirmarCompra_Click(object sender, EventArgs e)
        {
            if (verificaDadosObrigatorios())
            {
                if (MessageBox.Show("Deseja concluir a compra?", "Confirmação da Compra", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    Venda oVenda    = new Venda();
                    int   idCliente = Convert.ToInt32(pegaIdItem(lstClientes.SelectedItem.ToString()));
                    oVenda.oCliente = Cliente.SelecionarCliente(idCliente);

                    ItemVenda itemVenda;
                    foreach (string item in lstCarrinho.Items)
                    {
                        itemVenda            = new ItemVenda();
                        itemVenda.oProduto   = Produto.SelecionarProduto(pegaIdItem(item.ToString()));;
                        itemVenda.Quantidade = Convert.ToInt16(pegaQuantidade(item));
                        oVenda.Itens.Add(itemVenda);
                    }

                    int idVendedor = Convert.ToInt32(pegaIdItem(lstVendedor.SelectedItem.ToString()));
                    oVenda.oFuncionario = Funcionario.SelecionarFuncionario(idVendedor);
                    CVenda.IncluirVenda(oVenda);

                    MessageBox.Show("Venda Concluída", "Status", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    lstCarrinho.SelectedIndex             =
                        lstClientes.SelectedIndex         =
                            lstProdutos.SelectedIndex     =
                                lstVendedor.SelectedIndex = -1;

                    lstCarrinho.Items.Clear();
                    totalAPagar = 0;
                    AtualizaTotalAPagar();
                }
            }
            else
            {
                MessageBox.Show("Todos os dados devem ser selecionandos antes da confirmação da compra", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
Esempio n. 12
0
        private void carregarCaixa(int idcaixa)
        {
            CCaixa c = new CCaixa();

            dtcaixa = c.pegacaixa(idcaixa);
            CContaReceber creceber  = new CContaReceber();
            DataTable     dtreceber = creceber.carregarParcelasCaixa(idcaixa);

            total         = c.totalCaixa(idcaixa);
            totaldinheiro = 0;
            totalcheque   = 0;
            totalfiado    = 0;
            totalcartao   = 0;
            totaldesconto = 0;
            CVenda    cvenda  = new CVenda();
            DataTable dtvenda = cvenda.pesquisarIDCaixa(idcaixa);

            try
            {
                for (int i = 0; i < dtvenda.Rows.Count; i++)
                {
                    totaldesconto += decimal.Parse(dtvenda.Rows[i]["ven_desconto"].ToString());
                }
                for (int i = 0; i < dtreceber.Rows.Count; i++)
                {
                    if (dtreceber.Rows[i]["par_descricao"].ToString().ToUpper() == "DINHEIRO")
                    {
                        totaldinheiro += decimal.Parse(dtreceber.Rows[i]["par_valor"].ToString());
                    }
                    if (dtreceber.Rows[i]["par_descricao"].ToString().ToUpper() == "CHEQUE")
                    {
                        totalcheque += decimal.Parse(dtreceber.Rows[i]["par_valor"].ToString());
                    }
                    if (dtreceber.Rows[i]["par_descricao"].ToString().ToUpper() == "MARCAR")
                    {
                        totalfiado += decimal.Parse(dtreceber.Rows[i]["par_valor"].ToString());
                    }
                    if (dtreceber.Rows[i]["par_descricao"].ToString().ToUpper().Contains("CARTÃO"))
                    {
                        totalcartao += decimal.Parse(dtreceber.Rows[i]["par_valor"].ToString());
                    }
                }
                ttbcaixanumero.Text = dtcaixa.Rows[0]["cai_numero"].ToString();
                try
                {
                    ttbcaixavalorinicial.Text = decimal.Parse(dtcaixa.Rows[0]["cai_valorinicial"].ToString()).ToString("00.00");
                }
                catch { ttbcaixavalorinicial.Text = "00,00"; }

                ttbdinheirototal.Text = totaldinheiro.ToString("00.00");
                ttbchequetotal.Text   = totalcheque.ToString("00.00");
                ttbfiadototal.Text    = totalfiado.ToString("00.00");
                ttbcartaototal.Text   = totalcartao.ToString("00.00");
                ttbdescontototal.Text = totaldesconto.ToString("00.00");

                // total = totaldinheiro + totalcheque + totalfiado + totalcartao - totaldesconto;
                total         = total - totaldesconto;
                ttbtotal.Text = total.ToString("00.00");



                //ttbcaixavalordinheiro.Text =
                //ttbvalor.Text = c.totalCaixa(idcaixa).ToString("00.00");
                //lblvalor.Text = ttbvalor.Text;
            }
            catch { }
        }
Esempio n. 13
0
 public CarrinhoController()
 {
     _c               = new CLivro();
     _cvenda          = new CVenda();
     _cLivrosVendidos = new CLivrosVendidos();
 }
Esempio n. 14
0
        private void buttonCadastrar_Click(object sender, EventArgs e)
        {
            Conexao con      = new Conexao();
            CVenda  AlterVen = new CVenda();

            AlterVen.Placa        = maskedTextBoxPlaca.Text;
            AlterVen.Chassi       = textBoxChassi.Text;
            AlterVen.Veiculo      = textBoxVeiculo.Text;
            AlterVen.Modelo       = textBoxModelo.Text;
            AlterVen.Fabricacao   = textBoxFabricacao.Text;
            AlterVen.Valorveiculo = Int32.Parse(textBoxVenda.Text);
            AlterVen.Data         = maskedTextBoxData.Text;
            AlterVen.Hora         = textBoxHora.Text;
            AlterVen.Nome         = textBoxNome.Text;
            AlterVen.Cpf          = maskedTextBoxCpf.Text;
            AlterVen.Rg           = maskedTextBoxRg.Text;
            AlterVen.Expedicao    = maskedTextBoxExpedicao.Text;
            AlterVen.Nascimento   = maskedTextBoxNascimento.Text;
            if (radioButtonMasculino.Checked)
            {
                AlterVen.Sexo = "Masculino";
            }
            else
            {
                AlterVen.Sexo = "Feminino";
            }
            AlterVen.Civil    = comboBoxCivil.Text;
            AlterVen.Endereco = textBoxEndereco.Text;
            AlterVen.Numero   = textBoxNumero.Text;
            AlterVen.Cep      = maskedTextBoxCep.Text;
            AlterVen.Bairro   = textBoxBairro.Text;
            AlterVen.Cidade   = textBoxCidade.Text;
            AlterVen.Estado   = comboBoxUF.Text;
            AlterVen.Telefone = maskedTextBoxTelefone.Text;
            AlterVen.Celular  = maskedTextBoxCelular.Text;
            AlterVen.Email    = textBoxEmail.Text;

            con.AlterarVenda(AlterVen, textBoxID.Text);

            MessageBox.Show("Alteração Realizada com sucesso !");

            maskedTextBoxPlaca.Text      = "";
            textBoxChassi.Text           = "";
            textBoxVeiculo.Text          = "";
            textBoxModelo.Text           = "";
            textBoxFabricacao.Text       = "";
            textBoxVenda.Text            = "";
            maskedTextBoxData.Text       = "";
            textBoxHora.Text             = "";
            textBoxNome.Text             = "";
            maskedTextBoxCpf.Text        = "";
            maskedTextBoxRg.Text         = "";
            maskedTextBoxExpedicao.Text  = "";
            maskedTextBoxNascimento.Text = "";
            radioButtonFeminino.Text     = "";
            radioButtonMasculino.Text    = "";
            comboBoxCivil.Text           = "";
            textBoxEndereco.Text         = "";
            textBoxNumero.Text           = "";
            maskedTextBoxCep.Text        = "";
            textBoxBairro.Text           = "";
            textBoxCidade.Text           = "";
            comboBoxUF.Text            = "";
            maskedTextBoxTelefone.Text = "";
            maskedTextBoxCelular.Text  = "";
            textBoxEmail.Text          = "";

            this.Close();
        }
Esempio n. 15
0
        private void buttonCadastrar_Click(object sender, EventArgs e)
        {
            CVenda  venda = new CVenda();
            Conexao con   = new Conexao();

            venda.Placa        = maskedTextBoxPlaca.Text;
            venda.Chassi       = textBoxChassi.Text;
            venda.Veiculo      = textBoxVeiculo.Text;
            venda.Modelo       = textBoxModelo.Text;
            venda.Fabricacao   = textBoxFabricacao.Text;
            venda.Valorveiculo = Int32.Parse(textBoxVenda.Text);
            venda.Data         = maskedTextBoxData.Text;
            venda.Hora         = textBoxHora.Text;
            venda.Vendedor     = textBoxVendedor.Text;
            venda.Comissao     = Int32.Parse(textBoxComissao.Text);
            venda.Nome         = textBoxNome.Text;
            venda.Cpf          = maskedTextBoxCpf.Text;
            venda.Rg           = maskedTextBoxRg.Text;
            venda.Expedicao    = maskedTextBoxExpedicao.Text;
            venda.Nascimento   = maskedTextBoxNascimento.Text;
            if (radioButtonMasculino.Checked)
            {
                venda.Sexo = "Masculino";
            }
            else
            {
                venda.Sexo = "Feminino";
            }
            venda.Civil    = comboBoxCivil.Text;
            venda.Endereco = textBoxEndereco.Text;
            venda.Numero   = textBoxNumero.Text;
            venda.Cep      = maskedTextBoxCep.Text;
            venda.Bairro   = textBoxBairro.Text;
            venda.Cidade   = textBoxCidade.Text;
            venda.Estado   = comboBoxUF.Text;
            venda.Telefone = maskedTextBoxTelefone.Text;
            venda.Celular  = maskedTextBoxCelular.Text;
            venda.Email    = textBoxEmail.Text;

            con.CadasVenda(venda);

            MessageBox.Show("Cadastro Efetuado com sucesso !");

            maskedTextBoxPlaca.Text      = "";
            maskedTextBoxPlaca.Text      = "";
            textBoxChassi.Text           = "";
            textBoxVeiculo.Text          = "";
            textBoxModelo.Text           = "";
            textBoxFabricacao.Text       = "";
            textBoxVenda.Text            = "";
            maskedTextBoxData.Text       = "";
            textBoxHora.Text             = "";
            textBoxVendedor.Text         = "";
            textBoxComissao.Text         = "";
            textBoxNome.Text             = "";
            maskedTextBoxCpf.Text        = "";
            maskedTextBoxRg.Text         = "";
            maskedTextBoxExpedicao.Text  = "";
            maskedTextBoxNascimento.Text = "";
            radioButtonFeminino.Text     = "";
            radioButtonMasculino.Text    = "";
            comboBoxCivil.Text           = "";
            textBoxEndereco.Text         = "";
            textBoxNumero.Text           = "";
            maskedTextBoxCep.Text        = "";
            textBoxBairro.Text           = "";
            textBoxCidade.Text           = "";
            comboBoxUF.Text            = "";
            maskedTextBoxTelefone.Text = "";
            maskedTextBoxCelular.Text  = "";
            textBoxEmail.Text          = "";

            this.Close();
        }