public Respuesta <Abono> Guardar(Abono Abono) { Respuesta <Abono> respuesta = new Respuesta <Abono>(); try { string respuestaActualizar = ActualizarCredito(Abono); if (respuestaActualizar.Equals("Execede")) { respuesta.Mensaje = "error el valor es excedido al de la deuda"; respuesta.Elemento = null; } else { respuesta = new Respuesta <Abono>(Abono, $"Los datos de han sido guardados correctamente", false); _contexto.Abonos.Add(respuesta.Elemento); _contexto.SaveChanges(); } } catch (Exception E) { respuesta.Elemento = null; respuesta.Mensaje = "Error de la aplicaciĆ³n: " + E.Message; } return(respuesta); }
public void Guardar(Abono abono) { using (var Comando = Conexion.CreateCommand()) { Comando.CommandText = "controlabono.guardarabono"; Comando.CommandType = CommandType.StoredProcedure; OracleParameter FechaCreacion = new OracleParameter(); FechaCreacion.ParameterName = ":fechacreacion"; FechaCreacion.Value = abono.Fecha; Comando.Parameters.Add(FechaCreacion); OracleParameter ValorAbono = new OracleParameter(); ValorAbono.ParameterName = ":valorabono"; ValorAbono.Value = abono.ValorAbono; Comando.Parameters.Add(ValorAbono); OracleParameter IdCliente = new OracleParameter(); IdCliente.ParameterName = ":cliente_idcliente"; IdCliente.Value = abono.IdCliente; Comando.Parameters.Add(IdCliente); OracleParameter CodigoCuenta = new OracleParameter(); CodigoCuenta.ParameterName = ":cuenta_codcuenta"; CodigoCuenta.Value = abono.CodigoCuenta; Comando.Parameters.Add(CodigoCuenta); Comando.ExecuteNonQuery(); } }
public AbonoViewModel(Abono Abono) { ValorAbono = Abono.ValorAbono; CreditoId = Abono.CreditoId; AbonoId = Abono.AbonoId; Fecha = Abono.Fecha; }
public Abono ObtenerAbono(int cantidad) { Abono aux = new Abono(); AccesoDatos conexion = new AccesoDatos(); string consulta = "SP_Obtener_Abono"; try { conexion.borrarParametros(); conexion.agregarParametro("@Cantidad", cantidad); conexion.setearSP(consulta); conexion.leerConsulta(); while (conexion.Lector.Read()) { aux.IdAbono = conexion.Lector.GetInt32(0); aux.CantIngresos = conexion.Lector.GetInt32(1); aux.Valor = float.Parse(conexion.Lector.GetDecimal(2).ToString()); //ver aux.Vigente = conexion.Lector.GetBoolean(3); aux.FechaAlta = conexion.Lector.GetDateTime(4); } return(aux); } catch (Exception ex) { throw ex; } finally { conexion.cerrarConexion(); } }
private static void ActualizarAbono(NpgsqlConnection conn, Abono abono) { string sqlString = "UPDATE ctrl_abono " + "SET ID_DOCO = @id_doc, " + "TIPO_PAGO = @tipo_pago, " + "IMPORTE_PAGO = @importe, " + "FOLIO = @folio, " + "concepto = @concepto, " + "fecha_deposito = @fecha_deposito, " + "cuenta = @cuenta " + "WHERE ID_ABONO = @id"; NpgsqlCommand cmd = new NpgsqlCommand(sqlString, conn); cmd.Parameters.Add("@id_doc", NpgsqlTypes.NpgsqlDbType.Integer); cmd.Parameters.Add("@tipo_pago", NpgsqlTypes.NpgsqlDbType.Varchar, 150); cmd.Parameters.Add("@importe", NpgsqlTypes.NpgsqlDbType.Money); cmd.Parameters.Add("@folio", NpgsqlTypes.NpgsqlDbType.Integer); cmd.Parameters.Add("@concepto", NpgsqlTypes.NpgsqlDbType.Varchar, 150); cmd.Parameters.Add("@fecha_deposito", NpgsqlTypes.NpgsqlDbType.Date); cmd.Parameters.Add("@cuenta", NpgsqlTypes.NpgsqlDbType.Varchar, 50); cmd.Parameters.Add("@id", NpgsqlTypes.NpgsqlDbType.Integer); cmd.Parameters["@id_doc"].Value = abono.IdCuenta; cmd.Parameters["@tipo_pago"].Value = abono.TipoPago; cmd.Parameters["@importe"].Value = abono.Monto; cmd.Parameters["@folio"].Value = abono.Folio; cmd.Parameters["@concepto"].Value = abono.Concepto; cmd.Parameters["@fecha_deposito"].Value = abono.FechaDeposito; cmd.Parameters["@cuenta"].Value = abono.Cuenta; cmd.Parameters["@id"].Value = abono.Id; cmd.ExecuteNonQuery(); }
private static void AgregarAbono(NpgsqlConnection conn, Abono abono) { string sqlString = "INSERT INTO ctrl_abono (id_abono, id_doco, tipo_pago, importe_pago, folio, concepto, fecha_deposito, cuenta) " + "VALUES(@id, @id_doc, @tipo_pago, @importe, @folio, @concepto, @fecha_deposito, @cuenta);"; NpgsqlCommand cmd = new NpgsqlCommand(sqlString, conn); cmd.Parameters.Add("@id_doc", NpgsqlTypes.NpgsqlDbType.Integer); cmd.Parameters.Add("@tipo_pago", NpgsqlTypes.NpgsqlDbType.Varchar, 150); cmd.Parameters.Add("@importe", NpgsqlTypes.NpgsqlDbType.Money); cmd.Parameters.Add("@folio", NpgsqlTypes.NpgsqlDbType.Integer); cmd.Parameters.Add("@concepto", NpgsqlTypes.NpgsqlDbType.Varchar, 150); cmd.Parameters.Add("@fecha_deposito", NpgsqlTypes.NpgsqlDbType.Date); cmd.Parameters.Add("@cuenta", NpgsqlTypes.NpgsqlDbType.Varchar, 50); cmd.Parameters.Add("@id", NpgsqlTypes.NpgsqlDbType.Integer); cmd.Parameters["@id_doc"].Value = abono.IdCuenta; cmd.Parameters["@tipo_pago"].Value = abono.TipoPago; cmd.Parameters["@importe"].Value = abono.Monto; cmd.Parameters["@folio"].Value = abono.Folio; cmd.Parameters["@concepto"].Value = abono.Concepto; cmd.Parameters["@fecha_deposito"].Value = abono.FechaDeposito; cmd.Parameters["@cuenta"].Value = abono.Cuenta; cmd.Parameters["@id"].Value = abono.Id; cmd.ExecuteNonQuery(); }
private static void GrabarAbono(NpgsqlConnection conn, Abono abono) { string sqlString = "SELECT id_abono " + "FROM ctrl_abono " + "WHERE id_abono = @pId;"; NpgsqlCommand cmd = new NpgsqlCommand(sqlString, conn); cmd.Parameters.Add("@pId", NpgsqlTypes.NpgsqlDbType.Integer); cmd.Parameters["@pId"].Value = abono.Id; NpgsqlDataReader dr = cmd.ExecuteReader(); bool exists = dr.Read(); dr.Close(); if (exists) { ActualizarAbono(conn, abono); } else { AgregarAbono(conn, abono); } }
public void AgregarAbono() { if (int.Parse(txtMontoAbono.Text) <= int.Parse(txtDeuda.Text)) { DateTime fechaAbono = DateTime.Now.Date; int montoAbono = int.Parse(txtMontoAbono.Text); Boleta boleta = new Boleta(); boleta = boleta.ObtenerBoleta(_numeroBoleta); DateTime fechaLimite = boleta.FechaCreacion.AddMonths(1); Abono abono = new Abono(boleta, montoAbono, fechaAbono, fechaLimite); if (abono.AgregarAbono()) { int idAbono = abono.ObtenerIdMaximoAbono(); CargarGrillaAbonoPorBoleta(boleta.Numero); MessageBox.Show("Abono NĀ°" + idAbono + " agregado."); _numeroBoleta = 0; } } else { MessageBox.Show("Monto del abono no puede ser mayor a lo adeudado."); } _numeroBoleta = 0; }
public void testConsultarCuentaPorPagar() { string idCuentaPorPagar = "1"; Proveedor miProveedor = new Proveedor(); miProveedor.Nombre = "Hiperdental"; NumeroCuentaBanco miCuentaBanco = new NumeroCuentaBanco(); miCuentaBanco.NroCuentaBanco = "847384001"; Abono miAbono = new Abono(); List <Abono> listaAbono = new List <Abono>(); listaAbono.Add(miAbono); Empleado miEmpleado = new Empleado(); Entidad miCuentaPP = new CuentaPorPagar("1", "2009/02/02", "2011/03/03", "credito", "activo", "proveedor ", "detallazo", 222, 0, miProveedor, miEmpleado, miCuentaBanco, listaAbono); DAOCuentasPorPagar SqlCuentaPP = new DAOCuentasPorPagar(); Entidad otraCuenta = new CuentaPorPagar(); otraCuenta = SqlCuentaPP.ConsultarCuentaPorPagar(idCuentaPorPagar); Assert.IsNotNull(otraCuenta); Assert.AreEqual(otraCuenta, miCuentaPP); }
public void PagarDia(Persona persona, Abono abono) { AccesoDatos conexion = new AccesoDatos(); string consulta = "INSERT INTO AbonosVendidos VALUES (@FechaVenta,@ID_Abono, @ID_Persona,@ID_MediodePago, @NroComprobante)"; try { conexion.borrarParametros(); conexion.agregarParametro("@FechaVenta", DateTime.Today); conexion.agregarParametro("@ID_Abono", abono.IdAbono); conexion.agregarParametro("@ID_Persona", persona.IdPersona); conexion.agregarParametro("@ID_MediodePago", 1); conexion.agregarParametro("@NroComprobante", 0); conexion.setearConsulta(consulta); conexion.accionEjecutar(); } catch (Exception ex) { throw ex; } finally { conexion.cerrarConexion(); } }
public ActionResult <Respuesta <AbonoViewModel> > Guardar(AbonoInputModel AbonoInput) { Abono Abono = MapearAbono(AbonoInput); var peticion = _servicioAbono.Guardar(Abono); return(Ok(peticion)); }
public void MostrarDeuda(int numeroBoleta) { Abono abono = new Abono(); decimal deuda = abono.ObtenerDeuda(numeroBoleta); txtDeuda.Text = deuda.ToString(); }
public void BuscarCuadre(DateTime Fecha) { Abono a = new Abono(); int Id = Convert.ToInt32(Session["UsuarioId"]); //ESTE USUARIO ES EL ADMINISTRATIVO string Campo = ""; string Tabla = ""; string Condicion = ""; DataTable dt = new DataTable(); DataTable dtCliente = new DataTable(); DateTime fecha = Fecha; string FechaHoy = fecha.Year + "/" + fecha.Month + "/" + fecha.Day + " 00:0:00.000 "; string ConvFecha = "Convert(VARCHAR(10),C.Fecha,103) as Fecha"; Campo = " C.CuadreId, Uc.Nombre,C.Total, C.UsuarioCoId," + ConvFecha; Tabla = " from Cuadre as C inner join UsuarioCo as Uc on Uc.UsuarioCoId = C.UsuarioCoId inner join Usuario as U on U.UsuarioId = Uc.UsuarioId"; Condicion = " where C.Fecha = '" + FechaHoy + "' and U.UsuarioId = " + Id; dt = Utilitario.Lista(Campo, Tabla, Condicion); if (dt.Rows.Count > 0) { GridPrestamo.DataSource = dt; GridPrestamo.DataBind(); } else { Utilitario.ShowToastr(this, "No existen registro conforme a esta fecha", "Mensaje", "error"); GridPrestamo.DataSource = null; GridPrestamo.DataBind(); } }
/// <summary> /// Inserta los datos de la cuota en la tabla /// </summary> /// <returns>true si fue exitoso y false si hubo algun error</returns> public bool InsertarCuota() { bool res = false; int numero = 0; //string fecha = DateTime.Now.ToShortDateString().Replace('/', '-'); //fecha = fecha.Substring(6, 4) + "-" + fecha.Substring(3, 2) + "-" + fecha.Substring(0, 2); if (this.MaximaCuota() == 0) { numero = 1; } else if (this.MaximaCuota() > 0) { numero = this.MaximaCuota() + 1; } if (this.ValidardatosCuota()) { string sql = "INSERT INTO tcuotas(abono, codigo_prestamo, fecha, numero, cobrador, cod_dia)"; sql += " VALUES (" + Abono.ToString().Replace(",", ".") + ","; sql += "'" + CodigoPrestamo + "',"; sql += "'" + this.Fecha + "', " + numero + ",'" + CedulaCobrador + "', " + Cod_Dia + ");"; res = conex.Ejecutar(sql); } else { res = false; } return(res); }
public void EvaluarDeudaParaEstadoFiador(int numeroBoleta) { Abono abono = new Abono(); Boleta boleta = new Boleta(); boleta = boleta.ObtenerBoleta(numeroBoleta); decimal deuda = abono.ObtenerDeuda(numeroBoleta); Cliente cliente = new Cliente(); cliente = cliente.ObtenerCliente(boleta.Cliente.Run); if (deuda == 0) { bool clientePagado = cliente.CambiarEstadoDeudaPagada(cliente.Run); if (clientePagado) { MessageBox.Show("La deuda ha sido pagada por completo"); } } else if (deuda > 0) { bool clienteNoHaPagado = cliente.CambiarEstadoDeudaImpaga(cliente.Run); if (clienteNoHaPagado) { MessageBox.Show("Ojo! Aun queda por pagar $" + deuda + ", tiene hasta " + boleta.FechaCreacion.AddMonths(1).ToShortDateString() + " para pagar!"); } } }
/// <summary> /// Ejecuta abono de prestamo /// </summary> /// <param name="abono"></param> /// <returns></returns> public async Task <Abono> Abonar(Abono abono) { var prestamo = await _context.Prestamos.FirstOrDefaultAsync(p => p.Id == abono.PrestamoId); var pagado = _context.Abonos.Where(x => x.PrestamoId == abono.PrestamoId).Sum(s => s.Capital); var mprestamo = prestamo.Monto; var saldo = mprestamo - pagado; var interes = await CalculaInteres(abono); var abonoCapital = abono.Monto > saldo + interes ? saldo : (abono.Monto - interes); var abonoInteres = abono.Monto > saldo + interes ? interes + (abono.Monto - saldo) : interes; abono.Capital = abonoCapital; abono.Interes = abonoInteres; abono.Fecha = DateTime.Now; _context.Abonos.Add(abono); await _context.SaveChangesAsync(); var pagadoTotal = _context.Abonos.Where(x => x.PrestamoId == abono.PrestamoId).Sum(s => s.Capital); prestamo.EstadoPrestamo = prestamo.Monto == pagadoTotal?ESTADOPRESTAMO.PAGADO.ToString() : ESTADOPRESTAMO.PROCESOPAGO.ToString(); prestamo.EstadoComision = prestamo.EstadoPrestamo == ESTADOPRESTAMO.PAGADO.ToString() ? ESTADOPRESTAMO.PENDIENTE.ToString() : null; await _context.SaveChangesAsync(); return(abono); }
private void TELEFONO_KeyDown(object sender, KeyEventArgs e) { if (e.Key == Key.Tab) { Abono.Focus(); } }
public AbonoViewModel(Abono abono) { Fecha = abono.Fecha; ValorAbono = abono.ValorAbono; Idabono = abono.Idabono; }
public bool AgregarAbonoCC(Abono _abono) { DAOAbono abono = new DAOAbono(); if (abono.CantidadAbonos(_abono.Factura) == 0) { System.Diagnostics.Debug.WriteLine(abono.CantidadAbonos(_abono.Factura)); if (abono.AgregarPrimerAbono(_abono)) { return(true); } else { return(false); } } else { if (abono.AgregarAbonoCC(_abono)) { return(true); } else { return(false); } } }
private void opciones(int opcion, bool BusquedaOK) { if (BusquedaOK) { lblNombre.Visible = true; lblNombre.Text = persona.Nombre; lblApellido.Visible = true; lblApellido.Text = persona.Apellido; lblDNI.Visible = true; lblDNI.Text = persona.Dni.ToString(); switch (opcion) { case 1: lblMonto.Visible = true; btnPagar.Visible = true; btnCancelar.Visible = true; abono = abonoBusiness.ObtenerAbono(1); lblMonto.Text = "$ " + abonoBusiness.ObtenerPrecioDia(); break; case 2: btnPagar.Visible = true; btnCancelar.Visible = true; break; case 3: break; } } }
private void CargarGrillaAbonoPorBoleta(int nroBoleta) { Abono abono = new Abono(); grdAbono.DataSource = abono.ListarAbonosPorBoleta(nroBoleta); OcultarColumnasAutogeneradasDetalle(); CambioNombreColumnaGrillaDetalle(); }
/// <summary> /// Calcula el interes del prestamo, en base al saldo del mismo /// </summary> /// <param name="abono"></param> /// <returns></returns> public async Task <float> CalculaInteres(Abono abono) { var prestamo = await _context.Prestamos.SingleAsync(x => x.Id == abono.PrestamoId); var abonos = _context.Abonos.Where(x => x.PrestamoId == abono.PrestamoId).Sum(a => a.Capital); return((prestamo.Monto - abonos) * (prestamo.Interes / 100)); }
private void MostrarMontoAbono(int idAbono) { Abono abono = new Abono(); abono = abono.ObtenerAbono(idAbono); decimal montoAbono = abono.Total; txtMontoAbono.Text = montoAbono.ToString(); }
private void Limpiar() { Abono.Clear(); Documento.Text = "DNI"; Nombre.Clear(); TELEFONO.Clear(); PUNTO.Text = hu; NUMERO.Clear(); CANTBICI.SelectedIndex = -1; TIEMPOALQUI.SelectedIndex = -1; dtCLiente.ItemsSource = alquiler.ListarCliente(hu).OrderBy(k => Convert.ToDateTime(k.FECHA)).Where(K => Convert.ToDateTime(K.FECHA) > DateTime.Now.AddDays(-7)); Volver(); }
private Abono MapearAbono(AbonoInputModel AbonoInput) { Abono Abono = new Abono { CreditoId = AbonoInput.CreditoId, ValorAbono = AbonoInput.ValorAbono, Fecha = DateTime.Now, }; return(Abono); }
private Abono MapearPersona(AbonoInputModel abonoInput) { var abono = new Abono { Fecha = abonoInput.Fecha, ValorAbono = abonoInput.ValorAbono, Idabono = abonoInput.Idabono, }; return(abono); }
public ActionResult <AbonoViewModel> Post(AbonoInputModel abonoInput) { Abono abono = MapearPersona(abonoInput); var response = _abonoService.Guardar(abono); if (response.Error) { return(BadRequest(response.Mensaje)); } return(Ok(response.Abono)); }
public async Task <IActionResult> PutAbono(int id, Abono item) { if (id != item.id) { return(BadRequest()); } _context.Entry(item).State = EntityState.Modified; await _context.SaveChangesAsync(); return(NoContent()); }
public void InsertarAbono(Abono abono) { if (string.IsNullOrWhiteSpace(abono.id_factura) || string.IsNullOrWhiteSpace(abono.id_cliente) || string.IsNullOrWhiteSpace(Convert.ToString(abono.forma_pago)) || string.IsNullOrWhiteSpace(Convert.ToString(abono.abono)) || string.IsNullOrWhiteSpace(Convert.ToString(abono.fecha))) { MessageBox.Show("Hay campos que estan vacios"); //si hace falta algun campo no se realiza la transaccion } else { datos cdatos = new datos(); //Se crea un objeto de capa de datos cdatos.insertarabono(abono.id_factura, abono.id_cliente, abono.forma_pago, abono.abono, abono.fecha); //se llama la funcion de DinsertarPersona con los datos del objeto persona } }
public static int InsertAndReturn(Abono abono) { using (SQLiteConnection sqliteConnection = new SQLiteConnection(DataConnection.GetConnectionPath())) { sqliteConnection.Insert(abono); int id = sqliteConnection.Table <Abono>().Where(v => v.COM_ID == 0).FirstOrDefault().ABO_ID; abono = GetAbonoByID(id); abono.COM_ID = Memoria.DinamicValue; UpdateAbono(abono); return(id); } }