Beispiel #1
0
        //Retorna o cliente no qual sera feito a negociação
        private void SelecionarClienteId(ItemContaReceber item)
        {
            ItemContaReceber   itemContaReceber   = new ItemContaReceber();
            ItemContaReceberBO itemContaReceberBO = new ItemContaReceberBO();

            itemContaReceber = itemContaReceberBO.SelecionarItemContaReceberID(item._ItemContaReceberID);

            if (itemContaReceber != null)
            {
                ContasReceber   contaReceber   = new ContasReceber();
                ContasReceberBO contaReceberBO = new ContasReceberBO();

                contaReceber = contaReceberBO.RetornaContaReceberID(itemContaReceber._ContaReceber._ContaReceberID);

                if (contaReceber != null)
                {
                    RealizarVendasTipos realizaVenda   = new RealizarVendasTipos();
                    RealizarVendasBO    realizaVendaBO = new RealizarVendasBO();

                    realizaVenda = realizaVendaBO.RetornaNumeroVenda(contaReceber._NumeroVenda);

                    if (realizaVenda != null)
                    {
                        CadastroClientes    cliente    = new CadastroClientes();
                        CadastroClientesDAO clienteDAO = new CadastroClientesDAO();

                        cliente = clienteDAO.SelecionaClientePorID(realizaVenda._CodigoCliente);

                        codCliente           = cliente._CodigoCliente;
                        txtCPFCNPJ.Text      = cliente._CPF;
                        txtNomeFantasia.Text = cliente._Nome;
                    }
                }
            }
        }
Beispiel #2
0
        //Carrega informações inerente  as parcelas
        public void CarregaContaReceberParcela(int itemContaReceberID, bool isTrueFalse)
        {
            itemContaReceber = itemContaReceberBo.SelecionarItemContaReceberID(itemContaReceberID);

            if (itemContaReceber != null)
            {
                CarregaItensTipoRecebimento(Convert.ToInt32(itemContaReceber._ItemContaReceberID));
                HabilitaDesabilitaFormulario(isTrueFalse);

                parametroCod = itemContaReceber._ItemContaReceberID;;
                //Pega conta receber
                contaReceber = contaReceberBO.RetornaContaReceberID(itemContaReceber._ContaReceber._ContaReceberID);
                contaID      = contaReceber._ContaReceberID;

                //Pega venda
                vendas  = vendasBO.RetornaNumeroVenda(contaReceber._NumeroVenda);
                vendaID = vendas._NumeroVenda;

                //Pega Dados cliente
                cliente = clienteDAO.SelecionaClientePorID(vendas._CodigoCliente);

                txtCPFCNPJ.Text        = cliente._CPF;
                txtNomeFantasia.Text   = cliente._Nome;
                txtDoc.Text            = itemContaReceber._ItemContaReceberID.ToString();
                txtDataVencimento.Text = itemContaReceber._DataVencimento.ToString("dd/MM/yyyy");
                txtDataPgto.Text       = DateTime.Now.ToString("dd/MM/yyyy");
                txtJuros.Text          = itemContaReceber._Juros.ToString("C");
                txtMulta.Text          = itemContaReceber.ValorMulta.ToString("C");
                txtNParcela.Text       = itemContaReceber._NumeroParcela;
                txtTotalPaga.Text      = itemContaReceber.ValorAberto > 0 ? itemContaReceber.ValorAberto.ToString("C") : itemContaReceber.ValorCobrado.ToString("C");
                txtValorParcela.Text   = itemContaReceber._ValorParcela.ToString("C");
                pagamentoHaver         = itemContaReceber._ValorPago;
                txtDiasAtraso.Text     = itemContaReceber.DiasAtraso.ToString();
            }
        }
