agregado procesos y bd clases

This commit is contained in:
2026-04-28 11:52:16 +02:00
parent 59a774c397
commit cd2e8b8530
251 changed files with 56881 additions and 49 deletions

View File

@@ -0,0 +1,96 @@
<Serializable>
Public Class DatosRecibosExportacion
Public Sub New()
End Sub
Public Sub New(Recibo As vf_recibosextendidos)
CodigoRecibo = Recibo.CodigoRecibo
NumeroPoliza = Recibo.NumeroPoliza
Tomador = Recibo.Tomador
Matricula = Recibo.Matricula
FechaEfecto = Recibo.FechaEfecto
FechaVencimiento = Recibo.FechaVencimiento
Compania = Recibo.Compania
Agente = Recibo.Agente
SubAgente = Recibo.SubAgente
Ramo = Recibo.Ramo
FechaExpedicion = Recibo.FechaExpedicion
BienesAsegurados = Recibo.BienesAsegurados
FechaBaja = Recibo.FechaBaja
CausaBaja = Recibo.CausaBaja
TipoRecibo = Recibo.TipoRecibo
TipoPago = Recibo.TipoPago
Oficina = Recibo.Oficina
PrimaNeta = Recibo.PrimaNeta
BonificacionORecargo = Recibo.BonificacionORecargo
Consorcio = Recibo.Consorcio
Impuesto = Recibo.Impuesto
RecargoExterno = Recibo.RecargoExterno
TotalRecibo = Recibo.TotalRecibo
ComisionReciboPrimaNeta = Recibo.ComisionReciboPrimaNeta
PorcentajeReciboPrimaNeta = Recibo.PorcentajeReciboPrimaNeta
TotalComision = Recibo.TotalComision
PorcentajeComisionAgente = Recibo.PorcentajeComisionAgente
ComisionAgente = Recibo.ComisionAgente
End Sub
Public Sub New(Recibo As ve_recibos)
CodigoRecibo = Recibo.CodigoRecibo
NumeroPoliza = Recibo.NumeroPoliza
Tomador = Recibo.Tomador
Matricula = Recibo.Matricula
FechaEfecto = Recibo.FechaEfecto
FechaRecepcionCia = Recibo.FechaRecepcionCia
FechaVencimiento = Recibo.FechaVencimiento
Compania = Recibo.Compania
Agente = Recibo.Agente
SubAgente = Recibo.SubAgente
Ramo = Recibo.Ramo
FechaExpedicion = Recibo.FechaExpedicion
BienesAsegurados = Recibo.BienesAsegurados
FechaBaja = Recibo.FechaBaja
CausaBaja = Recibo.CausaBaja
TipoRecibo = Recibo.TipoRecibo
TipoPago = Recibo.TipoPago
Oficina = Recibo.Oficina
PrimaNeta = Recibo.PrimaNeta
BonificacionORecargo = Recibo.BonificacionORecargo
Consorcio = Recibo.Consorcio
Impuesto = Recibo.Impuesto
RecargoExterno = Recibo.RecargoExterno
TotalRecibo = Recibo.TotalRecibo
ComisionReciboPrimaNeta = Recibo.ComisionReciboPrimaNeta
PorcentajeReciboPrimaNeta = Recibo.PorcentajeReciboPrimaNeta
TotalComision = Recibo.TotalComision
PorcentajeComisionAgente = Recibo.PorcentajeComisionAgente
ComisionAgente = Recibo.ComisionAgente
End Sub
Public Property CodigoRecibo As String
Public Property NumeroPoliza As String
Public Property Tomador As String
Public Property Matricula As String
Public Property FechaEfecto As Date
Public Property FechaRecepcionCia As Date?
Public Property FechaVencimiento As Date
Public Property Compania As String
Public Property Agente As String
Public Property SubAgente As String
Public Property Ramo As String
Public Property FechaExpedicion As Date?
Public Property BienesAsegurados As String
Public Property FechaBaja As Date?
Public Property CausaBaja As String
Public Property TipoRecibo As String
Public Property TipoPago As String
Public Property Oficina As String
Public Property PrimaNeta As Double?
Public Property BonificacionORecargo As Double?
Public Property Consorcio As Double?
Public Property Impuesto As Double?
Public Property RecargoExterno As Double?
Public Property TotalRecibo As Double?
Public Property ComisionReciboPrimaNeta As Double?
Public Property PorcentajeReciboPrimaNeta As Double?
Public Property TotalComision As Double?
Public Property PorcentajeComisionAgente As Double?
Public Property ComisionAgente As Double?
End Class

View File

@@ -0,0 +1,8 @@
Public Class Etiquetas
Public Property Campo1 As String
Public Property Campo2 As String
Public Property Campo3 As String
Public Property Campo4 As String
Public Property Campo5 As String
End Class

View File

@@ -0,0 +1,10 @@
Public Class GrupoLiquidacionCias
Property NumeroGeneracion As Double
Property FechaGeneracion As Date
Property Pagos As List(Of pagosliquidacionescias)
ReadOnly Property TotalLiquidacion As Double
Get
Return Math.Round(Pagos.Sum(Function(x) x.ImportePago), 2, MidpointRounding.AwayFromZero)
End Get
End Property
End Class

View File

@@ -0,0 +1,10 @@
Public Class PagoExtorno
Property NumeroGeneracion As Double
Property FechaGeneracion As Date
Property Pagos As List(Of vf_recibosextendidos)
ReadOnly Property TotalLiquidacion As Double
Get
Return Math.Round(Pagos.Sum(Function(x) x.TotalRecibo.Value * -1), 2, MidpointRounding.AwayFromZero)
End Get
End Property
End Class

View File

@@ -0,0 +1,77 @@
Imports bdGestionAsegasa.estadossiniestros_eiac
Imports ProcesosEIAC_V6
Public Class accionessiniestros_eiac
Public Shared Function ObtieneAccionSiniestroV6(clave As claves_accionsiniestro) As Integer?
Try
Select Case clave
Case claves_accionsiniestro.DI
Return ClavesAccionSiniestroEnum.DOCUMENTACIÓN_O_INFORMACIÓN
Case claves_accionsiniestro.EJ
Return ClavesAccionSiniestroEnum.JUDICIAL
Case claves_accionsiniestro.EP
Return ClavesAccionSiniestroEnum.PERITACIÓN
Case claves_accionsiniestro.ER
Return ClavesAccionSiniestroEnum.REPARACIÓN
Case Else
Return ClavesAccionSiniestroEnum.DESCONOCIDA
End Select
Catch ex As Exception
Return ClavesAccionSiniestroEnum.DESCONOCIDA
End Try
End Function
Public Shared Function ObtieneSituacionAccionV6(clave As claves_situacionaccion) As Integer?
Try
Select Case clave
Case claves_situacionaccion.PD
Return ClavesSituacionAccionEnum.PENDIENTE_DE_INICIO
Case claves_situacionaccion.EC
Return ClavesSituacionAccionEnum.EN_CURSO_DE_EJECUCIÓN_INICIADA
Case claves_situacionaccion.FI
Return ClavesSituacionAccionEnum.FINALIZADA
Case Else
Return ClavesSituacionAccionEnum.DESCONOCIDA
End Select
Catch ex As Exception
Return ClavesSituacionAccionEnum.DESCONOCIDA
End Try
End Function
Public Enum ClavesAccionSiniestroEnum As Integer
DOCUMENTACIÓN_O_INFORMACIÓN = 1
JUDICIAL = 2
PERITACIÓN = 3
REPARACIÓN = 4
INDEMNIZACIÓN = 5
DESCONOCIDA = 99
End Enum
Public ReadOnly Property DescripcionAccionSiniestro As String
Get
If AccionSiniestro.HasValue Then
Return DirectCast(AccionSiniestro.Value, ClavesAccionSiniestroEnum).ToString.Replace("_", " ")
Else
Return ""
End If
End Get
End Property
Public Enum ClavesSituacionAccionEnum As Integer
PENDIENTE_DE_INICIO = 1
EN_CURSO_DE_EJECUCIÓN_INICIADA = 2
FINALIZADA = 3
DESCONOCIDA = 99
End Enum
Public ReadOnly Property DescripcionSituacionAccionSiniestro As String
Get
If AccionSiniestro.HasValue Then
Return DirectCast(SituacionAccion.Value, ClavesSituacionAccionEnum).ToString.Replace("_", " ")
Else
Return ""
End If
End Get
End Property
End Class

229
guia/Extensiones/agentes.vb Normal file
View File

@@ -0,0 +1,229 @@
Imports tsl5.Extensiones
Partial Public Class agentes
Public ReadOnly Property NombreYCodigo As String
Get
Return Nombre & " - " & Codigo
End Get
End Property
Public ReadOnly Property CodigoYNombre As String
Get
Return Codigo & " - " & Nombre
End Get
End Property
Public ReadOnly Property Direccion As direcciones
Get
If Me.idDireccion.HasValue AndAlso Me.idDireccion.Value > 0 Then
Return Me.direcciones
Else
Return Nothing
End If
End Get
End Property
Private _CodigoPostalTmpEsNulo As Boolean = True
Private _CodigoPostalTmp As String
Public Property CodigoPostalTmp As String
Get
If _CodigoPostalTmpEsNulo Then
If Direccion Is Nothing Then
Return ""
Else
_CodigoPostalTmp = Me.Direccion.CodigoPostal
_CodigoPostalTmpEsNulo = False
Return Me.Direccion.CodigoPostal
End If
Else
Return _CodigoPostalTmp
End If
End Get
Set(value As String)
_CodigoPostalTmp = value
_CodigoPostalTmpEsNulo = False
If Direccion IsNot Nothing Then
Direccion.CodigoPostal = value
End If
Me.OnPropertyChanged("CodigoPostalTmp")
End Set
End Property
Private _DomicilioTmpEsNulo As Boolean = True
Private _DomicilioTmp As String
Public Property DomicilioTmp As String
Get
If _DomicilioTmpEsNulo Then
If Direccion Is Nothing Then
Return ""
Else
_DomicilioTmp = Direccion.Direccion
_DomicilioTmpEsNulo = False
Return Direccion.Direccion
End If
Else
Return _DomicilioTmp
End If
End Get
Set(value As String)
_DomicilioTmp = value
_DomicilioTmpEsNulo = False
If Direccion IsNot Nothing Then
Direccion.Direccion = value
End If
Me.OnPropertyChanged("DomicilioTmp")
End Set
End Property
Private _CodigoPoblacionTmpEsNulo As Boolean = True
Private _CodigoPoblacionTmp As String
Public Property CodigoPoblacionTmp As String
Get
If _CodigoPoblacionTmpEsNulo Then
If Direccion Is Nothing OrElse Direccion.municipios Is Nothing Then
If Direccion IsNot Nothing AndAlso Direccion.municipios Is Nothing Then
If Direccion.CodigoPostal.NothingAVacio <> "" Then
Dim bd = bdGestionAsegasa.gestionasegasaEntities.NuevoContexto
Dim pob = bd.codigospostales.FirstOrDefault(Function(x) x.CodigoPostal = Direccion.CodigoPostal)
If pob Is Nothing Then
Return "CP.ERRONEO"
Else
Direccion.CodigoMunicipio = pob.CodigoMunicipio
_CodigoPoblacionTmp = pob.CodigoMunicipio
_CodigoPoblacionTmpEsNulo = False
Return _CodigoPoblacionTmp
End If
Else
Return ""
End If
Else
Return ""
End If
Else
_CodigoPoblacionTmp = Direccion.CodigoMunicipio
_CodigoPoblacionTmpEsNulo = False
Return Direccion.CodigoMunicipio
End If
Else
Return _CodigoPoblacionTmp
End If
End Get
Set(value As String)
_CodigoPoblacionTmp = value
_CodigoPoblacionTmpEsNulo = False
If Direccion IsNot Nothing Then
Direccion.CodigoMunicipio = value
End If
Me.OnPropertyChanged("CodigoPoblacionTmp")
ProvinciaTmp = municipios.ObtieneProvincia(_CodigoPoblacionTmp)
PoblacionTmp = municipios.ObtienePoblacion(_CodigoPoblacionTmp)
End Set
End Property
Private _PoblacionTmp As String
Private _PoblacionTmpEsNulo As Boolean = True
Public Property PoblacionTmp As String
Get
If _PoblacionTmpEsNulo Then _PoblacionTmp = municipios.ObtienePoblacion(CodigoPoblacionTmp)
Return _PoblacionTmp
End Get
Set(value As String)
_PoblacionTmp = value
Me.OnPropertyChanged("PoblacionTmp")
End Set
End Property
Private _ProvinciaTmp As String
Private _ProvinciaTmpEsNulo As Boolean = True
Public Property ProvinciaTmp As String
Get
If _ProvinciaTmpEsNulo Then _ProvinciaTmp = municipios.ObtieneProvincia(CodigoPoblacionTmp)
Return _ProvinciaTmp
End Get
Set(value As String)
_ProvinciaTmp = value
Me.OnPropertyChanged("ProvinciaTmp")
End Set
End Property
Public ReadOnly Property OficinaAgente As String
Get
' Dim sPrefijoAgentes As String = "|2 |000004|000018|000023|000029|100029|"
'Dim sPrefijo = Me.Codigo.PadLeft(6, " ")
'If sPrefijoAgentes.Contains("|" & sPrefijo & "|") Then
If Me.Codigo <> "000029013008" And (Me.Codigo.StartsWith("2") Or Me.Codigo.StartsWith("000004") Or Me.Codigo.StartsWith("000018") Or Me.Codigo.StartsWith("000023") Or Me.Codigo.StartsWith("000029") Or Me.Codigo.StartsWith("100029")) Then
Return "Antequera"
Else
Return "Sevilla"
End If
End Get
End Property
Public ReadOnly Property PolizasConDocumentosPendientes As List(Of polizassg)
Get
Return Me.polizassg.Where(Function(x) (x.NumeroPoliza IsNot Nothing OrElse x.FechaAceptacionPresupuesto.HasValue) AndAlso (x.FechaDocumentosSuplementoRevisado IsNot Nothing OrElse x.NumeroSuplemento = 0 OrElse x.agentes.Codigo = "1" OrElse x.agentes.Codigo = "2") AndAlso x.documentospolizassg.Any(Function(y) y.Obligatorio AndAlso y.FechaComprobacion Is Nothing AndAlso y.idFichero Is Nothing)).ToList
End Get
End Property
Public ReadOnly Property PolizasConDocumentosPendientes7Dias As List(Of polizassg)
Get
Dim FechaInicio As Date = Date.Today.AddDays(-7)
Return Me.polizassg.Where(Function(x) x.FechaBaja.HasValue = False And (x.NumeroPoliza IsNot Nothing Or x.FechaAceptacionPresupuesto IsNot Nothing) And (x.FechaAlta >= FechaInicio And (x.FechaDocumentosSuplementoRevisado IsNot Nothing OrElse x.NumeroSuplemento = 0 Or x.agentes.Codigo = "1" Or x.agentes.Codigo = "2") And x.documentospolizassg.Any(Function(y) y.FechaComprobacion Is Nothing AndAlso y.idFichero Is Nothing AndAlso y.Obligatorio AndAlso (y.documentosasolicitar Is Nothing OrElse y.documentosasolicitar.SolicitarAAgente)))).ToList
'Return Me.polizassg.Where(Function(x) (x.FechaAlta.HasValue = False OrElse x.FechaAlta >= FechaInicio) AndAlso (x.NumeroPoliza IsNot Nothing OrElse x.FechaAceptacionPresupuesto.HasValue)).ToList.Where(Function(x) (x.FechaDocumentosSuplementoRevisado IsNot Nothing OrElse x.NumeroSuplemento = 0 OrElse x.agentes.Codigo = "1" OrElse x.agentes.Codigo = "2") And x.documentospolizassg.Any(Function(y) y.Obligatorio AndAlso y.FechaComprobacion Is Nothing AndAlso y.idFichero Is Nothing)).ToList
End Get
End Property
Public Shared Function CambiaCarteraAgente(AgenteAnterior As String, AgenteNuevo As String) As Boolean
Dim bd = bdGestionAsegasa.gestionasegasaEntities.NuevoContextoCN()
Dim idnueage = bd.agentes.First(Function(x) x.Codigo = AgenteNuevo).idAgente
Dim recs = bd.recibos.Where(Function(x) x.liquidacionesagenterecibos.Any = False And x.agentes.Codigo = AgenteAnterior).ToList
Dim tge = bdGestionAsegasa.TipoGestionEnum.CAMBIO_CARTERA_AGENTE
For Each r In recs
r.idAgente = idnueage
' r.polizassg.idAgente = idnueage
Dim tg As New bdGestionAsegasa.gestionesrecibos
With tg
.idRecibo = r.idRecibo
.FormaComunicacion = 4
.Tipo = tge
.GestionesRealizadas = tge.ToString.Replace("_", " ")
.Fecha = Now
.idCorreo = Nothing
.Observaciones = "Cambio Cartera Agente del " & AgenteAnterior & " al " & AgenteNuevo
End With
bd.gestionesrecibos.AddObject(tg)
Next
bd.SaveChanges()
Dim tgp = bd.enumeraciones.First(Function(x) x.Codigo = "TGP.CAMCARAG")
Dim idtgp = tgp.idEnumeracion
Dim pols = bd.polizassg.Where(Function(x) x.agentes.Codigo = AgenteAnterior And x.FechaBaja.HasValue = False)
For Each p In pols
p.idAgente = idnueage
Dim tg As New bdGestionAsegasa.gestionespolizassg
With tg
.idPoliza = p.idPoliza
.idTipo = idtgp
.GestionesRealizadas = tgp.Descripcion
.Fecha = Now
.Observaciones = "Cambio Cartera Agente del " & AgenteAnterior & " al " & AgenteNuevo
End With
bd.gestionespolizassg.AddObject(tg)
Next
bd.SaveChanges()
Dim ageant = bd.agentes.First(Function(x) x.Codigo = AgenteAnterior)
Dim bbaja As Boolean
If ageant.FechaBaja.HasValue = False Then
ageant.FechaBaja = Now
bbaja = True
Else
bbaja = False
End If
bd.SaveChanges()
Return bbaja
End Function
End Class

View File

@@ -0,0 +1,41 @@
partial Public Class amortizacionrecibos
Public ReadOnly Property Tomador As String
Get
Return Me.recibos.polizassg.Tomador.RazonSocial
End Get
End Property
Public ReadOnly Property Compania As String
Get
Return Me.recibos.polizassg.companias.Nombre
End Get
End Property
Public ReadOnly Property Ramo As String
Get
Return Me.recibos.polizassg.ramos.Descripcion
End Get
End Property
End Class
Public Class ve_amortizacionrecibos
Public Property idAmortizacion As Integer
Public Property idRecibo As Integer?
Public Property FechaInicioAmortizacion As Date
Public Property FechaFinAmortizacion As Date
Public Property PorcentajeAnual As Integer?
Public Property FechaBaja As Date?
Public Property idMotivoBaja As Integer?
Public Property idEmpresa As Integer
Public Property NumeroCuenta As String
Public Property Observaciones As String
Public Property FechaAlta As Date?
Public Property CodigoRecibo As String
Public Property TotalRecibo As Double
Public Property Ramo As String
Public Property Compañía As String
Public Property Tomador As String
Public Property CIFTomador As String
Public Property CausaBaja As String
Public Property Empresa As String
End Class

109
guia/Extensiones/apuntes.vb Normal file
View File

@@ -0,0 +1,109 @@
Partial Public Class apuntes
Private _NumeroCuentaTmp As String
Public Property NumeroCuentaTmp As String
Get
Return _NumeroCuentaTmp
End Get
Set(value As String)
_NumeroCuentaTmp = value
OnPropertyChanged("NumeroCuentaTmp")
End Set
End Property
Public Property SaldoCuentaTmp As Double
Public Property DescripcionCuentaTmp As String
Public Shared Sub EstableceSaldoTmp(lap As List(Of apuntes))
Dim SaldoAnterior As Double = 0
For Each ap In lap
SaldoAnterior = SaldoAnterior + ap.Debe - ap.Haber
ap.SaldoCuentaTmp = SaldoAnterior
Next
End Sub
Public Enum TiposDocumentos
RECIBO = 1
FACTURA = 2
OTRO = 99
End Enum
Public Shared Function ListaTiposDocumentos() As List(Of Tipo)
Dim lEstados As New List(Of Tipo)
For Each Enumeracion As TiposDocumentos In System.Enum.GetValues(GetType(TiposDocumentos))
lEstados.Add(New Tipo With {.id = CInt(Enumeracion), .Descripcion = Enumeracion.ToString.Replace("_", " ")})
Next
Return lEstados
End Function
Public Function DebeAnterior(bd As bdGestionAsegasa.gestionasegasaEntities, Fecha As Date) As Double
Try
Dim aps = bd.apuntes.Where(Function(X) X.idCuenta = Me.idCuenta And X.asientos.Fecha < Fecha).ToList
Return aps.Sum(Function(x) x.Debe)
Catch ex As Exception
Throw New Exception(ex.Message, ex)
End Try
End Function
Public Function HaberAnterior(bd As bdGestionAsegasa.gestionasegasaEntities, Fecha As Date) As Double
Try
Dim aps = bd.apuntes.Where(Function(X) X.idCuenta = Me.idCuenta And X.asientos.Fecha < Fecha).ToList
Return aps.Sum(Function(x) x.Haber)
Catch ex As Exception
Throw New Exception(ex.Message, ex)
End Try
End Function
Public ReadOnly Property Saldo As Double
Get
Return Math.Round(Debe - Haber, 2)
End Get
End Property
Private _Conciliado As Boolean?
Public Property Conciliado As Boolean
Get
If _Conciliado.HasValue Then
Return _Conciliado
Else
If ConciliacionActual_TMP IsNot Nothing Then
If ConciliacionActual_TMP.idconciliacion <> Me.idConciliacion Then
Return False
Else
Return Me.idConciliacion.HasValue
End If
Else
Return Me.idConciliacion.HasValue
End If
End If
End Get
Set(value As Boolean)
_Conciliado = value
If value Then
Me.conciliacionesbancarias = Me.ConciliacionActual_TMP
Else
Me.idConciliacion = Nothing
End If
End Set
End Property
Public Property ConciliacionActual_TMP As conciliacionesbancarias
Public ReadOnly Property ConciliadoEn As String
Get
If ConciliacionActual_TMP IsNot Nothing AndAlso Me.idConciliacion.HasValue AndAlso Me.idConciliacion <> ConciliacionActual_TMP.idconciliacion Then
Return "Nº Conc.: " & Me.idConciliacion & " (" & Me.conciliacionesbancarias.Año.ToString & "-" & Me.conciliacionesbancarias.Mes.ToString & ")"
Else
Return ""
End If
End Get
End Property
Public ReadOnly Property Diferencia As Double
Get
Return Debe - Haber
End Get
End Property
End Class
Public Class Tipo
Property id As Integer
Property Descripcion As String
End Class

View File

