コード例 #1
0
 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;
 }
コード例 #2
0
		private void detach_FinancieraCreditos(FinancieraCredito entity)
		{
			this.SendPropertyChanging();
			entity.FinancieraGrupo = null;
		}
コード例 #3
0
		private void attach_FinancieraCreditos(FinancieraCredito entity)
		{
			this.SendPropertyChanging();
			entity.Usuario = this;
		}
コード例 #4
0
 partial void DeleteFinancieraCredito(FinancieraCredito instance);
コード例 #5
0
 partial void UpdateFinancieraCredito(FinancieraCredito instance);
コード例 #6
0
 partial void InsertFinancieraCredito(FinancieraCredito instance);
コード例 #7
0
        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"));
        }
コード例 #8
0
        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");
            }
        }