351 lines
22 KiB
VB.net
351 lines
22 KiB
VB.net
Imports DevExpress.Xpf.Editors
|
|
Imports DevExpress.Xpf.LayoutControl
|
|
Imports tsWPF
|
|
Imports System.Data
|
|
Imports DevExpress.Xpf.Editors.Validation
|
|
Imports DevExpress.Xpf.Editors.Helpers
|
|
Imports DevExpress.Xpf.Core
|
|
Imports tsWPF.modExtensiones
|
|
Imports System.Data.Common
|
|
Imports System.Data.Entity
|
|
Imports bdGrupoSanchoToro
|
|
Imports DevExpress.Xpf.Bars
|
|
Imports DevExpress.Xpf.Grid
|
|
Imports tsUtilidades.Datos
|
|
Imports tsUtilidades.Extensiones.StringExtensions
|
|
Imports tsWPFCore.Comun
|
|
Imports tsUtilidades
|
|
|
|
Imports tsWPFCore
|
|
|
|
Imports bdGrupoSanchoToro.db
|
|
Imports bdGrupoSanchoToro.db.Utilidades
|
|
|
|
Public Class ucCuenta
|
|
Private bd As tscGrupoSanchoToro
|
|
Private _idCuenta As Integer?
|
|
Private ra As cuentas
|
|
|
|
Public Sub New(Optional idCuenta As Integer? = Nothing)
|
|
|
|
' Esta llamada es exigida por el diseñador.
|
|
InitializeComponent()
|
|
_idCuenta = idCuenta
|
|
' Agregue cualquier inicialización después de la llamada a InitializeComponent().
|
|
|
|
End Sub
|
|
|
|
|
|
Public Overrides ReadOnly Property idRegistroAplicacionActual As String
|
|
Get
|
|
If Estado = EstadosAplicacion.Nuevo Then
|
|
Return "Cuenta.Nuevo"
|
|
Else
|
|
Dim cta = DirectCast(Me.DataContext, cuentas)
|
|
Return "Cuenta." & cta.NumeroCuenta.ToString & " (" & cta.idEjercicioNavigation.Descripcion & ")"
|
|
End If
|
|
End Get
|
|
End Property
|
|
|
|
Public Overrides ReadOnly Property DescripcionRegistro As String
|
|
Get
|
|
Return "Cuenta"
|
|
End Get
|
|
End Property
|
|
|
|
Public Overrides ReadOnly Property NombreTablaBase As String
|
|
Get
|
|
Return "cuentas"
|
|
End Get
|
|
End Property
|
|
|
|
Public Overrides Sub EstableceDataContextSecundarios(Optional Background As Boolean = False)
|
|
cbEmpresaAmortizacion.ItemsSource = bd.enumeraciones.Where(Function(x) x.idGrupoEnumeracionNavigation.Grupo = "EMPAMO")
|
|
cbEjercicio.ItemsSource = bd.ejercicioscontables.OrderByDescending(Function(x) x.FechaInicio).ToList
|
|
End Sub
|
|
|
|
Public Overrides Sub EstableceTitulo()
|
|
If Me.docpanel Is Nothing Then
|
|
Dim w As dxwGenerica = Window.GetWindow(Me)
|
|
w.Title = "Agregar nueva cuenta"
|
|
Else
|
|
If Me.Estado = EstadosAplicacion.ModificandoRegistro Then
|
|
Dim cta As cuentas = Me.DataContext
|
|
Me.docpanel.Caption = "Cuenta " & cta.NumeroCuenta.ToString & " (" & cta.idEjercicioNavigation.Descripcion & ")"
|
|
Me.docpanel.Tag = "Cuenta." & cta.idCuenta
|
|
Else
|
|
Me.docpanel.Caption = "Cuenta Nuevo"
|
|
Me.docpanel.Tag = "Cuenta.Nuevo"
|
|
End If
|
|
End If
|
|
End Sub
|
|
|
|
Public Overrides Sub Cargado()
|
|
Me.Tipo_ucControlBusqueda = GetType(ucCuentas)
|
|
End Sub
|
|
|
|
|
|
|
|
Public Overrides Function EstableceDCPrincipal(Optional Background As Boolean = False, Optional FuerzaNuevo As Boolean = False, Optional Refrescar As Boolean = False) As EstadosAplicacion
|
|
Dim NuevoEstado As EstadosAplicacion
|
|
|
|
If FuerzaNuevo OrElse _idCuenta Is Nothing Then
|
|
ra = New bdGrupoSanchoToro.db.cuentas
|
|
Me.DataContext = ra
|
|
_idCuenta = Nothing
|
|
ra.idEjercicioNavigation = bd.ejercicioscontables.Where(Function(X) X.FechaCierre.HasValue = False).OrderByDescending(Function(X) X.FechaApertura).First
|
|
NuevoEstado = EstadosAplicacion.Nuevo
|
|
Else
|
|
ra = bd.cuentas.First(Function(x) x.idCuenta = _idCuenta.Value)
|
|
NuevoEstado = EstadosAplicacion.ModificandoRegistro
|
|
lgDebe.DataContext = ra.ValoresExtendidos
|
|
lgHaber.DataContext = ra.ValoresExtendidos
|
|
lgSaldo.DataContext = ra.ValoresExtendidos
|
|
lgDesvio.DataContext = ra.ValoresExtendidos
|
|
lgPorcentajeDesvio.DataContext = ra.ValoresExtendidos
|
|
If ra.Nivel = 8 Then
|
|
If bd.apuntes.Any(Function(x) x.idCuenta = ra.idCuenta) Then
|
|
tsUserControl.EstableceSoloLectura(cbEjercicio, True)
|
|
End If
|
|
Else
|
|
If bd.apuntes.Any(Function(x) x.idCuentaNavigation.NumeroCuenta.StartsWith(ra.NumeroCuenta) And x.idAsientoNavigation.idEjercicio = ra.idEjercicio) Then
|
|
tsUserControl.EstableceSoloLectura(cbEjercicio, True)
|
|
End If
|
|
End If
|
|
End If
|
|
Me.DataContext = ra
|
|
Dim aps As List(Of apuntes)
|
|
If ra.EsCuentaFinal Then
|
|
aps = bd.apuntes.Include("asientos").Include("cuentas").Where(Function(x) x.idCuenta = ra.idCuenta).OrderBy(Function(x) x.idAsientoNavigation.Fecha).ThenBy(Function(x) x.idAsientoNavigation.NumeroAsiento).ThenBy(Function(x) x.idAsientoNavigation.idAsiento).ToList()
|
|
Else
|
|
aps = bd.apuntes.Include("asientos").Include("cuentas").Where(Function(x) x.idCuentaNavigation.NumeroCuenta.StartsWith(ra.NumeroCuenta) And x.idAsientoNavigation.idEjercicio = ra.idEjercicio).OrderBy(Function(x) x.idAsientoNavigation.Fecha).ThenBy(Function(x) x.idAsientoNavigation.NumeroAsiento).ThenBy(Function(x) x.idAsiento).ToList
|
|
End If
|
|
bdGrupoSanchoToro.db.apuntes.EstableceSaldoTmp(aps)
|
|
gcApuntes.ItemsSource = aps
|
|
Return NuevoEstado
|
|
|
|
End Function
|
|
|
|
Public Overrides Function ObtieneBD() As tsUtilidades.ItsContexto
|
|
bd = tscGrupoSanchoToro.NuevoContexto()
|
|
Return bd
|
|
End Function
|
|
|
|
'Public Overrides Function ObtieneConexionBD() As BBDD
|
|
' Return bdGrupoSanchoToro.gestionasegasaEntities.bdga
|
|
'End Function
|
|
|
|
Public Overrides Function ObtienePermisos() As tsUtilidades.Permisos
|
|
Return Comun.ObtienePermisos(Me.bd, "AP.CONTABILIDAD", idUsuario)
|
|
End Function
|
|
|
|
Private Sub ucCuenta_ValidarControl(sender As Object, e As DevExpress.Xpf.Editors.ValidationEventArgs, ByRef ev As ErrorValidacion, ByRef ValorOriginalCambiado As Object) Handles Me.ValidarControl
|
|
Try
|
|
Dim pts As PropiedadesTS = sender.parent.propiedadests
|
|
If Not pts Is Nothing Then
|
|
Select Case pts.NombreCampo.ToLower
|
|
Case "numerocuenta"
|
|
Dim re = New Text.RegularExpressions.Regex("[0-9]")
|
|
Dim sNC As String = e.Value
|
|
Dim rs As Integer
|
|
If Not Integer.TryParse(sNC, rs) Then
|
|
Throw New Exception("Solo se admiten numeros en el nº de cuenta")
|
|
Else
|
|
If rs < 0 Then
|
|
Throw New Exception("Solo se admiten numeros en el nº de cuenta")
|
|
Else
|
|
If sNC.Length <> 8 And sNC.Length <> 4 And sNC.Length <> 3 And sNC.Length <> 2 And sNC.Length <> 1 Then
|
|
Throw New Exception("Los nº de dígitos de la cuenta deben ser 8,4,3,2 o 1.")
|
|
End If
|
|
End If
|
|
End If
|
|
ra.EsCuentaFinal = (sNC.Length = 8)
|
|
End Select
|
|
End If
|
|
Catch ex As Exception
|
|
Dim sCodigoError As String = "validando-"
|
|
ev = New ErrorValidacion(sCodigoError, sender, ex.Message, ex, DevExpress.XtraEditors.DXErrorProvider.ErrorType.Critical)
|
|
e.IsValid = False
|
|
End Try
|
|
End Sub
|
|
|
|
Private Sub apCL_EstadoCambiado(EstadoAnterior As EstadosAplicacion, EstadoNuevo As EstadosAplicacion) Handles Me.EstadoCambiado
|
|
|
|
Select Case EstadoNuevo
|
|
Case EstadosAplicacion.Nuevo
|
|
Dim ejs = bd.ejercicioscontables.Where(Function(x) x.FechaCierre Is Nothing).OrderByDescending(Function(x) x.FechaInicio).ToList
|
|
cbEjercicio.ItemsSource = ejs
|
|
cbEjercicio.EditValue = ejs.First.idEjercicio
|
|
Case EstadosAplicacion.ModificandoRegistro
|
|
cbEjercicio.ItemsSource = bd.ejercicioscontables.Where(Function(x) x.FechaCierre Is Nothing Or x.idEjercicio = ra.idEjercicio).OrderByDescending(Function(x) x.FechaInicio).ToList
|
|
If ra.idEjercicioNavigation.FechaCierre.HasValue Then
|
|
EstableceSoloLectura()
|
|
Else
|
|
tsUserControl.EstableceSoloLectura(cbEjercicio, ra.apuntes.Count > 0)
|
|
End If
|
|
End Select
|
|
End Sub
|
|
|
|
Private Sub apCL_CampoActualizado(sender As Object, e As DataTransferEventArgs) Handles Me.CampoActualizado
|
|
Dim pts As PropiedadesTS = sender.parent.propiedadests
|
|
If Not pts Is Nothing Then
|
|
|
|
If pts.NombreCampo.ToLower.StartsWith("presupuesto") Then
|
|
ra.ActualizaTotalPresupuestado()
|
|
End If
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub apCL_AntesGuardar(sender As Object, e As ItemClickEventArgs, ByRef Cancelar As Boolean, ByRef MensajesError As Hashtable, OpcionGuardado As Integer) Handles Me.AntesGuardar
|
|
|
|
Dim hte As New Hashtable
|
|
If bd.cuentas.Any(Function(x) x.idCuenta <> ra.idCuenta And x.NumeroCuenta = ra.NumeroCuenta And x.idEjercicio = ra.idEjercicio) Then
|
|
hte.Add("Almacenar-CUENTA_EXISTENTE", "Ya existe la cuenta del ejercicio indicado")
|
|
Else
|
|
If bd.cuentas.Any(Function(x) x.idCuenta <> ra.idCuenta And x.Mote = ra.Mote And x.idEjercicio = ra.idEjercicio) Then
|
|
hte.Add("Almacenar-CUENTA_EXISTENTE", "Ya existe unaa cuenta con el mismo mote")
|
|
End If
|
|
End If
|
|
Select Case ra.NumeroCuenta.NothingAVacio.Length
|
|
Case 8
|
|
Dim Cta4 = ra.NumeroCuenta.Substring(0, 4)
|
|
If Not bd.cuentas.Any(Function(x) x.NumeroCuenta = Cta4 And x.idEjercicio = ra.idEjercicio) Then
|
|
hte.Add("Almacenar-CUENTA_SUPERIOR_4", "La cuenta superior de 4 dígitos no existe. Creela primero.")
|
|
End If
|
|
Dim Cta3 = ra.NumeroCuenta.Substring(0, 3)
|
|
If Not bd.cuentas.Any(Function(x) x.NumeroCuenta = Cta3 And x.idEjercicio = ra.idEjercicio) Then
|
|
hte.Add("Almacenar-CUENTA_SUPERIOR_3", "La cuenta superior de 3 dígitos no existe. Creela primero.")
|
|
End If
|
|
Dim Cta2 = ra.NumeroCuenta.Substring(0, 2)
|
|
If Not bd.cuentas.Any(Function(x) x.NumeroCuenta = Cta2 And x.idEjercicio = ra.idEjercicio) Then
|
|
hte.Add("Almacenar-CUENTA_SUPERIOR_2", "La cuenta superior de 2 dígitos no existe. Creela primero.")
|
|
End If
|
|
Dim Cta1 = ra.NumeroCuenta.Substring(0, 1)
|
|
If Not bd.cuentas.Any(Function(x) x.NumeroCuenta = Cta1 And x.idEjercicio = ra.idEjercicio) Then
|
|
hte.Add("Almacenar-CUENTA_SUPERIOR_1", "La cuenta superior de 1 dígito no existe. Creela primero.")
|
|
End If
|
|
Case 4
|
|
Dim Cta3 = ra.NumeroCuenta.Substring(0, 3)
|
|
If Not bd.cuentas.Any(Function(x) x.NumeroCuenta = Cta3 And x.idEjercicio = ra.idEjercicio) Then
|
|
hte.Add("Almacenar-CUENTA_SUPERIOR_3", "La cuenta superior de 3 dígitos no existe. Creela primero.")
|
|
End If
|
|
Dim Cta2 = ra.NumeroCuenta.Substring(0, 2)
|
|
If Not bd.cuentas.Any(Function(x) x.NumeroCuenta = Cta2 And x.idEjercicio = ra.idEjercicio) Then
|
|
hte.Add("Almacenar-CUENTA_SUPERIOR_2", "La cuenta superior de 2 dígitos no existe. Creela primero.")
|
|
End If
|
|
Dim Cta1 = ra.NumeroCuenta.Substring(0, 1)
|
|
If Not bd.cuentas.Any(Function(x) x.NumeroCuenta = Cta1 And x.idEjercicio = ra.idEjercicio) Then
|
|
hte.Add("Almacenar-CUENTA_SUPERIOR_1", "La cuenta superior de 1 dígito no existe. Creela primero.")
|
|
End If
|
|
Case 3
|
|
Dim Cta2 = ra.NumeroCuenta.Substring(0, 2)
|
|
If Not bd.cuentas.Any(Function(x) x.NumeroCuenta = Cta2 And x.idEjercicio = ra.idEjercicio) Then
|
|
hte.Add("Almacenar-CUENTA_SUPERIOR_2", "La cuenta superior de 2 dígitos no existe. Creela primero.")
|
|
End If
|
|
Dim Cta1 = ra.NumeroCuenta.Substring(0, 1)
|
|
If Not bd.cuentas.Any(Function(x) x.NumeroCuenta = Cta1 And x.idEjercicio = ra.idEjercicio) Then
|
|
hte.Add("Almacenar-CUENTA_SUPERIOR_1", "La cuenta superior de 1 dígito no existe. Creela primero.")
|
|
End If
|
|
Case 2
|
|
Dim Cta1 = ra.NumeroCuenta.Substring(0, 1)
|
|
If Not bd.cuentas.Any(Function(x) x.NumeroCuenta = Cta1 And x.idEjercicio = ra.idEjercicio) Then
|
|
hte.Add("Almacenar-CUENTA_SUPERIOR_1", "La cuenta superior de 1 dígito no existe. Creela primero.")
|
|
End If
|
|
Case 1
|
|
Case Else
|
|
hte.Add("Almacenar-NUMERO_DIGITOS_ERRONEOS", "El nº de dígitos es erróneo")
|
|
End Select
|
|
'If ra.TotalPresupuestado > 0 And (ra.EsCuentaFinal = False Or (ra.NumeroCuenta.StartsWith("6") = False And ra.NumeroCuenta.StartsWith("7") = False)) Then
|
|
' hte.Add("Almacenar-PRESUPUESTO_CUENTA_INALIDA", "El presupuesto solo se debe rellenar en cuentas finales del grupo 6 y 7")
|
|
'End If
|
|
If hte.Count > 0 Then
|
|
MensajesError = hte
|
|
Cancelar = True
|
|
Else
|
|
Select Case Estado
|
|
Case EstadosAplicacion.Nuevo
|
|
If ra.EsCuentaFinal Then
|
|
ActualizaCuentaSuperior(ra.CuentaSuperior4, ra.PresupuestoEnero, ra.PresupuestoFebrero, ra.PresupuestoMarzo, ra.PresupuestoAbril, ra.PresupuestoMayo, ra.PresupuestoJunio, ra.PresupuestoJulio, ra.PresupuestoAgosto, ra.PresupuestoSeptiembre, ra.PresupuestoOctubre, ra.PresupuestoNoviembre, ra.PresupuestoDiciembre, 1)
|
|
ActualizaCuentaSuperior(ra.CuentaSuperior3, ra.PresupuestoEnero, ra.PresupuestoFebrero, ra.PresupuestoMarzo, ra.PresupuestoAbril, ra.PresupuestoMayo, ra.PresupuestoJunio, ra.PresupuestoJulio, ra.PresupuestoAgosto, ra.PresupuestoSeptiembre, ra.PresupuestoOctubre, ra.PresupuestoNoviembre, ra.PresupuestoDiciembre, 1)
|
|
ActualizaCuentaSuperior(ra.CuentaSuperior2, ra.PresupuestoEnero, ra.PresupuestoFebrero, ra.PresupuestoMarzo, ra.PresupuestoAbril, ra.PresupuestoMayo, ra.PresupuestoJunio, ra.PresupuestoJulio, ra.PresupuestoAgosto, ra.PresupuestoSeptiembre, ra.PresupuestoOctubre, ra.PresupuestoNoviembre, ra.PresupuestoDiciembre, 1)
|
|
ActualizaCuentaSuperior(ra.CuentaSuperior1, ra.PresupuestoEnero, ra.PresupuestoFebrero, ra.PresupuestoMarzo, ra.PresupuestoAbril, ra.PresupuestoMayo, ra.PresupuestoJunio, ra.PresupuestoJulio, ra.PresupuestoAgosto, ra.PresupuestoSeptiembre, ra.PresupuestoOctubre, ra.PresupuestoNoviembre, ra.PresupuestoDiciembre, 1)
|
|
End If
|
|
Case EstadosAplicacion.ModificandoRegistro
|
|
If ra.EsCuentaFinal Then
|
|
ActualizaCuentaSuperior(ra.CuentaSuperior4, ra.PresupuestoEnero, ra.PresupuestoFebrero, ra.PresupuestoMarzo, ra.PresupuestoAbril, ra.PresupuestoMayo, ra.PresupuestoJunio, ra.PresupuestoJulio, ra.PresupuestoAgosto, ra.PresupuestoSeptiembre, ra.PresupuestoOctubre, ra.PresupuestoNoviembre, ra.PresupuestoDiciembre, 1)
|
|
ActualizaCuentaSuperior(ra.CuentaSuperior3, ra.PresupuestoEnero, ra.PresupuestoFebrero, ra.PresupuestoMarzo, ra.PresupuestoAbril, ra.PresupuestoMayo, ra.PresupuestoJunio, ra.PresupuestoJulio, ra.PresupuestoAgosto, ra.PresupuestoSeptiembre, ra.PresupuestoOctubre, ra.PresupuestoNoviembre, ra.PresupuestoDiciembre, 1)
|
|
ActualizaCuentaSuperior(ra.CuentaSuperior2, ra.PresupuestoEnero, ra.PresupuestoFebrero, ra.PresupuestoMarzo, ra.PresupuestoAbril, ra.PresupuestoMayo, ra.PresupuestoJunio, ra.PresupuestoJulio, ra.PresupuestoAgosto, ra.PresupuestoSeptiembre, ra.PresupuestoOctubre, ra.PresupuestoNoviembre, ra.PresupuestoDiciembre, 1)
|
|
ActualizaCuentaSuperior(ra.CuentaSuperior1, ra.PresupuestoEnero, ra.PresupuestoFebrero, ra.PresupuestoMarzo, ra.PresupuestoAbril, ra.PresupuestoMayo, ra.PresupuestoJunio, ra.PresupuestoJulio, ra.PresupuestoAgosto, ra.PresupuestoSeptiembre, ra.PresupuestoOctubre, ra.PresupuestoNoviembre, ra.PresupuestoDiciembre, 1)
|
|
|
|
Dim bdtmp = tscGrupoSanchoToro.NuevoContexto
|
|
Dim raant = bd.cuentas.First(Function(x) x.idCuenta = ra.idCuenta)
|
|
|
|
ActualizaCuentaSuperior(ra.CuentaSuperior4, raant.PresupuestoEnero, raant.PresupuestoFebrero, raant.PresupuestoMarzo, raant.PresupuestoAbril, raant.PresupuestoMayo, raant.PresupuestoJunio, raant.PresupuestoJulio, raant.PresupuestoAgosto, raant.PresupuestoSeptiembre, raant.PresupuestoOctubre, raant.PresupuestoNoviembre, raant.PresupuestoDiciembre, -1)
|
|
ActualizaCuentaSuperior(ra.CuentaSuperior3, raant.PresupuestoEnero, raant.PresupuestoFebrero, raant.PresupuestoMarzo, raant.PresupuestoAbril, raant.PresupuestoMayo, raant.PresupuestoJunio, raant.PresupuestoJulio, raant.PresupuestoAgosto, raant.PresupuestoSeptiembre, raant.PresupuestoOctubre, raant.PresupuestoNoviembre, raant.PresupuestoDiciembre, -1)
|
|
ActualizaCuentaSuperior(ra.CuentaSuperior2, raant.PresupuestoEnero, raant.PresupuestoFebrero, raant.PresupuestoMarzo, raant.PresupuestoAbril, raant.PresupuestoMayo, raant.PresupuestoJunio, raant.PresupuestoJulio, raant.PresupuestoAgosto, raant.PresupuestoSeptiembre, raant.PresupuestoOctubre, raant.PresupuestoNoviembre, raant.PresupuestoDiciembre, -1)
|
|
ActualizaCuentaSuperior(ra.CuentaSuperior1, raant.PresupuestoEnero, raant.PresupuestoFebrero, raant.PresupuestoMarzo, raant.PresupuestoAbril, raant.PresupuestoMayo, raant.PresupuestoJunio, raant.PresupuestoJulio, raant.PresupuestoAgosto, raant.PresupuestoSeptiembre, raant.PresupuestoOctubre, raant.PresupuestoNoviembre, raant.PresupuestoDiciembre, -1)
|
|
End If
|
|
End Select
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub apCL_AntesEliminar(sender As Object, e As ItemClickEventArgs, ByRef Cancelar As Boolean, ByRef MensajesError As Hashtable, ByRef EliminacionManual As Boolean) Handles Me.AntesEliminar
|
|
|
|
Dim hte As New Hashtable
|
|
If ra.apuntes.Count > 0 Then
|
|
hte.Add("Almacenar-CUENTA_CON_APUNTES", "No se puede eliminar una cuenta que ya tiene apuntes.")
|
|
End If
|
|
If Not ra.EsCuentaFinal Then
|
|
If bd.apuntes.Any(Function(x) x.idCuentaNavigation.NumeroCuenta.StartsWith(ra.NumeroCuenta) And x.idAsientoNavigation.idEjercicio = ra.idEjercicio) Then
|
|
hte.Add("Almacenar-CUENTA_INFERIOR_CON_APUNTES", "No se puede eliminar una cuenta que ya tiene apuntes.")
|
|
End If
|
|
End If
|
|
If hte.Count = 0 And ra.EsCuentaFinal = False Then
|
|
Dim ci = bd.cuentas.Where(Function(x) x.idEjercicio = ra.idEjercicio And x.NumeroCuenta.StartsWith(ra.NumeroCuenta))
|
|
For i = ci.Count - 1 To 0 Step -1
|
|
bd.Remove(ci(i))
|
|
Next
|
|
End If
|
|
If hte.Count > 0 Then
|
|
MensajesError = hte
|
|
Cancelar = True
|
|
Else
|
|
If ra.EsCuentaFinal Then
|
|
ActualizaCuentaSuperior(ra.CuentaSuperior4, ra.PresupuestoEnero, ra.PresupuestoFebrero, ra.PresupuestoMarzo, ra.PresupuestoAbril, ra.PresupuestoMayo, ra.PresupuestoJunio, ra.PresupuestoJulio, ra.PresupuestoAgosto, ra.PresupuestoSeptiembre, ra.PresupuestoOctubre, ra.PresupuestoNoviembre, ra.PresupuestoDiciembre, -1)
|
|
ActualizaCuentaSuperior(ra.CuentaSuperior3, ra.PresupuestoEnero, ra.PresupuestoFebrero, ra.PresupuestoMarzo, ra.PresupuestoAbril, ra.PresupuestoMayo, ra.PresupuestoJunio, ra.PresupuestoJulio, ra.PresupuestoAgosto, ra.PresupuestoSeptiembre, ra.PresupuestoOctubre, ra.PresupuestoNoviembre, ra.PresupuestoDiciembre, -1)
|
|
ActualizaCuentaSuperior(ra.CuentaSuperior2, ra.PresupuestoEnero, ra.PresupuestoFebrero, ra.PresupuestoMarzo, ra.PresupuestoAbril, ra.PresupuestoMayo, ra.PresupuestoJunio, ra.PresupuestoJulio, ra.PresupuestoAgosto, ra.PresupuestoSeptiembre, ra.PresupuestoOctubre, ra.PresupuestoNoviembre, ra.PresupuestoDiciembre, -1)
|
|
ActualizaCuentaSuperior(ra.CuentaSuperior1, ra.PresupuestoEnero, ra.PresupuestoFebrero, ra.PresupuestoMarzo, ra.PresupuestoAbril, ra.PresupuestoMayo, ra.PresupuestoJunio, ra.PresupuestoJulio, ra.PresupuestoAgosto, ra.PresupuestoSeptiembre, ra.PresupuestoOctubre, ra.PresupuestoNoviembre, ra.PresupuestoDiciembre, -1)
|
|
End If
|
|
End If
|
|
End Sub
|
|
Private Sub ActualizaCuentaSuperior(cta As cuentas, Presupuesto1 As Double, Presupuesto2 As Double, Presupuesto3 As Double, Presupuesto4 As Double, Presupuesto5 As Double, Presupuesto6 As Double, Presupuesto7 As Double, Presupuesto8 As Double, Presupuesto9 As Double, Presupuesto10 As Double, Presupuesto11 As Double, Presupuesto12 As Double, Factor As Integer)
|
|
cta.PresupuestoEnero += (Presupuesto1 * Factor)
|
|
cta.PresupuestoFebrero += (Presupuesto2 * Factor)
|
|
cta.PresupuestoMarzo += (Presupuesto3 * Factor)
|
|
cta.PresupuestoAbril += (Presupuesto4 * Factor)
|
|
cta.PresupuestoMayo += (Presupuesto7 * Factor)
|
|
cta.PresupuestoJunio += (Presupuesto6 * Factor)
|
|
cta.PresupuestoJulio += (Presupuesto7 * Factor)
|
|
cta.PresupuestoAgosto += (Presupuesto8 * Factor)
|
|
cta.PresupuestoSeptiembre += (Presupuesto9 * Factor)
|
|
cta.PresupuestoOctubre += (Presupuesto10 * Factor)
|
|
cta.PresupuestoNoviembre += (Presupuesto11 * Factor)
|
|
cta.PresupuestoDiciembre += (Presupuesto12 * Factor)
|
|
End Sub
|
|
Private Sub apCL_Enlazar(Celda As EditGridCellData, Defecto As Boolean) Handles Me.Enlazar
|
|
Select Case Celda.Column.FieldName.ToLower
|
|
Case "idasiento"
|
|
Dim id As Integer = DirectCast(Me.gcApuntes.CurrentItem, apuntes).idAsiento
|
|
Dim uc As New ucDiario(id)
|
|
FuncionesDinamicas.AbrirAP(uc, OtrosParametros)
|
|
Case "numerodocumento"
|
|
Dim ap = DirectCast(Me.gcApuntes.CurrentItem, apuntes)
|
|
ucDiario.VerDocumentoApunte(bd, ap)
|
|
End Select
|
|
End Sub
|
|
|
|
Private Sub ucCuenta_DespuesGuardar(sender As Object, e As ItemClickEventArgs, OpcionGuardado As Integer) Handles Me.DespuesGuardar
|
|
_idCuenta = ra.idCuenta
|
|
End Sub
|
|
End Class
|