@@ -0,0 +1,506 @@
Imports System.Data.Objects
Imports tsl5.Extensiones
Partial Public Class asientos
Public Enum TipoAsiento As Integer
NORMAL = 0
APERTURA = 1
REGULARIZACION = 2
End Enum
Public ReadOnly Property Cuentas As String
Get
If Me.apuntes.Count > 10 Then
Return "** MÁS DE 10 **"
Else
Dim sCuentas As String = ""
For Each ap In Me.apuntes
sCuentas &= ap.cuentas.NumeroCuenta & " "
Next
Return sCuentas.Trim
End If
End Get
End Property
Public ReadOnly Property Documentos As String
Get
Dim sDocumentos As String = ""
For Each ap In Me.apuntes.ToList.Where(Function(x) x.NumeroDocumento IsNot Nothing AndAlso x.NumeroDocumento <> "").GroupBy(Function(x) x.NumeroDocumento)
sDocumentos &= ap.First.NumeroDocumento & " "
Next
Return sDocumentos.Trim
End Get
End Property
Public ReadOnly Property Conceptos As String
Get
Dim sDocumentos As String = ""
For Each ap In Me.apuntes.ToList.GroupBy(Function(x) x.Concepto)
sDocumentos &= ap.First.Concepto & " "
Next
Return sDocumentos.Trim
End Get
End Property
Public ReadOnly Property idAsiento_Nulable As Integer?
Get
If Me.idAsiento = 0 Then
Return Nothing
Else
Return Me.idAsiento
End If
End Get
End Property
Public Sub RellenaCuentaTmp()
For Each ap In Me.apuntes
ap.NumeroCuentaTmp = ap.cuentas.NumeroCuenta
ap.DescripcionCuentaTmp = ap.cuentas.Denominacion
Next
End Sub
'Public Sub EstableceNumeroAsiento(bd As gestionasegasaEntities)
' If Me.NumeroAsiento.HasValue = False Then
' Dim ua = bd.asientos.Where(Function(x) x.Tipo = Me.Tipo And x.Fecha.Year = Me.Fecha.Year).OrderByDescending(Function(x) x.NumeroAsiento).FirstOrDefault
' Dim Nuevo As Integer
' If ua IsNot Nothing Then
' Nuevo = ua.NumeroAsiento.Value + 1
' Else
' Nuevo = 1
' End If
' Me.NumeroAsiento = Nuevo
' End If
'End Sub
Public Shared Sub GeneraAsientoRecibosContado(bd As gestionasegasaEntities, Recibos As List(Of vf_recibosextendidos), DelegadoError As tsWPF.Comun.ErrorNoControlado)
Dim Hoy = tsl5.bbdd.AhoraSqlServer(bd).Date
Dim ej = bd.ejercicioscontables.FirstOrDefault(Function(x) x.FechaInicio <= Hoy And x.FechaFin >= Hoy And x.FechaCierre.HasValue = False)
If ej Is Nothing Then ej = bdGestionAsegasa.ejercicioscontables.AbreEjercicio(bd, Hoy)
Dim idTiporem = bd.enumeraciones.First(Function(x) x.Codigo = "TIPREM.CO").idEnumeracion
Dim tipospagos = bd.enumeraciones.Where(Function(x) x.gruposenumeraciones.Grupo = "TIPP").ToList
Dim idSituacion = bd.enumeraciones.First(Function(x) x.Codigo = "SITR.PA").idEnumeracion
Dim Cont = bd.enumeraciones.First(Function(x) x.Codigo = "CONT.NUMGEN")
Dim Conceps = bd.conceptosapuntes.ToList
Cont.ValorNumerico1 += 1
Dim remesa As New remesas
With remesa
.IBAN = ""
.FechaCreacion = Now
.Fecha = Hoy
.idTipo = idTiporem
End With
bd.remesas.AddObject(remesa)
bd.SaveChanges()
Dim numgenerados As Integer
Dim numerrores As Integer
Dim sRecibosConErrores As String = ""
Dim lrg As New List(Of vf_recibosextendidos)
For Each recibo In Recibos
Dim r = bd.recibos.First(Function(x) x.idRecibo = recibo.idRecibo)
Try
GeneraAsientoReciboContado(bd, r, tipospagos, Conceps, idSituacion, remesa, Cont.ValorNumerico1)
lrg.Add(recibo)
numgenerados += 1
Catch EX As Exception
sRecibosConErrores &= recibo.CodigoRecibo & vbNewLine
numerrores += 1
DelegadoError.Invoke("GeneraAsientoRecibosContado", EX)
End Try
Next
Dim sDestinatarios = bd.enumeraciones.First(Function(X) X.Codigo = "CONF.EMAILCONTA").ValorAlfabeticoLargo
Dim cta = bd.cuentascorreo.First(Function(x) x.Codigo = "SEG.GENERALES")
Dim f() As Byte = Nothing
If lrg.Count > 0 Then
Dim lr = lrg.Select(Function(x) New With {.CodigoRecibo = x.CodigoRecibo, .NumeroPoliza = x.NumeroPoliza, .NumeroSuplemento = x.NumeroSuplemento, .Tomador = x.Tomador, .BinesAsegurados = x.BienesAsegurados, .Ramo = x.Ramo, .Compañia = x.Compania}).ToList
f = tsWPF.Utilidades.Varias.IEnumerableAExcel(lr)
End If
Dim sCuerpo As String = ""
If numgenerados > 0 Then sCuerpo = "Adjunto le remitimos listado de recibos marcados como remesados (Contado)"
If numerrores > 0 Then
sCuerpo &= vbCrLf & "Los siguientes recibos no pudieron ser marcados como remesados correctamente: " & vbCrLf & sRecibosConErrores
End If
If numgenerados > 0 Then
bdGestionAsegasa.correos.GeneraRegistroCorreoConAdjunto(Nothing, "Se han marcado " & numgenerados.ToString & " Recibos como remesados (Contado)", sCuerpo, cta, f, "Pagos-" & Now.ToString("yyyy-MM-dd") & ".xlsx", "Listado Recibos de con fecha de pago " & Now.ToString("yyyy-MM-dd"), sDestinatarios,, "sevilla@tecnosis.net")
Else
bdGestionAsegasa.correos.GeneraRegistroCorreo(Nothing, "Los siguientes recibos no pudieron ser marcados como remesados (Contado)", sCuerpo, cta, sDestinatarios,, "sevilla@tecnosis.net")
End If
End Sub
Public Shared Sub GeneraAsientoReciboContado(bd As gestionasegasaEntities, Recibo As recibos, TiposPago As List(Of enumeraciones), Conceptos As List(Of conceptosapuntes), idSituacion As Integer, Remesa As remesas, NumeroGeneracion As Integer, Optional Inverso As Boolean = False)
Try
Dim Tipp = TiposPago.First(Function(x) x.idEnumeracion = Recibo.idTipoPago).Codigo.Split(".")(1)
Dim ent = Recibo.polizassg.EntidadPolizaTomador.entidades
Dim na As New asientos
bd.asientos.AddObject(na)
With na
If Inverso Then
.Fecha = Today 'Recibo.FechaBaja.Value
Else
.Fecha = Recibo.FechaPago.Value
End If
.idEjercicio = ejercicioscontables.ObtieneidEjercicioAbierto(.Fecha)
.Tipo = bdGestionAsegasa.asientos.TipoAsiento.NORMAL
.FechaIntroduccion = Now
If bdGestionAsegasa.Utilidades.dsc.idUsuario > 0 Then .idUsuario = bdGestionAsegasa.Utilidades.dsc.idUsuario
End With
Dim nap1 As New apuntes
With nap1
.asientos = na
.Concepto = ent.RazonSocial
.NumeroDocumento = Recibo.idRecibo
Dim Cta As String
Select Case Tipp
Case "PE"
If ent.CuentaContable.NothingAVacio = "" Then Throw New Exception("La entidad " & ent.RazonSocial & " no tiene asignada una cuenta contable")
Cta = ent.CuentaContable
.idConcepto = Conceptos.First(Function(x) x.Codigo = "029").idConcepto
Case "CO"
If Recibo.OficinaAgente.ToUpper = "SEVILLA" Then
Cta = "57000000"
Else
Cta = "57000002"
End If
If Recibo.TotalRecibo.Value > 0 Then
.idConcepto = Conceptos.First(Function(x) x.Codigo = "015").idConcepto
Else
.idConcepto = Conceptos.First(Function(x) x.Codigo = "029").idConcepto
End If
'Case "CGP"
' Cta = "57000000"
' .idConcepto = Conceptos.First(Function(x) x.Codigo = "015").idConcepto
' .Concepto = "GIRO " & ent.RazonSocial
Case "CTA"
If Recibo.TotalRecibo.Value > 0 Then
Cta = "57000001"
.idConcepto = Conceptos.First(Function(x) x.Codigo = "016").idConcepto
Else
Cta = "57200004"
.idConcepto = Conceptos.First(Function(x) x.Codigo = "029").idConcepto
End If
.Concepto = "TRF. " & ent.RazonSocial
Case "CTR"
Cta = "57200004"
.idConcepto = Conceptos.First(Function(x) x.Codigo = "015").idConcepto
.Concepto = "TRANS. " & ent.RazonSocial
Case "CIN"
Cta = "57200004"
.idConcepto = Conceptos.First(Function(x) x.Codigo = "015").idConcepto
.Concepto = "TPV. " & ent.RazonSocial
Case Else
Throw New Exception("Tipo de pago " & Tipp & " no soportado")
End Select
Dim cuenta = bd.cuentas.FirstOrDefault(Function(x) x.NumeroCuenta = Cta And x.idEjercicio = na.idEjercicio)
If cuenta Is Nothing Then
Dim ctaant = bd.cuentas.Where(Function(x) x.NumeroCuenta = Cta).OrderByDescending(Function(x) x.ejercicioscontables.FechaInicio).FirstOrDefault
If ctaant IsNot Nothing Then cuenta = bdGestionAsegasa.cuentas.CreaCuenta(bd, na.idEjercicio, Cta, ctaant.Denominacion, ctaant.Observaciones)
End If
If cuenta Is Nothing Then Throw New Exception("No existe la cuenta " & Cta & " para el recibo " & Recibo.CodigoRecibo)
.cuentas = cuenta
If Inverso Then
.Haber = Recibo.TotalRecibo.Value
.Debe = 0
Else
.Haber = 0
.Debe = Recibo.TotalRecibo.Value
End If
End With
na.apuntes.Add(nap1)
Dim nap2 As New apuntes
With nap2
.asientos = na
Dim Cta As String = "4400" & Recibo.polizassg.companias.Codigo
.idCuenta = bd.cuentas.First(Function(x) x.NumeroCuenta = Cta And x.idEjercicio = na.idEjercicio).idCuenta
If Inverso Then
.Haber = 0
.Debe = Math.Round(Recibo.TotalRecibo.Value, 2, MidpointRounding.AwayFromZero)
Else
.Debe = 0
.Haber = Math.Round(Recibo.TotalRecibo.Value, 2, MidpointRounding.AwayFromZero)
End If
.Concepto = ent.RazonSocial
.idConcepto = Conceptos.First(Function(X) X.Codigo = "005").idConcepto
.NumeroDocumento = Recibo.idRecibo
End With
na.apuntes.Add(nap2)
na.Importe = na.apuntes.Sum(Function(x) x.Debe)
Recibo.idRemesa = Remesa.idRemesa
Recibo.idSituacion = idSituacion
bd.SaveChanges()
Dim Ahora = tsl5.bbdd.AhoraMysql(bd)
'Dim reglc As New registrosactualizados
'With reglc
' .Tipo = "ASIENTOS"
' .idAplicacion = na.idAsiento
' .MacroAct = "ASICONMYSQL"
' .NumeroGeneracion = NumeroGeneracion
' ' .FechaCreacion = Ahora
'End With
'bd.registrosactualizados.AddObject(reglc)
'bd.SaveChanges()
'' Recibo.idAsientoRemesaOContado = na.idAsiento
'Dim reg As New registrosactualizados
'With reg
' .Tipo = "RECIBOS"
' .idAplicacion = Recibo.idRecibo
' .MacroAct = "ASICONMYSQL"
' .NumeroGeneracion = NumeroGeneracion
' ' .FechaCreacion = Ahora
'End With
'bd.registrosactualizados.AddObject(reg)
'bd.SaveChanges()
If Tipp = "PE" AndAlso nap1.cuentas.idEmpresaAmortizacion.HasValue Then
If Not Inverso Then
Dim Amr As New amortizacionrecibos
With Amr
Dim iUltimoMes As Integer = 0
Dim ud = bd.detallesamortizacionrecibos.Where(Function(x) x.FechaAplicacion.HasValue).OrderByDescending(Function(x) x.FechaAplicacion).FirstOrDefault
If ud IsNot Nothing Then iUltimoMes = ud.Mes
Dim iMesPago = Recibo.FechaPago.Value.Year * 100 + Recibo.FechaPago.Value.Month
If iUltimoMes >= iMesPago Then
.FechaInicioAmortizacion = New Date(iUltimoMes \ 100, iUltimoMes Mod 100, 1).AddMonths(1)
Else
.FechaInicioAmortizacion = Recibo.FechaPago
End If
.idRecibo = Recibo.idRecibo
.PorcentajeAnual = 100
.idEmpresa = nap1.cuentas.idEmpresaAmortizacion
.FechaFinAmortizacion = (New Date(.FechaInicioAmortizacion.Year, .FechaInicioAmortizacion.Month, 1)).AddMonths(12)
.NumeroCuenta = nap1.cuentas.NumeroCuenta
.FechaAlta = Now
Dim FechaInicial = New Date(.FechaInicioAmortizacion.Year, .FechaInicioAmortizacion.Month, 1)
For i = 0 To 11
Dim amrd As New detallesamortizacionrecibos
Amr.detallesamortizacionrecibos.Add(amrd)
amrd.Mes = FechaInicial.AddMonths(i).Year * 100 + FechaInicial.AddMonths(i).Month
If i < 11 Then
amrd.ValorAmortizado = Math.Round(Recibo.TotalRecibo.Value / 12, 2, MidpointRounding.AwayFromZero)
amrd.ValorAcumulado = Math.Round(Recibo.TotalRecibo.Value / 12 * (i + 1), 2, MidpointRounding.AwayFromZero)
amrd.ValorResidual = Math.Round(Recibo.TotalRecibo.Value - amrd.ValorAcumulado, 2, MidpointRounding.AwayFromZero)
Else
amrd.ValorAmortizado = Math.Round(Recibo.TotalRecibo.Value - Amr.detallesamortizacionrecibos.Sum(Function(x) x.ValorAmortizado), 2, MidpointRounding.AwayFromZero)
amrd.ValorAcumulado = Recibo.TotalRecibo.Value
amrd.ValorResidual = 0
End If
Next
End With
bd.amortizacionrecibos.AddObject(Amr)
End If
bd.SaveChanges()
Dim apas = New aplicacionesasientos
With apas
.idAplicacion = Recibo.idRecibo
If Inverso Then
.Tipo = Enums.TipoAplicacionAsientoEnum.RECIBO_BAJA_TIPO_PAGO_PE
Else
.Tipo = Enums.TipoAplicacionAsientoEnum.RECIBO_CONTABILIZACION_PAGO_CONTADO
End If
.idAsiento = na.idAsiento
End With
bd.aplicacionesasientos.AddObject(apas)
bd.SaveChanges()
End If
bd.ExecuteStoreCommand("UPDATE registrosactualizados SET FechaCreacion=Now() where FechaCreacion Is null and NumeroGeneracion=" & NumeroGeneracion.ToString & ";")
Catch ex As Exception
Throw New Exception(ex.Message, ex)
End Try
End Sub
Public Shared Function GeneraAsientoReciboPagadoEnCiaYaFacturado(bd As gestionasegasaEntities, Recibo As recibos, idEjercicio As Integer) As asientos
Try
Dim ent = Recibo.polizassg.EntidadPolizaTomador.entidades
Dim na As New asientos
bd.asientos.AddObject(na)
With na
.Fecha = Today
.idEjercicio = idEjercicio
.Tipo = bdGestionAsegasa.asientos.TipoAsiento.NORMAL
.FechaIntroduccion = Now
If bdGestionAsegasa.Utilidades.dsc.idUsuario > 0 Then .idUsuario = bdGestionAsegasa.Utilidades.dsc.idUsuario
End With
Dim nap1 As New apuntes
With nap1
.asientos = na
.Concepto = "RECIBO PAGADO EN CIA (DESFACTURACION) " & ent.RazonSocial
.NumeroDocumento = Recibo.idRecibo
Dim Cta As String = "4400" & Recibo.polizassg.companias.Codigo
Dim cuenta = ObtieneCuenta(bd, Cta, idEjercicio)
.cuentas = cuenta
.Haber = Math.Round(Recibo.TotalRecibo.Value, 2, MidpointRounding.AwayFromZero)
.Debe = 0
End With
na.apuntes.Add(nap1)
Dim nap2 As New apuntes
With nap2
.asientos = na
Dim Cta As String = "4190" & Recibo.polizassg.companias.Codigo
Dim cuenta = ObtieneCuenta(bd, Cta, idEjercicio)
.cuentas = cuenta
.Debe = Math.Round(Recibo.TotalRecibo.Value - Recibo.TotalComision.Value, 2, MidpointRounding.AwayFromZero)
.Haber = 0
.Concepto = "RECIBO PAGADO EN CIA (DESFACTURACION)" & ent.RazonSocial
.NumeroDocumento = Recibo.idRecibo
End With
na.apuntes.Add(nap2)
Dim nap3 As New apuntes
With nap3
.asientos = na
Dim Cta As String = "7050" & Recibo.polizassg.companias.Codigo
Dim cuenta = ObtieneCuenta(bd, Cta, idEjercicio)
.cuentas = cuenta
.Debe = Math.Round(Recibo.TotalComision.Value, 2, MidpointRounding.AwayFromZero)
.Haber = 0
.Concepto = "RECIBO PAGADO EN CIA (DESFACTURACION)" & ent.RazonSocial
.NumeroDocumento = Recibo.idRecibo
End With
na.apuntes.Add(nap3)
Dim nap4 As New apuntes
With nap4
.asientos = na
.Concepto = "RECIBO PAGADO EN CIA " & ent.RazonSocial
.NumeroDocumento = Recibo.idRecibo
Dim Cta As String = "4190" & Recibo.polizassg.companias.Codigo
Dim cuenta = ObtieneCuenta(bd, Cta, idEjercicio)
.cuentas = cuenta
.Haber = 0
.Debe = Math.Round(Recibo.TotalComision.Value, 2, MidpointRounding.AwayFromZero)
End With
na.apuntes.Add(nap4)
Dim nap5 As New apuntes
With nap5
.asientos = na
Dim Cta As String = "7050" & Recibo.polizassg.companias.Codigo
Dim cuenta = ObtieneCuenta(bd, Cta, idEjercicio)
.cuentas = cuenta
.Debe = 0
.Haber = Math.Round(Recibo.TotalComision.Value, 2, MidpointRounding.AwayFromZero)
.Concepto = "RECIBO PAGADO EN CIA " & ent.RazonSocial
.NumeroDocumento = Recibo.idRecibo
End With
na.apuntes.Add(nap5)
na.Importe = na.apuntes.Sum(Function(x) x.Debe)
bd.SaveChanges()
Dim apas = New aplicacionesasientos
With apas
.idAplicacion = Recibo.idRecibo
.Tipo = Enums.TipoAplicacionAsientoEnum.RECIBO_PAGADO_EN_CIA
.idAsiento = na.idAsiento
End With
bd.aplicacionesasientos.AddObject(apas)
bd.SaveChanges()
Return na
Catch ex As Exception
Throw New Exception(ex.Message, ex)
End Try
End Function
Public Shared Function GeneraAsientoReciboPagadoEnCia(bd As gestionasegasaEntities, Recibo As recibos) As asientos
Try
Dim ej = bd.ejercicioscontables.FirstOrDefault(Function(x) x.FechaInicio <= Today And x.FechaFin >= Today And x.FechaCierre.HasValue = False)
If ej Is Nothing Then ej = bdGestionAsegasa.ejercicioscontables.AbreEjercicio(bd, Today)
Dim ent = Recibo.polizassg.EntidadPolizaTomador.entidades
Dim na As New asientos
bd.asientos.AddObject(na)
With na
.Fecha = Today
.idEjercicio = ej.idEjercicio
.Tipo = bdGestionAsegasa.asientos.TipoAsiento.NORMAL
.FechaIntroduccion = Now
If bdGestionAsegasa.Utilidades.dsc.idUsuario > 0 Then .idUsuario = bdGestionAsegasa.Utilidades.dsc.idUsuario
End With
Dim nap1 As New apuntes
With nap1
.asientos = na
.Concepto = "RECIBO PAGADO EN CIA " & ent.RazonSocial
.NumeroDocumento = Recibo.idRecibo
Dim Cta As String = "4190" & Recibo.polizassg.companias.Codigo
Dim cuenta = ObtieneCuenta(bd, Cta, ej.idEjercicio)
.cuentas = cuenta
.Haber = 0
.Debe = Math.Round(Recibo.TotalComision.Value, 2, MidpointRounding.AwayFromZero)
End With
na.apuntes.Add(nap1)
Dim nap2 As New apuntes
With nap2
.asientos = na
Dim Cta As String = "7050" & Recibo.polizassg.companias.Codigo
Dim cuenta = ObtieneCuenta(bd, Cta, ej.idEjercicio)
.cuentas = cuenta
.Debe = 0
.Haber = Math.Round(Recibo.TotalComision.Value, 2, MidpointRounding.AwayFromZero)
.Concepto = "RECIBO PAGADO EN CIA " & ent.RazonSocial
.NumeroDocumento = Recibo.idRecibo
End With
na.apuntes.Add(nap2)
na.Importe = Math.Round(na.apuntes.Sum(Function(x) x.Debe), 2, MidpointRounding.AwayFromZero)
bd.SaveChanges()
Dim apas = New aplicacionesasientos
With apas
.idAplicacion = Recibo.idRecibo
.Tipo = Enums.TipoAplicacionAsientoEnum.RECIBO_PAGADO_EN_CIA
.idAsiento = na.idAsiento
End With
bd.aplicacionesasientos.AddObject(apas)
bd.SaveChanges()
Return na
Catch ex As Exception
Throw New Exception(ex.Message, ex)
End Try
End Function
Public Sub RefrescaExtensiones()
OnPropertyChanged("EjercicioTmp")
OnPropertyChanged("idAsiento_Nulable")
End Sub
Public Shared Function ObtieneCuenta(bd As gestionasegasaEntities, cta As String, idEjercicio As Integer) As cuentas
Dim cuenta = bd.cuentas.FirstOrDefault(Function(x) x.NumeroCuenta = cta And x.idEjercicio = idEjercicio)
If cuenta Is Nothing Then
Dim ctaant = bd.cuentas.Where(Function(x) x.NumeroCuenta = cta).OrderByDescending(Function(x) x.ejercicioscontables.FechaInicio).FirstOrDefault
If ctaant IsNot Nothing Then cuenta = bdGestionAsegasa.cuentas.CreaCuenta(bd, idEjercicio, cta, ctaant.Denominacion, ctaant.Observaciones)
End If
Return cuenta
End Function
Public Property Punteado As Boolean
Get
Return FechaPunteo.HasValue
End Get
Set(value As Boolean)
If value Then
FechaPunteo = Now
Else
FechaPunteo = Nothing
End If
End Set
End Property
Private _Ejercicio As String
Public Property EjercicioTmp As String
Get
If _Ejercicio = "" AndAlso ejercicioscontables IsNot Nothing Then
_Ejercicio = ejercicioscontables.Descripcion
End If
Return _Ejercicio
End Get
Set(value As String)
_Ejercicio = value
OnPropertyChanged("EjercicioTmp")
End Set
End Property
End Class

View File

@@ -0,0 +1,6 @@
Partial Public Class cajas
Public Enum TipoCaja
METALICO = 0
BANCO = 1
End Enum
End Class

View File

@@ -0,0 +1,12 @@
Public Class codigospostales
Public ReadOnly Property NombreMunicipio As String
Get
If DescripcionAdicional IsNot Nothing AndAlso DescripcionAdicional <> "" Then
Return DescripcionAdicional & " (" & Me.municipios.Nombre & ")"
Else
Return Me.municipios.Nombre
End If
End Get
End Property
End Class

View File

@@ -0,0 +1,3 @@
Public Class comisionesagentes
Public Property AEliminar As Boolean
End Class

View File

@@ -0,0 +1,165 @@
Imports tsl5.Extensiones
Partial Public Class companias
Public ReadOnly Property Direccion As direcciones
Get
If Me.idDireccion.HasValue AndAlso Me.idDireccion.Value > 0 Then
Return Me.direcciones
Else
Return Nothing
End If
End Get
End Property
Private _CodigoPostalTmpEsNulo As Boolean = True
Private _CodigoPostalTmp As String
Public Property CodigoPostalTmp As String
Get
If _CodigoPostalTmpEsNulo Then
If Direccion Is Nothing Then
Return ""
Else
_CodigoPostalTmp = Me.Direccion.CodigoPostal
_CodigoPostalTmpEsNulo = False
Return Me.Direccion.CodigoPostal
End If
Else
Return _CodigoPostalTmp
End If
End Get
Set(value As String)
_CodigoPostalTmp = value
_CodigoPostalTmpEsNulo = False
If Direccion IsNot Nothing Then
Direccion.CodigoPostal = value
End If
Me.OnPropertyChanged("CodigoPostalTmp")
End Set
End Property
Private _DomicilioTmpEsNulo As Boolean = True
Private _DomicilioTmp As String
Public Property DomicilioTmp As String
Get
If _DomicilioTmpEsNulo Then
If Direccion Is Nothing Then
Return ""
Else
_DomicilioTmp = Direccion.Direccion
_DomicilioTmpEsNulo = False
Return Direccion.Direccion
End If
Else
Return _DomicilioTmp
End If
End Get
Set(value As String)
_DomicilioTmp = value
_DomicilioTmpEsNulo = False
If Direccion IsNot Nothing Then
Direccion.Direccion = value
End If
Me.OnPropertyChanged("DomicilioTmp")
End Set
End Property
Private _CodigoPoblacionTmpEsNulo As Boolean = True
Private _CodigoPoblacionTmp As String
Public Property CodigoPoblacionTmp As String
Get
If _CodigoPoblacionTmpEsNulo Then
If Direccion Is Nothing OrElse Direccion.municipios Is Nothing Then
If Direccion IsNot Nothing AndAlso Direccion.municipios Is Nothing Then
If Direccion.CodigoPostal.NothingAVacio <> "" Then
Dim bd = bdGestionAsegasa.gestionasegasaEntities.NuevoContexto
Dim pob = bd.codigospostales.FirstOrDefault(Function(x) x.CodigoPostal = Direccion.CodigoPostal)
If pob Is Nothing Then
Return "CP.ERRONEO"
Else
Direccion.CodigoMunicipio = pob.CodigoMunicipio
_CodigoPoblacionTmp = pob.CodigoMunicipio
_CodigoPoblacionTmpEsNulo = False
Return _CodigoPoblacionTmp
End If
Else
Return ""
End If
Else
Return ""
End If
Else
_CodigoPoblacionTmp = Direccion.CodigoMunicipio
_CodigoPoblacionTmpEsNulo = False
Return Direccion.CodigoMunicipio
End If
Else
Return _CodigoPoblacionTmp
End If
End Get
Set(value As String)
_CodigoPoblacionTmp = value
_CodigoPoblacionTmpEsNulo = False
If Direccion IsNot Nothing Then
Direccion.CodigoMunicipio = value
End If
Me.OnPropertyChanged("CodigoPoblacionTmp")
ProvinciaTmp = municipios.ObtieneProvincia(_CodigoPoblacionTmp)
PoblacionTmp = municipios.ObtienePoblacion(_CodigoPoblacionTmp)
End Set
End Property
Private _PoblacionTmp As String
Private _PoblacionTmpEsNulo As Boolean = True
Public Property PoblacionTmp As String
Get
If _PoblacionTmpEsNulo Then _PoblacionTmp = municipios.ObtienePoblacion(CodigoPoblacionTmp)
Return _PoblacionTmp
End Get
Set(value As String)
_PoblacionTmp = value
Me.OnPropertyChanged("PoblacionTmp")
End Set
End Property
Private _ProvinciaTmp As String
Private _ProvinciaTmpEsNulo As Boolean = True
Public Property ProvinciaTmp As String
Get
If _ProvinciaTmpEsNulo Then _ProvinciaTmp = municipios.ObtieneProvincia(CodigoPoblacionTmp)
Return _ProvinciaTmp
End Get
Set(value As String)
_ProvinciaTmp = value
Me.OnPropertyChanged("ProvinciaTmp")
End Set
End Property
Public ReadOnly Property DescripcionFormaLiquidacion As String
Get
Return DirectCast(Me.FormaLiquidacion, FormaLiquidacionEnum).ToString
End Get
End Property
Public ReadOnly Property CodigoNombre As String
Get
Return Me.Codigo & " " & Me.Nombre
End Get
End Property
Public Enum FormaLiquidacionEnum
TRANSFERENCIA = 0
RECIBO = 1
End Enum
Public Shared Function ListadoFormaLiquidacion() As List(Of FormaLiquidacion)
Dim listFormaLiquidacion As New List(Of FormaLiquidacion)
For Each Enumeracion As FormaLiquidacionEnum In System.Enum.GetValues(GetType(FormaLiquidacionEnum))
listFormaLiquidacion.Add(New FormaLiquidacion With {.id = CInt(Enumeracion), .Descripcion = Enumeracion.ToString})
Next
Return listFormaLiquidacion
End Function
End Class
Public Class FormaLiquidacion
Property id As Integer
Property Descripcion As String
End Class

View File

@@ -0,0 +1,58 @@
Public Class conciliacionesbancarias
Public ReadOnly Property ImporteExtractosConciliados As Double
Get
Return Me.movimientosbancarios.Sum(Function(x) x.Importe)
End Get
End Property
Public ReadOnly Property ImporteApuntesConciliados As Double
Get
Return Me.apuntes.Sum(Function(x) x.Debe - x.Haber)
End Get
End Property
Dim _Año As Integer?
Public Property Año As Integer?
Get
If _Año.HasValue Then
Return _Año
Else
If FechaInicio = Date.MinValue Then
Return Nothing
Else
Return FechaInicio.Year
End If
End If
End Get
Set(value As Integer?)
_Año = value
If _Mes.HasValue Then
Me.FechaInicio = New Date(_Año, _Mes, 1)
Me.FechaFin = New Date(_Año, _Mes, Date.DaysInMonth(_Año, _Mes))
End If
Me.OnPropertyChanged("Año")
End Set
End Property
Dim _Mes As Integer?
Public Property Mes As Integer?
Get
If _Mes.HasValue Then
Return _Mes
Else
If FechaInicio = Date.MinValue Then
Return Nothing
Else
Return FechaInicio.Month
End If
End If
End Get
Set(value As Integer?)
_Mes = value
If _Año.HasValue Then
Me.FechaInicio = New Date(_Año, _Mes, 1)
Me.FechaFin = New Date(_Año, _Mes, Date.DaysInMonth(_Año, _Mes))
End If
Me.OnPropertyChanged("Mes")
End Set
End Property
End Class

124
guia/Extensiones/correos.vb Normal file
View File

