Exemple #1
0
        public decimal GetBalancePendiente()
        {
            decimal value = 0;
            try
            {
                DB = new Conexion();
                if (!Amortizar)
                {
                    decimal BalancePago = decimal.Parse(
                        DB.GetData("select sum(monto) as 'Pago' from cuotas where id_prestamo = " +
                        idprestamo.ToString()).Rows[0][0].ToString() == "" ? "0" :
                        DB.GetData("select cast(sum(monto) as decimal(18,2)) as 'Pago' from cuotas where id_prestamo = " +
                        idprestamo.ToString()).Rows[0][0].ToString());

                    decimal _taza = decimal.Parse(DB.GetData("Select porcentaje from taza where id_taza = " +
                                    Taza.ToString()).Rows[0][0].ToString());

                    value = ((Monto) - BalancePago);
                }
                else
                {

                    DB = new Conexion();

                    var _CuotasPagadas = Convert.ToDecimal(DB.GetData("Select count(*) from cuotas where id_prestamo = " +
                        idprestamo.ToString()).Rows[0][0].ToString()) == 0 ? 0 : Convert.ToDecimal(DB.GetData("Select count(*) from cuotas where id_prestamo = " +
                        idprestamo.ToString()).Rows[0][0].ToString());

                    if (_CuotasPagadas == 0)
                    {
                        value = Monto;
                    }
                    else
                    {
                        value = ((Monto - ((Monto / Cuotas) * _CuotasPagadas)) * GetInteresPrestamo()) +
                          ((Monto - ((Monto / Cuotas) * _CuotasPagadas)));
                    }
                }

                return value;

            }
            catch (Exception)
            {

            }

            return this.monto;
        }
Exemple #2
0
        public decimal GetInteresPrestamo()
        {
            try
            {
                DB = new Conexion();

                decimal _taza = decimal.Parse(DB.GetData("Select porcentaje from taza where id_taza = " +
                               Taza.ToString()).Rows[0][0].ToString());
                return _taza;
            }
            catch (Exception)
            {
                return 0;
            }
        }