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