private void CargarDetalle(Int32 CodPrestamo)
        {
            Clases.cDetallePrestamo detalle = new Clases.cDetallePrestamo();
            DataTable trdo = detalle.GetDetallePrestamo(CodPrestamo);

            Clases.cFunciones fun = new Clases.cFunciones();
            trdo = fun.TablaaMiles(trdo, "Importe");
            GrillaDetallePrestamo.DataSource = trdo;
        }
        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());
        }
Beispiel #3
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       = "";
        }