@@ -0,0 +1,124 @@
Public Class correos
''' <summary>
''' Genera un registro de correo electrónico saliente en la base de datos.
''' </summary>
''' <param name="bd"></param>
''' <param name="Asunto"></param>
''' <param name="Cuerpo"></param>
''' <param name="cuenta"></param>
''' <param name="Destinatario"></param>
''' <param name="idfichero"></param>
''' <returns>1 si se ha guardado el correo, 0 en caso contrario</returns>
''' <remarks>Devuelve el número de líneas modificadas tras escribir en la base de datos el correo que se desea enviar.</remarks>
Public Shared Function GeneraRegistroCorreo(bd As bdGestionAsegasa.gestionasegasaEntities, Asunto As String, Cuerpo As String, cuenta As cuentascorreo, Destinatario As String, Optional Copia As String = "", Optional CopiaOculta As String = "", Optional idfichero As Integer? = Nothing, Optional MarcarComoAnulado As Boolean = False, Optional Remitente As String = "", Optional ResponderA As String = "") As Integer
Dim resultado As Integer = 0
Try
If bd Is Nothing Then bd = bdGestionAsegasa.gestionasegasaEntities.NuevoContexto
Dim sRutaAdjunto As String = ""
Dim correo = New correos With {
.Asunto = Asunto,
.Cuerpo = Cuerpo,
.Destinatario = Destinatario,
.Copia = Copia,
.CopiaOculta = CopiaOculta,
.DireccionRespuesta = If(ResponderA <> "", ResponderA, cuenta.ResponderA),
.FechaCreacion = bdGestionAsegasa.Utilidades.AhoraMysql(bd),
.idcuenta = cuenta.idCuenta,
.Remitente = If(Remitente <> "", Remitente, cuenta.Remitente),
.idFicheroAdjunto = idfichero
}
If MarcarComoAnulado Then correo.FechaAnulacion = Now
bd.correos.AddObject(correo)
bd.GuardarCambios()
Return correo.idcorreo
Catch ex As Exception
Debug.Write(ex.Message)
Throw New Exception(ex.Message, ex)
End Try
Return resultado
End Function
Public Shared Function GeneraRegistroCorreoConAdjunto(bd As bdGestionAsegasa.gestionasegasaEntities, Asunto As String, Cuerpo As String, cuenta As cuentascorreo, Fichero As Byte(), NombreFichero As String, DescripcionFichero As String, Destinatario As String, Optional Copia As String = "", Optional CopiaOculta As String = "", Optional MarcarComoAnulado As Boolean = False, Optional Remitente As String = "", Optional idAplicacion As Integer? = Nothing, Optional CodigoAplicacion As String = "") As Integer
Dim resultado As Integer = 0
Try
If bd Is Nothing Then bd = bdGestionAsegasa.gestionasegasaEntities.NuevoContexto
Dim idTipoAdjunto = bd.enumeraciones.First(Function(x) x.Codigo = "TIPFIC.ADJCOR").idEnumeracion
Dim f As New ficheros With {
.idTipo = idTipoAdjunto,
.Descripcion = DescripcionFichero,
.Fichero = Fichero,
.NombreFichero = NombreFichero}
bd.ficheros.AddObject(f)
bd.SaveChanges()
Dim correo = New correos With {
.Asunto = Asunto,
.Cuerpo = Cuerpo,
.Destinatario = Destinatario,
.Copia = Copia,
.CopiaOculta = CopiaOculta,
.DireccionRespuesta = cuenta.ResponderA,
.FechaCreacion = bdGestionAsegasa.Utilidades.AhoraMysql(bd),
.idcuenta = cuenta.idCuenta,
.Remitente = If(Remitente <> "", Remitente, cuenta.Remitente),
.idFicheroAdjunto = f.idFichero,
.idAplicacion = idAplicacion,
.CodigoAplicacion = CodigoAplicacion
}
If MarcarComoAnulado Then correo.FechaAnulacion = Now
bd.correos.AddObject(correo)
bd.GuardarCambios()
Return correo.idcorreo
Catch ex As Exception
Debug.Write(ex.Message)
Throw
End Try
Return resultado
End Function
Public Shared Function GeneraRegistroCorreoVariosFicheros(bd As bdGestionAsegasa.gestionasegasaEntities, Asunto As String, Cuerpo As String, cuenta As cuentascorreo, Destinatario As String, Optional idficheros As List(Of Integer) = Nothing, Optional FechaAnulacion As DateTime? = Nothing) As Integer
Try
Dim sRutaAdjunto As String = ""
Dim correo = New correos With {
.Asunto = Asunto,
.Cuerpo = Cuerpo,
.Destinatario = Destinatario,
.DireccionRespuesta = cuenta.Remitente,
.FechaCreacion = bdGestionAsegasa.Utilidades.AhoraMysql(bd),
.idcuenta = cuenta.idCuenta,
.Remitente = cuenta.Remitente,
.FechaAnulacion = FechaAnulacion
}
For Each f In idficheros
Dim nf As New ficherosadjuntos With {.idFichero = f}
correo.ficherosadjuntos.Add(nf)
Next
bd.correos.AddObject(correo)
bd.GuardarCambios()
Return correo.idcorreo
Catch ex As Exception
Throw New Exception("Error en GeneraRegistroCorreoVariosFicheros. Asunto:" & Asunto & " " & ex.Message, ex)
End Try
End Function
Public ReadOnly Property FicheroAdjunto As String
Get
If Me.idFicheroAdjunto.HasValue Then
Return Me.ficheros.NombreFichero
Else
Return ""
End If
End Get
End Property
Public Class CorreoReducido
Public Property idCorreo As Integer
Public Property Destinatario As String
Public Property Asunto As String
Public Property FechaCreacion As DateTime
Public Property FechaAnulacion As DateTime?
Public Property MensajeError As String
Public Property Aplicacion As String
Public Property CodigoAplicacion As String
End Class
End Class

708
guia/Extensiones/cuentas.vb Normal file
View File

@@ -0,0 +1,708 @@

Imports tsl5.Extensiones
Imports tsl5.Extensiones.DoubleExtensions
Partial Public Class cuentas
Public Shared LongitudCuentaFinal As Integer = 8
Public Const CUENTA_PERDIDAS_Y_GANANCIAS As String = "12900000"
Public Property ApuntesTemporales As List(Of apuntes)
Public ReadOnly Property Descripcion As String
Get
Return Me.NumeroCuenta & " " & Me.Denominacion
End Get
End Property
Public Sub RellenaApuntesTemporales(IncluirAsientoCierre As Boolean)
If Me.Nivel = LongitudCuentaFinal Then
Dim apap = Me.apuntes.Where(Function(x) x.asientos.Tipo = asientos.TipoAsiento.APERTURA).ToList
If apap.Count = 0 Then
Me.SaldoInicialTmp = 0
Else
Me.SaldoInicialTmp = Math.Round(apap.Sum(Function(x) x.Debe - x.Haber), 2, MidpointRounding.AwayFromZero)
End If
If IncluirAsientoCierre Then
ApuntesTemporales = Me.apuntes.Where(Function(x) x.asientos.Tipo <> asientos.TipoAsiento.APERTURA).ToList
Else
ApuntesTemporales = Me.apuntes.Where(Function(x) x.asientos.Tipo <> asientos.TipoAsiento.APERTURA And x.asientos.Tipo <> asientos.TipoAsiento.REGULARIZACION).ToList
End If
Else
Dim bd As bdGestionAsegasa.gestionasegasaEntities = Me.ObtieneContexto
Dim apap = bd.apuntes.Where(Function(x) x.cuentas.NumeroCuenta.StartsWith(Me.NumeroCuenta) And x.asientos.Tipo = asientos.TipoAsiento.APERTURA).ToList
If apap.Count = 0 Then
Me.SaldoInicialTmp = 0
Else
Me.SaldoInicialTmp = Math.Round(apap.Sum(Function(x) x.Debe - x.Haber), 2, MidpointRounding.AwayFromZero)
End If
If IncluirAsientoCierre Then
ApuntesTemporales = bd.apuntes.Where(Function(x) x.asientos.idEjercicio = Me.idEjercicio And x.cuentas.NumeroCuenta.StartsWith(Me.NumeroCuenta) And x.asientos.Tipo <> asientos.TipoAsiento.APERTURA).ToList
Else
ApuntesTemporales = bd.apuntes.Where(Function(x) x.asientos.idEjercicio = Me.idEjercicio And x.cuentas.NumeroCuenta.StartsWith(Me.NumeroCuenta) And x.asientos.Tipo <> asientos.TipoAsiento.REGULARIZACION And x.asientos.Tipo <> asientos.TipoAsiento.APERTURA).ToList
End If
End If
If ApuntesTemporales.Count = 0 Then
Me.SaldoDebeTmp = 0
Me.SaldoHaberTmp = 0
Else
Me.SaldoDebeTmp = Math.Round(ApuntesTemporales.Sum(Function(x) x.Debe), 2, MidpointRounding.AwayFromZero)
Me.SaldoHaberTmp = Math.Round(ApuntesTemporales.Sum(Function(x) x.Haber), 2, MidpointRounding.AwayFromZero)
End If
Me.SaldoFinalTmp = Me.SaldoInicialTmp + Me.SaldoDebeTmp - Me.SaldoHaberTmp
End Sub
Public Property SaldoInicialTmp As Double
Public Property SaldoDebeTmp As Double
Public Property SaldoHaberTmp As Double
Public Property SaldoFinalTmp As Double
Public Shared Function CreaCuenta(bd As gestionasegasaEntities, idEjercicio As Integer, NumeroCuenta As String, Descripcion As String, Optional Observaciones As String = "") As cuentas
Dim cta = bd.cuentas.FirstOrDefault(Function(x) x.NumeroCuenta = NumeroCuenta And x.idEjercicio = idEjercicio)
If cta Is Nothing Then
cta = New cuentas
With cta
.NumeroCuenta = NumeroCuenta
.idEjercicio = idEjercicio
.Denominacion = Descripcion.Acortar(150)
.EsCuentaFinal = True
.Observaciones = Observaciones
End With
bd.cuentas.AddObject(cta)
bd.SaveChanges()
End If
Return cta
End Function
Public Shared Function CreaCuenta(bd As gestionasegasaEntities, Fecha As Date, NumeroCuenta As String, Descripcion As String, Optional Observaciones As String = "") As cuentas
Dim ej = bd.ejercicioscontables.FirstOrDefault(Function(x) x.FechaInicio <= Fecha And x.FechaFin >= Fecha)
If ej Is Nothing Then Throw New Exception("No existe ningún ejercicio abierto para la fecha " & Fecha.ToString)
Return CreaCuenta(bd, ej.idEjercicio, NumeroCuenta, Descripcion, Observaciones)
End Function
Public ReadOnly Property TotalSaldoAntesCierre As Double
Get
Dim ac = Me.ejercicioscontables.asientos.FirstOrDefault(Function(x) x.Tipo = asientos.TipoAsiento.REGULARIZACION)
If ac Is Nothing Then
Return TotalSaldo
Else
Dim tdac = ac.apuntes.Where(Function(x) x.cuentas.NumeroCuenta.StartsWith(Me.NumeroCuenta)).Sum(Function(x) x.Debe)
Dim thac = ac.apuntes.Where(Function(x) x.cuentas.NumeroCuenta.StartsWith(Me.NumeroCuenta)).Sum(Function(x) x.Haber)
Return TotalSaldo - tdac + thac
End If
End Get
End Property
Public ReadOnly Property Grupo1 As String
Get
If Me.NumeroCuenta.Length > 1 Then
Dim nc = Me.NumeroCuenta.Substring(0, 1)
Return nc & " - " & Me.ejercicioscontables.cuentas.First(Function(x) x.NumeroCuenta = nc).Denominacion
Else
Return ""
End If
End Get
End Property
Public ReadOnly Property Grupo2 As String
Get
If Me.NumeroCuenta.Length > 2 Then
Dim nc = Me.NumeroCuenta.Substring(0, 2)
Return nc & " - " & Me.ejercicioscontables.cuentas.First(Function(x) x.NumeroCuenta = nc).Denominacion
Else
Return ""
End If
End Get
End Property
Public ReadOnly Property Grupo3 As String
Get
If Me.NumeroCuenta.Length > 3 Then
Dim nc = Me.NumeroCuenta.Substring(0, 3)
Return nc & " - " & Me.ejercicioscontables.cuentas.First(Function(x) x.NumeroCuenta = nc).Denominacion
Else
Return ""
End If
End Get
End Property
Public ReadOnly Property Grupo4 As String
Get
If Me.NumeroCuenta.Length > 4 Then
Dim nc = Me.NumeroCuenta.Substring(0, 4)
Return nc & " - " & Me.ejercicioscontables.cuentas.First(Function(x) x.NumeroCuenta = nc).Denominacion
Else
Return ""
End If
End Get
End Property
Private _bd As gestionasegasaEntities
Public ReadOnly Property bd As gestionasegasaEntities
Get
If _bd Is Nothing Then
_bd = Me.ObtieneContexto
End If
Return _bd
End Get
End Property
Public ReadOnly Property CuentaSuperior1 As cuentas
Get
If Me.NumeroCuenta.Length = 1 Then
Return Nothing
Else
Dim CuentaSuperior = Me.NumeroCuenta.Substring(0, 1)
Return bd.cuentas.First(Function(x) x.NumeroCuenta = CuentaSuperior And x.idEjercicio = Me.idEjercicio)
End If
End Get
End Property
Public ReadOnly Property CuentaSuperior2 As cuentas
Get
If Me.NumeroCuenta.Length < 3 Then
Return Nothing
Else
Dim CuentaSuperior = Me.NumeroCuenta.Substring(0, 2)
Return bd.cuentas.First(Function(x) x.NumeroCuenta = CuentaSuperior And x.idEjercicio = Me.idEjercicio)
End If
End Get
End Property
Public ReadOnly Property CuentaSuperior3 As cuentas
Get
If Me.NumeroCuenta.Length < 4 Then
Return Nothing
Else
Dim CuentaSuperior = Me.NumeroCuenta.Substring(0, 3)
Return bd.cuentas.First(Function(x) x.NumeroCuenta = CuentaSuperior And x.idEjercicio = Me.idEjercicio)
End If
End Get
End Property
Public ReadOnly Property CuentaSuperior4 As cuentas
Get
If Me.NumeroCuenta.Length < 5 Then
Return Nothing
Else
Dim CuentaSuperior = Me.NumeroCuenta.Substring(0, 4)
Return bd.cuentas.First(Function(x) x.NumeroCuenta = CuentaSuperior And x.idEjercicio = Me.idEjercicio)
End If
End Get
End Property
Public ReadOnly Property Nivel As Integer
Get
Return NumeroCuenta.NothingAVacio.Length
End Get
End Property
Private _ValoresExtendidos As vf_cuentas
Public ReadOnly Property ValoresExtendidos As vf_cuentas
Get
If _ValoresExtendidos Is Nothing Then
_ValoresExtendidos = Obtiene_vf_cuenta()
End If
Return _ValoresExtendidos
End Get
End Property
Public Function Obtiene_vf_cuenta() As vf_cuentas
Try
Dim bd As gestionasegasaEntities = Me.ObtieneContexto
Dim ct As vf_cuentas
If Me.Nivel = 8 Then
ct = bd.vf_cuentas.First(Function(x) x.idCuenta = Me.idCuenta)
Else
If Nivel = 0 Then
ct = New vf_cuentas
With ct
.idCuenta = 0
.idEjercicio = 0
.Mote = ""
.Denominacion = ""
.idEmpresaAmortizacion = 0
.NumeroCuenta = ""
.Observaciones = ""
.PresupuestoEnero = 0
.PresupuestoFebrero = 0
.PresupuestoMarzo = 0
.PresupuestoAbril = 0
.PresupuestoMayo = 0
.PresupuestoJunio = 0
.PresupuestoJulio = 0
.PresupuestoAgosto = 0
.PresupuestoSeptiembre = 0
.PresupuestoOctubre = 0
.PresupuestoNoviembre = 0
.PresupuestoDiciembre = 0
.DebeEnero = 0
.DebeFebrero = 0
.DebeMarzo = 0
.DebeAbril = 0
.DebeMayo = 0
.DebeJunio = 0
.DebeJulio = 0
.DebeAgosto = 0
.DebeSeptiembre = 0
.DebeOctubre = 0
.DebeNoviembre = 0
.DebeDiciembre = 0
.HaberEnero = 0
.HaberFebrero = 0
.HaberMarzo = 0
.HaberAbril = 0
.HaberMayo = 0
.HaberJunio = 0
.HaberJulio = 0
.HaberAgosto = 0
.HaberSeptiembre = 0
.HaberOctubre = 0
.HaberNoviembre = 0
.HaberDiciembre = 0
.TotalDebe = 0
.TotalHaber = 0
End With
Else
Dim sumatorio = bd.vf_cuentas.Where(Function(x) x.NumeroCuenta.StartsWith(Me.NumeroCuenta) And x.idEjercicio = Me.idEjercicio).ToList
ct = New vf_cuentas
With ct
.idCuenta = Me.idCuenta
.idEjercicio = Me.idEjercicio
.Mote = Me.Mote
.Denominacion = Me.Denominacion
.idEmpresaAmortizacion = Me.idEmpresaAmortizacion
.NumeroCuenta = Me.NumeroCuenta
.Observaciones = Me.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)
End With
End If
End If
Try
If Nivel > 0 Then
Dim cta1 = bd.cuentas.First(Function(x) x.NumeroCuenta = ct.NumeroCuenta.Substring(0, 1) And x.idEjercicio = Me.idEjercicio)
ct.Grupo1 = cta1.NumeroCuenta & " " & cta1.Denominacion
If ct.Nivel > 1 Then
Dim cta2 = bd.cuentas.First(Function(x) x.NumeroCuenta = ct.NumeroCuenta.Substring(0, 2) And x.idEjercicio = Me.idEjercicio)
ct.Grupo2 = cta2.NumeroCuenta & " " & cta2.Denominacion
If ct.Nivel > 2 Then
Dim cta3 = bd.cuentas.First(Function(x) x.NumeroCuenta = ct.NumeroCuenta.Substring(0, 3) And x.idEjercicio = Me.idEjercicio)
ct.Grupo3 = cta3.NumeroCuenta & " " & cta3.Denominacion
If ct.Nivel > 3 Then
Dim cta4 = bd.cuentas.First(Function(x) x.NumeroCuenta = ct.NumeroCuenta.Substring(0, 4) And x.idEjercicio = Me.idEjercicio)
ct.Grupo4 = cta4.NumeroCuenta & " " & cta4.Denominacion
End If
End If
End If
End If
Catch ex As Exception
Throw New Exception("Error obteniendo cuentas intermedia de la cuenta " & Me.NumeroCuenta & " " & ex.Message, ex)
End Try
Return ct
Catch ex As Exception
Throw New Exception(ex.Message, ex)
End Try
End Function
#Region "Saldos"
Public ReadOnly Property SaldoEnero As Double
Get
Return ValoresExtendidos.SaldoEnero
End Get
End Property
Public ReadOnly Property SaldoFebrero As Double
Get
Return ValoresExtendidos.SaldoFebrero
End Get
End Property
Public ReadOnly Property SaldoMarzo As Double
Get
Return ValoresExtendidos.SaldoMarzo
End Get
End Property
Public ReadOnly Property SaldoAbril As Double
Get
Return ValoresExtendidos.SaldoAbril
End Get
End Property
Public ReadOnly Property SaldoMayo As Double
Get
Return ValoresExtendidos.SaldoMayo
End Get
End Property
Public ReadOnly Property SaldoJunio As Double
Get
Return ValoresExtendidos.SaldoJunio
End Get
End Property
Public ReadOnly Property SaldoJulio As Double
Get
Return ValoresExtendidos.SaldoJulio
End Get
End Property
Public ReadOnly Property SaldoAgosto As Double
Get
Return ValoresExtendidos.SaldoAgosto
End Get
End Property
Public ReadOnly Property SaldoSeptiembre As Double
Get
Return ValoresExtendidos.SaldoSeptiembre
End Get
End Property
Public ReadOnly Property SaldoOctubre As Double
Get
Return ValoresExtendidos.SaldoOctubre
End Get
End Property
Public ReadOnly Property SaldoNoviembre As Double
Get
Return ValoresExtendidos.SaldoNoviembre
End Get
End Property
Public ReadOnly Property SaldoDiciembre As Double
Get
Return ValoresExtendidos.SaldoDiciembre
End Get
End Property
Public ReadOnly Property TotalSaldo As Double
Get
Return ValoresExtendidos.TotalSaldo
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
Return ValoresExtendidos.DesvioPresupuestoEnero
End Get
End Property
Public ReadOnly Property DesvioPresupuestoFebrero As Double
Get
Return ValoresExtendidos.DesvioPresupuestoFebrero
End Get
End Property
Public ReadOnly Property DesvioPresupuestoMarzo As Double
Get
Return ValoresExtendidos.DesvioPresupuestoMarzo
End Get
End Property
Public ReadOnly Property DesvioPresupuestoAbril As Double
Get
Return ValoresExtendidos.DesvioPresupuestoAbril
End Get
End Property
Public ReadOnly Property DesvioPresupuestoMayo As Double
Get
Return ValoresExtendidos.DesvioPresupuestoMayo
End Get
End Property
Public ReadOnly Property DesvioPresupuestoJunio As Double
Get
Return ValoresExtendidos.DesvioPresupuestoJunio
End Get
End Property
Public ReadOnly Property DesvioPresupuestoJulio As Double
Get
Return ValoresExtendidos.DesvioPresupuestoJulio
End Get
End Property
Public ReadOnly Property DesvioPresupuestoAgosto As Double
Get
Return ValoresExtendidos.DesvioPresupuestoAgosto
End Get
End Property
Public ReadOnly Property DesvioPresupuestoSeptiembre As Double
Get
Return ValoresExtendidos.DesvioPresupuestoSeptiembre
End Get
End Property
Public ReadOnly Property DesvioPresupuestoOctubre As Double
Get
Return ValoresExtendidos.DesvioPresupuestoOctubre
End Get
End Property
Public ReadOnly Property DesvioPresupuestoNoviembre As Double
Get
Return ValoresExtendidos.DesvioPresupuestoNoviembre
End Get
End Property
Public ReadOnly Property DesvioPresupuestoDiciembre As Double
Get
Return ValoresExtendidos.DesvioPresupuestoDiciembre
End Get
End Property
Public ReadOnly Property DesvioPresupuestoTotal As Double
Get
Return ValoresExtendidos.DesvioPresupuestoTotal
End Get
End Property
Public ReadOnly Property PorcentajeDesvioPresupuestoEnero As Double
Get
Return ValoresExtendidos.PorcentajeDesvioPresupuestoEnero
End Get
End Property
Public ReadOnly Property PorcentajeDesvioPresupuestoFebrero As Double
Get
Return ValoresExtendidos.PorcentajeDesvioPresupuestoFebrero
End Get
End Property
Public ReadOnly Property PorcentajeDesvioPresupuestoMarzo As Double
Get
Return ValoresExtendidos.PorcentajeDesvioPresupuestoMarzo
End Get
End Property
Public ReadOnly Property PorcentajeDesvioPresupuestoAbril As Double
Get
Return ValoresExtendidos.PorcentajeDesvioPresupuestoAbril
End Get
End Property
Public ReadOnly Property PorcentajeDesvioPresupuestoMayo As Double
Get
Return ValoresExtendidos.PorcentajeDesvioPresupuestoMayo
End Get
End Property
Public ReadOnly Property PorcentajeDesvioPresupuestoJunio As Double
Get
Return ValoresExtendidos.PorcentajeDesvioPresupuestoJunio
End Get
End Property
Public ReadOnly Property PorcentajeDesvioPresupuestoJulio As Double
Get
Return ValoresExtendidos.PorcentajeDesvioPresupuestoJulio
End Get
End Property
Public ReadOnly Property PorcentajeDesvioPresupuestoAgosto As Double
Get
Return ValoresExtendidos.PorcentajeDesvioPresupuestoAgosto
End Get
End Property
Public ReadOnly Property PorcentajeDesvioPresupuestoSeptiembre As Double
Get
Return ValoresExtendidos.PorcentajeDesvioPresupuestoSeptiembre
End Get
End Property
Public ReadOnly Property PorcentajeDesvioPresupuestoOctubre As Double
Get
Return ValoresExtendidos.PorcentajeDesvioPresupuestoOctubre
End Get
End Property
Public ReadOnly Property PorcentajeDesvioPresupuestoNoviembre As Double
Get
Return ValoresExtendidos.PorcentajeDesvioPresupuestoNoviembre
End Get
End Property
Public ReadOnly Property PorcentajeDesvioPresupuestoDiciembre As Double
Get
Return ValoresExtendidos.PorcentajeDesvioPresupuestoDiciembre
End Get
End Property
Public ReadOnly Property PorcentajeDesvioPresupuestoTotal As Double
Get
Return ValoresExtendidos.PorcentajeDesvioPresupuestoTotal
End Get
End Property
#End Region
Public Shared Function ListadoGruposCuentas() As List(Of GrupoCuenta)
Dim lGrupos As New List(Of GrupoCuenta)
lGrupos.Add(New GrupoCuenta With {.Nivel = 1, .Descripcion = "GRUPO INICIAL 1 DÍGITO"})
lGrupos.Add(New GrupoCuenta With {.Nivel = 2, .Descripcion = "GRUPO INTERMEDIO 2 DÍGITOS"})
lGrupos.Add(New GrupoCuenta With {.Nivel = 3, .Descripcion = "GRUPO INTERMEDIO 3 DÍGITOS"})
lGrupos.Add(New GrupoCuenta With {.Nivel = 4, .Descripcion = "GRUPO INTERMEDIO 4 DÍGITOS"})
lGrupos.Add(New GrupoCuenta With {.Nivel = 8, .Descripcion = "GRUPO FINAL 8 DÍGITOS"})
Return lGrupos
End Function
End Class
Public Class GrupoCuenta
Property Nivel As Integer
Property Descripcion As String
End Class
'Public Class ve_cuentas
' Property idCuenta As Integer
' Property Mote As String
' Property Denominacion As String
' Property DebeEnero As Double
' Property DebeFebrero As Double
' Property DebeMarzo As Double
' Property DebeAbril As Double
' Property DebeMayo As Double
' Property DebeJunio As Double
' Property DebeJulio As Double
' Property DebeAgosto As Double
' Property DebeSeptiembre As Double
' Property DebeOctubre As Double
' Property DebeNoviembre As Double
' Property DebeDiciembre As Double
' Property HaberEnero As Double
' Property HaberFebrero As Double
' Property HaberMarzo As Double
' Property HaberAbril As Double
' Property HaberMayo As Double
' Property HaberJunio As Double
' Property HaberJulio As Double
' Property HaberAgosto As Double
' Property HaberSeptiembre As Double
' Property HaberOctubre As Double
' Property HaberNoviembre As Double
' Property HaberDiciembre As Double
' Property TotalDebe As Double
' Property TotalHaber As Double
' Property PresupuestoEnero As Double
' Property PresupuestoFebrero As Double
' Property PresupuestoMarzo As Double
' Property PresupuestoAbril As Double
' Property PresupuestoMayo As Double
' Property PresupuestoJunio As Double
' Property PresupuestoJulio As Double
' Property PresupuestoAgosto As Double
' Property PresupuestoSeptiembre As Double
' Property PresupuestoOctubre As Double
' Property PresupuestoNoviembre As Double
' Property PresupuestoDiciembre As Double
' Property Observaciones As String
' Property NumeroCuenta As String
' Property idEjercicio As Integer
' Property idEmpresaAmortizacion As Integer?
' Property EsCuentaFinal As Boolean
' Public Property Grupo1 As String
' Public Property Grupo2 As String
' Public Property Grupo3 As String
' Public Property Grupo4 As String
'#Region "Saldos"
' Public ReadOnly Property SaldoEnero As Double
' Get
' Return Math.Round(DebeEnero - HaberEnero, 2, MidpointRounding.AwayFromZero)
' End Get
' End Property
' Public ReadOnly Property SaldoFebrero As Double
' Get
' Return Math.Round(DebeFebrero - HaberFebrero, 2, MidpointRounding.AwayFromZero)
' End Get
' End Property
' Public ReadOnly Property SaldoMarzo As Double
' Get
' Return Math.Round(DebeMarzo - HaberMarzo, 2, MidpointRounding.AwayFromZero)
' End Get
' End Property
' Public ReadOnly Property SaldoAbril As Double
' Get
' Return Math.Round(DebeAbril - HaberAbril, 2, MidpointRounding.AwayFromZero)
' End Get
' End Property
' Public ReadOnly Property SaldoMayo As Double
' Get
' Return Math.Round(DebeMayo - HaberMayo, 2, MidpointRounding.AwayFromZero)
' End Get
' End Property
' Public ReadOnly Property SaldoJunio As Double
' Get
' Return Math.Round(DebeJunio - HaberJunio, 2, MidpointRounding.AwayFromZero)
' End Get
' End Property
' Public ReadOnly Property SaldoJulio As Double
' Get
' Return Math.Round(DebeJulio - HaberJulio, 2, MidpointRounding.AwayFromZero)
' End Get
' End Property
' Public ReadOnly Property SaldoAgosto As Double
' Get
' Return Math.Round(DebeAgosto - HaberAgosto, 2, MidpointRounding.AwayFromZero)
' End Get
' End Property
' Public ReadOnly Property SaldoSeptiembre As Double
' Get
' Return Math.Round(DebeSeptiembre - HaberSeptiembre, 2, MidpointRounding.AwayFromZero)
' End Get
' End Property
' Public ReadOnly Property SaldoOctubre As Double
' Get
' Return Math.Round(DebeOctubre - HaberOctubre, 2, MidpointRounding.AwayFromZero)
' End Get
' End Property
' Public ReadOnly Property SaldoNoviembre As Double
' Get
' Return Math.Round(DebeNoviembre - HaberNoviembre, 2, MidpointRounding.AwayFromZero)
' End Get
' End Property
' Public ReadOnly Property SaldoDiciembre As Double
' Get
' Return Math.Round(DebeDiciembre - HaberDiciembre, 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
'End Class

View File

@@ -0,0 +1,49 @@
Partial Public Class detallesamortizacionrecibos
Public ReadOnly Property MesFecha As String
Get
Dim Mes = Me.Mes.ToString
Return Mes.Substring(0, 4) + "/" + Mes.Substring(4, 2)
End Get
End Property
'Public Property AEliminar_tmp As Boolean
End Class
Public Class ve_detallesamortizacionrecibos
Public Property idDetalle As Integer
Public Property idAmortizacion As Integer
Public Property idRecibo As Integer?
Public Property FechaInicioAmortizacion As Date
Public Property FechaFinAmortizacion As Date
Public Property PorcentajeAnual As Integer?
Public Property FechaBaja As Date?
Public Property idMotivoBaja As Integer?
Public Property idEmpresa As Integer
Public Property NumeroCuenta As String
Public Property Observaciones As String
Public Property FechaAlta As Date?
Public Property CodigoRecibo As String
Public Property FechaEfecto As Date
Public Property TotalRecibo As Double
Public Property Ramo As String
Public Property Compañía As String
Public Property Tomador As String
Public Property CIFTomador As String
Public Property CausaBaja As String
Public Property Empresa As String
Public Property ValorAmortizado As Double
Public Property ValorAcumulado As Double
Public Property ValorResidual As Double
Public Property Mes As Integer
Public Property FechaAplicacion As DateTime?
Public ReadOnly Property MesFecha As String
Get
Dim Mes = Me.Mes.ToString
Return Mes.Substring(0, 4) + "/" + Mes.Substring(4, 2)
End Get
End Property
End Class

View File

@@ -0,0 +1,13 @@
Partial Public Class direcciones
Public ReadOnly Property PoblacionTmp As String
Get
Return municipios.ObtienePoblacion(Me.CodigoMunicipio)
End Get
End Property
Public ReadOnly Property ProvinciaTmp As String
Get
Return municipios.ObtieneProvincia(Me.CodigoMunicipio)
End Get
End Property
End Class

View File

@@ -0,0 +1,12 @@
Partial Public Class documentosasolicitar
Private _ElementoComprobado As Boolean
Public Property ElementoComprobado As Boolean
Get
Return _ElementoComprobado
End Get
Set(value As Boolean)
_ElementoComprobado = value
End Set
End Property
End Class

View File

@@ -0,0 +1,54 @@
Partial Public Class documentospolizassg
Public Property DocumentoComprobado As Boolean
Get
Return Me.FechaComprobacion.HasValue
End Get
Set(value As Boolean)
If value Then
Me.FechaComprobacion = Now
Me.idUsuarioComprueba = Utilidades.dsc.idUsuario
Else
Me.FechaComprobacion = Nothing
Me.idUsuarioComprueba = Nothing
End If
Me.OnPropertyChanged("idUsuarioComprueba")
Me.OnPropertyChanged("FechaComprobacion")
End Set
End Property
Public Shared Sub GeneraDocumentosASolicitar(bd As gestionasegasaEntities, Poliza As polizassg, Optional idDocsASolicitar As List(Of Integer) = Nothing)
Dim das As List(Of documentosasolicitar)
If idDocsASolicitar IsNot Nothing Then
das = bd.documentosasolicitar.Where(Function(x) idDocsASolicitar.Contains(x.idDocumento)).ToList
Else
das = bd.documentosasolicitar.Where(Function(x) x.idRamo = Poliza.idRamo).ToList
End If
Dim idDomiciliacion = bd.enumeraciones.First(Function(x) x.Codigo = "TIPP.BA").idEnumeracion
For Each d In das
Dim dp = New documentospolizassg
Poliza.documentospolizassg.Add(dp)
dp.Descripcion = d.enumeraciones.Descripcion
dp.idDocumentoASolicitar = d.idDocumento
dp.Obligatorio = d.Obligatorio
dp.Fecha = Date.Now
If d.enumeraciones.Codigo = "DOCRAM.MDTO" And Poliza.idTipoPago <> idDomiciliacion Then
dp.Obligatorio = False
End If
Next
End Sub
Public ReadOnly Property DescripcionTipo
Get
Return DirectCast(Tipo, TipoDocumentoEnum).ToString.Replace("_", " ")
End Get
End Property
Public Enum TipoDocumentoEnum As Integer
DESCONOCIDO = 0
PÓLIZA = 1
CARTA_SUPLEMENTO = 2
CERTIFICADO_SEGURO = 3
RECIBO = 10
OTROS = 100
End Enum
End Class

View File

@@ -0,0 +1,132 @@
Imports tsl5.Extensiones
Partial Public Class ejercicioscontables
Public Shared Function ObtieneidEjercicioAbierto(Fecha As Date) As Integer
Dim bd = bdGestionAsegasa.gestionasegasaEntities.NuevoContexto
Dim ej = bd.ejercicioscontables.FirstOrDefault(Function(x) x.FechaInicio <= Fecha And x.FechaFin >= Fecha And x.FechaCierre.HasValue = False)
If ej Is Nothing Then
ej = bd.ejercicioscontables.FirstOrDefault(Function(x) x.FechaInicio <= Fecha And x.FechaFin >= Fecha And x.FechaCierre.HasValue)
If ej Is Nothing Then
If Today.Subtract(Fecha).TotalDays > 365 OrElse Fecha.Subtract(Today).TotalDays > 60 Then
Throw New Exception("La fecha del ejercicio " & Fecha.ToShortDateString & " parece incorrecta")
Else
ej = bdGestionAsegasa.ejercicioscontables.AbreEjercicio(bd, Fecha)
Return ej.idEjercicio
End If
Else
Throw New Exception("El ejercicio está cerrado")
End If
Else
Return ej.idEjercicio
End If
End Function
Public ReadOnly Property DescripcionExtendida As String
Get
If Me.FechaInicio.Month = 1 And Me.FechaInicio.Day = 1 And Me.FechaFin.Month = 12 And Me.FechaFin.Day = 31 Then
Return Me.empresascontables.RazonSocial & " " & Me.FechaInicio.Year.ToString
Else
Return Me.empresascontables.RazonSocial & " " & Me.FechaInicio.ToString & " " & Me.FechaFin.ToString
End If
End Get
End Property
Public ReadOnly Property AsientoApertura As asientos
Get
Return Me.asientos.FirstOrDefault(Function(x) x.Tipo = bdGestionAsegasa.asientos.TipoAsiento.APERTURA)
End Get
End Property
Public ReadOnly Property AsientoRegularizacion As asientos
Get
Return Me.asientos.FirstOrDefault(Function(x) x.Tipo = bdGestionAsegasa.asientos.TipoAsiento.REGULARIZACION)
End Get
End Property
'Private _CuentasPlanContable As List(Of cuentasplancontable)
'Public ReadOnly Property CuentasPlanContable As List(Of cuentasplancontable)
' Get
' If _CuentasPlanContable Is Nothing Then
' _CuentasPlanContable = Me.plancontable.gruposplancontable.SelectMany(Function(x) x.cuentasplancontable).ToList
' End If
' Return _CuentasPlanContable
' End Get
'End Property
Public Sub CopiaCuentas()
Try
Dim bd As gestionasegasaEntities = Me.ObtieneContexto
Dim ea = bd.ejercicioscontables.OrderByDescending(Function(x) x.FechaInicio).FirstOrDefault(Function(x) x.FechaInicio < Me.FechaInicio)
If ea IsNot Nothing Then
Dim ctas1 = ea.cuentas.Where(Function(x) x.NumeroCuenta.Length = 1).ToList
Dim ctas2 = ea.cuentas.Where(Function(x) x.NumeroCuenta.Length = 2).ToList
Dim ctas3 = ea.cuentas.Where(Function(x) x.NumeroCuenta.Length = 3).ToList
Dim ctas4 = ea.cuentas.Where(Function(x) x.NumeroCuenta.Length = 4).ToList
Dim ctas8 = ea.cuentas.Where(Function(x) x.NumeroCuenta.Length = 8).ToList
Dim Nc As Integer = 0
For Each cta In ctas1
Nc += CopiaCuenta(bd, Me, cta)
Next
For Each cta In ctas2
Nc += CopiaCuenta(bd, Me, cta)
Next
For Each cta In ctas3
Nc += CopiaCuenta(bd, Me, cta)
Next
For Each cta In ctas4
Nc += CopiaCuenta(bd, Me, cta)
Next
For Each cta In ctas8
Nc += CopiaCuenta(bd, Me, cta)
Next
bd.SaveChanges()
End If
Catch ex As Exception
Throw New Exception(ex.Message, ex)
End Try
End Sub
Private Function CopiaCuenta(bd As gestionasegasaEntities, Ejercicio As ejercicioscontables, CtaAnterior As cuentas) As Integer
If Not Ejercicio.cuentas.Any(Function(X) X.NumeroCuenta = CtaAnterior.NumeroCuenta) Then
Dim nc As New cuentas
nc.Denominacion = CtaAnterior.Denominacion
nc.EsCuentaFinal = CtaAnterior.EsCuentaFinal
nc.Mote = CtaAnterior.Mote
nc.Observaciones = CtaAnterior.Observaciones
nc.NumeroCuenta = CtaAnterior.NumeroCuenta
nc.idEjercicio = Ejercicio.idEjercicio
nc.idEmpresaAmortizacion = CtaAnterior.idEmpresaAmortizacion
nc.PresupuestoEnero = CtaAnterior.PresupuestoEnero
nc.PresupuestoFebrero = CtaAnterior.PresupuestoFebrero
nc.PresupuestoMarzo = CtaAnterior.PresupuestoMarzo
nc.PresupuestoAbril = CtaAnterior.PresupuestoAbril
nc.PresupuestoMayo = CtaAnterior.PresupuestoMayo
nc.PresupuestoJunio = CtaAnterior.PresupuestoJunio
nc.PresupuestoJulio = CtaAnterior.PresupuestoJulio
nc.PresupuestoAgosto = CtaAnterior.PresupuestoAgosto
nc.PresupuestoSeptiembre = CtaAnterior.PresupuestoSeptiembre
nc.PresupuestoOctubre = CtaAnterior.PresupuestoOctubre
nc.PresupuestoNoviembre = CtaAnterior.PresupuestoNoviembre
nc.PresupuestoDiciembre = CtaAnterior.PresupuestoDiciembre
bd.AddTocuentas(nc)
Return 1
Else
Return 0
End If
End Function
Public Shared Function AbreEjercicio(bd As gestionasegasaEntities, Fecha As Date) As ejercicioscontables
Dim ej As New ejercicioscontables()
ej.FechaApertura = Now
ej.FechaInicio = New Date(Fecha.Year, 1, 1)
ej.FechaFin = New Date(Fecha.Year, 12, 31)
ej.Descripcion = Fecha.Year.ToString
bd.ejercicioscontables.AddObject(ej)
bd.SaveChanges()
ej.CopiaCuentas()
Return ej
End Function
Public Shared Function CompruebaEjereciciosAbiertos(bd As gestionasegasaEntities, Fechas As List(Of Date)) As Boolean
Dim ejeabiertos = bd.ejercicioscontables.Where(Function(x) x.FechaCierre.HasValue = False).ToList
Return Fechas.All(Function(x) ejeabiertos.Any(Function(y) y.FechaInicio <= x And y.FechaFin >= x))
End Function
End Class

View File

@@ -0,0 +1,355 @@
Imports System.ComponentModel
Imports System.Data.Objects
Imports tsl5.Extensiones
Imports System.Text.RegularExpressions
Partial Public Class entidades
Implements INotifyPropertyChanged
Public Function UltimoReciboDevueltoFaltaPago(CodigoRamo As String) As Boolean
If Me.idEntidad <> 0 Then
Dim bd As bdGestionAsegasa.gestionasegasaEntities = ObtieneContexto
Dim idramo = bd.ramos.First(Function(x) x.Codigo = CodigoRamo).idRamo
Dim idfp = bd.enumeraciones.First(Function(x) x.Codigo = "CABA.FP").idEnumeracion
Dim recs = bd.entidadespolizas.Where(Function(x) x.idEntidad = Me.idEntidad).Select(Function(x) x.polizassg).Where(Function(x) x.idRamo = idramo).SelectMany(Function(x) x.recibos).ToList
Dim rec = recs.OrderByDescending(Function(x) x.FechaEfecto).FirstOrDefault
If rec Is Nothing Then
Return False
Else
Return rec.idCausaBaja.HasValue AndAlso rec.idCausaBaja = idfp
End If
End If
Return False
End Function
Public ReadOnly Property Sexo As String
Get
If Me.idSexo.HasValue Then
Return Me.enumeraciones.Descripcion
Else
Return "* Desconocido *"
End If
End Get
End Property
Public ReadOnly Property DireccionPrincipal As direcciones
Get
If Me.idDireccionPrincipal.HasValue AndAlso Me.idDireccionPrincipal.Value > 0 Then
If Me.direcciones1 Is Nothing Then
Dim d = Me.direcciones.First(Function(x) x.idDireccion = Me.idDireccionPrincipal)
Return d
Else
Return Me.direcciones1
End If
Else
If Me.direcciones.Any Then
If Me.direcciones.Any(Function(x) x.idTipo.HasValue AndAlso x.enumeraciones.Codigo = "TIPDIR.CORREO") Then
Dim d = Me.direcciones.First(Function(x) x.idTipo.HasValue AndAlso x.enumeraciones.Codigo = "TIPDIR.CORREO")
' Me.idDireccionPrincipal = d.idDireccion
'Me.direcciones1 = d
Return d
Else
Dim d = Me.direcciones.First
' Me.idDireccionPrincipal = d.idDireccion
'Me.direcciones1 = d
Return d
End If
Else
Return Nothing
End If
End If
End Get
End Property
Private _CodigoPostalTmpEsNulo As Boolean = True
Private _CodigoPostalTmp As String
Public Property CodigoPostalTmp As String
Get
If _CodigoPostalTmpEsNulo Then
If DireccionPrincipal Is Nothing Then
Return ""
Else
_CodigoPostalTmp = Me.DireccionPrincipal.CodigoPostal
_CodigoPostalTmpEsNulo = False
Return Me.DireccionPrincipal.CodigoPostal
End If
Else
Return _CodigoPostalTmp
End If
End Get
Set(value As String)
_CodigoPostalTmp = value
_CodigoPostalTmpEsNulo = False
If DireccionPrincipal IsNot Nothing Then
DireccionPrincipal.CodigoPostal = value
End If
Me.OnPropertyChanged("CodigoPostalTmp")
End Set
End Property
Private _DomicilioTmpEsNulo As Boolean = True
Private _DomicilioTmp As String
Public Property DomicilioTmp As String
Get
If _DomicilioTmpEsNulo Then
If DireccionPrincipal Is Nothing Then
Return ""
Else
_DomicilioTmp = DireccionPrincipal.Direccion
_DomicilioTmpEsNulo = False
Return DireccionPrincipal.Direccion
End If
Else
Return _DomicilioTmp
End If
End Get
Set(value As String)
_DomicilioTmp = value
_DomicilioTmpEsNulo = False
If DireccionPrincipal IsNot Nothing Then
DireccionPrincipal.Direccion = value
End If
Me.OnPropertyChanged("DomicilioTmp")
End Set
End Property
Private _CodigoPoblacionTmpEsNulo As Boolean = True
Private _CodigoPoblacionTmp As String
Public Property CodigoPoblacionTmp As String
Get
If _CodigoPoblacionTmpEsNulo Then
If DireccionPrincipal Is Nothing OrElse DireccionPrincipal.municipios Is Nothing Then
If DireccionPrincipal IsNot Nothing AndAlso DireccionPrincipal.municipios Is Nothing Then
If DireccionPrincipal.CodigoPostal.NothingAVacio <> "" Then
Dim bd = bdGestionAsegasa.gestionasegasaEntities.NuevoContexto
Dim pob = bd.codigospostales.FirstOrDefault(Function(x) x.CodigoPostal = DireccionPrincipal.CodigoPostal)
If pob Is Nothing Then
Return "CP.ERRONEO"
Else
DireccionPrincipal.CodigoMunicipio = pob.CodigoMunicipio
_CodigoPoblacionTmp = pob.CodigoMunicipio
_CodigoPoblacionTmpEsNulo = False
Return _CodigoPoblacionTmp
End If
Else
Return ""
End If
Else
Return ""
End If
Else
_CodigoPoblacionTmp = DireccionPrincipal.CodigoMunicipio
_CodigoPoblacionTmpEsNulo = False
Return DireccionPrincipal.CodigoMunicipio
End If
Else
Return _CodigoPoblacionTmp
End If
End Get
Set(value As String)
_CodigoPoblacionTmp = value
_CodigoPoblacionTmpEsNulo = False
If DireccionPrincipal IsNot Nothing Then
DireccionPrincipal.CodigoMunicipio = value
End If
Me.OnPropertyChanged("CodigoPoblacionTmp")
ProvinciaTmp = municipios.ObtieneProvincia(_CodigoPoblacionTmp)
PoblacionTmp = municipios.ObtienePoblacion(_CodigoPoblacionTmp)
End Set
End Property
Private _PoblacionTmp As String
Private _PoblacionTmpEsNulo As Boolean = True
Public Property PoblacionTmp As String
Get
If _PoblacionTmpEsNulo Then _PoblacionTmp = municipios.ObtienePoblacion(CodigoPoblacionTmp)
Return _PoblacionTmp
End Get
Set(value As String)
_PoblacionTmp = value
Me.OnPropertyChanged("PoblacionTmp")
End Set
End Property
Private _ProvinciaTmp As String
Private _ProvinciaTmpEsNulo As Boolean = True
Public Property ProvinciaTmp As String
Get
If _ProvinciaTmpEsNulo Then _ProvinciaTmp = municipios.ObtieneProvincia(CodigoPoblacionTmp)
Return _ProvinciaTmp
End Get
Set(value As String)
_ProvinciaTmp = value
Me.OnPropertyChanged("ProvinciaTmp")
End Set
End Property
Public ReadOnly Property FechaNacimientoSinHora As String
Get
Return Me.FechaNacimiento.ToString.PadLeft(10, " ").Substring(0, 10)
End Get
End Property
Public ReadOnly Property FechaExpCarnetSinHora As String
Get
Return Me.FechaExpedicionCarnet.ToString.PadLeft(10, " ").Substring(0, 10)
End Get
End Property
'Public Sub ReiniciaValoresTMP()
' _CodigoPoblacionTmpEsNulo = True
' _CodigoPostalTmpEsNulo = True
' _DomicilioTmpEsNulo = True
'End Sub
Friend Shared Sub GuardandoCambios(bd As bdGestionAsegasa.gestionasegasaEntities, Aplicacion As String)
Dim ents As IEnumerable(Of ObjectStateEntry) = Nothing
Dim dirs As IEnumerable(Of ObjectStateEntry) = Nothing
ents = bd.ObjectStateManager.GetObjectStateEntries(EntityState.Modified).Where(Function(x) x.EntitySet.Name.ToLower = "entidades")
Dim nents = bd.ObjectStateManager.GetObjectStateEntries(EntityState.Modified).Where(Function(x) x.EntitySet.Name.ToLower = "entidades")
dirs = bd.ObjectStateManager.GetObjectStateEntries(EntityState.Modified).Where(Function(x) x.EntitySet.Name.ToLower = "direcciones")
Try
For Each m In ents
Dim ra = DirectCast(m.Entity, entidades)
ra.CIF = Regex.Replace(ra.CIF.NothingAVacio, "[^a-zA-Z0-9]", "").ToUpper
Next
Catch ex As Exception
End Try
Try
Dim bdtmp = bdGestionAsegasa.gestionasegasaEntities.NuevoContextoCN
For Each m In ents
Dim ra = DirectCast(m.Entity, entidades)
ra.CIF = Regex.Replace(ra.CIF.NothingAVacio, "[^a-zA-Z0-9]", "").ToUpper
Dim reant = bdtmp.entidades.First(Function(x) x.idEntidad = ra.idEntidad)
Dim su = If(bd.Aplicacion IsNot Nothing, bd.Aplicacion.ModoSuperUsuario, False)
Dim lr = bdGestionAsegasa.logs.GeneraLog(bdtmp, "ENTIDADES", reant.idEntidad, Nothing, "REGISTRO_COMPLETO", tsl5.Utilidades.Serializar(reant), su, Aplicacion)
Dim lep = reant.direcciones.ToList
bdGestionAsegasa.logs.GeneraLog(bdtmp, "DIRECCIONESENTIDADES", reant.idEntidad, lr, "REGISTRO_COMPLETO", tsl5.Utilidades.Serializar(lep), su, Aplicacion)
Next
Catch ex As Exception
Dim sListaCambios As String = ""
If ents IsNot Nothing Then
For Each m In ents
Dim ra = DirectCast(m.Entity, entidades)
sListaCambios &= "entidades idEntidad:" & ra.idEntidad & "; "
Next
End If
Call Utilidades.AñadeLog(tsl5.Enumeraciones.TipoLog.Fallo, "En GuardandoCambios", ex.Message & vbCrLf & sListaCambios, ex)
End Try
End Sub
Public ReadOnly Property RelacionesEntreEntidades As List(Of EntidadRelacionada)
Get
Dim entsh = Me.entidadesrelacionadas.Select(Function(x) New EntidadRelacionada With {
.RazonSocial = x.entidades1.RazonSocial,
.TipoRelacion = EntidadRelacionada.TipoRelacionEntidadEnum.ES_HIJA,
.CIF = x.entidades1.CIF,
.EntRel = x
}).ToList
Dim entsp = Me.entidadesrelacionadas1.Select(Function(x) New EntidadRelacionada With {
.RazonSocial = x.entidades.RazonSocial,
.TipoRelacion = EntidadRelacionada.TipoRelacionEntidadEnum.ES_PADRE,
.CIF = x.entidades.CIF,
.EntRel = x
}).ToList
Return entsh.Union(entsp).OrderBy(Function(x) x.RazonSocial).ToList
End Get
End Property
Public Class EntidadRelacionada
Public Property idEntidad As Integer
Public Property CIF As String
Public Property TipoRelacion As TipoRelacionEntidadEnum
Public ReadOnly Property DescripcionTipoRelacion As String
Get
Return TipoRelacion.ToString.Replace("_", " ")
End Get
End Property
Public Property RazonSocial As String
Public Enum TipoRelacionEntidadEnum As Integer
ES_HIJA = 0
ES_PADRE = 1
End Enum
Public Property EntRel As entidadesrelacionadas
End Class
End Class
Public Class ve_entidades
Public Property idEntidad As String
Public Property CIF As String
Public Property RazonSocial As String
Public Property FechaNacimiento As Date?
Public Property Direccion As String
Public Property Poblacion As String
Public Property Provincia As String
Public Property Telefono1 As String
Public Property email As String
Public Property EsTaller As Boolean
Public Property EsClienteSG As Boolean
Public Property EsClienteSA As Boolean
Public Property EsContrarioSiniestro As Boolean
Public ReadOnly Property PoblacionYProvincia As String
Get
If Me.Provincia = Me.Poblacion Then
Return Me.Poblacion
Else
Return Me.Poblacion & " (" & Me.Provincia & ")"
End If
End Get
End Property
End Class
Public Class ve_entidades_venta_cruzada
Public Property idEntidad As String
Public Property CIF As String
Public Property RazonSocial As String
' Public Property FechaNacimiento As Date?
' Public Property Direccion As String
' Public Property Poblacion As String
' Public Property Provincia As String
Public Property Telefono1 As String
Public Property Telefono2 As String
Public Property FechaNacimientoTomador As Date?
Public Property TelefonoMovilValido As String
Public Property Email As String
' Public Property EsTaller As Boolean
' Public Property EsClienteSG As Boolean
' Public Property EsClienteSA As Boolean
' Public Property EsContrarioSiniestro As Boolean
'Public ReadOnly Property PoblacionYProvincia As String
' Get
' If Me.Provincia = Me.Poblacion Then
' Return Me.Poblacion
' Else
' Return Me.Poblacion & " (" & Me.Provincia & ")"
' End If
' End Get
'End Property
Public Property NumeroPolizas As Integer
Public Property idAgente As Integer
Public Property Agente As String
Public Property idSubagente As Integer?
Public Property SubAgente As String
Public Property TlfAgente As String
Public Property EmailAgente As String
Public Property TlfSubAgente As String
Public Property EmailSubAgente As String
Public Property NumeroCorreosVentaCruzada As Integer
Public Property Compañías As String
Public ReadOnly Property TelefonoSubAgenteAgente As String
Get
If TlfSubAgente <> "" Then
Return TlfSubAgente
Else
Return TlfAgente
End If
End Get
End Property
End Class

View File

@@ -0,0 +1,23 @@
Imports tsl5.Extensiones
Public Class entidadespolizas
Public Property AEliminar_tmp As Boolean
Public ReadOnly Property Domicilio As String
Get
If Me.idDireccion.HasValue Then
If Me.direcciones.municipios Is Nothing OrElse Me.direcciones.Direccion.NothingAVacio = "" OrElse Me.direcciones.CodigoPostal.NothingAVacio = "" Then
Return "** DOMICILIO INCORRECTO **"
Else
If Me.direcciones.municipios.provincias.Nombre = Me.direcciones.municipios.Nombre Then
Return Me.direcciones.Direccion & " - " & Me.direcciones.CodigoPostal & " " & Me.direcciones.municipios.Nombre
Else
Return Me.direcciones.Direccion & " - " & Me.direcciones.CodigoPostal & " " & Me.direcciones.municipios.Nombre & " (" & Me.direcciones.municipios.provincias.Nombre & ")"
End If
End If
Else
Return "** DOMICILIO INCORRECTO **"
End If
End Get
End Property
End Class

View File

@@ -0,0 +1,36 @@
Partial Public Class enumeraciones
Public ReadOnly Property CodigoDescripcion As String
Get
Return Me.Codigo.Split(".")(1) & " - " & Me.Descripcion
End Get
End Property
Public Property ValorEntero1 As Integer?
Get
If Me.ValorNumerico1.HasValue Then
Return CInt(Me.ValorNumerico1.Value)
Else
Return Nothing
End If
End Get
Set(value As Integer?)
If Me.ValorNumerico1.HasValue Then
Me.ValorNumerico1 = CDbl(value)
Else
Me.ValorNumerico1 = Nothing
End If
End Set
End Property
Private Shared _LConfsi As List(Of enumeraciones)
Public Shared ReadOnly Property LConfsi As List(Of enumeraciones)
Get
If _LConfsi Is Nothing Then
Dim bd = bdGestionAsegasa.gestionasegasaEntities.NuevoContextoCN()
_LConfsi = bd.enumeraciones.Where(Function(x) x.Codigo.StartsWith("VF.SI-")).OrderByDescending(Function(x) x.Fecha1).ToList
End If
Return _LConfsi
End Get
End Property
End Class

View File

@@ -0,0 +1,37 @@
Imports ProcesosEIAC_V6
Partial Public Class estadossiniestros_eiac
Public Shared Function ObtieneSituacionSiniestroV6(Clave As claves_situacionsiniestro) As Integer
Try
Select Case Clave
Case claves_situacionsiniestro.AP
Return ClavesSituacionSiniestroEnum.ABIERTO
Case claves_situacionsiniestro.CE
Return ClavesSituacionSiniestroEnum.CERRADO
Case claves_situacionsiniestro.RA
Return ClavesSituacionSiniestroEnum.REABIERTO
Case claves_situacionsiniestro.RC
Return ClavesSituacionSiniestroEnum.RECHAZADO
Case Else
Return ClavesSituacionSiniestroEnum.DESCONOCIDA
End Select
Catch ex As Exception
Return ClavesSituacionSiniestroEnum.DESCONOCIDA
End Try
End Function
Public Enum ClavesSituacionSiniestroEnum As Integer
ABIERTO = 1
CERRADO = 2
REABIERTO = 3
RECHAZADO = 4
DESCONOCIDA = 99
End Enum
Public ReadOnly Property DescripcionSituacionSiniestro As String
Get
If SituacionSiniestro.HasValue Then
Return DirectCast(SituacionSiniestro.Value, ClavesSituacionSiniestroEnum).ToString.Replace("_", " ")
Else
Return ""
End If
End Get
End Property
End Class

View File

@@ -0,0 +1,42 @@
Imports bdGestionAsegasa.accionessiniestros_eiac
Imports ProcesosEIAC_V6
Partial Public Class expedientessiniestros_eiac
Public Shared Function ObtieneEstadoExpedienteV6(clave As claves_estadoexpediente) As Integer
Try
Select Case clave
Case claves_estadoexpediente.DE
Return ClavesEstadoExpedienteEnum.DECLARADO
Case claves_estadoexpediente.LI
Return ClavesEstadoExpedienteEnum.LIQUIDADO
Case claves_estadoexpediente.PE
Return ClavesEstadoExpedienteEnum.PENDIENTE
Case claves_estadoexpediente.RE
Return ClavesEstadoExpedienteEnum.REAPERTURA
Case claves_estadoexpediente.TE
Return ClavesEstadoExpedienteEnum.TERMINADO
Case Else
Return ClavesEstadoExpedienteEnum.DESCONOCIDA
End Select
Catch ex As Exception
Return ClavesEstadoExpedienteEnum.DESCONOCIDA
End Try
End Function
Public Enum ClavesEstadoExpedienteEnum As Integer
DECLARADO = 1
LIQUIDADO = 2
PENDIENTE = 3
REAPERTURA = 4
TERMINADO = 5
DESCONOCIDA = 99
End Enum
Public ReadOnly Property DescripcionEstadoExpediente As String
Get
Return DirectCast(EstadoExpediente, ClavesEstadoExpedienteEnum).ToString.Replace("_", " ")
End Get
End Property
End Class

View File

@@ -0,0 +1,43 @@
Partial Public Class ficheros
Public ReadOnly Property idFicheroEnc As String
Get
Dim oCodigo As New System.Text.ASCIIEncoding
Dim byHash() As Byte, shaTmp As New System.Security.Cryptography.SHA1CryptoServiceProvider
byHash = shaTmp.ComputeHash(oCodigo.GetBytes("ASEGASa" & Me.idFichero.ToString.PadLeft(8, "0")))
Return tsl5.crypt.FEncS(Me.idFichero.ToString.PadLeft(8, "0") & byHash(0).ToString("x2"), "[AN]", "[AN]", 1973122213)
End Get
End Property
Public Shared Function ObtieneidFichero(idEncriptado As String) As Integer
Try
Dim oCodigo As New System.Text.ASCIIEncoding
Dim idcdc = tsl5.crypt.FEncS(idEncriptado, "[AN]", "[AN]", -1973122213)
Dim idr = idcdc.Substring(0, 8)
Dim dc = idcdc.Substring(8, 2)
Dim byHash() As Byte, shaTmp As New System.Security.Cryptography.SHA1CryptoServiceProvider
byHash = shaTmp.ComputeHash(oCodigo.GetBytes("ASEGASa" & idr))
If byHash(0).ToString("x2") <> dc Then
Return 0
Else
Return idr
End If
Catch ex As Exception
Return 0
End Try
End Function
End Class
Partial Public Class vr_ficheros
Public Property idFichero As Integer
Public Property NombreFichero As String
Public Property Fecha As DateTime
Public Property Descripcion As String
Public Shared Function Obtiene_vr_ficheros(iqFicheros As IQueryable(Of ficheros)) As List(Of vr_ficheros)
Return iqFicheros.Select(Function(x) New vr_ficheros With {
.Descripcion = x.Descripcion,
.Fecha = x.Fecha,
.idFichero = x.idFichero,
.NombreFichero = x.NombreFichero}).ToList
End Function
End Class

View File

@@ -0,0 +1,36 @@
Public Class ficheroscompanias
Public Enum TipoFicheroCompania As Integer
POLIZAS_EIAC = 1
RECIBOS_EIAC = 2
MOVIMIENTOS_RECIBOS_EIAC = 3
SINIESTROS_EIAC = 4
MOVIMIENTOS_SINIESTROS_EIAC = 5
LIQUIDACIONES_EIAC = 5
RECIBOS_PATRIA_HISPANA = 12
RECIBOS_PREVISION_MALLORQUINA = 12
CARTERA_COMPLETA_EIAC = 98
DESCONOCIDO = 99
End Enum
Public Function ContieneMovimientosDeRecibos() As Boolean
Try
If Me.Version = "6.0" Then
Dim DatosEIAC As ProcesosEIAC_V6.ProcesosEIAC = tsl5.Utilidades.Deserializa(Me.Fichero, GetType(ProcesosEIAC_V6.ProcesosEIAC))
If DatosEIAC.Objetos IsNot Nothing AndAlso DatosEIAC.Objetos.Items IsNot Nothing Then
Return DatosEIAC.Objetos.Items.Any(Function(x) x.GetType Is GetType(ProcesosEIAC_V6.tipo_movimientorecibo))
Else
Return False
End If
Else
'Dim DatosEIAC As ProcesosEIAC_V5.ProcesosEIAC = tsl5.Utilidades.Deserializa(Me.Fichero, GetType(ProcesosEIAC_V5.ProcesosEIAC))
'If DatosEIAC.Objetos IsNot Nothing AndAlso DatosEIAC.Objetos.Items IsNot Nothing Then
' Return DatosEIAC.Objetos.Items.Any(Function(x) x.GetType Is GetType(ProcesosEIAC_V5.tipo))
'Else
Return False
'End If
End If
Catch ex As Exception
Return False
End Try
End Function
End Class

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,76 @@
Partial Public Class gestionesrecibos
Public ReadOnly Property DetalleCorreo As String
Get
If Me.correos IsNot Nothing Then
If Me.correos.FechaAnulacion.HasValue Then
Return "Correo a " & Me.correos.Destinatario & " Anulado el " & Me.correos.FechaAnulacion.Value.ToString("dd/MM/yyyy hh:mm")
Else
If Me.correos.FechaEnvio.HasValue Then
Return "Correo a " & Me.correos.Destinatario & " Enviado el " & Me.correos.FechaEnvio.Value.ToString("dd/MM/yyyy hh:mm")
Else
Return "Correo a " & Me.correos.Destinatario & " pendiente de envio"
End If
End If
Else
Return "Sin correo"
End If
End Get
End Property
Public ReadOnly Property DetalleMensaje As String
Get
If Me.mensajes IsNot Nothing Then
If Me.mensajes.FechaAnulacion.HasValue Then
Return "Mensaje a " & Me.mensajes.Destinatario & " Anulado el " & Me.mensajes.FechaAnulacion.Value.ToString("dd/MM/yyyy hh:mm")
Else
If Me.mensajes.FechaEnvio.HasValue Then
Return "Mensaje a " & Me.mensajes.Destinatario & " Enviado el " & Me.mensajes.FechaEnvio.Value.ToString("dd/MM/yyyy hh:mm")
Else
Return "Mensaje a " & Me.mensajes.Destinatario & " pendiente de envio"
End If
End If
Else
Return "Sin Mensaje"
End If
End Get
End Property
End Class
Public Enum TipoGestionEnum As Integer
AVISO_REMESA_O_COBRO_DIRECTO = 1
AVISO_POLIZA_DE_BAJA = 2
AVISO_RECIBO_DEVUELTO_BANCO = 3
AVISO_IMPERATIVO_LEGAL = 4
SOLICITUD_DATOS_DEL_ASEGURADO_AL_AGENTE = 5
COMUNICACIÓN_DEVOLUCIÓN_AL_AGENTE = 6
COMUNICACIÓN_BAJA_AL_AGENTE = 7
CAMBIO_CARTERA_AGENTE = 8
AVISO_DEFENSA_CARTERA = 9
DESCARGA_RECIBO_DE_CIA = 10
OTROS_HP = 100
OTROS = 101
COMUNICACIÓN_EMISION_RECIBO_A_LA_COMPAÑÍA = 200
IMPRESION_RECIBO_CIA = 300
IMPRESION_RECIBO_GENERICO = 301
AVISO_ERRONEO = 1000
End Enum
Public Enum FormaComunicacionEnum
NINGUNA = 0
POR_SMS = 1
POR_CARTA = 2
SIN_DOMICILIO_NI_TLF_VALIDO = 3
POR_EMAIL = 4
'AVISO_REMESA_O_COBRO_DIRECTO_POR_SMS = 1
'AVISO_REMESA_O_COBRO_DIRECTO_POR_CARTA = 2
'AVISO_REMESA_O_COBRO_DIRECTO_SIN_DOMICILIO_NI_TLF_VALIDO = 3
'AVISO_POLIZA_DE_BAJA_POR_SMS = 4
'AVISO_POLIZA_DE_BAJA_POR_CARTA = 5
'AVISO_POLIZA_DE_BAJA_SIN_DOMICILIO_NI_TLF_VALIDO = 6
'AVISO_RECIBO_DEVUELTO_BANCO_POR_SMS = 7
'AVISO_RECIBO_DEVUELTO_BANCO_POR_CARTA = 8
'AVISO_RECIBO_DEVUELTO_BANCO_SIN_DOMICILIO_NI_TLF_VALIDO = 9
End Enum

View File

@@ -0,0 +1,20 @@
Partial Public Class gestionessiniestros
'Public Property RecordatorioVisto As Boolean
' Get
' Return Me.FechaRecordatorioVisto.HasValue
' End Get
' Set(value As Boolean)
' If value Then
' Me.FechaRecordatorioVisto = Now
' Else
' Me.FechaRecordatorioVisto = Nothing
' End If
' End Set
'End Property
Public ReadOnly Property PendienteRevision As Boolean
Get
PendienteRevision = (Me.FechaRecordatorio.HasValue AndAlso Me.FechaRecordatorio.Value <= Now)
End Get
End Property
End Class

View File

@@ -0,0 +1,50 @@
Partial Public Class gestionesvarias
Public Shared Function CreaNuevoCambioContraseñaAgente(idAgente As Integer) As gestionesvarias
Try
Dim bd = bdGestionAsegasa.gestionasegasaEntities.NuevoContextoCN()
Dim idTg = bd.enumeraciones.First(Function(x) x.Codigo = "TGV.CCAG").idEnumeracion
Dim Ag = bd.agentes.First(Function(x) x.idAgente = idAgente).Codigo
Static r As System.Random = New System.Random()
Randomize()
Dim iAleatorio = r.Next(100000000, 999999999).ToString
Dim ng As New gestionesvarias
With ng
.idTipo = idTg
.idAplicacion = idAgente
.FechaCreacion = Now
.Descripción = Ag
.Parametros = tsl5.crypt.SHA1("M3Soft." & iAleatorio.ToString)
End With
bd.gestionesvarias.AddObject(ng)
bd.SaveChanges()
Return ng
Catch ex As Exception
Throw New Exception(ex.Message, ex)
End Try
End Function
Public Shared Function CreaNuevoCambioContraseñaSubAgente(idSubAgente As Integer) As gestionesvarias
Try
Dim bd = bdGestionAsegasa.gestionasegasaEntities.NuevoContextoCN()
Dim idTg = bd.enumeraciones.First(Function(x) x.Codigo = "TGV.CCSAG").idEnumeracion
Dim Sag = bd.subagentes.First(Function(x) x.idSubagente = idSubAgente)
Static r As System.Random = New System.Random()
Randomize()
Dim iAleatorio = r.Next(100000000, 999999999).ToString
Dim ng As New gestionesvarias
With ng
.idTipo = idTg
.idAplicacion = idSubAgente
.FechaCreacion = Now
.Descripción = Sag.agentes.Codigo & "-" & Sag.Codigo
.Parametros = tsl5.crypt.SHA1("M3Soft." & iAleatorio.ToString)
End With
bd.gestionesvarias.AddObject(ng)
bd.SaveChanges()
Return ng
Catch ex As Exception
Throw New Exception(ex.Message, ex)
End Try
End Function
End Class

View File

@@ -0,0 +1,26 @@
Imports tsl5
Imports bdGestionAsegasa
Imports tsl5.Extensiones
Partial Public Class historicocomisiones
Public ReadOnly Property TotalComisionAgente As Double
Get
Return If(Me.comisionAgente.HasValue, Me.comisionAgente.Value, 0) + If(Me.incentivoAgente.HasValue, Me.incentivoAgente.Value, 0)
End Get
End Property
Public ReadOnly Property CodNomAgente As String
Get
Return Me.agentes.Codigo & "-" & Me.agentes.Nombre
End Get
End Property
Public ReadOnly Property PlanLinea As String
Get
Return Me.polizasagrario.planeslineas.planLinea
End Get
End Property
Public ReadOnly Property NumeroPolizas As Integer
Get
Dim bd As gestionasegasaEntities = Me.ObtieneContexto
Return bd.polizasagrario.Where(Function(x) x.poliza = Me.polizasagrario.poliza).Count
End Get
End Property
End Class

View File

@@ -0,0 +1,92 @@
Imports System.Globalization
Imports DevExpress.CodeParser
Imports tsWPF
Partial Public Class liquidacionesagentes
Public Const Prod As String = "https://www2.agenciatributaria.gob.es/wlpl/TIKE-CONT/ValidarQR"
Public Const TestValidate As String = "https://prewww2.aeat.es/wlpl/TIKE-CONT/ValidarQR"
Public ReadOnly Property EnlaceQR As String
Get
Dim confsi = enumeraciones.LConfsi.Where(Function(x) x.Fecha1.HasValue AndAlso x.Fecha1.Value <= Fecha).OrderByDescending(Function(x) x.Fecha1).FirstOrDefault
If confsi IsNot Nothing Then
If confsi.ValorNumerico4 > 0 Then
Return Prod & "?nif=" & agentes.CIF & "&numserie=" & NumeroFactura & "&fecha=" & Fecha.ToString("dd-MM-yyyy") & "&importe=" & Math.Round(TotalFacturaSinIRPF, 2, MidpointRounding.AwayFromZero).ToString(CultureInfo.InvariantCulture)
Else
Dim nf = NumeroFacturaVF(confsi.ValorAlfabetico4)
Return TestValidate & "?nif=" & agentes.CIF & "&numserie=" & nf & "&fecha=" & Fecha.ToString("dd-MM-yyyy") & "&importe=" & Math.Round(TotalFacturaSinIRPF, 2, MidpointRounding.AwayFromZero).ToString(CultureInfo.InvariantCulture)
End If
Else
Dim nf = NumeroFacturaVF(confsi.ValorAlfabetico4)
Return TestValidate & "?nif=" & agentes.CIF & "&numserie=" & nf & "&fecha=" & Fecha.ToString("dd-MM-yyyy") & "&importe=" & Math.Round(TotalFacturaSinIRPF, 2, MidpointRounding.AwayFromZero).ToString(CultureInfo.InvariantCulture)
End If
End Get
End Property
Public ReadOnly Property QRVisible As Boolean
Get
Dim confsi = enumeraciones.LConfsi.Where(Function(x) x.Fecha1.HasValue AndAlso x.Fecha1.Value <= Fecha).OrderByDescending(Function(x) x.Fecha1).FirstOrDefault
If confsi IsNot Nothing Then
Return confsi.ValorNumerico4 > 0
Else
Return False
End If
End Get
End Property
Public ReadOnly Property DescripcionEstadoVerifactu As String
Get
Return EstadoVerifactu.ToString.Replace("_", " ")
End Get
End Property
Public Function NumeroFacturaVF(ByVal PrefijoPruebas As String) As String
If PrefijoPruebas IsNot Nothing Then
Return PrefijoPruebas + NumeroFactura
Else
Return NumeroFactura
End If
End Function
Public ReadOnly Property EstadoVerifactu As EstadoVerifactuEnum
Get
Dim bd As gestionasegasaEntities = Me.ObtieneContexto
Dim rvf = bd.registrosverifactu.Where(Function(x) x.idAplicacion = idLiquidacionAgente).OrderByDescending(Function(x) x.idRegistro).FirstOrDefault
If rvf IsNot Nothing Then
Return CType(rvf.Estado, EstadoVerifactuEnum)
Else
Return EstadoVerifactuEnum.SIN_REGISTROS
End If
End Get
End Property
Public Enum EstadoVerifactuEnum
PENDIENTE_RESPUESTA = 0
CORRECTO = 1
ACEPTADO_CON_ERRORES = 2
INCORRECTO = 3
COMPLETADO = 10
SIN_REGISTROS = 100
End Enum
Public Function ObtieneNumeroFactura()
Dim bd As bdGestionAsegasa.gestionasegasaEntities = Me.ObtieneContexto
Dim AnoAct = Today.Year
If Me.FechaFactura.Value.Year < 2026 Then
Dim UltimaLiquidacion = bd.liquidacionesagentes.Where(Function(x) x.FechaFactura.HasValue AndAlso x.FechaFactura.Value.Year = AnoAct).OrderByDescending(Function(x) x.NumeroFactura).FirstOrDefault
Dim UltimaFactura As Integer = 1
If UltimaLiquidacion IsNot Nothing Then UltimaFactura = Integer.Parse(UltimaLiquidacion.NumeroFactura.Split("-")(1)) + 1
Return Today.Year.ToString & "-" & UltimaFactura.ToString.PadLeft(5, "0")
Else
Dim UltimaLiquidacion = bd.liquidacionesagentes.Where(Function(x) x.FechaFactura.HasValue AndAlso x.FechaFactura.Value.Year = AnoAct AndAlso x.idSerieFactura = Me.idSerieFactura).OrderByDescending(Function(x) x.NumeroFactura).FirstOrDefault
Dim UltimaFactura As Integer = 1
If UltimaLiquidacion IsNot Nothing Then UltimaFactura = Integer.Parse(UltimaLiquidacion.NumeroFactura.Split("-")(1).Substring(2)) + 1
Dim sf = bd.seriesfacturas.First(Function(x) x.idSerieFactura = idSerieFactura).Serie
Return sf & "-" & Today.Year.ToString.Substring(2) & UltimaFactura.ToString.PadLeft(5, "0")
End If
End Function
Public ReadOnly Property TotalFacturaSinIRPF As Double
Get
Return Math.Round(BaseImponible + IVA, 2, MidpointRounding.AwayFromZero)
End Get
End Property
End Class

View File

@@ -0,0 +1,14 @@
Partial Public Class liquidacionescompanias
ReadOnly Property Compañía As String
Get
If Me.liquidacionescompaniasrecibos.Any Then
Return Me.liquidacionescompaniasrecibos.First.recibos.polizassg.companias.Nombre
Else
Return ""
End If
End Get
End Property
End Class

View File

@@ -0,0 +1,27 @@
Imports System
Partial Public Class liquidacionesviajes
Public ReadOnly Property Diferencia As Double
Get
Return Math.Round(TotalJustificado - Anticipo, 2, MidpointRounding.AwayFromZero)
End Get
End Property
Public ReadOnly Property ADevolver As String
Get
If Diferencia < 0 Then
Return Math.Abs(Diferencia).ToString("c2")
Else
Return ""
End If
End Get
End Property
Public ReadOnly Property ARecibir As String
Get
If Diferencia > 0 Then
Return Diferencia.ToString("c2")
Else
Return ""
End If
End Get
End Property
End Class

52
guia/Extensiones/logs.vb Normal file
View File

@@ -0,0 +1,52 @@

Imports tsl5.Extensiones
Partial Public Class logs
Public Shared Function GeneraLog(bd As gestionasegasaEntities, Tabla As String, id As Integer, idrelacionado As Integer?, Tipo As String, LogXML As String, SuperUsuario As Boolean, Aplicacion As String) As Integer
Try
If bd Is Nothing Then
bd = bdGestionAsegasa.gestionasegasaEntities.NuevoContexto
End If
Dim nl As New logs
With nl
.Tabla = Tabla
.Aplicacion = Aplicacion
.LogXML = LogXML
.id = id
.idRelacionado = idrelacionado
.ip = bd.ip
.FechaHora = tsl5.bbdd.AhoraMysql(bd)
.Tipo = Tipo
If SuperUsuario Then
.Usuario = Utilidades.Usuario & " (SU)"
Else
.Usuario = Utilidades.Usuario
End If
.idTimeStamp = CDbl(Now.Ticks)
End With
bd.logs.AddObject(nl)
bd.GuardarCambios()
Return nl.idLog
Catch ex As Exception
Call Utilidades.AñadeLog(tsl5.Enumeraciones.TipoLog.Fallo, "En GeneraLog", ex.Message, ex)
Return -1
End Try
End Function
Public ReadOnly Property GeneradoPor As String
Get
If Me.idRelacionado.HasValue Then
Dim bd As gestionasegasaEntities = Me.ObtieneContexto
Dim lp = bd.logs.FirstOrDefault(Function(x) x.idLog = Me.idRelacionado)
If lp IsNot Nothing Then
Return lp.Aplicacion
Else
Return "DESCONOCIDO"
End If
Else
Return Me.Aplicacion
End If
End Get
End Property
End Class

View File

@@ -0,0 +1,44 @@
Partial Public Class modificacionespolizasagrario
Public ReadOnly Property PorIncAge As Double
Get
Return Me.previstasIncentivoAgente / Me.primaComercialNeta * 100
End Get
End Property
Public ReadOnly Property PorComAge As Double
Get
Return Me.previstasComisionAgente / Me.primaComercialNeta * 100
End Get
End Property
Public ReadOnly Property PorIncAse As Double
Get
Return Me.previstasIncentivoAsegasa / Me.primaComercialNeta * 100
End Get
End Property
Public ReadOnly Property PorComAse As Double
Get
Return Me.previstasComisionAsegasa / Me.primaComercialNeta * 100
End Get
End Property
Public ReadOnly Property PorNifNue As Double
Get
Return Me.previstasNIFNuevo / Me.primaComercialNeta * 100
End Get
End Property
Public ReadOnly Property PorTomPro As Double
Get
Return Me.previstasTomadorPropio / Me.primaComercialNeta * 100
End Get
End Property
Public ReadOnly Property PorTotComPre As Double
Get
Return Me.totalPrevistas / Me.primaComercialNeta * 100
End Get
End Property
End Class

View File

@@ -0,0 +1,38 @@
Public Class movimientosbancarios
Private _Conciliado As Boolean?
Public Property Conciliado As Boolean
Get
If _Conciliado.HasValue Then
Return _Conciliado
Else
If ConciliacionActual_TMP IsNot Nothing Then
If ConciliacionActual_TMP.idconciliacion <> Me.idConciliacion Then
Return False
Else
Return Me.idConciliacion.HasValue
End If
Else
Return Me.idConciliacion.HasValue
End If
End If
End Get
Set(value As Boolean)
_Conciliado = value
If value Then
Me.conciliacionesbancarias = Me.ConciliacionActual_TMP
Else
Me.idConciliacion = Nothing
End If
End Set
End Property
Public Property ConciliacionActual_TMP As conciliacionesbancarias
Public ReadOnly Property ConciliadoEn As String
Get
If ConciliacionActual_TMP IsNot Nothing AndAlso Me.idConciliacion.HasValue AndAlso Me.idConciliacion <> ConciliacionActual_TMP.idconciliacion Then
Return "Nº Conc.: " & Me.idConciliacion & " (" & Me.conciliacionesbancarias.Año.ToString & "-" & Me.conciliacionesbancarias.Mes.ToString & ")"
Else
Return ""
End If
End Get
End Property
End Class

View File

@@ -0,0 +1,53 @@
Partial Public Class municipios
Public Shared ListaPoblaciones As List(Of municipios)
Public ReadOnly Property PoblacionYProvincia As String
Get
Try
If Me.Nombre = Me.provincias.Nombre Then
Return Me.Nombre
Else
Return Me.Nombre & " (" & Me.provincias.Nombre & ")"
End If
Catch ex As Exception
Return ""
End Try
End Get
End Property
Public Shared Function ObtienePoblacion(CodigoPoblacion As String) As String
If ListaPoblaciones Is Nothing Then
Dim bd = bdGestionAsegasa.gestionasegasaEntities.NuevoContexto
ListaPoblaciones = bd.municipios.Include("provincias").ToList
End If
If ListaPoblaciones.Any(Function(x) x.CodigoMunicipio = CodigoPoblacion) Then
Return ListaPoblaciones.First(Function(x) x.CodigoMunicipio = CodigoPoblacion).Nombre
Else
Dim bd = bdGestionAsegasa.gestionasegasaEntities.NuevoContexto
Dim pob = bd.municipios.Include("provincias").FirstOrDefault(Function(x) x.CodigoMunicipio = CodigoPoblacion)
If pob IsNot Nothing Then
ListaPoblaciones.Add(pob)
Return pob.Nombre
Else
Return ""
End If
End If
End Function
Public Shared Function ObtieneProvincia(CodigoPoblacion As String) As String
If ListaPoblaciones Is Nothing Then
Dim bd = bdGestionAsegasa.gestionasegasaEntities.NuevoContexto
ListaPoblaciones = bd.municipios.Include("provincias").ToList
End If
If ListaPoblaciones.Any(Function(x) x.CodigoMunicipio = CodigoPoblacion) Then
Return ListaPoblaciones.First(Function(x) x.CodigoMunicipio = CodigoPoblacion).provincias.Nombre
Else
Dim bd = bdGestionAsegasa.gestionasegasaEntities.NuevoContexto
Dim pob = bd.municipios.Include("provincias").FirstOrDefault(Function(x) x.CodigoMunicipio = CodigoPoblacion)
If pob IsNot Nothing Then
ListaPoblaciones.Add(pob)
Return pob.provincias.Nombre
Else
Return ""
End If
End If
End Function
End Class

View File

@@ -0,0 +1,19 @@
Partial Public Class notificaciones
Public Property Notificado As Boolean
Get
Return FechaNotificado.HasValue
End Get
Set(value As Boolean)
FechaNotificado = If(value, Now, Nothing)
End Set
End Property
Public Enum TipoEntidadEnum As Integer
USUARIO = 1
AGENTE = 2
SUBAGENTE = 3
End Enum
Public Enum TipoNotificacionEnum As Integer
AVISO_AGENTE_RECIBOS_BAJA = 1
End Enum
End Class

View File

@@ -0,0 +1,21 @@
Public Class pagosliquidacionescias
Public ReadOnly Property ImportePago As Double
Get
Return Math.Round(Me.ImporteLiquidaciones + Me.ImporteRegularizacion, 2, MidpointRounding.AwayFromZero)
End Get
End Property
Public ReadOnly Property ImporteCobros As Double
Get
Return Math.Round(Me.liquidacionescompanias.Where(Function(x) x.enumeraciones.Codigo <> "TIPLIQ.DESCOBRO").Sum(Function(x) x.Importe), 2, MidpointRounding.AwayFromZero)
End Get
End Property
Public ReadOnly Property ImporteDesCobros As Double
Get
Return Math.Round(Me.liquidacionescompanias.Where(Function(x) x.enumeraciones.Codigo = "TIPLIQ.DESCOBRO").Sum(Function(x) x.Importe), 2, MidpointRounding.AwayFromZero)
End Get
End Property
Public Sub ActualizaImportePago()
Me.OnPropertyChanged("ImportePago")
End Sub
End Class

View File

@@ -0,0 +1,196 @@
Imports System.Text
Imports DevExpress.XtraRichEdit.Model
Partial Public Class pagostelematicos
Public ReadOnly Property CodigoRecibo As String
Get
If Me.idRecibo.HasValue Then
Return Me.recibos.CodigoRecibo
Else
Return ""
End If
End Get
End Property
Public Shared Function GeneraPagoTelematico(bd As bdGestionAsegasa.gestionasegasaEntities, OrigenPago As OrigenPagoEnum, Referencia As String, EmailConfirmacionPago As String, Telefono As String, Importe As Double, Optional DNI As String = "", Optional idRecibo As Integer? = Nothing) As pagostelematicos
Try
If idRecibo.HasValue AndAlso Not bd.recibos.Any(Function(x) x.idRecibo = idRecibo.Value) Then Throw New Exception("No se encuentra el recibo con id: " & idRecibo.Value.ToString)
Static r As System.Random = New System.Random()
Dim np As New bdGestionAsegasa.pagostelematicos
With np
.DNI = DNI.Trim().ToUpper()
.Referencia = Referencia.Trim().ToUpper()
.EmailConfirmacionPago = EmailConfirmacionPago.Trim().ToLower()
.Telefono = Telefono
.Importe = Math.Round(Importe, 2)
.FechaCreacion = Now
.idRecibo = idRecibo
.OrigenPago = OrigenPago
Randomize()
.CodigoConfirmacionPago = r.Next(100000000, 999999999).ToString
End With
bd.pagostelematicos.AddObject(np)
bd.SaveChanges()
Return np
Catch ex As Exception
Throw New Exception(ex.Message, ex)
End Try
End Function
End Class
Public Enum OrigenPagoEnum
PAGO_GENERICO = 0
PAGO_RECIBO = 1
End Enum
Public Class RespuestaRedsysPOST
'////////////////////////////
'// Atributos de la clase //
'/////////////////////////
Public Ds_SignatureVersion As String
Public Ds_MerchantParameters As String
Public Ds_Signature As String
Public Confirmacion As ConfirmacionRedsys
'////////////////////
'// Constructores //
'//////////////////
Public Sub New()
MyBase.New()
End Sub
Public Sub New(datosPOST As Specialized.NameValueCollection)
'// Esto lo he implementado como un bucle porque no estoy seguro de si los parámetros opcionales llegarán
'// vacíos o no llegarán. De este modo, garantizo que no habrá excepciones por exigir la existencia
'// de un parámetro que nunca llegue.
For Each p In datosPOST
If p = "Ds_SignatureVersion" Then Me.Ds_SignatureVersion = datosPOST(p)
If p = "Ds_MerchantParameters" Then Me.Ds_MerchantParameters = datosPOST(p)
If p = "Ds_Signature" Then Me.Ds_Signature = datosPOST(p)
Next
Dim bDatos As Byte() = Convert.FromBase64String(Ds_MerchantParameters)
Dim sDatos As String = Encoding.UTF8.GetString(bDatos)
Dim jDatos As ConfirmacionRedsys = Newtonsoft.Json.JsonConvert.DeserializeObject(sDatos, GetType(ConfirmacionRedsys))
Me.Confirmacion = jDatos
End Sub
End Class
Public Class ConfirmacionRedsys
'////////////////////////////
'// Atributos de la clase //
'/////////////////////////
Public Ds_Date As String
Public Ds_Hour As String
Public Ds_Amount As String
Public Ds_Currency As String
Public Ds_Order As String
Public Ds_MerchantCode As String
Public Ds_Terminal As String
Public Ds_Response As String
Public Ds_MerchantData As String
Public Ds_SecurePayment As String
Public Ds_TransactionType As String
Public Ds_Card_Country As String '// Lista de códigos de país: https://unstats.un.org/unsd/methodology/m49/
Public Ds_AuthorisationCode As String
Public Ds_ConsumerLanguage As String
Public Ds_Card_Type As String
Private sSeparadorFecha = "%2F"
Private sSeparadorHora = "%3A"
'//////////////////
'// Propiedades //
'////////////////
Public ReadOnly Property Ds_Date__ComoDate As DateTime
Get
Dim dd As String = Me.Ds_Date.Split(sSeparadorFecha)(0)
Dim mm As String = Me.Ds_Date.Split(sSeparadorFecha)(1).Substring(2, 2)
Dim yyyy As String = Me.Ds_Date.Split(sSeparadorFecha)(2).Substring(2, 4)
Dim resultado As New Date(yyyy, mm, dd)
Return resultado
End Get
End Property
Public ReadOnly Property Ds_Hour__ComoTimeSpan As TimeSpan
Get
Dim H As String = Me.Ds_Hour.Split(sSeparadorHora)(0)
Dim m As String = Me.Ds_Hour.Split(sSeparadorHora)(1).Substring(2, 2)
Dim resultado As New TimeSpan(H, m, 0)
Return resultado
End Get
End Property
Public ReadOnly Property Ds_Amount__ComoDouble As Double
Get
Return Me.Ds_Amount / 100.0
End Get
End Property
Public ReadOnly Property Ds_Response__ComoBoolean As Boolean
Get
Dim resultado As Boolean = False
Dim codigoRespuesta As UInteger = UInteger.Parse(Me.Ds_Response)
If codigoRespuesta >= 0 AndAlso codigoRespuesta <= 99 Then
resultado = True
End If
Return resultado
End Get
End Property
Public ReadOnly Property Ds_SecurePayment__ComoBoolean As Boolean
Get
If Me.Ds_SecurePayment = "1" Then
Return True
Else
Return False
End If
End Get
End Property
Public ReadOnly Property Ds_Card_Type__ComoEnum As RedsysTipoTarjeta
Get
Dim resultado As RedsysTipoTarjeta = RedsysTipoTarjeta.NO_PROPORCIONADO
If Me.Ds_Card_Type = "C" Then
resultado = RedsysTipoTarjeta.CREDITO
ElseIf Me.Ds_Card_Type = "D" Then
resultado = RedsysTipoTarjeta.DEBITO
End If
Return resultado
End Get
End Property
Public ReadOnly Property FechaHora As DateTime
Get
Dim dd As String = Me.Ds_Date.Split(sSeparadorFecha)(0)
Dim mm As String = Me.Ds_Date.Split(sSeparadorFecha)(1).Substring(2, 2)
Dim yyyy As String = Me.Ds_Date.Split(sSeparadorFecha)(2).Substring(2, 4)
Dim H As String = Me.Ds_Hour.Split(sSeparadorHora)(0)
Dim m As String = Me.Ds_Hour.Split(sSeparadorHora)(1).Substring(2, 2)
Return New DateTime(yyyy, mm, dd, H, m, 0)
End Get
End Property
''////////////////////
''// Constructores //
''//////////////////
'Public Sub New()
' MyBase.New()
'End Sub
'Public Sub New(datosPOST As Specialized.NameValueCollection)
' MyBase.New()
' For Each p In datosPOST
' If p = "Ds_Date" Then Me.Ds_Date = datosPOST(p)
' If p = "Ds_Hour" Then Me.Ds_Hour = datosPOST(p)
' If p = "Ds_Amount" Then Me.Ds_Amount = datosPOST(p)
' If p = "Ds_Currency" Then Me.Ds_Currency = datosPOST(p)
' If p = "Ds_Order" Then Me.Ds_Order = datosPOST(p)
' If p = "Ds_MerchantCode" Then Me.Ds_MerchantCode = datosPOST(p)
' If p = "Ds_Terminal" Then Me.Ds_Terminal = datosPOST(p)
' If p = "Ds_Response" Then Me.Ds_Response = datosPOST(p)
' If p = "Ds_MerchantData" Then Me.Ds_MerchantData = datosPOST(p)
' If p = "Ds_SecurePayment" Then Me.Ds_SecurePayment = datosPOST(p)
' If p = "Ds_TransactionType" Then Me.Ds_TransactionType = datosPOST(p)
' If p = "Ds_Card_Country" Then Me.Ds_Card_Country = datosPOST(p)
' If p = "Ds_AuthorisationCode" Then Me.Ds_AuthorisationCode = datosPOST(p)
' If p = "Ds_ConsumerLanguage" Then Me.Ds_ConsumerLanguage = datosPOST(p)
' If p = "Ds_Card_Type" Then Me.Ds_Card_Type = datosPOST(p)
' Next
'End Sub
End Class
Public Enum RedsysTipoTarjeta
NO_PROPORCIONADO = 0
CREDITO = 1
DEBITO = 2
End Enum

View File

@@ -0,0 +1,13 @@
Imports tsl5
Imports bdGestionAsegasa
Imports tsl5.Extensiones
Partial Public Class planeslineas
Public ReadOnly Property PlanesLineasDescripcion As String
Get
Return Me.planLinea & ", " & Me.descripcion
End Get
End Property
End Class

View File

@@ -0,0 +1,12 @@
Public Class plantillas
Public ReadOnly Property Plantilla As Byte()
Get
If Me.ficheros IsNot Nothing Then
Return Me.ficheros.Fichero
Else
Return Nothing
End If
End Get
End Property
End Class

View File

@@ -0,0 +1,109 @@
Imports tsl5
Imports bdGestionAsegasa
Imports tsl5.Extensiones
Imports DevExpress.CodeParser
Partial Public Class polizasagrario
#Region "Tomador"
Public ReadOnly Property Tomador As entidades
Get
Return Me.entidades
End Get
End Property
#End Region
#Region "Asegurado"
Public ReadOnly Property Asegurado As entidades
Get
Return Me.entidades1
End Get
End Property
Public ReadOnly Property DireccionAsegurado As direcciones
Get
Return Me.direcciones
End Get
End Property
#End Region
Public ReadOnly Property CodNomAgente As String
Get
Return Me.agentes.Codigo & "-" & Me.agentes.Nombre
End Get
End Property
Public ReadOnly Property Fraccio As String
Get
Dim Retorno = "NO"
If Me.fraccionada = True Then Retorno = "SI"
Return Retorno
End Get
End Property
Public ReadOnly Property idSubAgente_Especial As Integer?
Get
If Me.idSubagente.HasValue AndAlso Me.agentes.Codigo = "000047002186" Then
Dim bd As gestionasegasaEntities = Me.ObtieneContexto
Dim Codigo = Me.subagentes.Codigo.Substring(0, 2) & "00"
Dim subage = bd.subagentes.FirstOrDefault(Function(x) x.idAgente = Me.idAgente And x.Codigo = Codigo)
If subage IsNot Nothing Then
Return subage.idSubagente
Else
Return Nothing
End If
Else
Return idSubagente
End If
End Get
End Property
Public ReadOnly Property ProvinciaAsegurado As String
Get
If Me.entidades1 IsNot Nothing AndAlso Me.entidades1.direcciones1 IsNot Nothing AndAlso Me.entidades1.direcciones1.CodigoPostal IsNot Nothing AndAlso Me.entidades1.direcciones1.CodigoPostal.Length > 2 Then
Return Me.entidades1.direcciones1.CodigoPostal.Substring(0, 2)
Else
Return ""
End If
End Get
End Property
#Region "Conversiones"
Public Function AListadoGenericoPA() As ListadoGenericoPA
Return New ListadoGenericoPA(Me)
End Function
#End Region
End Class
#Region "Exportaciones"
Public Class ListadoGenericoPA
Public Sub New(Poliza As polizasagrario)
NumeroPóliza = Poliza.poliza
FechaPóliza = Poliza.fechaPoliza
Línea = Poliza.planeslineas.descripcion
Compañía = Poliza.companias.Nombre
CIFAsegurado = Poliza.entidades1.CIF
Asegurado = Poliza.entidades1.RazonSocial
Teléfono1 = If(Poliza.telefono1Asegurado.NothingAVacio <> "", Poliza.telefono1Asegurado, Poliza.entidades1.Telefono1.NothingAVacio)
Teléfono2 = If(Poliza.telefono2Asegurado.NothingAVacio <> "", Poliza.telefono2Asegurado, Poliza.entidades1.Telefono2.NothingAVacio)
Email = If(Poliza.emailAsegurado.NothingAVacio <> "", Poliza.emailAsegurado, Poliza.entidades1.Email.NothingAVacio)
End Sub
Property NumeroPóliza As String
Property FechaPóliza As Date?
Property Compañía As String
Property Línea As String
Property CIFAsegurado As String
Property Asegurado As String
Property Teléfono1 As String
Property Teléfono2 As String
Property Email As String
End Class
#End Region

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,8 @@
Partial Public Class procesos
Public ReadOnly Property Permiso As tsWPF.Permisos
Get
Dim bd As bdGestionAsegasa.gestionasegasaEntities = tsWPF.ObtieneContexto(Me)
Return Utilidades.ObtienePermisos(bd, Me.idPermiso, bdGestionAsegasa.Utilidades.dsc.idUsuario)
End Get
End Property
End Class

35
guia/Extensiones/ramos.vb Normal file
View File

@@ -0,0 +1,35 @@
Partial Public Class ramos
Public Shared Function ObtieneIDRamos(bd As bdGestionAsegasa.gestionasegasaEntities, CodigosRamos() As String) As Integer()
Return bd.ramos.Where(Function(x) CodigosRamos.Contains(x.Codigo)).Select(Function(x) x.idRamo).ToArray
End Function
''' <summary>
''' Cambia de idRamo todas las pólzias asociadas al ramoAnterior y tras el cambio elimina dicho ramo
''' </summary>
''' <param name="bd"></param>
''' <param name="ramoAnterior"></param>
''' <param name="ramoNuevo"></param>
''' <returns></returns>
Public Shared Function EliminarRamo(bd As bdGestionAsegasa.gestionasegasaEntities, ramoAnterior As String, ramoNuevo As String) As Boolean
Dim cambiosCorrectos = False
Try
bd.ExecuteStoreCommand("UPDATE polizassg set idRamo=" & ramoNuevo & " WHERE idRamo=" & ramoAnterior)
bd.ExecuteStoreCommand("DELETE FROM ramos where idRamo=" & ramoAnterior)
cambiosCorrectos = True
Catch ex As Exception
cambiosCorrectos = False
End Try
Return cambiosCorrectos
End Function
Public ReadOnly Property CodigoYDescripcion As String
Get
Return Me.Codigo & " " & Me.Descripcion
End Get
End Property
End Class

