904 lines
39 KiB
C#
904 lines
39 KiB
C#
using System;
|
|
using System.ComponentModel;
|
|
using System.Linq;
|
|
using System.Linq.Dynamic.Core;
|
|
using System.Runtime.CompilerServices;
|
|
using Microsoft.VisualBasic.CompilerServices;
|
|
using tsUtilidades.Extensiones;
|
|
|
|
namespace bdGrupoSanchoToro.db
|
|
{
|
|
public partial class vf_cuentas
|
|
{
|
|
public static List<vf_cuentas> Obtiene_vf_cuentas(tscGrupoSanchoToro bd, int idEjercicio, int Nivel)
|
|
{
|
|
try
|
|
{
|
|
List<vf_cuentas> lc;
|
|
var ctasintermedias = bd.cuentas.Where(x => x.EsCuentaFinal == false & x.idEjercicio == idEjercicio & x.NumeroCuenta.Length <= Nivel).ToList();
|
|
var ctasf = bd.vf_cuentas.Where(x => x.idEjercicio == idEjercicio).ToList();
|
|
if (Nivel == 8)
|
|
lc = ctasf;
|
|
else
|
|
{
|
|
lc = new List<vf_cuentas>();
|
|
foreach (var cta in ctasintermedias.Where(x => x.Nivel == Nivel))
|
|
{
|
|
var sumatorio = ctasf.Where(x => x.NumeroCuenta.StartsWith(cta.NumeroCuenta));
|
|
vf_cuentas nc = new vf_cuentas();
|
|
{
|
|
var withBlock = nc;
|
|
withBlock.idCuenta = cta.idCuenta;
|
|
withBlock.idEjercicio = cta.idEjercicio;
|
|
withBlock.Mote = cta.Mote;
|
|
withBlock.Denominacion = cta.Denominacion;
|
|
withBlock.idEmpresaAmortizacion = cta.idEmpresaAmortizacion;
|
|
withBlock.NumeroCuenta = cta.NumeroCuenta;
|
|
withBlock.Observaciones = cta.Observaciones;
|
|
withBlock.PresupuestoEnero = Math.Round(sumatorio.Sum(x => x.PresupuestoEnero), 2, MidpointRounding.AwayFromZero);
|
|
withBlock.PresupuestoFebrero = Math.Round(sumatorio.Sum(x => x.PresupuestoEnero), 2, MidpointRounding.AwayFromZero);
|
|
withBlock.PresupuestoMarzo = Math.Round(sumatorio.Sum(x => x.PresupuestoMarzo), 2, MidpointRounding.AwayFromZero);
|
|
withBlock.PresupuestoAbril = Math.Round(sumatorio.Sum(x => x.PresupuestoAbril), 2, MidpointRounding.AwayFromZero);
|
|
withBlock.PresupuestoMayo = Math.Round(sumatorio.Sum(x => x.PresupuestoMayo), 2, MidpointRounding.AwayFromZero);
|
|
withBlock.PresupuestoJunio = Math.Round(sumatorio.Sum(x => x.PresupuestoJunio), 2, MidpointRounding.AwayFromZero);
|
|
withBlock.PresupuestoJulio = Math.Round(sumatorio.Sum(x => x.PresupuestoJulio), 2, MidpointRounding.AwayFromZero);
|
|
withBlock.PresupuestoAgosto = Math.Round(sumatorio.Sum(x => x.PresupuestoAgosto), 2, MidpointRounding.AwayFromZero);
|
|
withBlock.PresupuestoSeptiembre = Math.Round(sumatorio.Sum(x => x.PresupuestoSeptiembre), 2, MidpointRounding.AwayFromZero);
|
|
withBlock.PresupuestoOctubre = Math.Round(sumatorio.Sum(x => x.PresupuestoOctubre), 2, MidpointRounding.AwayFromZero);
|
|
withBlock.PresupuestoNoviembre = Math.Round(sumatorio.Sum(x => x.PresupuestoNoviembre), 2, MidpointRounding.AwayFromZero);
|
|
withBlock.PresupuestoDiciembre = Math.Round(sumatorio.Sum(x => x.PresupuestoDiciembre), 2, MidpointRounding.AwayFromZero);
|
|
|
|
withBlock.DebeEnero = Math.Round(sumatorio.Sum(x => x.DebeEnero.NothingA0()), 2, MidpointRounding.AwayFromZero);
|
|
withBlock.DebeFebrero = Math.Round(sumatorio.Sum(x => x.DebeEnero.NothingA0()), 2, MidpointRounding.AwayFromZero);
|
|
withBlock.DebeMarzo = Math.Round(sumatorio.Sum(x => x.DebeMarzo.NothingA0()), 2, MidpointRounding.AwayFromZero);
|
|
withBlock.DebeAbril = Math.Round(sumatorio.Sum(x => x.DebeAbril.NothingA0()), 2, MidpointRounding.AwayFromZero);
|
|
withBlock.DebeMayo = Math.Round(sumatorio.Sum(x => x.DebeMayo.NothingA0()), 2, MidpointRounding.AwayFromZero);
|
|
withBlock.DebeJunio = Math.Round(sumatorio.Sum(x => x.DebeJunio.NothingA0()), 2, MidpointRounding.AwayFromZero);
|
|
withBlock.DebeJulio = Math.Round(sumatorio.Sum(x => x.DebeJulio.NothingA0()), 2, MidpointRounding.AwayFromZero);
|
|
withBlock.DebeAgosto = Math.Round(sumatorio.Sum(x => x.DebeAgosto.NothingA0()), 2, MidpointRounding.AwayFromZero);
|
|
withBlock.DebeSeptiembre = Math.Round(sumatorio.Sum(x => x.DebeSeptiembre.NothingA0()), 2, MidpointRounding.AwayFromZero);
|
|
withBlock.DebeOctubre = Math.Round(sumatorio.Sum(x => x.DebeOctubre.NothingA0()), 2, MidpointRounding.AwayFromZero);
|
|
withBlock.DebeNoviembre = Math.Round(sumatorio.Sum(x => x.DebeNoviembre.NothingA0()), 2, MidpointRounding.AwayFromZero);
|
|
withBlock.DebeDiciembre = Math.Round(sumatorio.Sum(x => x.DebeDiciembre.NothingA0()), 2, MidpointRounding.AwayFromZero);
|
|
|
|
withBlock.HaberEnero = Math.Round(sumatorio.Sum(x => x.HaberEnero.NothingA0()), 2, MidpointRounding.AwayFromZero);
|
|
withBlock.HaberFebrero = Math.Round(sumatorio.Sum(x => x.HaberEnero.NothingA0()), 2, MidpointRounding.AwayFromZero);
|
|
withBlock.HaberMarzo = Math.Round(sumatorio.Sum(x => x.HaberMarzo.NothingA0()), 2, MidpointRounding.AwayFromZero);
|
|
withBlock.HaberAbril = Math.Round(sumatorio.Sum(x => x.HaberAbril.NothingA0()), 2, MidpointRounding.AwayFromZero);
|
|
withBlock.HaberMayo = Math.Round(sumatorio.Sum(x => x.HaberMayo.NothingA0()), 2, MidpointRounding.AwayFromZero);
|
|
withBlock.HaberJunio = Math.Round(sumatorio.Sum(x => x.HaberJunio.NothingA0()), 2, MidpointRounding.AwayFromZero);
|
|
withBlock.HaberJulio = Math.Round(sumatorio.Sum(x => x.HaberJulio.NothingA0()), 2, MidpointRounding.AwayFromZero);
|
|
withBlock.HaberAgosto = Math.Round(sumatorio.Sum(x => x.HaberAgosto.NothingA0()), 2, MidpointRounding.AwayFromZero);
|
|
withBlock.HaberSeptiembre = Math.Round(sumatorio.Sum(x => x.HaberSeptiembre.NothingA0()), 2, MidpointRounding.AwayFromZero);
|
|
withBlock.HaberOctubre = Math.Round(sumatorio.Sum(x => x.HaberOctubre.NothingA0()), 2, MidpointRounding.AwayFromZero);
|
|
withBlock.HaberNoviembre = Math.Round(sumatorio.Sum(x => x.HaberNoviembre.NothingA0()), 2, MidpointRounding.AwayFromZero);
|
|
withBlock.HaberDiciembre = Math.Round(sumatorio.Sum(x => x.HaberDiciembre.NothingA0()), 2, MidpointRounding.AwayFromZero);
|
|
|
|
withBlock.TotalDebe = Math.Round(sumatorio.Sum(x => x.TotalDebe), 2, MidpointRounding.AwayFromZero);
|
|
withBlock.TotalHaber = Math.Round(sumatorio.Sum(x => x.TotalHaber), 2, MidpointRounding.AwayFromZero);
|
|
lc.Add(nc);
|
|
}
|
|
}
|
|
}
|
|
foreach (var cta in lc)
|
|
{
|
|
try
|
|
{
|
|
var cta1 = ctasintermedias.First(x => x.NumeroCuenta == cta.NumeroCuenta.Substring(0, 1));
|
|
cta.Grupo1 = cta1.NumeroCuenta + " " + cta1.Denominacion;
|
|
if (cta.Nivel > 1)
|
|
{
|
|
var cta2 = ctasintermedias.First(x => x.NumeroCuenta == cta.NumeroCuenta.Substring(0, 2));
|
|
cta.Grupo2 = cta2.NumeroCuenta + " " + cta2.Denominacion;
|
|
if (cta.Nivel > 2)
|
|
{
|
|
var cta3 = ctasintermedias.First(x => x.NumeroCuenta == cta.NumeroCuenta.Substring(0, 3));
|
|
cta.Grupo3 = cta3.NumeroCuenta + " " + cta3.Denominacion;
|
|
if (cta.Nivel > 3)
|
|
{
|
|
var cta4 = ctasintermedias.First(x => x.NumeroCuenta == cta.NumeroCuenta.Substring(0, 4));
|
|
cta.Grupo4 = cta4.NumeroCuenta + " " + cta4.Denominacion;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
throw new Exception("Error obteniendo cuentas intermedia de la cuenta " + cta.NumeroCuenta + " " + ex.Message, ex);
|
|
}
|
|
}
|
|
return lc;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
throw new Exception(ex.Message, ex);
|
|
}
|
|
}
|
|
public static List<vf_cuentas> Obtiene_vf_cuentas(tscGrupoSanchoToro bd, int[] Ejercicios, int Nivel, string ExpresionBusqueda)
|
|
{
|
|
try
|
|
{
|
|
List<vf_cuentas> lc;
|
|
IQueryable<cuentas> qCtasIntermedias = bd.cuentas.Where(x => x.EsCuentaFinal == false & Ejercicios.Contains(x.idEjercicio) & x.NumeroCuenta.Length <= Nivel);
|
|
object[] parametros = new object[1];
|
|
IQueryable<vf_cuentas> qcastf;
|
|
if (ExpresionBusqueda == "")
|
|
qcastf = bd.vf_cuentas.AsQueryable();
|
|
else
|
|
{
|
|
qcastf = bd.vf_cuentas.Where(ExpresionBusqueda, parametros);
|
|
if (Nivel < 8)
|
|
{
|
|
ExpresionBusqueda = "NumeroCuenta.Length<" + Nivel.ToString() + " or (" + ExpresionBusqueda + ")";
|
|
qCtasIntermedias = qCtasIntermedias.Where(ExpresionBusqueda, parametros);
|
|
}
|
|
}
|
|
var ctasintermedias = qCtasIntermedias.ToList();
|
|
// Dim KK = qcastf.ToList
|
|
var ctasf = qcastf.Where(x => Ejercicios.Contains(x.idEjercicio)).ToList();
|
|
if (Nivel == 8)
|
|
lc = ctasf;
|
|
else
|
|
{
|
|
lc = new List<vf_cuentas>();
|
|
foreach (var cta in ctasintermedias.Where(x => x.Nivel == Nivel))
|
|
{
|
|
var sumatorio = ctasf.Where(x => x.idEjercicio == cta.idEjercicio & x.NumeroCuenta.StartsWith(cta.NumeroCuenta));
|
|
vf_cuentas nc = new vf_cuentas();
|
|
{
|
|
var withBlock = nc;
|
|
withBlock.idCuenta = cta.idCuenta;
|
|
withBlock.idEjercicio = cta.idEjercicio;
|
|
withBlock.Mote = cta.Mote;
|
|
withBlock.Denominacion = cta.Denominacion;
|
|
withBlock.idEmpresaAmortizacion = cta.idEmpresaAmortizacion;
|
|
withBlock.NumeroCuenta = cta.NumeroCuenta;
|
|
withBlock.Observaciones = cta.Observaciones;
|
|
withBlock.PresupuestoEnero = Math.Round(sumatorio.Sum(x => x.PresupuestoEnero), 2, MidpointRounding.AwayFromZero);
|
|
withBlock.PresupuestoFebrero = Math.Round(sumatorio.Sum(x => x.PresupuestoEnero), 2, MidpointRounding.AwayFromZero);
|
|
withBlock.PresupuestoMarzo = Math.Round(sumatorio.Sum(x => x.PresupuestoMarzo), 2, MidpointRounding.AwayFromZero);
|
|
withBlock.PresupuestoAbril = Math.Round(sumatorio.Sum(x => x.PresupuestoAbril), 2, MidpointRounding.AwayFromZero);
|
|
withBlock.PresupuestoMayo = Math.Round(sumatorio.Sum(x => x.PresupuestoMayo), 2, MidpointRounding.AwayFromZero);
|
|
withBlock.PresupuestoJunio = Math.Round(sumatorio.Sum(x => x.PresupuestoJunio), 2, MidpointRounding.AwayFromZero);
|
|
withBlock.PresupuestoJulio = Math.Round(sumatorio.Sum(x => x.PresupuestoJulio), 2, MidpointRounding.AwayFromZero);
|
|
withBlock.PresupuestoAgosto = Math.Round(sumatorio.Sum(x => x.PresupuestoAgosto), 2, MidpointRounding.AwayFromZero);
|
|
withBlock.PresupuestoSeptiembre = Math.Round(sumatorio.Sum(x => x.PresupuestoSeptiembre), 2, MidpointRounding.AwayFromZero);
|
|
withBlock.PresupuestoOctubre = Math.Round(sumatorio.Sum(x => x.PresupuestoOctubre), 2, MidpointRounding.AwayFromZero);
|
|
withBlock.PresupuestoNoviembre = Math.Round(sumatorio.Sum(x => x.PresupuestoNoviembre), 2, MidpointRounding.AwayFromZero);
|
|
withBlock.PresupuestoDiciembre = Math.Round(sumatorio.Sum(x => x.PresupuestoDiciembre), 2, MidpointRounding.AwayFromZero);
|
|
|
|
withBlock.DebeEnero = Math.Round(sumatorio.Sum(x => x.DebeEnero.NothingA0()), 2, MidpointRounding.AwayFromZero);
|
|
withBlock.DebeFebrero = Math.Round(sumatorio.Sum(x => x.DebeEnero.NothingA0()), 2, MidpointRounding.AwayFromZero);
|
|
withBlock.DebeMarzo = Math.Round(sumatorio.Sum(x => x.DebeMarzo.NothingA0()), 2, MidpointRounding.AwayFromZero);
|
|
withBlock.DebeAbril = Math.Round(sumatorio.Sum(x => x.DebeAbril.NothingA0()), 2, MidpointRounding.AwayFromZero);
|
|
withBlock.DebeMayo = Math.Round(sumatorio.Sum(x => x.DebeMayo.NothingA0()), 2, MidpointRounding.AwayFromZero);
|
|
withBlock.DebeJunio = Math.Round(sumatorio.Sum(x => x.DebeJunio.NothingA0()), 2, MidpointRounding.AwayFromZero);
|
|
withBlock.DebeJulio = Math.Round(sumatorio.Sum(x => x.DebeJulio.NothingA0()), 2, MidpointRounding.AwayFromZero);
|
|
withBlock.DebeAgosto = Math.Round(sumatorio.Sum(x => x.DebeAgosto.NothingA0()), 2, MidpointRounding.AwayFromZero);
|
|
withBlock.DebeSeptiembre = Math.Round(sumatorio.Sum(x => x.DebeSeptiembre.NothingA0()), 2, MidpointRounding.AwayFromZero);
|
|
withBlock.DebeOctubre = Math.Round(sumatorio.Sum(x => x.DebeOctubre.NothingA0()), 2, MidpointRounding.AwayFromZero);
|
|
withBlock.DebeNoviembre = Math.Round(sumatorio.Sum(x => x.DebeNoviembre.NothingA0()), 2, MidpointRounding.AwayFromZero);
|
|
withBlock.DebeDiciembre = Math.Round(sumatorio.Sum(x => x.DebeDiciembre.NothingA0()), 2, MidpointRounding.AwayFromZero);
|
|
|
|
withBlock.HaberEnero = Math.Round(sumatorio.Sum(x => x.HaberEnero.NothingA0()), 2, MidpointRounding.AwayFromZero);
|
|
withBlock.HaberFebrero = Math.Round(sumatorio.Sum(x => x.HaberEnero.NothingA0()), 2, MidpointRounding.AwayFromZero);
|
|
withBlock.HaberMarzo = Math.Round(sumatorio.Sum(x => x.HaberMarzo.NothingA0()), 2, MidpointRounding.AwayFromZero);
|
|
withBlock.HaberAbril = Math.Round(sumatorio.Sum(x => x.HaberAbril.NothingA0()), 2, MidpointRounding.AwayFromZero);
|
|
withBlock.HaberMayo = Math.Round(sumatorio.Sum(x => x.HaberMayo.NothingA0()), 2, MidpointRounding.AwayFromZero);
|
|
withBlock.HaberJunio = Math.Round(sumatorio.Sum(x => x.HaberJunio.NothingA0()), 2, MidpointRounding.AwayFromZero);
|
|
withBlock.HaberJulio = Math.Round(sumatorio.Sum(x => x.HaberJulio.NothingA0()), 2, MidpointRounding.AwayFromZero);
|
|
withBlock.HaberAgosto = Math.Round(sumatorio.Sum(x => x.HaberAgosto.NothingA0()), 2, MidpointRounding.AwayFromZero);
|
|
withBlock.HaberSeptiembre = Math.Round(sumatorio.Sum(x => x.HaberSeptiembre.NothingA0()), 2, MidpointRounding.AwayFromZero);
|
|
withBlock.HaberOctubre = Math.Round(sumatorio.Sum(x => x.HaberOctubre.NothingA0()), 2, MidpointRounding.AwayFromZero);
|
|
withBlock.HaberNoviembre = Math.Round(sumatorio.Sum(x => x.HaberNoviembre.NothingA0()), 2, MidpointRounding.AwayFromZero);
|
|
withBlock.HaberDiciembre = Math.Round(sumatorio.Sum(x => x.HaberDiciembre.NothingA0()), 2, MidpointRounding.AwayFromZero);
|
|
|
|
withBlock.TotalDebe = Math.Round(sumatorio.Sum(x => x.TotalDebe), 2, MidpointRounding.AwayFromZero);
|
|
withBlock.TotalHaber = Math.Round(sumatorio.Sum(x => x.TotalHaber), 2, MidpointRounding.AwayFromZero);
|
|
lc.Add(nc);
|
|
}
|
|
}
|
|
}
|
|
foreach (var cta in lc)
|
|
{
|
|
try
|
|
{
|
|
var cta1 = ctasintermedias.First(x => x.NumeroCuenta == cta.NumeroCuenta.Substring(0, 1));
|
|
cta.Grupo1 = cta1.NumeroCuenta + " " + cta1.Denominacion;
|
|
if (cta.Nivel > 1)
|
|
{
|
|
var cta2 = ctasintermedias.First(x => x.NumeroCuenta == cta.NumeroCuenta.Substring(0, 2));
|
|
cta.Grupo2 = cta2.NumeroCuenta + " " + cta2.Denominacion;
|
|
if (cta.Nivel > 2)
|
|
{
|
|
var cta3 = ctasintermedias.First(x => x.NumeroCuenta == cta.NumeroCuenta.Substring(0, 3));
|
|
cta.Grupo3 = cta3.NumeroCuenta + " " + cta3.Denominacion;
|
|
if (cta.Nivel > 3)
|
|
{
|
|
var cta4 = ctasintermedias.First(x => x.NumeroCuenta == cta.NumeroCuenta.Substring(0, 4));
|
|
cta.Grupo4 = cta4.NumeroCuenta + " " + cta4.Denominacion;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
throw new Exception("Error obteniendo cuentas intermedia de la cuenta " + cta.NumeroCuenta + " " + ex.Message, ex);
|
|
}
|
|
}
|
|
return lc;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
throw new Exception(ex.Message, ex);
|
|
}
|
|
}
|
|
|
|
public string Grupo1 { get; set; }
|
|
public string Grupo2 { get; set; }
|
|
public string Grupo3 { get; set; }
|
|
public string Grupo4 { get; set; }
|
|
public int Nivel
|
|
{
|
|
get
|
|
{
|
|
return NumeroCuenta.Length;
|
|
}
|
|
}
|
|
|
|
|
|
#region "Saldos"
|
|
public double SaldoEnero
|
|
{
|
|
get
|
|
{
|
|
return Math.Round(DebeEnero.NothingA0() - HaberEnero.NothingA0(), 2, MidpointRounding.AwayFromZero);
|
|
}
|
|
}
|
|
public double SaldoFebrero
|
|
{
|
|
get
|
|
{
|
|
return Math.Round(DebeFebrero.NothingA0() - HaberFebrero.NothingA0(), 2, MidpointRounding.AwayFromZero);
|
|
}
|
|
}
|
|
public double SaldoMarzo
|
|
{
|
|
get
|
|
{
|
|
return Math.Round(DebeMarzo.NothingA0() - HaberMarzo.NothingA0(), 2, MidpointRounding.AwayFromZero);
|
|
}
|
|
}
|
|
public double SaldoAbril
|
|
{
|
|
get
|
|
{
|
|
return Math.Round(DebeAbril.NothingA0() - HaberAbril.NothingA0(), 2, MidpointRounding.AwayFromZero);
|
|
}
|
|
}
|
|
public double SaldoMayo
|
|
{
|
|
get
|
|
{
|
|
return Math.Round(DebeMayo.NothingA0() - HaberMayo.NothingA0(), 2, MidpointRounding.AwayFromZero);
|
|
}
|
|
}
|
|
public double SaldoJunio
|
|
{
|
|
get
|
|
{
|
|
return Math.Round(DebeJunio.NothingA0() - HaberJunio.NothingA0(), 2, MidpointRounding.AwayFromZero);
|
|
}
|
|
}
|
|
public double SaldoJulio
|
|
{
|
|
get
|
|
{
|
|
return Math.Round(DebeJulio.NothingA0() - HaberJulio.NothingA0(), 2, MidpointRounding.AwayFromZero);
|
|
}
|
|
}
|
|
public double SaldoAgosto
|
|
{
|
|
get
|
|
{
|
|
return Math.Round(DebeAgosto.NothingA0() - HaberAgosto.NothingA0(), 2, MidpointRounding.AwayFromZero);
|
|
}
|
|
}
|
|
public double SaldoSeptiembre
|
|
{
|
|
get
|
|
{
|
|
return Math.Round(DebeSeptiembre.NothingA0() - HaberSeptiembre.NothingA0(), 2, MidpointRounding.AwayFromZero);
|
|
}
|
|
}
|
|
public double SaldoOctubre
|
|
{
|
|
get
|
|
{
|
|
return Math.Round(DebeOctubre.NothingA0() - HaberOctubre.NothingA0(), 2, MidpointRounding.AwayFromZero);
|
|
}
|
|
}
|
|
public double SaldoNoviembre
|
|
{
|
|
get
|
|
{
|
|
return Math.Round(DebeNoviembre.NothingA0() - HaberNoviembre.NothingA0(), 2, MidpointRounding.AwayFromZero);
|
|
}
|
|
}
|
|
|
|
public double SaldoDiciembre
|
|
{
|
|
get
|
|
{
|
|
return Math.Round(DebeDiciembre.NothingA0() - HaberDiciembre.NothingA0(), 2, MidpointRounding.AwayFromZero);
|
|
}
|
|
}
|
|
public double TotalSaldo
|
|
{
|
|
get
|
|
{
|
|
return Math.Round(TotalDebe - TotalHaber, 2, MidpointRounding.AwayFromZero);
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region "Presupuestos"
|
|
public double TotalPresupuestado
|
|
{
|
|
get
|
|
{
|
|
return Math.Round(PresupuestoEnero + PresupuestoFebrero + PresupuestoMarzo + PresupuestoAbril + PresupuestoMayo + PresupuestoJunio + PresupuestoJulio + PresupuestoAgosto + PresupuestoSeptiembre + PresupuestoOctubre + PresupuestoNoviembre + PresupuestoDiciembre, 2, MidpointRounding.AwayFromZero);
|
|
}
|
|
}
|
|
public void ActualizaTotalPresupuestado()
|
|
{
|
|
OnPropertyChanged("TotalPresupuestado");
|
|
}
|
|
|
|
public double DesvioPresupuestoEnero
|
|
{
|
|
get
|
|
{
|
|
if (this.NumeroCuenta != null)
|
|
{
|
|
switch (this.NumeroCuenta.Substring(0, 1))
|
|
{
|
|
case "6":
|
|
case "7":
|
|
{
|
|
return Math.Round(Math.Abs(this.PresupuestoEnero) - Math.Abs(this.SaldoEnero), 2, MidpointRounding.AwayFromZero);
|
|
}
|
|
|
|
default:
|
|
{
|
|
return 0;
|
|
}
|
|
}
|
|
}
|
|
else
|
|
return 0;
|
|
}
|
|
}
|
|
public double DesvioPresupuestoFebrero
|
|
{
|
|
get
|
|
{
|
|
if (this.NumeroCuenta != null)
|
|
{
|
|
switch (this.NumeroCuenta.Substring(0, 1))
|
|
{
|
|
case "6":
|
|
case "7":
|
|
{
|
|
return Math.Round(Math.Abs(this.PresupuestoFebrero) - Math.Abs(this.SaldoFebrero), 2, MidpointRounding.AwayFromZero);
|
|
}
|
|
|
|
default:
|
|
{
|
|
return 0;
|
|
}
|
|
}
|
|
}
|
|
else
|
|
return 0;
|
|
}
|
|
}
|
|
public double DesvioPresupuestoMarzo
|
|
{
|
|
get
|
|
{
|
|
if (this.NumeroCuenta != null)
|
|
{
|
|
switch (this.NumeroCuenta.Substring(0, 1))
|
|
{
|
|
case "6":
|
|
case "7":
|
|
{
|
|
return Math.Round(Math.Abs(this.PresupuestoMarzo) - Math.Abs(this.SaldoMarzo), 2, MidpointRounding.AwayFromZero);
|
|
}
|
|
|
|
default:
|
|
{
|
|
return 0;
|
|
}
|
|
}
|
|
}
|
|
else
|
|
return 0;
|
|
}
|
|
}
|
|
public double DesvioPresupuestoAbril
|
|
{
|
|
get
|
|
{
|
|
if (this.NumeroCuenta != null)
|
|
{
|
|
switch (this.NumeroCuenta.Substring(0, 1))
|
|
{
|
|
case "6":
|
|
case "7":
|
|
{
|
|
return Math.Round(Math.Abs(this.PresupuestoAbril) - Math.Abs(this.SaldoAbril), 2, MidpointRounding.AwayFromZero);
|
|
}
|
|
|
|
default:
|
|
{
|
|
return 0;
|
|
}
|
|
}
|
|
}
|
|
else
|
|
return 0;
|
|
}
|
|
}
|
|
public double DesvioPresupuestoMayo
|
|
{
|
|
get
|
|
{
|
|
if (this.NumeroCuenta != null)
|
|
{
|
|
switch (this.NumeroCuenta.Substring(0, 1))
|
|
{
|
|
case "6":
|
|
case "7":
|
|
{
|
|
return Math.Round(Math.Abs(this.PresupuestoMayo) - Math.Abs(this.SaldoMayo), 2, MidpointRounding.AwayFromZero);
|
|
}
|
|
|
|
default:
|
|
{
|
|
return 0;
|
|
}
|
|
}
|
|
}
|
|
else
|
|
return 0;
|
|
}
|
|
}
|
|
public double DesvioPresupuestoJunio
|
|
{
|
|
get
|
|
{
|
|
if (this.NumeroCuenta != null)
|
|
{
|
|
switch (this.NumeroCuenta.Substring(0, 1))
|
|
{
|
|
case "6":
|
|
case "7":
|
|
{
|
|
return Math.Round(Math.Abs(this.PresupuestoJunio) - Math.Abs(this.SaldoJunio), 2, MidpointRounding.AwayFromZero);
|
|
}
|
|
|
|
default:
|
|
{
|
|
return 0;
|
|
}
|
|
}
|
|
}
|
|
else
|
|
return 0;
|
|
}
|
|
}
|
|
public double DesvioPresupuestoJulio
|
|
{
|
|
get
|
|
{
|
|
if (this.NumeroCuenta != null)
|
|
{
|
|
switch (this.NumeroCuenta.Substring(0, 1))
|
|
{
|
|
case "6":
|
|
case "7":
|
|
{
|
|
return Math.Round(Math.Abs(this.PresupuestoJulio) - Math.Abs(this.SaldoJulio), 2, MidpointRounding.AwayFromZero);
|
|
}
|
|
|
|
default:
|
|
{
|
|
return 0;
|
|
}
|
|
}
|
|
}
|
|
else
|
|
return 0;
|
|
}
|
|
}
|
|
public double DesvioPresupuestoAgosto
|
|
{
|
|
get
|
|
{
|
|
if (this.NumeroCuenta != null)
|
|
{
|
|
switch (this.NumeroCuenta.Substring(0, 1))
|
|
{
|
|
case "6":
|
|
case "7":
|
|
{
|
|
return Math.Round(Math.Abs(this.PresupuestoAgosto) - Math.Abs(this.SaldoAgosto), 2, MidpointRounding.AwayFromZero);
|
|
}
|
|
|
|
default:
|
|
{
|
|
return 0;
|
|
}
|
|
}
|
|
}
|
|
else
|
|
return 0;
|
|
}
|
|
}
|
|
public double DesvioPresupuestoSeptiembre
|
|
{
|
|
get
|
|
{
|
|
if (this.NumeroCuenta != null)
|
|
{
|
|
switch (this.NumeroCuenta.Substring(0, 1))
|
|
{
|
|
case "6":
|
|
case "7":
|
|
{
|
|
return Math.Round(Math.Abs(this.PresupuestoSeptiembre) - Math.Abs(this.SaldoSeptiembre), 2, MidpointRounding.AwayFromZero);
|
|
}
|
|
|
|
default:
|
|
{
|
|
return 0;
|
|
}
|
|
}
|
|
}
|
|
else
|
|
return 0;
|
|
}
|
|
}
|
|
public double DesvioPresupuestoOctubre
|
|
{
|
|
get
|
|
{
|
|
if (this.NumeroCuenta != null)
|
|
{
|
|
switch (this.NumeroCuenta.Substring(0, 1))
|
|
{
|
|
case "6":
|
|
case "7":
|
|
{
|
|
return Math.Round(Math.Abs(this.PresupuestoOctubre) - Math.Abs(this.SaldoOctubre), 2, MidpointRounding.AwayFromZero);
|
|
}
|
|
|
|
default:
|
|
{
|
|
return 0;
|
|
}
|
|
}
|
|
}
|
|
else
|
|
return 0;
|
|
}
|
|
}
|
|
public double DesvioPresupuestoNoviembre
|
|
{
|
|
get
|
|
{
|
|
if (this.NumeroCuenta != null)
|
|
{
|
|
switch (this.NumeroCuenta.Substring(0, 1))
|
|
{
|
|
case "6":
|
|
case "7":
|
|
{
|
|
return Math.Round(Math.Abs(this.PresupuestoNoviembre) - Math.Abs(this.SaldoNoviembre), 2, MidpointRounding.AwayFromZero);
|
|
}
|
|
|
|
default:
|
|
{
|
|
return 0;
|
|
}
|
|
}
|
|
}
|
|
else
|
|
return 0;
|
|
}
|
|
}
|
|
public double DesvioPresupuestoDiciembre
|
|
{
|
|
get
|
|
{
|
|
if (this.NumeroCuenta != null)
|
|
{
|
|
switch (this.NumeroCuenta.Substring(0, 1))
|
|
{
|
|
case "6":
|
|
case "7":
|
|
{
|
|
return Math.Round(Math.Abs(this.PresupuestoDiciembre) - Math.Abs(this.SaldoDiciembre), 2, MidpointRounding.AwayFromZero);
|
|
}
|
|
|
|
default:
|
|
{
|
|
return 0;
|
|
}
|
|
}
|
|
}
|
|
else
|
|
return 0;
|
|
}
|
|
}
|
|
public double DesvioPresupuestoTotal
|
|
{
|
|
get
|
|
{
|
|
if (this.NumeroCuenta != null)
|
|
{
|
|
switch (this.NumeroCuenta.Substring(0, 1))
|
|
{
|
|
case "6":
|
|
case "7":
|
|
{
|
|
return Math.Round(Math.Abs(this.TotalPresupuestado) - Math.Abs(this.TotalSaldo), 2, MidpointRounding.AwayFromZero);
|
|
}
|
|
|
|
default:
|
|
{
|
|
return 0;
|
|
}
|
|
}
|
|
}
|
|
else
|
|
return 0;
|
|
}
|
|
}
|
|
public double PorcentajeDesvioPresupuestoEnero
|
|
{
|
|
get
|
|
{
|
|
if (SaldoEnero == 0)
|
|
{
|
|
if (DesvioPresupuestoEnero < 0)
|
|
return -100;
|
|
else if (DesvioPresupuestoEnero > 0)
|
|
return 100;
|
|
else
|
|
return 0;
|
|
}
|
|
else
|
|
return Math.Round(DesvioPresupuestoEnero * 100 / (double)SaldoEnero, 2, MidpointRounding.AwayFromZero);
|
|
}
|
|
}
|
|
public double PorcentajeDesvioPresupuestoFebrero
|
|
{
|
|
get
|
|
{
|
|
if (SaldoFebrero == 0)
|
|
{
|
|
if (DesvioPresupuestoFebrero < 0)
|
|
return -100;
|
|
else if (DesvioPresupuestoFebrero > 0)
|
|
return 100;
|
|
else
|
|
return 0;
|
|
}
|
|
else
|
|
return Math.Round(DesvioPresupuestoFebrero * 100 / (double)SaldoFebrero, 2, MidpointRounding.AwayFromZero);
|
|
}
|
|
}
|
|
public double PorcentajeDesvioPresupuestoMarzo
|
|
{
|
|
get
|
|
{
|
|
if (SaldoMarzo == 0)
|
|
{
|
|
if (DesvioPresupuestoMarzo < 0)
|
|
return -100;
|
|
else if (DesvioPresupuestoMarzo > 0)
|
|
return 100;
|
|
else
|
|
return 0;
|
|
}
|
|
else
|
|
return Math.Round(DesvioPresupuestoMarzo * 100 / (double)SaldoMarzo, 2, MidpointRounding.AwayFromZero);
|
|
}
|
|
}
|
|
public double PorcentajeDesvioPresupuestoAbril
|
|
{
|
|
get
|
|
{
|
|
if (SaldoAbril == 0)
|
|
{
|
|
if (DesvioPresupuestoAbril < 0)
|
|
return -100;
|
|
else if (DesvioPresupuestoAbril > 0)
|
|
return 100;
|
|
else
|
|
return 0;
|
|
}
|
|
else
|
|
return Math.Round(DesvioPresupuestoAbril * 100 / (double)SaldoAbril, 2, MidpointRounding.AwayFromZero);
|
|
}
|
|
}
|
|
public double PorcentajeDesvioPresupuestoMayo
|
|
{
|
|
get
|
|
{
|
|
if (SaldoMayo == 0)
|
|
{
|
|
if (DesvioPresupuestoMayo < 0)
|
|
return -100;
|
|
else if (DesvioPresupuestoMayo > 0)
|
|
return 100;
|
|
else
|
|
return 0;
|
|
}
|
|
else
|
|
return Math.Round(DesvioPresupuestoMayo * 100 / (double)SaldoMayo, 2, MidpointRounding.AwayFromZero);
|
|
}
|
|
}
|
|
public double PorcentajeDesvioPresupuestoJunio
|
|
{
|
|
get
|
|
{
|
|
if (SaldoJunio == 0)
|
|
{
|
|
if (DesvioPresupuestoJunio < 0)
|
|
return -100;
|
|
else if (DesvioPresupuestoJunio > 0)
|
|
return 100;
|
|
else
|
|
return 0;
|
|
}
|
|
else
|
|
return Math.Round(DesvioPresupuestoJunio * 100 / (double)SaldoJunio, 2, MidpointRounding.AwayFromZero);
|
|
}
|
|
}
|
|
public double PorcentajeDesvioPresupuestoJulio
|
|
{
|
|
get
|
|
{
|
|
if (SaldoJulio == 0)
|
|
{
|
|
if (DesvioPresupuestoJulio < 0)
|
|
return -100;
|
|
else if (DesvioPresupuestoJulio > 0)
|
|
return 100;
|
|
else
|
|
return 0;
|
|
}
|
|
else
|
|
return Math.Round(DesvioPresupuestoJulio * 100 / (double)SaldoJulio, 2, MidpointRounding.AwayFromZero);
|
|
}
|
|
}
|
|
public double PorcentajeDesvioPresupuestoAgosto
|
|
{
|
|
get
|
|
{
|
|
if (SaldoAgosto == 0)
|
|
{
|
|
if (DesvioPresupuestoAgosto < 0)
|
|
return -100;
|
|
else if (DesvioPresupuestoAgosto > 0)
|
|
return 100;
|
|
else
|
|
return 0;
|
|
}
|
|
else
|
|
return Math.Round(DesvioPresupuestoAgosto * 100 / (double)SaldoAgosto, 2, MidpointRounding.AwayFromZero);
|
|
}
|
|
}
|
|
public double PorcentajeDesvioPresupuestoSeptiembre
|
|
{
|
|
get
|
|
{
|
|
if (SaldoSeptiembre == 0)
|
|
{
|
|
if (DesvioPresupuestoSeptiembre < 0)
|
|
return -100;
|
|
else if (DesvioPresupuestoSeptiembre > 0)
|
|
return 100;
|
|
else
|
|
return 0;
|
|
}
|
|
else
|
|
return Math.Round(DesvioPresupuestoSeptiembre * 100 / (double)SaldoSeptiembre, 2, MidpointRounding.AwayFromZero);
|
|
}
|
|
}
|
|
public double PorcentajeDesvioPresupuestoOctubre
|
|
{
|
|
get
|
|
{
|
|
if (SaldoOctubre == 0)
|
|
{
|
|
if (DesvioPresupuestoOctubre < 0)
|
|
return -100;
|
|
else if (DesvioPresupuestoOctubre > 0)
|
|
return 100;
|
|
else
|
|
return 0;
|
|
}
|
|
else
|
|
return Math.Round(DesvioPresupuestoOctubre * 100 / (double)SaldoOctubre, 2, MidpointRounding.AwayFromZero);
|
|
}
|
|
}
|
|
public double PorcentajeDesvioPresupuestoNoviembre
|
|
{
|
|
get
|
|
{
|
|
if (SaldoNoviembre == 0)
|
|
{
|
|
if (DesvioPresupuestoNoviembre < 0)
|
|
return -100;
|
|
else if (DesvioPresupuestoNoviembre > 0)
|
|
return 100;
|
|
else
|
|
return 0;
|
|
}
|
|
else
|
|
return Math.Round(DesvioPresupuestoNoviembre * 100 / (double)SaldoNoviembre, 2, MidpointRounding.AwayFromZero);
|
|
}
|
|
}
|
|
public double PorcentajeDesvioPresupuestoDiciembre
|
|
{
|
|
get
|
|
{
|
|
if (SaldoDiciembre == 0)
|
|
{
|
|
if (DesvioPresupuestoDiciembre < 0)
|
|
return -100;
|
|
else if (DesvioPresupuestoDiciembre > 0)
|
|
return 100;
|
|
else
|
|
return 0;
|
|
}
|
|
else
|
|
return Math.Round(DesvioPresupuestoDiciembre * 100 / (double)SaldoDiciembre, 2, MidpointRounding.AwayFromZero);
|
|
}
|
|
}
|
|
public double PorcentajeDesvioPresupuestoTotal
|
|
{
|
|
get
|
|
{
|
|
if (TotalSaldo == 0)
|
|
{
|
|
if (DesvioPresupuestoTotal < 0)
|
|
return -100;
|
|
else if (DesvioPresupuestoTotal > 0)
|
|
return 100;
|
|
else
|
|
return 0;
|
|
}
|
|
else
|
|
return Math.Round(DesvioPresupuestoTotal * 100 / (double)TotalSaldo, 2, MidpointRounding.AwayFromZero);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|