private void ActualizarCredito(decimal pago) { //_entidades=new EmpeñosDC(new clsConeccionDB().StringConn()); FinancieraCredito credito = _entidades.FinancieraCreditos.Single(c => c.Clave == Convert.ToInt32(txtCveCredito.EditValue)); credito.SaldoActual = credito.SaldoActual - pago; //_entidades.SubmitChanges(); if (credito.SaldoActual == 0) { credito.Estado = "Pagado"; //_entidades.SubmitChanges(); ImprimirRetiroBase(); FinancieraGrupo grupo = _entidades.FinancieraGrupos.Single(c => c.Clave == Convert.ToInt32(txtCveGrupo.EditValue)); grupo.Estado = "INACTIVO"; foreach (FinancieraGruposDetalle integrantes in grupo.FinancieraGruposDetalles) { integrantes.Aprobado = 0; integrantes.Base = 0; } //_entidades.SubmitChanges(); } _entidades.SubmitChanges(); }
public int AgregarCredito(FinancieraCredito credito) { if (credito.CveGrupo == 0) { throw new ValidationException("Elija el Grupo para poder otorgar un credito"); } _entidades.FinancieraCreditos.InsertOnSubmit(credito); _entidades.SubmitChanges(); return(credito.Clave); }
private void CancelarCredito() { FinancieraCredito credito = _entidades.FinancieraCreditos.First( cre => cre.Clave == Convert.ToInt32(grvDatos.GetFocusedRowCellDisplayText("Clave"))); credito.Estado = "Cancelado"; FinancieraGrupo grupo = _entidades.FinancieraGrupos.Single(c => c.Clave == credito.CveGrupo); grupo.Estado = "INACTIVO"; _entidades.SubmitChanges(); Insertarcancelacion("Crédito", grvDatos.GetFocusedRowCellDisplayText("Clave")); }
public void Guardar() { //if (HasNull(dtIntegrantesGrupo)) //{ // XtraMessageBox.Show("No puede guardar el crédito si no especifica las fotos de los integrantes"); // return; //} try { if ((int)txtCveCredito.EditValue == 0) { FinancieraCredito credito = new FinancieraCredito { CveGrupo = Convert.ToInt32(txtCveGrupo.EditValue), FechaInicio = dtpFechaInicio.DateTime.Date, FechaFinal = dtpFechaFinal.DateTime.Date, Prestamo = Convert.ToDecimal(txtCantidadCredito.EditValue), Pago = Convert.ToDecimal(txtMontoPago.EditValue), TotalPago = Convert.ToDecimal(txtTotalCredito.EditValue), SaldoActual = Convert.ToDecimal(txtTotalCredito.EditValue), Plazos = cboPlazo.Text, NumeroPlazos = Convert.ToInt32(txtNumPlazos.EditValue), Estado = "Activo", CveUsuario = Convert.ToInt32(new clsModificarConfiguracion().configGetValue("IdUsuarioApp")), Base = Convert.ToDecimal(txtBase.EditValue), FechaModificacion = DateTime.Today.Date }; txtCveCredito.EditValue = new LogicaCreditos().AgregarCredito(credito); ImprimirReportes(credito); ActualizarGrupo(Convert.ToInt32(txtCveGrupo.EditValue)); } else { FinancieraCredito credito = _entidades.FinancieraCreditos.Single(c => c.Clave == Convert.ToInt32(txtCveCredito.EditValue)); ImprimirReportes(credito); } cboPlazo.Enabled = txtNumPlazos.Enabled = false; } catch (ValidationException vex) { XtraMessageBox.Show(vex.Message, "Validando Datos"); } catch (Exception ex) { XtraMessageBox.Show(ex.Message, "Error de al guardar"); } }
private void CancelarPagosCredito() { FinancieraPago pcredito = _entidades.FinancieraPagos.First( cre => cre.Clave == Convert.ToInt32(grvDatos.GetFocusedRowCellDisplayText("Clave"))); pcredito.Estado = false; //_entidades.SubmitChanges(); FinancieraCredito credito = _entidades.FinancieraCreditos.First( cre => cre.Clave == pcredito.CveCredito); credito.SaldoActual = credito.SaldoActual + pcredito.Pago; credito.Estado = "Activo"; FinancieraGrupo grupo = _entidades.FinancieraGrupos.Single(fg => fg.Clave == credito.CveGrupo); grupo.Estado = "ACTIVO"; _entidades.SubmitChanges(); Insertarcancelacion("Pagos Credito", grvDatos.GetFocusedRowCellDisplayText("Clave")); }
private void botonGuardar_Click(object sender, EventArgs e) { if ((decimal)txtTotalAPagar.EditValue <= 0) { return; } if (!ClsVerificarCaja.CajaEstado()) { MessageBox.Show("La Caja del Dia de hoy ya se ha cerrado\n SISTEMA BLOQUEADO", "Caja Cerrada", MessageBoxButtons.OK, MessageBoxIcon.Error); Application.Exit(); } if (!_guardado) { if ((int)txtCveCredito.EditValue == 0) { MessageBox.Show("Busque Primero el financiamiento para poder cobrar", Application.ProductName); return; } decimal totalcantidad = 0; if (_dTpagos.Rows.Count > 0) { //if para saber si va a cobrar pagos de interes y moratorios for (int i = 0; i < _dTpagos.Rows.Count; i++) { if ((bool)_dTpagos.Rows[i]["Pagar"] == false) { continue; } FinancieraPago pagFin = new FinancieraPago() { FechaPago = dtpFechaPago.DateTime.Date, CveCredito = Convert.ToInt32(txtCveCredito.EditValue), Pago = (decimal)_dTpagos.Rows[i]["Pago"], Recargo = (decimal)_dTpagos.Rows[i]["Recargo"], TotalPago = Convert.ToDecimal(_dTpagos.Rows[i]["TotalAPagar"]), CveUsuario = Convert.ToInt32(new clsModificarConfiguracion().configGetValue("IdUsuarioApp")), Estado = true }; totalcantidad += (decimal)_dTpagos.Rows[i]["Pago"]; _entidades.FinancieraPagos.InsertOnSubmit(pagFin); _entidades.SubmitChanges(); ActualizarCredito(pagFin.Pago); _folios += pagFin.Clave + "; "; _guardado = true; } FinancieraCredito credito = _entidades.FinancieraCreditos.Single(c => c.Clave == Convert.ToInt32(txtCveCredito.EditValue)); txtLetrasRestantes.EditValue = credito.NumeroPlazos - credito.FinancieraPagos.Count(c => c.Estado); } new ManejadorControles().DesectivarTextBox(gpoContenedor, true); MessageBox.Show("Pagos Registrado", Application.ProductName); // ModificarSaldoFinanciamiento(_cveFinanciamiento, (totalcantidad + Convert.ToDecimal(txtAbonoCapital.EditValue))); ImprimirTicketPago(); } else { ImprimirTicketPago(); } SendKeys.Send("{TAB}"); }
private void ImprimirReportes(FinancieraCredito credito) { FinancieraDS financieraDS = new FinancieraDS(); DateTime fechapago = dtpFechaInicio.DateTime.Date; decimal pagoPuntual = decimal.Round(Convert.ToDecimal(txtMontoPago.EditValue), 1); decimal pagoAtrasado = decimal.Round( (pagoPuntual + (pagoPuntual * Convert.ToDecimal(txtRecargoG.EditValue))), 1); for (int i = 0; i < Convert.ToInt32(txtNumPlazos.EditValue); i++) { switch (cboPlazo.Text) { case "SEMANAL": financieraDS.Tables[0].Rows.Add(new object[] { null, fechapago.AddDays(7).Date, pagoPuntual, pagoAtrasado }); fechapago = fechapago.AddDays(7).Date; break; case "QUINCENAL": financieraDS.Tables[0].Rows.Add(new object[] { null, fechapago.AddDays(15).Date, pagoPuntual, pagoAtrasado }); fechapago = fechapago.AddDays(15).Date; break; case "MENSUAL": financieraDS.Tables[0].Rows.Add(new object[] { null, fechapago.AddMonths(1).Date, pagoPuntual, pagoAtrasado }); fechapago = fechapago.AddMonths(1).Date; break; } } XrptControlPagosGrupal control = new XrptControlPagosGrupal(); control.DataSource = financieraDS.Tables[0]; control.DatosGrupo.DataSource = credito; control.MontoCredito.Value = Convert.ToDecimal(txtCantidadCredito.EditValue); control.DiasPago.Value = string.Format("LOS {0} DE CADA SEMANA (CON PRORROGA HASTA EL {1})", dtpFechaInicio.DateTime.ToString("dddd").ToUpper(), dtpFechaInicio.DateTime.AddDays(Convert.ToInt32(txtProrrogaG.EditValue)).ToString("dddd").ToUpper()); //control.ShowPreviewDialog(); control.Print(new clsModificarConfiguracion().configGetValue("ImpresoraBoletas")); control.Print(new clsModificarConfiguracion().configGetValue("ImpresoraBoletas")); foreach (DataRow fila in dtIntegrantesGrupo.Rows) { fechapago = dtpFechaInicio.DateTime.Date; financieraDS.Tables[1].Rows.Clear(); financieraDS.Tables[1].AcceptChanges(); financieraDS.Tables[1].Columns["Pago"].AutoIncrementSeed = -1; financieraDS.Tables[1].Columns["Pago"].AutoIncrementStep = -1; financieraDS.Tables[1].Columns["Pago"].AutoIncrementSeed = 1; financieraDS.Tables[1].Columns["Pago"].AutoIncrementStep = 1; for (int i = 0; i < Convert.ToInt32(txtNumPlazos.EditValue); i++) { switch (cboPlazo.Text) { case "SEMANAL": financieraDS.Tables[1].Rows.Add(new[] { fila[1], fila[8], fila[9], fila[3], fechapago.AddDays(7).Date, null }); fechapago = fechapago.AddDays(7).Date; break; case "QUINCENAL": financieraDS.Tables[1].Rows.Add(new[] { fila[1], fila[8], fila[9], fila[3], fechapago.AddDays(15).Date, null }); fechapago = fechapago.AddDays(15).Date; break; case "MENSUAL": financieraDS.Tables[1].Rows.Add(new[] { fila[1], fila[8], fila[9], fila[3], fechapago.AddMonths(1).Date, null }); fechapago = fechapago.AddMonths(1).Date; break; } } XrptControlPagosPersonal control1 = new XrptControlPagosPersonal(); control1.DataSource = financieraDS.Tables[1]; control1.DatosGrupo.DataSource = credito; control1.MontoCredito.Value = Convert.ToDecimal(txtCantidadCredito.EditValue); control1.DiasPago.Value = string.Format("LOS {0} DE CADA SEMANA (CON PRORROGA HASTA EL {1})", dtpFechaInicio.DateTime.ToString("dddd").ToUpper(), dtpFechaInicio.DateTime.AddDays(Convert.ToInt32(txtProrrogaG.EditValue)).ToString("dddd").ToUpper()); control1.Print(new clsModificarConfiguracion().configGetValue("ImpresoraBoletas")); //financieraDS.Tables[2].Rows.Add(new[] { fila[1],CbToBytesA((Bitmap)fila[5]), CbToBytesA((Bitmap)fila[6]), CbToBytesA((Bitmap)fila[7])}); } financieraDS.Tables[1].Rows.Clear(); foreach (DataRow fila in dtIntegrantesGrupo.Rows) { financieraDS.Tables[1].Rows.Add(new[] { fila[1], fila[8], fila[9], fila[3], fechapago.AddDays(7).Date, null }); } XrptHistrorialPagoPersonal historial = new XrptHistrorialPagoPersonal(); historial.DataSource = financieraDS; historial.DatosGrupo.DataSource = credito; historial.MontoCredito.Value = Convert.ToDecimal(txtCantidadCredito.EditValue); historial.DiasPago.Value = dtpFechaInicio.DateTime.ToString("dddd").ToUpper(); XRSubreport detailReport = historial.Bands[BandKind.ReportHeader].FindControl("xrSubreport1", true) as XRSubreport; detailReport.ReportSource.DataSource = financieraDS.Tables[1]; //for (int i = 0; i < dtIntegrantesGrupo.Rows.Count; i++) //{ historial.Print(new clsModificarConfiguracion().configGetValue("ImpresoraBoletas")); historial.Print(new clsModificarConfiguracion().configGetValue("ImpresoraBoletas")); //} XrptPoderCobranza poder = new XrptPoderCobranza(); poder.DataSource = credito; //poder.ShowPreviewDialog(); poder.Print(new clsModificarConfiguracion().configGetValue("ImpresoraBoletas")); XrptReglamento reglamento = new XrptReglamento(); reglamento.DataSource = credito; reglamento.BaseLetras.Value = String.Format("{0} ({1}) ", txtBase.Text, Conversiones.NumeroALetras(txtBase.EditValue.ToString())); reglamento.Presidenta.Value = credito.FinancieraGrupo.FinancieraGruposDetalles.First(p => p.Tipo == "PRESIDENTA").FinancieraCliente.Nombre; reglamento.Tesorera.Value = credito.FinancieraGrupo.FinancieraGruposDetalles.First(p => p.Tipo == "TESORERA").FinancieraCliente.Nombre; reglamento.Print(new clsModificarConfiguracion().configGetValue("ImpresoraBoletas")); reglamento.Print(new clsModificarConfiguracion().configGetValue("ImpresoraBoletas")); //reglamento.ShowPreviewDialog(); //control.Pages.AddRange(historial.Pages); this.oWord = new Word.Application(); this.oWord.Visible = false; // Ubicación de la plantilla en el disco duro oDoc = oWord.Documents.Add(Application.StartupPath + @"\Reglamento.dotx"); oDoc.Bookmarks["Sucursal"].Range.Text = new clsModificarConfiguracion().configGetValue("Empresa"); oDoc.Bookmarks["Direccion"].Range.Text = new clsModificarConfiguracion().configGetValue("Direccion"); object m = System.Reflection.Missing.Value; object copies = 2; oWord.ActivePrinter = new clsModificarConfiguracion().configGetValue("ImpresoraBoletas"); oWord.PrintOut(m, m, m, m, m, m, m, copies, m, m, m, m, m, m, m, m, m, m, m); object doNotSaveChanges = Word.WdSaveOptions.wdDoNotSaveChanges; oDoc.Close(ref doNotSaveChanges, m, m); //////XrptFotosGrupos fotos=new XrptFotosGrupos {DataSource = financieraDS.Tables[2]}; ////////fotos.ShowPreviewDialog(new clsModificarConfiguracion().configGetValue("ImpresoraBoletas")); //////fotos.Print(new clsModificarConfiguracion().configGetValue("ImpresoraBoletas")); }