3872
guia/Extensiones/recibos.vb Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,84 @@
Imports bdGestionAsegasa.seriesfacturas
Partial Public Class registrosverifactu
Public ReadOnly Property CSV As String
Get
If Me.peticionesverifactu Is Nothing Then
Return String.Empty
Else
Return Me.peticionesverifactu.CSV
End If
End Get
End Property
Public ReadOnly Property DescripcionEstado As String
Get
Return (CType(Me.Estado, EstadoEnum)).ToString().Replace("_", " ")
End Get
End Property
Public ReadOnly Property DescripcionOperacion As String
Get
Return (CType(Me.Operacion, OperacionEnum)).ToString().Replace("_", " ")
End Get
End Property
Public ReadOnly Property DescripcionTipoFactura As String
Get
Select Case CType(Me.TipoFactura, TipoFacturaEnum)
Case TipoFacturaEnum.F1
Return "F1 - Factura (art. 6, 7.2 y 7.3 del RD 1619/2012)"
Case TipoFacturaEnum.F2
Return "F2 - Factura Simplificada y Facturas sin identificación del destinatario"
Case TipoFacturaEnum.F3
Return "F3 - Factura emitida en sustitución de facturas simplificadas facturadas y declaradas"
Case TipoFacturaEnum.R1
Return "R1 - Factura Rectificativa (Error fundado en derecho y Art. 80 Uno Dos y Seis LIVA)"
Case TipoFacturaEnum.R2
Return "R2 - Factura Rectificativa (Art. 80.3). Cuando el destinatario de las operaciones sujetas al Impuesto no haya hecho efectivo el pago de las cuotas repercutidas y siempre que, con posterioridad al devengo de la operación, se dicte auto de declaración de concurso."
Case TipoFacturaEnum.R3
Return "R3 - Factura Rectificativa (Art. 80.4). Cuando los créditos correspondientes a las cuotas repercutidas por las operaciones gravadas sean total o parcialmente incobrables."
Case TipoFacturaEnum.R4
Return "R4 - Factura Rectificativa (Resto)"
Case TipoFacturaEnum.R5
Return "R5 - Factura Rectificativa en facturas simplificadas. Factura emitida en sustitución de facturas simplificadas facturadas y declaradas"
'Case TipoFacturaEnum.A
' Return "Factura Anulación"
Case Else
Return "Tipo de factura desconocido"
End Select
End Get
End Property
Public Enum TipoFacturaEnum
F1 'Factura (art. 6, 7.2 y 7.3 del RD 1619/2012).
F2 'Factura Simplificada y Facturas sin identificación del destinatario art. 6.1.d) RD 1619/2012.
F3 'Factura emitida en sustitución de facturas simplificadas facturadas y declaradas.
R1 'Factura Rectificativa (Error fundado en derecho y Art. 80 Uno Dos y Seis LIVA).
R2 'Factura Rectificativa (Art. 80.3). Cuando el destinatario de las operaciones sujetas al Impuesto no haya hecho efectivo el pago de las cuotas repercutidas y siempre que, con posterioridad al devengo de la operación, se dicte auto de declaración de concurso.
R3 'Factura Rectificativa (Art. 80.4). Cuando los créditos correspondientes a las cuotas repercutidas por las operaciones gravadas sean total o parcialmente incobrables.
R4 'Factura Rectificativa (Resto).
R5 'Factura Rectificativa en facturas simplificadas. Factura emitida en sustitución de facturas simplificadas facturadas y declaradas.
' A = 100 'Factura Anulación (Tipo añadido por Tecnosis)
End Enum
Public Enum OperacionEnum
ALTA = 0
SUBSANACION = 1
ALTA_POR_RECHAZO = 2
REENVÍO = 3
ANULACIÓN = 9
CONSULTA_DATOS = 5
OBTENCIÓN_QR = 100
End Enum
Public Enum EstadoEnum
PENDIENTE_RESPUESTA = 0
CORRECTO = 1
ACEPTADO_CON_ERRORES = 2
INCORRECTO = 3
COMPLETADO = 10
End Enum
Public Enum AplicacionEnum As Integer
LIQUIDACION_AGENTE = 0
End Enum
End Class