Beispiel #3
0
        /// <summary>
        /// Grava os itens de cada venda
        /// </summary>
        private void GravaItemsVenda()
        {
            realizaVenda   = new RealizarVendasTipos();
            realizaVendaBo = new RealizarVendasBO();

            //busca o numero da venda realizada
            realizaVenda._NumeroVenda = int.Parse(txtNumeroVenda.Text);

            realizaVenda = realizaVendaBo.RetornaNumeroVenda(realizaVenda);

            if (realizaVenda != null)
            {
                for (int i = 0; i < listaItensProdutoVenda.Items.Count; i++)
                {
                    realizaVenda._NumeroVenda   = realizaVenda._NumeroVenda;
                    realizaVenda._Item          = i + 1;
                    realizaVenda._Iuo           = int.Parse(listaItensProdutoVenda.Items[i].SubItems[1].Text);
                    realizaVenda._Descricao     = listaItensProdutoVenda.Items[i].SubItems[3].Text;
                    realizaVenda._PrecoUnitario = decimal.Parse(listaItensProdutoVenda.Items[i].SubItems[4].Text.Substring(3));
                    realizaVenda._Qtde          = int.Parse(listaItensProdutoVenda.Items[i].SubItems[5].Text);
                    realizaVenda._SubTotal      = decimal.Parse(listaItensProdutoVenda.Items[i].SubItems[6].Text.Substring(3));

                    realizaVendaBo.GravaItensVenda(realizaVenda);

                    //Remove a quantidade de itens que foi vendido, referente ao cada item no estoque
                    produtoBo = new ProdutosBO();
                    produtoBo.BaixarQtdeProdutoEstoque(realizaVenda._Iuo, realizaVenda._Qtde);
                }
            }
        }
Beispiel #4
0
        public void CarregaDadosVendas(int vendaId)
        {
            RealizarVendasBO    vendasBO = new RealizarVendasBO();
            RealizarVendasTipos vendas   = new RealizarVendasTipos();

            //Pega venda
            vendas = vendasBO.RetornaNumeroVenda(vendaId);

            if (vendas != null)
            {
                lblNumeroVenda.Text = vendas._NumeroVenda.ToString();
                lblTotal.Text       = Convert.ToDecimal(vendas._TotalPagar).ToString("C");
                lblDataVenda.Text   = vendas._DataVenda.ToString("dd/MM/yyyy");

                //Pega cliente
                CadastroClientes    cliente    = new CadastroClientes();
                CadastroClientesDAO clienteDao = new CadastroClientesDAO();

                cliente = clienteDao.SelecionaClientePorID(vendas._CodigoCliente);

                if (cliente != null)
                {
                    lblCliente.Text = cliente._Nome;
                    lblCpf.Text     = cliente._CPF;
                    lblFone.Text    = cliente._Telefone_Celular;
                }
            }
        }
Beispiel #5
0
        /// <summary>
        /// Método retorna ultimo registro inserido na tabela realiza vendas
        /// </summary>
        /// <returns></returns>
        public RealizarVendasTipos RetornaNumeroVenda()
        {
            conexaoBanco = new ConexaoBanco();
            RealizarVendasTipos realizaVendas;

            sbsql = new StringBuilder();

            sbsql.Append("SELECT TOP 1 * FROM tblRealizarVenda ORDER BY NumeroVenda DESC");

            OleDbDataReader leitor = conexaoBanco.selectDR(sbsql.ToString());

            if (leitor.HasRows)
            {
                leitor.Read();

                realizaVendas = new RealizarVendasTipos();

                realizaVendas._NumeroVenda = (int)leitor["NumeroVenda"];
            }
            else
            {
                realizaVendas = null;
            }
            return(realizaVendas);
        }
Beispiel #6
0
        public RealizarVendasTipos RetornaVendaClienteId(int clienteId)
        {
            conexaoBanco = new ConexaoBanco();
            RealizarVendasTipos realizaVendas;

            sbsql = new StringBuilder();

            sbsql.Append("SELECT * FROM tblRealizarVenda WHERE CodigoCliente =" + clienteId);

            OleDbDataReader leitor = conexaoBanco.selectDR(sbsql.ToString());

            if (leitor.HasRows)
            {
                leitor.Read();

                realizaVendas = new RealizarVendasTipos();

                realizaVendas._NumeroVenda    = (int)leitor["NumeroVenda"];
                realizaVendas._DataVenda      = (DateTime)leitor["DataVenda"];
                realizaVendas._CodigoCliente  = (int)leitor["CodigoCliente"];
                realizaVendas._FormaPagamento = (string)leitor["FormaPagamento"];
                realizaVendas._TotalPagar     = (decimal)leitor["TotalPagar"];
            }
            else
            {
                realizaVendas = null;
            }
            return(realizaVendas);
        }
