public string criarParcela(Parcelas p) { { string retorno = "0"; Connection objCon = new Connection(); MySqlConnection Banco = new MySqlConnection(); string user = "******"; Banco = objCon.AbreConexao(user); MySqlCommand command = Banco.CreateCommand(); command.CommandText = "INSERT into parcelas (numParcela, dtvencParcela, statusParcela, idVendaaPrazo, valorParcela) VALUES('" + p.numParcela + "', '" + p.dtvencParcela + "', '" + p.statusParcela + "', '" + p.idVendaaPrazo + "', REPLACE( '" + p.valorParcela + "', ',' ,'.' ) )"; int numRowsUpdated = command.ExecuteNonQuery(); if (numRowsUpdated != 0) { retorno = "1"; } else { retorno = "0"; } objCon.FechaConexao(); return(retorno); } }
public Parcelas GetParcelas(int id) { Parcelas p = new Parcelas(); try { Connection objCon = new Connection(); MySqlConnection Banco = new MySqlConnection(); string user = "******"; Banco = objCon.AbreConexao(user); MySqlCommand command = Banco.CreateCommand(); command.CommandText = "SELECT numParcela, valorParcela, dtvencParcela FROM parcelas WHERE idPagamento=" + id + ""; MySqlDataReader Reader = command.ExecuteReader(); while (Reader.Read()) { p.numParcela = Reader.GetInt32(0); p.valorParcela = Reader.GetDecimal(1); p.dtvencParcela = Reader.GetString(2); } command.Dispose(); objCon.FechaConexao(); } catch { } return(p); }
protected void lbtnSelecionar_Command(object sender, CommandEventArgs e) { RelAlunosDevedoresCr cr = new RelAlunosDevedoresCr(); RelAlunosDevedoresDs ds = new RelAlunosDevedoresDs(); Parcelas p = new Parcelas(); DataTable dt = p.AlunosDevedores(e.CommandArgument.ToString()); ds.dtAlunosDevedores.Merge(dt); cr.SetDataSource(ds); Stream relStream = cr.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat); BinaryReader stream = new BinaryReader(relStream); HttpContext.Current.Response.ClearContent(); HttpContext.Current.Response.ClearHeaders(); HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment; filename=relatorio.pdf"); HttpContext.Current.Response.ContentType = "application/pdf"; HttpContext.Current.Response.BinaryWrite(stream.ReadBytes(Convert.ToInt32(stream.BaseStream.Length))); HttpContext.Current.Response.Flush(); HttpContext.Current.Response.Close(); }
public List <Parcelas> Vencimentos() { List <Parcelas> listP = new List <Parcelas>(); string dataHoje = DateTime.Now.ToString("dd/MM/yyyy"); string idVendedor = HttpContext.Current.Session["idVendedor"].ToString(); try { Connection objCon = new Connection(); MySqlConnection Banco = new MySqlConnection(); string user = "******"; Banco = objCon.AbreConexao(user); MySqlCommand command = Banco.CreateCommand(); command.CommandText = "SELECT idParcela, dtvencParcela, valorParcela FROM parcelas WHERE statusParcela = 0 and dtvencParcela LIKE '%" + dataHoje + "%'"; MySqlDataReader Reader = command.ExecuteReader(); while (Reader.Read()) { Parcelas p = new Parcelas(); p.idParcela = Reader.GetInt32(0); p.dtvencParcela = Reader.GetString(1); p.valorParcela = Reader.GetDecimal(2); listP.Add(p); } command.Dispose(); objCon.FechaConexao(); } catch { } return(listP); }
public ActionResult pagarparcela(int id) { if (Session["idVendedor"] != null) { ParcelasDAO objPD = new ParcelasDAO(); PagamentoDAO objPgD = new PagamentoDAO(); Parcelas objP = new Parcelas(); VendaaPrazoDAO objVPD = new VendaaPrazoDAO(); //retorna a idPagamento int idPagamento = objPgD.realizaPagamento(id); objP.idPagamento = idPagamento; objP.idParcela = id; objPD.pagarParcela(objP); TempData["idPag"] = idPagamento; // string retorno = Request["idPagamento"].ToString(); //ViewBag.retorno = idPagamento.ToString(); //atualizar as parcelas restantes da vendaaprazo int idvendaaprazo = objPD.selecionaidVendaaPrazo(id); objVPD.atualizaVendaaprazo(idvendaaprazo); return(RedirectToAction("sucessopg/" + idPagamento + "")); } else { return(RedirectToAction("Index")); } }
public bool Save(Parcelas p) { try { if (db.Find(p.Id) == null) { p.Id = db.NextId(e => e.Id); db.Save(p); } else { db.Update(p); } if (auto_commit) { db.Commit(); } return(true); } catch (Exception ex) { return(false); } }
protected void CarregaAlteracao(int id) { Parcelas p = new Parcelas(); gvParcelas.DataSource = p.PesqParcelas(id); gvParcelas.DataBind(); }
protected void btnSelec_Click(object sender, EventArgs e) { if (Request.Form["ckSelecionar"] != null) { ckSelecionar = Request.Form["ckSelecionar"]; ViewState.Add("ParCodSel", ckSelecionar); if (ckSelecionar != "") { string[] vet = ckSelecionar.Split(','); Parcelas p = new Parcelas(); decimal valor = 0; for (int i = 0; i < vet.Length; i++) { int cod = int.Parse(vet[i]); valor = valor + p.RecuperarValorParcela(cod); } lValor.Text = "R$ " + valor.ToString("N2"); } lValor.Visible = true; btnConf.Visible = true; lbtnImprimir.Visible = false; } else { u.MsgBox(this, "Selecione uma parcela."); } }
protected void gvModulos_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { Literal ltCk = (Literal)e.Row.FindControl("ltCk"); string cod = DataBinder.Eval(e.Row.DataItem, "Cod").ToString(); string ck = ""; Parcelas p = new Parcelas(); if (hfMatricula.Value != "") { string[] cods = p.RecuperarOCMselecionados(Convert.ToInt32(hfMatricula.Value)).ToString().Split(','); ck = "checked=\"checked\""; for (int i = 0; i < cods.Length; i++) { if (!cods.Contains(cod)) { ck = ""; } } } else { ck = ""; } ltCk.Text = "<input id=\"ckSelecionar\" name=\"ckSelecionar\" type=\"checkbox\" value=\"" + cod + "\" " + ck + "/>"; } }
protected void lbtnImprimir_Click(object sender, EventArgs e) { Parcelas p = new Parcelas(); Relatorios.ReciboCr cr = new Relatorios.ReciboCr(); Relatorios.ReciboDs ds = new Relatorios.ReciboDs(); data = Convert.ToDateTime(ViewState["data"]); DataTable dt = p.RecuperarParcelasPaga(Convert.ToInt32(Request.QueryString["id"]), data); ds.dtRecibo.Merge(dt); cr.SetDataSource(ds); cr.SetParameterValue("pNome", Request.QueryString["alu"]); Stream relStream = cr.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat); BinaryReader stream = new BinaryReader(relStream); HttpContext.Current.Response.ClearContent(); HttpContext.Current.Response.ClearHeaders(); HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment; filename=relatorio.pdf"); HttpContext.Current.Response.ContentType = "application/pdf"; HttpContext.Current.Response.BinaryWrite(stream.ReadBytes(Convert.ToInt32(stream.BaseStream.Length))); HttpContext.Current.Response.Flush(); HttpContext.Current.Response.Close(); }
public String pagarParcela(Parcelas p) { string Retorno; try { Connection objCon = new Connection(); MySqlConnection Banco = new MySqlConnection(); string user = "******"; Banco = objCon.AbreConexao(user); MySqlCommand command = Banco.CreateCommand(); command.CommandText = "UPDATE parcelas set statusParcela ='1', idPagamento='" + p.idPagamento + "' WHERE idParcela ='" + p.idParcela + "'"; //command.CommandText = "UPDATE pedidos set status ='1' AND idVenda='" + idVenda + "' WHERE idVendedor ='" + vendedor + "' and status='0' and sessao ='" + sessao + "'"; int numRowsUpdated = command.ExecuteNonQuery(); if (numRowsUpdated == 0) { Retorno = "0"; } else { Retorno = "1"; } objCon.FechaConexao(); } catch { Retorno = "Erro em realizar pagamento"; } return(Retorno); }
public async Task <ActionResult <Parcelas> > PostParcelas(Parcelas parcelas) { _context.Parcelas.Add(parcelas); await _context.SaveChangesAsync(); return(CreatedAtAction("GetParcelas", new { id = parcelas.IdParcelas }, parcelas)); }
public void CadastraDivida(Contrato contrato, Parcelas parcelas, DateTimePicker dtpParcela) { int VezesDpsEntrada = contrato.QtdVezes - 1; CadastraContrato(contrato); while (!dtpParcela.Value.Day.ToString().Equals(contrato.DiaVencimento)) // CHECA SE É O DIA DE VENCIMENTO { dtpParcela.Value = dtpParcela.Value.AddDays(1); } parcelas.DataVencimento = dtpParcela.Value.ToShortDateString(); CadastraEntradaParcela(parcelas, contrato); if (contrato.QtdVezes > 1) { for (int contador = 0; contador < VezesDpsEntrada; contador++) { dtpParcela.Value = dtpParcela.Value.AddMonths(1); parcelas.DataVencimento = dtpParcela.Value.ToShortDateString(); CadastraParcela(parcelas); } } //CADASTROU DIVIDA }
public async Task <IActionResult> PutParcelas(int id, Parcelas parcelas) { if (id != parcelas.IdParcelas) { return(BadRequest()); } _context.Entry(parcelas).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ParcelasExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public Processamento_Contratos_Service(Contratos contratos, Parcelas parcelas, double valorParcelas, IPagamentosService pagamentosService, int meses) { Contratos = contratos; Parcelas = parcelas; ValorParcelas = valorParcelas; _pagamentosService = pagamentosService; Meses = meses; }
protected void btnExcluir_Click(object sender, EventArgs e) { int mat = Convert.ToInt32(hfMatricula.Value); Matricula m = new Matricula(); Parcelas p = new Parcelas(); p.ExcluirParcelas(mat); m.ExcluirAlunoOfertaCursoModulo(mat); m.ExcluirMatricula(mat); }
private void SelecionarModulos() { if (Request.Form["ckSelecionar"] != null) { if (hfMatricula.Value == "") { ckSelecionar = Request.Form["ckSelecionar"]; ViewState.Add("ocmSel", ckSelecionar); if (ckSelecionar != "") { string[] vet = ckSelecionar.Split(','); OfertaCursoModulo ocm = new OfertaCursoModulo(); double valor = 0; for (int i = 0; i < vet.Length; i++) { int cod = int.Parse(vet[i]); valor = valor + ocm.RecuperarValorModulos(cod); } tbValor.Text = valor.ToString(); } } else { ckSelecionar = Request.Form["ckSelecionar"]; ViewState.Add("ocmSel", ckSelecionar); if (ckSelecionar != "") { string[] vet = ckSelecionar.Split(','); OfertaCursoModulo ocm = new OfertaCursoModulo(); double valor = 0; for (int i = 0; i < vet.Length; i++) { int cod = int.Parse(vet[i]); valor = valor + ocm.RecuperarValorModulos(cod); } Parcelas p = new Parcelas(); double vlrParExcl = p.ValorParcelasPagaExcluidas(Convert.ToInt32(hfMatricula.Value)); valor = valor - vlrParExcl; tbValor.Text = valor.ToString(); } else { u.MsgBox(this, "Selecione pelo menos um modulo."); } } } }
public ParcelaAdapter(Parcelas parcela, varejo_config context) { Parcela = parcela; switch (Parcela.Tipo_parcela) { case (int)Tipo_parcela.PAGAR: Tipo = "PAGAR"; break; case (int)Tipo_parcela.RECEBER: Tipo = "RECEBER"; break; } Application.Current.Dispatcher.BeginInvoke(new Action(() => { switch (parcela.Situacao) { case (int)Situacao_parcela.EM_ABERTO: ImgStatus = new BitmapImage(new Uri(System.IO.Directory.GetCurrentDirectory() + System.IO.Path.DirectorySeparatorChar + "/Images/verde.png")); break; case (int)Situacao_parcela.PAGA: ImgStatus = new BitmapImage(new Uri(System.IO.Directory.GetCurrentDirectory() + System.IO.Path.DirectorySeparatorChar + "/Images/vermelho.png")); break; case (int)Situacao_parcela.CANCELADA: ImgStatus = new BitmapImage(new Uri(System.IO.Directory.GetCurrentDirectory() + System.IO.Path.DirectorySeparatorChar + "/Images/cinza.png")); break; case (int)Situacao_parcela.RENEGOCIADA: ImgStatus = new BitmapImage(new Uri(System.IO.Directory.GetCurrentDirectory() + System.IO.Path.DirectorySeparatorChar + "/Images/amarelo.png")); break; } })); if (parcela.Portador > 0) { Portador = context.Contas.Find(parcela.Portador).Nome; } if (parcela.Cliente_id > 0) { Cliente = context.Clientes.Find(parcela.Cliente_id).Nome; } if (parcela.Fornecedor_id > 0) { Fornecedor = context.Fornecedores.Find(parcela.Fornecedor_id).Nome; } }
public ParcelaAdapter(Parcelas parcela, varejo_config context) { Id = parcela.Id; Num_documento = parcela.Num_documento; Data_vencimento = parcela.Data_vencimento; if (parcela.Portador > 0) { Contas conta = context.Contas.Find(parcela.Portador); Portador = conta.Nome; } switch (parcela.Situacao) { case (int)Situacao_parcela.EM_ABERTO: ImgStatus = new BitmapImage(new Uri(System.IO.Directory.GetCurrentDirectory() + System.IO.Path.DirectorySeparatorChar + "/Images/verde.png")); break; case (int)Situacao_parcela.PAGA: ImgStatus = new BitmapImage(new Uri(System.IO.Directory.GetCurrentDirectory() + System.IO.Path.DirectorySeparatorChar + "/Images/vermelho.png")); break; case (int)Situacao_parcela.CANCELADA: ImgStatus = new BitmapImage(new Uri(System.IO.Directory.GetCurrentDirectory() + System.IO.Path.DirectorySeparatorChar + "/Images/cinza.png")); break; case (int)Situacao_parcela.RENEGOCIADA: ImgStatus = new BitmapImage(new Uri(System.IO.Directory.GetCurrentDirectory() + System.IO.Path.DirectorySeparatorChar + "/Images/amarelo.png")); break; } Valor = parcela.Valor; Forma_pagamento = (from fpg in context.Formas_pagamento join itens_pg in context.Itens_pagamento on fpg.Id equals itens_pg.Forma_pagamento_id join parc in context.Parcelas on itens_pg.Id equals parc.Item_pagamento_id where parc.Id == parcela.Id select fpg.Descricao).SingleOrDefault(); switch (parcela.Tipo_parcela) { case (int)Tipo_parcela.PAGAR: Tipo = "PAGAR"; break; case (int)Tipo_parcela.RECEBER: Tipo = "RECEBER"; break; } }
protected void gvCidades_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { LinkButton lbtnSelecionar = (LinkButton)e.Row.FindControl("lbtnSelecionar"); string cidade = DataBinder.Eval(e.Row.DataItem, "Cidade").ToString(); Parcelas p = new Parcelas(); DataTable dt = p.AlunosDevedores(cidade); if (dt.Rows.Count == 0) { lbtnSelecionar.Visible = false; } } }
public void CalcularParcelas(Contrato contrato) { int x = 1; while (x <= contrato.NrParcelas) { DateTime dataParcela = contrato.DataAssinatura.AddMonths(x); double valor = (contrato.ValorTotal / contrato.NrParcelas); valor += ((valor * 0.01) * x); valor = valor + (valor * 0.02); Parcelas parcela = new Parcelas(dataParcela, valor); contrato.Parcelas.Add(parcela); x++; } }
public void RemoveParcela(Parcelas parcela) { FabricaConexao con = new FabricaConexao(); con.AbreConexao(); SqlCommand cmd = new SqlCommand("spDeletaParcela", con.GetConexao()); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@IdParcela", parcela.IdParcela); cmd.ExecuteNonQuery(); //DELETOU PARCELA con.FechaConexao(); }
protected void gvAlunos_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { Literal ltCk = (Literal)e.Row.FindControl("ltCk"); string cod = DataBinder.Eval(e.Row.DataItem, "Aluno.Ra").ToString(); string ck = ""; Parcelas p = new Parcelas(); ck = ""; ltCk.Text = "<input id=\"ckSelecionar\" name=\"ckSelecionar\" type=\"checkbox\" value=\"" + cod + "\" " + ck + "/>"; } }
//se o pagamento for bem sucedido public ActionResult sucessopg(int id) { if (Session["idVendedor"] != null) { PagamentoDAO objPD = new PagamentoDAO(); Pagamento objP = objPD.GetPagamento(id); ParcelasDAO objPrD = new ParcelasDAO(); Parcelas objPr = objPrD.GetParcelas(id); return(View(Tuple.Create(objPr, objP))); } else { return(RedirectToAction("Index")); } }
public void AlteraParcelaRapido(Parcelas parcela) { FabricaConexao con = new FabricaConexao(); con.AbreConexao(); SqlCommand cmd = new SqlCommand("spUpdateParcela", con.GetConexao()); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@IdParcela", parcela.IdParcela); cmd.Parameters.AddWithValue("@Valor", parcela.Valor); cmd.Parameters.AddWithValue("@DataVencimento", parcela.DataVencimento); cmd.Parameters.AddWithValue("@Situacao", parcela.Situacao); cmd.Parameters.AddWithValue("@Observacao", parcela.Observacao); cmd.ExecuteNonQuery(); con.FechaConexao(); }
private void dgvLancamentos_CellClick(object sender, DataGridViewCellEventArgs e) { if (e.ColumnIndex == 9) { Parcelas frm = new Parcelas( dgvLancamentos.CurrentRow.Cells["id"].Value.ToString(), dgvLancamentos.CurrentRow.Cells["id_pagto"].Value.ToString(), dgvLancamentos.CurrentRow.Cells["id_sub"].Value.ToString(), dgvLancamentos.CurrentRow.Cells["id_emp"].Value.ToString() ); frm.ShowDialog(); } if (e.ColumnIndex == 0) { string rpta = ""; try { if (MessageBox.Show("Excluir Registro?", "Confirmar", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { rpta = DoCadastros.Recorrencia_Delete(int.Parse(dgvLancamentos.CurrentRow.Cells["id"].Value.ToString())); } else { // user clicked no } if (rpta.Equals("OK")) { MessageBox.Show("Registro excluida com sucesso!"); } else { MessageBox.Show(rpta); } } catch (Exception ex) { rpta = ex.Message + ex.StackTrace; } Provisionados_Lista(); } }
public void CadastraEntradaParcela(Parcelas parcelas, Contrato contrato) { FabricaConexao con = new FabricaConexao(); con.AbreConexao(); SqlCommand cmd = new SqlCommand("spCadastraParcela", con.GetConexao()); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@IdCliente", parcelas.IdCliente); cmd.Parameters.AddWithValue("@IdContrato", parcelas.IdContrato); cmd.Parameters.AddWithValue("@Valor", contrato.ValorEntrada); cmd.Parameters.AddWithValue("@DataVencimento", parcelas.DataVencimento); cmd.Parameters.AddWithValue("@Situacao", parcelas.Situacao); cmd.Parameters.AddWithValue("@Observacao", parcelas.Observacao); cmd.ExecuteNonQuery(); //CADASTROU ENTRADA PARCELA con.FechaConexao(); }
static void Main(string[] args) { Console.WriteLine("Entre com os dados do contrato"); Console.Write("Número : "); int numero = int.Parse(Console.ReadLine()); Console.Write("Data (dd/MM/yyyy) : "); DateTime data = DateTime.ParseExact(Console.ReadLine(), "dd/MM/yyyy", CultureInfo.InvariantCulture); Console.Write("Valor do Contrato : "); double valor_Contrato = double.Parse(Console.ReadLine(), CultureInfo.InvariantCulture); Console.Write("Entre com o número de parcelas : "); int meses = int.Parse(Console.ReadLine()); Contratos contratos = new Contratos(numero, data, valor_Contrato); Parcelas parcelas = new Parcelas(meses, data); Processamento_Contratos_Service processamento_Contratos_Service = new Processamento_Contratos_Service(contratos, parcelas); double valorParcelas = processamento_Contratos_Service.calcular_Parcelas(); for (int c = 1; c <= parcelas.Quantidade; c++) { processamento_Contratos_Service = new Processamento_Contratos_Service(contratos, parcelas, valorParcelas, new Servico_Pagamento_Service(), c); Console.WriteLine(processamento_Contratos_Service.ToString()); } // Outra solução sem o Tostring() //double valor_parcelas = processamento_Contratos_Service.calcular_Parcelas(); //IPagamentosService pagamentos = new Servico_Pagamento_Service(); //for (int c = 1; c <= parcelas.Quantidade; c++) //{ // double parcelamento = pagamentos.processar_Pagamentos(valor_parcelas, c); // Console.WriteLine(contratos.Data.AddMonths(c).ToString("dd/MM/yyyy") + " - "+parcelamento.ToString("F2", CultureInfo.InvariantCulture)); //} }
protected void btnConf_Click(object sender, EventArgs e) { data = DateTime.Now; ckSelecionar = ViewState["ParCodSel"].ToString(); if (ckSelecionar != "") { string[] vet = ckSelecionar.Split(','); Parcelas p = new Parcelas(); for (int i = 0; i < vet.Length; i++) { int cod = int.Parse(vet[i]); p.PagarParcela(cod, data); } ViewState.Add("data", data); lValor.Visible = false; btnConf.Visible = false; lbtnImprimir.Visible = true; CarregaAlteracao(int.Parse(Request.QueryString["id"])); u.MsgBox(this, "Pagamento realizado com sucesso."); } }
public List <Parcelas> listarParcelas(string id) { List <Parcelas> Retorno = new List <Parcelas>(); try { Connection objCon = new Connection(); MySqlConnection Banco = new MySqlConnection(); string user = "******"; Banco = objCon.AbreConexao(user); MySqlCommand command = Banco.CreateCommand(); command.CommandText = "select idParcela, numParcela, dtvencParcela, valorParcela from parcelas WHERE idVendaaPrazo = " + id + " and statusParcela = 0"; MySqlDataReader Reader = command.ExecuteReader(); while (Reader.Read()) { Parcelas objP = new Parcelas(); objP.idParcela = Reader.GetInt32(0); objP.numParcela = Reader.GetInt32(1); objP.dtvencParcela = Reader.GetString(2); objP.valorParcela = Reader.GetDecimal(3); Retorno.Add(objP); } objCon.FechaConexao(); } catch (Exception e) { Parcelas objP = new Parcelas(); objP.idParcela = 0; objP.dtvencParcela = e.Message + e.InnerException + e.Source; Retorno.Add(objP); } return(Retorno); }