View File

@@ -0,0 +1,14 @@
Public Class regularizacionespagosagentes
Public Enum TipoRegularizacion
DESCOBRO_RECIBO = 1
DEVOLUCION_PAGO_AL_AGENTE = 2
RECALCULO_COMISION = 3
CAMBIADO_DE_AGENTE = 4
End Enum
Public ReadOnly Property DescripcionTipo As String
Get
Return DirectCast(Tipo, TipoRegularizacion).ToString.Replace("_", " ")
End Get
End Property
End Class

View File

@@ -0,0 +1,28 @@
Partial Public Class seriesfacturas
Private Shared _ListadoSeries As List(Of String)
Public Shared ReadOnly Property ListadoSeries As List(Of String)
Get
If _ListadoSeries Is Nothing Then
Dim bd = bdGestionAsegasa.gestionasegasaEntities.NuevoContextoCN()
_ListadoSeries = bd.seriesfacturas.Select(Function(x) x.Serie).ToList
End If
Return _ListadoSeries
End Get
End Property
Public ReadOnly Property SerieDescripcion As String
Get
Return Me.Serie & " - " & Me.Descripcion
End Get
End Property
Public ReadOnly Property DescripcionClase As String
Get
Return DirectCast(Me.Clase, ClaseFacturaEnum).ToString.Replace("_", " ")
End Get
End Property
Public Enum ClaseFacturaEnum As Integer
LIQUIDACIONES_A_AGENTES = 0
End Enum
End Class

