private void btnRegistrarPago_Click(object sender, EventArgs e)
        {
            Clases.cFunciones fun = new Clases.cFunciones();
            if (Grilla.CurrentRow == null)
            {
                MessageBox.Show("Debe seleccionar un registro para continuar", Clases.cMensaje.Mensaje());
                return;
            }

            if (fun.ValidarFecha(txtFechaDevolucion.Text) == false)
            {
                MessageBox.Show("La fecha de devolución es incorrecta", Clases.cMensaje.Mensaje());
                return;
            }

            if (Grilla.CurrentRow.Cells[8].Value.ToString() != "")
            {
                MessageBox.Show("Ya se ha registrado el pago del préstamo", Clases.cMensaje.Mensaje());
                return;
            }


            Int32    CodPrestamo = Convert.ToInt32(Grilla.CurrentRow.Cells[0].Value);
            DateTime FechaPago   = Convert.ToDateTime(txtFechaDevolucion.Text);
            string   Nombre      = Grilla.CurrentRow.Cells[1].Value.ToString();
            string   Descripcion = "PAGO PRESTAMO " + Nombre.ToString();
            double   Importe     = fun.ToDouble(Grilla.CurrentRow.Cells[6].Value.ToString());

            Clases.cPrestamo prestamo = new Clases.cPrestamo();
            prestamo.RegistrarDevolucion(CodPrestamo, FechaPago);
            Clases.cMovimiento mov = new Clases.cMovimiento();
            mov.RegistrarMovimientoDescripcion(-1, Principal.CodUsuarioLogueado, -1 * Importe, 0, 0, 0, 0, FechaPago, Descripcion);
            MessageBox.Show("Datos registrados correctametne", Clases.cMensaje.Mensaje());
            CargarGrilla();
        }
        private void btnModificar_Click(object sender, EventArgs e)
        {
            Clases.cFunciones fun = new Clases.cFunciones();
            if (txtMontoModificar.Text == "")
            {
                MessageBox.Show("Debe ingresar un monto para continuar ", Clases.cMensaje.Mensaje());
                return;
            }

            Int32    CodPrestamo        = Convert.ToInt32(Principal.CodigoPrincipalAbm);
            DateTime Fecha              = Convert.ToDateTime(txtFechaPago.Text);
            double   Importe            = fun.ToDouble(txtMontoModificar.Text);
            string   DescripcionDetalle = "INGRESO PRESTAMO " + Importe.ToString().Replace(",", ".");
            double   MontoAnterio       = fun.ToDouble(txtImporte.Text);
            double   MontoModificar     = fun.ToDouble(txtMontoModificar.Text);

            if (CmbOpciones.SelectedIndex == 0)
            {
                DescripcionDetalle = "AGREGAR CAPITAL " + Importe.ToString();
            }
            else
            {
                MontoModificar     = -1 * MontoModificar;
                DescripcionDetalle = "DESCUENTO DE CAPITAL " + Importe.ToString();
            }
            txtImporte.Text = (fun.ToDouble(txtImporte.Text) + fun.ToDouble(MontoModificar.ToString())).ToString();
            txtImporte.Text = fun.FormatoEnteroMiles(txtImporte.Text);
            CalcularPorcentaje();

            Clases.cDetallePrestamo detalle = new Clases.cDetallePrestamo();
            detalle.InsertarDetallePrestamo(CodPrestamo, Importe, DescripcionDetalle, Fecha);
            //cargo el nuevo porcentaje
            double   Por              = Convert.ToDouble(txtPorcentaje.Text.Replace(".", ","));
            double   MontoFinal       = fun.ToDouble(txtImporte.Text);
            double   ImporteaPagar    = fun.ToDouble(txtMontoApagar.Text);
            DateTime FechaVencimiento = Convert.ToDateTime(txtFechaVencimiento.Text);

            Clases.cPrestamo prestamo = new Clases.cPrestamo();
            prestamo.ModificarPorcentajePrestamo(CodPrestamo, Por, ImporteaPagar, Fecha, MontoFinal);
            CargarDetalle(CodPrestamo);
            string DescripcionMovimiento = "";

            if (MontoModificar > 0)
            {
                DescripcionMovimiento = " INGRESO PRESTAMO " + txtNombre.Text;
            }
            else
            {
                DescripcionMovimiento = " RETIRO PRESTAMO " + txtNombre.Text;
            }
            Clases.cMovimiento mov = new Clases.cMovimiento();
            mov.RegistrarMovimientoDescripcion(-1, Principal.CodUsuarioLogueado, MontoModificar, 0, 0, 0, 0, Fecha, DescripcionMovimiento);
            MessageBox.Show("Datos grabados correctamente", Clases.cMensaje.Mensaje());
        }
        private void CargarGrilla()
        {
            Clases.cFunciones fun = new Clases.cFunciones();
            if (fun.ValidarFecha(txtFechaDesde.Text) == false)
            {
                MessageBox.Show("Fecha desde incorrecta", Clases.cMensaje.Mensaje());
                return;
            }

            if (fun.ValidarFecha(txtFechaHasta.Text) == false)
            {
                MessageBox.Show("Fecha hasta incorrecta", Clases.cMensaje.Mensaje());
                return;
            }

            if (Convert.ToDateTime(txtFechaDesde.Text) > Convert.ToDateTime(txtFechaHasta.Text))
            {
                MessageBox.Show("La fecha desde debe ser inferior a la fecha hasta", Clases.cMensaje.Mensaje());
                return;
            }

            int soloImpago = 0;

            if (chkImpagos.Checked)
            {
                soloImpago = 1;
            }
            string Nombre = txtNombre.Text;

            Clases.cPrestamo prestamo   = new Clases.cPrestamo();
            DateTime         FechaDesde = Convert.ToDateTime(txtFechaDesde.Text);
            DateTime         FechaHasta = Convert.ToDateTime(txtFechaHasta.Text);
            DataTable        tb         = prestamo.GetPrestamosxFecha(FechaDesde, FechaHasta, Nombre, soloImpago);

            tb            = fun.TablaaMiles(tb, "Importe");
            tb            = fun.TablaaMiles(tb, "ImporteaPagar");
            txtTotal.Text = fun.TotalizarColumna(tb, "Importe").ToString();
            if (txtTotal.Text != "")
            {
                txtTotal.Text = fun.SepararDecimales(txtTotal.Text);
                txtTotal.Text = fun.FormatoEnteroMiles(txtTotal.Text);
            }
            Grilla.DataSource            = tb;
            Grilla.Columns[1].Width      = 290;
            Grilla.Columns[2].Width      = 170;
            Grilla.Columns[5].HeaderText = "Fecha";
            Grilla.Columns[5].Width      = 100;
            Grilla.Columns[7].HeaderText = "Importe a pagar";
            Grilla.Columns[7].Width      = 140;
            Grilla.Columns[8].HeaderText = "Fecha Pago";
            Grilla.Columns[8].Width      = 130;
            Grilla.Columns[0].Visible    = false;
            Grilla.Columns[4].Visible    = false;
        }