Beispiel #7
0
        /// <summary>
        /// Método grava dados referente ao cabecalho da venda
        /// </summary>
        public void GravarCabecalhoVenda(RealizarVendasTipos realizaVenda)
        {
            conexaoBanco = new ConexaoBanco();
            sbsql        = new StringBuilder();

            sbsql.Append("INSERT INTO tblRealizarVenda(NumeroVenda,DataVenda,CodigoCliente,FormaPagamento,Descontos,TotalPagar)");
            sbsql.Append("VALUES('");
            sbsql.Append(realizaVenda._NumeroVenda + "','");
            sbsql.Append(realizaVenda._DataVenda + "','");
            sbsql.Append(realizaVenda._CodigoCliente + "','");
            sbsql.Append(realizaVenda._FormaPagamento + "','");
            sbsql.Append(realizaVenda._Descontos + "','");
            sbsql.Append(realizaVenda._TotalPagar + "')");

            conexaoBanco.manterCRUD(sbsql.ToString());
        }
Beispiel #8
0
        /// <summary>
        /// Metodo grava os itens de uma determinada venda
        /// </summary>
        /// <param name="realizaVenda"></param>
        public void GravaItensVenda(RealizarVendasTipos realizaVenda)
        {
            conexaoBanco = new ConexaoBanco();
            sbsql        = new StringBuilder();

            sbsql.Append("INSERT INTO tblItemVenda(NumeroVenda,Item,CodigoProduto,Descricao,Qtde,PrecoUnitario,Subtotal)");
            sbsql.Append("VALUES('");
            sbsql.Append(realizaVenda._NumeroVenda + "','");
            sbsql.Append(realizaVenda._Item + "','");
            sbsql.Append(realizaVenda._Iuo + "','");
            sbsql.Append(realizaVenda._Descricao + "','");
            sbsql.Append(realizaVenda._Qtde + "','");
            sbsql.Append(realizaVenda._PrecoUnitario + "','");
            sbsql.Append(realizaVenda._SubTotal + "')");

            conexaoBanco.manterCRUD(sbsql.ToString());
        }
Beispiel #9
0
        private Boolean ConsultarClienteContaPendente(int clienteID)
        {
            bool situacao = true;

            realizaVenda   = new RealizarVendasTipos();
            realizaVendaBo = new RealizarVendasBO();
            DataTable dt = new DataTable();

            contasReceber   = new ContasReceber();
            contasReceberBo = new ContasReceberBO();

            dt = realizaVendaBo.RetornaDataTableVendaClienteId(clienteID);

            if (dt != null)
            {
                foreach (DataRow row in dt.Rows)
                {
                    contasReceber = contasReceberBo.RetornaContaReceberNumeroVenda(int.Parse(row["numeroVenda"].ToString()));

                    if (contasReceber != null)
                    {
                        if (contasReceber._Situacao.Equals("Aberto"))
                        {
                            itemContaReceber   = new ItemContaReceber();
                            itemContaReceberBo = new ItemContaReceberBO();

                            DataTable dtItem = new DataTable();

                            dtItem = itemContaReceberBo.CriaDataTableSelecionaItemContasReceber(contasReceber._ContaReceberID);

                            foreach (DataRow rowItem in dtItem.Rows)
                            {
                                if (rowItem["status"].Equals("Vencida"))
                                {
                                    situacao = false;
                                    break;
                                }
                            }
                        }
                    }
                }
            }
            return(situacao);
        }