View File

@@ -0,0 +1,750 @@
Imports System.Data.Objects
Imports tsl5.Extensiones
Partial Public Class siniestros
Public Property idPoliza_Nulable As Integer?
Get
If Me.idPoliza = 0 Then
Return Nothing
Else
Return Me.idPoliza
End If
End Get
Set(value As Integer?)
If value.HasValue Then Me.idPoliza = value.Value
End Set
End Property
#Region "Contrario"
Private _CifContrarioTmpEsNulo As Boolean = True
Private _CifContrarioTmp As String
Public Property CifContrarioTmp As String
Get
If _CifContrarioTmpEsNulo Then
If Me.entidades Is Nothing Then
Return ""
Else
_CifContrarioTmp = Me.entidades.CIF
_CifContrarioTmpEsNulo = False
Return Me.entidades.CIF
End If
Else
Return _CifContrarioTmp
End If
'If Me.entidades Is Nothing Then
' If _CifContrarioTmpEsNulo Then
' Return ""
' Else
' Return _CifContrarioTmp
' End If
'Else
' Return Me.entidades.CIF
'End If
End Get
Set(value As String)
_CifContrarioTmp = value
_CifContrarioTmpEsNulo = False
If Me.entidades IsNot Nothing Then
If value.NothingAVacio = "" Then
Me.entidades.CIF = Nothing
Else
Me.entidades.CIF = value
End If
End If
Me.OnPropertyChanged("CifContrarioTmp")
Me.OnPropertyChanged("RazonSocialContrarioTmp")
Me.OnPropertyChanged("CodigoPostalContrarioTmp")
Me.OnPropertyChanged("DomicilioContrarioTmp")
Me.OnPropertyChanged("CodigoPoblacionContrarioTmp")
Me.OnPropertyChanged("PoblacionContrarioTmp")
Me.OnPropertyChanged("ProvinciaContrarioTmp")
Me.OnPropertyChanged("TelefonoContrario1Tmp")
Me.OnPropertyChanged("TelefonoContrario2Tmp")
Me.OnPropertyChanged("EmailContrarioTmp")
End Set
End Property
Private _RazonSocialContrarioTmpEsNulo As Boolean = True
Private _RazonSocialContrarioTmp As String
Public Property RazonSocialContrarioTmp As String
Get
If _RazonSocialContrarioTmpEsNulo Then
If Me.entidades Is Nothing Then
Return ""
Else
Dim rs As String
If Me.entidades.RazonSocial = "" Then
rs = (Me.entidades.Apellidos & ", " & Me.entidades.Nombre).Trim.Trim(",")
Else
rs = Me.entidades.RazonSocial
End If
_RazonSocialContrarioTmpEsNulo = False
_RazonSocialContrarioTmp = rs
Return rs
End If
Else
Return _RazonSocialContrarioTmp
End If
'If Me.entidades Is Nothing Then
' If _RazonSocialContrarioTmpEsNulo Then
' Return ""
' Else
' Return _RazonSocialContrarioTmp
' End If
'Else
' If Me.entidades.RazonSocial = "" Then
' Return (Me.entidades.Apellidos & ", " & Me.entidades.Nombre).Trim.Trim(",")
' Else
' Return Me.entidades.RazonSocial
' End If
'End If
End Get
Set(value As String)
_RazonSocialContrarioTmp = value
_RazonSocialContrarioTmpEsNulo = False
If Me.entidades IsNot Nothing Then
Me.entidades.RazonSocial = value
If Me.entidades.CIF.NothingAVacio <> "" AndAlso "1234567890X".Contains(Me.entidades.CIF.Substring(1, 1)) AndAlso value.Contains(",") Then
Me.entidades.Apellidos = value.Split(",")(0).Trim
Me.entidades.Nombre = value.Split(",")(1).Trim
End If
End If
Me.OnPropertyChanged("RazonSocialContrarioTmp")
End Set
End Property
Private _CodigoPostalContrarioTmpEsNulo As Boolean = True
Private _CodigoPostalContrarioTmp As String
Public Property CodigoPostalContrarioTmp As String
Get
If _CodigoPostalContrarioTmpEsNulo Then
If Me.entidades Is Nothing OrElse Me.entidades.DireccionPrincipal Is Nothing Then
Return ""
Else
_CodigoPostalContrarioTmp = Me.entidades.DireccionPrincipal.CodigoPostal
_CodigoPostalContrarioTmpEsNulo = False
Return Me.entidades.DireccionPrincipal.CodigoPostal
End If
Else
Return _CodigoPostalContrarioTmp
End If
'If Me.entidades Is Nothing OrElse Me.entidades.DireccionPrincipal Is Nothing Then
' If _CodigoPostalContrarioTmpEsNulo Then
' Return ""
' Else
' Return _CodigoPostalContrarioTmp
' End If
'Else
' Return Me.entidades.DireccionPrincipal.CodigoPostal
'End If
End Get
Set(value As String)
_CodigoPostalContrarioTmp = value
_CodigoPostalContrarioTmpEsNulo = False
If Me.entidades IsNot Nothing AndAlso Me.entidades.DireccionPrincipal IsNot Nothing Then
Me.entidades.DireccionPrincipal.CodigoPostal = value
End If
Me.OnPropertyChanged("CodigoPostalContrarioTmp")
End Set
End Property
Private _DomicilioContrarioTmpEsNulo As Boolean = True
Private _DomicilioContrarioTmp As String
Public Property DomicilioContrarioTmp As String
Get
If _DomicilioContrarioTmpEsNulo Then
If Me.entidades Is Nothing OrElse Me.entidades.DireccionPrincipal Is Nothing Then
Return ""
Else
_DomicilioContrarioTmp = Me.entidades.DireccionPrincipal.Direccion
_DomicilioContrarioTmpEsNulo = False
Return Me.entidades.DireccionPrincipal.Direccion
End If
Else
Return _DomicilioContrarioTmp
End If
'If Me.entidades Is Nothing OrElse Me.entidades.DireccionPrincipal Is Nothing Then
' If _DomicilioContrarioTmpEsNulo Then
' Return ""
' Else
' Return _DomicilioContrarioTmp
' End If
'Else
' Return Me.entidades.DireccionPrincipal.Direccion
'End If
End Get
Set(value As String)
_DomicilioContrarioTmp = value
_DomicilioContrarioTmpEsNulo = False
If Me.entidades IsNot Nothing AndAlso Me.entidades.DireccionPrincipal IsNot Nothing Then
Me.entidades.DireccionPrincipal.Direccion = value
End If
Me.OnPropertyChanged("DomicilioContrarioTmp")
End Set
End Property
Private _CodigoPoblacionContrarioTmpEsNulo As Boolean = True
Private _CodigoPoblacionContrarioTmp As String
Public Property CodigoPoblacionContrarioTmp As String
Get
If _CodigoPoblacionContrarioTmpEsNulo Then
If Me.entidades Is Nothing OrElse Me.entidades.DireccionPrincipal Is Nothing OrElse Me.entidades.DireccionPrincipal.municipios Is Nothing Then
If Me.entidades IsNot Nothing AndAlso Me.entidades.DireccionPrincipal IsNot Nothing AndAlso Me.entidades.DireccionPrincipal.municipios Is Nothing Then
If Me.entidades.DireccionPrincipal.CodigoPostal.NothingAVacio <> "" Then
Dim bd = bdGestionAsegasa.gestionasegasaEntities.NuevoContexto
Dim pob = bd.codigospostales.First(Function(x) x.CodigoPostal = Me.entidades.DireccionPrincipal.CodigoPostal)
Me.entidades.DireccionPrincipal.CodigoMunicipio = pob.CodigoMunicipio
_CodigoPoblacionContrarioTmp = pob.CodigoMunicipio
_CodigoPoblacionContrarioTmpEsNulo = False
Return _CodigoPoblacionContrarioTmp
Else
Return ""
End If
Else
Return ""
End If
Else
_CodigoPoblacionContrarioTmp = Me.entidades.DireccionPrincipal.CodigoMunicipio
_CodigoPoblacionContrarioTmpEsNulo = False
Return Me.entidades.DireccionPrincipal.CodigoMunicipio
End If
Else
Return _CodigoPoblacionContrarioTmp
End If
'If Me.entidades Is Nothing OrElse Me.entidades.DireccionPrincipal Is Nothing OrElse Me.entidades.DireccionPrincipal.municipios Is Nothing Then
' If _CodigoPoblacionContrarioTmpEsNulo Then
' Return ""
' Else
' Return _CodigoPoblacionContrarioTmp
' End If
'Else
' Return Me.entidades.DireccionPrincipal.CodigoMunicipio
'End If
End Get
Set(value As String)
_CodigoPoblacionContrarioTmp = value
_CodigoPoblacionContrarioTmpEsNulo = False
If Me.entidades IsNot Nothing AndAlso Me.entidades.DireccionPrincipal IsNot Nothing Then
Me.entidades.DireccionPrincipal.CodigoMunicipio = value
End If
Me.OnPropertyChanged("CodigoPoblacionContrarioTmp")
Me.OnPropertyChanged("PoblacionContrarioTmp")
Me.OnPropertyChanged("ProvinciaContrarioTmp")
End Set
End Property
Public ReadOnly Property PoblacionContrarioTmp As String
Get
Return municipios.ObtienePoblacion(CodigoPoblacionContrarioTmp)
End Get
End Property
Public ReadOnly Property ProvinciaContrarioTmp As String
Get
Return municipios.ObtieneProvincia(CodigoPoblacionContrarioTmp)
End Get
End Property
Private _TelefonoContrario1TmpEsNulo As Boolean = True
Private _TelefonoContrario1Tmp As String
Public Property TelefonoContrario1Tmp As String
Get
If _TelefonoContrario1TmpEsNulo Then
If Me.entidades Is Nothing Then
Return ""
Else
_TelefonoContrario1Tmp = Me.entidades.Telefono1
_TelefonoContrario1TmpEsNulo = False
Return Me.entidades.Telefono1
End If
Else
Return _TelefonoContrario1Tmp
End If
'If Me.entidades Is Nothing Then
' If _TelefonoContrarioTmpEsNulo Then
' Return ""
' Else
' Return _TelefonoContrarioTmp
' End If
'Else
' Return Me.entidades.Telefono1
'End If
End Get
Set(value As String)
_TelefonoContrario1Tmp = value
_TelefonoContrario1TmpEsNulo = False
If Me.entidades IsNot Nothing Then
Me.entidades.Telefono1 = value
End If
Me.OnPropertyChanged("TelefonoContrario1Tmp")
End Set
End Property
Private _TelefonoContrario2TmpEsNulo As Boolean = True
Private _TelefonoContrario2Tmp As String
Public Property TelefonoContrario2Tmp As String
Get
If _TelefonoContrario2TmpEsNulo Then
If Me.entidades Is Nothing Then
Return ""
Else
_TelefonoContrario2Tmp = Me.entidades.Telefono2
_TelefonoContrario2TmpEsNulo = False
Return Me.entidades.Telefono2
End If
Else
Return _TelefonoContrario2Tmp
End If
'If Me.entidades Is Nothing Then
' If _TelefonoContrarioTmpEsNulo Then
' Return ""
' Else
' Return _TelefonoContrarioTmp
' End If
'Else
' Return Me.entidades.Telefono1
'End If
End Get
Set(value As String)
_TelefonoContrario2Tmp = value
_TelefonoContrario2TmpEsNulo = False
If Me.entidades IsNot Nothing Then
Me.entidades.Telefono2 = value
End If
Me.OnPropertyChanged("TelefonoContrario2Tmp")
End Set
End Property
Private _EmailContrarioTmpEsNulo As Boolean = True
Private _EmailContrarioTmp As String
Public Property EmailContrarioTmp As String
Get
If _EmailContrarioTmpEsNulo Then
If Me.entidades Is Nothing Then
Return ""
Else
_EmailContrarioTmp = Me.entidades.Email
_EmailContrarioTmpEsNulo = False
Return Me.entidades.Email
End If
Else
Return _EmailContrarioTmp
End If
'If Me.entidades Is Nothing Then
' If _EmailContrarioTmpEsNulo Then
' Return ""
' Else
' Return _EmailContrarioTmp
' End If
'Else
' Return Me.entidades.Email
'End If
End Get
Set(value As String)
_EmailContrarioTmp = value
_EmailContrarioTmpEsNulo = False
If Me.entidades IsNot Nothing Then
Me.entidades.Email = value
End If
Me.OnPropertyChanged("EmailContrarioTmp")
End Set
End Property
Public Sub ReiniciaValoresTMPContrario()
_CifContrarioTmpEsNulo = True
_RazonSocialContrarioTmpEsNulo = True
_CodigoPoblacionContrarioTmpEsNulo = True
_CodigoPostalContrarioTmpEsNulo = True
_DomicilioContrarioTmpEsNulo = True
_TelefonoContrario1TmpEsNulo = True
_TelefonoContrario2TmpEsNulo = True
_EmailContrarioTmpEsNulo = True
End Sub
#End Region
#Region "Taller"
Private _CifTallerTmpEsNulo As Boolean = True
Private _CifTallerTmp As String
Public Property CifTallerTmp As String
Get
If _CifTallerTmpEsNulo Then
If Me.entidades1 Is Nothing Then
Return ""
Else
_CifTallerTmp = Me.entidades1.CIF
_CifTallerTmpEsNulo = False
Return Me.entidades1.CIF
End If
Else
Return _CifTallerTmp
End If
'If Me.entidades1 Is Nothing Then
' If _CifTallerTmpEsNulo Then
' Return ""
' Else
' Return _CifTallerTmp
' End If
'Else
' Return Me.entidades1.CIF
'End If
End Get
Set(value As String)
_CifTallerTmp = value
_CifTallerTmpEsNulo = False
If Me.entidades1 IsNot Nothing Then
If value.NothingAVacio = "" Then
Me.entidades1.CIF = Nothing
Else
Me.entidades1.CIF = value
End If
End If
Me.OnPropertyChanged("CifTallerTmp")
Me.OnPropertyChanged("RazonSocialTallerTmp")
Me.OnPropertyChanged("CodigoPostalTallerTmp")
Me.OnPropertyChanged("DomicilioTallerTmp")
Me.OnPropertyChanged("CodigoPoblacionTallerTmp")
Me.OnPropertyChanged("PoblacionTallerTmp")
Me.OnPropertyChanged("ProvinciaTallerTmp")
Me.OnPropertyChanged("TelefonoTallerTmp")
Me.OnPropertyChanged("EmailTallerTmp")
End Set
End Property
Private _RazonSocialTallerTmpEsNulo As Boolean = True
Private _RazonSocialTallerTmp As String
Public Property RazonSocialTallerTmp As String
Get
If _RazonSocialTallerTmpEsNulo Then
If Me.entidades1 IsNot Nothing Then
Dim rs As String
If Me.entidades1.RazonSocial.NothingAVacio = "" Then
rs = (Me.entidades1.Apellidos & ", " & Me.entidades1.Nombre).Trim.Trim(",")
Else
rs = Me.entidades1.RazonSocial
End If
_RazonSocialTallerTmpEsNulo = False
_RazonSocialTallerTmp = rs
Return rs
Else
Return ""
End If
Else
Return _RazonSocialTallerTmp
End If
'If Me.entidades1 Is Nothing Then
' If _RazonSocialTallerTmpEsNulo Then
' Return ""
' Else
' Return _RazonSocialTallerTmp
' End If
'Else
' If Me.entidades1.RazonSocial = "" Then
' Return (Me.entidades1.Apellidos & ", " & Me.entidades1.Nombre).Trim.Trim(",")
' Else
' Return Me.entidades1.RazonSocial
' End If
'End If
End Get
Set(value As String)
_RazonSocialTallerTmp = value
_RazonSocialTallerTmpEsNulo = False
If Me.entidades1 IsNot Nothing Then
Me.entidades1.RazonSocial = value
If Me.entidades1.CIF.NothingAVacio <> "" AndAlso "1234567890X".Contains(Me.entidades1.CIF.Substring(1, 1)) AndAlso value.Contains(",") Then
Me.entidades1.Apellidos = value.Split(",")(0).Trim
Me.entidades1.Nombre = value.Split(",")(1).Trim
End If
End If
Me.OnPropertyChanged("RazonSocialTallerTmp")
End Set
End Property
Private _CodigoPostalTallerTmpEsNulo As Boolean = True
Public _CodigoPostalTallerTmp As String
Public Property CodigoPostalTallerTmp As String
Get
If _CodigoPostalTallerTmpEsNulo Then
If Me.entidades1 IsNot Nothing AndAlso Me.entidades1.DireccionPrincipal IsNot Nothing Then
_CodigoPostalTallerTmp = Me.entidades1.DireccionPrincipal.CodigoPostal
_CodigoPostalTallerTmpEsNulo = False
Return Me.entidades1.DireccionPrincipal.CodigoPostal
Else
Return ""
End If
Else
Return _CodigoPostalTallerTmp
End If
'If Me.entidades1 Is Nothing OrElse Me.entidades1.DireccionPrincipal Is Nothing Then
' If _CodigoPostalTallerTmpEsNulo Then
' Return ""
' Else
' Return _CodigoPostalTallerTmp
' End If
'Else
' Return Me.entidades1.DireccionPrincipal.CodigoPostal
'End If
End Get
Set(value As String)
_CodigoPostalTallerTmp = value
_CodigoPostalTallerTmpEsNulo = False
If Me.entidades1 IsNot Nothing AndAlso Me.entidades1.DireccionPrincipal IsNot Nothing Then
Me.entidades1.DireccionPrincipal.CodigoPostal = value
End If
Me.OnPropertyChanged("CodigoPostalTallerTmp")
End Set
End Property
Private _DomicilioTallerTmpEsNulo As Boolean = True
Private _DomicilioTallerTmp As String
Public Property DomicilioTallerTmp As String
Get
If _DomicilioTallerTmpEsNulo Then
If Me.entidades1 IsNot Nothing AndAlso Me.entidades1.DireccionPrincipal IsNot Nothing Then
_DomicilioTallerTmp = Me.entidades1.DireccionPrincipal.Direccion.NothingAVacio
_DomicilioTallerTmpEsNulo = False
Return Me.entidades1.DireccionPrincipal.Direccion
Else
Return ""
End If
Else
Return _DomicilioTallerTmp
End If
'If Me.entidades1 Is Nothing OrElse Me.entidades1.DireccionPrincipal Is Nothing Then
' If _DomicilioTallerTmpEsNulo Then
' Return ""
' Else
' Return _DomicilioTallerTmp
' End If
'Else
' Return Me.entidades1.DireccionPrincipal.Direccion
'End If
End Get
Set(value As String)
_DomicilioTallerTmp = value
_DomicilioTallerTmpEsNulo = False
If Me.entidades1 IsNot Nothing AndAlso Me.entidades1.DireccionPrincipal IsNot Nothing Then
Me.entidades1.DireccionPrincipal.Direccion = value
End If
Me.OnPropertyChanged("DomicilioTallerTmp")
End Set
End Property
Private _CodigoPoblacionTallerTmpEsNulo As Boolean = True
Private _CodigoPoblacionTallerTmp As String
Public Property CodigoPoblacionTallerTmp As String
Get
If _CodigoPoblacionTallerTmpEsNulo Then
'If Me.entidades1 IsNot Nothing AndAlso Me.entidades1.DireccionPrincipal IsNot Nothing AndAlso Me.entidades1.DireccionPrincipal.municipios IsNot Nothing Then
' _CodigoPoblacionTallerTmp = Me.entidades1.DireccionPrincipal.CodigoMunicipio
' _CodigoPoblacionTallerTmpEsNulo = False
' Return Me.entidades1.DireccionPrincipal.CodigoMunicipio
'Else
' Return ""
'End If
If Me.entidades1 Is Nothing OrElse Me.entidades1.DireccionPrincipal Is Nothing OrElse Me.entidades1.DireccionPrincipal.municipios Is Nothing Then
If Me.entidades1 IsNot Nothing AndAlso Me.entidades1.DireccionPrincipal IsNot Nothing AndAlso Me.entidades1.DireccionPrincipal.municipios Is Nothing Then
If Me.entidades1.DireccionPrincipal.CodigoPostal.NothingAVacio <> "" Then
Dim bd = bdGestionAsegasa.gestionasegasaEntities.NuevoContexto
Dim pob = bd.codigospostales.First(Function(x) x.CodigoPostal = Me.entidades1.DireccionPrincipal.CodigoPostal)
Me.entidades1.DireccionPrincipal.CodigoMunicipio = pob.CodigoMunicipio
_CodigoPoblacionTallerTmp = pob.CodigoMunicipio
_CodigoPoblacionTallerTmpEsNulo = False
Return _CodigoPoblacionTallerTmp
Else
Return ""
End If
Else
Return ""
End If
Else
_CodigoPoblacionTallerTmp = Me.entidades1.DireccionPrincipal.CodigoMunicipio
_CodigoPoblacionTallerTmpEsNulo = False
Return Me.entidades1.DireccionPrincipal.CodigoMunicipio
End If
Else
Return _CodigoPoblacionTallerTmp
End If
' If Me.entidades1 Is Nothing OrElse Me.entidades1.DireccionPrincipal Is Nothing OrElse Me.entidades1.DireccionPrincipal.municipios Is Nothing Then
' If _CodigoPoblacionTallerTmpEsNulo Then
' Return ""
' Else
' Return _CodigoPoblacionTallerTmp
' End If
'Else
' Return Me.entidades1.DireccionPrincipal.CodigoMunicipio
'End If
End Get
Set(value As String)
_CodigoPoblacionTallerTmp = value
_CodigoPoblacionTallerTmpEsNulo = False
If Me.entidades1 IsNot Nothing AndAlso Me.entidades1.DireccionPrincipal IsNot Nothing Then
Me.entidades1.DireccionPrincipal.CodigoMunicipio = value
End If
Me.OnPropertyChanged("CodigoPoblacionTallerTmp")
Me.OnPropertyChanged("PoblacionTallerTmp")
Me.OnPropertyChanged("ProvinciaTallerTmp")
End Set
End Property
Public ReadOnly Property PoblacionTallerTmp As String
Get
Return municipios.ObtienePoblacion(CodigoPoblacionTallerTmp)
End Get
End Property
Public ReadOnly Property ProvinciaTallerTmp As String
Get
Return municipios.ObtieneProvincia(CodigoPoblacionTallerTmp)
End Get
End Property
Private _TelefonoTallerTmpEsNulo As Boolean = True
Private _TelefonoTallerTmp As String
Public Property TelefonoTallerTmp As String
Get
If _TelefonoTallerTmpEsNulo Then
If Me.entidades1 IsNot Nothing Then
_TelefonoTallerTmp = Me.entidades1.Telefono1
_TelefonoTallerTmpEsNulo = False
Return Me.entidades1.Telefono1
Else
Return ""
End If
Else
Return _TelefonoTallerTmp
End If
'If Me.entidades1 Is Nothing Then
' If _TelefonoTallerTmpEsNulo Then
' Return ""
' Else
' Return _TelefonoTallerTmp
' End If
'Else
' Return Me.entidades1.Telefono1
'End If
End Get
Set(value As String)
_TelefonoTallerTmp = value
_TelefonoTallerTmpEsNulo = False
If Me.entidades1 IsNot Nothing Then
Me.entidades1.Telefono1 = value
End If
Me.OnPropertyChanged("TelefonoTallerTmp")
End Set
End Property
Private _EmailTallerTmpEsNulo As Boolean = True
Private _EmailTallerTmp As String
Public Property EmailTallerTmp As String
Get
If _EmailTallerTmpEsNulo Then
If Me.entidades1 Is Nothing Then
Return ""
Else
_EmailTallerTmp = Me.entidades1.Email
_EmailTallerTmpEsNulo = False
Return Me.entidades1.Email
End If
Else
Return _EmailTallerTmp
End If
'If Me.entidades1 Is Nothing Then
' If _EmailTallerTmpEsNulo Then
' Return ""
' Else
' Return _EmailTallerTmp
' End If
'Else
' Return Me.entidades1.Email
'End If
End Get
Set(value As String)
_EmailTallerTmp = value
_EmailTallerTmpEsNulo = False
If Me.entidades1 IsNot Nothing Then
Me.entidades1.Email = value
End If
Me.OnPropertyChanged("EmailTallerTmp")
End Set
End Property
Public Sub ReiniciaValoresTMPTaller()
_CifTallerTmpEsNulo = True
_RazonSocialTallerTmpEsNulo = True
_CodigoPoblacionTallerTmpEsNulo = True
_CodigoPostalTallerTmpEsNulo = True
_DomicilioTallerTmpEsNulo = True
_TelefonoTallerTmpEsNulo = True
_EmailTallerTmpEsNulo = True
End Sub
#End Region
Friend Shared Sub GuardandoCambios(bd As bdGestionAsegasa.gestionasegasaEntities)
Dim gestioness = bd.ObjectStateManager.GetObjectStateEntries(EntityState.Added).Where(Function(x) x.EntitySet.Name.ToLower = "gestionessiniestros")
AsignaidUsuarioCreadorGestionesSiniestros(bd, gestioness)
gestioness = bd.ObjectStateManager.GetObjectStateEntries(EntityState.Modified).Where(Function(x) x.EntitySet.Name.ToLower = "gestionessiniestros")
AsignaidUsuarioModificadorGestionesSiniestros(bd, gestioness)
End Sub
Private Shared Sub AsignaidUsuarioCreadorGestionesSiniestros(bd As bdGestionAsegasa.gestionasegasaEntities, ms As IEnumerable(Of ObjectStateEntry))
Try
If ms.Count > 0 And Utilidades.dsc.idUsuario > 0 Then
Dim Ahora = tsl5.bbdd.AhoraMysql(bd)
For Each m In ms
Dim r = DirectCast(m.Entity, gestionessiniestros)
r.idUsuarioCreador = Utilidades.dsc.idUsuario
r.idUsuarioModificador = Utilidades.dsc.idUsuario
r.FechaModificacion = Ahora
Next
End If
Catch ex As Exception
Throw
End Try
End Sub
Private Shared Sub AsignaidUsuarioModificadorGestionesSiniestros(bd As bdGestionAsegasa.gestionasegasaEntities, ms As IEnumerable(Of ObjectStateEntry))
Try
If ms.Count > 0 And Utilidades.dsc.idUsuario > 0 Then
Dim Ahora = tsl5.bbdd.AhoraMysql(bd)
For Each m In ms
Dim r = DirectCast(m.Entity, gestionessiniestros)
r.idUsuarioModificador = Utilidades.dsc.idUsuario
r.FechaModificacion = Ahora
Next
End If
Catch ex As Exception
Throw
End Try
End Sub
End Class

