Esempio n. 1
0
 public void GerarParcelas(ContaPagar contaPagar)
 {
     using (var context = _unitOfWork.Create())
     {
         context.Repositorios.ContaPagarRepositorio.GerarParcelas(contaPagar);
         context.SaveChanges();
     }
 }
Esempio n. 2
0
        private void DgvContas_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            int             selectedRowIndex = dgvContas.SelectedCells[0].RowIndex;
            DataGridViewRow selectedRow      = dgvContas.Rows[selectedRowIndex];

            contaPagarSelecionada = contaPagarDAO.BuscaByID(Convert.ToInt32(selectedRow.Cells[0].Value));
            this.Close();
        }
Esempio n. 3
0
        public ActionResult Editar(int id)
        {
            ContaPagarRepository repository = new ContaPagarRepository();
            ContaPagar           contaPagar = repository.ObterPeloId(id);

            ViewBag.ContaPagar = contaPagar;
            return(View());
        }
        public void Deletar()
        {
            ContaPagar i = ContaPagarDao.BuscarPorId(ContaPagarDao.getLastId());

            Assert.IsTrue(ContaPagarDao.Excluir(ContaPagarDao.getLastId()));

            // Assert.IsTrue(InstituicaoDAO.Excluir(i));
        }
Esempio n. 5
0
 public FrmOperacaoParcela(FrmGerenciarContaPagar form, int opcao, ContaPagar conta, ParcelaPagar parcela)
 {
     InitializeComponent();
     this.form    = form;
     this.opcao   = opcao;
     this.conta   = conta;
     this.parcela = parcela;
 }
Esempio n. 6
0
        public void Desativar(int id)
        {
            ContaPagar contas = _contexto.ContasPagar.Find(id);

            contas.FlagAtivo    = false;
            contas.DataExclusao = DateTime.Now;
            Salvar();
        }
        public ActionResult Editar(int id)
        {
            ContaPagarRepositorio repositorio = new ContaPagarRepositorio();
            ContaPagar            conta       = repositorio.ObterPeloId(id);

            ViewBag.ContaPagar = conta;
            return(View());
        }
Esempio n. 8
0
        public ActionResult Update(int id, string nome, DateTime dataPagamento, DateTime dataVencimento, decimal valor)
        {
            ContaPagar contaPagar = new ContaPagar();

            contaPagar.Id   = id;
            contaPagar.Nome = nome;
            repository.Alterar(contaPagar);
            return(RedirectToAction("Index"));
        }
Esempio n. 9
0
 public FrmCadParcela(ContaPagar conta, FrmContasPagar form)
 {
     InitializeComponent();
     this.conta      = conta;
     txtdata.MinDate = conta.data_emissao;
     txtdata.Value   = conta.data_emissao;
     txtcodigo.Text  = conta.id_conta_pagar + "";
     this.form       = form;
 }
Esempio n. 10
0
 public ChequeEmitidoContaPagar ToEntity()
 {
     return(new ChequeEmitidoContaPagar
     {
         Id = Id,
         ContaPagar = ContaPagar.ToEntity(),
         ChequeEmitido = ChequeEmitido.ToEntity()
     });
 }
Esempio n. 11
0
 private void button9_Click(object sender, EventArgs e)
 {
     if (tabela.SelectedRows.Count == 1)
     {
         ContaPagar    c   = GerarConta();
         FrmCadParcela cad = new FrmCadParcela(c, this);
         cad.Show();
     }
 }
Esempio n. 12
0
        public void PersistirAtualizar()
        {
            ContaPagar i = ContaPagarDao.BuscarPorId(ContaPagarDao.getLastId());

            i.Valor  = 22;
            i.Data   = DateTime.Now;
            i.Compra = CompraDao.BuscarPorId(CompraDao.getLastId());

            Assert.IsTrue(ContaPagarDao.Persistir(i));
        }