Example #4
0
        private void GetDeudasxPrestamo()
        {
            Clases.cFunciones fun      = new Clases.cFunciones();
            Clases.cPrestamo  prestamo = new Clases.cPrestamo();
            double            Importe  = prestamo.GetTotalDeudaPrestamo();

            txtDeudaxPrestamo.Text = Importe.ToString();
            if (Importe > 0)
            {
                txtDeudaxPrestamo.Text = fun.SepararDecimales(txtDeudaxPrestamo.Text);
                txtDeudaxPrestamo.Text = fun.FormatoEnteroMiles(txtDeudaxPrestamo.Text);
            }
        }
        private void VerificarPagoInteres(Int32 CodPrestamo)
        {
            Clases.cPrestamo prestamo = new Clases.cPrestamo();
            DataTable        trdo     = prestamo.GetPrestamoxCodigo(CodPrestamo);

            if (trdo.Rows.Count > 0)
            {
                if (trdo.Rows[0]["FechaPago"].ToString() != "")
                {
                    btnGrabar.Enabled   = false;
                    btnEliminar.Enabled = false;
                }
            }
        }
        public void GetDatosxPrestamo(Int32 CodPrestamo)
        {
            VerificarPagoInteres(CodPrestamo);
            Clases.cFunciones fun      = new Clases.cFunciones();
            Clases.cPrestamo  prestamo = new Clases.cPrestamo();
            DataTable         trdo     = prestamo.GetPrestamoxCodigo(CodPrestamo);

            if (trdo.Rows.Count > 0)
            {
                txtNombre.Text           = trdo.Rows[0]["Nombre"].ToString();
                txtDireccion.Text        = trdo.Rows[0]["Direccion"].ToString();
                txtFecha.Text            = trdo.Rows[0]["Fecha"].ToString();
                txtPorcentaje.Text       = trdo.Rows[0]["PorcentajeInteres"].ToString();
                txtTelefono.Text         = trdo.Rows[0]["Telefono"].ToString();
                txtFechaVencimiento.Text = trdo.Rows[0]["FechaVencimiento"].ToString();
                txtMontoApagar.Text      = trdo.Rows[0]["ImporteaPagar"].ToString();
                txtImporte.Text          = trdo.Rows[0]["Importe"].ToString();
                if (txtMontoApagar.Text != "")
                {
                    txtMontoApagar.Text = fun.ParteEntera(txtMontoApagar.Text);
                }
                if (txtMontoApagar.Text != "")
                {
                    txtMontoApagar.Text = fun.FormatoEnteroMiles(txtMontoApagar.Text);
                }

                if (txtImporte.Text != "")
                {
                    txtImporte.Text = fun.ParteEntera(txtImporte.Text);
                }
                if (txtImporte.Text != "")
                {
                    txtImporte.Text = fun.FormatoEnteroMiles(txtImporte.Text);
                }
            }
            CargarGrilla(CodPrestamo);
            CargarDetalle(CodPrestamo);
        }