View File

@@ -0,0 +1,74 @@
Imports System.Security
Imports ProcesosEIAC_V6
Partial Public Class siniestros_eiac
Public Shared Function ObtienePosicionSiniestroV6(Clave As claves_posicionsiniestro) As Integer
Try
Select Case Clave
Case claves_posicionsiniestro.CU
Return ClavesPosicionSiniestroEnum.CULPA
Case claves_posicionsiniestro.RE
Return ClavesPosicionSiniestroEnum.RECLAMACIÓN
Case claves_posicionsiniestro.IN
Return ClavesPosicionSiniestroEnum.INDETERMINADO
Case claves_posicionsiniestro.NA
Return ClavesPosicionSiniestroEnum.NO_APLICA
Case Else
Return ClavesPosicionSiniestroEnum.DESCONOCIDA
End Select
Catch EX As Exception
Return ClavesPosicionSiniestroEnum.DESCONOCIDA
End Try
End Function
Public Shared Function ObtenerTipoPagoV6(formaPago As tipo_formapago, tiposPago As List(Of enumeraciones)) As Object
Dim Codigo As String = "TIPP.CO"
If formaPago IsNot Nothing Then
Try
Select Case formaPago.ClaseFormaPago
Case claves_formapago.CC
Codigo = "TIPP.BA"
Case claves_formapago.PC
Codigo = "TIPP.CIA"
Case Else
Codigo = "TIPP.CO"
End Select
Catch
End Try
End If
Return tiposPago.First(Function(x) x.Codigo = Codigo).idEnumeracion
End Function
Public Enum ClavesPosicionSiniestroEnum As Integer
CULPA = 1
RECLAMACIÓN = 2
INDETERMINADO = 3
NO_APLICA = 4
DESCONOCIDA = 99
End Enum
Public ReadOnly Property DescripcionPosicionSiniestro As String
Get
Return DirectCast(PosicionSiniestro, ClavesPosicionSiniestroEnum).ToString.Replace("_", " ")
End Get
End Property
Public Enum SituacionAsegasaENUM As Integer
NUEVO = 1
MODIFICADO = 2
POLIZA_NO_ENCONTRADA = 10
SINIESTRO_NO_ENCONTRADO = 11
VARIOS_SINIESTROS_POSIBLES = 12
VISUALIZADO = 100
DESCARTADO = 200
End Enum
Public ReadOnly Property DescripcionSituacionAsegasa As String
Get
If SituacionAsegasa.HasValue Then
Return DirectCast(SituacionAsegasa.Value, SituacionAsegasaENUM).ToString.Replace("_", " ")
Else
Return ""
End If
End Get
End Property
End Class

View File

@@ -0,0 +1,28 @@
Public Class subagentes
Private Shared _ListaSubagentes As List(Of subagentes)
Public Property AMarcarComoBaja As Boolean
Public ReadOnly Property PolizasConDocumentosPendientes As List(Of polizassg)
Get
Return Me.polizassg.Where(Function(x) x.documentospolizassg.Any(Function(y) y.Obligatorio And y.FechaComprobacion Is Nothing AndAlso y.idFichero Is Nothing)).ToList
End Get
End Property
Public ReadOnly Property PolizasConDocumentosPendientes7Dias As List(Of polizassg)
Get
Dim FechaInicio As Date = Date.Today.AddDays(-7)
Return Me.polizassg.Where(Function(x) x.FechaAlta >= FechaInicio).ToList.Where(Function(x) x.documentospolizassg.Any(Function(y) y.Obligatorio And y.FechaComprobacion Is Nothing AndAlso y.idFichero Is Nothing)).ToList
End Get
End Property
Public Shared Function ListaSubAgentes() As List(Of subagentes)
If _ListaSubagentes Is Nothing Then
Dim bd = bdGestionAsegasa.gestionasegasaEntities.NuevoContexto
_ListaSubagentes = bd.subagentes.OrderBy(Function(x) x.Nombre).ToList
End If
Return _ListaSubagentes
End Function
Public ReadOnly Property CodigoYNombre As String
Get
Return Codigo & " - " & Nombre
End Get
End Property
End Class

View File

@@ -0,0 +1,13 @@
Partial Public Class tiposgestionsiniestros
Public ReadOnly Property DescripcionDetallada As String
Get
Dim sDescripcion
sDescripcion = Me.Descripcion & " *" & Me.Codigo & " * "
If Me.idDestinatario.HasValue Then
sDescripcion &= "(DESTINATARIO: " & Me.enumeraciones1.Descripcion & ")"
End If
Return sDescripcion
End Get
End Property
End Class

View File

@@ -0,0 +1,691 @@
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

View File

@@ -0,0 +1,30 @@
Imports bdGestionAsegasa.documentospolizassg
Public Class vf_documentospolizassgextendidas
Public Property FicheroModificado_TMP As Boolean
Public Property Fichero_TMP As Byte()
Public Property DocumentoComprobado As Boolean
Get
Return Me.FechaComprobacion.HasValue
End Get
Set(value As Boolean)
If value Then
Me.FechaComprobacion = Now
Me.idUsuarioComprueba = Utilidades.dsc.idUsuario
Me.UsuarioComprueba = Utilidades.NombreUsuario
Else
Me.FechaComprobacion = Nothing
Me.idUsuarioComprueba = Nothing
Me.UsuarioComprueba = ""
End If
Me.OnPropertyChanged("idUsuarioComprueba")
Me.OnPropertyChanged("FechaComprobacion")
Me.OnPropertyChanged("UsuarioComprueba")
End Set
End Property
Public ReadOnly Property DescripcionTipo
Get
Return DirectCast(Tipo, TipoDocumentoEnum).ToString.Replace("_", " ")
End Get
End Property
End Class

View File

@@ -0,0 +1,18 @@
Partial Public Class vf_liquidacionesagentesverifactu
Public ReadOnly Property DescripcionEstadoVerifactu As String
Get
Return EstadoVerifactu.ToString.Replace("_", " ")
End Get
End Property
Public ReadOnly Property EstadoVerifactu As liquidacionesagentes.EstadoVerifactuEnum
Get
If Estado.HasValue Then
Return CType(Me.Estado, liquidacionesagentes.EstadoVerifactuEnum)
Else
Return liquidacionesagentes.EstadoVerifactuEnum.SIN_REGISTROS
End If
End Get
End Property
End Class

View File

@@ -0,0 +1,16 @@
Partial Public Class vf_liquidacionesciasextendidas
Public ReadOnly Property Compañia As String
Get
If Me.NumeroCias = 0 Then
Return ""
Else
If Me.NumeroCias = 1 Then
Return Me.Cia
Else
Return "Varias"
End If
End If
End Get
End Property
End Class

View File

@@ -0,0 +1,20 @@
Public Class vf_liquidacionesrecibosextendidas
Public ReadOnly Property EsDescobro
Get
Return Me.DescripcionTipoLiquidacion = "DESCOBRO"
End Get
End Property
Public ReadOnly Property LiquidoCia As Double
Get
Return Math.Round(Me.TotalRecibo.Value - Me.TotalComision.Value, 2, MidpointRounding.AwayFromZero)
End Get
End Property
Public ReadOnly Property LiquidacionTipo As String
Get
Return Me.idLiquidacionCia.ToString & " " & Me.DescripcionTipoLiquidacion
End Get
End Property
End Class

View File