Beispiel #10
0
        /// <summary>
        /// Método faz inserção dados do cabeçalho da venda
        /// </summary>
        private void GravaDadosVenda(decimal valorFinalPagar)
        {
            realizaVenda   = new RealizarVendasTipos();
            realizaVendaBo = new RealizarVendasBO();

            realizaVenda._NumeroVenda    = int.Parse(txtNumeroVenda.Text);
            realizaVenda._DataVenda      = DateTime.Parse(txtDataVenda.Text);
            realizaVenda._CodigoCliente  = clienteID != 0 ? clienteID : 15;
            realizaVenda._FormaPagamento = formaPgto;
            realizaVenda._TotalPagar     = valorFinalPagar;
            realizaVenda._Descontos      = desc;


            //Grava cabeçalho
            realizaVendaBo.GravarCabecalhoVenda(realizaVenda);

            //Grava itens venda
            GravaItemsVenda();
        }
Beispiel #11
0
        /// <summary>
        /// Método retorna numero de uma venda expecifica que foi realizada
        /// </summary>
        /// <param name="realizaVenda"></param>
        /// <returns></returns>
        public RealizarVendasTipos RetornaNumeroVenda(RealizarVendasTipos realizaVenda)
        {
            conexaoBanco = new ConexaoBanco();
            sbsql        = new StringBuilder();

            sbsql.Append("SELECT * FROM tblRealizarVenda WHERE NumeroVenda = " + realizaVenda._NumeroVenda);

            OleDbDataReader leitor = conexaoBanco.selectDR(sbsql.ToString());

            if (leitor.HasRows)
            {
                leitor.Read();

                realizaVenda = new RealizarVendasTipos();

                realizaVenda._NumeroVenda = (int)leitor["NumeroVenda"];
            }
            else
            {
                realizaVenda = null;
            }
            return(realizaVenda);
        }
Beispiel #12
0
        /// <summary>
        /// Método retorna numero da venda atual
        /// </summary>
        private int GerarNumeroVenda()
        {
            realizaVenda   = new RealizarVendasTipos();
            realizaVendaBo = new RealizarVendasBO();

            numeroVenda = 1;

            realizaVenda = realizaVendaBo.RetornaNumerVenda();

            if (realizaVenda != null)
            {
                int codigoAtual = realizaVenda._NumeroVenda;
                numeroVenda = codigoAtual + 1;

                txtNumeroVenda.Text = preencheNumeros(numeroVenda.ToString());
            }
            else
            {
                txtNumeroVenda.Text = preencheNumeros(numeroVenda.ToString());
            }

            return(numeroVenda);
        }
Beispiel #13
0
        private bool ConsultaContaReceberClienteCod(int cod)
        {
            bool resp = false;

            if (cod > 0)
            {
                RealizarVendasTipos realizaVenda   = new RealizarVendasTipos();
                RealizarVendasBO    realizaVendaBO = new RealizarVendasBO();

                realizaVenda = realizaVendaBO.RetornaVendaClienteId(cod);

                if (realizaVenda != null)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }

            return(resp);
        }
Beispiel #14
0
        /// <summary>
        /// Método chama método grava dados referente ao cabecalho da venda
        /// </summary>
        public void GravarCabecalhoVenda(RealizarVendasTipos realizaVenda)
        {
            realizaVendasDao = new RealizarVendasDAO();

            realizaVendasDao.GravarCabecalhoVenda(realizaVenda);
        }
Beispiel #15
0
 public ContasReceber()
 {
     m_RealizarVenda = new RealizarVendasTipos();
 }
Beispiel #16
0
 /// <summary>
 /// Método retorna numero de uma venda expecifica que foi realizada
 /// </summary>
 /// <param name="realizaVenda"></param>
 /// <returns></returns>
 public RealizarVendasTipos RetornaNumeroVenda(RealizarVendasTipos realizaVenda)
 {
     realizaVendasDao = new RealizarVendasDAO();
     return(realizaVendasDao.RetornaNumeroVenda(realizaVenda));
 }
Beispiel #17
0
 /// <summary>
 /// Metodo grava os itens de uma determinada venda
 /// </summary>
 /// <param name="realizaVenda"></param>
 public void GravaItensVenda(RealizarVendasTipos realizaVenda)
 {
     realizaVendasDao = new RealizarVendasDAO();
     realizaVendasDao.GravaItensVenda(realizaVenda);
 }