Esempio n. 13
0
        public void PersistirInserir()
        {
            ContaPagar i = new ContaPagar();

            i.Valor  = 11;
            i.Data   = Convert.ToDateTime("2001/05/20");
            i.Compra = CompraDao.BuscarPorId(CompraDao.getLastId());

            Assert.IsTrue(ContaPagarDao.Persistir(i));
        }
        // GET: ContaPagar/Delete/5
        public ActionResult Delete(int id)
        {
            ContaPagar i = ContaPagarDao.BuscarPorId(id);

            if (i == null)
            {
                return(HttpNotFound());
            }

            return(View(i));
        }
Esempio n. 15
0
        public IActionResult Put([FromRoute] ContaPagarId id, ContaPagar entity)
        {
            entity.Modelo       = id.Modelo;
            entity.Serie        = id.Serie;
            entity.Numero       = id.Numero;
            entity.FornecedorId = id.FornecedorId;
            entity.Parcela      = id.Parcela;

            this.ContaPagarService.Update(entity);
            return(Ok());
        }
Esempio n. 16
0
        public IActionResult CadastrarConta([FromBody] ContaPagar cont)
        {
            if (cont == null)
            {
                return(BadRequest());
            }

            _contPgService.Create(cont);

            return(CreatedAtRoute("GetContaParcelaPagamento", new { id = cont.Id }, cont));
        }
Esempio n. 17
0
 public Retorno Pesquisar(ContaPagar Entity, int Pagina, int QntPagina)
 {
     try
     {
         return(new DataContaPagar().Pesquisar(Entity, Pagina, QntPagina));
     }
     catch (Exception ex)
     {
         return(Retorno.CriarRetornoExcecao(ex));
     }
 }
Esempio n. 18
0
 public Retorno Consultar(ContaPagar Entity)
 {
     try
     {
         return(new DataContaPagar().Consultar(Entity));
     }
     catch (Exception ex)
     {
         return(Retorno.CriarRetornoExcecao(ex));
     }
 }
Esempio n. 19
0
 private Retorno VerificarExistencia(ContaPagar Entity)
 {
     try
     {
         return(new DataContaPagar().VerificarExistencia(Entity));
     }
     catch (Exception ex)
     {
         return(Retorno.CriarRetornoExcecao(ex));
     }
 }
Esempio n. 20
0
        private ContaPagar CriarContaFixa(ContaPagar contaPagar, int meses, bool contemPagamento)
        {
            var contaPagarClonada = (ContaPagar)contaPagar.Clone();

            contaPagarClonada.DataVencimento = contaPagarClonada.DataVencimento.Value.AddMonths(meses);

            contaPagarClonada.TipoStatusContaPagar        = new TipoStatusContaPagar();
            contaPagarClonada.TipoStatusContaPagar.Codigo = contemPagamento ? (int)EnumTipoStatusContaPagar.PAGO : contaPagarClonada.DataVencimento < DateTime.Now ?
                                                            (int)EnumTipoStatusContaPagar.ATRASADO : (int)EnumTipoStatusContaPagar.EM_ABERTO;
            return(contaPagarClonada);
        }
Esempio n. 21
0
        private void AtualizarTabela()
        {
            ContaPagarRepositorio repositorio = new ContaPagarRepositorio();
            string            busca           = txtBusca.Text;
            List <ContaPagar> contasPagar     = repositorio.ObterTodos(busca); dataGridView1.RowCount = 0;

            for (int i = 0; i < contasPagar.Count; i++)
            {
                ContaPagar contaPagar = contasPagar[i];
                dataGridView1.Rows.Add(new object[] { contaPagar.Id, contaPagar.Nome });
            }
        }
Esempio n. 22
0
        private void Inserir()
        {
            ContaPagar contaPagar = new ContaPagar();

            contaPagar.Nome           = txtNome.Text;
            contaPagar.Valor          = Convert.ToDecimal(mtbValor.Text);
            contaPagar.Tipo           = txtTipo.Text;
            contaPagar.DataVencimento = Convert.ToDateTime(mtbDataVencimento.Text);
            ContaPagarRepositorio repositorio = new ContaPagarRepositorio();

            repositorio.Inserir(contaPagar);
        }
