Imports tsl5.Extensiones Imports tsl5.Extensiones.DoubleExtensions Partial Public Class vf_cuentas Public Shared Function Obtiene_vf_cuentas(bd As gestionasegasaEntities, idEjercicio As Integer, Nivel As Integer) As List(Of vf_cuentas) Try Dim lc As List(Of vf_cuentas) Dim ctasintermedias = bd.cuentas.Where(Function(x) x.EsCuentaFinal = False And x.idEjercicio = idEjercicio And x.NumeroCuenta.Length <= Nivel).ToList Dim ctasf = bd.vf_cuentas.Where(Function(x) x.idEjercicio = idEjercicio).ToList If Nivel = 8 Then lc = ctasf Else lc = New List(Of vf_cuentas) For Each cta In ctasintermedias.Where(Function(x) x.Nivel = Nivel) Dim sumatorio = ctasf.Where(Function(x) x.NumeroCuenta.StartsWith(cta.NumeroCuenta)) Dim nc As New vf_cuentas With nc .idCuenta = cta.idCuenta .idEjercicio = cta.idEjercicio .Mote = cta.Mote .Denominacion = cta.Denominacion .idEmpresaAmortizacion = cta.idEmpresaAmortizacion .NumeroCuenta = cta.NumeroCuenta .Observaciones = cta.Observaciones .PresupuestoEnero = Math.Round(sumatorio.Sum(Function(x) x.PresupuestoEnero), 2, MidpointRounding.AwayFromZero) .PresupuestoFebrero = Math.Round(sumatorio.Sum(Function(x) x.PresupuestoEnero), 2, MidpointRounding.AwayFromZero) .PresupuestoMarzo = Math.Round(sumatorio.Sum(Function(x) x.PresupuestoMarzo), 2, MidpointRounding.AwayFromZero) .PresupuestoAbril = Math.Round(sumatorio.Sum(Function(x) x.PresupuestoAbril), 2, MidpointRounding.AwayFromZero) .PresupuestoMayo = Math.Round(sumatorio.Sum(Function(x) x.PresupuestoMayo), 2, MidpointRounding.AwayFromZero) .PresupuestoJunio = Math.Round(sumatorio.Sum(Function(x) x.PresupuestoJunio), 2, MidpointRounding.AwayFromZero) .PresupuestoJulio = Math.Round(sumatorio.Sum(Function(x) x.PresupuestoJulio), 2, MidpointRounding.AwayFromZero) .PresupuestoAgosto = Math.Round(sumatorio.Sum(Function(x) x.PresupuestoAgosto), 2, MidpointRounding.AwayFromZero) .PresupuestoSeptiembre = Math.Round(sumatorio.Sum(Function(x) x.PresupuestoSeptiembre), 2, MidpointRounding.AwayFromZero) .PresupuestoOctubre = Math.Round(sumatorio.Sum(Function(x) x.PresupuestoOctubre), 2, MidpointRounding.AwayFromZero) .PresupuestoNoviembre = Math.Round(sumatorio.Sum(Function(x) x.PresupuestoNoviembre), 2, MidpointRounding.AwayFromZero) .PresupuestoDiciembre = Math.Round(sumatorio.Sum(Function(x) x.PresupuestoDiciembre), 2, MidpointRounding.AwayFromZero) .DebeEnero = Math.Round(sumatorio.Sum(Function(x) x.DebeEnero.NothingA0), 2, MidpointRounding.AwayFromZero) .DebeFebrero = Math.Round(sumatorio.Sum(Function(x) x.DebeEnero.NothingA0), 2, MidpointRounding.AwayFromZero) .DebeMarzo = Math.Round(sumatorio.Sum(Function(x) x.DebeMarzo.NothingA0), 2, MidpointRounding.AwayFromZero) .DebeAbril = Math.Round(sumatorio.Sum(Function(x) x.DebeAbril.NothingA0), 2, MidpointRounding.AwayFromZero) .DebeMayo = Math.Round(sumatorio.Sum(Function(x) x.DebeMayo.NothingA0), 2, MidpointRounding.AwayFromZero) .DebeJunio = Math.Round(sumatorio.Sum(Function(x) x.DebeJunio.NothingA0), 2, MidpointRounding.AwayFromZero) .DebeJulio = Math.Round(sumatorio.Sum(Function(x) x.DebeJulio.NothingA0), 2, MidpointRounding.AwayFromZero) .DebeAgosto = Math.Round(sumatorio.Sum(Function(x) x.DebeAgosto.NothingA0), 2, MidpointRounding.AwayFromZero) .DebeSeptiembre = Math.Round(sumatorio.Sum(Function(x) x.DebeSeptiembre.NothingA0), 2, MidpointRounding.AwayFromZero) .DebeOctubre = Math.Round(sumatorio.Sum(Function(x) x.DebeOctubre.NothingA0), 2, MidpointRounding.AwayFromZero) .DebeNoviembre = Math.Round(sumatorio.Sum(Function(x) x.DebeNoviembre.NothingA0), 2, MidpointRounding.AwayFromZero) .DebeDiciembre = Math.Round(sumatorio.Sum(Function(x) x.DebeDiciembre.NothingA0), 2, MidpointRounding.AwayFromZero) .HaberEnero = Math.Round(sumatorio.Sum(Function(x) x.HaberEnero.NothingA0), 2, MidpointRounding.AwayFromZero) .HaberFebrero = Math.Round(sumatorio.Sum(Function(x) x.HaberEnero.NothingA0), 2, MidpointRounding.AwayFromZero) .HaberMarzo = Math.Round(sumatorio.Sum(Function(x) x.HaberMarzo.NothingA0), 2, MidpointRounding.AwayFromZero) .HaberAbril = Math.Round(sumatorio.Sum(Function(x) x.HaberAbril.NothingA0), 2, MidpointRounding.AwayFromZero) .HaberMayo = Math.Round(sumatorio.Sum(Function(x) x.HaberMayo.NothingA0), 2, MidpointRounding.AwayFromZero) .HaberJunio = Math.Round(sumatorio.Sum(Function(x) x.HaberJunio.NothingA0), 2, MidpointRounding.AwayFromZero) .HaberJulio = Math.Round(sumatorio.Sum(Function(x) x.HaberJulio.NothingA0), 2, MidpointRounding.AwayFromZero) .HaberAgosto = Math.Round(sumatorio.Sum(Function(x) x.HaberAgosto.NothingA0), 2, MidpointRounding.AwayFromZero) .HaberSeptiembre = Math.Round(sumatorio.Sum(Function(x) x.HaberSeptiembre.NothingA0), 2, MidpointRounding.AwayFromZero) .HaberOctubre = Math.Round(sumatorio.Sum(Function(x) x.HaberOctubre.NothingA0), 2, MidpointRounding.AwayFromZero) .HaberNoviembre = Math.Round(sumatorio.Sum(Function(x) x.HaberNoviembre.NothingA0), 2, MidpointRounding.AwayFromZero) .HaberDiciembre = Math.Round(sumatorio.Sum(Function(x) x.HaberDiciembre.NothingA0), 2, MidpointRounding.AwayFromZero) .TotalDebe = Math.Round(sumatorio.Sum(Function(x) x.TotalDebe), 2, MidpointRounding.AwayFromZero) .TotalHaber = Math.Round(sumatorio.Sum(Function(x) x.TotalHaber), 2, MidpointRounding.AwayFromZero) lc.Add(nc) End With Next End If For Each cta In lc Try Dim cta1 = ctasintermedias.First(Function(x) x.NumeroCuenta = cta.NumeroCuenta.Substring(0, 1)) cta.Grupo1 = cta1.NumeroCuenta & " " & cta1.Denominacion If cta.Nivel > 1 Then Dim cta2 = ctasintermedias.First(Function(x) x.NumeroCuenta = cta.NumeroCuenta.Substring(0, 2)) cta.Grupo2 = cta2.NumeroCuenta & " " & cta2.Denominacion If cta.Nivel > 2 Then Dim cta3 = ctasintermedias.First(Function(x) x.NumeroCuenta = cta.NumeroCuenta.Substring(0, 3)) cta.Grupo3 = cta3.NumeroCuenta & " " & cta3.Denominacion If cta.Nivel > 3 Then Dim cta4 = ctasintermedias.First(Function(x) x.NumeroCuenta = cta.NumeroCuenta.Substring(0, 4)) cta.Grupo4 = cta4.NumeroCuenta & " " & cta4.Denominacion End If End If End If Catch ex As Exception Throw New Exception("Error obteniendo cuentas intermedia de la cuenta " & cta.NumeroCuenta & " " & ex.Message, ex) End Try Next Return lc Catch ex As Exception Throw New Exception(ex.Message, ex) End Try End Function Public Shared Function Obtiene_vf_cuentas(bd As gestionasegasaEntities, Ejercicios As Integer(), Nivel As Integer, ExpresionBusqueda As String) As List(Of vf_cuentas) Try Dim lc As List(Of vf_cuentas) Dim qCtasIntermedias As IQueryable(Of cuentas) = bd.cuentas.Where(Function(x) x.EsCuentaFinal = False And Ejercicios.Contains(x.idEjercicio) And x.NumeroCuenta.Length <= Nivel) Dim parametros(0) As Object Dim qcastf As IQueryable(Of vf_cuentas) If ExpresionBusqueda = "" Then qcastf = bd.vf_cuentas.AsQueryable Else qcastf = bd.vf_cuentas.Where(ExpresionBusqueda, parametros) If Nivel < 8 Then ExpresionBusqueda = "NumeroCuenta.Length<" & Nivel.ToString & " or (" & ExpresionBusqueda & ")" qCtasIntermedias = qCtasIntermedias.Where(ExpresionBusqueda, parametros) End If End If Dim ctasintermedias = qCtasIntermedias.ToList 'Dim KK = qcastf.ToList Dim ctasf = qcastf.Where(Function(x) Ejercicios.Contains(x.idEjercicio)).ToList If Nivel = 8 Then lc = ctasf Else lc = New List(Of vf_cuentas) For Each cta In ctasintermedias.Where(Function(x) x.Nivel = Nivel) Dim sumatorio = ctasf.Where(Function(x) x.idEjercicio = cta.idEjercicio And x.NumeroCuenta.StartsWith(cta.NumeroCuenta)) Dim nc As New vf_cuentas With nc .idCuenta = cta.idCuenta .idEjercicio = cta.idEjercicio .Mote = cta.Mote .Denominacion = cta.Denominacion .idEmpresaAmortizacion = cta.idEmpresaAmortizacion .NumeroCuenta = cta.NumeroCuenta .Observaciones = cta.Observaciones .PresupuestoEnero = Math.Round(sumatorio.Sum(Function(x) x.PresupuestoEnero), 2, MidpointRounding.AwayFromZero) .PresupuestoFebrero = Math.Round(sumatorio.Sum(Function(x) x.PresupuestoEnero), 2, MidpointRounding.AwayFromZero) .PresupuestoMarzo = Math.Round(sumatorio.Sum(Function(x) x.PresupuestoMarzo), 2, MidpointRounding.AwayFromZero) .PresupuestoAbril = Math.Round(sumatorio.Sum(Function(x) x.PresupuestoAbril), 2, MidpointRounding.AwayFromZero) .PresupuestoMayo = Math.Round(sumatorio.Sum(Function(x) x.PresupuestoMayo), 2, MidpointRounding.AwayFromZero) .PresupuestoJunio = Math.Round(sumatorio.Sum(Function(x) x.PresupuestoJunio), 2, MidpointRounding.AwayFromZero) .PresupuestoJulio = Math.Round(sumatorio.Sum(Function(x) x.PresupuestoJulio), 2, MidpointRounding.AwayFromZero) .PresupuestoAgosto = Math.Round(sumatorio.Sum(Function(x) x.PresupuestoAgosto), 2, MidpointRounding.AwayFromZero) .PresupuestoSeptiembre = Math.Round(sumatorio.Sum(Function(x) x.PresupuestoSeptiembre), 2, MidpointRounding.AwayFromZero) .PresupuestoOctubre = Math.Round(sumatorio.Sum(Function(x) x.PresupuestoOctubre), 2, MidpointRounding.AwayFromZero) .PresupuestoNoviembre = Math.Round(sumatorio.Sum(Function(x) x.PresupuestoNoviembre), 2, MidpointRounding.AwayFromZero) .PresupuestoDiciembre = Math.Round(sumatorio.Sum(Function(x) x.PresupuestoDiciembre), 2, MidpointRounding.AwayFromZero) .DebeEnero = Math.Round(sumatorio.Sum(Function(x) x.DebeEnero.NothingA0), 2, MidpointRounding.AwayFromZero) .DebeFebrero = Math.Round(sumatorio.Sum(Function(x) x.DebeEnero.NothingA0), 2, MidpointRounding.AwayFromZero) .DebeMarzo = Math.Round(sumatorio.Sum(Function(x) x.DebeMarzo.NothingA0), 2, MidpointRounding.AwayFromZero) .DebeAbril = Math.Round(sumatorio.Sum(Function(x) x.DebeAbril.NothingA0), 2, MidpointRounding.AwayFromZero) .DebeMayo = Math.Round(sumatorio.Sum(Function(x) x.DebeMayo.NothingA0), 2, MidpointRounding.AwayFromZero) .DebeJunio = Math.Round(sumatorio.Sum(Function(x) x.DebeJunio.NothingA0), 2, MidpointRounding.AwayFromZero) .DebeJulio = Math.Round(sumatorio.Sum(Function(x) x.DebeJulio.NothingA0), 2, MidpointRounding.AwayFromZero) .DebeAgosto = Math.Round(sumatorio.Sum(Function(x) x.DebeAgosto.NothingA0), 2, MidpointRounding.AwayFromZero) .DebeSeptiembre = Math.Round(sumatorio.Sum(Function(x) x.DebeSeptiembre.NothingA0), 2, MidpointRounding.AwayFromZero) .DebeOctubre = Math.Round(sumatorio.Sum(Function(x) x.DebeOctubre.NothingA0), 2, MidpointRounding.AwayFromZero) .DebeNoviembre = Math.Round(sumatorio.Sum(Function(x) x.DebeNoviembre.NothingA0), 2, MidpointRounding.AwayFromZero) .DebeDiciembre = Math.Round(sumatorio.Sum(Function(x) x.DebeDiciembre.NothingA0), 2, MidpointRounding.AwayFromZero) .HaberEnero = Math.Round(sumatorio.Sum(Function(x) x.HaberEnero.NothingA0), 2, MidpointRounding.AwayFromZero) .HaberFebrero = Math.Round(sumatorio.Sum(Function(x) x.HaberEnero.NothingA0), 2, MidpointRounding.AwayFromZero) .HaberMarzo = Math.Round(sumatorio.Sum(Function(x) x.HaberMarzo.NothingA0), 2, MidpointRounding.AwayFromZero) .HaberAbril = Math.Round(sumatorio.Sum(Function(x) x.HaberAbril.NothingA0), 2, MidpointRounding.AwayFromZero) .HaberMayo = Math.Round(sumatorio.Sum(Function(x) x.HaberMayo.NothingA0), 2, MidpointRounding.AwayFromZero) .HaberJunio = Math.Round(sumatorio.Sum(Function(x) x.HaberJunio.NothingA0), 2, MidpointRounding.AwayFromZero) .HaberJulio = Math.Round(sumatorio.Sum(Function(x) x.HaberJulio.NothingA0), 2, MidpointRounding.AwayFromZero) .HaberAgosto = Math.Round(sumatorio.Sum(Function(x) x.HaberAgosto.NothingA0), 2, MidpointRounding.AwayFromZero) .HaberSeptiembre = Math.Round(sumatorio.Sum(Function(x) x.HaberSeptiembre.NothingA0), 2, MidpointRounding.AwayFromZero) .HaberOctubre = Math.Round(sumatorio.Sum(Function(x) x.HaberOctubre.NothingA0), 2, MidpointRounding.AwayFromZero) .HaberNoviembre = Math.Round(sumatorio.Sum(Function(x) x.HaberNoviembre.NothingA0), 2, MidpointRounding.AwayFromZero) .HaberDiciembre = Math.Round(sumatorio.Sum(Function(x) x.HaberDiciembre.NothingA0), 2, MidpointRounding.AwayFromZero) .TotalDebe = Math.Round(sumatorio.Sum(Function(x) x.TotalDebe), 2, MidpointRounding.AwayFromZero) .TotalHaber = Math.Round(sumatorio.Sum(Function(x) x.TotalHaber), 2, MidpointRounding.AwayFromZero) lc.Add(nc) End With Next End If For Each cta In lc Try Dim cta1 = ctasintermedias.First(Function(x) x.NumeroCuenta = cta.NumeroCuenta.Substring(0, 1)) cta.Grupo1 = cta1.NumeroCuenta & " " & cta1.Denominacion If cta.Nivel > 1 Then Dim cta2 = ctasintermedias.First(Function(x) x.NumeroCuenta = cta.NumeroCuenta.Substring(0, 2)) cta.Grupo2 = cta2.NumeroCuenta & " " & cta2.Denominacion If cta.Nivel > 2 Then Dim cta3 = ctasintermedias.First(Function(x) x.NumeroCuenta = cta.NumeroCuenta.Substring(0, 3)) cta.Grupo3 = cta3.NumeroCuenta & " " & cta3.Denominacion If cta.Nivel > 3 Then Dim cta4 = ctasintermedias.First(Function(x) x.NumeroCuenta = cta.NumeroCuenta.Substring(0, 4)) cta.Grupo4 = cta4.NumeroCuenta & " " & cta4.Denominacion End If End If End If Catch ex As Exception Throw New Exception("Error obteniendo cuentas intermedia de la cuenta " & cta.NumeroCuenta & " " & ex.Message, ex) End Try Next Return lc Catch ex As Exception Throw New Exception(ex.Message, ex) End Try End Function Public Property Grupo1 As String Public Property Grupo2 As String Public Property Grupo3 As String Public Property Grupo4 As String Public ReadOnly Property Nivel As Integer Get Return NumeroCuenta.Length End Get End Property #Region "Saldos" Public ReadOnly Property SaldoEnero As Double Get Return Math.Round(DebeEnero.NothingA0 - HaberEnero.NothingA0, 2, MidpointRounding.AwayFromZero) End Get End Property Public ReadOnly Property SaldoFebrero As Double Get Return Math.Round(DebeFebrero.NothingA0 - HaberFebrero.NothingA0, 2, MidpointRounding.AwayFromZero) End Get End Property Public ReadOnly Property SaldoMarzo As Double Get Return Math.Round(DebeMarzo.NothingA0 - HaberMarzo.NothingA0, 2, MidpointRounding.AwayFromZero) End Get End Property Public ReadOnly Property SaldoAbril As Double Get Return Math.Round(DebeAbril.NothingA0 - HaberAbril.NothingA0, 2, MidpointRounding.AwayFromZero) End Get End Property Public ReadOnly Property SaldoMayo As Double Get Return Math.Round(DebeMayo.NothingA0 - HaberMayo.NothingA0, 2, MidpointRounding.AwayFromZero) End Get End Property Public ReadOnly Property SaldoJunio As Double Get Return Math.Round(DebeJunio.NothingA0 - HaberJunio.NothingA0, 2, MidpointRounding.AwayFromZero) End Get End Property Public ReadOnly Property SaldoJulio As Double Get Return Math.Round(DebeJulio.NothingA0 - HaberJulio.NothingA0, 2, MidpointRounding.AwayFromZero) End Get End Property Public ReadOnly Property SaldoAgosto As Double Get Return Math.Round(DebeAgosto.NothingA0 - HaberAgosto.NothingA0, 2, MidpointRounding.AwayFromZero) End Get End Property Public ReadOnly Property SaldoSeptiembre As Double Get Return Math.Round(DebeSeptiembre.NothingA0 - HaberSeptiembre.NothingA0, 2, MidpointRounding.AwayFromZero) End Get End Property Public ReadOnly Property SaldoOctubre As Double Get Return Math.Round(DebeOctubre.NothingA0 - HaberOctubre.NothingA0, 2, MidpointRounding.AwayFromZero) End Get End Property Public ReadOnly Property SaldoNoviembre As Double Get Return Math.Round(DebeNoviembre.NothingA0 - HaberNoviembre.NothingA0, 2, MidpointRounding.AwayFromZero) End Get End Property Public ReadOnly Property SaldoDiciembre As Double Get Return Math.Round(DebeDiciembre.NothingA0 - HaberDiciembre.NothingA0, 2, MidpointRounding.AwayFromZero) End Get End Property Public ReadOnly Property TotalSaldo As Double Get Return Math.Round(TotalDebe - TotalHaber, 2, MidpointRounding.AwayFromZero) End Get End Property #End Region #Region "Presupuestos" Public ReadOnly Property TotalPresupuestado As Double Get Return Math.Round(PresupuestoEnero + PresupuestoFebrero + PresupuestoMarzo + PresupuestoAbril + PresupuestoMayo + PresupuestoJunio + PresupuestoJulio + PresupuestoAgosto + PresupuestoSeptiembre + PresupuestoOctubre + PresupuestoNoviembre + PresupuestoDiciembre, 2, MidpointRounding.AwayFromZero) End Get End Property Public Sub ActualizaTotalPresupuestado() OnPropertyChanged("TotalPresupuestado") End Sub Public ReadOnly Property DesvioPresupuestoEnero As Double Get If Me.NumeroCuenta IsNot Nothing Then Select Case Me.NumeroCuenta.Substring(0, 1) Case "6", "7" Return Math.Round(Math.Abs(Me.PresupuestoEnero) - Math.Abs(Me.SaldoEnero), 2, MidpointRounding.AwayFromZero) Case Else Return 0 End Select Else Return 0 End If End Get End Property Public ReadOnly Property DesvioPresupuestoFebrero As Double Get If Me.NumeroCuenta IsNot Nothing Then Select Case Me.NumeroCuenta.Substring(0, 1) Case "6", "7" Return Math.Round(Math.Abs(Me.PresupuestoFebrero) - Math.Abs(Me.SaldoFebrero), 2, MidpointRounding.AwayFromZero) Case Else Return 0 End Select Else Return 0 End If End Get End Property Public ReadOnly Property DesvioPresupuestoMarzo As Double Get If Me.NumeroCuenta IsNot Nothing Then Select Case Me.NumeroCuenta.Substring(0, 1) Case "6", "7" Return Math.Round(Math.Abs(Me.PresupuestoMarzo) - Math.Abs(Me.SaldoMarzo), 2, MidpointRounding.AwayFromZero) Case Else Return 0 End Select Else Return 0 End If End Get End Property Public ReadOnly Property DesvioPresupuestoAbril As Double Get If Me.NumeroCuenta IsNot Nothing Then Select Case Me.NumeroCuenta.Substring(0, 1) Case "6", "7" Return Math.Round(Math.Abs(Me.PresupuestoAbril) - Math.Abs(Me.SaldoAbril), 2, MidpointRounding.AwayFromZero) Case Else Return 0 End Select Else Return 0 End If End Get End Property Public ReadOnly Property DesvioPresupuestoMayo As Double Get If Me.NumeroCuenta IsNot Nothing Then Select Case Me.NumeroCuenta.Substring(0, 1) Case "6", "7" Return Math.Round(Math.Abs(Me.PresupuestoMayo) - Math.Abs(Me.SaldoMayo), 2, MidpointRounding.AwayFromZero) Case Else Return 0 End Select Else Return 0 End If End Get End Property Public ReadOnly Property DesvioPresupuestoJunio As Double Get If Me.NumeroCuenta IsNot Nothing Then Select Case Me.NumeroCuenta.Substring(0, 1) Case "6", "7" Return Math.Round(Math.Abs(Me.PresupuestoJunio) - Math.Abs(Me.SaldoJunio), 2, MidpointRounding.AwayFromZero) Case Else Return 0 End Select Else Return 0 End If End Get End Property Public ReadOnly Property DesvioPresupuestoJulio As Double Get If Me.NumeroCuenta IsNot Nothing Then Select Case Me.NumeroCuenta.Substring(0, 1) Case "6", "7" Return Math.Round(Math.Abs(Me.PresupuestoJulio) - Math.Abs(Me.SaldoJulio), 2, MidpointRounding.AwayFromZero) Case Else Return 0 End Select Else Return 0 End If End Get End Property Public ReadOnly Property DesvioPresupuestoAgosto As Double Get If Me.NumeroCuenta IsNot Nothing Then Select Case Me.NumeroCuenta.Substring(0, 1) Case "6", "7" Return Math.Round(Math.Abs(Me.PresupuestoAgosto) - Math.Abs(Me.SaldoAgosto), 2, MidpointRounding.AwayFromZero) Case Else Return 0 End Select Else Return 0 End If End Get End Property Public ReadOnly Property DesvioPresupuestoSeptiembre As Double Get If Me.NumeroCuenta IsNot Nothing Then Select Case Me.NumeroCuenta.Substring(0, 1) Case "6", "7" Return Math.Round(Math.Abs(Me.PresupuestoSeptiembre) - Math.Abs(Me.SaldoSeptiembre), 2, MidpointRounding.AwayFromZero) Case Else Return 0 End Select Else Return 0 End If End Get End Property Public ReadOnly Property DesvioPresupuestoOctubre As Double Get If Me.NumeroCuenta IsNot Nothing Then Select Case Me.NumeroCuenta.Substring(0, 1) Case "6", "7" Return Math.Round(Math.Abs(Me.PresupuestoOctubre) - Math.Abs(Me.SaldoOctubre), 2, MidpointRounding.AwayFromZero) Case Else Return 0 End Select Else Return 0 End If End Get End Property Public ReadOnly Property DesvioPresupuestoNoviembre As Double Get If Me.NumeroCuenta IsNot Nothing Then Select Case Me.NumeroCuenta.Substring(0, 1) Case "6", "7" Return Math.Round(Math.Abs(Me.PresupuestoNoviembre) - Math.Abs(Me.SaldoNoviembre), 2, MidpointRounding.AwayFromZero) Case Else Return 0 End Select Else Return 0 End If End Get End Property Public ReadOnly Property DesvioPresupuestoDiciembre As Double Get If Me.NumeroCuenta IsNot Nothing Then Select Case Me.NumeroCuenta.Substring(0, 1) Case "6", "7" Return Math.Round(Math.Abs(Me.PresupuestoDiciembre) - Math.Abs(Me.SaldoDiciembre), 2, MidpointRounding.AwayFromZero) Case Else Return 0 End Select Else Return 0 End If End Get End Property Public ReadOnly Property DesvioPresupuestoTotal As Double Get If Me.NumeroCuenta IsNot Nothing Then Select Case Me.NumeroCuenta.Substring(0, 1) Case "6", "7" Return Math.Round(Math.Abs(Me.TotalPresupuestado) - Math.Abs(Me.TotalSaldo), 2, MidpointRounding.AwayFromZero) Case Else Return 0 End Select Else Return 0 End If End Get End Property Public ReadOnly Property PorcentajeDesvioPresupuestoEnero As Double Get If SaldoEnero = 0 Then If DesvioPresupuestoEnero < 0 Then Return -100 ElseIf DesvioPresupuestoEnero > 0 Then Return 100 Else Return 0 End If Else Return Math.Round(DesvioPresupuestoEnero * 100 / SaldoEnero, 2, MidpointRounding.AwayFromZero) End If End Get End Property Public ReadOnly Property PorcentajeDesvioPresupuestoFebrero As Double Get If SaldoFebrero = 0 Then If DesvioPresupuestoFebrero < 0 Then Return -100 ElseIf DesvioPresupuestoFebrero > 0 Then Return 100 Else Return 0 End If Else Return Math.Round(DesvioPresupuestoFebrero * 100 / SaldoFebrero, 2, MidpointRounding.AwayFromZero) End If End Get End Property Public ReadOnly Property PorcentajeDesvioPresupuestoMarzo As Double Get If SaldoMarzo = 0 Then If DesvioPresupuestoMarzo < 0 Then Return -100 ElseIf DesvioPresupuestoMarzo > 0 Then Return 100 Else Return 0 End If Else Return Math.Round(DesvioPresupuestoMarzo * 100 / SaldoMarzo, 2, MidpointRounding.AwayFromZero) End If End Get End Property Public ReadOnly Property PorcentajeDesvioPresupuestoAbril As Double Get If SaldoAbril = 0 Then If DesvioPresupuestoAbril < 0 Then Return -100 ElseIf DesvioPresupuestoAbril > 0 Then Return 100 Else Return 0 End If Else Return Math.Round(DesvioPresupuestoAbril * 100 / SaldoAbril, 2, MidpointRounding.AwayFromZero) End If End Get End Property Public ReadOnly Property PorcentajeDesvioPresupuestoMayo As Double Get If SaldoMayo = 0 Then If DesvioPresupuestoMayo < 0 Then Return -100 ElseIf DesvioPresupuestoMayo > 0 Then Return 100 Else Return 0 End If Else Return Math.Round(DesvioPresupuestoMayo * 100 / SaldoMayo, 2, MidpointRounding.AwayFromZero) End If End Get End Property Public ReadOnly Property PorcentajeDesvioPresupuestoJunio As Double Get If SaldoJunio = 0 Then If DesvioPresupuestoJunio < 0 Then Return -100 ElseIf DesvioPresupuestoJunio > 0 Then Return 100 Else Return 0 End If Else Return Math.Round(DesvioPresupuestoJunio * 100 / SaldoJunio, 2, MidpointRounding.AwayFromZero) End If End Get End Property Public ReadOnly Property PorcentajeDesvioPresupuestoJulio As Double Get If SaldoJulio = 0 Then If DesvioPresupuestoJulio < 0 Then Return -100 ElseIf DesvioPresupuestoJulio > 0 Then Return 100 Else Return 0 End If Else Return Math.Round(DesvioPresupuestoJulio * 100 / SaldoJulio, 2, MidpointRounding.AwayFromZero) End If End Get End Property Public ReadOnly Property PorcentajeDesvioPresupuestoAgosto As Double Get If SaldoAgosto = 0 Then If DesvioPresupuestoAgosto < 0 Then Return -100 ElseIf DesvioPresupuestoAgosto > 0 Then Return 100 Else Return 0 End If Else Return Math.Round(DesvioPresupuestoAgosto * 100 / SaldoAgosto, 2, MidpointRounding.AwayFromZero) End If End Get End Property Public ReadOnly Property PorcentajeDesvioPresupuestoSeptiembre As Double Get If SaldoSeptiembre = 0 Then If DesvioPresupuestoSeptiembre < 0 Then Return -100 ElseIf DesvioPresupuestoSeptiembre > 0 Then Return 100 Else Return 0 End If Else Return Math.Round(DesvioPresupuestoSeptiembre * 100 / SaldoSeptiembre, 2, MidpointRounding.AwayFromZero) End If End Get End Property Public ReadOnly Property PorcentajeDesvioPresupuestoOctubre As Double Get If SaldoOctubre = 0 Then If DesvioPresupuestoOctubre < 0 Then Return -100 ElseIf DesvioPresupuestoOctubre > 0 Then Return 100 Else Return 0 End If Else Return Math.Round(DesvioPresupuestoOctubre * 100 / SaldoOctubre, 2, MidpointRounding.AwayFromZero) End If End Get End Property Public ReadOnly Property PorcentajeDesvioPresupuestoNoviembre As Double Get If SaldoNoviembre = 0 Then If DesvioPresupuestoNoviembre < 0 Then Return -100 ElseIf DesvioPresupuestoNoviembre > 0 Then Return 100 Else Return 0 End If Else Return Math.Round(DesvioPresupuestoNoviembre * 100 / SaldoNoviembre, 2, MidpointRounding.AwayFromZero) End If End Get End Property Public ReadOnly Property PorcentajeDesvioPresupuestoDiciembre As Double Get If SaldoDiciembre = 0 Then If DesvioPresupuestoDiciembre < 0 Then Return -100 ElseIf DesvioPresupuestoDiciembre > 0 Then Return 100 Else Return 0 End If Else Return Math.Round(DesvioPresupuestoDiciembre * 100 / SaldoDiciembre, 2, MidpointRounding.AwayFromZero) End If End Get End Property Public ReadOnly Property PorcentajeDesvioPresupuestoTotal As Double Get If TotalSaldo = 0 Then If DesvioPresupuestoTotal < 0 Then Return -100 ElseIf DesvioPresupuestoTotal > 0 Then Return 100 Else Return 0 End If Else Return Math.Round(DesvioPresupuestoTotal * 100 / TotalSaldo, 2, MidpointRounding.AwayFromZero) End If End Get End Property #End Region End Class