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; } } }
//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; } } } }
//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(); } }
/// <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); } } }