Esempio n. 23
0
        public Retorno Pesquisar(ContaPagar Entity, int Pagina, int QntPagina)
        {
            try
            {
                List <ContaPagar> ContaPagars = new List <ContaPagar>();
                int Limite = (Pagina - 1) * QntPagina;
                CommandSQL = new StringBuilder();
                CommandSQL.AppendLine("SELECT ");
                CommandSQL.AppendLine("TB_CONTA_PAGAR.CODIGO AS CODIGO_CONTA_PAGAR, ");
                CommandSQL.AppendLine("TB_CONTA_PAGAR.DATA_EMISSAO, ");
                CommandSQL.AppendLine("TB_CONTA_PAGAR.DATA_VENCIMENTO, ");
                CommandSQL.AppendLine("TB_CONTA_PAGAR.VALOR, ");
                CommandSQL.AppendLine("TB_CONTA_PAGAR.QUANTIDADE_PARCELAS, ");
                CommandSQL.AppendLine("TB_CONTA_PAGAR.DESCRICAO AS DESCRICAO_CONTA_PAGAR, ");
                CommandSQL.AppendLine("TB_FORNECEDOR.CODIGO AS CODIGO_FORNECEDOR, ");
                CommandSQL.AppendLine("TB_FORNECEDOR.NOME, ");
                CommandSQL.AppendLine("TB_FORNECEDOR.EMAIL, ");
                CommandSQL.AppendLine("TB_FORNECEDOR.TELEFONE, ");
                CommandSQL.AppendLine("TB_TIPO_STATUS_CONTA_PAGAR.CODIGO AS CODIGO_TIPO_STATUS_CONTA_PAGAR, ");
                CommandSQL.AppendLine("TB_TIPO_STATUS_CONTA_PAGAR.DESCRICAO AS DESCRICAO_TIPO_STATUS_CONTA_PAGAR, ");
                CommandSQL.AppendLine("TB_TIPO_CONTA_PAGAR.CODIGO AS CODIGO_TIPO_CONTA_PAGAR, ");
                CommandSQL.AppendLine("TB_TIPO_CONTA_PAGAR.DESCRICAO AS DESCRICAO_TIPO_CONTA_PAGAR, ");
                CommandSQL.AppendLine("TB_TIPO_FORMA_PAGAMENTO_CONTA_PAGAR.CODIGO AS CODIGO_TIPO_FORMA_PAGAMENTO_CONTA_PAGAR, ");
                CommandSQL.AppendLine("TB_TIPO_FORMA_PAGAMENTO_CONTA_PAGAR.DESCRICAO AS DESCRICAO_TIPO_FORMA_PAGAMENTO_CONTA_PAGAR ");
                CommandSQL.AppendLine("FROM TB_CONTA_PAGAR ");
                CommandSQL.AppendLine("INNER JOIN TB_FORNECEDOR ON ");
                CommandSQL.AppendLine("TB_CONTA_PAGAR.CODIGO_FORNECEDOR = TB_FORNECEDOR.CODIGO ");
                CommandSQL.AppendLine("INNER JOIN TB_TIPO_STATUS_CONTA_PAGAR ON ");
                CommandSQL.AppendLine("TB_CONTA_PAGAR.CODIGO_TIPO_STATUS_CONTA_PAGAR = TB_TIPO_STATUS_CONTA_PAGAR.CODIGO ");
                CommandSQL.AppendLine("INNER JOIN TB_TIPO_CONTA_PAGAR ON ");
                CommandSQL.AppendLine("TB_CONTA_PAGAR.CODIGO_TIPO_CONTA_PAGAR = TB_TIPO_CONTA_PAGAR.CODIGO ");
                CommandSQL.AppendLine("INNER JOIN TB_TIPO_FORMA_PAGAMENTO_CONTA_PAGAR ON ");
                CommandSQL.AppendLine("TB_CONTA_PAGAR.CODIGO_TIPO_FORMA_PAGAMENTO_CONTA_PAGAR = TB_TIPO_FORMA_PAGAMENTO_CONTA_PAGAR.CODIGO ");

                CommandSQL.AppendLine("WHERE (TB_CONTA_PAGAR.DATA_EMISSAO LIKE '%" + Entity.DataEmissao + "%' )");
                CommandSQL.AppendLine("LIMIT @QNT_PAGINA OFFSET @LIMITE");
                Command = CriaComandoSQL(CommandSQL.ToString());
                Abrir();
                Command.Parameters.AddWithValue("@QNT_PAGINA", QntPagina);
                Command.Parameters.AddWithValue("@LIMITE", Limite);
                Reader = Command.ExecuteReader();
                while (Reader.Read())
                {
                    ContaPagars.Add(FillEntity(Reader));
                }
                return(new Retorno(ContaPagars));
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally { Fechar(); }
        }
Esempio n. 24
0
        public ActionResult Store(string nome, DateTime dataVencimento, DateTime dataPagamento, decimal valor, int idCliente, int idCategoria)
        {
            ContaPagar contaPagar = new ContaPagar();

            contaPagar.Nome          = nome;
            contaPagar.DataPagamento = dataPagamento;
            contaPagar.Valor         = valor;
            contaPagar.IdCliente     = idCliente;
            contaPagar.IdCategoria   = idCategoria;
            repository.Inserir(contaPagar);
            return(RedirectToAction("Index"));
        }
Esempio n. 25
0
        public List <ContaPagar> ObterTodos()
        {
            SqlCommand comando = Conexao.AbrirConexao();

            comando.CommandText = @"SELECT
            clientes.id AS 'IdCliente',
            clientes.nome AS 'NomeCliente',
            clientes.cpf AS 'CpfCliente',
            categorias.id AS 'IdCategoria',
            categorias.nome AS 'NomeCategoria',
            contas_pagar.id AS 'id',
            contas_pagar.nome AS 'nome',
            contas_pagar.data_vencimento AS 'data_vencimento',
            contas_pagar.data_pagamento AS 'data_pagamento',
            contas_pagar.valor AS 'valor' FROM contas_pagar
            INNER JOIN clientes ON (contas_pagar.id_cliente = clientes.id)
            INNER JOIN categorias ON (contas_pagar.id_categoria = categorias.id)";

            DataTable tabela = new DataTable();

            tabela.Load(comando.ExecuteReader());
            List <ContaPagar> contasPagar = new List <ContaPagar>();

            comando.Connection.Close();

            foreach (DataRow linha in tabela.Rows)
            {
                ContaPagar contaPagar = new ContaPagar();

                contaPagar.Id             = Convert.ToInt32(linha["id"]);
                contaPagar.IdCliente      = Convert.ToInt32(linha["idCliente"]);
                contaPagar.IdCategoria    = Convert.ToInt32(linha["idCategoria"]);
                contaPagar.Nome           = linha["nome"].ToString();
                contaPagar.DataVencimento = Convert.ToDateTime(linha["data_vencimento"]);
                contaPagar.DataPagamento  = Convert.ToDateTime(linha["data_pagamento"]);
                contaPagar.Valor          = Convert.ToDecimal(linha["valor"]);

                contaPagar.Categoria = new Categoria();
                contaPagar.Cliente   = new Cliente();

                contaPagar.Categoria.Nome = linha["NomeCategoria"].ToString();
                contaPagar.Categoria.Id   = Convert.ToInt32(linha["idCategoria"]);

                contaPagar.Cliente.Id   = Convert.ToInt32(linha["IdCliente"]);
                contaPagar.Cliente.Nome = linha["NomeCliente"].ToString();
                contaPagar.Cliente.Cpf  = linha["CpfCliente"].ToString();

                contasPagar.Add(contaPagar);
            }

            return(contasPagar);
        }
Esempio n. 26
0
        public ContaPagar GerarConta()
        {
            ContaPagar      c     = new ContaPagar();
            int             id    = Convert.ToInt32(tabela.CurrentRow.Cells[0].Value.ToString());
            MySqlConnection con   = new MySqlConnection(Config.Conexao);
            string          query = "select * from conta_pagar where id_conta_pagar =" + id;
            MySqlCommand    cmd   = new MySqlCommand(query, con);

            con.Open();
            MySqlDataReader reader = cmd.ExecuteReader();

            reader.Read();
            c.id_conta_pagar  = id;
            c.numDias         = Convert.ToInt32(reader["num_dias"].ToString());
            c.valor_total     = Convert.ToDecimal(reader["valor_total"].ToString());
            c.numParcelas     = c.numDias = Convert.ToInt32(reader["num_parcelas"].ToString());
            c.situacao        = reader["situacao"].ToString();
            c.credor          = reader["credor"].ToString();
            c.valor_pago      = Convert.ToDecimal(reader["valor_pago"].ToString());
            c.data_emissao    = DateTime.Parse(reader["data_emissao"].ToString());
            c.data_vencimento = DateTime.Parse(reader["data_vencimento"].ToString());
            c.entrada         = Convert.ToDecimal(reader["entrada"].ToString());
            string id_forn = reader["id_fornecedor"].ToString();

            reader.Close();
            if (id_forn.Length != 0)
            {
                query = "select * from fornecedor as f inner join pessoa_juridica as p on f.id_pessoa_juridica=p.id_pessoa_juridica where f.id_fornecedor=" + id_forn;

                cmd.CommandText = query;
                reader          = cmd.ExecuteReader();
                reader.Read();
                while (reader.Read())
                {
                    Fornecedor f = new Fornecedor();
                    f.celular            = reader["celular"].ToString();
                    f.cnpj               = reader["p.cnpj"].ToString();
                    f.email              = reader["p.email"].ToString();
                    f.razao_social       = reader["p.razao_social"].ToString();
                    f.telefone           = f.celular = reader["p.telefone"].ToString();
                    f.inscricao_estadual = f.celular = reader["p.inscricao_estadual"].ToString();
                    f.id_pessoa_juridica = Convert.ToInt32(reader["p.id_pessoa_juridica"]);
                    c.fornecedor         = f;
                }
            }
            else
            {
                c.fornecedor = null;
            }
            con.Close();
            return(c);
        }
Esempio n. 27
0
        private static ContaPagar GetContaPagar(object[] dados)
        {
            ContaPagar contaspagar = new ContaPagar();

            contaspagar.Id     = Convert.ToInt32(dados.GetValue(0));
            contaspagar.Valor  = Convert.ToDecimal(dados.GetValue(1));
            contaspagar.Data   = System.DBNull.Value.Equals(dados.GetValue(2)) ? DateTime.Now : Convert.ToDateTime(dados.GetValue(2));
            contaspagar.Compra = CompraDao.BuscarPorId(Convert.ToInt32(dados.GetValue(3)));



            return(contaspagar);
        }
Esempio n. 28
0
        public ContaPagar objGerado()
        {
            ContaPagar obj = new ContaPagar();

            obj.ContaClienteID = Convert.ToInt64(NomeClienteTextBox.Text.Split(' ')[0]);
            obj.DataCompra     = Convert.ToDateTime(ContaDateTimePicker.Text);
            obj.ValorTotal     = Convert.ToDouble(ValorTotalTextBox.Text);
            obj.ValorPago      = Convert.ToDouble(ValorPagoTextBox.Text);
            obj.FormaPagamento = FormaPagComboBox.Text;
            obj.Parcelas       = Convert.ToInt32(ParcelasComboBox.Text);

            return(obj);
        }
Esempio n. 29
0
        public ActionResult Create()
        {
            var model = new ContaPagar();

            model.DataVencimento = DateTime.Now;
            model.Competencia    = DateTime.Now;

            CarregarFornecedores();
            CarregarCategorias();
            CarregarSubCategorias(0);
            CarregarCentroDeCusto();
            return(View(model));
        }
        public void Inserir()
        {
            ContaPagar contaPagar = new ContaPagar();

            contaPagar.Nome           = txtNome.Text;
            contaPagar.Valor          = Convert.ToDecimal(mtbValor.Text);
            contaPagar.Tipo           = cbTipo.SelectedItem.ToString();
            contaPagar.DataVencimento = dtpDataVencimento.Value;

            ContaPagarRepositorio repositorio = new ContaPagarRepositorio();

            repositorio.Inserir(contaPagar);
        }