public void AlterarTitulo()
        {
            try
            {
                //Update AReceber

                ModelLibrary.Receber receber = new ModelLibrary.Receber();

                receber.Id             = cAReceberId;
                receber.ValorNF        = Convert.ToDouble(txtValorNF.Text);
                receber.ValorDuplicata = Convert.ToDouble(txtValorDuplicata.Text);
                receber.ValorAReceber  = Convert.ToDouble(txtValorAReceber.Text);
                receber.DataEmissao    = cbbDataEmissao.Value;
                receber.DataLancamento = cbbDataLancamento.Value;
                receber.DataVencimento = cbbDataVencimento.Value;
                receber.Observacoes    = txtObservacoes.Text;


                ModelLibrary.MetodosDeposito.AtualizarReceber(receber);

                MessageBox.Show("Título alterado com sucesso!", "Alterar título a receber", MessageBoxButtons.OK, MessageBoxIcon.Information);

                localDepositoForm.cRetorno.CarregarContasAReceber();

                this.Close();
            }
            catch (Exception vE)
            {
                Trace.WriteLine(DateTime.Now.ToString() + "FormAReceber.AlterarTitulo()");
                Trace.TraceError(vE.Message);
                MessageBox.Show(vE.Message, vE.Source, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Example #2
0
        public void AdicionarTitulo()
        {
            //insert AReceber


            ModelLibrary.Receber receber = new ModelLibrary.Receber();

            receber.VendedorId     = Convert.ToInt32(txtVendedorId.Text);
            receber.CargaId        = Convert.ToInt32(txtCargaId.Text);
            receber.Documento      = Convert.ToInt32(txtDocumento.Text);
            receber.Serie          = txtSerie.Text;
            receber.ValorNF        = Convert.ToDouble(txtValorNF.Text);
            receber.ValorDuplicata = Convert.ToDouble(txtValorDuplicata.Text);
            receber.ValorAReceber  = Convert.ToDouble(txtValorAReceber.Text);
            receber.DataEmissao    = cbbDataEmissao.Value;
            receber.DataLancamento = cbbDataLancamento.Value;
            receber.DataVencimento = cbbDataVencimento.Value;
            receber.Observacoes    = txtObservacoes.Text;
            receber.Status         = "0";


            ModelLibrary.MetodosDeposito.InserirReceber(receber);

            MessageBox.Show("Título incluído com sucesso!", "Incluir título a receber", MessageBoxButtons.OK, MessageBoxIcon.Information);

            localDepositoForm.cRetorno.CarregarContasAReceber();

            this.Close();
        }
Example #3
0
        public void AlterarTitulo()
        {
            //Update AReceber

            ModelLibrary.Receber receber = new ModelLibrary.Receber();

            receber.Id             = cAReceberId;
            receber.ValorNF        = Convert.ToDouble(txtValorNF.Text);
            receber.ValorDuplicata = Convert.ToDouble(txtValorDuplicata.Text);
            receber.ValorAReceber  = Convert.ToDouble(txtValorAReceber.Text);
            receber.DataEmissao    = cbbDataEmissao.Value;
            receber.DataLancamento = cbbDataLancamento.Value;
            receber.DataVencimento = cbbDataVencimento.Value;
            receber.Observacoes    = txtObservacoes.Text;


            ModelLibrary.MetodosDeposito.AtualizarReceber(receber);

            MessageBox.Show("Título alterado com sucesso!", "Alterar título a receber", MessageBoxButtons.OK, MessageBoxIcon.Information);

            localDepositoForm.cRetorno.CarregarContasAReceber();

            this.Close();
        }
        public void ExibirTitulo()
        {
            try
            {
                if (cModo == "Update") // get the current and check if is selected {
                {
                    //load and show data from AReceber

                    cAReceberId = Convert.ToInt32(localDepositoForm.grdContasAReceber.CurrentRow.Cells["Id"].Value);


                    ModelLibrary.Receber receber = ModelLibrary.MetodosDeposito.ObterAReceber(cAReceberId);

                    if (receber != null)
                    {
                        txtVendedorId.Text = receber.VendedorId.ToString();

                        ModelLibrary.Vendedor vendedor = ModelLibrary.MetodosDeposito.ObterVendedor(Convert.ToUInt32(receber.VendedorId));

                        txtNome.Text = (vendedor != null) ? vendedor.Nome : "";

                        txtDocumento.Text = receber.Documento.ToString();
                        txtSerie.Text     = receber.Serie;

                        txtCargaId.Text = receber.CargaId.ToString();

                        txtValorNF.Text = receber.ValorNF.ToString();

                        txtValorDuplicata.Text = receber.ValorDuplicata.ToString();

                        txtValorAReceber.Text = receber.ValorAReceber.ToString();

                        cbbDataEmissao.Value    = receber.DataEmissao.Value;
                        cbbDataLancamento.Value = receber.DataLancamento.Value;
                        cbbDataVencimento.Value = receber.DataVencimento.Value;

                        if (receber.DataPagamento != null)
                        {
                            lblDataPagamento.Visible = true;
                            cbbDataPagamento.Visible = true;
                            cbbDataPagamento.Value   = receber.DataPagamento.Value;
                        }



                        txtObservacoes.Text = receber.Observacoes;

                        btnConfirmar.Enabled = true;
                    }
                    else
                    {
                        MessageBox.Show("Não foi possível carregar o Título a Receber. Por favor entre em contato com o administrador do sistema.", "Erro ao carregar título a receber", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        LimparTitulo();
                        this.Close();
                    }
                }
                else
                {
                    LimparTitulo();

                    btnConfirmar.Enabled = true;
                }
            }
            catch (Exception vE)
            {
                Trace.WriteLine(DateTime.Now.ToString() + "FormAReceber.ExibirTitulo()");
                Trace.TraceError(vE.Message);
                MessageBox.Show(vE.Message, vE.Source, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Example #5
0
        private void CarregarRecebimento()
        {
            if (cTipo == "Pedido")
            {
                ModelLibrary.Pedido pedido = ModelLibrary.MetodosDeposito.ObterPedido("", cPedidoId);

                cVendedorId = pedido.VendedorId;

                txtReferencia.Text = "Pedido: " + pedido.CodigoPedido + " | " + string.Format("{0:C2}", pedido.ValorLiquido + pedido.ValorAReceber);


                double vValorAcerto = (pedido.ValorAcerto != null) ? Convert.ToDouble(pedido.ValorAcerto) : 0;

                dlbTotalRecebido.Text = String.Format("{0:0.00}", vValorAcerto);
                dlbTotalAReceber.Text = String.Format("{0:0.00}", (pedido.ValorLiquido + pedido.ValorAReceber - vValorAcerto));


                if (pedido.Status == "4" || pedido.Status == "5")
                {
                    btnConfirmar.Enabled = false;
                    lblStatus.Visible    = true;
                    lblStatus.Text       = "Este pedido foi fechado na criação de um novo e não pode ser editado";
                }
                else if (pedido.Status == "0" || pedido.Status == "1")
                {
                    btnConfirmar.Enabled = false;
                    lblStatus.Text       = "Este pedido ainda não foi retornado e por isso não é possível fazer o acerto. Por favor, realize o retorno primeiro.";
                    lblStatus.Visible    = true;
                }
                else
                {
                    btnConfirmar.Enabled = true;
                    lblStatus.Visible    = false;

                    lblStatus.Text = "";
                }
            }
            else
            {
                ModelLibrary.Receber receber = ModelLibrary.MetodosDeposito.ObterAReceber(cReceberId);

                cVendedorId        = Convert.ToInt32(receber.VendedorId);
                txtReferencia.Text = "Titulo: " + receber.Documento + "/" + receber.Serie + " | " + string.Format("{0:C2}", receber.ValorDuplicata);

                dlbTotalRecebido.Text = String.Format("{0:0.00}", receber.ValorDuplicata - receber.ValorAReceber);
                dlbTotalAReceber.Text = String.Format("{0:0.00}", receber.ValorAReceber);
            }



            List <ModelLibrary.ListaRecebimento> recebimento = ModelLibrary.MetodosDeposito.ObterListaRecebimento(cVendedorId, cReceberId);

            BindingListView <ModelLibrary.ListaRecebimento> view = new BindingListView <ModelLibrary.ListaRecebimento>(recebimento);

            grdRecebimento.DataSource = view;


            grdRecebimento.Columns[0].Width = 250;
            grdRecebimento.Columns[1].DefaultCellStyle.Format = "c";

            grdRecebimento.Columns[5].Visible  = false;
            grdRecebimento.Columns[6].Visible  = false;
            grdRecebimento.Columns[7].Visible  = false;
            grdRecebimento.Columns[8].Visible  = false;
            grdRecebimento.Columns[9].Visible  = false;
            grdRecebimento.Columns[10].Visible = false;


            btnConfirmar.Enabled = true;

            lblStatus.Text = "";
        }