public void CargarIntereses() { interes = cInteres.ObtenerInteresDepartamento(prenda.IdDepartamento); pagos = null; pagos = new ObservableCollection <cPago>(); for (int i = 1; i <= int.Parse(interes.Plazo) + 1; i++) { cPago p = new cPago(); if (i == 1) { p.Periodo = i.ToString(); p.Importe = prenda.Prestamo; if (interes.ReclamoAnticipadoMetodo == "Interes") { p.Intereses = ((float.Parse(interes.ReclamoAnticipadoCantidad) / 100) * (float.Parse(prenda.Prestamo))).ToString(); p.Almacenaje = (0.01 * (float.Parse(prenda.Prestamo))).ToString(); p.IVA = (((float.Parse(p.Intereses) + float.Parse(p.Almacenaje)) * (float.Parse(interes.IVA) / 100)).ToString()); p.TotalDesempeno = (float.Parse(p.Importe) + float.Parse(p.Intereses) + float.Parse(p.Almacenaje) + float.Parse(p.IVA)).ToString(); p.TotalRefrendo = (float.Parse(p.Intereses) + float.Parse(p.Almacenaje) + float.Parse(p.IVA)).ToString(); //p.FechaPago = DateTime.Now.AddDays(int.Parse(interes.ReclamoAnticipadoDias)).ToShortDateString(); p.FechaPago = dtpFechaPrestamo.SelectedDate.Value.AddDays(int.Parse(interes.ReclamoAnticipadoDias)).ToShortDateString(); } else if (interes.ReclamoAnticipadoMetodo == "Monto Fijo") { } } else { p.Periodo = i.ToString(); p.Importe = prenda.Prestamo; float financiamiento = float.Parse(interes.Financiamiento); float fPago = financiamiento * (i - 1); int r = i - 1; if (interes.ReclamoAnticipadoMetodo == "Interes") { p.Intereses = ((fPago / 100) * (float.Parse(prenda.Prestamo))).ToString(); p.Almacenaje = (r * (float.Parse(interes.Almacenaje) / 100) * (float.Parse(prenda.Prestamo))).ToString(); p.IVA = (((float.Parse(p.Intereses) + float.Parse(p.Almacenaje)) * (float.Parse(interes.IVA) / 100)).ToString()); p.TotalDesempeno = (float.Parse(p.Importe) + float.Parse(p.Intereses) + float.Parse(p.Almacenaje) + float.Parse(p.IVA)).ToString(); p.TotalRefrendo = (float.Parse(p.Intereses) + float.Parse(p.Almacenaje) + float.Parse(p.IVA)).ToString(); //p.FechaPago = DateTime.Now.AddDays(30 * r).ToShortDateString(); p.FechaPago = dtpFechaPrestamo.SelectedDate.Value.AddMonths(r).ToShortDateString(); } else if (interes.ReclamoAnticipadoMetodo == "Monto Fijo") { } } pagos.Add(p); } dgPagos.ItemsSource = pagos; }
public static List <cReporteBoletas> ObtenerReporte(String Busqueda) { List <cReporteBoletas> reporte = new List <cReporteBoletas>(); cReporteBoletas c; try { using (SqlConnection con = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["EfectivoInmediato.Properties.Settings.EfectivoInmediatoConnectionString"].ConnectionString)) { using (SqlCommand myCMD = new SqlCommand(" " + "Select * " + "From Prestamos " + "Inner Join Clientes " + "On Clientes.IdCliente = Prestamos.IdCliente " + "Inner Join Prendas " + "On Prendas.IdPrenda = Prestamos.IdPrenda " + "WHERE (Prestamos.Contrato LIKE @Busqueda) " + "OR (Clientes.NombreCliente LIKE @Busqueda) " + "ORDER BY Prestamos.IdPrestamo " + "", con)) { con.Open(); myCMD.Parameters.AddWithValue("Busqueda", Busqueda); SqlDataReader reader = myCMD.ExecuteReader(); if (reader.HasRows) { while (reader.Read()) { c = new cReporteBoletas(); c.IdPrestamo = reader["IdPrestamo"].ToString(); c.IdPrenda = reader["IdPrenda"].ToString(); c.IdDepartamento = reader["IdDepartamento"].ToString(); c.Contrato = reader["Contrato"].ToString(); c.NombreCliente = reader["NombreCliente"].ToString() + " " + reader["ApellidoPaternoCliente"].ToString() + " " + reader["ApellidoMaternoCliente"].ToString(); c.Descripcion = reader["Descripcion"].ToString() + " " + reader["Marca"].ToString() + " " + reader["Modelo"].ToString(); c.CantidadPrestada = reader["CantidadPrestada"].ToString(); cInteres interes = cInteres.ObtenerInteresDepartamento(c.IdDepartamento); cPago p = new cPago(); p.Importe = c.CantidadPrestada; float financiamiento = float.Parse(interes.Financiamiento); float fPago = financiamiento * (3 - 1); int r = 3 - 1; p.Intereses = ((fPago / 100) * (float.Parse(c.CantidadPrestada))).ToString(); p.Almacenaje = (r * (float.Parse(interes.Almacenaje) / 100) * (float.Parse(c.CantidadPrestada))).ToString(); p.IVA = (((float.Parse(p.Intereses) + float.Parse(p.Almacenaje)) * (float.Parse(interes.IVA) / 100)).ToString()); p.TotalDesempeno = (float.Parse(p.Importe) + float.Parse(p.Intereses) + float.Parse(p.Almacenaje) + float.Parse(p.IVA)).ToString(); p.TotalRefrendo = (float.Parse(p.Intereses) + float.Parse(p.Almacenaje) + float.Parse(p.IVA)).ToString(); //p.FechaPago = DateTime.Parse(c.FechaPrestamo).AddMonths(r).ToShortDateString(); c.Intereses = p.TotalRefrendo; c.FechaEmpeno = reader["FechaPrestamo"].ToString(); c.FechaLiquidacion = ""; c.Estado = reader["Estado"].ToString(); c.CantidadVenta = reader["PrecioVenta"].ToString(); if (reader["Estado"].ToString() == "LIQUIDADO") { ObservableCollection <cRefrendo> refrendosLiquidado = cRefrendo.ObtenerRefrendos(c.IdPrestamo); int s = refrendosLiquidado.Count; c.FechaLiquidacion = refrendosLiquidado[s - 1].FechaRefrendo; } reporte.Add(c); } } con.Close(); } } } catch (Exception exc) { c = null; } return(reporte); }
public void CargarIntereses() { interes = cInteres.ObtenerInteresDepartamento(prenda.IdDepartamento); pagos = null; pagos = new ObservableCollection <cPago>(); float cantidadPrestada = float.Parse(prestamo.CantidadPrestada); if (refrendos.Count > 0) { foreach (cRefrendo r in refrendos) { if (r.Tipo == "REFRENDO") { prestamo.FechaPrestamo = r.FechaRefrendo; } if (r.Tipo == "ABONO") { cantidadPrestada = cantidadPrestada - float.Parse(r.Refrendo); } } } prestamo.CantidadPrestada = cantidadPrestada.ToString(); for (int i = 1; i <= int.Parse(interes.Plazo) + 1; i++) { cPago p = new cPago(); if (i == 1) { p.Periodo = i.ToString(); p.Importe = prestamo.CantidadPrestada; if (interes.ReclamoAnticipadoMetodo == "Interes") { p.Intereses = ((float.Parse(interes.ReclamoAnticipadoCantidad) / 100) * (float.Parse(prestamo.CantidadPrestada))).ToString(); p.Almacenaje = (0.01 * (float.Parse(prestamo.CantidadPrestada))).ToString(); p.IVA = (((float.Parse(p.Intereses) + float.Parse(p.Almacenaje)) * (float.Parse(interes.IVA) / 100)).ToString()); p.TotalDesempeno = (float.Parse(p.Importe) + float.Parse(p.Intereses) + float.Parse(p.Almacenaje) + float.Parse(p.IVA)).ToString(); p.TotalRefrendo = (float.Parse(p.Intereses) + float.Parse(p.Almacenaje) + float.Parse(p.IVA)).ToString(); p.FechaPago = DateTime.Parse(prestamo.FechaPrestamo).AddDays(int.Parse(interes.ReclamoAnticipadoDias)).ToShortDateString(); } else if (interes.ReclamoAnticipadoMetodo == "Monto Fijo") { } } else { p.Periodo = i.ToString(); p.Importe = prestamo.CantidadPrestada; float financiamiento = float.Parse(interes.Financiamiento); float fPago = financiamiento * (i - 1); int r = i - 1; if (interes.ReclamoAnticipadoMetodo == "Interes") { p.Intereses = ((fPago / 100) * (float.Parse(prestamo.CantidadPrestada))).ToString(); p.Almacenaje = (r * (float.Parse(interes.Almacenaje) / 100) * (float.Parse(prestamo.CantidadPrestada))).ToString(); p.IVA = (((float.Parse(p.Intereses) + float.Parse(p.Almacenaje)) * (float.Parse(interes.IVA) / 100)).ToString()); p.TotalDesempeno = (float.Parse(p.Importe) + float.Parse(p.Intereses) + float.Parse(p.Almacenaje) + float.Parse(p.IVA)).ToString(); p.TotalRefrendo = (float.Parse(p.Intereses) + float.Parse(p.Almacenaje) + float.Parse(p.IVA)).ToString(); p.FechaPago = DateTime.Parse(prestamo.FechaPrestamo).AddMonths(r).ToShortDateString(); } else if (interes.ReclamoAnticipadoMetodo == "Monto Fijo") { } } pagos.Add(p); } dgPagos.ItemsSource = pagos; }