Ejemplo n.º 1
0
 private void cboTipoSaldo_SelectedValueChanged(object sender, EventArgs e)
 {
     try
     {
         btnGrabar.Enabled  = false;
         lblMontoCuota.Text = "0.00";
         DTDetalle.Clear();
     }
     catch (Exception ex)
     {
         objUtil.MostrarMensajeError(ex.Message);
     }
 }
Ejemplo n.º 2
0
        private void txtTasa_TextChanged(object sender, EventArgs e)
        {
            double  tasa = 0, plazo = 0;
            DataRow fila0 = null;

            try
            {
                if (DSDatos == null)
                {
                    return;
                }
                if (DSDatos.Tables.Count <= 0)
                {
                    return;
                }

                fila0 = DSDatos.Tables[0].Rows[0];
                plazo = objDB.GetAsDouble("Plazo", fila0);
                tasa  = objDB.GetAsDouble("Tasa_Interes", fila0);

                if (plazo != objUtil.ConvertirANumero(txtPlazo.Text) || tasa != objUtil.ConvertirANumero(txtTasa.Text))
                {
                    SetValorEncabezado("Plazo", plazo);
                    SetValorEncabezado("Tasa_Interes", tasa);

                    //Deshabilitamos el boton guardar para obligar a volver a generar
                    btnGrabar.Enabled = false;
                    //btnGenerar.Enabled = true;
                    DTDetalle.Clear();
                }
            }
            catch (Exception ex)
            {
                objUtil.MostrarMensajeError(ex.Message);
            }
        }
Ejemplo n.º 3
0
        void CalcularMontoPrestamo()
        {
            double monto = 0, costoLeg = 0, residuo;
            double montoAprobado = 0;
            int    opcionLegal   = 0;

            try
            {
                monto         = objUtil.ConvertirANumero(txtMonto.Text);
                montoAprobado = objUtil.ConvertirANumero(txtMonto.Text);
                if (cboOpcionLegal.Text.Trim() != "")
                {
                    if (facturaNo <= 0)
                    {
                        opcionLegal = cboOpcionLegal.SelectedIndex;
                    }
                }

                if (sysMontoLeg > 0)
                {
                    costoLeg = sysMontoLeg;
                }
                else
                {
                    costoLeg = (monto * sysPorcLeg) / 100.0;
                }

                //REDONDEAMOS EL COSTO DE LA LEGALIZACION
                if (esRedondear)
                {
                    costoLeg = Math.Ceiling(costoLeg);
                    residuo  = costoLeg % 100;
                    if (residuo < 50 && residuo != 0)
                    {
                        costoLeg += (50 - residuo);
                    }
                    else if (residuo < 100 && residuo != 0)
                    {
                        costoLeg += (100 - residuo);
                    }
                }

                if (opcionLegal == 0)
                {
                    monto += costoLeg;
                }
                lblCostoLegal.Text    = costoLeg.ToString("N2");
                lblMontoPrestamo.Text = monto.ToString("N2");
                lblMontoCuota.Text    = "0.00";
                btnGrabar.Enabled     = false;
                DTDetalle.Clear();
                //btnGenerar.Enabled = true;

                SetValorEncabezado("Monto_Aprobado", montoAprobado);
                SetValorEncabezado("Monto_Prestamo", monto);
                SetValorEncabezado("Costo_Legalizacion", costoLeg);
                SetValorEncabezado("Opcion_Legal", opcionLegal);
                if (opcionLegal <= 0)
                {
                    SetValorEncabezado("Descontar_Legalizacion", false);
                }
                else
                {
                    SetValorEncabezado("Descontar_Legalizacion", true);
                }
            }
            catch (Exception)
            {
                throw;
            }
        }