Example #7
0
        private void btnGrabar_Click(object sender, EventArgs e)
        {
            Clases.cFunciones fun = new Clases.cFunciones();
            if (txtNombre.Text == "")
            {
                MessageBox.Show("Debe ingresar un nombre para continuar", Clases.cMensaje.Mensaje());
                return;
            }

            if (txtTelefono.Text == "")
            {
                MessageBox.Show("Debe ingresar un teléfono para continuar", Clases.cMensaje.Mensaje());
                return;
            }

            if (txtImporte.Text == "")
            {
                MessageBox.Show("Debe ingresar un Importe para continuar", Clases.cMensaje.Mensaje());
                return;
            }

            if (fun.ValidarFecha(txtFecha.Text) == false)
            {
                MessageBox.Show("Debe ingresar una fecha válida para continuar", Clases.cMensaje.Mensaje());
                return;
            }

            if (fun.ValidarFecha(txtFechaVencimiento.Text) == false)
            {
                MessageBox.Show("Debe ingresar una fecha de vencimiento válidad para continuar", Clases.cMensaje.Mensaje());
                return;
            }


            if (txtPorcentaje.Text == "")
            {
                MessageBox.Show("Debe ingresar un Porcentaje para continuar", Clases.cMensaje.Mensaje());
                return;
            }
            // Clases.cFunciones fun = new Clases.cFunciones();
            string   Nombre            = txtNombre.Text;
            string   Telefono          = txtTelefono.Text;
            string   Dirección         = txtDireccion.Text;
            DateTime Fecha             = Convert.ToDateTime(txtFecha.Text);
            double   Importe           = fun.ToDouble(txtImporte.Text);
            double   PorcentajeInteres = Convert.ToDouble(txtPorcentaje.Text);
            DateTime FechaVencimiento  = Convert.ToDateTime(txtFechaVencimiento.Text);
            double   ImporteaPagar     = fun.ToDouble(txtMontoApagar.Text);

            Clases.cPrestamo prestamo = new Clases.cPrestamo();
            prestamo.InsertarPrestamo(Nombre, Telefono, Dirección, Fecha, Importe, PorcentajeInteres, FechaVencimiento, ImporteaPagar);
            Int32  CodPrestamo        = prestamo.GetMaxPrestamo();
            string Descripcion        = "INGRESO PRESTAMO " + txtNombre.Text.ToUpper();
            string DescripcionDetalle = "INGRESO PRESTAMO " + Importe.ToString().Replace(",", ".");

            Clases.cDetallePrestamo detalle = new Clases.cDetallePrestamo();
            detalle.InsertarDetallePrestamo(CodPrestamo, Importe, DescripcionDetalle, Fecha);
            Clases.cMovimiento mov = new Clases.cMovimiento();
            mov.RegistrarMovimientoDescripcion(-1, Principal.CodUsuarioLogueado, Importe, 0, 0, 0, 0, Fecha, Descripcion);
            MessageBox.Show("Datos grabados correctamente", Clases.cMensaje.Mensaje());
            txtNombre.Text           = "";
            txtDireccion.Text        = "";
            txtTelefono.Text         = "";
            txtMontoApagar.Text      = "";
            txtImporte.Text          = "";
            txtFecha.Text            = "";
            txtFechaVencimiento.Text = "";
            txtPorcentaje.Text       = "";
        }