@@ -0,0 +1,119 @@
Imports bdGestionAsegasa.gestionasegasaEntities
Partial Public Class vf_polizasextendidas
Public ReadOnly Property NumeroSuplemento_String As String
Get
If Me.NumeroSuplemento = 0 Then
Return ""
Else
Return NumeroSuplemento.ToString
End If
End Get
End Property
Public ReadOnly Property Situacion_Web As String
Get
Return ObtieneSituacionWeb(Me.idSituacion, Me.idTipoPago)
End Get
End Property
Public ReadOnly Property CiaNumeroPoliza As String
Get
Return Me.Compania & "/" & Me.NumeroPoliza
End Get
End Property
Public ReadOnly Property EdadTomador As Integer?
Get
If Me.FechaNacimientoTomador.HasValue Then
Return CInt(Now.Subtract(Me.FechaNacimientoTomador.Value).TotalDays / 365.2425)
Else
Return Nothing
End If
End Get
End Property
Public ReadOnly Property TelefonoMovilValido As String
Get
If tsl5.Extensiones.StringExtensions.EsNumeroTelefonoMovilEspañolValido(Me.Telefono1Tomador) Then
Return Me.Telefono1Tomador
ElseIf tsl5.Extensiones.StringExtensions.EsNumeroTelefonoMovilEspañolValido(Me.Telefono2Tomador) Then
Return Me.Telefono2Tomador
Else
Return ""
End If
End Get
End Property
Public Property LibreAlfabetico_TMP_1 As String
Public Property LibreAlfabetico_TMP_2 As String
Public Property LibreAlfabetico_TMP_3 As String
Public Property LibreAlfabetico_TMP_4 As String
Public Property LibreAlfabetico_TMP_5 As String
Public Property LibreAlfabetico_TMP_6 As String
Public Property LibreAlfabetico_TMP_7 As String
Public Property LibreAlfabetico_TMP_8 As String
Public Property LibreAlfabetico_TMP_9 As String
Public Property LibreAlfabetico_TMP_10 As String
Public Property LibreAlfabetico_TMP_11 As String
Public Property LibreAlfabetico_TMP_12 As String
Public Property LibreAlfabetico_TMP_13 As String
Public Property LibreAlfabetico_TMP_14 As String
Public Property LibreAlfabetico_TMP_15 As String
Public Property LibreAlfabetico_TMP_16 As String
Public Property LibreAlfabetico_TMP_17 As String
Public Property LibreAlfabetico_TMP_18 As String
Public Property LibreAlfabetico_TMP_19 As String
Public Property LibreAlfabetico_TMP_20 As String
Public Property LibreDoble_TMP_1 As Double
Public Property LibreDoble_TMP_2 As Double
Public Property LibreDoble_TMP_3 As Double
Public Property LibreDoble_TMP_4 As Double
Public Property LibreDoble_TMP_5 As Double
Public Property LibreDoble_TMP_6 As Double
Public Property LibreDoble_TMP_7 As Double
Public Property LibreDoble_TMP_8 As Double
Public Property LibreDoble_TMP_9 As Double
Public Property LibreDoble_TMP_10 As Double
Public Property LibreDoble_TMP_11 As Double
Public Property LibreDoble_TMP_12 As Double
Public Property LibreDoble_TMP_13 As Double
Public Property LibreDoble_TMP_14 As Double
Public Property LibreDoble_TMP_15 As Double
Public Property LibreDoble_TMP_16 As Double
Public Property LibreDoble_TMP_17 As Double
Public Property LibreDoble_TMP_18 As Double
Public Property LibreDoble_TMP_19 As Double
Public Property LibreDoble_TMP_20 As Double
#Region "Conversiones"
Public Function AListadoReducido() As ListadoReducido
Return New ListadoReducido(Me)
End Function
#End Region
End Class
Public Class ListadoReducido
Public Sub New(Poliza As vf_polizasextendidas)
NumeroPropuesta = Poliza.idPoliza
FechaAlta = Poliza.FechaAlta
NumeroPóliza = Poliza.NumeroPoliza
Matrícula = Poliza.Matricula
Compañía = Poliza.Compania
Ramo = Poliza.Ramo
BienesAsegurados = Poliza.BienesAsegurados
TipoPago = Poliza.TipoPago
CIFTomador = Poliza.CIFTomador
Tomador = Poliza.Tomador
Teléfono1 = Poliza.Telefono1Tomador
Teléfono2 = Poliza.Telefono2Tomador
Email = Poliza.EmailTomador
End Sub
Property NumeroPropuesta As Integer
Property FechaAlta As Date?
Property NumeroPóliza As String
Property Matrícula As String
Property BienesAsegurados As String
Property Compañía As String
Property Ramo As String
Property TipoPago As String
Property CIFTomador As String
Property Tomador As String
Property Teléfono1 As String
Property Teléfono2 As String
Property Email As String
End Class

View File

@@ -0,0 +1,20 @@
'Public Class vf_polizassg_estadisticas
' Public Property EsContratacion As Integer
' Public Property EsBaja As Integer
' Public Property NumeroContrataciones As Integer
' Public Property FechaSituacion As Date
'End Class
Public Class vf_polizassg_estadisticas_reducido
Public Property EsContratacion As Integer
Public Property EsBaja As Integer
Public Property FechaSituacion As Date
Public Property Compania As String
Public Property FamiliaRamo As String
Public Property SubAgente As String
Public ReadOnly Property Incremento As Integer
Get
Incremento = EsContratacion - EsBaja
End Get
End Property
End Class

View File

@@ -0,0 +1,231 @@
Imports bdGestionAsegasa.gestionasegasaEntities
Imports tsl5.Extensiones
Imports tsl5.Extensiones.StringExtensions
Partial Public Class vf_recibosextendidos
Private Shared TiposPago As List(Of enumeraciones)
Public ReadOnly Property Situacion_Web As String
Get
Return ObtieneSituacionWeb(Me.idSituacion, Me.idTipoPago)
End Get
End Property
Public ReadOnly Property CiaNumeroPoliza As String
Get
Return Me.Compania & "/" & Me.NumeroPoliza
End Get
End Property
Public ReadOnly Property CompaniaNumeros As String
Get
Return Me.Compania & " (Números de asistencia)"
End Get
End Property
Public ReadOnly Property Estado As recibos.EstadoRecibo
Get
Dim est As recibos.EstadoRecibo = recibos.EstadoRecibo.PENDIENTE
If Me.idRemesa.HasValue Then est = recibos.EstadoRecibo.REMESADO
If Me.idTipoPago = gestionasegasaEntities.TipoPagoCia OrElse Me.idTipoPago = gestionasegasaEntities.TipoPagoFAE Then est = recibos.EstadoRecibo.GESTION_COBRO_CIA
If Me.FechaLiquidacionAgente.HasValue Then est = recibos.EstadoRecibo.LIQUIDADO
If Me.FechaBaja.HasValue AndAlso Me.idCausaBaja <> gestionasegasaEntities.CabaSupl AndAlso Me.idCausaBaja <> gestionasegasaEntities.CabaSust Then est = recibos.EstadoRecibo.BAJA
If Me.FechaDevolucionBanco.HasValue Then est = recibos.EstadoRecibo.DEVUELTO_BANCO
' If Me.FechaDevolucionCompania.HasValue Then est = recibos.EstadoRecibo.DEVUELTO_CIA
Return est
End Get
End Property
Public ReadOnly Property EstadoRecibo As String
Get
Return Estado.ToString.Replace("_", " ")
End Get
End Property
Public ReadOnly Property IBANoTipoPago As String
Get
If Me.idTipoPago.HasValue Then
If TiposPago Is Nothing Then
Dim bdtmp = bdGestionAsegasa.gestionasegasaEntities.NuevoContextoCN
TiposPago = bdtmp.enumeraciones.Where(Function(x) x.gruposenumeraciones.Grupo = "TIPP").ToList
End If
Dim tp = TiposPago.FirstOrDefault(Function(x) x.idEnumeracion = Me.idTipoPago)
If tp Is Nothing Then
Return "* DESCONOCIDO *"
Else
If tp.Codigo = "TIPP.BA" Then
If IBAN.NothingAVacio = "" Then
Return "BANCARIO SIN IBAN ASIGNADO"
Else
Return IBAN
End If
End If
Return tp.Descripcion
End If
Else
Return "* NO ASIGNADO *"
End If
End Get
End Property
Public ReadOnly Property TipoPago As String
Get
If Me.idTipoPago.HasValue Then
If TiposPago Is Nothing Then
Dim bdtmp = bdGestionAsegasa.gestionasegasaEntities.NuevoContextoCN
TiposPago = bdtmp.enumeraciones.Where(Function(x) x.gruposenumeraciones.Grupo = "TIPP").ToList
End If
Dim tp = TiposPago.FirstOrDefault(Function(x) x.idEnumeracion = Me.idTipoPago)
If tp Is Nothing Then
Return "* DESCONOCIDO *"
Else
Return tp.Descripcion
End If
Else
Return "* NO ASIGNADO *"
End If
End Get
End Property
Public ReadOnly Property IBANCorrecto As Boolean
Get
Return tsl5.Bancos.Genericas.IBANCorrecto(Me.IBAN.NothingAVacio) AndAlso Me.IBAN <> "ES8200000000000000000000"
End Get
End Property
Public ReadOnly Property idSubAgente_Especial As Integer?
Get
If Me.idSubagente.HasValue AndAlso Me.CodigoAgente = "000047002186" Then
Dim bd As gestionasegasaEntities = Me.ObtieneContexto
Dim Codigo = Me.CodigoSubAgente.Substring(0, 2) & "00"
Dim subage = bd.subagentes.FirstOrDefault(Function(x) x.idAgente = Me.idAgente And x.Codigo = Codigo)
If subage IsNot Nothing Then
Return subage.idSubagente
Else
Return idSubagente
End If
Else
Return idSubagente
End If
End Get
End Property
'Public ReadOnly Property SubAgenteSuperior As String
' Get
' If Me.idSubagente.HasValue AndAlso Me.CodigoAgente = "000047002186" Then
' Dim bd As gestionasegasaEntities = Me.ObtieneContexto
' Dim Codigo = Me.CodigoSubAgente.Substring(0, 2) & "00"
' Dim subage = bd.subagentes.FirstOrDefault(Function(x) x.idAgente = Me.idAgente And x.Codigo = Codigo)
' If subage IsNot Nothing Then
' Return subage.Nombre
' Else
' Return SubAgente
' End If
' Else
' Return SubAgente
' End If
' End Get
'End Property
Public ReadOnly Property NumeroPolizaSuplementoLargo As String
Get
If Me.NumeroSuplemento = 0 Then
Return Me.NumeroPoliza
Else
Return Me.NumeroPoliza & " (" & Me.NumeroSuplemento.ToString & ")"
End If
End Get
End Property
Public ReadOnly Property NumeroPolizaSuplemento As String
Get
If Me.NumeroSuplemento = 0 Then
Return Me.NumeroPoliza
Else
Return Me.NumeroPoliza & "#" & Me.NumeroSuplemento.ToString
End If
End Get
End Property
Public ReadOnly Property LiquidoCia As Double
Get
Return Math.Round(Me.TotalRecibo.Value - Me.TotalComision.Value, 2, MidpointRounding.AwayFromZero)
End Get
End Property
'Public ReadOnly Property ImporteIRPFAgente As Double
' Get
' Dim Factor = If(EsRetornoComision_TMP, -1, 1)
' Return Math.Round(Factor * Me.ComisionAgente.Value * Me.IRPFAgente.Value / 100, 2, MidpointRounding.AwayFromZero)
' End Get
'End Property
'Public ReadOnly Property LiquidoAgente As Double
' Get
' Dim Factor = If(EsRetornoComision_TMP, -1, 1)
' Return Math.Round((Factor * Me.ComisionAgente.Value - Factor * ImporteIRPFAgente), 2, MidpointRounding.AwayFromZero)
' End Get
'End Property
Public ReadOnly Property PrimaNetaBonificada As Double
Get
Return Math.Round((Me.PrimaNeta.Value + Me.BonificacionORecargo.Value), 2, MidpointRounding.AwayFromZero)
End Get
End Property
Public ReadOnly Property ImporteALiquidarAgente As Double
Get
Dim Factor = If(EsRetornoComision_TMP, -1, 1)
Return Math.Round((Factor * Me.ComisionAgente.Value), 2, MidpointRounding.AwayFromZero)
End Get
End Property
Public Property EsRetornoComision_TMP As Boolean
Public Property idRegularizacion_TMP As Integer
Public ReadOnly Property TipoLiquidacionAgente As String
Get
If EsRetornoComision_TMP Then
Return "RETORNO COMISION"
Else
Return "LIQUIDACIÓN"
End If
End Get
End Property
Public ReadOnly Property CuentaContableTomadorErronea As Boolean
Get
If Utilidades.idTippPE.HasValue = False Then
Dim bd = DirectCast(Me.ObtieneContexto, gestionasegasaEntities)
Utilidades.idTippPE = bd.enumeraciones.First(Function(x) x.Codigo = "TIPP.PE").idEnumeracion
End If
Return Me.idTipoPago = Utilidades.idTippPE.Value AndAlso Me.CuentaContableTomador.NothingAVacio.Length <> 8
End Get
End Property
Public ReadOnly Property TelefonoMovilValido As String
Get
If Me.Telefono1Tomador.EsNumeroTelefonoMovilEspañolValido Then
Return Me.Telefono1Tomador
Else
If Me.Telefono2Tomador.EsNumeroTelefonoMovilEspañolValido Then
Return Me.Telefono2Tomador
Else
Return ""
End If
End If
End Get
End Property
Public ReadOnly Property ProvinciaTomador As String
Get
If Me.CodigoPostalTomador IsNot Nothing AndAlso Me.CodigoPostalTomador.Length > 2 Then
Return Me.CodigoPostalTomador.Substring(0, 2)
Else
Return ""
End If
End Get
End Property
Public ReadOnly Property AntiguedadMayor2M As Boolean
Get
Return Today.Subtract(FechaEfecto).TotalDays > 60
End Get
End Property
#Region "Conversiones"
Public Function AListadoAsegurados() As ListadoAsegurados
Return New ListadoAsegurados(Me)
End Function
#End Region
End Class

View File

@@ -0,0 +1,145 @@
Imports bdGestionAsegasa.gestionasegasaEntities
Imports tsl5.Extensiones
Imports tsl5.Extensiones.StringExtensions
Partial Public Class vf_recibosextendidos_lc
Private Shared TiposPago As List(Of enumeraciones)
Public ReadOnly Property LiquidoCia As Double
Get
Return Math.Round(Me.TotalRecibo.Value - Me.TotalComision.Value, 2, MidpointRounding.AwayFromZero)
End Get
End Property
Public ReadOnly Property Situacion_Web As String
Get
Return ObtieneSituacionWeb(Me.idSituacion, Me.idTipoPago)
End Get
End Property
Public ReadOnly Property CiaNumeroPoliza As String
Get
Return Me.Compania & "/" & Me.NumeroPoliza
End Get
End Property
Public ReadOnly Property TipoPago As String
Get
If Me.idTipoPago.HasValue Then
If TiposPago Is Nothing Then
Dim bdtmp = bdGestionAsegasa.gestionasegasaEntities.NuevoContextoCN
TiposPago = bdtmp.enumeraciones.Where(Function(x) x.gruposenumeraciones.Grupo = "TIPP").ToList
End If
Dim tp = TiposPago.FirstOrDefault(Function(x) x.idEnumeracion = Me.idTipoPago)
If tp Is Nothing Then
Return "* DESCONOCIDO *"
Else
Return tp.Descripcion
End If
Else
Return "* NO ASIGNADO *"
End If
End Get
End Property
Public ReadOnly Property IBANCorrecto As Boolean
Get
Return tsl5.Bancos.Genericas.IBANCorrecto(Me.IBAN.NothingAVacio)
End Get
End Property
Public ReadOnly Property idSubAgente_Especial As Integer?
Get
If Me.idSubagente.HasValue AndAlso Me.CodigoAgente = "000047002186" Then
Dim bd As gestionasegasaEntities = Me.ObtieneContexto
Dim Codigo = Me.CodigoSubAgente.Substring(0, 2) & "00"
Dim subage = bd.subagentes.FirstOrDefault(Function(x) x.idAgente = Me.idAgente And x.Codigo = Codigo)
If subage IsNot Nothing Then
Return subage.idSubagente
Else
Return idSubagente
End If
Else
Return idSubagente
End If
End Get
End Property
Public ReadOnly Property NumeroPolizaSuplementoLargo As String
Get
If Me.NumeroSuplemento = 0 Then
Return Me.NumeroPoliza
Else
Return Me.NumeroPoliza & " (" & Me.NumeroSuplemento.ToString & ")"
End If
End Get
End Property
Public ReadOnly Property NumeroPolizaSuplemento As String
Get
If Me.NumeroSuplemento = 0 Then
Return Me.NumeroPoliza
Else
Return Me.NumeroPoliza & "#" & Me.NumeroSuplemento.ToString
End If
End Get
End Property
Public ReadOnly Property FechaInicioLiquidacionCia As Date?
Get
If Utilidades.idTippBA.HasValue = False Then
Dim bd = DirectCast(Me.ObtieneContexto, gestionasegasaEntities)
Utilidades.idTippBA = bd.enumeraciones.First(Function(x) x.Codigo = "TIPP.PE").idEnumeracion
Utilidades.idtrEx = bd.enumeraciones.First(Function(x) x.Codigo = "TRC.EX").idEnumeracion
Utilidades.idtrCx = bd.enumeraciones.First(Function(x) x.Codigo = "TRC.CX").idEnumeracion
End If
Select Case Me.idTipo
Case Utilidades.idtrEx, Utilidades.idtrCx
Return Today
Case Else
If Me.idTipoPago = Utilidades.idTippBA Then
Return Today
Else
Dim fechacalculo As Date? = Nothing
If Me.idRemesa.HasValue Then
fechacalculo = Me.FechaRemesa.Value.AddDays(Me.PlazoRetornoComision.Value)
Else
If Me.FechaRecepcionCia.HasValue Then
fechacalculo = Me.FechaRecepcionCia.Value.AddDays(Me.PlazoRetornoComision.Value)
End If
End If
If fechacalculo.HasValue Then
If fechacalculo > Today Then
Return fechacalculo
Else
Return Today
End If
Else
Return Nothing
End If
End If
End Select
End Get
End Property
Public ReadOnly Property MotivoBajaCia As String
Get
If Me.idCausaBaja.HasValue Then
Dim bd As bdGestionAsegasa.gestionasegasaEntities = Me.ObtieneContexto
Return bd.enumeraciones.First(Function(x) x.idEnumeracion = Me.idCausaBaja).ValorAlfabetico2
Else
Return ""
End If
End Get
End Property
Public ReadOnly Property CodigoDevolucionBanco As String
Get
If Me.idCausaDevolucion.HasValue Then
Dim bd As bdGestionAsegasa.gestionasegasaEntities = Me.ObtieneContexto
Return bd.enumeraciones.First(Function(x) x.idEnumeracion = Me.idCausaDevolucion).Codigo.Split(".")(1)
Else
Return ""
End If
End Get
End Property
End Class

View File

@@ -0,0 +1,124 @@
Imports bdGestionAsegasa.gestionasegasaEntities
Imports tsl5.Extensiones
Imports tsl5.Extensiones.StringExtensions
Partial Public Class vf_recibosextendidos_ti
Private Shared TiposPago As List(Of enumeraciones)
Public ReadOnly Property Situacion_Web As String
Get
Return ObtieneSituacionWeb(Me.idSituacion, Me.idTipoPago)
End Get
End Property
Public ReadOnly Property CiaNumeroPoliza As String
Get
Return Me.Compania & "/" & Me.NumeroPoliza
End Get
End Property
Public ReadOnly Property Estado As recibos.EstadoRecibo
Get
Dim est As recibos.EstadoRecibo = recibos.EstadoRecibo.PENDIENTE
If Me.idRemesa.HasValue Then est = recibos.EstadoRecibo.REMESADO
If Me.idTipoPago = gestionasegasaEntities.TipoPagoCia OrElse Me.idTipoPago = gestionasegasaEntities.TipoPagoFAE Then est = recibos.EstadoRecibo.GESTION_COBRO_CIA
If Me.FechaLiquidacionAgente.HasValue Then est = recibos.EstadoRecibo.LIQUIDADO
If Me.FechaBaja.HasValue AndAlso Me.idCausaBaja <> gestionasegasaEntities.CabaSupl AndAlso Me.idCausaBaja <> gestionasegasaEntities.CabaSust Then est = recibos.EstadoRecibo.BAJA
If Me.FechaDevolucionBanco.HasValue Then est = recibos.EstadoRecibo.DEVUELTO_BANCO
' If Me.FechaDevolucionCompania.HasValue Then est = recibos.EstadoRecibo.DEVUELTO_CIA
Return est
End Get
End Property
Public ReadOnly Property EstadoRecibo As String
Get
Return Estado.ToString.Replace("_", " ")
End Get
End Property
Public ReadOnly Property TipoPago As String
Get
If Me.idTipoPago.HasValue Then
If TiposPago Is Nothing Then
Dim bdtmp = bdGestionAsegasa.gestionasegasaEntities.NuevoContextoCN
TiposPago = bdtmp.enumeraciones.Where(Function(x) x.gruposenumeraciones.Grupo = "TIPP").ToList
End If
Dim tp = TiposPago.FirstOrDefault(Function(x) x.idEnumeracion = Me.idTipoPago)
If tp Is Nothing Then
Return "* DESCONOCIDO *"
Else
Return tp.Descripcion
End If
Else
Return "* NO ASIGNADO *"
End If
End Get
End Property
Public ReadOnly Property IBANCorrecto As Boolean
Get
Return tsl5.Bancos.Genericas.IBANCorrecto(Me.IBAN.NothingAVacio)
End Get
End Property
Public ReadOnly Property idSubAgente_Especial As Integer?
Get
If Me.idSubagente.HasValue AndAlso Me.CodigoAgente = "000047002186" Then
Dim bd As gestionasegasaEntities = Me.ObtieneContexto
Dim Codigo = Me.CodigoSubAgente.Substring(0, 2) & "00"
Dim subage = bd.subagentes.FirstOrDefault(Function(x) x.idAgente = Me.idAgente And x.Codigo = Codigo)
If subage IsNot Nothing Then
Return subage.idSubagente
Else
Return idSubagente
End If
Else
Return idSubagente
End If
End Get
End Property
'Public ReadOnly Property SubAgenteSuperior As String
' Get
' If Me.idSubagente.HasValue AndAlso Me.CodigoAgente = "000047002186" Then
' Dim bd As gestionasegasaEntities = Me.ObtieneContexto
' Dim Codigo = Me.CodigoSubAgente.Substring(0, 2) & "00"
' Dim subage = bd.subagentes.FirstOrDefault(Function(x) x.idAgente = Me.idAgente And x.Codigo = Codigo)
' If subage IsNot Nothing Then
' Return subage.Nombre
' Else
' Return SubAgente
' End If
' Else
' Return SubAgente
' End If
' End Get
'End Property
Public ReadOnly Property NumeroPolizaSuplementoLargo As String
Get
If Me.NumeroSuplemento = 0 Then
Return Me.NumeroPoliza
Else
Return Me.NumeroPoliza & " (" & Me.NumeroSuplemento.ToString & ")"
End If
End Get
End Property
Public ReadOnly Property NumeroPolizaSuplemento As String
Get
If Me.NumeroSuplemento = 0 Then
Return Me.NumeroPoliza
Else
Return Me.NumeroPoliza & "#" & Me.NumeroSuplemento.ToString
End If
End Get
End Property
Public ReadOnly Property PrimeraDevolucionCia As liquidacionescompaniasrecibos
Get
Dim bd As gestionasegasaEntities = Me.ObtieneContexto
Return bd.liquidacionescompaniasrecibos.FirstOrDefault(Function(x) x.idRecibo = Me.idRecibo And x.liquidacionescompanias.enumeraciones.Codigo = "TIPLIQ.DEVUELTO")
End Get
End Property
Public ReadOnly Property FechaAsientoDevueltoCia As Date?
Get
If PrimeraDevolucionCia IsNot Nothing Then
Return PrimeraDevolucionCia.liquidacionescompanias.Fecha
Else
Return Nothing
End If
End Get
End Property
End Class

View File

@@ -0,0 +1,74 @@
Imports System.Security
Imports ProcesosEIAC_V6
Partial Public Class vf_siniestros_eiac_extendidos
Public Shared Function ObtienePosicionSiniestroV6(Clave As claves_posicionsiniestro) As Integer
Try
Select Case Clave
Case claves_posicionsiniestro.CU
Return ClavesPosicionSiniestroEnum.CULPA
Case claves_posicionsiniestro.RE
Return ClavesPosicionSiniestroEnum.RECLAMACIÓN
Case claves_posicionsiniestro.IN
Return ClavesPosicionSiniestroEnum.INDETERMINADO
Case claves_posicionsiniestro.NA
Return ClavesPosicionSiniestroEnum.NO_APLICA
Case Else
Return ClavesPosicionSiniestroEnum.DESCONOCIDA
End Select
Catch EX As Exception
Return ClavesPosicionSiniestroEnum.DESCONOCIDA
End Try
End Function
Public Shared Function ObtenerTipoPagoV6(formaPago As tipo_formapago, tiposPago As List(Of enumeraciones)) As Object
Dim Codigo As String = "TIPP.CO"
If formaPago IsNot Nothing Then
Try
Select Case formaPago.ClaseFormaPago
Case claves_formapago.CC
Codigo = "TIPP.BA"
Case claves_formapago.PC
Codigo = "TIPP.CIA"
Case Else
Codigo = "TIPP.CO"
End Select
Catch
End Try
End If
Return tiposPago.First(Function(x) x.Codigo = Codigo).idEnumeracion
End Function
Public Enum ClavesPosicionSiniestroEnum As Integer
CULPA = 1
RECLAMACIÓN = 2
INDETERMINADO = 3
NO_APLICA = 4
DESCONOCIDA = 99
End Enum
Public ReadOnly Property DescripcionPosicionSiniestro As String
Get
Return DirectCast(PosicionSiniestro, ClavesPosicionSiniestroEnum).ToString.Replace("_", " ")
End Get
End Property
Public Enum SituacionAsegasaENUM As Integer
NUEVO = 1
MODIFICADO = 2
POLIZA_NO_ENCONTRADA = 10
SINIESTRO_NO_ENCONTRADO = 11
VARIOS_SINIESTROS_POSIBLES = 12
VISUALIZADO = 100
DESCARTADO = 200
End Enum
Public ReadOnly Property DescripcionSituacionAsegasa As String
Get
If SituacionAsegasa.HasValue Then
Return DirectCast(SituacionAsegasa.Value, SituacionAsegasaENUM).ToString.Replace("_", " ")
Else
Return ""
End If
End Get
End Property
End Class

View File

@@ -0,0 +1,24 @@
Partial Public Class vf_siniestrosextendidos
Public ReadOnly Property NumeroGestionesNN As Long
Get
Return If(NumeroGestiones.HasValue, NumeroGestiones, 1)
End Get
End Property
Public ReadOnly Property Abierto As Boolean
Get
Return Me.FechaCierre.HasValue = False
End Get
End Property
Public ReadOnly Property AñoMes As String
Get
If Me.FechaAccidente.HasValue Then
Return Me.FechaAccidente.Value.Year.ToString & "-" & Me.FechaAccidente.Value.Month.ToString.PadLeft(2, "0")
Else
Return ""
End If
End Get
End Property
End Class