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

7942
guia/Dump20260325.sql Normal file

File diff suppressed because one or more lines are too long

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

15
guia/Guia_Antigravity.md Normal file
View File

@@ -0,0 +1,15 @@
Tengo una solución con varios proyectos en .net 4.8, y quiero y pasándolo a .net 8. En la solución antigua está todo en visual basic y quiero cambiarlo todo a c#.
Cosas a tener en cuenta:
- Proyectos como tsl5, tslutilidades y demás, ahora estan en un paquete nuget, por lo que habría que cambiar la referencia a que apunte a este nuget.
- Otra cosa que hay que tener en cuenta es que la base de datos también cambia como se accede al entity framework, esta es la forma en que e llama en 4.8 bd.actualizacioneshp.Where(Function(x) x.Aplicacion = "COMPAÑIAC").Count y asi es como se llama en lo nuevo bd.enumeraciones.First(x => x.Codigo.Contains("TIPFIC.DOCPOL")).idEnumeracion. La diferencia es quitar el Function y tal.
- Te adjunto también el esquema de la base de datos.
-Las referencias a tsl5 ahora serán a tslUtilidades, que es un paquete nuget que tengo instalado.
- Ten en cuenta que aveces cambia de datetime a dateonly, trata de poner bien la conversión.
- No quiero que hagas if terciarios como este pob.CodigoProvinciaNavigation?.Nombre ?? ""; si antes no estaba.
- Quiero que sea la equivalencia a lo que ya existía, no añadir nada más.
- Si hay que crear algún get or set, no quiero que se haga corto con =>, quiero que se haga con get y set normales.
- tscgestionasegasa.NuevoContextoCN() se pasa a ser tscgestionasegasa.NuevoContexto();
- Cambiar los bdAsegasa.db.Utilidades.AñadeLog por await tsUtilidades.TsNotificacionesClient.RegistrarAsync, y también cambiar el orden de los parámetros, donde la enumeracion de tipo log, será el ultimo parámetro.

817
guia/Utilidades.vb Normal file
View File

@@ -0,0 +1,817 @@
Imports System.Data.EntityClient
Imports tsl5
Imports tsl5.Enumeraciones
Imports System.Net
Imports System.Data.Objects
Imports DevExpress.Xpf.Core
Imports System.Reflection
Public Class Utilidades
Public Shared Property Usuario As String
Public Shared Property NombreUsuario As String
Public Shared dsc As New tsl5.Datos.DatosSesionCliente
'Public Shared bdga As tsl5.Datos.BBDD
Public Shared EsRemoto As Boolean? = Nothing
Private Shared FicheroLog = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) & "\Asegasa\GestionAsegasaLog.txt"
' Public Shared ip As String
Private Shared _ListaSituacionesWeb As List(Of enumeraciones) = Nothing
Private Shared _ListaPagoWeb As List(Of enumeraciones) = Nothing
Friend Shared idTippPE As Integer?
Friend Shared idTippBA As Integer?
Friend Shared idtrCx As Integer?
Friend Shared idtrEx As Integer?
Public Shared idSitr1 As Integer?
Private Shared Sub ActualizaConexion(deGestionAsegasa As gestionasegasaEntities)
Dim idMYSQL As Integer = deGestionAsegasa.ExecuteStoreQuery(Of Integer)("select connection_id() as id").First
Dim cn As conexiones
If deGestionAsegasa.conexiones.Any(Function(x) x.idMysql = idMYSQL) Then
cn = deGestionAsegasa.conexiones.First(Function(x) x.idMysql = idMYSQL)
Else
cn = New conexiones
cn.idMysql = idMYSQL
deGestionAsegasa.conexiones.AddObject(cn)
End If
cn.ip = deGestionAsegasa.ExecuteStoreQuery(Of String)("select host from information_schema.processlist WHERE ID=connection_id()").First
If deGestionAsegasa.usuarios.Any(Function(x) x.Usuario = Usuario) Then
If cn.Usuario <> Usuario Then
cn.Usuario = Usuario 'deGestionAsegasa.usuarios.First(Function(x) x.idUsuario = idUsuario).Usuario
cn.FechaHora = AhoraMysql(deGestionAsegasa)
deGestionAsegasa.GuardarCambios()
End If
Else
cn.Usuario = Usuario & " * NO ENCONTRADO *"
cn.FechaHora = AhoraMysql(deGestionAsegasa)
deGestionAsegasa.GuardarCambios()
End If
End Sub
Public Shared Function AhoraMysql(deGestionAsegasa As gestionasegasaEntities) As DateTime
Try
Dim FechaServidor As DateTime = deGestionAsegasa.ExecuteStoreQuery(Of DateTime)("select now() as Ahora").First
Return FechaServidor
Catch ex As Exception
Return Now
End Try
End Function
Public Shared el As EventLog
Public Shared DirectorioLogs As String = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) & "\ServicioGestionAsegasa\Logs\"
Public Shared Sub AñadeLog(ByVal Tipo As tsl5.Enumeraciones.TipoLog, ByVal Asunto As String, ByVal Mensaje As String, Optional ByVal e As Exception = Nothing)
' ----------------------------------------------------------------------------------------------------
' Descripción Sub: Gestión de logs de la aplicación
' Fecha. Creacion: ???
' Creada por: manmog
' Ultima Modificacion: 24/11/2010
'
' Modificaciones:
' ===============
Dim sFicheroLog As String = DirectorioLogs & "Log-" & Now.Year.ToString & Now.Month.ToString & ".txt"
Try
If Not IsNothing(e) Then
If Not el Is Nothing Then el.WriteEntry(e.Message & vbCrLf & e.StackTrace, EventLogEntryType.Error)
Dim sSeguimientoDePila As String = "Información de la excepción: " & e.ToString & vbCrLf
Dim exceptionInterna As Exception = e
Do
sSeguimientoDePila &= exceptionInterna.StackTrace & vbCrLf
exceptionInterna = exceptionInterna.InnerException
Loop Until IsNothing(exceptionInterna)
If sSeguimientoDePila <> "" Then Mensaje &= vbCrLf & "Seguimiento de pila: " & sSeguimientoDePila
End If
Select Case Tipo
Case tsl5.Enumeraciones.TipoLog.Fallo, tsl5.Enumeraciones.TipoLog.Advertencia
If Tipo = tsl5.Enumeraciones.TipoLog.Fallo Then
sFicheroLog = DirectorioLogs & "Errores-" & Now.Year.ToString & Now.Month.ToString.PadLeft(2, "0") & ".txt"
Mensaje = Now.ToString("dd/MM/yyyy HH:mm:ss") & " Error enviado desde " & Environment.MachineName & " VERSION: " & Assembly.GetExecutingAssembly.GetName.Version.ToString & ". " & Mensaje
Else
Mensaje = Now.ToString("dd/MM/yyyy HH:mm:ss") & " Advertencia enviado desde " & Environment.MachineName & " VERSION: " & Assembly.GetExecutingAssembly.GetName.Version.ToString & ". " & Mensaje
End If
Dim sDireccionesEnvio As String = "sevilla@tecnosis.net"
Dim sServidorSMTP As String = "correo.tecnosis.net"
Dim sRemitente = "logs@tecnosis.es"
If Environment.MachineName.ToUpper.Trim() = "INTI" OrElse Environment.MachineName.ToUpper.Trim() = "CERBERO" Then
sDireccionesEnvio = "danmun@tecnosis.net"
Asunto = "[`" & Environment.MachineName.Trim & "`] " & Asunto
End If
'If Mensaje IsNot Nothing Then Mensaje = Mensaje.Replace(vbCrLf, vbCrLf & "<br />")
tsl5.Correo.Funciones.EnviaCorreo(sServidorSMTP, sRemitente, sDireccionesEnvio, Asunto, Mensaje,,,, "logs@tecnosis.es", "LoGs20i9.",, True)
End Select
AñadeLogTXT(Mensaje, sFicheroLog)
Catch ex As Exception
sFicheroLog = DirectorioLogs & "Errores-" & Now.Year.ToString & Now.Month.ToString.PadLeft(2, "0") & ".txt"
AñadeLogTXT(ex.Message, sFicheroLog)
End Try
End Sub
Public Shared Sub AñadeLogNombre(ByVal nombreLog As String, ByVal Tipo As tsl5.Enumeraciones.TipoLog, ByVal Asunto As String, ByVal Mensaje As String,
Optional ByVal forzarEnviarCorreoE As Boolean = False, Optional ByVal forzarDestinatario As String = "",
Optional ByVal forzarEnviarSlack As Boolean = False, Optional ByVal excepcion As Exception = Nothing)
' ----------------------------------------------------------------------------------------------------
' Descripción Sub: Gestión de logs de la aplicación
' Fecha. Creacion: 2020-12-01
' Creada por: danmun (heredando de manmog)
' Ultima Modificacion: 2020-12-01
'
' Modificaciones:
' ===============
Dim sFicheroLog As String = DirectorioLogs & "Log-" & nombreLog & "-" & Now.Year.ToString & Now.Month.ToString & ".txt"
Try
Dim enviarCorreoE As Boolean = False
Dim sbAsunto As New Text.StringBuilder
Dim sSeguimientoDePila As String = ""
sbAsunto.AppendFormat("[`{0}`] ", System.Diagnostics.Process.GetCurrentProcess.ProcessName)
sbAsunto.Append(Asunto)
'// Decidir si se envía información sobre la excepción
If Not IsNothing(excepcion) Then
If Not el Is Nothing Then el.WriteEntry(excepcion.Message & vbCrLf & excepcion.StackTrace, EventLogEntryType.Error)
sSeguimientoDePila = "Información de la excepción: " & excepcion.ToString & vbCrLf
Dim exceptionInterna As Exception = excepcion
Do
sSeguimientoDePila &= exceptionInterna.StackTrace & vbCrLf
exceptionInterna = exceptionInterna.InnerException
Loop Until IsNothing(exceptionInterna)
End If
Mensaje = sbAsunto.ToString & vbCrLf & Mensaje & vbCrLf
If Not String.IsNullOrWhiteSpace(sSeguimientoDePila) Then Mensaje &= vbCrLf & "Seguimiento de pila: " & sSeguimientoDePila
'// Decidir si se envía correo electrónico
Select Case Tipo
Case tsl5.Enumeraciones.TipoLog.Fallo, tsl5.Enumeraciones.TipoLog.Advertencia
enviarCorreoE = True
End Select
'// Forzar envío de correo electrónico
If forzarEnviarCorreoE OrElse excepcion IsNot Nothing Then enviarCorreoE = True
If enviarCorreoE Then
Select Case Tipo
Case tsl5.Enumeraciones.TipoLog.Fallo
sFicheroLog = DirectorioLogs & "Errores-" & nombreLog & "-" & Now.Year.ToString & Now.Month.ToString.PadLeft(2, "0") & ".txt"
Mensaje = Now.ToLongTimeString & " Error enviado desde [`" & Environment.MachineName & "`]." & vbCrLf & Mensaje
Case tsl5.Enumeraciones.TipoLog.Advertencia
Mensaje = Now.ToLongTimeString & " Advertencia enviada desde [`" & Environment.MachineName & "`]." & vbCrLf & Mensaje
Case tsl5.Enumeraciones.TipoLog.Informacion
Mensaje = Now.ToLongTimeString & " Información enviada desde [`" & Environment.MachineName & "`]." & vbCrLf & Mensaje
Case tsl5.Enumeraciones.TipoLog.Depuracion
Mensaje = Now.ToLongTimeString & " Información de depuración enviada desde [`" & Environment.MachineName & "`]." & vbCrLf & Mensaje
End Select
Dim sDireccionesEnvio As String = "sevilla@tecnosis.net"
Dim sServidorSMTP As String = "correo.tecnosis.net"
Dim sRemitente = "logs@tecnosis.es"
'// Forzar destinatario
If Not String.IsNullOrWhiteSpace(forzarDestinatario) Then
sDireccionesEnvio = forzarDestinatario
End If
'// Destinatario especial si se está ejecutando en ciertas máquinas.
If Environment.MachineName.ToUpper.Trim() = "INTI" OrElse Environment.MachineName.ToUpper.Trim() = "CERBERO" OrElse Environment.MachineName.ToUpper.Trim() = "QUISQUILLA" Then
sDireccionesEnvio = "danmun@tecnosis.net"
sbAsunto.Insert(0, "[`" & Environment.MachineName.Trim & "`] ")
End If
'If Mensaje IsNot Nothing Then Mensaje = Mensaje.Replace(vbCrLf, vbCrLf & "<br />")
tsl5.Correo.Funciones.EnviaCorreo(sServidorSMTP, sRemitente, sDireccionesEnvio, sbAsunto.ToString.Replace("`", ""), Mensaje.Replace("`", ""),,,, "logs@tecnosis.es", "LoGs20i9.")
End If
'// Decidir si enviar también por Slack
If forzarEnviarSlack OrElse Tipo = tsl5.Enumeraciones.TipoLog.Fallo OrElse Tipo = tsl5.Enumeraciones.TipoLog.Advertencia OrElse excepcion IsNot Nothing Then
Dim destinoSlack = "asegasa"
If forzarEnviarSlack Then destinoSlack = "Avant2"
Dim mensajeSlack As New Text.StringBuilder
If String.IsNullOrWhiteSpace(Mensaje) Then
mensajeSlack.Append(Asunto)
Else
mensajeSlack.Append(Mensaje)
End If
tsl5.Utilidades.EnviarNotificacionSlack(mensajeSlack.ToString, destinatario:=destinoSlack, descripcionRemitente:=Reflection.MethodBase.GetCurrentMethod.ToString)
End If
AñadeLogTXT(Mensaje, sFicheroLog)
Catch ex As Exception
sFicheroLog = DirectorioLogs & "Errores-" & nombreLog & "-" & Now.Year.ToString & Now.Month.ToString.PadLeft(2, "0") & ".txt"
AñadeLogTXT(ex.Message, sFicheroLog)
End Try
End Sub
Public Shared Sub AñadeLogNombreConFicheroTexto(ByVal nombreLog As String, ByVal Tipo As tsl5.Enumeraciones.TipoLog, ByVal descripcion As String,
ByVal nombreDelFichero As String, ByVal textoDelFichero As String,
Optional ByVal forzarEnviarCorreoE As Boolean = False, Optional ByVal forzarDestinatario As String = "",
Optional ByVal forzarEnviarSlack As Boolean = False, Optional ByVal excepcion As Exception = Nothing)
' ----------------------------------------------------------------------------------------------------
' Descripción Sub: Gestión de logs de la aplicación
' Fecha. Creacion: 2020-12-01
' Creada por: danmun (heredando de manmog)
' Ultima Modificacion: 2020-12-01
'
' Modificaciones:
' ===============
Dim rutaCarpetaLogs As String = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) & "\ServicioGestionAsegasa\Logs\"
Dim rutaCarpetaTMP As String = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) & "\ServicioGestionAsegasa\TMP\"
Dim sFicheroLog As String = rutaCarpetaLogs & "Log-" & nombreLog & "-" & Now.Year.ToString & Now.Month.ToString & ".txt"
Try
Dim enviarCorreoE As Boolean = False
Dim sbAsunto As New Text.StringBuilder
Dim sSeguimientoDePila As String = ""
sbAsunto.AppendFormat("[`{0}`] ", System.Diagnostics.Process.GetCurrentProcess.ProcessName)
sbAsunto.AppendFormat("{0}: guardando y enviando fichero con nombre `{1}`. ", nombreLog, nombreDelFichero)
Dim sbMensaje As New Text.StringBuilder
'// Lo principal: guardar el fichero de texto.
'// UTF-8 sin BOM y tópalante, que esto lo estoy haciendo rápidamente con propósitos de depuración.
Dim sRutaFicheroTexto As String = rutaCarpetaTMP & nombreLog & "-" & Today.ToString("yyyy-MM-dd_HH-mm-ss-fff") & "-" & nombreDelFichero
IO.File.WriteAllText(sRutaFicheroTexto, textoDelFichero)
'// Decidir si se envía información sobre la excepción
If Not IsNothing(excepcion) Then
If Not el Is Nothing Then el.WriteEntry(excepcion.Message & vbCrLf & excepcion.StackTrace, EventLogEntryType.Error)
sSeguimientoDePila = "Información de la excepción: " & excepcion.ToString & vbCrLf
Dim exceptionInterna As Exception = excepcion
Do
sSeguimientoDePila &= exceptionInterna.StackTrace & vbCrLf
exceptionInterna = exceptionInterna.InnerException
Loop Until IsNothing(exceptionInterna)
End If
sbMensaje.AppendLine(sbAsunto.ToString)
sbMensaje.AppendFormat("{0}{0}Descripción: {1}", vbCrLf, descripcion)
sbMensaje.AppendFormat("{0}{0}Fichero guardado en: `{1}`", vbCrLf, sRutaFicheroTexto)
sbMensaje.AppendFormat("{0}{0}### Inicio del fichero de texto con nombre `{1}`:{0}```{0}{2}{0}```{0}### Fin del fichero de texto.", vbCrLf, nombreDelFichero, textoDelFichero)
If Not String.IsNullOrWhiteSpace(sSeguimientoDePila) Then sbAsunto.AppendLine(vbCrLf & "Seguimiento de pila: " & sSeguimientoDePila)
'// Decidir si se envía correo electrónico
Select Case Tipo
Case tsl5.Enumeraciones.TipoLog.Fallo, tsl5.Enumeraciones.TipoLog.Advertencia
enviarCorreoE = True
End Select
'// Forzar envío de correo electrónico
If forzarEnviarCorreoE OrElse excepcion IsNot Nothing Then enviarCorreoE = True
If enviarCorreoE Then
Select Case Tipo
Case tsl5.Enumeraciones.TipoLog.Fallo
sFicheroLog = rutaCarpetaLogs & "Errores-" & nombreLog & "-" & Now.Year.ToString & Now.Month.ToString.PadLeft(2, "0") & ".txt"
sbMensaje.Insert(0, Now.ToLongTimeString & " Error enviado desde [`" & Environment.MachineName & "`]." & vbCrLf)
Case tsl5.Enumeraciones.TipoLog.Advertencia
sbMensaje.Insert(0, Now.ToLongTimeString & " Advertencia enviada desde [`" & Environment.MachineName & "`]." & vbCrLf)
Case tsl5.Enumeraciones.TipoLog.Informacion
sbMensaje.Insert(0, Now.ToLongTimeString & " Información enviada desde [`" & Environment.MachineName & "`]." & vbCrLf)
Case tsl5.Enumeraciones.TipoLog.Depuracion
sbMensaje.Insert(0, Now.ToLongTimeString & " Información de depuración enviada desde [`" & Environment.MachineName & "`]." & vbCrLf)
End Select
Dim sDireccionesEnvio As String = "sevilla@tecnosis.net"
Dim sServidorSMTP As String = "correo.tecnosis.net"
Dim sRemitente = "logs@tecnosis.es"
'// Forzar destinatario
If Not String.IsNullOrWhiteSpace(forzarDestinatario) Then
sDireccionesEnvio = forzarDestinatario
End If
'// Destinatario especial si se está ejecutando en ciertas máquinas.
If Environment.MachineName.ToUpper.Trim() = "INTI" OrElse Environment.MachineName.ToUpper.Trim() = "CERBERO" Then
sDireccionesEnvio = "danmun@tecnosis.net"
sbAsunto.Insert(0, "[`" & Environment.MachineName.ToUpper.Trim & "`] ")
End If
'If nombreDelFichero IsNot Nothing Then nombreDelFichero = nombreDelFichero.Replace(vbCrLf, vbCrLf & "<br />")
tsl5.Correo.Funciones.EnviaCorreo(sServidorSMTP, sRemitente, sDireccionesEnvio, sbAsunto.ToString.Replace("`", ""), sbMensaje.ToString.Replace("`", ""),,,, "logs@tecnosis.es", "LoGs20i9.")
End If
'// Decidir si enviar también por Slack
If forzarEnviarSlack OrElse Tipo = tsl5.Enumeraciones.TipoLog.Fallo OrElse Tipo = tsl5.Enumeraciones.TipoLog.Advertencia OrElse excepcion IsNot Nothing Then
Dim destinoSlack = "asegasa"
If forzarEnviarSlack Then destinoSlack = "Avant2"
Dim mensajeSlack As New Text.StringBuilder
mensajeSlack.Append(sbAsunto.ToString)
If String.IsNullOrWhiteSpace(sbMensaje.ToString) Then
mensajeSlack.Append(sbAsunto.ToString)
Else
mensajeSlack.Append(sbMensaje.ToString)
End If
tsl5.Utilidades.EnviarNotificacionSlack(mensajeSlack.ToString, destinatario:=destinoSlack, descripcionRemitente:=Reflection.MethodBase.GetCurrentMethod.ToString)
End If
AñadeLogTXT(sbAsunto.ToString, sFicheroLog)
Catch ex As Exception
sFicheroLog = rutaCarpetaLogs & "Errores-" & nombreLog & "-" & Now.Year.ToString & Now.Month.ToString.PadLeft(2, "0") & ".txt"
AñadeLogTXT(ex.Message, sFicheroLog)
End Try
End Sub
Public Shared Sub AñadeLogTXT(ByVal Mensaje As String, ByVal FicheroLog As String)
Dim sw As IO.StreamWriter = Nothing
Try
Mensaje = Mensaje.Replace(vbCrLf, "---")
If IO.File.Exists(FicheroLog) Then
sw = IO.File.AppendText(FicheroLog)
Else
Dim directorio = IO.Path.GetDirectoryName(FicheroLog)
If Not IO.Directory.Exists(directorio) Then tsl5.Utilidades.CreaEstructuraDirectorio(directorio)
sw = IO.File.CreateText(FicheroLog)
End If
Mensaje = Now.ToString & "|" & "Ws: " & System.Diagnostics.Process.GetCurrentProcess.WorkingSet64.ToString.PadLeft(20) &
" PMS: " & System.Diagnostics.Process.GetCurrentProcess.PrivateMemorySize64.ToString.PadLeft(20) & "|" & Mensaje
sw.WriteLine(Mensaje)
Catch ex As Exception
Try
Dim sDireccionesEnvio As String = "sevilla@tecnosis.net"
Dim sServidorSMTP As String = "sevilla2.tecnosis.es"
Dim sRemitente = "logs@tecnosis.es"
If Environment.MachineName.StartsWith("INTI") OrElse Environment.MachineName.StartsWith("ANTA") OrElse Environment.MachineName.ToUpper.Trim() = "CERBERO" Then sDireccionesEnvio = "danmun@tecnosis.net"
'If Mensaje IsNot Nothing Then Mensaje = Mensaje.Replace(vbCrLf, vbCrLf & "<br />")
tsl5.Correo.Funciones.EnviaCorreo(sServidorSMTP, sRemitente, sDireccionesEnvio, "Error AñadeLogTXT. " & Mensaje, Environment.MachineName & ".- " & ex.Message & vbCrLf & ex.StackTrace & vbCrLf & ex.Source,,,, "logs@tecnosis.es", "LoGs20i9.")
Catch ex2 As Exception
End Try
Finally
Try
sw.Close()
Catch
End Try
End Try
End Sub
Shared Sub GeneraRegistroCorreoExcepcion(ex As Exception, Rutina As String, Optional MostrarMensajeError As Boolean = False, Optional FicheroImagen As Byte() = Nothing)
Try
Dim bd = bdGestionAsegasa.gestionasegasaEntities.NuevoContextoCN
Dim sMensaje As String = "Usuario: " & bdGestionAsegasa.Utilidades.Usuario & " Versión: " & My.Application.Info.Version.ToString & vbCrLf
Dim sStackTrace As String = "Tipo excepción: " & ex.ToString & vbCrLf
Dim exError As Exception = ex
Do
sStackTrace &= exError.StackTrace & vbCrLf
exError = exError.InnerException
Loop Until IsNothing(exError)
If sStackTrace <> "" Then sMensaje &= vbCrLf & "StackTrace: " & sStackTrace
Dim cuentaorigen As cuentascorreo = (From c In bd.cuentascorreo Select c Where c.Codigo = "TECNOSIS").First
bdGestionAsegasa.Utilidades.GeneraRegistroCorreo(bd, "Mensaje Automático. Error en " & Rutina, sMensaje, cuentaorigen, "sevilla@tecnosis.net", FicheroImagen,, "ERROR")
Catch ex2 As Exception
AñadeLogTXT(ex2.Message, FicheroLog)
If MostrarMensajeError Then DXMessageBox.Show(ex2.Message & vbCrLf & ex2.StackTrace, "Error Generando Correo Excepcion")
End Try
End Sub
'Shared Sub GeneraRegistroCorreoExcepcion(ex As Exception, sAsunto As String, sCuerpo As String, Optional MostrarMensajeError As Boolean = False)
' Try
' Dim bd = bdGestionAsegasa.gestionasegasaEntities.NuevoContextoCN
' Dim sMensaje As String = sCuerpo & vbCrLf & vbCrLf & "Usuario: " & bdGestionAsegasa.Utilidades.Usuario & vbCrLf & vbCrLf
' Dim sStackTrace As String = "Excepción: " & ex.ToString & vbCrLf
' Dim exError As Exception = ex
' Do
' sStackTrace &= exError.StackTrace & vbCrLf & vbCrLf
' exError = exError.InnerException
' Loop Until IsNothing(exError)
' If sStackTrace <> "" Then sMensaje &= vbCrLf & "StackTrace: " & sStackTrace
' Dim cuentaorigen As cuentascorreo = (From c In bd.cuentascorreo Select c Where c.Codigo = "TECNOSIS").First
' Dim bFichero() As Byte = Nothing
' bdGestionAsegasa.Utilidades.GeneraRegistroCorreo(bd, sAsunto, sMensaje, cuentaorigen, "sevilla@tecnosis.net")
' Catch ex2 As Exception
' AñadeLogTXT(ex2.Message, FicheroLog)
' If MostrarMensajeError Then DXMessageBox.Show(ex2.Message & vbCrLf & ex2.StackTrace, "Error Generando Correo Excepcion")
' End Try
'End Sub
Shared Sub GeneraRegistroCorreoExcepcion(bd As bdGestionAsegasa.gestionasegasaEntities, ex As Exception, sAsunto As String, sCuerpo As String, Optional MostrarMensajeError As Boolean = False, Optional FicheroImagen As Byte() = Nothing)
Try
Dim sMensaje As String = sCuerpo & vbCrLf & vbCrLf & "Usuario: " & bdGestionAsegasa.Utilidades.Usuario & vbCrLf & vbCrLf
Dim sStackTrace As String = "Excepción: " & ex.ToString & vbCrLf
Dim exError As Exception = ex
Do
sStackTrace &= exError.StackTrace & vbCrLf & vbCrLf
exError = exError.InnerException
Loop Until IsNothing(exError)
If sStackTrace <> "" Then sMensaje &= vbCrLf & "StackTrace: " & sStackTrace
Dim cuentaorigen As cuentascorreo = (From c In bd.cuentascorreo Select c Where c.Codigo = "TECNOSIS").First
Dim bFichero() As Byte = Nothing
bdGestionAsegasa.Utilidades.GeneraRegistroCorreo(bd, sAsunto, sMensaje, cuentaorigen, "sevilla@tecnosis.net", FicheroImagen,, "ERROR")
Catch ex2 As Exception
AñadeLogTXT(ex2.Message, FicheroLog)
If MostrarMensajeError Then DXMessageBox.Show(ex2.Message & vbCrLf & ex2.StackTrace, "Error Generando Correo Excepcion")
End Try
End Sub
Public Shared Sub GeneraRegistroCorreo(bd As bdGestionAsegasa.gestionasegasaEntities, Asunto As String, Cuerpo As String)
Try
Dim cuentaorigen As cuentascorreo = (From c In bd.cuentascorreo Select c Where c.Codigo = "TECNOSIS").First
Dim sRutaAdjunto As String = ""
Dim correo = New correos With {
.Asunto = Asunto,
.Cuerpo = Cuerpo,
.Destinatario = "sevilla@tecnosis.net",
.DireccionRespuesta = cuentaorigen.Remitente,
.FechaCreacion = bdGestionAsegasa.Utilidades.AhoraMysql(bd),
.idcuenta = cuentaorigen.idCuenta,
.Remitente = cuentaorigen.Remitente
}
If Environment.MachineName.ToUpper = "INTI" OrElse Environment.MachineName.ToUpper.Trim() = "CERBERO" Then correo.Destinatario = "danmun@tecnosis.net"
'// Reemplazar los saltos de línea con <br> porque el correo va en HTML, y si no hacemos esto
'// no habrá saltos de línea dentro del correo.
'If correo.Cuerpo IsNot Nothing Then correo.Cuerpo = correo.Cuerpo.Replace(vbCrLf, vbCrLf & "<br />")
'// Guardar en la bd.
bd.correos.AddObject(correo)
bd.GuardarCambios()
Catch ex As Exception
Debug.Write(ex.Message)
Throw
End Try
End Sub
Public Shared Sub GeneraRegistroCorreo(bd As bdGestionAsegasa.gestionasegasaEntities, Asunto As String, Cuerpo As String, cuenta As cuentascorreo, Destinatario As String, Optional CapturaPantallaError As Byte() = Nothing, Optional idAplicacion As Integer? = Nothing, Optional CodigoAplicacion As String = "")
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,
.idAplicacion = idAplicacion,
.CodigoAplicacion = CodigoAplicacion
}
If CapturaPantallaError IsNot Nothing Then
Dim idtipocapturaerror = bd.enumeraciones.First(Function(x) x.Codigo = "TIPFIC.CAPERROR").idEnumeracion
Dim f As New ficheros
With f
f.NombreFichero = "CapturaPantallaError_" & Now.ToString("yyyyMMddhhmmss") & ".jpg"
f.Fichero = CapturaPantallaError
f.idTipo = idtipocapturaerror
End With
bd.ficheros.AddObject(f)
correo.ficheros = f
End If
If Environment.MachineName.ToUpper = "INTI" OrElse Environment.MachineName.ToUpper.Trim() = "CERBERO" Then Destinatario = "danmun@tecnosis.net"
bd.correos.AddObject(correo)
bd.GuardarCambios()
Catch ex As Exception
Debug.Write(ex.Message)
Throw
End Try
End Sub
Shared Sub GenerarRegistroCorreoAvant2Agente3(bd As bdGestionAsegasa.gestionasegasaEntities, ByRef linea As bdGestionAsegasa.polizassg, ByVal sQuotationID As String, Optional ByVal usuarioAvant2 As String = "")
Try
'// Los destinatarios de estos correos están en la base de datos.
Dim lineasEnumeraciones As List(Of bdGestionAsegasa.enumeraciones) = (From x In bd.enumeraciones Where x.idGrupoEnumeracion = "62" Select x).ToList()
Dim sDireccionRespuesta As String = lineasEnumeraciones.Where(Function(x) x.Codigo = "AVANT2.EMAIL.IP.RESPUESTA").FirstOrDefault.ValorAlfabetico1
Dim sDireccionesDestino As New List(Of String)
For Each le In lineasEnumeraciones
If le.Codigo.StartsWith("AVANT2.EMAIL.IP.DESTINO") Then sDireccionesDestino.Add(le.ValorAlfabetico1)
Next
Dim sbAsuntoEmail As New Text.StringBuilder
Dim sbCuerpoEmail As New Text.StringBuilder
sbAsuntoEmail.Append("Avant2: se procederá a la incorporación de una póliza al agente 3")
sbCuerpoEmail.AppendLine("Avant2: se procederá a la incorporación de una póliza al agente 3.")
sbCuerpoEmail.AppendLine("<br/>")
sbCuerpoEmail.AppendLine("No es posible transferir la póliza a su usuario original porque no se encuentra la información del usuario que la emitió desde Avant2.")
sbCuerpoEmail.AppendLine("<br/>")
sbCuerpoEmail.AppendLine("Hay que revisar que el usuario de Avant2 que realizó la emisión de esta póliza esté correctamente identificado en la aplicación Gestión Asegasa: hay que revisar el campo ""Usuario Avant"" en la ficha del agente o subagente y que no esté de baja.")
sbCuerpoEmail.AppendLine("<br/>")
sbCuerpoEmail.AppendLine("Datos de la póliza importada al agente 3:")
sbCuerpoEmail.AppendLine("<br/>")
sbCuerpoEmail.AppendLine(String.Format("quotationID: {0} <br/>", sQuotationID))
Try
sbCuerpoEmail.AppendLine(String.Format("Nº de póliza: {0} <br/>", linea.NumeroPoliza))
Catch ex As Exception
'Nada, a propósito.
End Try
Try
sbCuerpoEmail.AppendLine(String.Format("Compañía: {0} <br/>", linea.companias.Nombre))
Catch ex As Exception
'Nada, a propósito.
End Try
Try
sbCuerpoEmail.AppendLine(String.Format("Ramo: {0} <br/>", linea.ramos.Descripcion))
Catch ex As Exception
'Nada, a propósito.
End Try
Try
sbCuerpoEmail.AppendLine(String.Format("CIF del tomador: {0} <br/>", linea.Tomador.CIF))
Catch ex As Exception
'Nada, a propósito.
End Try
Try
sbCuerpoEmail.AppendLine(String.Format("Nombre del tomador: {0} <br/>", (linea.Tomador.Nombre & " " & linea.Tomador.Apellidos).Trim))
Catch ex As Exception
'Nada, a propósito.
End Try
Try
sbCuerpoEmail.AppendLine(String.Format("Fecha de efecto: {0} <br/>", linea.FechaEfecto))
Catch ex As Exception
'Nada, a propósito.
End Try
Try
If Not String.IsNullOrWhiteSpace(usuarioAvant2) Then
sbCuerpoEmail.AppendLine(String.Format("Identificador del usuario de Avant 2 que realizó el alta: {0} <br/>", (usuarioAvant2).Trim))
End If
Catch ex As Exception
'Nada, a propósito.
End Try
sbCuerpoEmail.AppendLine("<br/>")
sbCuerpoEmail.AppendLine("Fin del correo electrónico.")
Dim cuentaorigen As cuentascorreo = (From c In bd.cuentascorreo Select c Where c.Codigo = "TECNOSIS").First
For Each destinatario In sDireccionesDestino
bdGestionAsegasa.Utilidades.GeneraRegistroCorreo(bd, sbAsuntoEmail.ToString, sbCuerpoEmail.ToString, cuentaorigen, destinatario)
Next
Catch ex2 As Exception
AñadeLogTXT(ex2.Message, FicheroLog)
End Try
End Sub
Shared Sub GenerarRegistroCorreoAvant2IncorporacionParcial(bd As bdGestionAsegasa.gestionasegasaEntities, ByRef linea As bdGestionAsegasa.polizassg, ByVal sQuotationID As String)
Try
'// Los destinatarios de estos correos están en la base de datos.
Dim lineasEnumeraciones As List(Of bdGestionAsegasa.enumeraciones) = (From x In bd.enumeraciones Where x.idGrupoEnumeracion = "62" Select x).ToList()
Dim sDireccionRespuesta As String = lineasEnumeraciones.Where(Function(x) x.Codigo = "AVANT2.EMAIL.IP.RESPUESTA").FirstOrDefault.ValorAlfabetico1
Dim sDireccionesDestino As New List(Of String)
For Each le In lineasEnumeraciones
If le.Codigo.StartsWith("AVANT2.EMAIL.IP.DESTINO") Then sDireccionesDestino.Add(le.ValorAlfabetico1)
Next
Dim sbAsuntoEmail As New Text.StringBuilder
Dim sbCuerpoEmail As New Text.StringBuilder
sbAsuntoEmail.AppendFormat("Avant2: incorporación parcial de poliza nº {0}, {1}", linea.NumeroPoliza, linea.ramos.Descripcion)
sbCuerpoEmail.AppendLine("Avant2, incorporación parcial de póliza.")
sbCuerpoEmail.AppendLine("")
sbCuerpoEmail.AppendLine("Esto es una incorporación parcial. Avant2 de Codeoscopic no proporciona varios datos de la póliza. Estos campos no proporcionados podrían venir vacios, con los símbolos ~~, con el número -1 o con la fecha 1970/01/01.")
sbCuerpoEmail.AppendLine("")
sbCuerpoEmail.AppendLine(String.Format("quotationID: {0}", sQuotationID))
Try
sbCuerpoEmail.AppendLine(String.Format("Numero de póliza: {0}", linea.NumeroPoliza))
Catch ex As Exception
'Nada, a propósito.
End Try
Try
sbCuerpoEmail.AppendLine(String.Format("Compañía: {0}", linea.companias.Nombre))
Catch ex As Exception
'Nada, a propósito.
End Try
Try
sbCuerpoEmail.AppendLine(String.Format("Ramo: {0}", linea.ramos.Descripcion))
Catch ex As Exception
'Nada, a propósito.
End Try
Try
sbCuerpoEmail.AppendLine(String.Format("CIF del tomador: {0}", linea.Tomador.CIF))
Catch ex As Exception
'Nada, a propósito.
End Try
Try
sbCuerpoEmail.AppendLine(String.Format("Nombre del tomador: {0}", (linea.Tomador.Nombre & " " & linea.Tomador.Apellidos).Trim))
Catch ex As Exception
'Nada, a propósito.
End Try
Try
sbCuerpoEmail.AppendLine(String.Format("Fecha de efecto: {0}", linea.FechaEfecto))
Catch ex As Exception
'Nada, a propósito.
End Try
sbCuerpoEmail.AppendLine("")
sbCuerpoEmail.AppendLine("Fin del correo electronico.")
Dim cuentaorigen As cuentascorreo = (From c In bd.cuentascorreo Select c Where c.Codigo = "TECNOSIS").First
For Each destinatario In sDireccionesDestino
bdGestionAsegasa.Utilidades.GeneraRegistroCorreo(bd, sbAsuntoEmail.ToString, sbCuerpoEmail.ToString, cuentaorigen, destinatario)
Next
Catch ex2 As Exception
AñadeLogTXT(ex2.Message, FicheroLog)
End Try
End Sub
Public Shared Function ObtienePermisos(bd As bdGestionAsegasa.gestionasegasaEntities, idPermiso As Nullable(Of Integer), idUsuario As Integer) As tsWPF.Permisos
Dim per As New tsWPF.Permisos
If (From u In bd.usuarios Select u Where u.idUsuario = idUsuario).First.gruposusuarios.Descripcion = "TECNOSIS" Then
per.Consultar = True
per.Eliminar = True
per.Nuevos = True
per.Otros = True
per.Modificar = True
per.Impresion = True
per.Exportar = True
Else
If idPermiso Is Nothing Then
per.Consultar = False
per.Eliminar = False
per.Nuevos = False
per.Otros = False
per.Modificar = False
per.Impresion = False
per.Exportar = False
Else
Dim au = (From a In bd.autorizacionesusuarios Select a Where a.permisos.idPermiso = idPermiso And a.idUsuario = idUsuario)
If au.Count = 0 Then
Dim idGrupo As Integer = (From u In bd.usuarios Select u Where u.idUsuario = idUsuario).First.idGrupo
Dim ag = (From g In bd.autorizacionesgrupos Select g Where g.permisos.idPermiso = idPermiso And g.idGrupo = idGrupo)
If ag.Count = 0 Then
per.Consultar = False
per.Eliminar = False
per.Nuevos = False
per.Otros = False
per.Modificar = False
per.Impresion = False
per.Exportar = False
Else
per.Consultar = ag.First.PermitirConsultas
per.Eliminar = ag.First.PermitirEliminaciones
per.Nuevos = ag.First.PermitirNuevos
per.Otros = ag.First.OtrosPermisos
per.Modificar = ag.First.PermitirModificaciones
per.Impresion = ag.First.PermitirImpresiones
per.Exportar = ag.First.PermitirExportar
End If
Else
per.Consultar = au.First.PermitirConsultas
per.Eliminar = au.First.PermitirEliminaciones
per.Nuevos = au.First.PermitirNuevos
per.Otros = au.First.OtrosPermisos
per.Modificar = au.First.PermitirModificaciones
per.Impresion = au.First.PermitirImpresiones
per.Exportar = au.First.PermitirExportar
End If
End If
End If
Return per
End Function
Public Shared Function ObtienePermisos(bd As bdGestionAsegasa.gestionasegasaEntities, Codigo As String, idUsuario As Integer) As tsWPF.Permisos
Try
Dim per As New tsWPF.Permisos
If bd.usuarios.First(Function(x) x.idUsuario = idUsuario).gruposusuarios.Descripcion = "TECNOSIS" Then
per.Consultar = True
per.Eliminar = True
per.Nuevos = True
per.Otros = True
per.Modificar = True
per.Impresion = True
per.Exportar = True
Else
Dim au = (From a In bd.autorizacionesusuarios Select a Where a.permisos.CodigoPermiso = Codigo And a.idUsuario = idUsuario)
If au.Count = 0 Then
Dim idGrupo As Integer = (From u In bd.usuarios Select u Where u.idUsuario = idUsuario).First.idGrupo
Dim ag = (From g In bd.autorizacionesgrupos Select g Where g.permisos.CodigoPermiso = Codigo And g.idGrupo = idGrupo)
If ag.Count = 0 Then
per.Consultar = False
per.Eliminar = False
per.Nuevos = False
per.Otros = False
per.Modificar = False
per.Impresion = False
per.Exportar = False
Else
per.Consultar = ag.First.PermitirConsultas
per.Eliminar = ag.First.PermitirEliminaciones
per.Nuevos = ag.First.PermitirNuevos
per.Otros = ag.First.OtrosPermisos
per.Modificar = ag.First.PermitirModificaciones
per.Impresion = ag.First.PermitirImpresiones
per.Exportar = ag.First.PermitirExportar
End If
Else
per.Consultar = au.First.PermitirConsultas
per.Eliminar = au.First.PermitirEliminaciones
per.Nuevos = au.First.PermitirNuevos
per.Otros = au.First.OtrosPermisos
per.Modificar = au.First.PermitirModificaciones
per.Impresion = au.First.PermitirImpresiones
per.Exportar = au.First.PermitirExportar
End If
End If
Return per
Catch ex As Exception
Throw New Exception(ex.Message, ex)
End Try
End Function
Public Shared Function ObtenerNumeroDePolizaDisponibleTractoresAXA(ByVal bd As bdGestionAsegasa.gestionasegasaEntities, Optional ByVal n As UInteger = 0) As String
Dim resultado As String = ""
Dim inicio As bdGestionAsegasa.enumeraciones
Dim fin As bdGestionAsegasa.enumeraciones
Dim actual As UInteger = 0
Dim bEncontrado As Boolean = False
Dim enumNumeracion = (From x In bd.enumeraciones Where x.Codigo.StartsWith("AXATRACTORES.numeracion.") AndAlso x.ValorAlfabetico1.ToUpper.Trim = "DISPONIBLE"
Order By x.Codigo Select x).ToList()
Dim idRamoTractores As String = (From x In bd.ramos Where x.Codigo = "1-1" Select x.idRamo).FirstOrDefault
Dim idRamoRemolques As String = (From x In bd.ramos Where x.Codigo = "1-1-1" Select x.idRamo).FirstOrDefault
' De todos los posibles rangos, tengo que elegir el más bajo que esté disponible.
' Como lo he ordenado por Codigo, al hacerlo así ya estoy eligiendo el más bajo disponible.
' Con rango más bajo me refiero al valor que está dentro del código, no a los números del rango en sí.
' Formato del código: "AXATRACTORES.numeracion.0000"
inicio = enumNumeracion.Where(Function(x) x.Codigo.EndsWith(".inicio")).FirstOrDefault
fin = enumNumeracion.Where(Function(x) x.Codigo.EndsWith(".fin")).FirstOrDefault
Try
If n = 0 Then
actual = (From x In bd.polizassg Where x.NumeroPoliza >= inicio.ValorNumerico1 AndAlso x.NumeroPoliza <= fin.ValorNumerico1 AndAlso
(x.idRamo = idRamoTractores OrElse x.idRamo = idRamoRemolques)
Order By x.NumeroPoliza Descending
Select x.NumeroPoliza Take 10).ToList().FirstOrDefault
Else
actual = n
End If
Catch ex As Exception
' Nada, significa que aún no existe el primero.
End Try
If actual = 0 Then
' Si "actual" vale 0 significa que es la primera vez y tenemos que usar el primero del rango.
resultado = inicio.ValorNumerico1
bEncontrado = True
Else
If actual < inicio.ValorNumerico1 Then
resultado = inicio.ValorNumerico1
bEncontrado = True
ElseIf actual = fin.ValorNumerico1 Then
' Caso en el que hay que pasar a usar el siguiente rango.
' Hay que marcar el actual rango como completado.
inicio.ValorAlfabetico1 = "Usado"
fin.ValorAlfabetico1 = "Usado"
bd.GuardarCambios()
resultado = ObtenerNumeroDePolizaDisponibleTractoresAXA(bd)
' Sí, esta es una función recursiva. Está comprobado que esta recursividad funciona adecuadamente según los datos que haya en la base de datos.
ElseIf actual > fin.ValorNumerico1 Then 'El número final sí lo podemos usar, por eso la comparación se hace con ">".
resultado = -1 'Significa que ya hemos llegado al límite de asignaciones, no podemos asignar más.
bEncontrado = True
' TODO: Mirar si hay otro rango más?
Dim asunto As String = "TractoresAXA: Se han acabado los nºs de pólizas reservados para el servicio de TractoresAXA. Todas las altas que se realicen a partir de ahora fallarán hasta que se asignen nuevos rangos."
Dim cuerpo As String = asunto & vbCrLf & " Hay que avisar a ASEGASA para que gestionen con AXA la asignación de un nuevo rango de nºs de pólizas para este servicio." & vbCrLf &
"En método `" & System.Reflection.MethodBase.GetCurrentMethod.ToString & "`. " _
& vbCrLf & Environment.MachineName
Call AñadeLog(tsl5.Enumeraciones.TipoLog.Fallo, asunto, cuerpo)
tsl5.Utilidades.EnviarNotificacionSlack(asunto, destinatario:="#asegasa", descripcionRemitente:=Reflection.MethodBase.GetCurrentMethod.ToString)
Else
' Caso normal, en el que hay que usar el número que sigue, porque seguimos dentro del rango.
'
' Pero tengo que comprobar que "actual + 1" no esté usado. ¿Cómo lo hago? Bueno, sería mucha
' casualidad y mucha mala suerte que dos altas coincidan en el tiempo de tal modo que ambas
' pillen el mismo nº de poliza.
resultado = actual + 1
bEncontrado = True
End If
End If
' TODO: danmun: Lanzar aquí mensajes cuando falten 500, 200, 100, 50, 20, 10, avisando.
'If bEncontrado Then
' Dim numerosReservadosDisponibles As Integer = ComprobarCuantosNumerosReservadosQuedanDisponibles(actual, inicio, fin)
' Dim listaDeLimitesParaEnviarAdvertencias As Integer() = {10, 20, 50, 100, 200, 500}
' Dim bAdvertenciaEnviada As Boolean = False
' ' La idea es la siguiente: dispongo de un array donde tenemos los límites en los que hay que lanzar la advertencia
' ' de que se están gastando los nºs de pólizas reservados para TractoresAXA. El array está ordenado de menor a mayor.
' ' Al recorrer el array, compruebo: ¿quedan menos de 10 números disponibles? Si es así, lanzo advertencia y ya no vuelvo
' ' a realizar más comprobaciones. Si no es así, compruebo con el siguiente límite, que sería 20. Por lo tanto, es posible
' ' completar el recorrido del array sin enviar ninguna advertencia o bien enviando solamente 1.
' For Each i In listaDeLimitesParaEnviarAdvertencias
' If Not bAdvertenciaEnviada AndAlso numerosReservadosDisponibles < i Then
' ' Notificación Slack
' Try
' Dim asunto As String = String.Format("TractoresAXA: quedan menos de {0} nºs de póliza reservados sin usar.", i)
' Dim sbCuerpo As New Text.StringBuilder()
' sbCuerpo.AppendFormat("*TractoresAXA*: quedan menos de {1} nºs de póliza reservados sin usar.{0}", vbCrLf, i)
' sbCuerpo.AppendLine("Es recomendable avisar a ASEGASA para que gestionen con AXA la asignación de un nuevo rango de nºs de pólizas para este servicio.")
' sbCuerpo.AppendFormat("```Próximo nº de póliza que va a ser usado de inmediato: {1}{0}Primer nº del rango actual:{2}{0}Último nº del rango actual: {3}{0}Servidor: {4}```{0}", vbCrLf,
' resultado, inicio.ValorNumerico1, fin.ValorNumerico1, Environment.MachineName)
' sbCuerpo.AppendFormat("En método `{0}` y en máquina `{1}`.", System.Reflection.MethodBase.GetCurrentMethod.ToString, Environment.MachineName)
' Call AñadeLog(tsl5.Enumeraciones.TipoLog.Advertencia, asunto, sbCuerpo.ToString)
' tsl5.Utilidades.EnviarNotificacionSlack(sbCuerpo.ToString, destinatario:="#asegasa", descripcionRemitente:=Reflection.MethodBase.GetCurrentMethod.ToString)
' Catch ex As Exception
' ' Si esta notificación da error no debe pararse el servicio, así que no hago nada.
' End Try
' bAdvertenciaEnviada = True
' End If
' Next
'End If
Return resultado
End Function
End Class

871
guia/bd/Utilidades.vb Normal file
View File

@@ -0,0 +1,871 @@
Imports System.Data.EntityClient
Imports System.Data.Objects
Imports System.Net
Imports System.Reflection
Imports DevExpress.Xpf.Core
Imports DevExpress.XtraPrinting.Native.Properties
Imports Microsoft.Extensions.Configuration
Imports tsl5
Imports tsl5.Enumeraciones
Public Class Utilidades
Public Shared Property Usuario As String
Public Shared Property NombreUsuario As String
Public Shared dsc As New tsl5.Datos.DatosSesionCliente
'Public Shared bdga As tsl5.Datos.BBDD
Public Shared EsRemoto As Boolean? = Nothing
Private Shared FicheroLog = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) & "\Asegasa\GestionAsegasaLog.txt"
' Public Shared ip As String
Private Shared _ListaSituacionesWeb As List(Of enumeraciones) = Nothing
Private Shared _ListaPagoWeb As List(Of enumeraciones) = Nothing
Friend Shared idTippPE As Integer?
Friend Shared idTippBA As Integer?
Friend Shared idtrCx As Integer?
Friend Shared idtrEx As Integer?
Public Shared idSitr1 As Integer?
Private Shared Sub ActualizaConexion(deGestionAsegasa As gestionasegasaEntities)
Dim idMYSQL As Integer = deGestionAsegasa.ExecuteStoreQuery(Of Integer)("select connection_id() as id").First
Dim cn As conexiones
If deGestionAsegasa.conexiones.Any(Function(x) x.idMysql = idMYSQL) Then
cn = deGestionAsegasa.conexiones.First(Function(x) x.idMysql = idMYSQL)
Else
cn = New conexiones
cn.idMysql = idMYSQL
deGestionAsegasa.conexiones.AddObject(cn)
End If
cn.ip = deGestionAsegasa.ExecuteStoreQuery(Of String)("select host from information_schema.processlist WHERE ID=connection_id()").First
If deGestionAsegasa.usuarios.Any(Function(x) x.Usuario = Usuario) Then
If cn.Usuario <> Usuario Then
cn.Usuario = Usuario 'deGestionAsegasa.usuarios.First(Function(x) x.idUsuario = idUsuario).Usuario
cn.FechaHora = AhoraMysql(deGestionAsegasa)
deGestionAsegasa.GuardarCambios()
End If
Else
cn.Usuario = Usuario & " * NO ENCONTRADO *"
cn.FechaHora = AhoraMysql(deGestionAsegasa)
deGestionAsegasa.GuardarCambios()
End If
End Sub
Public Shared Function AhoraMysql(deGestionAsegasa As gestionasegasaEntities) As DateTime
Try
Dim FechaServidor As DateTime = deGestionAsegasa.ExecuteStoreQuery(Of DateTime)("select now() as Ahora").First
Return FechaServidor
Catch ex As Exception
Return Now
End Try
End Function
Public Shared el As EventLog
Public Shared DirectorioLogs As String = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) & "\ServicioGestionAsegasa\Logs\"
Public Shared Async Sub AñadeLog(ByVal Tipo As tsl5.Enumeraciones.TipoLog, ByVal Asunto As String, ByVal Mensaje As String, Optional ByVal e As Exception = Nothing)
' ----------------------------------------------------------------------------------------------------
' Descripción Sub: Gestión de logs de la aplicación
' Fecha. Creacion: ???
' Creada por: manmog
' Ultima Modificacion: 24/11/2010
'
' Modificaciones:
' ===============
Dim sFicheroLog As String = DirectorioLogs & "Log-" & Now.Year.ToString & Now.Month.ToString & ".txt"
Try
If Not IsNothing(e) Then
If Not el Is Nothing Then el.WriteEntry(e.Message & vbCrLf & e.StackTrace, EventLogEntryType.Error)
Dim sSeguimientoDePila As String = "Información de la excepción: " & e.ToString & vbCrLf
Dim exceptionInterna As Exception = e
Do
sSeguimientoDePila &= exceptionInterna.StackTrace & vbCrLf
exceptionInterna = exceptionInterna.InnerException
Loop Until IsNothing(exceptionInterna)
If sSeguimientoDePila <> "" Then Mensaje &= vbCrLf & "Seguimiento de pila: " & sSeguimientoDePila
End If
Select Case Tipo
Case tsl5.Enumeraciones.TipoLog.Fallo, tsl5.Enumeraciones.TipoLog.Advertencia
If Tipo = tsl5.Enumeraciones.TipoLog.Fallo Then
sFicheroLog = DirectorioLogs & "Errores-" & Now.Year.ToString & Now.Month.ToString.PadLeft(2, "0") & ".txt"
Mensaje = Now.ToString("dd/MM/yyyy HH:mm:ss") & " Error enviado desde " & Environment.MachineName & " VERSION: " & Assembly.GetExecutingAssembly.GetName.Version.ToString & ". " & Mensaje
Else
Mensaje = Now.ToString("dd/MM/yyyy HH:mm:ss") & " Advertencia enviado desde " & Environment.MachineName & " VERSION: " & Assembly.GetExecutingAssembly.GetName.Version.ToString & ". " & Mensaje
End If
Dim sDireccionesEnvio As String = "sevilla@tecnosis.net"
Dim sServidorSMTP As String = "correo.tecnosis.net"
Dim sRemitente = "logs@tecnosis.es"
If Environment.MachineName.ToUpper.Trim() = "INTI" OrElse Environment.MachineName.ToUpper.Trim() = "CERBERO" Then
sDireccionesEnvio = "danmun@tecnosis.net"
Asunto = "[`" & Environment.MachineName.Trim & "`] " & Asunto
End If
Dim FuerzaCorreo As Boolean = False
If tsNotificacionesHabilitado Then
Try
Await EnviaAlertaExcepcion(Asunto, Mensaje)
Catch ex1 As Exception
FuerzaCorreo = True
Dim sStackTrace = "Tipo excepción Alerta: " & ex1.ToString & vbCrLf
Dim exError = ex1
Do
sStackTrace &= exError.StackTrace & vbCrLf
exError = exError.InnerException
Loop Until IsNothing(exError)
If sStackTrace <> "" Then Mensaje &= vbCrLf & "StackTrace: " & sStackTrace
End Try
Else
FuerzaCorreo = True
End If
If CorreoLogsHabilitado Or FuerzaCorreo Then
tsl5.Correo.Funciones.EnviaCorreo(sServidorSMTP, sRemitente, sDireccionesEnvio, Asunto, Mensaje,,,, "logs@tecnosis.es", "LoGs20i9.",, True)
End If
End Select
AñadeLogTXT(Mensaje, sFicheroLog)
Catch ex As Exception
sFicheroLog = DirectorioLogs & "Errores-" & Now.Year.ToString & Now.Month.ToString.PadLeft(2, "0") & ".txt"
AñadeLogTXT(ex.Message, sFicheroLog)
End Try
End Sub
Public Shared Sub AñadeLogNombre(ByVal nombreLog As String, ByVal Tipo As tsl5.Enumeraciones.TipoLog, ByVal Asunto As String, ByVal Mensaje As String,
Optional ByVal forzarEnviarCorreoE As Boolean = False, Optional ByVal forzarDestinatario As String = "",
Optional ByVal forzarEnviarSlack As Boolean = False, Optional ByVal excepcion As Exception = Nothing)
' ----------------------------------------------------------------------------------------------------
' Descripción Sub: Gestión de logs de la aplicación
' Fecha. Creacion: 2020-12-01
' Creada por: danmun (heredando de manmog)
' Ultima Modificacion: 2020-12-01
'
' Modificaciones:
' ===============
Dim sFicheroLog As String = DirectorioLogs & "Log-" & nombreLog & "-" & Now.Year.ToString & Now.Month.ToString & ".txt"
Try
Dim enviarCorreoE As Boolean = False
Dim sbAsunto As New Text.StringBuilder
Dim sSeguimientoDePila As String = ""
sbAsunto.AppendFormat("[`{0}`] ", System.Diagnostics.Process.GetCurrentProcess.ProcessName)
sbAsunto.Append(Asunto)
'// Decidir si se envía información sobre la excepción
If Not IsNothing(excepcion) Then
If Not el Is Nothing Then el.WriteEntry(excepcion.Message & vbCrLf & excepcion.StackTrace, EventLogEntryType.Error)
sSeguimientoDePila = "Información de la excepción: " & excepcion.ToString & vbCrLf
Dim exceptionInterna As Exception = excepcion
Do
sSeguimientoDePila &= exceptionInterna.StackTrace & vbCrLf
exceptionInterna = exceptionInterna.InnerException
Loop Until IsNothing(exceptionInterna)
End If
Mensaje = sbAsunto.ToString & vbCrLf & Mensaje & vbCrLf
If Not String.IsNullOrWhiteSpace(sSeguimientoDePila) Then Mensaje &= vbCrLf & "Seguimiento de pila: " & sSeguimientoDePila
'// Decidir si se envía correo electrónico
Select Case Tipo
Case tsl5.Enumeraciones.TipoLog.Fallo, tsl5.Enumeraciones.TipoLog.Advertencia
enviarCorreoE = True
End Select
'// Forzar envío de correo electrónico
If forzarEnviarCorreoE OrElse excepcion IsNot Nothing Then enviarCorreoE = True
If enviarCorreoE Then
Select Case Tipo
Case tsl5.Enumeraciones.TipoLog.Fallo
sFicheroLog = DirectorioLogs & "Errores-" & nombreLog & "-" & Now.Year.ToString & Now.Month.ToString.PadLeft(2, "0") & ".txt"
Mensaje = Now.ToLongTimeString & " Error enviado desde [`" & Environment.MachineName & "`]." & vbCrLf & Mensaje
Case tsl5.Enumeraciones.TipoLog.Advertencia
Mensaje = Now.ToLongTimeString & " Advertencia enviada desde [`" & Environment.MachineName & "`]." & vbCrLf & Mensaje
Case tsl5.Enumeraciones.TipoLog.Informacion
Mensaje = Now.ToLongTimeString & " Información enviada desde [`" & Environment.MachineName & "`]." & vbCrLf & Mensaje
Case tsl5.Enumeraciones.TipoLog.Depuracion
Mensaje = Now.ToLongTimeString & " Información de depuración enviada desde [`" & Environment.MachineName & "`]." & vbCrLf & Mensaje
End Select
Dim sDireccionesEnvio As String = "sevilla@tecnosis.net"
Dim sServidorSMTP As String = "correo.tecnosis.net"
Dim sRemitente = "logs@tecnosis.es"
'// Forzar destinatario
If Not String.IsNullOrWhiteSpace(forzarDestinatario) Then
sDireccionesEnvio = forzarDestinatario
End If
'// Destinatario especial si se está ejecutando en ciertas máquinas.
If Environment.MachineName.ToUpper.Trim() = "INTI" OrElse Environment.MachineName.ToUpper.Trim() = "CERBERO" OrElse Environment.MachineName.ToUpper.Trim() = "QUISQUILLA" Then
sDireccionesEnvio = "danmun@tecnosis.net"
sbAsunto.Insert(0, "[`" & Environment.MachineName.Trim & "`] ")
End If
'If Mensaje IsNot Nothing Then Mensaje = Mensaje.Replace(vbCrLf, vbCrLf & "<br />")
tsl5.Correo.Funciones.EnviaCorreo(sServidorSMTP, sRemitente, sDireccionesEnvio, sbAsunto.ToString.Replace("`", ""), Mensaje.Replace("`", ""),,,, "logs@tecnosis.es", "LoGs20i9.")
End If
'// Decidir si enviar también por Slack
If forzarEnviarSlack OrElse Tipo = tsl5.Enumeraciones.TipoLog.Fallo OrElse Tipo = tsl5.Enumeraciones.TipoLog.Advertencia OrElse excepcion IsNot Nothing Then
Dim destinoSlack = "asegasa"
If forzarEnviarSlack Then destinoSlack = "Avant2"
Dim mensajeSlack As New Text.StringBuilder
If String.IsNullOrWhiteSpace(Mensaje) Then
mensajeSlack.Append(Asunto)
Else
mensajeSlack.Append(Mensaje)
End If
tsl5.Utilidades.EnviarNotificacionSlack(mensajeSlack.ToString, destinatario:=destinoSlack, descripcionRemitente:=Reflection.MethodBase.GetCurrentMethod.ToString)
End If
AñadeLogTXT(Mensaje, sFicheroLog)
Catch ex As Exception
sFicheroLog = DirectorioLogs & "Errores-" & nombreLog & "-" & Now.Year.ToString & Now.Month.ToString.PadLeft(2, "0") & ".txt"
AñadeLogTXT(ex.Message, sFicheroLog)
End Try
End Sub
'Public Shared Sub AñadeLogNombreConFicheroTexto(ByVal nombreLog As String, ByVal Tipo As tsl5.Enumeraciones.TipoLog, ByVal descripcion As String,
' ByVal nombreDelFichero As String, ByVal textoDelFichero As String,
' Optional ByVal forzarEnviarCorreoE As Boolean = False, Optional ByVal forzarDestinatario As String = "",
' Optional ByVal forzarEnviarSlack As Boolean = False, Optional ByVal excepcion As Exception = Nothing)
' ' ----------------------------------------------------------------------------------------------------
' ' Descripción Sub: Gestión de logs de la aplicación
' ' Fecha. Creacion: 2020-12-01
' ' Creada por: danmun (heredando de manmog)
' ' Ultima Modificacion: 2020-12-01
' '
' ' Modificaciones:
' ' ===============
' Dim rutaCarpetaLogs As String = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) & "\ServicioGestionAsegasa\Logs\"
' Dim rutaCarpetaTMP As String = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) & "\ServicioGestionAsegasa\TMP\"
' Dim sFicheroLog As String = rutaCarpetaLogs & "Log-" & nombreLog & "-" & Now.Year.ToString & Now.Month.ToString & ".txt"
' Try
' Dim enviarCorreoE As Boolean = False
' Dim sbAsunto As New Text.StringBuilder
' Dim sSeguimientoDePila As String = ""
' sbAsunto.AppendFormat("[`{0}`] ", System.Diagnostics.Process.GetCurrentProcess.ProcessName)
' sbAsunto.AppendFormat("{0}: guardando y enviando fichero con nombre `{1}`. ", nombreLog, nombreDelFichero)
' Dim sbMensaje As New Text.StringBuilder
' '// Lo principal: guardar el fichero de texto.
' '// UTF-8 sin BOM y tópalante, que esto lo estoy haciendo rápidamente con propósitos de depuración.
' Dim sRutaFicheroTexto As String = rutaCarpetaTMP & nombreLog & "-" & Today.ToString("yyyy-MM-dd_HH-mm-ss-fff") & "-" & nombreDelFichero
' IO.File.WriteAllText(sRutaFicheroTexto, textoDelFichero)
' '// Decidir si se envía información sobre la excepción
' If Not IsNothing(excepcion) Then
' If Not el Is Nothing Then el.WriteEntry(excepcion.Message & vbCrLf & excepcion.StackTrace, EventLogEntryType.Error)
' sSeguimientoDePila = "Información de la excepción: " & excepcion.ToString & vbCrLf
' Dim exceptionInterna As Exception = excepcion
' Do
' sSeguimientoDePila &= exceptionInterna.StackTrace & vbCrLf
' exceptionInterna = exceptionInterna.InnerException
' Loop Until IsNothing(exceptionInterna)
' End If
' sbMensaje.AppendLine(sbAsunto.ToString)
' sbMensaje.AppendFormat("{0}{0}Descripción: {1}", vbCrLf, descripcion)
' sbMensaje.AppendFormat("{0}{0}Fichero guardado en: `{1}`", vbCrLf, sRutaFicheroTexto)
' sbMensaje.AppendFormat("{0}{0}### Inicio del fichero de texto con nombre `{1}`:{0}```{0}{2}{0}```{0}### Fin del fichero de texto.", vbCrLf, nombreDelFichero, textoDelFichero)
' If Not String.IsNullOrWhiteSpace(sSeguimientoDePila) Then sbAsunto.AppendLine(vbCrLf & "Seguimiento de pila: " & sSeguimientoDePila)
' '// Decidir si se envía correo electrónico
' Select Case Tipo
' Case tsl5.Enumeraciones.TipoLog.Fallo, tsl5.Enumeraciones.TipoLog.Advertencia
' enviarCorreoE = True
' End Select
' '// Forzar envío de correo electrónico
' If forzarEnviarCorreoE OrElse excepcion IsNot Nothing Then enviarCorreoE = True
' If enviarCorreoE Then
' Select Case Tipo
' Case tsl5.Enumeraciones.TipoLog.Fallo
' sFicheroLog = rutaCarpetaLogs & "Errores-" & nombreLog & "-" & Now.Year.ToString & Now.Month.ToString.PadLeft(2, "0") & ".txt"
' sbMensaje.Insert(0, Now.ToLongTimeString & " Error enviado desde [`" & Environment.MachineName & "`]." & vbCrLf)
' Case tsl5.Enumeraciones.TipoLog.Advertencia
' sbMensaje.Insert(0, Now.ToLongTimeString & " Advertencia enviada desde [`" & Environment.MachineName & "`]." & vbCrLf)
' Case tsl5.Enumeraciones.TipoLog.Informacion
' sbMensaje.Insert(0, Now.ToLongTimeString & " Información enviada desde [`" & Environment.MachineName & "`]." & vbCrLf)
' Case tsl5.Enumeraciones.TipoLog.Depuracion
' sbMensaje.Insert(0, Now.ToLongTimeString & " Información de depuración enviada desde [`" & Environment.MachineName & "`]." & vbCrLf)
' End Select
' Dim sDireccionesEnvio As String = "sevilla@tecnosis.net"
' Dim sServidorSMTP As String = "correo.tecnosis.net"
' Dim sRemitente = "logs@tecnosis.es"
' '// Forzar destinatario
' If Not String.IsNullOrWhiteSpace(forzarDestinatario) Then
' sDireccionesEnvio = forzarDestinatario
' End If
' '// Destinatario especial si se está ejecutando en ciertas máquinas.
' If Environment.MachineName.ToUpper.Trim() = "INTI" OrElse Environment.MachineName.ToUpper.Trim() = "CERBERO" Then
' sDireccionesEnvio = "danmun@tecnosis.net"
' sbAsunto.Insert(0, "[`" & Environment.MachineName.ToUpper.Trim & "`] ")
' End If
' 'If nombreDelFichero IsNot Nothing Then nombreDelFichero = nombreDelFichero.Replace(vbCrLf, vbCrLf & "<br />")
' tsl5.Correo.Funciones.EnviaCorreo(sServidorSMTP, sRemitente, sDireccionesEnvio, sbAsunto.ToString.Replace("`", ""), sbMensaje.ToString.Replace("`", ""),,,, "logs@tecnosis.es", "LoGs20i9.")
' End If
' '// Decidir si enviar también por Slack
' If forzarEnviarSlack OrElse Tipo = tsl5.Enumeraciones.TipoLog.Fallo OrElse Tipo = tsl5.Enumeraciones.TipoLog.Advertencia OrElse excepcion IsNot Nothing Then
' Dim destinoSlack = "asegasa"
' If forzarEnviarSlack Then destinoSlack = "Avant2"
' Dim mensajeSlack As New Text.StringBuilder
' mensajeSlack.Append(sbAsunto.ToString)
' If String.IsNullOrWhiteSpace(sbMensaje.ToString) Then
' mensajeSlack.Append(sbAsunto.ToString)
' Else
' mensajeSlack.Append(sbMensaje.ToString)
' End If
' tsl5.Utilidades.EnviarNotificacionSlack(mensajeSlack.ToString, destinatario:=destinoSlack, descripcionRemitente:=Reflection.MethodBase.GetCurrentMethod.ToString)
' End If
' AñadeLogTXT(sbAsunto.ToString, sFicheroLog)
' Catch ex As Exception
' sFicheroLog = rutaCarpetaLogs & "Errores-" & nombreLog & "-" & Now.Year.ToString & Now.Month.ToString.PadLeft(2, "0") & ".txt"
' AñadeLogTXT(ex.Message, sFicheroLog)
' End Try
'End Sub
Public Shared Sub AñadeLogTXT(ByVal Mensaje As String, ByVal FicheroLog As String)
Dim sw As IO.StreamWriter = Nothing
Try
Mensaje = Mensaje.Replace(vbCrLf, "---")
If IO.File.Exists(FicheroLog) Then
sw = IO.File.AppendText(FicheroLog)
Else
Dim directorio = IO.Path.GetDirectoryName(FicheroLog)
If Not IO.Directory.Exists(directorio) Then tsl5.Utilidades.CreaEstructuraDirectorio(directorio)
sw = IO.File.CreateText(FicheroLog)
End If
Mensaje = Now.ToString & "|" & "Ws: " & System.Diagnostics.Process.GetCurrentProcess.WorkingSet64.ToString.PadLeft(20) &
" PMS: " & System.Diagnostics.Process.GetCurrentProcess.PrivateMemorySize64.ToString.PadLeft(20) & "|" & Mensaje
sw.WriteLine(Mensaje)
Catch ex As Exception
Try
Dim sDireccionesEnvio As String = "sevilla@tecnosis.net"
Dim sServidorSMTP As String = "sevilla2.tecnosis.es"
Dim sRemitente = "logs@tecnosis.es"
If Environment.MachineName.StartsWith("INTI") OrElse Environment.MachineName.StartsWith("ANTA") OrElse Environment.MachineName.ToUpper.Trim() = "CERBERO" Then sDireccionesEnvio = "danmun@tecnosis.net"
'If Mensaje IsNot Nothing Then Mensaje = Mensaje.Replace(vbCrLf, vbCrLf & "<br />")
tsl5.Correo.Funciones.EnviaCorreo(sServidorSMTP, sRemitente, sDireccionesEnvio, "Error AñadeLogTXT. " & Mensaje, Environment.MachineName & ".- " & ex.Message & vbCrLf & ex.StackTrace & vbCrLf & ex.Source,,,, "logs@tecnosis.es", "LoGs20i9.")
Catch ex2 As Exception
End Try
Finally
Try
sw.Close()
Catch
End Try
End Try
End Sub
Public Shared CorreoLogsHabilitado As Boolean = True
Public Shared tsNotificacionesHabilitado As Boolean = True
Shared Async Sub GeneraRegistroCorreoExcepcion(ex As Exception, Rutina As String, Optional MostrarMensajeError As Boolean = False, Optional FicheroImagen As Byte() = Nothing, Optional CabeceraAsunto As String = "")
Dim FuerzaCorreo As Boolean = False
Try
Dim sMensaje As String = If(CabeceraAsunto <> "", CabeceraAsunto & " " & vbCrLf, "") & "Usuario: " & bdGestionAsegasa.Utilidades.Usuario & " Versión: " & My.Application.Info.Version.ToString & vbCrLf
Dim sStackTrace As String = "Tipo excepción: " & ex.ToString & vbCrLf
Dim exError As Exception = ex
Do
sStackTrace &= exError.StackTrace & vbCrLf
exError = exError.InnerException
Loop Until IsNothing(exError)
If sStackTrace <> "" Then sMensaje &= vbCrLf & "StackTrace: " & sStackTrace
Dim Titulo As String = "Mensaje Automático. Error en " & Rutina
If tsNotificacionesHabilitado Then
Try
Await EnviaAlertaExcepcion(Titulo, sMensaje, FicheroImagen)
Catch ex1 As Exception
FuerzaCorreo = True
sStackTrace = "Tipo excepción Alerta: " & ex1.ToString & vbCrLf
exError = ex1
Do
sStackTrace &= exError.StackTrace & vbCrLf
exError = exError.InnerException
Loop Until IsNothing(exError)
If sStackTrace <> "" Then sMensaje &= vbCrLf & "StackTrace: " & sStackTrace
End Try
Else
FuerzaCorreo = True
End If
If CorreoLogsHabilitado Or FuerzaCorreo Then
Dim bd = bdGestionAsegasa.gestionasegasaEntities.NuevoContextoCN
Dim cuentaorigen As cuentascorreo = (From c In bd.cuentascorreo Select c Where c.Codigo = "TECNOSIS").First
bdGestionAsegasa.Utilidades.GeneraRegistroCorreo(bd, Titulo, sMensaje, cuentaorigen, "sevilla@tecnosis.net", FicheroImagen,, "ERROR")
End If
Catch ex2 As Exception
AñadeLogTXT(ex2.Message, FicheroLog)
If MostrarMensajeError Then DXMessageBox.Show(ex2.Message & vbCrLf & ex2.StackTrace, "Error Generando Correo Excepcion")
End Try
End Sub
Shared Async Function EnviaAlertaExcepcion(Titulo As String, Mensaje As String, Optional FicheroImagen As Byte() = Nothing) As Task
Try
Await tsl5.TsNotificacionesClient.RegistrarAsync(Titulo, Mensaje, TsNotificacionesClient.TipoNotificacionEnum.ERROR)
Catch Exc As Exception
Throw New Exception(Exc.Message, Exc)
End Try
End Function
'Shared Sub GeneraRegistroCorreoExcepcion(ex As Exception, sAsunto As String, sCuerpo As String, Optional MostrarMensajeError As Boolean = False)
' Try
' Dim bd = bdGestionAsegasa.gestionasegasaEntities.NuevoContextoCN
' Dim sMensaje As String = sCuerpo & vbCrLf & vbCrLf & "Usuario: " & bdGestionAsegasa.Utilidades.Usuario & vbCrLf & vbCrLf
' Dim sStackTrace As String = "Excepción: " & ex.ToString & vbCrLf
' Dim exError As Exception = ex
' Do
' sStackTrace &= exError.StackTrace & vbCrLf & vbCrLf
' exError = exError.InnerException
' Loop Until IsNothing(exError)
' If sStackTrace <> "" Then sMensaje &= vbCrLf & "StackTrace: " & sStackTrace
' Dim cuentaorigen As cuentascorreo = (From c In bd.cuentascorreo Select c Where c.Codigo = "TECNOSIS").First
' Dim bFichero() As Byte = Nothing
' bdGestionAsegasa.Utilidades.GeneraRegistroCorreo(bd, sAsunto, sMensaje, cuentaorigen, "sevilla@tecnosis.net")
' Catch ex2 As Exception
' AñadeLogTXT(ex2.Message, FicheroLog)
' If MostrarMensajeError Then DXMessageBox.Show(ex2.Message & vbCrLf & ex2.StackTrace, "Error Generando Correo Excepcion")
' End Try
'End Sub
'Shared Sub GeneraRegistroCorreoExcepcion(bd As bdGestionAsegasa.gestionasegasaEntities, ex As Exception, sAsunto As String, sCuerpo As String, Optional MostrarMensajeError As Boolean = False, Optional FicheroImagen As Byte() = Nothing)
' Try
' Dim sMensaje As String = sCuerpo & vbCrLf & vbCrLf & "Usuario: " & bdGestionAsegasa.Utilidades.Usuario & vbCrLf & vbCrLf
' Dim sStackTrace As String = "Excepción: " & ex.ToString & vbCrLf
' Dim exError As Exception = ex
' Do
' sStackTrace &= exError.StackTrace & vbCrLf & vbCrLf
' exError = exError.InnerException
' Loop Until IsNothing(exError)
' If sStackTrace <> "" Then sMensaje &= vbCrLf & "StackTrace: " & sStackTrace
' Dim cuentaorigen As cuentascorreo = (From c In bd.cuentascorreo Select c Where c.Codigo = "TECNOSIS").First
' Dim bFichero() As Byte = Nothing
' bdGestionAsegasa.Utilidades.GeneraRegistroCorreo(bd, sAsunto, sMensaje, cuentaorigen, "sevilla@tecnosis.net", FicheroImagen,, "ERROR")
' Catch ex2 As Exception
' AñadeLogTXT(ex2.Message, FicheroLog)
' If MostrarMensajeError Then DXMessageBox.Show(ex2.Message & vbCrLf & ex2.StackTrace, "Error Generando Correo Excepcion")
' End Try
'End Sub
Public Shared Sub GeneraRegistroCorreo(bd As bdGestionAsegasa.gestionasegasaEntities, Asunto As String, Cuerpo As String)
Try
Dim cuentaorigen As cuentascorreo = (From c In bd.cuentascorreo Select c Where c.Codigo = "TECNOSIS").First
Dim sRutaAdjunto As String = ""
Dim correo = New correos With {
.Asunto = Asunto,
.Cuerpo = Cuerpo,
.Destinatario = "sevilla@tecnosis.net",
.DireccionRespuesta = cuentaorigen.Remitente,
.FechaCreacion = bdGestionAsegasa.Utilidades.AhoraMysql(bd),
.idcuenta = cuentaorigen.idCuenta,
.Remitente = cuentaorigen.Remitente
}
If Environment.MachineName.ToUpper = "INTI" OrElse Environment.MachineName.ToUpper.Trim() = "CERBERO" Then correo.Destinatario = "danmun@tecnosis.net"
'// Reemplazar los saltos de línea con <br> porque el correo va en HTML, y si no hacemos esto
'// no habrá saltos de línea dentro del correo.
'If correo.Cuerpo IsNot Nothing Then correo.Cuerpo = correo.Cuerpo.Replace(vbCrLf, vbCrLf & "<br />")
'// Guardar en la bd.
bd.correos.AddObject(correo)
bd.GuardarCambios()
Catch ex As Exception
Debug.Write(ex.Message)
Throw
End Try
End Sub
Public Shared Sub GeneraRegistroCorreo(bd As bdGestionAsegasa.gestionasegasaEntities, Asunto As String, Cuerpo As String, cuenta As cuentascorreo, Destinatario As String, Optional CapturaPantallaError As Byte() = Nothing, Optional idAplicacion As Integer? = Nothing, Optional CodigoAplicacion As String = "")
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,
.idAplicacion = idAplicacion,
.CodigoAplicacion = CodigoAplicacion
}
If CapturaPantallaError IsNot Nothing Then
Dim idtipocapturaerror = bd.enumeraciones.First(Function(x) x.Codigo = "TIPFIC.CAPERROR").idEnumeracion
Dim f As New ficheros
With f
f.NombreFichero = "CapturaPantallaError_" & Now.ToString("yyyyMMddhhmmss") & ".jpg"
f.Fichero = CapturaPantallaError
f.idTipo = idtipocapturaerror
End With
bd.ficheros.AddObject(f)
correo.ficheros = f
End If
If Environment.MachineName.ToUpper = "INTI" OrElse Environment.MachineName.ToUpper.Trim() = "CERBERO" Then Destinatario = "danmun@tecnosis.net"
bd.correos.AddObject(correo)
bd.GuardarCambios()
Catch ex As Exception
Debug.Write(ex.Message)
Throw
End Try
End Sub
Shared Sub GenerarRegistroCorreoAvant2Agente3(bd As bdGestionAsegasa.gestionasegasaEntities, ByRef linea As bdGestionAsegasa.polizassg, ByVal sQuotationID As String, Optional ByVal usuarioAvant2 As String = "")
Try
'// Los destinatarios de estos correos están en la base de datos.
Dim lineasEnumeraciones As List(Of bdGestionAsegasa.enumeraciones) = (From x In bd.enumeraciones Where x.idGrupoEnumeracion = "62" Select x).ToList()
Dim sDireccionRespuesta As String = lineasEnumeraciones.Where(Function(x) x.Codigo = "AVANT2.EMAIL.IP.RESPUESTA").FirstOrDefault.ValorAlfabetico1
Dim sDireccionesDestino As New List(Of String)
For Each le In lineasEnumeraciones
If le.Codigo.StartsWith("AVANT2.EMAIL.IP.DESTINO") Then sDireccionesDestino.Add(le.ValorAlfabetico1)
Next
Dim sbAsuntoEmail As New Text.StringBuilder
Dim sbCuerpoEmail As New Text.StringBuilder
sbAsuntoEmail.Append("Avant2: se procederá a la incorporación de una póliza al agente 3")
sbCuerpoEmail.AppendLine("Avant2: se procederá a la incorporación de una póliza al agente 3.")
sbCuerpoEmail.AppendLine("<br/>")
sbCuerpoEmail.AppendLine("No es posible transferir la póliza a su usuario original porque no se encuentra la información del usuario que la emitió desde Avant2.")
sbCuerpoEmail.AppendLine("<br/>")
sbCuerpoEmail.AppendLine("Hay que revisar que el usuario de Avant2 que realizó la emisión de esta póliza esté correctamente identificado en la aplicación Gestión Asegasa: hay que revisar el campo ""Usuario Avant"" en la ficha del agente o subagente y que no esté de baja.")
sbCuerpoEmail.AppendLine("<br/>")
sbCuerpoEmail.AppendLine("Datos de la póliza importada al agente 3:")
sbCuerpoEmail.AppendLine("<br/>")
sbCuerpoEmail.AppendLine(String.Format("quotationID: {0} <br/>", sQuotationID))
Try
sbCuerpoEmail.AppendLine(String.Format("Nº de póliza: {0} <br/>", linea.NumeroPoliza))
Catch ex As Exception
'Nada, a propósito.
End Try
Try
sbCuerpoEmail.AppendLine(String.Format("Compañía: {0} <br/>", linea.companias.Nombre))
Catch ex As Exception
'Nada, a propósito.
End Try
Try
sbCuerpoEmail.AppendLine(String.Format("Ramo: {0} <br/>", linea.ramos.Descripcion))
Catch ex As Exception
'Nada, a propósito.
End Try
Try
sbCuerpoEmail.AppendLine(String.Format("CIF del tomador: {0} <br/>", linea.Tomador.CIF))
Catch ex As Exception
'Nada, a propósito.
End Try
Try
sbCuerpoEmail.AppendLine(String.Format("Nombre del tomador: {0} <br/>", (linea.Tomador.Nombre & " " & linea.Tomador.Apellidos).Trim))
Catch ex As Exception
'Nada, a propósito.
End Try
Try
sbCuerpoEmail.AppendLine(String.Format("Fecha de efecto: {0} <br/>", linea.FechaEfecto))
Catch ex As Exception
'Nada, a propósito.
End Try
Try
If Not String.IsNullOrWhiteSpace(usuarioAvant2) Then
sbCuerpoEmail.AppendLine(String.Format("Identificador del usuario de Avant 2 que realizó el alta: {0} <br/>", (usuarioAvant2).Trim))
End If
Catch ex As Exception
'Nada, a propósito.
End Try
sbCuerpoEmail.AppendLine("<br/>")
sbCuerpoEmail.AppendLine("Fin del correo electrónico.")
Dim cuentaorigen As cuentascorreo = (From c In bd.cuentascorreo Select c Where c.Codigo = "TECNOSIS").First
For Each destinatario In sDireccionesDestino
bdGestionAsegasa.Utilidades.GeneraRegistroCorreo(bd, sbAsuntoEmail.ToString, sbCuerpoEmail.ToString, cuentaorigen, destinatario)
Next
Catch ex2 As Exception
AñadeLogTXT(ex2.Message, FicheroLog)
End Try
End Sub
Shared Sub GenerarRegistroCorreoAvant2IncorporacionParcial(bd As bdGestionAsegasa.gestionasegasaEntities, ByRef linea As bdGestionAsegasa.polizassg, ByVal sQuotationID As String)
Try
'// Los destinatarios de estos correos están en la base de datos.
Dim lineasEnumeraciones As List(Of bdGestionAsegasa.enumeraciones) = (From x In bd.enumeraciones Where x.idGrupoEnumeracion = "62" Select x).ToList()
Dim sDireccionRespuesta As String = lineasEnumeraciones.Where(Function(x) x.Codigo = "AVANT2.EMAIL.IP.RESPUESTA").FirstOrDefault.ValorAlfabetico1
Dim sDireccionesDestino As New List(Of String)
For Each le In lineasEnumeraciones
If le.Codigo.StartsWith("AVANT2.EMAIL.IP.DESTINO") Then sDireccionesDestino.Add(le.ValorAlfabetico1)
Next
Dim sbAsuntoEmail As New Text.StringBuilder
Dim sbCuerpoEmail As New Text.StringBuilder
sbAsuntoEmail.AppendFormat("Avant2: incorporación parcial de poliza nº {0}, {1}", linea.NumeroPoliza, linea.ramos.Descripcion)
sbCuerpoEmail.AppendLine("Avant2, incorporación parcial de póliza.")
sbCuerpoEmail.AppendLine("")
sbCuerpoEmail.AppendLine("Esto es una incorporación parcial. Avant2 de Codeoscopic no proporciona varios datos de la póliza. Estos campos no proporcionados podrían venir vacios, con los símbolos ~~, con el número -1 o con la fecha 1970/01/01.")
sbCuerpoEmail.AppendLine("")
sbCuerpoEmail.AppendLine(String.Format("quotationID: {0}", sQuotationID))
Try
sbCuerpoEmail.AppendLine(String.Format("Numero de póliza: {0}", linea.NumeroPoliza))
Catch ex As Exception
'Nada, a propósito.
End Try
Try
sbCuerpoEmail.AppendLine(String.Format("Compañía: {0}", linea.companias.Nombre))
Catch ex As Exception
'Nada, a propósito.
End Try
Try
sbCuerpoEmail.AppendLine(String.Format("Ramo: {0}", linea.ramos.Descripcion))
Catch ex As Exception
'Nada, a propósito.
End Try
Try
sbCuerpoEmail.AppendLine(String.Format("CIF del tomador: {0}", linea.Tomador.CIF))
Catch ex As Exception
'Nada, a propósito.
End Try
Try
sbCuerpoEmail.AppendLine(String.Format("Nombre del tomador: {0}", (linea.Tomador.Nombre & " " & linea.Tomador.Apellidos).Trim))
Catch ex As Exception
'Nada, a propósito.
End Try
Try
sbCuerpoEmail.AppendLine(String.Format("Fecha de efecto: {0}", linea.FechaEfecto))
Catch ex As Exception
'Nada, a propósito.
End Try
sbCuerpoEmail.AppendLine("")
sbCuerpoEmail.AppendLine("Fin del correo electronico.")
Dim cuentaorigen As cuentascorreo = (From c In bd.cuentascorreo Select c Where c.Codigo = "TECNOSIS").First
For Each destinatario In sDireccionesDestino
bdGestionAsegasa.Utilidades.GeneraRegistroCorreo(bd, sbAsuntoEmail.ToString, sbCuerpoEmail.ToString, cuentaorigen, destinatario)
Next
Catch ex2 As Exception
AñadeLogTXT(ex2.Message, FicheroLog)
End Try
End Sub
Public Shared Function ObtienePermisos(bd As bdGestionAsegasa.gestionasegasaEntities, idPermiso As Nullable(Of Integer), idUsuario As Integer) As tsWPF.Permisos
Dim per As New tsWPF.Permisos
If (From u In bd.usuarios Select u Where u.idUsuario = idUsuario).First.gruposusuarios.Descripcion = "TECNOSIS" Then
per.Consultar = True
per.Eliminar = True
per.Nuevos = True
per.Otros = True
per.Modificar = True
per.Impresion = True
per.Exportar = True
Else
If idPermiso Is Nothing Then
per.Consultar = False
per.Eliminar = False
per.Nuevos = False
per.Otros = False
per.Modificar = False
per.Impresion = False
per.Exportar = False
Else
Dim au = (From a In bd.autorizacionesusuarios Select a Where a.permisos.idPermiso = idPermiso And a.idUsuario = idUsuario)
If au.Count = 0 Then
Dim idGrupo As Integer = (From u In bd.usuarios Select u Where u.idUsuario = idUsuario).First.idGrupo
Dim ag = (From g In bd.autorizacionesgrupos Select g Where g.permisos.idPermiso = idPermiso And g.idGrupo = idGrupo)
If ag.Count = 0 Then
per.Consultar = False
per.Eliminar = False
per.Nuevos = False
per.Otros = False
per.Modificar = False
per.Impresion = False
per.Exportar = False
Else
per.Consultar = ag.First.PermitirConsultas
per.Eliminar = ag.First.PermitirEliminaciones
per.Nuevos = ag.First.PermitirNuevos
per.Otros = ag.First.OtrosPermisos
per.Modificar = ag.First.PermitirModificaciones
per.Impresion = ag.First.PermitirImpresiones
per.Exportar = ag.First.PermitirExportar
End If
Else
per.Consultar = au.First.PermitirConsultas
per.Eliminar = au.First.PermitirEliminaciones
per.Nuevos = au.First.PermitirNuevos
per.Otros = au.First.OtrosPermisos
per.Modificar = au.First.PermitirModificaciones
per.Impresion = au.First.PermitirImpresiones
per.Exportar = au.First.PermitirExportar
End If
End If
End If
Return per
End Function
Public Shared Function ObtienePermisos(bd As bdGestionAsegasa.gestionasegasaEntities, Codigo As String, idUsuario As Integer) As tsWPF.Permisos
Try
Dim per As New tsWPF.Permisos
If bd.usuarios.First(Function(x) x.idUsuario = idUsuario).gruposusuarios.Descripcion = "TECNOSIS" Then
per.Consultar = True
per.Eliminar = True
per.Nuevos = True
per.Otros = True
per.Modificar = True
per.Impresion = True
per.Exportar = True
Else
Dim au = (From a In bd.autorizacionesusuarios Select a Where a.permisos.CodigoPermiso = Codigo And a.idUsuario = idUsuario)
If au.Count = 0 Then
Dim idGrupo As Integer = (From u In bd.usuarios Select u Where u.idUsuario = idUsuario).First.idGrupo
Dim ag = (From g In bd.autorizacionesgrupos Select g Where g.permisos.CodigoPermiso = Codigo And g.idGrupo = idGrupo)
If ag.Count = 0 Then
per.Consultar = False
per.Eliminar = False
per.Nuevos = False
per.Otros = False
per.Modificar = False
per.Impresion = False
per.Exportar = False
Else
per.Consultar = ag.First.PermitirConsultas
per.Eliminar = ag.First.PermitirEliminaciones
per.Nuevos = ag.First.PermitirNuevos
per.Otros = ag.First.OtrosPermisos
per.Modificar = ag.First.PermitirModificaciones
per.Impresion = ag.First.PermitirImpresiones
per.Exportar = ag.First.PermitirExportar
End If
Else
per.Consultar = au.First.PermitirConsultas
per.Eliminar = au.First.PermitirEliminaciones
per.Nuevos = au.First.PermitirNuevos
per.Otros = au.First.OtrosPermisos
per.Modificar = au.First.PermitirModificaciones
per.Impresion = au.First.PermitirImpresiones
per.Exportar = au.First.PermitirExportar
End If
End If
Return per
Catch ex As Exception
Throw New Exception(ex.Message, ex)
End Try
End Function
Public Shared Function ObtenerNumeroDePolizaDisponibleTractoresAXA(ByVal bd As bdGestionAsegasa.gestionasegasaEntities, Optional ByVal n As UInteger = 0) As String
Dim resultado As String = ""
Dim inicio As bdGestionAsegasa.enumeraciones
Dim fin As bdGestionAsegasa.enumeraciones
Dim actual As UInteger = 0
Dim bEncontrado As Boolean = False
Dim enumNumeracion = (From x In bd.enumeraciones Where x.Codigo.StartsWith("AXATRACTORES.numeracion.") AndAlso x.ValorAlfabetico1.ToUpper.Trim = "DISPONIBLE"
Order By x.Codigo Select x).ToList()
Dim idRamoTractores As String = (From x In bd.ramos Where x.Codigo = "1-1" Select x.idRamo).FirstOrDefault
Dim idRamoRemolques As String = (From x In bd.ramos Where x.Codigo = "1-1-1" Select x.idRamo).FirstOrDefault
' De todos los posibles rangos, tengo que elegir el más bajo que esté disponible.
' Como lo he ordenado por Codigo, al hacerlo así ya estoy eligiendo el más bajo disponible.
' Con rango más bajo me refiero al valor que está dentro del código, no a los números del rango en sí.
' Formato del código: "AXATRACTORES.numeracion.0000"
inicio = enumNumeracion.Where(Function(x) x.Codigo.EndsWith(".inicio")).FirstOrDefault
fin = enumNumeracion.Where(Function(x) x.Codigo.EndsWith(".fin")).FirstOrDefault
Try
If n = 0 Then
actual = (From x In bd.polizassg Where x.NumeroPoliza >= inicio.ValorNumerico1 AndAlso x.NumeroPoliza <= fin.ValorNumerico1 AndAlso
(x.idRamo = idRamoTractores OrElse x.idRamo = idRamoRemolques)
Order By x.NumeroPoliza Descending
Select x.NumeroPoliza Take 10).ToList().FirstOrDefault
Else
actual = n
End If
Catch ex As Exception
' Nada, significa que aún no existe el primero.
End Try
If actual = 0 Then
' Si "actual" vale 0 significa que es la primera vez y tenemos que usar el primero del rango.
resultado = inicio.ValorNumerico1
bEncontrado = True
Else
If actual < inicio.ValorNumerico1 Then
resultado = inicio.ValorNumerico1
bEncontrado = True
ElseIf actual = fin.ValorNumerico1 Then
' Caso en el que hay que pasar a usar el siguiente rango.
' Hay que marcar el actual rango como completado.
inicio.ValorAlfabetico1 = "Usado"
fin.ValorAlfabetico1 = "Usado"
bd.GuardarCambios()
resultado = ObtenerNumeroDePolizaDisponibleTractoresAXA(bd)
' Sí, esta es una función recursiva. Está comprobado que esta recursividad funciona adecuadamente según los datos que haya en la base de datos.
ElseIf actual > fin.ValorNumerico1 Then 'El número final sí lo podemos usar, por eso la comparación se hace con ">".
resultado = -1 'Significa que ya hemos llegado al límite de asignaciones, no podemos asignar más.
bEncontrado = True
' TODO: Mirar si hay otro rango más?
Dim asunto As String = "TractoresAXA: Se han acabado los nºs de pólizas reservados para el servicio de TractoresAXA. Todas las altas que se realicen a partir de ahora fallarán hasta que se asignen nuevos rangos."
Dim cuerpo As String = asunto & vbCrLf & " Hay que avisar a ASEGASA para que gestionen con AXA la asignación de un nuevo rango de nºs de pólizas para este servicio." & vbCrLf &
"En método `" & System.Reflection.MethodBase.GetCurrentMethod.ToString & "`. " _
& vbCrLf & Environment.MachineName
Call AñadeLog(tsl5.Enumeraciones.TipoLog.Fallo, asunto, cuerpo)
tsl5.Utilidades.EnviarNotificacionSlack(asunto, destinatario:="#asegasa", descripcionRemitente:=Reflection.MethodBase.GetCurrentMethod.ToString)
Else
' Caso normal, en el que hay que usar el número que sigue, porque seguimos dentro del rango.
'
' Pero tengo que comprobar que "actual + 1" no esté usado. ¿Cómo lo hago? Bueno, sería mucha
' casualidad y mucha mala suerte que dos altas coincidan en el tiempo de tal modo que ambas
' pillen el mismo nº de poliza.
resultado = actual + 1
bEncontrado = True
End If
End If
' TODO: danmun: Lanzar aquí mensajes cuando falten 500, 200, 100, 50, 20, 10, avisando.
'If bEncontrado Then
' Dim numerosReservadosDisponibles As Integer = ComprobarCuantosNumerosReservadosQuedanDisponibles(actual, inicio, fin)
' Dim listaDeLimitesParaEnviarAdvertencias As Integer() = {10, 20, 50, 100, 200, 500}
' Dim bAdvertenciaEnviada As Boolean = False
' ' La idea es la siguiente: dispongo de un array donde tenemos los límites en los que hay que lanzar la advertencia
' ' de que se están gastando los nºs de pólizas reservados para TractoresAXA. El array está ordenado de menor a mayor.
' ' Al recorrer el array, compruebo: ¿quedan menos de 10 números disponibles? Si es así, lanzo advertencia y ya no vuelvo
' ' a realizar más comprobaciones. Si no es así, compruebo con el siguiente límite, que sería 20. Por lo tanto, es posible
' ' completar el recorrido del array sin enviar ninguna advertencia o bien enviando solamente 1.
' For Each i In listaDeLimitesParaEnviarAdvertencias
' If Not bAdvertenciaEnviada AndAlso numerosReservadosDisponibles < i Then
' ' Notificación Slack
' Try
' Dim asunto As String = String.Format("TractoresAXA: quedan menos de {0} nºs de póliza reservados sin usar.", i)
' Dim sbCuerpo As New Text.StringBuilder()
' sbCuerpo.AppendFormat("*TractoresAXA*: quedan menos de {1} nºs de póliza reservados sin usar.{0}", vbCrLf, i)
' sbCuerpo.AppendLine("Es recomendable avisar a ASEGASA para que gestionen con AXA la asignación de un nuevo rango de nºs de pólizas para este servicio.")
' sbCuerpo.AppendFormat("```Próximo nº de póliza que va a ser usado de inmediato: {1}{0}Primer nº del rango actual:{2}{0}Último nº del rango actual: {3}{0}Servidor: {4}```{0}", vbCrLf,
' resultado, inicio.ValorNumerico1, fin.ValorNumerico1, Environment.MachineName)
' sbCuerpo.AppendFormat("En método `{0}` y en máquina `{1}`.", System.Reflection.MethodBase.GetCurrentMethod.ToString, Environment.MachineName)
' Call AñadeLog(tsl5.Enumeraciones.TipoLog.Advertencia, asunto, sbCuerpo.ToString)
' tsl5.Utilidades.EnviarNotificacionSlack(sbCuerpo.ToString, destinatario:="#asegasa", descripcionRemitente:=Reflection.MethodBase.GetCurrentMethod.ToString)
' Catch ex As Exception
' ' Si esta notificación da error no debe pararse el servicio, así que no hago nada.
' End Try
' bAdvertenciaEnviada = True
' End If
' Next
'End If
Return resultado
End Function
End Class

View File

@@ -0,0 +1,132 @@
Public Class CarteraPerdida
Public Shared Function GeneraExcelCarteraPerdidaEF(fi As Date, ff As Date) As Byte()
Try
Dim bd = bdGestionAsegasa.gestionasegasaEntities.NuevoContextoCN
Dim fai = fi.AddYears(-1)
Dim faf = ff.AddYears(-1)
' Dim idTippcia = bd.enumeraciones.First(Function(x) x.Codigo = "TIPP.CIA").idEnumeracion
Dim idLiquidacion = bd.enumeraciones.First(Function(x) x.Codigo = "TIPLIQ.LIQUIDACION").idEnumeracion
Dim idLiquidacioncia = bd.enumeraciones.First(Function(x) x.Codigo = "TIPLIQ.PGDO.CIA").idEnumeracion
Dim iddevuelto = bd.enumeraciones.First(Function(x) x.Codigo = "TIPLIQ.DEVUELTO").idEnumeracion
Dim idDescobro = bd.enumeraciones.First(Function(x) x.Codigo = "TIPLIQ.DESCOBRO").idEnumeracion
Dim idCabaPGO = bd.enumeraciones.First(Function(x) x.Codigo = "CABA.PGO").idEnumeracion
Dim idCabaFP = bd.enumeraciones.First(Function(x) x.Codigo = "CABA.FP").idEnumeracion
Dim idTrex = bd.enumeraciones.First(Function(x) x.Codigo = "TRC.EX").idEnumeracion
Dim idTrcx = bd.enumeraciones.First(Function(x) x.Codigo = "TRC.CX").idEnumeracion
Dim idDuru = bd.enumeraciones.First(Function(x) x.Codigo = "DUR.U").idEnumeracion
' Dim idDura = bd.enumeraciones.First(Function(x) x.Codigo = "DUR.A").idEnumeracion
' Dim cabas = bd.enumeraciones.Where(Function(x) x.Codigo = "CABA.AGEN" Or x.Codigo = "CABA.CIA" Or x.Codigo = "CABA.SIN" Or x.Codigo = "CABA.ASEG" Or x.Codigo = "CABA.VTA" Or x.Codigo = "CABA.BJA" Or x.Codigo = "CABA.ASFP" Or x.Codigo = "CABA.RPZO" Or x.Codigo = "CABA.SUPL").Select(Function(x) x.idEnumeracion).ToArray
Dim lr As New List(Of ReciboCarteraPerdida)
Dim ps = bd.polizassg.Select(Function(x) New With {.idpoliza = x.idPoliza, .idDuracion = x.idDuracion, .idCausaBaja = x.idCausaBaja, .FechaBaja = x.FechaBaja, .NumeroPoliza = x.NumeroPoliza, .idCompania = x.idCompania, .NumeroSuplemento = x.NumeroSuplemento, .FechaVencimiento = x.FechaVencimiento}).ToList
' Dim POLS = (From p In ps Where p.NumeroPoliza IsNot Nothing Group By PolizaCia = New With {Key p.NumeroPoliza, Key p.idCompania} Into Gr = Group).Select(Function(x) x.Gr.OrderByDescending(Function(Y) Y.NumeroSuplemento).FirstOrDefault).Where(Function(X) X.FechaBaja.HasValue = False OrElse (X.idDuracion <> idDura And X.idCausaBaja.HasValue AndAlso X.idCausaBaja = idCabaFP) OrElse (X.idCausaBaja.HasValue AndAlso cabas.Contains(X.idCausaBaja) = False)).ToList
Dim POLS = (From p In ps Where p.NumeroPoliza IsNot Nothing Group By PolizaCia = New With {Key p.NumeroPoliza, Key p.idCompania} Into Gr = Group).Select(Function(x) x.Gr.OrderByDescending(Function(Y) Y.NumeroSuplemento).FirstOrDefault).Where(Function(X) X.FechaBaja.HasValue = False OrElse (X.idCausaBaja.HasValue AndAlso X.idCausaBaja = idCabaFP)).ToList
Dim recsex = bd.vf_recibosextendidos.Where(Function(x) x.FechaEfecto >= fai And x.FechaEfecto <= faf And x.idTipo <> idTrex And x.idTipo <> idTrcx And x.idDuracion <> idDuru).Select(Function(x) New With {.idRecibo = x.idRecibo, .Tomador = x.Tomador}).ToList
Dim recsant = bd.recibos.Where(Function(x) x.FechaEfecto >= fai And x.FechaEfecto <= faf And x.idTipo <> idTrex And x.idTipo <> idTrcx And x.polizassg.idDuracion <> idDuru _
And (x.liquidacionescompaniasrecibos.Any(Function(y) y.liquidacionescompanias.idTipoLiquidacion = idLiquidacion Or y.liquidacionescompanias.idTipoLiquidacion = idLiquidacioncia) _
Or (x.liquidacionescompaniasrecibos.Any(Function(y) y.liquidacionescompanias.idTipoLiquidacion = iddevuelto And x.idCausaBaja = idCabaPGO)))) _
.Select(Function(x) New ReciboCarteraPerdida With {.NumeroPoliza = x.polizassg.NumeroPoliza,
.idRecibo = x.idRecibo,
.idCompañia = x.polizassg.idCompania,
.Compañía = x.polizassg.companias.Nombre,
.Ramo = x.polizassg.ramos.Descripcion,
.FechaEfecto = x.FechaEfecto,
.Observaciones = x.polizassg.Observaciones}).ToList
Dim recs = bd.recibos.Where(Function(x) x.FechaEfecto >= fi And x.FechaEfecto <= ff And x.TotalRecibo > 0 And x.polizassg.idDuracion <> idDuru).Select(Function(x) New ReciboCarteraPerdida With {.NumeroPoliza = x.polizassg.NumeroPoliza,
.idRecibo = x.idRecibo,
.idCompañia = x.polizassg.idCompania,
.Compañía = x.polizassg.companias.Nombre,
.Ramo = x.polizassg.ramos.Descripcion,
.FechaEfecto = x.FechaEfecto,
.Observaciones = x.polizassg.Observaciones}).ToList
Dim flim = Today.AddYears(-1)
For Each r In recsant
If lr.Any(Function(X) X.NumeroPoliza = r.NumeroPoliza And X.idCompañia = r.idCompañia) = False AndAlso recs.Any(Function(x) x.NumeroPoliza = r.NumeroPoliza And x.idCompañia = r.idCompañia) = False AndAlso POLS.Any(Function(x) x.NumeroPoliza = r.NumeroPoliza And x.idCompania = r.idCompañia And Not (x.idDuracion = idDuru And x.FechaVencimiento < flim)) Then
r.Tomador = recsex.First(Function(x) x.idRecibo = r.idRecibo).Tomador
lr.Add(r)
End If
Next
If lr.Count > 0 Then
Dim lrd = lr.OrderBy(Function(x) x.Compañía).ThenBy(Function(x) x.Ramo).Select(Function(x) New With {x.NumeroPoliza, x.Compañía, x.Ramo, x.Tomador, .FechaEfectoUltimoRecibo = x.FechaEfecto, .Observaciones = x.Observaciones}).ToList
Dim b = tsWPF.Utilidades.Varias.IEnumerableAExcel(lrd)
Return b
Else
Return Nothing
End If
Catch ex As Exception
Throw New Exception(ex.Message, ex)
End Try
End Function
Public Shared Function GeneraExcelCarteraPerdida(fi As Date) As Byte()
Try
Dim bd = bdGestionAsegasa.gestionasegasaEntities.NuevoContextoCN
Dim idLiquidacion = bd.enumeraciones.First(Function(x) x.Codigo = "TIPLIQ.LIQUIDACION").idEnumeracion
Dim idLiquidacioncia = bd.enumeraciones.First(Function(x) x.Codigo = "TIPLIQ.PGDO.CIA").idEnumeracion
Dim iddevuelto = bd.enumeraciones.First(Function(x) x.Codigo = "TIPLIQ.DEVUELTO").idEnumeracion
Dim idDescobro = bd.enumeraciones.First(Function(x) x.Codigo = "TIPLIQ.DESCOBRO").idEnumeracion
Dim idTrex = bd.enumeraciones.First(Function(x) x.Codigo = "TRC.EX").idEnumeracion
Dim idTrcx = bd.enumeraciones.First(Function(x) x.Codigo = "TRC.CX").idEnumeracion
Dim idDuru = bd.enumeraciones.First(Function(x) x.Codigo = "DUR.U").idEnumeracion
Dim lr As New List(Of ReciboCarteraPerdida)
Dim ps = bd.polizassg.Select(Function(x) New With {.idpoliza = x.idPoliza, .idDuracion = x.idDuracion, .idCausaBaja = x.idCausaBaja, .FechaBaja = x.FechaBaja, .NumeroPoliza = x.NumeroPoliza, .idCompania = x.idCompania, .NumeroSuplemento = x.NumeroSuplemento, .FechaVencimiento = x.FechaVencimiento}).ToList
Dim POLS = (From p In ps Where p.NumeroPoliza IsNot Nothing Group By PolizaCia = New With {Key p.NumeroPoliza, Key p.idCompania} Into Gr = Group).Select(Function(x) x.Gr.OrderByDescending(Function(Y) Y.NumeroSuplemento).FirstOrDefault).Where(Function(X) X.FechaBaja.HasValue = False).ToList
Dim recsex = bd.vf_recibosextendidos.Where(Function(x) x.FechaEfecto >= fi And x.idTipo <> idTrex And x.idTipo <> idTrcx And x.idDuracion <> idDuru).Select(Function(x) New With {.idRecibo = x.idRecibo, .Tomador = x.Tomador, .NumeroPoliza = x.NumeroPoliza, .idCompania = x.idCompania, .FechaVencimiento = x.FechaVencimiento}).ToList
Dim recsant = bd.recibos.Where(Function(x) x.FechaEfecto >= fi And x.FechaVencimiento <= Today And x.idTipo <> idTrex And x.idTipo <> idTrcx And x.polizassg.idDuracion <> idDuru) _
.Select(Function(x) New ReciboCarteraPerdida With {.NumeroPoliza = x.polizassg.NumeroPoliza,
.idRecibo = x.idRecibo,
.idCompañia = x.polizassg.idCompania,
.Compañía = x.polizassg.companias.Nombre,
.Ramo = x.polizassg.ramos.Descripcion,
.FechaEfecto = x.FechaEfecto,
.FechaVencimiento = x.FechaVencimiento,
.Observaciones = x.polizassg.Observaciones}).ToList
Dim DentroUnMes As Date = fi.AddMonths(13)
Dim recs = bd.recibos.Where(Function(x) x.FechaVencimiento >= DentroUnMes And x.TotalRecibo > 0 And x.polizassg.idDuracion <> idDuru).Select(Function(x) New ReciboCarteraPerdida With {.NumeroPoliza = x.polizassg.NumeroPoliza,
.idRecibo = x.idRecibo,
.idCompañia = x.polizassg.idCompania,
.Compañía = x.polizassg.companias.Nombre,
.Ramo = x.polizassg.ramos.Descripcion,
.FechaEfecto = x.FechaEfecto,
.Observaciones = x.polizassg.Observaciones}).ToList
Dim flimduru = fi.AddYears(-1)
For Each r In recsant
If lr.Any(Function(X) X.NumeroPoliza = r.NumeroPoliza And X.idCompañia = r.idCompañia) = False AndAlso recs.Any(Function(x) x.NumeroPoliza = r.NumeroPoliza And x.idCompañia = r.idCompañia) = False AndAlso POLS.Any(Function(x) x.NumeroPoliza = r.NumeroPoliza And x.idCompania = r.idCompañia And Not (x.idDuracion = idDuru And x.FechaVencimiento < flimduru)) Then
If recsex.Any(Function(x) x.NumeroPoliza = r.NumeroPoliza AndAlso x.idCompania = r.idCompañia AndAlso x.idRecibo <> r.idRecibo AndAlso x.FechaVencimiento > r.fechaVencimiento) = False Then
r.Tomador = recsex.First(Function(x) x.idRecibo = r.idRecibo).Tomador
lr.Add(r)
End If
End If
Next
If lr.Count > 0 Then
Dim lrd = lr.OrderBy(Function(x) x.Compañía).ThenBy(Function(x) x.Ramo).Select(Function(x) New With {x.NumeroPoliza, x.Compañía, x.Ramo, x.Tomador, .FechaEfectoUltimoRecibo = x.FechaEfecto, .Observaciones = x.Observaciones}).ToList
Dim b = tsWPF.Utilidades.Varias.IEnumerableAExcel(lrd)
Return b
Else
Return Nothing
End If
Catch ex As Exception
Throw New Exception(ex.Message, ex)
End Try
End Function
Private Class ReciboCarteraPerdida
Public Property idRecibo As String
Public Property NumeroPoliza As String
Public Property idCompañia As Integer
Public Property Compañía As String
Public Property Ramo As String
Public Property Tomador As String
Public Property FechaEfecto As Date
Public Property FechaVencimiento As Date
Public Property Observaciones As String
End Class
End Class

View File

@@ -0,0 +1,40 @@
Public Class CartillaSeguroGenerales
Property Rso As String
Property Cif As String
Property PolizasEntidad As List(Of PolizaGeneral)
Property NumDePolizas As Integer
Property TotalPagados As Double
Property TotalAnulados As Double
Property TotalCia As Double
Property TotalPendiente As Double
Property Cia As String
End Class
Public Class SiniestroGeneral
Property IdSiniestro As Integer
Property RefCompania As String
Property DescripcionSiniestro As String
Property DanoCliente As String
Property DanoContrario As String
Property Culpabilidad As String
Property FechaSiniestro As String
End Class
Public Class PolizaGeneral
Property NumeroPoliza As String
Property Ramo As String
Property Compañia As String
Property RecibosPolizas As List(Of ReciboPoliza)
Property SiniestrosEntidad As List(Of SiniestroGeneral)
End Class
Public Class ReciboPoliza
Property FechaEfecto As Date
Property FechaVencimiento As Date?
Property Importe As Double
Property Matricula As String
Property Duracion As String
Property TipoPago As String
Property FechaPago As String
Property CausaBaja As String
Property FechaBaja As String
Property BienesAsegurados As String
End Class

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,14 @@
Public Class CombinacionCorrespondenciaPagosTelematicos
Property NumeroOperacion As String
Property FechaOperacion As String
Property Importe As String
Property Referencia As String
Property RazonSocial As String
Property DNI As String
End Class

View File

@@ -0,0 +1,36 @@
Public Class DetallesPoliza
Property NumeroPropuesta As String
Property Compania As String
Property NumeroPoliza As String
Property NumeroSuplemento As String
Property FechaEnvioCompania As String
Property FechaRecibidoCompania As String
Property Duracion As String
Property FechaEfecto As String
Property FechaVencimiento As String
Property FechaBaja As String
Property CausaBaja As String
Property Ramo As String
Property Agente As String
Property SubAgente As String
Property BienesAsegurados As String
Property Matricula As String
Property Coberturas As String
Property Garantias As String
Property DescripcionSumplemento As String
Property FechaAceptacionPropuesta As String
Property SuplementoRechazdoPorCompania As String
Property Observaciones As String
Property Usuario As String
Property FechaAlta As String
Property TipoPago As String
Property IBAN As String
Property FechaMandato As String
Property TipoCobro As String
Property Directorio As String
Property Tomador As List(Of entidades)
Property OtroAsegurado As List(Of entidades)
End Class

View File

@@ -0,0 +1,20 @@
Public Class DifPolSup
Property Compania As String
Property TomadorActual As String
Property NumPoliza As String
Property NumPropuesta As String
Property Ramo As String
Property Matricula As String
Property NumSuplemento As String
Property ModEnPoliza As List(Of Modificacion)
Property ModEnAsegurados As List(Of Modificacion)
Property Aclaracion1 As String
Property Aclaracion2 As String
End Class
Public Class Modificacion
Property Concepto As String
Property ValorNuevo As String
End Class

66
guia/informes/Informes.vb Normal file
View File

@@ -0,0 +1,66 @@
Imports DevExpress.XtraReports.UI
Imports DevExpress.Xpf.Printing
Imports System.Data.Objects
Imports System.IO
Public Class Informes
Public Shared Sub ImprimeInforme(xr As XtraReport, Datos As Object, ImpresoraPredeterminada As Boolean)
For Each pr In xr.Parameters
pr.Visible = False
Next
xr.DataSource = Datos
xr.CreateDocument(True)
If ImpresoraPredeterminada Then
xr.Print()
Else
xr.PrintDialog()
End If
End Sub
Public Shared Function GeneraXLSX(xr As XtraReport, Datos As Object) As IO.MemoryStream
Dim ms As New IO.MemoryStream
For Each pr In xr.Parameters
pr.Visible = False
Next
xr.DataSource = Datos
xr.CreateDocument(True)
xr.ExportToXlsx(ms)
Return ms
End Function
Public Shared Function GeneraPDF(bd As bdGestionAsegasa.gestionasegasaEntities, idPlantilla As Integer, Datasource As Object) As MemoryStream
Try
If idPlantilla = 0 Then Throw New Exception("Seleccione primero la plantilla a imprimir")
Dim xr As New XtraReport
Dim qr As ObjectQuery(Of plantillas) = bd.plantillas
qr.MergeOption = MergeOption.OverwriteChanges
Dim pl = qr.Where(Function(x) x.idPlantilla = idPlantilla).First
Dim s As String = System.Text.Encoding.UTF8.GetString(pl.ficheros.Fichero)
Using sw As New StreamWriter(New MemoryStream())
sw.Write(s)
sw.Flush()
xr = XtraReport.FromStream(sw.BaseStream, True)
End Using
Try
Dim pr As DevExpress.XtraReports.Parameters.Parameter = (From p As DevExpress.XtraReports.Parameters.Parameter In xr.Parameters Where p.Name = "Fecha").First
pr.Value = bdGestionAsegasa.Utilidades.AhoraMysql(bd)
pr.Visible = False
Catch
End Try
xr.DataSource = Datasource
xr.CreateDocument(True)
Dim ms As New IO.MemoryStream
xr.ExportToPdf(ms)
Return ms
Catch ex As Exception
Throw New Exception(ex.Message, ex)
End Try
End Function
End Class

View File

@@ -0,0 +1,19 @@
Public Class InformesAgrarios
Property DatosLineas As List(Of LinInformesAgrarios)
End Class
Public Class LinInformesAgrarios
Property CodLinea As String
Property GruLinea As String
Property DesLinea As String
Property Compania As String
Property NumPolizas As Integer
Property PrimaNetaCalculo As Double
Property ComAsegasa As Double
Property ComAgentes As Double
Property ComAsegasaPrev As Double
Property ComAgentesPrev As Double
Property TotComCob As Double
Property TotComPrev As Double
End Class

View File

@@ -0,0 +1,234 @@
<Serializable>
Public Class AccidentesIndividualesAXA
Private _tomadorCIF As String
Public Property TomadorCIF() As String
Get
Return _tomadorCIF
End Get
Set(ByVal value As String)
_tomadorCIF = value
End Set
End Property
Private _tomadorNombre As String
Public Property TomadorNombre() As String
Get
Return _tomadorNombre
End Get
Set(ByVal value As String)
_tomadorNombre = value
End Set
End Property
Private _tomadorApellidos As String
Public Property TomadorApellidos() As String
Get
Return _tomadorApellidos
End Get
Set(ByVal value As String)
_tomadorApellidos = value
End Set
End Property
Private _tomadorTelefono As String
Public Property TomadorTelefono() As String
Get
Return _tomadorTelefono
End Get
Set(ByVal value As String)
_tomadorTelefono = value
End Set
End Property
Private _tomadorEmail As String
Public Property TomadorEmail() As String
Get
Return _tomadorEmail
End Get
Set(ByVal value As String)
_tomadorEmail = value
End Set
End Property
Private _tomadorDomicilio As String
Public Property TomadorDomicilio() As String
Get
Return _tomadorDomicilio
End Get
Set(ByVal value As String)
_tomadorDomicilio = value
End Set
End Property
Private _tomadorCodigoPostal As String
Public Property TomadorCodigoPostal() As String
Get
Return _tomadorCodigoPostal
End Get
Set(ByVal value As String)
_tomadorCodigoPostal = value
End Set
End Property
Private _tomadorPoblacion As String
Public Property TomadorPoblacion() As String
Get
Return _tomadorPoblacion
End Get
Set(ByVal value As String)
_tomadorPoblacion = value
End Set
End Property
Private _tomadorProvincia As String
Public Property TomadorProvincia() As String
Get
Return _tomadorProvincia
End Get
Set(ByVal value As String)
_tomadorProvincia = value
End Set
End Property
Private _tomadorCodigoMunicipio As String
Public Property TomadorCodigoMunicipio() As String
Get
Return _tomadorCodigoMunicipio
End Get
Set(ByVal value As String)
_tomadorCodigoMunicipio = value
End Set
End Property
Private _propietarioCIF As String
Public Property PropietarioCIF() As String
Get
Return _propietarioCIF
End Get
Set(ByVal value As String)
_propietarioCIF = value
End Set
End Property
Private _propietarioNombre As String
Public Property PropietarioNombre() As String
Get
Return _propietarioNombre
End Get
Set(ByVal value As String)
_propietarioNombre = value
End Set
End Property
Private _propietarioApellidos As String
Public Property PropietarioApellidos() As String
Get
Return _propietarioApellidos
End Get
Set(ByVal value As String)
_propietarioApellidos = value
End Set
End Property
Private _propietarioTelefono As String
Public Property PropietarioTelefono() As String
Get
Return _propietarioTelefono
End Get
Set(ByVal value As String)
_propietarioTelefono = value
End Set
End Property
Private _propietarioEmail As String
Public Property PropietarioEmail() As String
Get
Return _propietarioEmail
End Get
Set(ByVal value As String)
_propietarioEmail = value
End Set
End Property
Private _propietarioDomicilio As String
Public Property PropietarioDomicilio() As String
Get
Return _propietarioDomicilio
End Get
Set(ByVal value As String)
_propietarioDomicilio = value
End Set
End Property
Private _propietarioCodigoPostal As String
Public Property PropietarioCodigoPostal() As String
Get
Return _propietarioCodigoPostal
End Get
Set(ByVal value As String)
_propietarioCodigoPostal = value
End Set
End Property
Private _propietarioPoblacion As String
Public Property PropietarioPoblacion() As String
Get
Return _propietarioPoblacion
End Get
Set(ByVal value As String)
_propietarioPoblacion = value
End Set
End Property
Private _propietarioProvincia As String
Public Property PropietarioProvincia() As String
Get
Return _propietarioProvincia
End Get
Set(ByVal value As String)
_propietarioProvincia = value
End Set
End Property
Private _propietarioCodigoMunicipio As String
Public Property PropietarioCodigoMunicipio() As String
Get
Return _propietarioCodigoMunicipio
End Get
Set(ByVal value As String)
_propietarioCodigoMunicipio = value
End Set
End Property
Private _observaciones As String
Public Property Observaciones() As String
Get
Return _observaciones
End Get
Set(ByVal value As String)
_observaciones = value
End Set
End Property
Private _capitalElegido As String
Public Property CapitalElegido() As String
Get
Return _capitalElegido
End Get
Set(ByVal value As String)
_capitalElegido = value
End Set
End Property
Private _IBAN As String
Public Property IBAN() As String
Get
Return _IBAN
End Get
Set(ByVal value As String)
_IBAN = value
End Set
End Property
Private _fechaEfecto As Date
Public Property FechaEfecto() As Date
Get
Return _fechaEfecto
End Get
Set(ByVal value As Date)
_fechaEfecto = value
End Set
End Property
Private _fechaVencimiento As Date
Public Property FechaVencimiento() As Date
Get
Return _fechaVencimiento
End Get
Set(ByVal value As Date)
_fechaVencimiento = value
End Set
End Property
End Class

View File

@@ -0,0 +1,224 @@
<Serializable>
Public Class CasetasRiegoAxa
Private _tomadorCIF As String
Public Property TomadorCIF() As String
Get
Return _tomadorCIF
End Get
Set(ByVal value As String)
_tomadorCIF = value
End Set
End Property
Private _tomadorNombre As String
Public Property TomadorNombre() As String
Get
Return _tomadorNombre
End Get
Set(ByVal value As String)
_tomadorNombre = value
End Set
End Property
Private _tomadorApellidos As String
Public Property TomadorApellidos() As String
Get
Return _tomadorApellidos
End Get
Set(ByVal value As String)
_tomadorApellidos = value
End Set
End Property
Private _tomadorTelefono As String
Public Property TomadorTelefono() As String
Get
Return _tomadorTelefono
End Get
Set(ByVal value As String)
_tomadorTelefono = value
End Set
End Property
Private _tomadorEmail As String
Public Property TomadorEmail() As String
Get
Return _tomadorEmail
End Get
Set(ByVal value As String)
_tomadorEmail = value
End Set
End Property
Private _tomadorDomicilio As String
Public Property TomadorDomicilio() As String
Get
Return _tomadorDomicilio
End Get
Set(ByVal value As String)
_tomadorDomicilio = value
End Set
End Property
Private _tomadorCodigoPostal As String
Public Property TomadorCodigoPostal() As String
Get
Return _tomadorCodigoPostal
End Get
Set(ByVal value As String)
_tomadorCodigoPostal = value
End Set
End Property
Private _tomadorPoblacion As String
Public Property TomadorPoblacion() As String
Get
Return _tomadorPoblacion
End Get
Set(ByVal value As String)
_tomadorPoblacion = value
End Set
End Property
Private _tomadorProvincia As String
Public Property TomadorProvincia() As String
Get
Return _tomadorProvincia
End Get
Set(ByVal value As String)
_tomadorProvincia = value
End Set
End Property
Private _tomadorCodigoMunicipio As String
Public Property TomadorCodigoMunicipio() As String
Get
Return _tomadorCodigoMunicipio
End Get
Set(ByVal value As String)
_tomadorCodigoMunicipio = value
End Set
End Property
Private _casetaUbicacion As String
Public Property CasetaUbicacion() As String
Get
Return _casetaUbicacion
End Get
Set(ByVal value As String)
_casetaUbicacion = value
End Set
End Property
Private _casetaLocalidad As String
Public Property CasetaLocalidad() As String
Get
Return _casetaLocalidad
End Get
Set(ByVal value As String)
_casetaLocalidad = value
End Set
End Property
Private _casetaCodigoPostal As String
Public Property CasetaCodigoPostal() As String
Get
Return _casetaCodigoPostal
End Get
Set(ByVal value As String)
_casetaCodigoPostal = value
End Set
End Property
Private _casetaProvincia As String
Public Property CasetaProvincia() As String
Get
Return _casetaProvincia
End Get
Set(ByVal value As String)
_casetaProvincia = value
End Set
End Property
Private _EdificiosDescripcion As String
Public Property EdificiosDescripcion() As String
Get
Return _EdificiosDescripcion
End Get
Set(ByVal value As String)
_EdificiosDescripcion = value
End Set
End Property
Private _EdificiosCapital As String
Public Property EdificiosCapital() As String
Get
Return _EdificiosCapital
End Get
Set(ByVal value As String)
_EdificiosCapital = value
End Set
End Property
Private _mobiliarioDescripcion As String
Public Property MobiliarioDescripcion() As String
Get
Return _mobiliarioDescripcion
End Get
Set(ByVal value As String)
_mobiliarioDescripcion = value
End Set
End Property
Private _mobiliarioCapital As String
Public Property MobiliarioCapital() As String
Get
Return _mobiliarioCapital
End Get
Set(ByVal value As String)
_mobiliarioCapital = value
End Set
End Property
Private _existenciasDescripcion As String
Public Property ExistenciasDescripcion() As String
Get
Return _existenciasDescripcion
End Get
Set(ByVal value As String)
_existenciasDescripcion = value
End Set
End Property
Private _existenciasCapital As String
Public Property ExistenciasCapital() As String
Get
Return _existenciasCapital
End Get
Set(ByVal value As String)
_existenciasCapital = value
End Set
End Property
Private _capitalElegido As String
Public Property CapitalElegido() As String
Get
Return _capitalElegido
End Get
Set(ByVal value As String)
_capitalElegido = value
End Set
End Property
Private _IBAN As String
Public Property IBAN() As String
Get
Return _IBAN
End Get
Set(ByVal value As String)
_IBAN = value
End Set
End Property
Private _fechaEfecto As Date
Public Property FechaEfecto() As Date
Get
Return _fechaEfecto
End Get
Set(ByVal value As Date)
_fechaEfecto = value
End Set
End Property
Private _fechaVencimiento As Date
Public Property FechaVencimiento() As Date
Get
Return _fechaVencimiento
End Get
Set(ByVal value As Date)
_fechaVencimiento = value
End Set
End Property
End Class

View File

@@ -0,0 +1,261 @@
<Serializable>
Public Class Patinetes
Private _tomadorCIF As String
Public Property TomadorCIF() As String
Get
Return _tomadorCIF
End Get
Set(ByVal value As String)
_tomadorCIF = value
End Set
End Property
Private _tomadorNombre As String
Public Property TomadorNombre() As String
Get
Return _tomadorNombre
End Get
Set(ByVal value As String)
_tomadorNombre = value
End Set
End Property
Private _tomadorApellidos As String
Public Property TomadorApellidos() As String
Get
Return _tomadorApellidos
End Get
Set(ByVal value As String)
_tomadorApellidos = value
End Set
End Property
Private _tomadorTelefono As String
Public Property TomadorTelefono() As String
Get
Return _tomadorTelefono
End Get
Set(ByVal value As String)
_tomadorTelefono = value
End Set
End Property
Private _tomadorCorreo As String
Public Property TomadorCorreo() As String
Get
Return _tomadorCorreo
End Get
Set(ByVal value As String)
_tomadorCorreo = value
End Set
End Property
Private _tomadorDomicilio As String
Public Property TomadorDomicilio() As String
Get
Return _tomadorDomicilio
End Get
Set(ByVal value As String)
_tomadorDomicilio = value
End Set
End Property
Private _tomadorCodigoPostal As String
Public Property TomadorCodigoPostal() As String
Get
Return _tomadorCodigoPostal
End Get
Set(ByVal value As String)
_tomadorCodigoPostal = value
End Set
End Property
Private _tomadorPoblacion As String
Public Property TomadorPoblacion() As String
Get
Return _tomadorPoblacion
End Get
Set(ByVal value As String)
_tomadorPoblacion = value
End Set
End Property
Private _tomadorProvincia As String
Public Property TomadorProvincia() As String
Get
Return _tomadorProvincia
End Get
Set(ByVal value As String)
_tomadorProvincia = value
End Set
End Property
Private _tomadorCodigoMunicipio As String
Public Property TomadorCodigoMunicipio() As String
Get
Return _tomadorCodigoMunicipio
End Get
Set(ByVal value As String)
_tomadorCodigoMunicipio = value
End Set
End Property
Private _propietarioCIF As String
Public Property PropietarioCIF() As String
Get
Return _propietarioCIF
End Get
Set(ByVal value As String)
_propietarioCIF = value
End Set
End Property
Private _propietarioNombre As String
Public Property PropietarioNombre() As String
Get
Return _propietarioNombre
End Get
Set(ByVal value As String)
_propietarioNombre = value
End Set
End Property
Private _propietarioApellidos As String
Public Property PropietarioApellidos() As String
Get
Return _propietarioApellidos
End Get
Set(ByVal value As String)
_propietarioApellidos = value
End Set
End Property
Private _propietarioTelefono As String
Public Property PropietarioTelefono() As String
Get
Return _propietarioTelefono
End Get
Set(ByVal value As String)
_propietarioTelefono = value
End Set
End Property
Private _propietarioCorreo As String
Public Property PropietarioCorreo() As String
Get
Return _propietarioCorreo
End Get
Set(ByVal value As String)
_propietarioCorreo = value
End Set
End Property
Private _propietarioDomicilio As String
Public Property PropietarioDomicilio() As String
Get
Return _propietarioDomicilio
End Get
Set(ByVal value As String)
_propietarioDomicilio = value
End Set
End Property
Private _propietarioCodigoPostal As String
Public Property PropietarioCodigoPostal() As String
Get
Return _propietarioCodigoPostal
End Get
Set(ByVal value As String)
_propietarioCodigoPostal = value
End Set
End Property
Private _propietarioPoblacion As String
Public Property PropietarioPoblacion() As String
Get
Return _propietarioPoblacion
End Get
Set(ByVal value As String)
_propietarioPoblacion = value
End Set
End Property
Private _propietarioProvincia As String
Public Property PropietarioProvincia() As String
Get
Return _propietarioProvincia
End Get
Set(ByVal value As String)
_propietarioProvincia = value
End Set
End Property
Private _propietarioCodigoMunicipio As String
Public Property PropietarioCodigoMunicipio() As String
Get
Return _propietarioCodigoMunicipio
End Get
Set(ByVal value As String)
_propietarioCodigoMunicipio = value
End Set
End Property
Private _producto As String
Public Property Producto() As String
Get
Return _producto
End Get
Set(ByVal value As String)
_producto = value
End Set
End Property
Private _identificador As String
Public Property Identificador() As String
Get
Return _identificador
End Get
Set(ByVal value As String)
_identificador = value
End Set
End Property
Private _fechaCompra As Date
Public Property FechaCompra() As Date
Get
Return _fechaCompra
End Get
Set(ByVal value As Date)
_fechaCompra = value
End Set
End Property
Private _primaAnualizada As Double
Public Property PrimaAnualizada() As Double
Get
Return _primaAnualizada
End Get
Set(ByVal value As Double)
_primaAnualizada = value
End Set
End Property
Private _observaciones As String
Public Property Observaciones() As String
Get
Return _observaciones
End Get
Set(ByVal value As String)
_observaciones = value
End Set
End Property
Private _IBAN As String
Public Property IBAN() As String
Get
Return _IBAN
End Get
Set(ByVal value As String)
_IBAN = value
End Set
End Property
Private _fechaEfecto As Date
Public Property FechaEfecto() As Date
Get
Return _fechaEfecto
End Get
Set(ByVal value As Date)
_fechaEfecto = value
End Set
End Property
Private _fechaVencimiento As Date
Public Property FechaVencimiento() As Date
Get
Return _fechaVencimiento
End Get
Set(ByVal value As Date)
_fechaVencimiento = value
End Set
End Property
End Class

View File

@@ -0,0 +1,139 @@
<Serializable>
Public Class RCCaballos
Private _tomadorCIF As String
Public Property TomadorCIF() As String
Get
Return _tomadorCIF
End Get
Set(ByVal value As String)
_tomadorCIF = value
End Set
End Property
Private _tomadorNombre As String
Public Property TomadorNombre() As String
Get
Return _tomadorNombre
End Get
Set(ByVal value As String)
_tomadorNombre = value
End Set
End Property
Private _tomadorApellidos As String
Public Property TomadorApellidos() As String
Get
Return _tomadorApellidos
End Get
Set(ByVal value As String)
_tomadorApellidos = value
End Set
End Property
Private _tomadorTelefono As String
Public Property TomadorTelefono() As String
Get
Return _tomadorTelefono
End Get
Set(ByVal value As String)
_tomadorTelefono = value
End Set
End Property
Private _tomadorEmail As String
Public Property TomadorEmail() As String
Get
Return _tomadorEmail
End Get
Set(ByVal value As String)
_tomadorEmail = value
End Set
End Property
Private _tomadorDomicilio As String
Public Property TomadorDomicilio() As String
Get
Return _tomadorDomicilio
End Get
Set(ByVal value As String)
_tomadorDomicilio = value
End Set
End Property
Private _tomadorCodigoPostal As String
Public Property TomadorCodigoPostal() As String
Get
Return _tomadorCodigoPostal
End Get
Set(ByVal value As String)
_tomadorCodigoPostal = value
End Set
End Property
Private _tomadorPoblacion As String
Public Property TomadorPoblacion() As String
Get
Return _tomadorPoblacion
End Get
Set(ByVal value As String)
_tomadorPoblacion = value
End Set
End Property
Private _tomadorProvincia As String
Public Property TomadorProvincia() As String
Get
Return _tomadorProvincia
End Get
Set(ByVal value As String)
_tomadorProvincia = value
End Set
End Property
Private _tomadorCodigoMunicipio As String
Public Property TomadorCodigoMunicipio() As String
Get
Return _tomadorCodigoMunicipio
End Get
Set(ByVal value As String)
_tomadorCodigoMunicipio = value
End Set
End Property
Private _documentacionEquina As String
Public Property DocumentacionEquina() As String
Get
Return _documentacionEquina
End Get
Set(ByVal value As String)
_documentacionEquina = value
End Set
End Property
Private _observaciones As String
Public Property Observaciones() As String
Get
Return _observaciones
End Get
Set(ByVal value As String)
_observaciones = value
End Set
End Property
Private _IBAN As String
Public Property IBAN() As String
Get
Return _IBAN
End Get
Set(ByVal value As String)
_IBAN = value
End Set
End Property
Private _fechaEfecto As Date
Public Property FechaEfecto() As Date
Get
Return _fechaEfecto
End Get
Set(ByVal value As Date)
_fechaEfecto = value
End Set
End Property
Private _fechaVencimiento As Date
Public Property FechaVencimiento() As Date
Get
Return _fechaVencimiento
End Get
Set(ByVal value As Date)
_fechaVencimiento = value
End Set
End Property
End Class

View File

@@ -0,0 +1,354 @@
<Serializable>
Public Class RCCotosCazaCaser
Private _numeroHectareas As Double
Public Property NumeroHectareas() As Double
Get
Return _numeroHectareas
End Get
Set(ByVal value As Double)
_numeroHectareas = value
End Set
End Property
Private _opcionA As Double
Public Property OpcionA() As Double
Get
Return _opcionA
End Get
Set(ByVal value As Double)
_opcionA = value
End Set
End Property
Private _opcionB As Double
Public Property OpcionB() As Double
Get
Return _opcionB
End Get
Set(ByVal value As Double)
_opcionB = value
End Set
End Property
Private _opcionC As Double
Public Property OpcionC() As Double
Get
Return _opcionC
End Get
Set(ByVal value As Double)
_opcionC = value
End Set
End Property
Private _opcionElegida As String
Public Property OpcionElegida() As String
Get
Return _opcionElegida
End Get
Set(ByVal value As String)
_opcionElegida = value
End Set
End Property
Private _totalOpcionElegida As String
Public Property TotalOpcionElegida() As String
Get
Return _totalOpcionElegida
End Get
Set(ByVal value As String)
_totalOpcionElegida = value
End Set
End Property
Private _limitePorSiniestro As String
Public Property LimitePorSiniestro() As String
Get
Return _limitePorSiniestro
End Get
Set(ByVal value As String)
_limitePorSiniestro = value
End Set
End Property
Private _tomadorCIF As String
Public Property TomadorCIF() As String
Get
Return _tomadorCIF
End Get
Set(ByVal value As String)
_tomadorCIF = value
End Set
End Property
Private _tomadorNombre As String
Public Property TomadorNombre() As String
Get
Return _tomadorNombre
End Get
Set(ByVal value As String)
_tomadorNombre = value
End Set
End Property
Private _tomadorApellidos As String
Public Property TomadorApellidos() As String
Get
Return _tomadorApellidos
End Get
Set(ByVal value As String)
_tomadorApellidos = value
End Set
End Property
Private _tomadorTelefono As String
Public Property TomadorTelefono() As String
Get
Return _tomadorTelefono
End Get
Set(ByVal value As String)
_tomadorTelefono = value
End Set
End Property
Private _tomadorDomicilio As String
Public Property TomadorDomicilio() As String
Get
Return _tomadorDomicilio
End Get
Set(ByVal value As String)
_tomadorDomicilio = value
End Set
End Property
Private _tomadorCodigoPostal As String
Public Property TomadorCodigoPostal() As String
Get
Return _tomadorCodigoPostal
End Get
Set(ByVal value As String)
_tomadorCodigoPostal = value
End Set
End Property
Private _tomadorPoblacion As String
Public Property TomadorPoblacion() As String
Get
Return _tomadorPoblacion
End Get
Set(ByVal value As String)
_tomadorPoblacion = value
End Set
End Property
Private _tomadorProvincia As String
Public Property TomadorProvincia() As String
Get
Return _tomadorProvincia
End Get
Set(ByVal value As String)
_tomadorProvincia = value
End Set
End Property
Private _tomadorCodigoMunicipio As String
Public Property TomadorCodigoMunicipio() As String
Get
Return _tomadorCodigoMunicipio
End Get
Set(ByVal value As String)
_tomadorCodigoMunicipio = value
End Set
End Property
Private _propietarioCIF As String
Public Property PropietarioCIF() As String
Get
Return _propietarioCIF
End Get
Set(ByVal value As String)
_propietarioCIF = value
End Set
End Property
Private _propietarioNombre As String
Public Property PropietarioNombre() As String
Get
Return _propietarioNombre
End Get
Set(ByVal value As String)
_propietarioNombre = value
End Set
End Property
Private _propietarioApellidos As String
Public Property PropietarioApellidos() As String
Get
Return _propietarioApellidos
End Get
Set(ByVal value As String)
_propietarioApellidos = value
End Set
End Property
Private _propietarioTelefono As String
Public Property PropietarioTelefono() As String
Get
Return _propietarioTelefono
End Get
Set(ByVal value As String)
_propietarioTelefono = value
End Set
End Property
Private _propietarioDomicilio As String
Public Property PropietarioDomicilio() As String
Get
Return _propietarioDomicilio
End Get
Set(ByVal value As String)
_propietarioDomicilio = value
End Set
End Property
Private _propietarioCodigoPostal As String
Public Property PropietarioCodigoPostal() As String
Get
Return _propietarioCodigoPostal
End Get
Set(ByVal value As String)
_propietarioCodigoPostal = value
End Set
End Property
Private _propietarioPoblacion As String
Public Property PropietarioPoblacion() As String
Get
Return _propietarioPoblacion
End Get
Set(ByVal value As String)
_propietarioPoblacion = value
End Set
End Property
Private _propietarioProvincia As String
Public Property PropietarioProvincia() As String
Get
Return _propietarioProvincia
End Get
Set(ByVal value As String)
_propietarioProvincia = value
End Set
End Property
Private _propietarioCodigoMunicipio As String
Public Property PropietarioCodigoMunicipio() As String
Get
Return _propietarioCodigoMunicipio
End Get
Set(ByVal value As String)
_propietarioCodigoMunicipio = value
End Set
End Property
Private _riesgoCodigoMunicipio As String
Public Property RiesgoCodigoMunicipio() As String
Get
Return _riesgoCodigoMunicipio
End Get
Set(ByVal value As String)
_riesgoCodigoMunicipio = value
End Set
End Property
Private _riesgoSituacion As String
Public Property RiesgoSituacion() As String
Get
Return _riesgoSituacion
End Get
Set(ByVal value As String)
_riesgoSituacion = value
End Set
End Property
Private _riegoCodigoPostal As String
Public Property RiesgoCodigoPostal() As String
Get
Return _riegoCodigoPostal
End Get
Set(ByVal value As String)
_riegoCodigoPostal = value
End Set
End Property
Private _riesgoPoblacion As String
Public Property RiesgoPoblacion() As String
Get
Return _riesgoPoblacion
End Get
Set(ByVal value As String)
_riesgoPoblacion = value
End Set
End Property
Private _riesgoProvincia As String
Public Property RiesgoProvincia() As String
Get
Return _riesgoProvincia
End Get
Set(ByVal value As String)
_riesgoProvincia = value
End Set
End Property
Private _riesgoActividad As String
Public Property RiesgoActividad() As String
Get
Return _riesgoActividad
End Get
Set(ByVal value As String)
_riesgoActividad = value
End Set
End Property
Private _riesgoEpigrafe As String
Public Property RiesgoEpigrafe() As String
Get
Return _riesgoEpigrafe
End Get
Set(ByVal value As String)
_riesgoEpigrafe = value
End Set
End Property
Private _riesgoDescripcion As String
Public Property RiesgoDescripcion() As String
Get
Return _riesgoDescripcion
End Get
Set(ByVal value As String)
_riesgoDescripcion = value
End Set
End Property
Private _aclaracionesDeLaActividad As String
Public Property AclaracionesDeLaActividad() As String
Get
Return _aclaracionesDeLaActividad
End Get
Set(ByVal value As String)
_aclaracionesDeLaActividad = value
End Set
End Property
Private _observaciones As String
Public Property Observaciones() As String
Get
Return _observaciones
End Get
Set(ByVal value As String)
_observaciones = value
End Set
End Property
Private _fechaEfecto As Date
Public Property FechaEfecto() As Date
Get
Return _fechaEfecto
End Get
Set(ByVal value As Date)
_fechaEfecto = value
End Set
End Property
Private _fechaVencimiento As Date
Public Property FechaVencimiento() As Date
Get
Return _fechaVencimiento
End Get
Set(ByVal value As Date)
_fechaVencimiento = value
End Set
End Property
Private _IBAN As String
Public Property IBAN() As String
Get
Return _IBAN
End Get
Set(ByVal value As String)
_IBAN = value
End Set
End Property
End Class

View File

@@ -0,0 +1,158 @@
<Serializable>
Public Class RCMaquinariaAgricola
Private _aseguradoCIF As String
Public Property AseguradoCIF() As String
Get
Return _aseguradoCIF
End Get
Set(ByVal value As String)
_aseguradoCIF = value
End Set
End Property
Private _aseguradoNombre As String
Public Property AseguradoNombre() As String
Get
Return _aseguradoNombre
End Get
Set(ByVal value As String)
_aseguradoNombre = value
End Set
End Property
Private _aseguradoApellidos As String
Public Property AseguradoApellidos() As String
Get
Return _aseguradoApellidos
End Get
Set(ByVal value As String)
_aseguradoApellidos = value
End Set
End Property
Private _aseguradoDireccion As String
Public Property AseguradoDireccion() As String
Get
Return _aseguradoDireccion
End Get
Set(ByVal value As String)
_aseguradoDireccion = value
End Set
End Property
Private _aseguradoCodigoPostal As String
Public Property AseguradoCodigoPostal() As String
Get
Return _aseguradoCodigoPostal
End Get
Set(ByVal value As String)
_aseguradoCodigoPostal = value
End Set
End Property
Private _codigoMunicipio As String
Public Property CodigoMunicipio() As String
Get
Return _codigoMunicipio
End Get
Set(ByVal value As String)
_codigoMunicipio = value
End Set
End Property
Private _aseguradoPoblacion As String
Public Property AseguradoPoblacion() As String
Get
Return _aseguradoPoblacion
End Get
Set(ByVal value As String)
_aseguradoPoblacion = value
End Set
End Property
Private _aseguradoTelefono1 As String
Public Property AseguradoTelefono1() As String
Get
Return _aseguradoTelefono1
End Get
Set(ByVal value As String)
_aseguradoTelefono1 = value
End Set
End Property
Private _aseguradoTelefono2 As String
Public Property AseguradoTelefono2() As String
Get
Return _aseguradoTelefono2
End Get
Set(ByVal value As String)
_aseguradoTelefono2 = value
End Set
End Property
Private _aseguradoCorreo As String
Public Property AseguradoCorreo() As String
Get
Return _aseguradoCorreo
End Get
Set(ByVal value As String)
_aseguradoCorreo = value
End Set
End Property
Private _fechaEfecto As Date
Public Property FechaEfecto() As Date
Get
Return _fechaEfecto
End Get
Set(ByVal value As Date)
_fechaEfecto = value
End Set
End Property
Private _fechaVencimiento As String
Public Property FechaVencimiento() As String
Get
Return _fechaVencimiento
End Get
Set(ByVal value As String)
_fechaVencimiento = value
End Set
End Property
Private _IBAN As String
Public Property IBAN() As String
Get
Return _IBAN
End Get
Set(ByVal value As String)
_IBAN = value
End Set
End Property
Private _matricula As String
Public Property Matricula() As String
Get
Return _matricula
End Get
Set(ByVal value As String)
_matricula = value
End Set
End Property
Private _cobertura As String
Public Property Cobertura() As String
Get
Return _cobertura
End Get
Set(ByVal value As String)
_cobertura = value
End Set
End Property
Private _elegida As String
Public Property Elegida() As String
Get
Return _elegida
End Get
Set(ByVal value As String)
_elegida = value
End Set
End Property
Private _primaTotal As String
Public Property PrimaTotal() As String
Get
Return _primaTotal
End Get
Set(ByVal value As String)
_primaTotal = value
End Set
End Property
End Class

View File

@@ -0,0 +1,413 @@
<Serializable>
Public Class RCPerros
Private _tomadorCIF As String
Public Property TomadorCIF() As String
Get
Return _tomadorCIF
End Get
Set(ByVal value As String)
_tomadorCIF = value
End Set
End Property
Private _tomadorNombre As String
Public Property TomadorNombre() As String
Get
Return _tomadorNombre
End Get
Set(ByVal value As String)
_tomadorNombre = value
End Set
End Property
Private _tomadorApellidos As String
Public Property TomadorApellidos() As String
Get
Return _tomadorApellidos
End Get
Set(ByVal value As String)
_tomadorApellidos = value
End Set
End Property
Private _tomadorTelefono As String
Public Property TomadorTelefono() As String
Get
Return _tomadorTelefono
End Get
Set(ByVal value As String)
_tomadorTelefono = value
End Set
End Property
Private _tomadorEmail As String
Public Property TomadorEmail() As String
Get
Return _tomadorEmail
End Get
Set(ByVal value As String)
_tomadorEmail = value
End Set
End Property
Private _tomadorDomicilio As String
Public Property TomadorDomicilio() As String
Get
Return _tomadorDomicilio
End Get
Set(ByVal value As String)
_tomadorDomicilio = value
End Set
End Property
Private _tomadorCodigoPostal As String
Public Property TomadorCodigoPostal() As String
Get
Return _tomadorCodigoPostal
End Get
Set(ByVal value As String)
_tomadorCodigoPostal = value
End Set
End Property
Private _tomadorPoblacion As String
Public Property TomadorPoblacion() As String
Get
Return _tomadorPoblacion
End Get
Set(ByVal value As String)
_tomadorPoblacion = value
End Set
End Property
Private _tomadorProvincia As String
Public Property TomadorProvincia() As String
Get
Return _tomadorProvincia
End Get
Set(ByVal value As String)
_tomadorProvincia = value
End Set
End Property
Private _tomadorCodigoMunicipio As String
Public Property TomadorCodigoMunicipio() As String
Get
Return _tomadorCodigoMunicipio
End Get
Set(ByVal value As String)
_tomadorCodigoMunicipio = value
End Set
End Property
Private _propietarioCIF As String
Public Property PropietarioCIF() As String
Get
Return _propietarioCIF
End Get
Set(ByVal value As String)
_propietarioCIF = value
End Set
End Property
Private _propietarioNombre As String
Public Property PropietarioNombre() As String
Get
Return _propietarioNombre
End Get
Set(ByVal value As String)
_propietarioNombre = value
End Set
End Property
Private _propietarioApellidos As String
Public Property PropietarioApellidos() As String
Get
Return _propietarioApellidos
End Get
Set(ByVal value As String)
_propietarioApellidos = value
End Set
End Property
Private _propietarioTelefono As String
Public Property PropietarioTelefono() As String
Get
Return _propietarioTelefono
End Get
Set(ByVal value As String)
_propietarioTelefono = value
End Set
End Property
Private _propietarioEmail As String
Public Property PropietarioEmail() As String
Get
Return _propietarioEmail
End Get
Set(ByVal value As String)
_propietarioEmail = value
End Set
End Property
Private _propietarioDomicilio As String
Public Property PropietarioDomicilio() As String
Get
Return _propietarioDomicilio
End Get
Set(ByVal value As String)
_propietarioDomicilio = value
End Set
End Property
Private _propietarioCodigoPostal As String
Public Property PropietarioCodigoPostal() As String
Get
Return _propietarioCodigoPostal
End Get
Set(ByVal value As String)
_propietarioCodigoPostal = value
End Set
End Property
Private _propietarioPoblacion As String
Public Property PropietarioPoblacion() As String
Get
Return _propietarioPoblacion
End Get
Set(ByVal value As String)
_propietarioPoblacion = value
End Set
End Property
Private _propietarioProvincia As String
Public Property PropietarioProvincia() As String
Get
Return _propietarioProvincia
End Get
Set(ByVal value As String)
_propietarioProvincia = value
End Set
End Property
Private _propietarioCodigoMunicipio As String
Public Property PropietarioCodigoMunicipio() As String
Get
Return _propietarioCodigoMunicipio
End Get
Set(ByVal value As String)
_propietarioCodigoMunicipio = value
End Set
End Property
Private _coberturaElegida As String
Public Property CoberturaElegida() As String
Get
Return _coberturaElegida
End Get
Set(ByVal value As String)
_coberturaElegida = value
End Set
End Property
Private _precioCobertura As String
Public Property PrecioCobertura() As String
Get
Return _precioCobertura
End Get
Set(ByVal value As String)
_precioCobertura = value
End Set
End Property
Private _numeroPerrosPeligrosos As Integer
Public Property NumeroPerrosPeligrosos() As Integer
Get
Return _numeroPerrosPeligrosos
End Get
Set(ByVal value As Integer)
_numeroPerrosPeligrosos = value
End Set
End Property
Private _numeroPerrosNoPeligrosos As Integer
Public Property NumeroPerrosNoPeligrosos() As Integer
Get
Return _numeroPerrosNoPeligrosos
End Get
Set(ByVal value As Integer)
_numeroPerrosNoPeligrosos = value
End Set
End Property
Private _primaPerroPeligrosos As Double
Public Property PrimaPerrosPeligrosos() As Double
Get
Return _primaPerroPeligrosos
End Get
Set(ByVal value As Double)
_primaPerroPeligrosos = value
End Set
End Property
Private _primaPerrosNoPeligrosos As Double
Public Property PrimaPerrosNoPeligrosos() As Double
Get
Return _primaPerrosNoPeligrosos
End Get
Set(ByVal value As Double)
_primaPerrosNoPeligrosos = value
End Set
End Property
Private _precioPerrosPeligrosos As Double
Public Property PrecioPerrosPeligrosos() As Double
Get
Return _precioPerrosPeligrosos
End Get
Set(ByVal value As Double)
_precioPerrosPeligrosos = value
End Set
End Property
Private _precioPerrosNoPeligrosos As Double
Public Property PrecioPerrosNoPeligrosos() As Double
Get
Return _precioPerrosNoPeligrosos
End Get
Set(ByVal value As Double)
_precioPerrosNoPeligrosos = value
End Set
End Property
Private _primeroRaza As String
Public Property PrimeroRaza() As String
Get
Return _primeroRaza
End Get
Set(ByVal value As String)
_primeroRaza = value
End Set
End Property
Private _primeroMicrochip As String
Public Property PrimeroMicrochip() As String
Get
Return _primeroMicrochip
End Get
Set(ByVal value As String)
_primeroMicrochip = value
End Set
End Property
Private _primeroNombre As String
Public Property PrimeroNombre() As String
Get
Return _primeroNombre
End Get
Set(ByVal value As String)
_primeroNombre = value
End Set
End Property
Private _primeroFechaNacimiento As Date
Public Property PrimeroFechaNacimiento() As Date
Get
Return _primeroFechaNacimiento
End Get
Set(ByVal value As Date)
_primeroFechaNacimiento = value
End Set
End Property
Private _segundoRaza As String
Public Property SegundoRaza() As String
Get
Return _segundoRaza
End Get
Set(ByVal value As String)
_segundoRaza = value
End Set
End Property
Private _segundoMicrochip As String
Public Property SegundoMicrochip() As String
Get
Return _segundoMicrochip
End Get
Set(ByVal value As String)
_segundoMicrochip = value
End Set
End Property
Private _segundoNombre As String
Public Property SegundoNombre() As String
Get
Return _segundoNombre
End Get
Set(ByVal value As String)
_segundoNombre = value
End Set
End Property
Private _segundoFechaNacimiento As Date
Public Property SegundoFechaNacimiento() As Date
Get
Return _segundoFechaNacimiento
End Get
Set(ByVal value As Date)
_segundoFechaNacimiento = value
End Set
End Property
Private _terceroRaza As String
Public Property TerceroRaza() As String
Get
Return _terceroRaza
End Get
Set(ByVal value As String)
_terceroRaza = value
End Set
End Property
Private _terceroMicrochip As String
Public Property TerceroMicrochip() As String
Get
Return _terceroMicrochip
End Get
Set(ByVal value As String)
_terceroMicrochip = value
End Set
End Property
Private _terceroNombre As String
Public Property TerceroNombre() As String
Get
Return _terceroNombre
End Get
Set(ByVal value As String)
_terceroNombre = value
End Set
End Property
Private _terceroFechaNacimiento As Date
Public Property TerceroFechaNacimiento() As Date
Get
Return _terceroFechaNacimiento
End Get
Set(ByVal value As Date)
_terceroFechaNacimiento = value
End Set
End Property
Private _observaciones As String
Public Property Observaciones() As String
Get
Return _observaciones
End Get
Set(ByVal value As String)
_observaciones = value
End Set
End Property
Private _IBAN As String
Public Property IBAN() As String
Get
Return _IBAN
End Get
Set(ByVal value As String)
_IBAN = value
End Set
End Property
Private _fechaEfecto As Date
Public Property FechaEfecto() As Date
Get
Return _fechaEfecto
End Get
Set(ByVal value As Date)
_fechaEfecto = value
End Set
End Property
Private _fechaVencimiento As Date
Public Property FechaVencimiento() As Date
Get
Return _fechaVencimiento
End Get
Set(ByVal value As Date)
_fechaVencimiento = value
End Set
End Property
Private _tipoPerro As String
Public Property TipoPerro() As String
Get
Return _tipoPerro
End Get
Set(ByVal value As String)
_tipoPerro = value
End Set
End Property
End Class

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,486 @@
<Serializable>
Public Class RCSociosZurich
Private _tomadorCIF As String
Public Property TomadorCIF() As String
Get
Return _tomadorCIF
End Get
Set(ByVal value As String)
_tomadorCIF = value
End Set
End Property
Private _tomadorNombre As String
Public Property TomadorNombre() As String
Get
Return _tomadorNombre
End Get
Set(ByVal value As String)
_tomadorNombre = value
End Set
End Property
Private _tomadorApellidos As String
Public Property TomadorApellidos() As String
Get
Return _tomadorApellidos
End Get
Set(ByVal value As String)
_tomadorApellidos = value
End Set
End Property
Private _tomadorTelefono As String
Public Property TomadorTelefono() As String
Get
Return _tomadorTelefono
End Get
Set(ByVal value As String)
_tomadorTelefono = value
End Set
End Property
Private _tomadorTelefono2 As String
Public Property TomadorTelefono2() As String
Get
Return _tomadorTelefono2
End Get
Set(ByVal value As String)
_tomadorTelefono2 = value
End Set
End Property
Private _tomadorEmail As String
Public Property TomadorEmail() As String
Get
Return _tomadorEmail
End Get
Set(ByVal value As String)
_tomadorEmail = value
End Set
End Property
Private _tomadorDomicilio As String
Public Property TomadorDomicilio() As String
Get
Return _tomadorDomicilio
End Get
Set(ByVal value As String)
_tomadorDomicilio = value
End Set
End Property
Private _tomadorCodigoPostal As String
Public Property TomadorCodigoPostal() As String
Get
Return _tomadorCodigoPostal
End Get
Set(ByVal value As String)
_tomadorCodigoPostal = value
End Set
End Property
Private _tomadorPoblacion As String
Public Property TomadorPoblacion() As String
Get
Return _tomadorPoblacion
End Get
Set(ByVal value As String)
_tomadorPoblacion = value
End Set
End Property
Private _tomadorProvincia As String
Public Property TomadorProvincia() As String
Get
Return _tomadorProvincia
End Get
Set(ByVal value As String)
_tomadorProvincia = value
End Set
End Property
Private _tomadorCodigoMunicipio As String
Public Property TomadorCodigoMunicipio() As String
Get
Return _tomadorCodigoMunicipio
End Get
Set(ByVal value As String)
_tomadorCodigoMunicipio = value
End Set
End Property
Private _propietarioCIF As String
Public Property PropietarioCIF() As String
Get
Return _propietarioCIF
End Get
Set(ByVal value As String)
_propietarioCIF = value
End Set
End Property
Private _propietarioNombre As String
Public Property PropietarioNombre() As String
Get
Return _propietarioNombre
End Get
Set(ByVal value As String)
_propietarioNombre = value
End Set
End Property
Private _propietarioApellidos As String
Public Property PropietarioApellidos() As String
Get
Return _propietarioApellidos
End Get
Set(ByVal value As String)
_propietarioApellidos = value
End Set
End Property
Private _propietarioTelefono As String
Public Property PropietarioTelefono() As String
Get
Return _propietarioTelefono
End Get
Set(ByVal value As String)
_propietarioTelefono = value
End Set
End Property
Private _propietarioTelefono2 As String
Public Property PropietarioTelefono2() As String
Get
Return _propietarioTelefono2
End Get
Set(ByVal value As String)
_propietarioTelefono2 = value
End Set
End Property
Private _propietarioEmail As String
Public Property PropietarioEmail() As String
Get
Return _propietarioEmail
End Get
Set(ByVal value As String)
_propietarioEmail = value
End Set
End Property
Private _propietarioDomicilio As String
Public Property PropietarioDomicilio() As String
Get
Return _propietarioDomicilio
End Get
Set(ByVal value As String)
_propietarioDomicilio = value
End Set
End Property
Private _propietarioCodigoPostal As String
Public Property PropietarioCodigoPostal() As String
Get
Return _propietarioCodigoPostal
End Get
Set(ByVal value As String)
_propietarioCodigoPostal = value
End Set
End Property
Private _propietarioPoblacion As String
Public Property PropietarioPoblacion() As String
Get
Return _propietarioPoblacion
End Get
Set(ByVal value As String)
_propietarioPoblacion = value
End Set
End Property
Private _propietarioProvincia As String
Public Property PropietarioProvincia() As String
Get
Return _propietarioProvincia
End Get
Set(ByVal value As String)
_propietarioProvincia = value
End Set
End Property
Private _propietarioCodigoMunicipio As String
Public Property PropietarioCodigoMunicipio() As String
Get
Return _propietarioCodigoMunicipio
End Get
Set(ByVal value As String)
_propietarioCodigoMunicipio = value
End Set
End Property
Private _dehesa As Double
Public Property Dehesa() As Double
Get
Return _dehesa
End Get
Set(ByVal value As Double)
_dehesa = value
End Set
End Property
Private _superficieCosechable As Double
Public Property SuperficieCosechable() As Double
Get
Return _superficieCosechable
End Get
Set(ByVal value As Double)
_superficieCosechable = value
End Set
End Property
Private _cotoDeCaza As Double
Public Property CotoDeCaza() As Double
Get
Return _cotoDeCaza
End Get
Set(ByVal value As Double)
_cotoDeCaza = value
End Set
End Property
Private _vidaPrivada As Double
Public Property VidaPrivada() As Double
Get
Return _vidaPrivada
End Get
Set(ByVal value As Double)
_vidaPrivada = value
End Set
End Property
Private _cabezasVacuno As Double
Public Property CabezasVacuno() As Integer
Get
Return _cabezasVacuno
End Get
Set(ByVal value As Integer)
_cabezasVacuno = value
End Set
End Property
Private _cabezasOvino As Integer
Public Property CabezasOvino() As Integer
Get
Return _cabezasOvino
End Get
Set(ByVal value As Integer)
_cabezasOvino = value
End Set
End Property
Private _cabezasPorcino As Integer
Public Property CabezasPorcino() As Integer
Get
Return _cabezasPorcino
End Get
Set(ByVal value As Integer)
_cabezasPorcino = value
End Set
End Property
Private _cabezasEquino As Integer
Public Property CabezasEquino() As Integer
Get
Return _cabezasEquino
End Get
Set(ByVal value As Integer)
_cabezasEquino = value
End Set
End Property
Private _cabezasGanadoBravo As Integer
Public Property CabezasGanadoBravo() As Integer
Get
Return _cabezasGanadoBravo
End Get
Set(ByVal value As Integer)
_cabezasGanadoBravo = value
End Set
End Property
Private _numeroRega As String
Public Property NumeroRega() As String
Get
Return _numeroRega
End Get
Set(ByVal value As String)
_numeroRega = value
End Set
End Property
Private _codGanadero As String
Public Property CodigoGanadero() As String
Get
Return _codGanadero
End Get
Set(ByVal value As String)
_codGanadero = value
End Set
End Property
Private _observaciones As String
Public Property Observaciones() As String
Get
Return _observaciones
End Get
Set(ByVal value As String)
_observaciones = value
End Set
End Property
Private _sumaContratar As String
Public Property SumaContratar() As String
Get
Return _sumaContratar
End Get
Set(ByVal value As String)
_sumaContratar = value
End Set
End Property
Private _IBAN As String
Public Property IBAN() As String
Get
Return _IBAN
End Get
Set(ByVal value As String)
_IBAN = value
End Set
End Property
Private _fechaEfecto As Date
Public Property FechaEfecto() As Date
Get
Return _fechaEfecto
End Get
Set(ByVal value As Date)
_fechaEfecto = value
End Set
End Property
Private _fechaVencimiento As Date
Public Property FechaVencimiento() As Date
Get
Return _fechaVencimiento
End Get
Set(ByVal value As Date)
_fechaVencimiento = value
End Set
End Property
Private _formaPago As String
Public Property FormaPago() As String
Get
Return _formaPago
End Get
Set(ByVal value As String)
_formaPago = value
End Set
End Property
Private _TipoRC As String
Public Property TipoRC() As String
Get
Return _TipoRC
End Get
Set(ByVal value As String)
_TipoRC = value
End Set
End Property
Private _opcionA As Double
Public Property OpcionA() As Double
Get
Return _opcionA
End Get
Set(ByVal value As Double)
_opcionA = value
End Set
End Property
Private _opcionB As Double
Public Property OpcionB() As Double
Get
Return _opcionB
End Get
Set(ByVal value As Double)
_opcionB = value
End Set
End Property
Private _opcionC As Double
Public Property OpcionC() As Double
Get
Return _opcionC
End Get
Set(ByVal value As Double)
_opcionC = value
End Set
End Property
Private _pnetaA As Double
Public Property PrimaNetaA() As Double
Get
Return _pnetaA
End Get
Set(ByVal value As Double)
_pnetaA = value
End Set
End Property
Private _pnetaB As Double
Public Property PrimaNetaB() As Double
Get
Return _pnetaB
End Get
Set(ByVal value As Double)
_pnetaB = value
End Set
End Property
Private _pnetaC As Double
Public Property PrimaNetaC() As Double
Get
Return _pnetaC
End Get
Set(ByVal value As Double)
_pnetaC = value
End Set
End Property
Private _impuestosA As Double
Public Property ImpuestosA() As Double
Get
Return _impuestosA
End Get
Set(ByVal value As Double)
_impuestosA = value
End Set
End Property
Private _impuestoB As Double
Public Property ImpuestosB() As Double
Get
Return _impuestoB
End Get
Set(ByVal value As Double)
_impuestoB = value
End Set
End Property
Private _impuestosC As String
Public Property ImpuestosC() As String
Get
Return _impuestosC
End Get
Set(ByVal value As String)
_impuestosC = value
End Set
End Property
Private _pTotalA As Double
Public Property PrimaTotalA() As Double
Get
Return _pTotalA
End Get
Set(ByVal value As Double)
_pTotalA = value
End Set
End Property
Private _pTotalB As Double
Public Property PrimaTotalB() As Double
Get
Return _pTotalB
End Get
Set(ByVal value As Double)
_pTotalB = value
End Set
End Property
Private _pTotalC As Double
Public Property PrimaTotalC() As Double
Get
Return _pTotalC
End Get
Set(ByVal value As Double)
_pTotalC = value
End Set
End Property
End Class

View File

@@ -0,0 +1,980 @@
Public Class SaludMapfre
Private _tomadorCIF As String
Public Property TomadorCIF() As String
Get
Return _tomadorCIF
End Get
Set(ByVal value As String)
_tomadorCIF = value
End Set
End Property
Private _tomadorNombre As String
Public Property TomadorNombre() As String
Get
Return _tomadorNombre
End Get
Set(ByVal value As String)
_tomadorNombre = value
End Set
End Property
Private _tomadorApellidos As String
Public Property TomadorApellidos() As String
Get
Return _tomadorApellidos
End Get
Set(ByVal value As String)
_tomadorApellidos = value
End Set
End Property
Private _tomadorTelefono As String
Public Property TomadorTelefono() As String
Get
Return _tomadorTelefono
End Get
Set(ByVal value As String)
_tomadorTelefono = value
End Set
End Property
Private _tomadorEmail As String
Public Property TomadorEmail() As String
Get
Return _tomadorEmail
End Get
Set(ByVal value As String)
_tomadorEmail = value
End Set
End Property
Private _tomadorDomicilio As String
Public Property TomadorDomicilio() As String
Get
Return _tomadorDomicilio
End Get
Set(ByVal value As String)
_tomadorDomicilio = value
End Set
End Property
Private _tomadorCodigoPostal As String
Public Property TomadorCodigoPostal() As String
Get
Return _tomadorCodigoPostal
End Get
Set(ByVal value As String)
_tomadorCodigoPostal = value
End Set
End Property
Private _tomadorPoblacion As String
Public Property TomadorPoblacion() As String
Get
Return _tomadorPoblacion
End Get
Set(ByVal value As String)
_tomadorPoblacion = value
End Set
End Property
Private _tomadorProvincia As String
Public Property TomadorProvincia() As String
Get
Return _tomadorProvincia
End Get
Set(ByVal value As String)
_tomadorProvincia = value
End Set
End Property
Private _tomadorCodigoMunicipio As String
Public Property TomadorCodigoMunicipio() As String
Get
Return _tomadorCodigoMunicipio
End Get
Set(ByVal value As String)
_tomadorCodigoMunicipio = value
End Set
End Property
Private _tomadorFechaNacimiento As Date
Public Property TomadorFechaNacimiento() As Date
Get
Return _tomadorFechaNacimiento
End Get
Set(ByVal value As Date)
_tomadorFechaNacimiento = value
End Set
End Property
Private _tomadorSexo As String
Public Property TomadorSexo() As String
Get
Return _tomadorSexo
End Get
Set(ByVal value As String)
_tomadorSexo = value
End Set
End Property
Private _tomadorEstadoCivil As String
Public Property TomadorEstadoCivil() As String
Get
Return _tomadorEstadoCivil
End Get
Set(ByVal value As String)
_tomadorEstadoCivil = value
End Set
End Property
Private _asegurado1CIF As String
Public Property Asegurado1CIF() As String
Get
Return _asegurado1CIF
End Get
Set(ByVal value As String)
_asegurado1CIF = value
End Set
End Property
Private _asegurado1Nombre As String
Public Property Asegurado1Nombre() As String
Get
Return _asegurado1Nombre
End Get
Set(ByVal value As String)
_asegurado1Nombre = value
End Set
End Property
Private _asegurado1Apellidos As String
Public Property Asegurado1Apellidos() As String
Get
Return _asegurado1Apellidos
End Get
Set(ByVal value As String)
_asegurado1Apellidos = value
End Set
End Property
Private _asegurado1Domicilio As String
Public Property Asegurado1Domicilio() As String
Get
Return _asegurado1Domicilio
End Get
Set(ByVal value As String)
_asegurado1Domicilio = value
End Set
End Property
Private _asegurado1CodigoPostal As String
Public Property Asegurado1CodigoPostal() As String
Get
Return _asegurado1CodigoPostal
End Get
Set(ByVal value As String)
_asegurado1CodigoPostal = value
End Set
End Property
Private _asegurado1Poblacion As String
Public Property Asegurado1Poblacion() As String
Get
Return _asegurado1Poblacion
End Get
Set(ByVal value As String)
_asegurado1Poblacion = value
End Set
End Property
Private _asegurado1Provincia As String
Public Property Asegurado1Provincia() As String
Get
Return _asegurado1Provincia
End Get
Set(ByVal value As String)
_asegurado1Provincia = value
End Set
End Property
Private _asegurado1CodigoMunicipio As String
Public Property Asegurado1CodigoMunicipio() As String
Get
Return _asegurado1CodigoMunicipio
End Get
Set(ByVal value As String)
_asegurado1CodigoMunicipio = value
End Set
End Property
Private _asegurado1Telefono As String
Public Property Asegurado1Telefono() As String
Get
Return _asegurado1Telefono
End Get
Set(ByVal value As String)
_asegurado1Telefono = value
End Set
End Property
Private _asegurado1Email As String
Public Property Asegurado1Email() As String
Get
Return _asegurado1Email
End Get
Set(ByVal value As String)
_asegurado1Email = value
End Set
End Property
Private _asegurado1FechaNacimiento As Date
Public Property Asegurado1FechaNacimiento() As Date
Get
Return _asegurado1FechaNacimiento
End Get
Set(ByVal value As Date)
_asegurado1FechaNacimiento = value
End Set
End Property
Private _asegurado1Sexo As String
Public Property Asegurado1Sexo() As String
Get
Return _asegurado1Sexo
End Get
Set(ByVal value As String)
_asegurado1Sexo = value
End Set
End Property
Private _asegurado1Peso As Integer
Public Property Asegurado1Peso() As Integer
Get
Return _asegurado1Peso
End Get
Set(ByVal value As Integer)
_asegurado1Peso = value
End Set
End Property
Private _asegurado1Estatura As Integer
Public Property Asegurado1Estatura() As Integer
Get
Return _asegurado1Estatura
End Get
Set(ByVal value As Integer)
_asegurado1Estatura = value
End Set
End Property
Private _asegurado1Profesion As String
Public Property Asegurado1Profesion() As String
Get
Return _asegurado1Profesion
End Get
Set(ByVal value As String)
_asegurado1Profesion = value
End Set
End Property
Private _asegurado1Parentesco As String
Public Property Asegurado1Parentesco() As String
Get
Return _asegurado1Parentesco
End Get
Set(ByVal value As String)
_asegurado1Parentesco = value
End Set
End Property
Private _asegurado2CIF As String
Public Property Asegurado2CIF() As String
Get
Return _asegurado2CIF
End Get
Set(ByVal value As String)
_asegurado2CIF = value
End Set
End Property
Private _asegurado2Nombre As String
Public Property Asegurado2Nombre() As String
Get
Return _asegurado2Nombre
End Get
Set(ByVal value As String)
_asegurado2Nombre = value
End Set
End Property
Private _asegurado2Apellidos As String
Public Property Asegurado2Apellidos() As String
Get
Return _asegurado2Apellidos
End Get
Set(ByVal value As String)
_asegurado2Apellidos = value
End Set
End Property
Private _asegurado2Domicilio As String
Public Property Asegurado2Domicilio() As String
Get
Return _asegurado2Domicilio
End Get
Set(ByVal value As String)
_asegurado2Domicilio = value
End Set
End Property
Private _asegurado2CodigoPostal As String
Public Property Asegurado2CodigoPostal() As String
Get
Return _asegurado2CodigoPostal
End Get
Set(ByVal value As String)
_asegurado2CodigoPostal = value
End Set
End Property
Private _asegurado2Poblacion As String
Public Property Asegurado2Poblacion() As String
Get
Return _asegurado2Poblacion
End Get
Set(ByVal value As String)
_asegurado2Poblacion = value
End Set
End Property
Private _asegurado2Provincia As String
Public Property Asegurado2Provincia() As String
Get
Return _asegurado2Provincia
End Get
Set(ByVal value As String)
_asegurado2Provincia = value
End Set
End Property
Private _asegurado2CodigoMunicipio As String
Public Property Asegurado2CodigoMunicipio() As String
Get
Return _asegurado2CodigoMunicipio
End Get
Set(ByVal value As String)
_asegurado2CodigoMunicipio = value
End Set
End Property
Private _asegurado2Telefono As String
Public Property Asegurado2Telefono() As String
Get
Return _asegurado2Telefono
End Get
Set(ByVal value As String)
_asegurado2Telefono = value
End Set
End Property
Private _asegurado2Email As String
Public Property Asegurado2Email() As String
Get
Return _asegurado2Email
End Get
Set(ByVal value As String)
_asegurado2Email = value
End Set
End Property
Private _asegurado2FechaNacimiento As Date
Public Property Asegurado2FechaNacimiento() As Date
Get
Return _asegurado2FechaNacimiento
End Get
Set(ByVal value As Date)
_asegurado2FechaNacimiento = value
End Set
End Property
Private _asegurado2Sexo As String
Public Property Asegurado2Sexo() As String
Get
Return _asegurado2Sexo
End Get
Set(ByVal value As String)
_asegurado2Sexo = value
End Set
End Property
Private _asegurado2Peso As Integer
Public Property Asegurado2Peso() As Integer
Get
Return _asegurado2Peso
End Get
Set(ByVal value As Integer)
_asegurado2Peso = value
End Set
End Property
Private _asegurado2Estatura As Integer
Public Property Asegurado2Estatura() As Integer
Get
Return _asegurado2Estatura
End Get
Set(ByVal value As Integer)
_asegurado2Estatura = value
End Set
End Property
Private _asegurado2Profesion As String
Public Property Asegurado2Profesion() As String
Get
Return _asegurado2Profesion
End Get
Set(ByVal value As String)
_asegurado2Profesion = value
End Set
End Property
Private _asegurado2Parentesco As String
Public Property Asegurado2Parentesco() As String
Get
Return _asegurado2Parentesco
End Get
Set(ByVal value As String)
_asegurado2Parentesco = value
End Set
End Property
Private _asegurado3CIF As String
Public Property Asegurado3CIF() As String
Get
Return _asegurado3CIF
End Get
Set(ByVal value As String)
_asegurado3CIF = value
End Set
End Property
Private _asegurado3Nombre As String
Public Property Asegurado3Nombre() As String
Get
Return _asegurado3Nombre
End Get
Set(ByVal value As String)
_asegurado3Nombre = value
End Set
End Property
Private _asegurado3Apellidos As String
Public Property Asegurado3Apellidos() As String
Get
Return _asegurado3Apellidos
End Get
Set(ByVal value As String)
_asegurado3Apellidos = value
End Set
End Property
Private _asegurado3Domicilio As String
Public Property Asegurado3Domicilio() As String
Get
Return _asegurado3Domicilio
End Get
Set(ByVal value As String)
_asegurado3Domicilio = value
End Set
End Property
Private _asegurado3CodigoPostal As String
Public Property Asegurado3CodigoPostal() As String
Get
Return _asegurado3CodigoPostal
End Get
Set(ByVal value As String)
_asegurado3CodigoPostal = value
End Set
End Property
Private _asegurado3Poblacion As String
Public Property Asegurado3Poblacion() As String
Get
Return _asegurado3Poblacion
End Get
Set(ByVal value As String)
_asegurado3Poblacion = value
End Set
End Property
Private _asegurado3Provincia As String
Public Property Asegurado3Provincia() As String
Get
Return _asegurado3Provincia
End Get
Set(ByVal value As String)
_asegurado3Provincia = value
End Set
End Property
Private _asegurado3CodigoMunicipio As String
Public Property Asegurado3CodigoMunicipio() As String
Get
Return _asegurado3CodigoMunicipio
End Get
Set(ByVal value As String)
_asegurado3CodigoMunicipio = value
End Set
End Property
Private _asegurado3Telefono As String
Public Property Asegurado3Telefono() As String
Get
Return _asegurado3Telefono
End Get
Set(ByVal value As String)
_asegurado3Telefono = value
End Set
End Property
Private _asegurado3Email As String
Public Property Asegurado3Email() As String
Get
Return _asegurado3Email
End Get
Set(ByVal value As String)
_asegurado3Email = value
End Set
End Property
Private _asegurado3FechaNacimiento As Date
Public Property Asegurado3FechaNacimiento() As Date
Get
Return _asegurado3FechaNacimiento
End Get
Set(ByVal value As Date)
_asegurado3FechaNacimiento = value
End Set
End Property
Private _asegurado3Sexo As String
Public Property Asegurado3Sexo() As String
Get
Return _asegurado3Sexo
End Get
Set(ByVal value As String)
_asegurado3Sexo = value
End Set
End Property
Private _asegurado3Peso As Integer
Public Property Asegurado3Peso() As Integer
Get
Return _asegurado3Peso
End Get
Set(ByVal value As Integer)
_asegurado3Peso = value
End Set
End Property
Private _asegurado3Estatura As Integer
Public Property Asegurado3Estatura() As Integer
Get
Return _asegurado3Estatura
End Get
Set(ByVal value As Integer)
_asegurado3Estatura = value
End Set
End Property
Private _asegurado3Profesion As String
Public Property Asegurado3Profesion() As String
Get
Return _asegurado3Profesion
End Get
Set(ByVal value As String)
_asegurado3Profesion = value
End Set
End Property
Private _asegurado3Parentesco As String
Public Property Asegurado3Parentesco() As String
Get
Return _asegurado3Parentesco
End Get
Set(ByVal value As String)
_asegurado3Parentesco = value
End Set
End Property
Private _asegurado4CIF As String
Public Property Asegurado4CIF() As String
Get
Return _asegurado4CIF
End Get
Set(ByVal value As String)
_asegurado4CIF = value
End Set
End Property
Private _asegurado4Nombre As String
Public Property Asegurado4Nombre() As String
Get
Return _asegurado4Nombre
End Get
Set(ByVal value As String)
_asegurado4Nombre = value
End Set
End Property
Private _asegurado4Apellidos As String
Public Property Asegurado4Apellidos() As String
Get
Return _asegurado4Apellidos
End Get
Set(ByVal value As String)
_asegurado4Apellidos = value
End Set
End Property
Private _asegurado4Domicilio As String
Public Property Asegurado4Domicilio() As String
Get
Return _asegurado4Domicilio
End Get
Set(ByVal value As String)
_asegurado4Domicilio = value
End Set
End Property
Private _asegurado4CodigoPostal As String
Public Property Asegurado4CodigoPostal() As String
Get
Return _asegurado4CodigoPostal
End Get
Set(ByVal value As String)
_asegurado4CodigoPostal = value
End Set
End Property
Private _asegurado4Poblacion As String
Public Property Asegurado4Poblacion() As String
Get
Return _asegurado4Poblacion
End Get
Set(ByVal value As String)
_asegurado4Poblacion = value
End Set
End Property
Private _asegurado4Provincia As String
Public Property Asegurado4Provincia() As String
Get
Return _asegurado4Provincia
End Get
Set(ByVal value As String)
_asegurado4Provincia = value
End Set
End Property
Private _asegurado4CodigoMunicipio As String
Public Property Asegurado4CodigoMunicipio() As String
Get
Return _asegurado4CodigoMunicipio
End Get
Set(ByVal value As String)
_asegurado4CodigoMunicipio = value
End Set
End Property
Private _asegurado4Telefono As String
Public Property Asegurado4Telefono() As String
Get
Return _asegurado4Telefono
End Get
Set(ByVal value As String)
_asegurado4Telefono = value
End Set
End Property
Private _asegurado4Email As String
Public Property Asegurado4Email() As String
Get
Return _asegurado4Email
End Get
Set(ByVal value As String)
_asegurado4Email = value
End Set
End Property
Private _asegurado4FechaNacimiento As Date
Public Property Asegurado4FechaNacimiento() As Date
Get
Return _asegurado4FechaNacimiento
End Get
Set(ByVal value As Date)
_asegurado4FechaNacimiento = value
End Set
End Property
Private _asegurado4Sexo As String
Public Property Asegurado4Sexo() As String
Get
Return _asegurado4Sexo
End Get
Set(ByVal value As String)
_asegurado4Sexo = value
End Set
End Property
Private _asegurado4Peso As Integer
Public Property Asegurado4Peso() As Integer
Get
Return _asegurado4Peso
End Get
Set(ByVal value As Integer)
_asegurado4Peso = value
End Set
End Property
Private _asegurado4Estatura As String
Public Property Asegurado4Estatura() As String
Get
Return _asegurado4Estatura
End Get
Set(ByVal value As String)
_asegurado4Estatura = value
End Set
End Property
Private _asegurado4Profesion As String
Public Property Asegurado4Profesion() As String
Get
Return _asegurado4Profesion
End Get
Set(ByVal value As String)
_asegurado4Profesion = value
End Set
End Property
Private _asegurado4Parentesco As String
Public Property Asegurado4Parentesco() As String
Get
Return _asegurado4Parentesco
End Get
Set(ByVal value As String)
_asegurado4Parentesco = value
End Set
End Property
Private _pregunta1Asegurado1 As Boolean
Public Property Pregunta1Asegurado1() As Boolean
Get
Return _pregunta1Asegurado1
End Get
Set(ByVal value As Boolean)
_pregunta1Asegurado1 = value
End Set
End Property
Private _pregunta1Asegurado2 As Boolean
Public Property Pregunta1Asegurado2() As Boolean
Get
Return _pregunta1Asegurado2
End Get
Set(ByVal value As Boolean)
_pregunta1Asegurado2 = value
End Set
End Property
Private _pregunta1Asegurado3 As Boolean
Public Property Pregunta1Asegurado3() As Boolean
Get
Return _pregunta1Asegurado3
End Get
Set(ByVal value As Boolean)
_pregunta1Asegurado3 = value
End Set
End Property
Private _pregunta1Asegurado4 As Boolean
Public Property Pregunta1Asegurado4() As Boolean
Get
Return _pregunta1Asegurado4
End Get
Set(ByVal value As Boolean)
_pregunta1Asegurado4 = value
End Set
End Property
Private _pregunta2Asegurado1 As Boolean
Public Property Pregunta2Asegurado1() As Boolean
Get
Return _pregunta2Asegurado1
End Get
Set(ByVal value As Boolean)
_pregunta2Asegurado1 = value
End Set
End Property
Private _pregunta2Asegurado2 As Boolean
Public Property Pregunta2Asegurado2() As Boolean
Get
Return _pregunta2Asegurado2
End Get
Set(ByVal value As Boolean)
_pregunta2Asegurado2 = value
End Set
End Property
Private _pregunta2Asegurado3 As Boolean
Public Property Pregunta2Asegurado3() As Boolean
Get
Return _pregunta2Asegurado3
End Get
Set(ByVal value As Boolean)
_pregunta2Asegurado3 = value
End Set
End Property
Private _pregunta2Asegurado4 As Boolean
Public Property Pregunta2Asegurado4() As Boolean
Get
Return _pregunta2Asegurado4
End Get
Set(ByVal value As Boolean)
_pregunta2Asegurado4 = value
End Set
End Property
Private _pregunta3Asegurado1 As Boolean
Public Property Pregunta3Asegurado1() As Boolean
Get
Return _pregunta3Asegurado1
End Get
Set(ByVal value As Boolean)
_pregunta3Asegurado1 = value
End Set
End Property
Private _pregunta3Asegurado2 As Boolean
Public Property Pregunta3Asegurado2() As Boolean
Get
Return _pregunta3Asegurado2
End Get
Set(ByVal value As Boolean)
_pregunta3Asegurado2 = value
End Set
End Property
Private _pregunta3Asegurado3 As Boolean
Public Property Pregunta3Asegurado3() As Boolean
Get
Return _pregunta3Asegurado3
End Get
Set(ByVal value As Boolean)
_pregunta3Asegurado3 = value
End Set
End Property
Private _pregunta3Asegurado4 As Boolean
Public Property Pregunta3Asegurado4() As Boolean
Get
Return _pregunta3Asegurado4
End Get
Set(ByVal value As Boolean)
_pregunta3Asegurado4 = value
End Set
End Property
Private _pregunta4Asegurado1 As Boolean
Public Property Pregunta4Asegurado1() As Boolean
Get
Return _pregunta4Asegurado1
End Get
Set(ByVal value As Boolean)
_pregunta4Asegurado1 = value
End Set
End Property
Private _pregunta4Asegurado2 As Boolean
Public Property Pregunta4Asegurado2() As Boolean
Get
Return _pregunta4Asegurado2
End Get
Set(ByVal value As Boolean)
_pregunta4Asegurado2 = value
End Set
End Property
Private _pregunta4Asegurado3 As Boolean
Public Property Pregunta4Asegurado3() As Boolean
Get
Return _pregunta4Asegurado3
End Get
Set(ByVal value As Boolean)
_pregunta4Asegurado3 = value
End Set
End Property
Private _pregunta4Asegurado4 As Boolean
Public Property Pregunta4Asegurado4() As Boolean
Get
Return _pregunta4Asegurado4
End Get
Set(ByVal value As Boolean)
_pregunta4Asegurado4 = value
End Set
End Property
Private _pregunta5Asegurado1 As Boolean
Public Property Pregunta5Asegurado1() As Boolean
Get
Return _pregunta5Asegurado1
End Get
Set(ByVal value As Boolean)
_pregunta5Asegurado1 = value
End Set
End Property
Private _pregunta5Asegurado2 As Boolean
Public Property Pregunta5Asegurado2() As Boolean
Get
Return _pregunta5Asegurado2
End Get
Set(ByVal value As Boolean)
_pregunta5Asegurado2 = value
End Set
End Property
Private _pregunta5Asegurado3 As Boolean
Public Property Pregunta5Asegurado3() As Boolean
Get
Return _pregunta5Asegurado3
End Get
Set(ByVal value As Boolean)
_pregunta5Asegurado3 = value
End Set
End Property
Private _pregunta5Asegurado4 As Boolean
Public Property Pregunta5Asegurado4() As Boolean
Get
Return _pregunta5Asegurado4
End Get
Set(ByVal value As Boolean)
_pregunta5Asegurado4 = value
End Set
End Property
Private _observaciones As String
Public Property Observaciones() As String
Get
Return _observaciones
End Get
Set(ByVal value As String)
_observaciones = value
End Set
End Property
Private _asistenciaSanitaria As Boolean
Public Property AsistenciaSanitaria() As Boolean
Get
Return _asistenciaSanitaria
End Get
Set(ByVal value As Boolean)
_asistenciaSanitaria = value
End Set
End Property
Private _garantiaBucodental As Boolean
Public Property GarantiaBucodental() As Boolean
Get
Return _garantiaBucodental
End Get
Set(ByVal value As Boolean)
_garantiaBucodental = value
End Set
End Property
Private _reembolsoGastosCompletos As Boolean
Public Property ReembolsoGastosCompletos() As Boolean
Get
Return _reembolsoGastosCompletos
End Get
Set(ByVal value As Boolean)
_reembolsoGastosCompletos = value
End Set
End Property
Private _reembolsoGastosHospitalarios As Boolean
Public Property ReembolsoGastosHospitalarios() As Boolean
Get
Return _reembolsoGastosHospitalarios
End Get
Set(ByVal value As Boolean)
_reembolsoGastosHospitalarios = value
End Set
End Property
Private _reembolsoGranCobertura As Boolean
Public Property ReembolsoGranCobertura() As Boolean
Get
Return _reembolsoGranCobertura
End Get
Set(ByVal value As Boolean)
_reembolsoGranCobertura = value
End Set
End Property
Private _formaPago As String
Public Property FormaPago() As String
Get
Return _formaPago
End Get
Set(ByVal value As String)
_formaPago = value
End Set
End Property
Private _IBAN As String
Public Property IBAN() As String
Get
Return _IBAN
End Get
Set(ByVal value As String)
_IBAN = value
End Set
End Property
Private _fechaEfecto As Date
Public Property FechaEfecto() As Date
Get
Return _fechaEfecto
End Get
Set(ByVal value As Date)
_fechaEfecto = value
End Set
End Property
Private _fechaVencimiento As Date
Public Property FechaVencimiento() As Date
Get
Return _fechaVencimiento
End Get
Set(ByVal value As Date)
_fechaVencimiento = value
End Set
End Property
End Class

View File

@@ -0,0 +1,148 @@
Public Class TarificadorGenerico
Private _tomadorCIF As String
Public Property TomadorCIF() As String
Get
Return _tomadorCIF
End Get
Set(ByVal value As String)
_tomadorCIF = value
End Set
End Property
Private _tomadorNombre As String
Public Property TomadorNombre() As String
Get
Return _tomadorNombre
End Get
Set(ByVal value As String)
_tomadorNombre = value
End Set
End Property
Private _tomadorApellidos As String
Public Property TomadorApellidos() As String
Get
Return _tomadorApellidos
End Get
Set(ByVal value As String)
_tomadorApellidos = value
End Set
End Property
Private _tomadorTelefono As String
Public Property TomadorTelefono() As String
Get
Return _tomadorTelefono
End Get
Set(ByVal value As String)
_tomadorTelefono = value
End Set
End Property
Private _tomadorTelefono2 As String
Public Property TomadorTelefono2() As String
Get
Return _tomadorTelefono2
End Get
Set(ByVal value As String)
_tomadorTelefono2 = value
End Set
End Property
Private _tomadorEmail As String
Public Property TomadorEmail() As String
Get
Return _tomadorEmail
End Get
Set(ByVal value As String)
_tomadorEmail = value
End Set
End Property
Private _tomadorDomicilio As String
Public Property TomadorDomicilio() As String
Get
Return _tomadorDomicilio
End Get
Set(ByVal value As String)
_tomadorDomicilio = value
End Set
End Property
Private _tomadorCodigoPostal As String
Public Property TomadorCodigoPostal() As String
Get
Return _tomadorCodigoPostal
End Get
Set(ByVal value As String)
_tomadorCodigoPostal = value
End Set
End Property
Private _tomadorPoblacion As String
Public Property TomadorPoblacion() As String
Get
Return _tomadorPoblacion
End Get
Set(ByVal value As String)
_tomadorPoblacion = value
End Set
End Property
Private _tomadorProvincia As String
Public Property TomadorProvincia() As String
Get
Return _tomadorProvincia
End Get
Set(ByVal value As String)
_tomadorProvincia = value
End Set
End Property
Private _tomadorCodigoMunicipio As String
Public Property TomadorCodigoMunicipio() As String
Get
Return _tomadorCodigoMunicipio
End Get
Set(ByVal value As String)
_tomadorCodigoMunicipio = value
End Set
End Property
Private _formaPago As String
Public Property FormaPago() As String
Get
Return _formaPago
End Get
Set(ByVal value As String)
_formaPago = value
End Set
End Property
Private _IBAN As String
Public Property IBAN() As String
Get
Return _IBAN
End Get
Set(ByVal value As String)
_IBAN = value
End Set
End Property
Private _total As String
Public Property Total() As String
Get
Return _total
End Get
Set(ByVal value As String)
_total = value
End Set
End Property
Private _fechaEfecto As Date
Public Property FechaEfecto() As Date
Get
Return _fechaEfecto
End Get
Set(ByVal value As Date)
_fechaEfecto = value
End Set
End Property
Private _fechaVencimiento As Date
Public Property FechaVencimiento() As Date
Get
Return _fechaVencimiento
End Get
Set(ByVal value As Date)
_fechaVencimiento = value
End Set
End Property
End Class

View File

@@ -0,0 +1,306 @@
<Serializable>
Public Class TarificadorMaquinariaPlusUltra
Private _tomadorCIF As String
Public Property TomadorCIF() As String
Get
Return _tomadorCIF
End Get
Set(ByVal value As String)
_tomadorCIF = value
End Set
End Property
Private _tomadorNombre As String
Public Property TomadorNombre() As String
Get
Return _tomadorNombre
End Get
Set(ByVal value As String)
_tomadorNombre = value
End Set
End Property
Private _tomadorApellidos As String
Public Property TomadorApellidos() As String
Get
Return _tomadorApellidos
End Get
Set(ByVal value As String)
_tomadorApellidos = value
End Set
End Property
Private _tomadorTelefono As String
Public Property TomadorTelefono() As String
Get
Return _tomadorTelefono
End Get
Set(ByVal value As String)
_tomadorTelefono = value
End Set
End Property
Private _tomadorTelefono2 As String
Public Property TomadorTelefono2() As String
Get
Return _tomadorTelefono2
End Get
Set(ByVal value As String)
_tomadorTelefono2 = value
End Set
End Property
Private _tomadorEmail As String
Public Property TomadorEmail() As String
Get
Return _tomadorEmail
End Get
Set(ByVal value As String)
_tomadorEmail = value
End Set
End Property
Private _tomadorDomicilio As String
Public Property TomadorDomicilio() As String
Get
Return _tomadorDomicilio
End Get
Set(ByVal value As String)
_tomadorDomicilio = value
End Set
End Property
Private _tomadorCodigoPostal As String
Public Property TomadorCodigoPostal() As String
Get
Return _tomadorCodigoPostal
End Get
Set(ByVal value As String)
_tomadorCodigoPostal = value
End Set
End Property
Private _tomadorPoblacion As String
Public Property TomadorPoblacion() As String
Get
Return _tomadorPoblacion
End Get
Set(ByVal value As String)
_tomadorPoblacion = value
End Set
End Property
Private _tomadorProvincia As String
Public Property TomadorProvincia() As String
Get
Return _tomadorProvincia
End Get
Set(ByVal value As String)
_tomadorProvincia = value
End Set
End Property
Private _tomadorCodigoMunicipio As String
Public Property TomadorCodigoMunicipio() As String
Get
Return _tomadorCodigoMunicipio
End Get
Set(ByVal value As String)
_tomadorCodigoMunicipio = value
End Set
End Property
Private _TipoMaquinaria As String
Public Property TipoMaquinaria() As String
Get
Return _TipoMaquinaria
End Get
Set(ByVal value As String)
_TipoMaquinaria = value
End Set
End Property
Private _UsoAlQueSeDestina As String
Public Property UsoAlQueSeDestina() As String
Get
Return _UsoAlQueSeDestina
End Get
Set(ByVal value As String)
_UsoAlQueSeDestina = value
End Set
End Property
Private _ValorMaquinaria As Double
Public Property ValorMaquinaria() As Double
Get
Return _ValorMaquinaria
End Get
Set(ByVal value As Double)
_ValorMaquinaria = value
End Set
End Property
Private _valorAccesorios As Double
Public Property ValorAccesorios() As Double
Get
Return _valorAccesorios
End Get
Set(ByVal value As Double)
_valorAccesorios = value
End Set
End Property
Private _ExistenciasProductoRecolectado As String
Public Property ExistenciasProductoRecolectado() As String
Get
Return _ExistenciasProductoRecolectado
End Get
Set(ByVal value As String)
_ExistenciasProductoRecolectado = value
End Set
End Property
Private _marca As String
Public Property Marca() As String
Get
Return _marca
End Get
Set(ByVal value As String)
_marca = value
End Set
End Property
Private _modelo As String
Public Property Modelo() As String
Get
Return _modelo
End Get
Set(ByVal value As String)
_modelo = value
End Set
End Property
Private _fechaMatriculacion As Date
Public Property FechaMatriculacion() As Date
Get
Return _fechaMatriculacion
End Get
Set(ByVal value As Date)
_fechaMatriculacion = value
End Set
End Property
Private _Antiguedad As String
Public Property Antiguedad() As String
Get
Return _Antiguedad
End Get
Set(ByVal value As String)
_Antiguedad = value
End Set
End Property
Private _estado As String
Public Property Estado() As String
Get
Return _estado
End Get
Set(ByVal value As String)
_estado = value
End Set
End Property
Private _garantiaIncendio As String
Public Property GarantiaIncendio() As String
Get
Return _garantiaIncendio
End Get
Set(ByVal value As String)
_garantiaIncendio = value
End Set
End Property
Private _garantiaResponsabilidadCivil As String
Public Property GarantiaResponsabilidadCivil() As String
Get
Return _garantiaResponsabilidadCivil
End Get
Set(ByVal value As String)
_garantiaResponsabilidadCivil = value
End Set
End Property
Private _riesgosExtensivos As String
Public Property RiesgosExtensivos() As String
Get
Return _riesgosExtensivos
End Get
Set(ByVal value As String)
_riesgosExtensivos = value
End Set
End Property
Private _paralizacion As String
Public Property Paralizacion() As String
Get
Return _paralizacion
End Get
Set(ByVal value As String)
_paralizacion = value
End Set
End Property
Private _RoboExpoliacion As String
Public Property RoboExpoliacion() As String
Get
Return _RoboExpoliacion
End Get
Set(ByVal value As String)
_RoboExpoliacion = value
End Set
End Property
Private _lunas As String
Public Property Lunas() As String
Get
Return _lunas
End Get
Set(ByVal value As String)
_lunas = value
End Set
End Property
Private _formaPago As String
Public Property FormaPago() As String
Get
Return _formaPago
End Get
Set(ByVal value As String)
_formaPago = value
End Set
End Property
Private _IBAN As String
Public Property IBAN() As String
Get
Return _IBAN
End Get
Set(ByVal value As String)
_IBAN = value
End Set
End Property
Private _total As String
Public Property Total() As String
Get
Return _total
End Get
Set(ByVal value As String)
_total = value
End Set
End Property
Private _fechaEfecto As Date
Public Property FechaEfecto() As Date
Get
Return _fechaEfecto
End Get
Set(ByVal value As Date)
_fechaEfecto = value
End Set
End Property
Private _fechaVencimiento As Date
Public Property FechaVencimiento() As Date
Get
Return _fechaVencimiento
End Get
Set(ByVal value As Date)
_fechaVencimiento = value
End Set
End Property
End Class

View File

@@ -0,0 +1,441 @@
Public Class TarificadorMaquinaria
Private _tomadorCIF As String
Public Property TomadorCIF() As String
Get
Return _tomadorCIF
End Get
Set(ByVal value As String)
_tomadorCIF = value
End Set
End Property
Private _tomadorNombre As String
Public Property TomadorNombre() As String
Get
Return _tomadorNombre
End Get
Set(ByVal value As String)
_tomadorNombre = value
End Set
End Property
Private _tomadorApellidos As String
Public Property TomadorApellidos() As String
Get
Return _tomadorApellidos
End Get
Set(ByVal value As String)
_tomadorApellidos = value
End Set
End Property
Private _tomadorTelefono As String
Public Property TomadorTelefono() As String
Get
Return _tomadorTelefono
End Get
Set(ByVal value As String)
_tomadorTelefono = value
End Set
End Property
Private _tomadorEmail As String
Public Property TomadorEmail() As String
Get
Return _tomadorEmail
End Get
Set(ByVal value As String)
_tomadorEmail = value
End Set
End Property
Private _tomadorDomicilio As String
Public Property TomadorDomicilio() As String
Get
Return _tomadorDomicilio
End Get
Set(ByVal value As String)
_tomadorDomicilio = value
End Set
End Property
Private _tomadorCodigoPostal As String
Public Property TomadorCodigoPostal() As String
Get
Return _tomadorCodigoPostal
End Get
Set(ByVal value As String)
_tomadorCodigoPostal = value
End Set
End Property
Private _tomadorPoblacion As String
Public Property TomadorPoblacion() As String
Get
Return _tomadorPoblacion
End Get
Set(ByVal value As String)
_tomadorPoblacion = value
End Set
End Property
Private _tomadorProvincia As String
Public Property TomadorProvincia() As String
Get
Return _tomadorProvincia
End Get
Set(ByVal value As String)
_tomadorProvincia = value
End Set
End Property
Private _tomadorCodigoMunicipio As String
Public Property TomadorCodigoMunicipio() As String
Get
Return _tomadorCodigoMunicipio
End Get
Set(ByVal value As String)
_tomadorCodigoMunicipio = value
End Set
End Property
Private _propietarioCIF As String
Public Property PropietarioCIF() As String
Get
Return _propietarioCIF
End Get
Set(ByVal value As String)
_propietarioCIF = value
End Set
End Property
Private _propietarioNombre As String
Public Property PropietarioNombre() As String
Get
Return _propietarioNombre
End Get
Set(ByVal value As String)
_propietarioNombre = value
End Set
End Property
Private _propietarioApellidos As String
Public Property PropietarioApellidos() As String
Get
Return _propietarioApellidos
End Get
Set(ByVal value As String)
_propietarioApellidos = value
End Set
End Property
Private _propietarioTelefono As String
Public Property PropietarioTelefono() As String
Get
Return _propietarioTelefono
End Get
Set(ByVal value As String)
_propietarioTelefono = value
End Set
End Property
Private _propietarioEmail As String
Public Property PropietarioEmail() As String
Get
Return _propietarioEmail
End Get
Set(ByVal value As String)
_propietarioEmail = value
End Set
End Property
Private _propietarioDomicilio As String
Public Property PropietarioDomicilio() As String
Get
Return _propietarioDomicilio
End Get
Set(ByVal value As String)
_propietarioDomicilio = value
End Set
End Property
Private _propietarioCodigoPostal As String
Public Property PropietarioCodigoPostal() As String
Get
Return _propietarioCodigoPostal
End Get
Set(ByVal value As String)
_propietarioCodigoPostal = value
End Set
End Property
Private _propietarioPoblacion As String
Public Property PropietarioPoblacion() As String
Get
Return _propietarioPoblacion
End Get
Set(ByVal value As String)
_propietarioPoblacion = value
End Set
End Property
Private _propietarioProvincia As String
Public Property PropietarioProvincia() As String
Get
Return _propietarioProvincia
End Get
Set(ByVal value As String)
_propietarioProvincia = value
End Set
End Property
Private _propietarioCodigoMunicipio As String
Public Property PropietarioCodigoMunicipio() As String
Get
Return _propietarioCodigoMunicipio
End Get
Set(ByVal value As String)
_propietarioCodigoMunicipio = value
End Set
End Property
Private _matricula As String
Public Property Matricula() As String
Get
Return _matricula
End Get
Set(ByVal value As String)
_matricula = value
End Set
End Property
Private _usoAlQueSeDestina As String
Public Property UsoAlQueSeDestina() As String
Get
Return _usoAlQueSeDestina
End Get
Set(ByVal value As String)
_usoAlQueSeDestina = value
End Set
End Property
Private _antiguedadMaquinaria As Integer
Public Property AntiguedadMaquinaria() As Integer
Get
Return _antiguedadMaquinaria
End Get
Set(ByVal value As Integer)
_antiguedadMaquinaria = value
End Set
End Property
Private _NumeroMaquinasAseguradas As Integer
Public Property NumeroMaquinasAseguradas() As Integer
Get
Return _NumeroMaquinasAseguradas
End Get
Set(ByVal value As Integer)
_NumeroMaquinasAseguradas = value
End Set
End Property
Private _cosechadoras As Integer
Public Property Cosechadoras() As Integer
Get
Return _cosechadoras
End Get
Set(ByVal value As Integer)
_cosechadoras = value
End Set
End Property
Private _cosechadorasRotura As Integer
Public Property CosechadorasRotura() As Integer
Get
Return _cosechadorasRotura
End Get
Set(ByVal value As Integer)
_cosechadorasRotura = value
End Set
End Property
Private _tractoresAgricolas As Integer
Public Property TractoresAgricolas() As Integer
Get
Return _tractoresAgricolas
End Get
Set(ByVal value As Integer)
_tractoresAgricolas = value
End Set
End Property
Private _empacadoras As Integer
Public Property Empacadoras() As Integer
Get
Return _empacadoras
End Get
Set(ByVal value As Integer)
_empacadoras = value
End Set
End Property
Private _vendimiadoras As Integer
Public Property Vendimiadoras() As Integer
Get
Return _vendimiadoras
End Get
Set(ByVal value As Integer)
_vendimiadoras = value
End Set
End Property
Private _noAutoPropulsados As Integer
Public Property NoAutoPropulsados() As Integer
Get
Return _noAutoPropulsados
End Get
Set(ByVal value As Integer)
_noAutoPropulsados = value
End Set
End Property
Private _vibradoresOlivos As Integer
Public Property VibradoresOlivos() As Integer
Get
Return _vibradoresOlivos
End Get
Set(ByVal value As Integer)
_vibradoresOlivos = value
End Set
End Property
Private _cosechadorasCalculado As Double
Public Property CosechadorasCalculado() As Double
Get
Return _cosechadorasCalculado
End Get
Set(ByVal value As Double)
_cosechadorasCalculado = value
End Set
End Property
Private _cosechadorasRoturaCalculado As Double
Public Property CosechadorasRoturaCalculado() As Double
Get
Return _cosechadorasRoturaCalculado
End Get
Set(ByVal value As Double)
_cosechadorasRoturaCalculado = value
End Set
End Property
Private _tractoresAgricolasCalculado As Double
Public Property TractoresAgricolasCalculado() As Double
Get
Return _tractoresAgricolasCalculado
End Get
Set(ByVal value As Double)
_tractoresAgricolasCalculado = value
End Set
End Property
Private _empacadorasCalculado As Double
Public Property EmpacadorasCalculado() As Double
Get
Return _empacadorasCalculado
End Get
Set(ByVal value As Double)
_empacadorasCalculado = value
End Set
End Property
Private _vendimiadorasCalculado As Double
Public Property VendimiadorasCalculado() As Double
Get
Return _vendimiadorasCalculado
End Get
Set(ByVal value As Double)
_vendimiadorasCalculado = value
End Set
End Property
Private _noAutoPropulsadosCalculado As Double
Public Property NoAutoPropulsadosCalculado() As Double
Get
Return _noAutoPropulsadosCalculado
End Get
Set(ByVal value As Double)
_noAutoPropulsadosCalculado = value
End Set
End Property
Private _vibradoresOlivosCalculado As Double
Public Property VibradoresOlivosCalculado() As Double
Get
Return _vibradoresOlivosCalculado
End Get
Set(ByVal value As Double)
_vibradoresOlivosCalculado = value
End Set
End Property
Private _primaNetaMinima As Double
Public Property PrimaNetaMinima() As Double
Get
Return _primaNetaMinima
End Get
Set(ByVal value As Double)
_primaNetaMinima = value
End Set
End Property
Private _primaNeta As Double
Public Property PrimaNeta() As Double
Get
Return _primaNeta
End Get
Set(ByVal value As Double)
_primaNeta = value
End Set
End Property
Private _impuestos As Double
Public Property Impuestos() As Double
Get
Return _impuestos
End Get
Set(ByVal value As Double)
_impuestos = value
End Set
End Property
Private _primaTotal As Double
Public Property PrimaTotal() As Double
Get
Return _primaTotal
End Get
Set(ByVal value As Double)
_primaTotal = value
End Set
End Property
Private _condicionantes As String
Public Property Condicionantes() As String
Get
Return _condicionantes
End Get
Set(ByVal value As String)
_condicionantes = value
End Set
End Property
Private _observaciones As String
Public Property Observaciones() As String
Get
Return _observaciones
End Get
Set(ByVal value As String)
_observaciones = value
End Set
End Property
Private _daniosLuna As String
Public Property DaniosLuna() As String
Get
Return _daniosLuna
End Get
Set(ByVal value As String)
_daniosLuna = value
End Set
End Property
Private _IBAN As String
Public Property IBAN() As String
Get
Return _IBAN
End Get
Set(ByVal value As String)
_IBAN = value
End Set
End Property
Private _fechaEfecto As Date
Public Property FechaEfecto() As Date
Get
Return _fechaEfecto
End Get
Set(ByVal value As Date)
_fechaEfecto = value
End Set
End Property
Private _fechaVencimiento As Date
Public Property FechaVencimiento() As Date
Get
Return _fechaVencimiento
End Get
Set(ByVal value As Date)
_fechaVencimiento = value
End Set
End Property
End Class

View File

@@ -0,0 +1,432 @@
<Serializable>
Public Class Tractores
Private _peso As Double
Public Property Peso() As Double
Get
Return _peso
End Get
Set(ByVal value As Double)
_peso = value
End Set
End Property
Private _Marca As String
Public Property Marca() As String
Get
Return _Marca
End Get
Set(ByVal value As String)
_Marca = value
End Set
End Property
Private _modelo As String
Public Property Modelo() As String
Get
Return _modelo
End Get
Set(ByVal value As String)
_modelo = value
End Set
End Property
Private _version As String
Public Property Version() As String
Get
Return _version
End Get
Set(ByVal value As String)
_version = value
End Set
End Property
Private _fechaPrimeraMatriculacion As DateTime
Public Property FechaPrimeraMatriculacion() As DateTime
Get
Return _fechaPrimeraMatriculacion
End Get
Set(ByVal value As DateTime)
_fechaPrimeraMatriculacion = value
End Set
End Property
Private _tipoVehiculo As String
Public Property TipoVehiculo() As String
Get
Return _tipoVehiculo
End Get
Set(ByVal value As String)
_tipoVehiculo = value
End Set
End Property
Private _matricula As String
Public Property Matricula() As String
Get
Return _matricula
End Get
Set(ByVal value As String)
_matricula = value
End Set
End Property
Private _tomadorCodigoMunicipio As String
Public Property TomadorCodigoMunicipio() As String
Get
Return _tomadorCodigoMunicipio
End Get
Set(ByVal value As String)
_tomadorCodigoMunicipio = value
End Set
End Property
Private _tomadorDocumento As String
Public Property TomadorDocumento() As String
Get
Return _tomadorDocumento
End Get
Set(ByVal value As String)
_tomadorDocumento = value
End Set
End Property
Private _tomadorTipoDocumento As String
Public Property TomadorTipoDocumento() As String
Get
Return _tomadorTipoDocumento
End Get
Set(ByVal value As String)
_tomadorTipoDocumento = value
End Set
End Property
Private _tomadorNombre As String
Public Property TomadorNombre() As String
Get
Return _tomadorNombre
End Get
Set(ByVal value As String)
_tomadorNombre = value
End Set
End Property
Private _tomadorApellido1 As String
Public Property TomadorApellido1() As String
Get
Return _tomadorApellido1
End Get
Set(ByVal value As String)
_tomadorApellido1 = value
End Set
End Property
Private _tomadorApellido2 As String
Public Property TomadorApellido2() As String
Get
Return _tomadorApellido2
End Get
Set(ByVal value As String)
_tomadorApellido2 = value
End Set
End Property
Private _tomadorFechaNacimiento As Date
Public Property TomadorFechaNacimiento() As Date
Get
Return _tomadorFechaNacimiento
End Get
Set(ByVal value As Date)
_tomadorFechaNacimiento = value
End Set
End Property
Private _estadoCivil As String
Public Property EstadoCivil() As String
Get
Return _estadoCivil
End Get
Set(ByVal value As String)
_estadoCivil = value
End Set
End Property
Private _tomadorSexo As Int32
Public Property TomadorSexo() As Int32
Get
Return _tomadorSexo
End Get
Set(ByVal value As Int32)
_tomadorSexo = value
End Set
End Property
Private _tomadorVia As String
Public Property TomadorVia() As String
Get
Return _tomadorVia
End Get
Set(ByVal value As String)
_tomadorVia = value
End Set
End Property
Private _tomadorNombreVia As String
Public Property TomadorNombreVia() As String
Get
Return _tomadorNombreVia
End Get
Set(ByVal value As String)
_tomadorNombreVia = value
End Set
End Property
Private _tomadorNumeroVia As String
Public Property TomadorNumeroVia() As String
Get
Return _tomadorNumeroVia
End Get
Set(ByVal value As String)
_tomadorNumeroVia = value
End Set
End Property
Private _tomadorRestoVia As String
Public Property TomadorRestoVia() As String
Get
Return _tomadorRestoVia
End Get
Set(ByVal value As String)
_tomadorRestoVia = value
End Set
End Property
Private _tomadorCodigoPostal As String
Public Property TomadorCodigoPostal() As String
Get
Return _tomadorCodigoPostal
End Get
Set(ByVal value As String)
_tomadorCodigoPostal = value
End Set
End Property
Private _tomadorPoblacion As String
Public Property TomadorPoblacion() As String
Get
Return _tomadorPoblacion
End Get
Set(ByVal value As String)
_tomadorPoblacion = value
End Set
End Property
Private _tomadorTelefono1 As String
Public Property Telefono1() As String
Get
Return _tomadorTelefono1
End Get
Set(ByVal value As String)
_tomadorTelefono1 = value
End Set
End Property
Private _tomadorTelefono2 As String
Public Property Telefono2() As String
Get
Return _tomadorTelefono2
End Get
Set(ByVal value As String)
_tomadorTelefono2 = value
End Set
End Property
Private _correoElectronico As String
Public Property CorreoElectronico() As String
Get
Return _correoElectronico
End Get
Set(ByVal value As String)
_correoElectronico = value
End Set
End Property
Private _tipoPropietario As String
Public Property TipoPropietario() As String
Get
Return _tipoPropietario
End Get
Set(ByVal value As String)
_tipoPropietario = value
End Set
End Property
Private _propietarioDocumento As String
Public Property PropietarioDocumento() As String
Get
Return _propietarioDocumento
End Get
Set(ByVal value As String)
_propietarioDocumento = value
End Set
End Property
'Private _propietarioIdEntidad As String
'Public Property PropietarioIdEntidad() As String
' Get
' Return _propietarioIdEntidad
' End Get
' Set(ByVal value As String)
' _propietarioIdEntidad = value
' End Set
'End Property
Private _propietarioNombre As String
Public Property PropietarioNombre() As String
Get
Return _propietarioNombre
End Get
Set(ByVal value As String)
_propietarioNombre = value
End Set
End Property
Private _propietarioApellido1 As String
Public Property PropietarioApellido1() As String
Get
Return _propietarioApellido1
End Get
Set(ByVal value As String)
_propietarioApellido1 = value
End Set
End Property
Private _propietarioApellido2 As String
Public Property PropietarioApellido2() As String
Get
Return _propietarioApellido2
End Get
Set(ByVal value As String)
_propietarioApellido2 = value
End Set
End Property
Private _propietarioFechaNacimiento As Date
Public Property PropietarioFechaNacimiento() As Date
Get
Return _propietarioFechaNacimiento
End Get
Set(ByVal value As Date)
_propietarioFechaNacimiento = value
End Set
End Property
Private _propietarioSexo As Int32
Public Property PropietarioSexo() As Int32
Get
Return _propietarioSexo
End Get
Set(ByVal value As Int32)
_propietarioSexo = value
End Set
End Property
Private _tipoConductor As String
Public Property TipoConductor() As String
Get
Return _tipoConductor
End Get
Set(ByVal value As String)
_tipoConductor = value
End Set
End Property
Private _fechaPermisoConduccion As Date
Public Property FechaPermisoConduccion() As Date
Get
Return _fechaPermisoConduccion
End Get
Set(ByVal value As Date)
_fechaPermisoConduccion = value
End Set
End Property
Private _conductorIdEntidad As String
Public Property ConductorIdEntidad() As String
Get
Return _conductorIdEntidad
End Get
Set(ByVal value As String)
_conductorIdEntidad = value
End Set
End Property
Private _conductorDocumento As String
Public Property ConductorDocumento() As String
Get
Return _conductorDocumento
End Get
Set(ByVal value As String)
_conductorDocumento = value
End Set
End Property
Private _conductorNombre As String
Public Property ConductorNombre() As String
Get
Return _conductorNombre
End Get
Set(ByVal value As String)
_conductorNombre = value
End Set
End Property
Private _conductorApellido1 As String
Public Property ConductorApellido1() As String
Get
Return _conductorApellido1
End Get
Set(ByVal value As String)
_conductorApellido1 = value
End Set
End Property
Private _conductorApellido2 As String
Public Property ConductorApellido2() As String
Get
Return _conductorApellido2
End Get
Set(ByVal value As String)
_conductorApellido2 = value
End Set
End Property
Private _conductorSexo As Int32
Public Property ConductorSexo() As Int32
Get
Return _conductorSexo
End Get
Set(ByVal value As Int32)
_conductorSexo = value
End Set
End Property
Private _conductorFechaNacimiento As Date
Public Property ConductorFechaNacimiento() As Date
Get
Return _conductorFechaNacimiento
End Get
Set(ByVal value As Date)
_conductorFechaNacimiento = value
End Set
End Property
Private _fechaEfecto As String
Public Property FechaEfecto() As String
Get
Return _fechaEfecto
End Get
Set(ByVal value As String)
_fechaEfecto = value
End Set
End Property
Private _iban As String
Public Property IBAN() As String
Get
Return _iban
End Get
Set(ByVal value As String)
_iban = value
End Set
End Property
Private _combinacionAccidentes As String
Public Property CombinacionAccidentes() As String
Get
Return _combinacionAccidentes
End Get
Set(ByVal value As String)
_combinacionAccidentes = value
End Set
End Property
Private _usoVehiculo As String
Public Property UsoVehiculo() As String
Get
Return _usoVehiculo
End Get
Set(ByVal value As String)
_usoVehiculo = value
End Set
End Property
Private _primaTotal As String
Public Property PrimaTotal() As String
Get
Return _primaTotal
End Get
Set(ByVal value As String)
_primaTotal = value
End Set
End Property
End Class

View File

@@ -0,0 +1,268 @@
<Serializable>
Public Class TractoresEuropAssistance
Private _Matricula As String
Public Property Matricula() As String
Get
Return _Matricula
End Get
Set(ByVal value As String)
_Matricula = value
End Set
End Property
Private _Marca As String
Public Property Marca() As String
Get
Return _Marca
End Get
Set(ByVal value As String)
_Marca = value
End Set
End Property
Private _Modelo As String
Public Property Modelo() As String
Get
Return _Modelo
End Get
Set(ByVal value As String)
_Modelo = value
End Set
End Property
Private _Version As String
Public Property Version() As String
Get
Return _Version
End Get
Set(ByVal value As String)
_Version = value
End Set
End Property
Private _FechaMatriculacion As Date
Public Property FechaMatriculacion() As Date
Get
Return _FechaMatriculacion
End Get
Set(ByVal value As Date)
_FechaMatriculacion = value
End Set
End Property
Private _CIF As String
Public Property CIF() As String
Get
Return _CIF
End Get
Set(ByVal value As String)
_CIF = value
End Set
End Property
Private _RazonSocial As String
Public Property RazonSocial() As String
Get
Return _RazonSocial
End Get
Set(ByVal value As String)
_RazonSocial = value
End Set
End Property
'Private _Nombre As String
'Public Property Nombre() As String
' Get
' Return _Nombre
' End Get
' Set(ByVal value As String)
' _Nombre = value
' End Set
'End Property
'Private _Apellido1 As String
'Public Property Apellido1() As String
' Get
' Return _Apellido1
' End Get
' Set(ByVal value As String)
' _Apellido1 = value
' End Set
'End Property
'Private _Apellido2 As String
'Public Property Apellido2() As String
' Get
' Return _Apellido2
' End Get
' Set(ByVal value As String)
' _Apellido2 = value
' End Set
'End Property
Private _FechaNacimiento As Date
Public Property FechaNacimiento() As Date
Get
Return _FechaNacimiento
End Get
Set(ByVal value As Date)
_FechaNacimiento = value
End Set
End Property
Private _EstadoCivil As String
Public Property EstadoCivil() As String
Get
Return _EstadoCivil
End Get
Set(ByVal value As String)
_EstadoCivil = value
End Set
End Property
Private _Sexo As String
Public Property Sexo() As String
Get
Return _Sexo
End Get
Set(ByVal value As String)
_Sexo = value
End Set
End Property
Private _Telefono1 As String
Public Property Telefono1() As String
Get
Return _Telefono1
End Get
Set(ByVal value As String)
_Telefono1 = value
End Set
End Property
Private _Telefono2 As String
Public Property Telefono2() As String
Get
Return _Telefono2
End Get
Set(ByVal value As String)
_Telefono2 = value
End Set
End Property
Private _Email As String
Public Property Email() As String
Get
Return _Email
End Get
Set(ByVal value As String)
_Email = value
End Set
End Property
Private _fechaEfecto As String
Public Property FechaEfecto() As String
Get
Return _fechaEfecto
End Get
Set(ByVal value As String)
_fechaEfecto = value
End Set
End Property
Private _fechaVencimiento As String
Public Property FechaVencimiento() As String
Get
Return _fechaVencimiento
End Get
Set(ByVal value As String)
_fechaVencimiento = value
End Set
End Property
'Private _TipoVia As String
'Public Property TipoVia() As String
' Get
' Return _TipoVia
' End Get
' Set(ByVal value As String)
' _TipoVia = value
' End Set
'End Property
'Private _NombreVia As String
'Public Property NombreVia() As String
' Get
' Return _NombreVia
' End Get
' Set(ByVal value As String)
' _NombreVia = value
' End Set
'End Property
'Private _RestoVia As String
'Public Property RestoVia() As String
' Get
' Return _RestoVia
' End Get
' Set(ByVal value As String)
' _RestoVia = value
' End Set
'End Property
Private _Direccion As String
Public Property Direccion() As String
Get
Return _Direccion
End Get
Set(ByVal value As String)
_Direccion = value
End Set
End Property
Private _CodigoPostal As String
Public Property CodigoPostal() As String
Get
Return _CodigoPostal
End Get
Set(ByVal value As String)
_CodigoPostal = value
End Set
End Property
Private _CodigoPoblacion As String
Public Property CodigoPoblacion() As String
Get
Return _CodigoPoblacion
End Get
Set(ByVal value As String)
_CodigoPoblacion = value
End Set
End Property
Private _Poblacion As String
Public Property Poblacion() As String
Get
Return _Poblacion
End Get
Set(ByVal value As String)
_Poblacion = value
End Set
End Property
Private _CodigoProvincia As String
Public Property CodigoProvincia() As String
Get
Return _CodigoProvincia
End Get
Set(ByVal value As String)
_CodigoProvincia = value
End Set
End Property
Private _Provinica As String
Public Property Provincia() As String
Get
Return _Provinica
End Get
Set(ByVal value As String)
_Provinica = value
End Set
End Property
Private _IBAN As String
Public Property IBAN() As String
Get
Return _IBAN
End Get
Set(ByVal value As String)
_IBAN = value
End Set
End Property
End Class

View File

@@ -0,0 +1,161 @@
<Serializable>
Public Class TransportexAXA
Private _tomadorCIF As String
Public Property TomadorCIF() As String
Get
Return _tomadorCIF
End Get
Set(ByVal value As String)
_tomadorCIF = value
End Set
End Property
Private _tomadorNombre As String
Public Property TomadorNombre() As String
Get
Return _tomadorNombre
End Get
Set(ByVal value As String)
_tomadorNombre = value
End Set
End Property
Private _tomadorApellidos As String
Public Property TomadorApellidos() As String
Get
Return _tomadorApellidos
End Get
Set(ByVal value As String)
_tomadorApellidos = value
End Set
End Property
Private _tomadorTelefono As String
Public Property TomadorTelefono() As String
Get
Return _tomadorTelefono
End Get
Set(ByVal value As String)
_tomadorTelefono = value
End Set
End Property
Private _tomadorEmail As String
Public Property TomadorEmail() As String
Get
Return _tomadorEmail
End Get
Set(ByVal value As String)
_tomadorEmail = value
End Set
End Property
Private _tomadorDomicilio As String
Public Property TomadorDomicilio() As String
Get
Return _tomadorDomicilio
End Get
Set(ByVal value As String)
_tomadorDomicilio = value
End Set
End Property
Private _tomadorCodigoPostal As String
Public Property TomadorCodigoPostal() As String
Get
Return _tomadorCodigoPostal
End Get
Set(ByVal value As String)
_tomadorCodigoPostal = value
End Set
End Property
Private _tomadorPoblacion As String
Public Property TomadorPoblacion() As String
Get
Return _tomadorPoblacion
End Get
Set(ByVal value As String)
_tomadorPoblacion = value
End Set
End Property
Private _tomadorProvincia As String
Public Property TomadorProvincia() As String
Get
Return _tomadorProvincia
End Get
Set(ByVal value As String)
_tomadorProvincia = value
End Set
End Property
Private _tomadorCodigoMunicipio As String
Public Property TomadorCodigoMunicipio() As String
Get
Return _tomadorCodigoMunicipio
End Get
Set(ByVal value As String)
_tomadorCodigoMunicipio = value
End Set
End Property
Private _matriculaRemolque As String
Public Property MatriculaRemolque() As String
Get
Return _matriculaRemolque
End Get
Set(ByVal value As String)
_matriculaRemolque = value
End Set
End Property
Private _calidadTomador As String
Public Property CalidadTomador() As String
Get
Return _calidadTomador
End Get
Set(ByVal value As String)
_calidadTomador = value
End Set
End Property
Private _medioTransporte As String
Public Property MedioTransporte() As String
Get
Return _medioTransporte
End Get
Set(ByVal value As String)
_medioTransporte = value
End Set
End Property
Private _capitalElegido As String
Public Property CapitalElegido() As String
Get
Return _capitalElegido
End Get
Set(ByVal value As String)
_capitalElegido = value
End Set
End Property
Private _IBAN As String
Public Property IBAN() As String
Get
Return _IBAN
End Get
Set(ByVal value As String)
_IBAN = value
End Set
End Property
Private _fechaEfecto As Date
Public Property FechaEfecto() As Date
Get
Return _fechaEfecto
End Get
Set(ByVal value As Date)
_fechaEfecto = value
End Set
End Property
Private _fechaVencimiento As Date
Public Property FechaVencimiento() As Date
Get
Return _fechaVencimiento
End Get
Set(ByVal value As Date)
_fechaVencimiento = value
End Set
End Property
End Class

View File

@@ -0,0 +1,276 @@
Imports bdGestionAsegasa
Imports bdGestionAsegasa.polizassg
Imports tsl5
Imports tsl5.Extensiones
Imports bdGestionAsegasa.Utilidades
Imports DevExpress.Spreadsheet
Imports tsl5.Enumeraciones
Imports System.Security
Imports bdGestionAsegasa.siniestros_eiac
Public Class ProcesosSiniestros
Public Shared Sub IncorporaSiniestrosEIACV6()
Try
Dim bd = bdGestionAsegasa.gestionasegasaEntities.NuevoContextoCN()
Dim ltpa = bd.enumeraciones.Where(Function(x) x.gruposenumeraciones.Grupo = "TIPP").ToList
Dim tipo As Integer = bdGestionAsegasa.ficheroscompanias.TipoFicheroCompania.SINIESTROS_EIAC
Dim ficspen = bd.ficheroscompanias.Where(Function(x) x.FechaProcesado Is Nothing AndAlso x.FechaError Is Nothing AndAlso x.Tipo = bdGestionAsegasa.ficheroscompanias.TipoFicheroCompania.SINIESTROS_EIAC AndAlso x.Version = "6.0").OrderBy(Function(x) x.idFichero).ToList
For Each f In ficspen
Try
Dim DatosEIAC As ProcesosEIAC_V6.ProcesosEIAC = tsl5.Utilidades.Deserializa(f.Fichero, GetType(ProcesosEIAC_V6.ProcesosEIAC), True)
If DatosEIAC.Objetos IsNot Nothing AndAlso DatosEIAC.Objetos.Items IsNot Nothing Then
Dim lSins = DatosEIAC.Objetos.Items.Where(Function(x) x.GetType Is GetType(ProcesosEIAC_V6.tipo_siniestro)).Cast(Of ProcesosEIAC_V6.tipo_siniestro)
For Each s In lSins
Dim sins As List(Of siniestros) = Nothing
Dim seiac = bd.siniestros_eiac.FirstOrDefault(Function(x) x.idSiniestroEntidad = s.DatosSiniestro.IdSiniestroEntidad)
If seiac Is Nothing Then
seiac = New siniestros_eiac
seiac.idSiniestroEntidad = s.DatosSiniestro.IdSiniestroEntidad
seiac.idFicheroCompania = f.idFichero
seiac.idCompania = f.idCompania
bd.siniestros_eiac.AddObject(seiac)
End If
With seiac
.NumeroPoliza = s.DatosPoliza.IdPoliza
Dim pol = bd.polizassg.Where(Function(x) x.NumeroPoliza = .NumeroPoliza AndAlso x.idCompania = .idCompania).OrderByDescending(Function(x) x.NumeroSuplemento).FirstOrDefault
If pol IsNot Nothing Then .idPoliza = pol.idPoliza
.NumeroSuplemento = s.DatosPoliza.NumeroSuplemento
.FechaDeclaracion = s.DatosSiniestro.FechaDeclaracion
.FechaOcurrencia = s.DatosSiniestro.FechaOcurrencia
.PosicionSiniestro = bdGestionAsegasa.siniestros_eiac.ObtienePosicionSiniestroV6(s.DatosSiniestro.PosicionSiniestro)
.DescripcionSiniestro = s.DatosSiniestro.DescripcionSiniestro.Acortar(2048)
.TipologiaSiniestro = s.DatosSiniestro.TipologiaSiniestro
.ImporteIndemnizacion = s.DatosSiniestro.ImporteIndemnizacion
.ImporteReserva = s.DatosSiniestro.ImporteReserva
If s.DatosSiniestro.LugarSiniestro IsNot Nothing Then
If seiac.direcciones Is Nothing Then
seiac.direcciones = New direcciones
End If
seiac.direcciones.Direccion = s.DatosSiniestro.LugarSiniestro.ClaseVia & " " & s.DatosSiniestro.LugarSiniestro.NombreVia & " " & s.DatosSiniestro.LugarSiniestro.OtrosDatosVia
seiac.direcciones.CodigoPostal = s.DatosSiniestro.LugarSiniestro.CodigoPostal
Dim codmun = bd.ObtieneCodigoMunicipioMasCoincidente(seiac.direcciones.CodigoPostal, s.DatosSiniestro.LugarSiniestro.Poblacion, True)
If codmun = "" Then
seiac.direcciones.Direccion &= " " & s.DatosSiniestro.LugarSiniestro.Poblacion
Else
seiac.direcciones.CodigoMunicipio = codmun
End If
seiac.direcciones.Direccion = seiac.direcciones.Direccion.Acortar(200)
End If
If s.DatosSiniestro.SituacionesSiniestro IsNot Nothing Then
Dim yaincorporados As New List(Of Integer)
For Each sit In s.DatosSiniestro.SituacionesSiniestro
Dim NumeroOrden As Integer = sit.NumeroOrden
If NumeroOrden = 0 Then NumeroOrden = sit.GetHashCode
If yaincorporados.Contains(NumeroOrden) = False Then
Dim est = seiac.estadossiniestros_eiac.FirstOrDefault(Function(x) x.NumeroOrden = NumeroOrden)
If est Is Nothing Then
est = New estadossiniestros_eiac
est.NumeroOrden = NumeroOrden
seiac.estadossiniestros_eiac.Add(est)
End If
est.SituacionSiniestro = bdGestionAsegasa.estadossiniestros_eiac.ObtieneSituacionSiniestroV6(sit.SituacionSiniestro)
est.DescripcionSituacion = sit.DescripcionSituacion.Acortar(45)
yaincorporados.Add(NumeroOrden)
End If
Next
End If
If s.DatosSiniestro.PagosSiniestro IsNot Nothing Then
Dim yaincorporados As New List(Of Integer)
For Each pag In s.DatosSiniestro.PagosSiniestro
Dim NumeroOrden As Integer = pag.NumeroOrden
If NumeroOrden = 0 Then NumeroOrden = pag.GetHashCode
If yaincorporados.Contains(NumeroOrden) = False Then
Dim ps = seiac.pagossiniestros_eiac.FirstOrDefault(Function(x) x.NumeroOrden = NumeroOrden)
If ps Is Nothing Then
ps = New pagossiniestros_eiac
ps.NumeroOrden = NumeroOrden
seiac.pagossiniestros_eiac.Add(ps)
End If
ps.FechaPago = pag.FechaPago
ps.FechaLiquidacion = pag.FechaLiquidacion
ps.ImportePago = ps.ImportePago
ps.DescripcionPago = ps.DescripcionPago.Acortar(255)
ps.idTipoPago = bdGestionAsegasa.siniestros_eiac.ObtenerTipoPagoV6(pag.FormaPago, ltpa)
If pag.FormaPago IsNot Nothing AndAlso pag.FormaPago.DatosCuentaCorriente IsNot Nothing Then
ps.IBAN = pag.FormaPago.DatosCuentaCorriente.IBAN
End If
yaincorporados.Add(NumeroOrden)
End If
Next
End If
If s.DatosSiniestro.AccionesSiniestro IsNot Nothing Then
Dim yaincorporados As New List(Of Integer)
For Each accs In s.DatosSiniestro.AccionesSiniestro
Dim NumeroOrden As Integer = accs.NumeroOrden
If NumeroOrden = 0 Then NumeroOrden = accs.GetHashCode
If yaincorporados.Contains(NumeroOrden) = False Then
Dim acs = seiac.accionessiniestros_eiac.FirstOrDefault(Function(x) x.NumeroOrden = NumeroOrden)
If acs Is Nothing Then
acs = New accionessiniestros_eiac
acs.NumeroOrden = NumeroOrden
seiac.accionessiniestros_eiac.Add(acs)
End If
acs.AccionSiniestro = bdGestionAsegasa.accionessiniestros_eiac.ObtieneAccionSiniestroV6(accs.AccionSiniestro)
acs.FechaAccion = accs.FechaAccion
acs.DescripcionAccion = accs.DescripcionAccion
acs.SituacionAccion = bdGestionAsegasa.accionessiniestros_eiac.ObtieneSituacionAccionV6(accs.SituacionAccion)
yaincorporados.Add(NumeroOrden)
End If
Next
End If
If s.DatosSiniestro.Expedientes IsNot Nothing Then
Dim yaincorporados As New List(Of String)
For Each exp In s.DatosSiniestro.Expedientes
Dim NumeroExpediente As String = exp.NumeroExpediente
If NumeroExpediente.NothingAVacio = "" Then NumeroExpediente = exp.GetHashCode.ToString
If yaincorporados.Contains(NumeroExpediente) = False Then
Dim ep = seiac.expedientessiniestros_eiac.FirstOrDefault(Function(x) x.NumeroExpediente = NumeroExpediente)
If ep Is Nothing Then
ep = New expedientessiniestros_eiac
ep.NumeroExpediente = NumeroExpediente
seiac.expedientessiniestros_eiac.Add(ep)
End If
ep.EstadoExpediente = bdGestionAsegasa.expedientessiniestros_eiac.ObtieneEstadoExpedienteV6(exp.EstadoExpediente)
ep.ImporteReserva = exp.ImporteReserva
ep.TotalPagos = exp.TotalPagos
ep.TotalRecobros = exp.TotalRecobros
ep.FechaInicio = exp.FechaInicio
ep.FechaFin = exp.FechaFin
ep.NumeroOrden = exp.NumeroOrden
yaincorporados.Add(NumeroExpediente)
End If
Next
End If
If .siniestros Is Nothing Then
Dim fi = .FechaOcurrencia.AddDays(-5)
Dim ff = .FechaOcurrencia.AddDays(5)
sins = bd.siniestros.Where(Function(x) x.polizassg.NumeroPoliza = .NumeroPoliza AndAlso x.FechaAccidente.HasValue AndAlso x.FechaAccidente.Value >= fi AndAlso x.FechaAccidente.Value <= ff).ToList
If sins.Count = 1 Then
.siniestros = sins(0)
End If
End If
End With
Dim bModificados As Boolean = False
If bd.ObjectStateManager.GetObjectStateEntries(EntityState.Added).Count > 0 Then
bModificados = True
seiac.SituacionAsegasa = SituacionAsegasaENUM.NUEVO
seiac.FechaSituacion = Now
Else
Dim prmods = bd.ObjectStateManager.GetObjectStateEntries(EntityState.Modified)
If prmods.Count > 0 Then
For Each pr In prmods
Dim original = pr.OriginalValues
Dim nuevosvalores = pr.CurrentValues
For i = 0 To original.FieldCount - 1
If original.GetValue(i).GetHashCode <> nuevosvalores.GetValue(i).GetHashCode Then
bModificados = True
Exit For
End If
Next
If bModificados Then Exit For
Next
End If
End If
If bModificados Then
If seiac.SituacionAsegasa.HasValue = False AndAlso seiac.SituacionAsegasa.Value <> seiac.SituacionAsegasa = SituacionAsegasaENUM.DESCARTADO Then
seiac.SituacionAsegasa = SituacionAsegasaENUM.MODIFICADO
seiac.FechaSituacion = Now
End If
Dim nact As New actualizacionessiniestros_eiac
With nact
.siniestros_eiac = seiac
.Fecha = Now
.idFicheroCompania = f.idFichero
End With
bd.actualizacionessiniestros_eiac.AddObject(nact)
If seiac.SituacionAsegasa.Value <> seiac.SituacionAsegasa = SituacionAsegasaENUM.DESCARTADO Then
If seiac.idPoliza.HasValue = False Then
seiac.SituacionAsegasa = SituacionAsegasaENUM.POLIZA_NO_ENCONTRADA
Else
If sins.Count = 0 Then
seiac.SituacionAsegasa = SituacionAsegasaENUM.SINIESTRO_NO_ENCONTRADO
ElseIf sins.Count > 1 Then
seiac.SituacionAsegasa = SituacionAsegasaENUM.VARIOS_SINIESTROS_POSIBLES
End If
End If
End If
bd.SaveChanges()
End If
Next
End If
f.FechaProcesado = Now
bd.SaveChanges()
Catch ex As Exception
f.FechaError = Now
bd.SaveChanges()
Call AñadeLog(tsl5.Enumeraciones.TipoLog.Fallo, "En IncorporaSiniestrosEIACV6.", "Rutina: IncorporaSiniestrosEIACV6. Fichero:" & f.NombreFichero & " " & gestionasegasaEntities.bdga.Servidor & " " & ex.Message, ex)
End Try
Next
Catch ex As Exception
Call AñadeLog(tsl5.Enumeraciones.TipoLog.Fallo, "En IncorporaSiniestrosEIACV6.", "Rutina: IncorporaSiniestrosEIACV6. " & gestionasegasaEntities.bdga.Servidor & " " & ex.Message, ex)
End Try
End Sub
Public Shared Sub IncorporaExpSiniestrosEIACV6()
Try
Dim bd = bdGestionAsegasa.gestionasegasaEntities.NuevoContextoCN()
Dim ltpa = bd.enumeraciones.Where(Function(x) x.gruposenumeraciones.Grupo = "TIPP").ToList
Dim tipo As Integer = bdGestionAsegasa.ficheroscompanias.TipoFicheroCompania.SINIESTROS_EIAC
Dim ficspen = bd.ficheroscompanias.Where(Function(x) x.Tipo = bdGestionAsegasa.ficheroscompanias.TipoFicheroCompania.SINIESTROS_EIAC AndAlso x.Version = "6.0").OrderBy(Function(x) x.idFichero).ToList
For Each f In ficspen
Try
Dim DatosEIAC As ProcesosEIAC_V6.ProcesosEIAC = tsl5.Utilidades.Deserializa(f.Fichero, GetType(ProcesosEIAC_V6.ProcesosEIAC), True)
If DatosEIAC.Objetos IsNot Nothing AndAlso DatosEIAC.Objetos.Items IsNot Nothing Then
Dim lSins = DatosEIAC.Objetos.Items.Where(Function(x) x.GetType Is GetType(ProcesosEIAC_V6.tipo_siniestro)).Cast(Of ProcesosEIAC_V6.tipo_siniestro)
For Each s In lSins
Dim sins As List(Of siniestros) = Nothing
Dim seiac = bd.siniestros_eiac.FirstOrDefault(Function(x) x.idSiniestroEntidad = s.DatosSiniestro.IdSiniestroEntidad)
If seiac IsNot Nothing Then
If s.DatosSiniestro.Expedientes IsNot Nothing Then
Dim yaincorporados As New List(Of String)
For Each exp In s.DatosSiniestro.Expedientes
Dim NumeroExpediente As String = exp.NumeroExpediente
If NumeroExpediente.NothingAVacio = "" Then NumeroExpediente = exp.GetHashCode.ToString
If yaincorporados.Contains(NumeroExpediente) = False Then
Dim ep = seiac.expedientessiniestros_eiac.FirstOrDefault(Function(x) x.NumeroExpediente = NumeroExpediente)
If ep Is Nothing Then
ep = New expedientessiniestros_eiac
ep.NumeroExpediente = NumeroExpediente
seiac.expedientessiniestros_eiac.Add(ep)
End If
ep.EstadoExpediente = bdGestionAsegasa.expedientessiniestros_eiac.ObtieneEstadoExpedienteV6(exp.EstadoExpediente)
ep.ImporteReserva = exp.ImporteReserva
ep.TotalPagos = exp.TotalPagos
ep.TotalRecobros = exp.TotalRecobros
ep.FechaInicio = exp.FechaInicio
ep.FechaFin = exp.FechaFin
ep.NumeroOrden = exp.NumeroOrden
yaincorporados.Add(NumeroExpediente)
End If
Next
bd.SaveChanges()
End If
End If
Next
End If
' f.FechaProcesado = Now
bd.SaveChanges()
Catch ex As Exception
f.FechaError = Now
bd.SaveChanges()
Call AñadeLog(tsl5.Enumeraciones.TipoLog.Fallo, "En IncorporaSiniestrosEIACV6.", "Rutina: IncorporaSiniestrosEIACV6. Fichero:" & f.NombreFichero & " " & gestionasegasaEntities.bdga.Servidor & " " & ex.Message, ex)
End Try
Next
Catch ex As Exception
Call AñadeLog(tsl5.Enumeraciones.TipoLog.Fallo, "En IncorporaSiniestrosEIACV6.", "Rutina: IncorporaSiniestrosEIACV6. " & gestionasegasaEntities.bdga.Servidor & " " & ex.Message, ex)
End Try
End Sub
End Class

View File

@@ -0,0 +1,782 @@
Imports tsl5.Extensiones.StringExtensions
Imports bdGestionAsegasa.Utilidades
Public Class ProcesosTractoresAxa
''' <summary>
''' Revisa qué pólizas de la última semana están pendientes de generación de CSV. Se genera el CSV y se crea en la base de datos toda la informacion relacionada y necesaria.
''' </summary>
''' <param name="bd"></param>
''' <remarks>Este método no crea el correo que se envía a AXA diariamente. Para eso se usa otro método distinto.</remarks>
Public Shared Function GenerarYGuardarEnBdCsvTractoresAxa(ByVal bd As bdGestionAsegasa.gestionasegasaEntities)
Dim resultadoGuardarCambios As Integer = 0
Try
Dim listaAltas As New List(Of bdGestionAsegasa.polizassg)
Dim listaAltasFiltradasPorFecha As New List(Of bdGestionAsegasa.polizassg)
Dim idRamoTractores = bd.ramos.First(Function(x) x.Codigo = "1-1").idRamo
Dim idRamoRemolques = bd.ramos.First(Function(x) x.Codigo = "1-1-1").idRamo
Dim idCiaAXA = bd.companias.First(Function(x) x.Codigo = "0027").idCompania
Dim idTipoGestionPoliza = bd.enumeraciones.First(Function(x) x.Codigo = "TGP.CSVAXA").idEnumeracion
Dim idTipoFicheroCSV = bd.enumeraciones.First(Function(x) x.Codigo = "TIPFIC.CSVAXA").idEnumeracion
Dim lineaFichero As bdGestionAsegasa.ficheros
Dim lineaGestionesVarias As bdGestionAsegasa.gestionesvarias
' Datos para comprobar que toca hacerlo
Dim dHoy As Date = Date.Today
Dim dAyer As Date = Date.Today.AddDays(-1)
' Dim dSemana As Date = Date.Today.AddDays(-7)
' Las pólizas que necesitan CSV son las que cumplan estas condiciones:
' - Sean de ramo 1-1 o 1-1-1.
' - La compañía sea AXA.
' - No tengan archivo CSV. Dicho de otro modo, que no tengan líneas en la tabla `gestionespolizassg` con la gestión "Creación de CSV y envío a AXA".
' - Que en la columna idOrigenPresupuesto el valor sea TiposPresupuestos.TRACTORES (2).
' - Que la fecha de creación sea anterior a hoy (ya que esto se ejecutará a las 00:00 y debe procesar las del día anterior).
' - Que la fecha de creación no sea mayor a 7 días.
' - Oculto = false
' Nota: En algún momento me interesaría poner que algunos estos filtros de búsqueda sean parametros que se le pasen a este método.
' Por ahora lo estoy haciendo así como dos consultas porque LINQtoSQL no permite filtrar por Date en los Where.
' Quizás lo mejor sería crear una vista para optimizar el rendimiento. Pero esto se ejecuta una sola vez al día, no sé si merece la pena hacerlo.
Try
listaAltas = (From x In bd.polizassg Where (x.ramos.idRamo = idRamoTractores OrElse x.ramos.idRamo = idRamoRemolques) _
AndAlso x.idCompania = idCiaAXA _
AndAlso x.FechaAceptacionPresupuesto.HasValue _
AndAlso x.FechaBaja.HasValue = False _
AndAlso Not x.gestionespolizassg.Any(Function(y) y.idTipo = idTipoGestionPoliza) _
AndAlso x.idOrigenPresupuesto = bdGestionAsegasa.polizassg.TiposPresupuestos.TRACTORES
).ToList()
'listaAltasFiltradasPorFecha = listaAltas.Where(Function(x) (x.FechaAlta.HasValue AndAlso x.FechaAlta.Value.Date < dHoy) _
' AndAlso (x.FechaAlta.HasValue AndAlso x.FechaAlta.Value.Date >= dSemana)
' ).ToList()
listaAltasFiltradasPorFecha = listaAltas.Where(Function(x) (x.FechaAlta.HasValue AndAlso x.FechaAlta.Value.Date < dHoy)).ToList
Debug.WriteLine("listaAltas: {0}", listaAltas.Count())
Debug.WriteLine("listaAltasFiltradasPorFecha: {0}", listaAltasFiltradasPorFecha.Count())
For Each item In listaAltasFiltradasPorFecha
Debug.WriteLine("({0},{1},{2})", item.idPoliza, item.NumeroPoliza, item.Matricula)
Next
Catch ex As Exception
System.Diagnostics.Debug.Write(ex.ToString)
Call AñadeLog(tsl5.Enumeraciones.TipoLog.Fallo, "En «" & System.Reflection.MethodBase.GetCurrentMethod.ToString & "`",
"En método `" & System.Reflection.MethodBase.GetCurrentMethod.ToString & "`. " _
& Environment.MachineName & " " & ex.ToString, ex)
End Try
If listaAltasFiltradasPorFecha.Count > 0 Then 'Si entra, significa que toca hacerlo.
lineaFichero = New bdGestionAsegasa.ficheros With {
.Descripcion = String.Format("{0} {1}",
bd.enumeraciones.First(Function(x) x.Codigo = "AXATRACTORES.DescripcionFicheroCSV").ValorAlfabeticoLargo,
dAyer.ToString("yyyy-MM-dd")),
.Fecha = Now,
.idTipo = idTipoFicheroCSV,
.NombreFichero = String.Format("{0}{1}.csv",
bd.enumeraciones.First(Function(x) x.Codigo = "AXATRACTORES.NombreFicheroCSV").ValorAlfabeticoLargo,
dAyer.ToString("yyyy-MM-dd"))
}
bd.ficheros.AddObject(lineaFichero)
'bd.GuardarCambios()
lineaGestionesVarias = New bdGestionAsegasa.gestionesvarias With {
.Descripción = lineaFichero.NombreFichero,
.idTipo = idTipoGestionPoliza,
.ficheros = lineaFichero,
.FechaCreacion = Now
}
bd.gestionesvarias.AddObject(lineaGestionesVarias)
' /////////////////////////////////////////////////////////
' // Generar CSV conteniendo todas las altas pendientes //
' ///////////////////////////////////////////////////////
Dim archivoCSV As Byte() = GenerarCsvTractoresAxa(bd, listaAltasFiltradasPorFecha, lineaGestionesVarias)
' /////////////////////////////////////////////////////////////
' // FIN Generar CSV conteniendo todas las altas pendientes //
' ///////////////////////////////////////////////////////////
' Crear líneas en la base de datos para fichero y gestiones varias
lineaFichero.Fichero = archivoCSV
resultadoGuardarCambios = bd.GuardarCambios()
' Notificación Slack
If resultadoGuardarCambios > 0 Then
Try
Dim mensaje As New Text.StringBuilder
mensaje.AppendFormat("Se ha generado un archivo CSV con altas de tractores y/o remolques para AXA.```idFichero: {1}{0}NombreFichero: {2}{0}idGestion: {3}{0}Servidor: {4}```", vbCrLf,
lineaFichero.idFichero, lineaFichero.NombreFichero, lineaGestionesVarias.idGestion, Environment.MachineName)
tsl5.Utilidades.EnviarNotificacionSlack(mensaje.ToString, destinatario:="#asegasa", descripcionRemitente:=Reflection.MethodBase.GetCurrentMethod.ToString)
Catch ex As Exception
' Si esta notificación da error no debe pararse el servicio, así que no hago nada.
End Try
End If
End If
Catch ex As Exception
System.Diagnostics.Debug.WriteLine("No hay líneas o se produjo excepción.")
System.Diagnostics.Debug.WriteLine(ex.ToString)
Call AñadeLog(tsl5.Enumeraciones.TipoLog.Fallo, "En «" & System.Reflection.MethodBase.GetCurrentMethod.ToString & "`",
"En método `" & System.Reflection.MethodBase.GetCurrentMethod.ToString & "`. " _
& Environment.MachineName & " " & ex.ToString, ex)
End Try
Debug.WriteLine(System.Reflection.MethodBase.GetCurrentMethod.ToString)
Return resultadoGuardarCambios
End Function
''' <summary>
''' Este es el método que se encarga de crear el CSV propiamente dicho. Opcionalmente (aunque, por lo general, sí) este método
''' va creando en la tabla `gestionnespolizassg` las líneas indicando que se ha creado el CSV para cada póliza.
''' </summary>
''' <param name="bd"></param>
''' <param name="listaPolizas">La lista de pólizas de tractores que se van a incluir en el CSV.</param>
''' <param name="lineaGestionesVarias">Si este parámetro se recibe, se crean en la tabla `gestionnespolizassg` las líneas que indican que se ha creado el CSV para cada póliza.</param>
''' <returns>Un array de bytes conteniendo el fichero CSV.</returns>
''' <remarks>Si no se recibe el parámtro "lineaGestionesVarias" no se crearán en la base de datos las líneas que indican que se ha creado el CSV para cada póliza.
''' La ventaja de esto es que así se puede usar este método para generar CSV de manera puntual o para depuración.</remarks>
Public Shared Function GenerarCsvTractoresAxa(ByVal bd As bdGestionAsegasa.gestionasegasaEntities, ByVal listaPolizas As List(Of bdGestionAsegasa.polizassg), Optional ByRef lineaGestionesVarias As bdGestionAsegasa.gestionesvarias = Nothing)
Dim archivoCSV As Byte() = Nothing
Dim idTipoGestionPoliza As String = bd.enumeraciones.First(Function(x) x.Codigo = "TGP.CSVAXA").idEnumeracion
Dim sDescripcionGestion As String = bd.enumeraciones.First(Function(x) x.Codigo = "AXATRACTORES.DescripcionGestion").ValorAlfabeticoLargo
Dim nombreArchivoTemporal As String = System.IO.Path.GetTempFileName
Using sw As New IO.StreamWriter(IO.File.Open(nombreArchivoTemporal, IO.FileMode.Create), System.Text.Encoding.GetEncoding("iso-8859-1"))
' Esta línea que escribo a continuación en el archivo era demasiado larga para guardarla en la tabla enumeraciones de la base de datos.
sw.WriteLine("Código Marca;Código Modelo;Código Versión;Medofi;Fecha de Efecto;Hora de Fecha Efecto;CAMPAÑA;Producto;Nº Póliza Reservado;Fecha entrada en Delegación;Duración;Plan de cobro;Canal de cobro;Fecha Vto.;NIF, CIF, OTROS;Nº de NIF ó CIF;Primer apellido si es Empresa, no cumplimentar;Segundo apellido si es Empresa, no cumplimentar;Nombre;Fecha Nacimiento;Estado Civil;SEXO;C.P.;Población;Tipo Vía;Nombre Vía;Numero vía;Resto Vía;Propietario;Nombre propietario;Apellido 1 propietario;Apellido 2 propietario;Nif/Cif propietario;Conductor Titular;Nombre Conductor;1º Apellido Conductor;2º Apellido Conductor;Fecha nacimiento conductor DDMMAAAA;Nif, Cif, Otros;NIF Conductor;SEXO;Fecha carnét DDMMAAAA;Conductor Autorizado 1;Nombre Conductor;1º Apellido Conductor;2º Apellido Conductor;Fecha nto. Conductor DDMMAAAA;NIF Conductor;SEXO;Fecha carnet DDMMAAAA;Conductor Autorizado 2;Nombre Conductor;1º Apellido Conductor;2º Apellido Conductor;Fecha nto. Conductor DDMMAAAA;NIF Conductor;SEXO;Fecha carnet DDMMAAAA;Permiso retirado (fijo);Uso Vehículo (según tabla);Accesorios;Tipo de Accesorios;Descripción (Detallar los accesorios separados por comas);Valor Accesorios (valor total);Peso en Toneladas;Literal de Marca;Literal de Modelo;Literal de Versión;Valor (fijo);Valor LUNAS;Matrícula;Fecha 1ª Matriculación DDMMAAAA;C.P. circulación (poner el CP del conductor);Alarma (fijo);Garaje (fijo);KM recorridos (fijo);Combinación de Garantías;Combinación de Accidentes;Kit RC Explotación Agrícola;PRIMA TOTAL;Nº PîLIZA EMITIDA;PNETA EMITIDA;PTOTAL EMITIDA")
For Each linea In listaPolizas
' Comprobar si el archivo XML es el tractores.xml de tipo "TIPFIC.PRESUPUESTO
Dim idTipoFicheroPresupuesto As Integer = bd.enumeraciones.First(Function(x) x.Codigo = "TIPFIC.PRESUPUESTO").idEnumeracion
If linea.ficheros.idTipo = idTipoFicheroPresupuesto _
AndAlso linea.ficheros.NombreFichero.Trim.ToUpper = "tractores.xml".ToUpper _
AndAlso linea.NumeroPoliza IsNot Nothing AndAlso Not String.IsNullOrWhiteSpace(linea.NumeroPoliza) Then
' Componer la poliza del archivo CSV
Dim lineaCSV As String = ""
Dim lineaCsvCorrecta As Boolean = False
Try
lineaCSV = ComponerLineaCsv(linea, bd)
lineaCsvCorrecta = True
Catch ex As Exception
Dim asunto As String = "No se ha podido generar una línea del CSV de TractoresAXA; idPoliza = " & linea.idPoliza & "; Máquina = " & Environment.MachineName
Dim cuerpo As String = "No se ha podido generar una línea del CSV de TractoresAXA; idPoliza = " & linea.idPoliza & vbCrLf &
"Esto podría significar que falta algún dato en esta póliza. " & vbCrLf &
"En método `" & System.Reflection.MethodBase.GetCurrentMethod.ToString & "`. " _
& vbCrLf & Environment.MachineName & " " & ex.ToString
Call AñadeLog(tsl5.Enumeraciones.TipoLog.Fallo, asunto, cuerpo, ex)
tsl5.Utilidades.EnviarNotificacionSlack(asunto, destinatario:="#asegasa", descripcionRemitente:=Reflection.MethodBase.GetCurrentMethod.ToString)
End Try
If lineaCsvCorrecta Then
sw.WriteLine(lineaCSV)
' Si he sido capaz de componer la línea del archivo CSV, tengo que guardarlo en la tabla gestionespolizassg
If lineaGestionesVarias IsNot Nothing AndAlso Not String.IsNullOrWhiteSpace(lineaGestionesVarias.Descripción) Then
linea.gestionespolizassg.Add(New bdGestionAsegasa.gestionespolizassg With {
.idPoliza = linea.idPoliza,
.idTipo = idTipoGestionPoliza,
.Fecha = Date.Now,
.GestionesRealizadas = sDescripcionGestion,
.gestionesvarias = lineaGestionesVarias
})
End If
End If
Else
Dim cadenaError As String = String.Format("Advertencia: el fichero no es de tipo ""TIPFIC.PRESUPUESTO"" o no se llama ""tractores.xml"", o no hay número de póliza; idPoliza = {0}", linea.idPoliza)
Console.WriteLine(cadenaError)
Call AñadeLog(tsl5.Enumeraciones.TipoLog.Fallo, "En «" & System.Reflection.MethodBase.GetCurrentMethod.ToString & "`",
"En método `" & System.Reflection.MethodBase.GetCurrentMethod.ToString & "`. " _
& Environment.MachineName & " " & cadenaError)
End If
Next
sw.Close()
sw.Dispose()
End Using
' Solo tenemos que enviarlo si el archivo tiene más de 1 línea.
' Si solo tiene 1, significa que solo va la línea de la cabecera, es decir,
' que no hay datos de ninguna póliza en ese archivo CSV.
' En ese caso, lanzamos una excepción para que se interruma el proceso.
If NumeroDeLineasEnElArchivoCSV(nombreArchivoTemporal) <= 1 Then
Throw New Exception("El archivo CSV que se ha generado solamente tiene la línea de la cabecera, es decir, no lleva información de ninguna póliza, por lo cual no tiene sentido mandarlo.")
End If
' Pasar el archivo CSV a array de bytes
archivoCSV = IO.File.ReadAllBytes(nombreArchivoTemporal)
Try
IO.File.Delete(nombreArchivoTemporal)
Catch ex As Exception
' Nada, a propósito.
' Si el archivo sobrevive tampoco es un gran problema.
End Try
Return archivoCSV
End Function
''' <summary>
''' Este método solamente crea un CSV; nada se guarda en la base de datos. Principalmente se usará con propósitos de pruebas y/o depuración.
''' </summary>
''' <param name="bd"></param>
''' <param name="cadenaListaPolizas">Una cadena de texto que incluya listas o rangos de pólizas en este formato: "64816901, 64816906-64816911, 64816915".
''' Esto significa "la póliza 64816901, el rango de las pólizas comprendidas entre la 64816906 y la 64816911, y la póliza 64816915". El separador "-" indica rango;
''' el separador "," separa elementos de la lista.</param>
''' <returns>Un array de bytes conteniendo el fichero CSV.</returns>
''' <remarks>Este método solamente crea un CSV; nada se guarda en la base de datos. Principalmente se usará con propósitos de pruebas y/o depuración.
''' Solo funcionará si todas las pólizas especificadas son de tractores de AXA generadas desde WEbAsegasa2018 (agentes.asegasa.com).</remarks>
Public Shared Function GenerarCsvTractoresAxa(ByVal bd As bdGestionAsegasa.gestionasegasaEntities, Optional ByVal cadenaListaPolizas As String = Nothing)
Dim archivoCSV As Byte() = Nothing
Dim listaPolizas As New List(Of bdGestionAsegasa.polizassg)
Dim idRamoTractores As String = (From x In bd.ramos Where x.Codigo = "1-1" Select x.idRamo).FirstOrDefault
Dim idRamoRemolques As String = (From x In bd.ramos Where x.Codigo = "1-1-1" Select x.idRamo).FirstOrDefault
Dim idCiaAXA As String = (From x In bd.companias Where x.Codigo = "0027" Select x.idCompania).FirstOrDefault
Dim listaCadenasSeparadasPorComas As List(Of String) = cadenaListaPolizas.Split(",").ToList
For Each x In listaCadenasSeparadasPorComas
If x.Contains("-") Then
Dim subListaRangos As List(Of String) = x.Split("-").ToList
If subListaRangos.Count = 2 Then
Dim iRangoDesde As UInteger = UInteger.Parse(subListaRangos.First.Trim())
Dim iRangoHasta As UInteger = UInteger.Parse(subListaRangos.Last.Trim())
listaPolizas.AddRange(bd.polizassg.Where(Function(y) (y.ramos.idRamo = idRamoTractores OrElse y.ramos.idRamo = idRamoRemolques) _
AndAlso y.idCompania = idCiaAXA _
AndAlso y.idOrigenPresupuesto = bdGestionAsegasa.polizassg.TiposPresupuestos.TRACTORES _
AndAlso (y.NumeroPoliza >= iRangoDesde AndAlso y.NumeroPoliza <= iRangoHasta)
).OrderBy(Function(y) y.NumeroPoliza).ToList())
Else
Throw New FormatException("Error con el formato de los rangos de números de pólizas especificados: " & cadenaListaPolizas)
End If
Else
Dim sNumeroPoliza As String = x.Trim()
Dim temp = bd.polizassg.Where(Function(y) y.NumeroPoliza = sNumeroPoliza).First
listaPolizas.Add(temp)
End If
Next
For Each poliza In listaPolizas
Debug.WriteLine(String.Format("[{0},{1},{2}]", poliza.idPoliza, poliza.NumeroPoliza, poliza.Matricula))
Next
archivoCSV = GenerarCsvTractoresAxa(bd, listaPolizas)
Return archivoCSV
End Function
''' <summary>
''' Este método solamente crea un CSV; nada se guarda en la base de datos. Principalmente se usará con propósitos de pruebas y/o depuración.
''' </summary>
''' <param name="bd"></param>
''' <param name="fechaDesde">Desde esta fecha se incluirán todas las pólizas de tractores de AXA en el rango que será procesado.</param>
''' <param name="fechaHasta">Hasta esta fecha se incluirán todas las pólizas de tractores de AXA en el rango que será procesado.</param>
''' <returns>Este método solamente crea un CSV; nada se guarda en la base de datos. Principalmente se usará con propósitos de pruebas y/o depuración.</returns>
''' <remarks>Ambas fechas especificadas están incluídas en el rango que será procesado.</remarks>
Public Shared Function GenerarCsvTractoresAxa(ByVal bd As bdGestionAsegasa.gestionasegasaEntities, ByVal fechaDesde As Date, ByVal fechaHasta As Date)
Dim archivoCSV As Byte() = Nothing
Dim idRamoTractores As String = (From x In bd.ramos Where x.Codigo = "1-1" Select x.idRamo).FirstOrDefault
Dim idRamoRemolques As String = (From x In bd.ramos Where x.Codigo = "1-1-1" Select x.idRamo).FirstOrDefault
Dim idCiaAXA As String = (From x In bd.companias Where x.Codigo = "0027" Select x.idCompania).FirstOrDefault
Dim listaAltas As List(Of bdGestionAsegasa.polizassg) = (From x In bd.polizassg Where (x.ramos.idRamo = idRamoTractores OrElse x.ramos.idRamo = idRamoRemolques) _
AndAlso x.idCompania = idCiaAXA _
AndAlso x.idOrigenPresupuesto = bdGestionAsegasa.polizassg.TiposPresupuestos.TRACTORES
).ToList()
Dim listaAltasFiltradasPorFecha As List(Of bdGestionAsegasa.polizassg) = listaAltas.Where(Function(x) (x.FechaAlta.HasValue AndAlso x.FechaAlta.Value.Date <= fechaHasta) _
AndAlso (x.FechaAlta.HasValue AndAlso x.FechaAlta.Value.Date >= fechaDesde)
).ToList()
archivoCSV = GenerarCsvTractoresAxa(bd, listaAltasFiltradasPorFecha)
Return archivoCSV
End Function
Private Shared Function ComponerLineaCsv(poliza As bdGestionAsegasa.polizassg, bd As bdGestionAsegasa.gestionasegasaEntities) As String
' Importante: tengo que hacer trim a todos los campos, por si acaso. Los apellidos se han guardando con espacios por delante.
Dim sb As New Text.StringBuilder
Try
' Primero verifico que todos los campos tengan datos. Si alguno no tiene, lanzo excepción.
Dim listaDatosFaltantes As New List(Of String)
If String.IsNullOrWhiteSpace(poliza.Tractores.TipoVehiculo.Trim()) Then listaDatosFaltantes.Add("poliza.Tractores.TipoVehiculo")
If String.IsNullOrWhiteSpace(poliza.FechaEfecto.ToString("ddMMyyyy")) Then listaDatosFaltantes.Add("poliza.FechaEfecto")
If String.IsNullOrWhiteSpace(poliza.Tomador.CIF.Trim()) Then listaDatosFaltantes.Add("poliza.Tomador.CIF")
If ObtenerTipoDocumentoTractoresAxa(poliza.Tomador.CIF) <> bd.enumeraciones.First(Function(x) x.Codigo = "AXATRACTORES.tipoDoc.PersJuridicaCIF").ValorAlfabeticoLargo Then ' Si no es CIF
If String.IsNullOrWhiteSpace(poliza.Tractores.TomadorApellido1.Trim()) Then listaDatosFaltantes.Add("poliza.Tractores.TomadorApellido1")
'If String.IsNullOrWhiteSpace(poliza.Tractores.TomadorApellido2.Trim()) Then listaDatosFaltantes.Add("poliza.Tractores.TomadorApellido2")
End If
If String.IsNullOrWhiteSpace(poliza.Tractores.TomadorNombre.Trim()) Then listaDatosFaltantes.Add("poliza.Tractores.TomadorNombre")
If String.IsNullOrWhiteSpace(poliza.Tractores.TomadorFechaNacimiento.ToString("ddMMyyyy")) Then listaDatosFaltantes.Add("poliza.Tractores.TomadorFechaNacimiento")
If String.IsNullOrWhiteSpace(poliza.Tractores.EstadoCivil.Trim()) Then listaDatosFaltantes.Add("poliza.Tractores.EstadoCivil")
If ObtenerTipoDocumentoTractoresAxa(poliza.Tomador.CIF) <> bd.enumeraciones.First(Function(x) x.Codigo = "AXATRACTORES.tipoDoc.PersJuridicaCIF").ValorAlfabeticoLargo Then ' Si no es CIF
If String.IsNullOrWhiteSpace(poliza.Tractores.TomadorSexo.ToString) Then listaDatosFaltantes.Add("poliza.Tractores.TomadorSexo")
End If
If String.IsNullOrWhiteSpace(poliza.Tractores.TomadorCodigoPostal.Trim()) Then listaDatosFaltantes.Add("poliza.Tractores.TomadorCodigoPostal")
If String.IsNullOrWhiteSpace(poliza.Tractores.TomadorPoblacion.Trim()) Then listaDatosFaltantes.Add("poliza.Tractores.TomadorPoblacion")
If String.IsNullOrWhiteSpace(poliza.Tractores.TomadorVia.Trim()) Then listaDatosFaltantes.Add("poliza.Tractores.TomadorVia")
If String.IsNullOrWhiteSpace(poliza.Tractores.TomadorNombreVia.Trim()) Then listaDatosFaltantes.Add("poliza.Tractores.TomadorNombreVia")
If String.IsNullOrWhiteSpace(poliza.Tractores.TomadorNumeroVia.Trim()) Then listaDatosFaltantes.Add("poliza.Tractores.TomadorNumeroVia")
If ObtenerTipoDocumentoTractoresAxa(poliza.Propietario.CIF) <> bd.enumeraciones.First(Function(x) x.Codigo = "AXATRACTORES.tipoDoc.PersJuridicaCIF").ValorAlfabeticoLargo Then ' Si no es CIF
If String.IsNullOrWhiteSpace(poliza.Tractores.PropietarioSexo.ToString) Then listaDatosFaltantes.Add("poliza.Tractores.PropietarioSexo")
If String.IsNullOrWhiteSpace(poliza.Tractores.PropietarioApellido1.Trim()) Then listaDatosFaltantes.Add("poliza.Tractores.PropietarioApellido1")
'If String.IsNullOrWhiteSpace(poliza.Tractores.PropietarioApellido2.Trim()) Then listaDatosFaltantes.Add("poliza.Tractores.PropietarioApellido2")
End If
If poliza.Propietario IsNot Nothing AndAlso poliza.Propietario.idEntidad <> poliza.Tomador.idEntidad Then
If String.IsNullOrWhiteSpace(poliza.Propietario.Nombre.Trim) And (ObtenerTipoDocumentoTractoresAxa(poliza.Propietario.CIF) <> bd.enumeraciones.First(Function(x) x.Codigo = "AXATRACTORES.tipoDoc.PersJuridicaCIF").ValorAlfabeticoLargo) Then
listaDatosFaltantes.Add("poliza.propietario.nombre")
End If
If String.IsNullOrWhiteSpace(poliza.Propietario.CIF.Trim()) Then listaDatosFaltantes.Add("poliza.Propietario.CIF")
End If
If poliza.Conductor Is Nothing OrElse poliza.Conductor.idEntidad = poliza.Tomador.idEntidad Then
'If Not poliza.Conductor.FechaExpedicionCarnet.HasValue Then
' listaDatosFaltantes.Add("poliza.Conductor.FechaExpedicionCarnet")
'Else
' If String.IsNullOrWhiteSpace(poliza.Conductor.FechaExpedicionCarnet.Value.ToString("ddMMyyyy")) Then listaDatosFaltantes.Add("poliza.Conductor.FechaExpedicionCarnet")
'End If
If Not (poliza.Tractores.FechaPermisoConduccion > Date.MinValue AndAlso poliza.Tractores.FechaPermisoConduccion < Date.MaxValue) Then
listaDatosFaltantes.Add("poliza.Tractores.FechaPermisoConduccion")
End If
If String.IsNullOrWhiteSpace(poliza.Tractores.FechaPermisoConduccion.ToString("ddMMyyyy")) Then listaDatosFaltantes.Add("poliza.Tractores.FechaPermisoConduccion")
Else
If String.IsNullOrWhiteSpace(poliza.Tractores.ConductorNombre.Trim()) Then listaDatosFaltantes.Add("poliza.Tractores.ConductorNombre")
If String.IsNullOrWhiteSpace(poliza.Tractores.ConductorApellido1.Trim()) Then listaDatosFaltantes.Add("poliza.Tractores.ConductorApellido1")
'If String.IsNullOrWhiteSpace(poliza.Tractores.ConductorApellido2.Trim()) Then listaDatosFaltantes.Add("poliza.Tractores.ConductorApellido2")
If String.IsNullOrWhiteSpace(poliza.Tractores.ConductorFechaNacimiento.ToString("ddMMyyyy")) Then listaDatosFaltantes.Add("poliza.Tractores.ConductorFechaNacimiento")
If String.IsNullOrWhiteSpace(poliza.Conductor.CIF.Trim()) Then listaDatosFaltantes.Add("poliza.Conductor.CIF")
If String.IsNullOrWhiteSpace(poliza.Tractores.ConductorSexo.ToString) Then listaDatosFaltantes.Add("poliza.Tractores.ConductorSexo")
If String.IsNullOrWhiteSpace(poliza.Tractores.FechaPermisoConduccion.ToString("ddMMyyyy")) Then listaDatosFaltantes.Add("poliza.Tractores.FechaPermisoConduccion")
End If
If String.IsNullOrWhiteSpace(poliza.Tractores.UsoVehiculo.Trim()) Then listaDatosFaltantes.Add("poliza.Tractores.UsoVehiculo")
If String.IsNullOrWhiteSpace(poliza.Tractores.Peso.ToString.Trim()) Then listaDatosFaltantes.Add("poliza.Tractores.Peso")
If String.IsNullOrWhiteSpace(poliza.Tractores.Marca.Trim()) Then listaDatosFaltantes.Add("poliza.Tractores.Marca")
If String.IsNullOrWhiteSpace(poliza.Tractores.Modelo.Trim()) Then listaDatosFaltantes.Add("poliza.Tractores.Modelo")
If String.IsNullOrWhiteSpace(poliza.Tractores.Version.Trim()) Then listaDatosFaltantes.Add("poliza.Tractores.Version")
If String.IsNullOrWhiteSpace(poliza.Matricula.ToUpper.Trim()) Then listaDatosFaltantes.Add("poliza.Matricula")
If String.IsNullOrWhiteSpace(poliza.Tractores.FechaPrimeraMatriculacion.ToString("ddMMyyyy")) Then listaDatosFaltantes.Add("poliza.Tractores.FechaPrimeraMatriculacion")
If String.IsNullOrWhiteSpace(poliza.Tractores.TomadorCodigoPostal.Trim()) Then listaDatosFaltantes.Add("poliza.Tractores.TomadorCodigoPostal")
If String.IsNullOrWhiteSpace(poliza.Tractores.CombinacionAccidentes.Trim()) Then listaDatosFaltantes.Add("poliza.Tractores.CombinacionAccidentes")
If String.IsNullOrWhiteSpace(poliza.Tractores.PrimaTotal.Trim()) Then listaDatosFaltantes.Add("poliza.Tractores.PrimaTotal")
If listaDatosFaltantes.Count > 0 Then
Dim sbDatosFaltantes As New Text.StringBuilder
For Each l In listaDatosFaltantes
sbDatosFaltantes.AppendFormat("{0}, ", l) 'Sí, esto es así. No es un error.
Next
Throw New Exception(String.Format("No se puede componer esta línea del CSV porque faltan datos en la póliza idPoliza = {0}; Lista de datos faltantes: {1}.",
poliza.idPoliza,
sbDatosFaltantes.ToString.RecortarPorElFinal(2)))
End If
' Fin de la verificación
' Datos generales de la póliza
sb.AppendFormat("{0};", poliza.Tractores.TipoVehiculo.Trim()) ' Código Marca
sb.AppendFormat("=""{0}"";", "001") ' Código Modelo
sb.AppendFormat("=""{0}"";", "001") ' Código Versión
sb.AppendFormat("{0};", "674392") ' Medofi
sb.AppendFormat("=""{0}"";", poliza.FechaEfecto.ToString("ddMMyyyy")) ' Fecha de Efecto
sb.AppendFormat("{0};", "") ' Hora de Fecha Efecto
sb.AppendFormat("{0};", "") ' CAMPAÑA
sb.AppendFormat("{0};", "8184") ' Producto
sb.AppendFormat("{0};", poliza.NumeroPoliza.Trim()) ' Nº Póliza Reservado
sb.AppendFormat("{0};", "") ' Fecha entrada en Delegación
sb.AppendFormat("{0};", "Anual Renovable") ' Duración
sb.AppendFormat("{0};", "Anual") ' Plan de cobro
sb.AppendFormat("{0};", "Mediador") ' Canal de cobro
sb.AppendFormat("{0};", "") ' Fecha Vto.
' Tomador
sb.AppendFormat("{0};", ObtenerTipoDocumentoTractoresAxa(poliza.Tomador.CIF)) ' NIF, CIF, OTROS
sb.AppendFormat("{0};", poliza.Tomador.CIF.Trim()) ' Nº de NIF ó CIF
sb.AppendFormat("{0};", poliza.Tractores.TomadorApellido1.Trim()) ' Primer apellido si es Empresa, no cumplimentar
sb.AppendFormat("{0};", poliza.Tractores.TomadorApellido2.Trim()) ' Segundo apellido si es Empresa, no cumplimentar
sb.AppendFormat("{0};", poliza.Tractores.TomadorNombre.Trim()) ' Nombre
sb.AppendFormat("=""{0}"";", poliza.Tractores.TomadorFechaNacimiento.ToString("ddMMyyyy")) ' Fecha Nacimiento
sb.AppendFormat("{0};", poliza.Tractores.EstadoCivil.Trim()) ' Estado Civil
If ObtenerTipoDocumentoTractoresAxa(poliza.Tomador.CIF) = bd.enumeraciones.First(Function(x) x.Codigo = "AXATRACTORES.tipoDoc.PersJuridicaCIF").ValorAlfabeticoLargo Then ' Si es CIF
sb.AppendFormat("{0};", bd.enumeraciones.First(Function(x) x.Codigo = "AXATRACTORES.sexo.SinInformar").ValorAlfabetico1) ' SEXO = "sin informar" para personas jurídicas
Else ' Si no es CIF
sb.AppendFormat("{0};", ObtenerSexoTractoresAxa(poliza.Tractores.TomadorSexo, bd)) ' SEXO
End If
sb.AppendFormat("{0};", poliza.Tractores.TomadorCodigoPostal.Trim()) ' C.P.
sb.AppendFormat("{0};", poliza.Tractores.TomadorPoblacion.Trim()) ' Población
sb.AppendFormat("{0};", poliza.Tractores.TomadorVia.Trim()) ' Tipo Vía
sb.AppendFormat("{0};", poliza.Tractores.TomadorNombreVia.Trim()) ' Nombre Vía
sb.AppendFormat("{0};", poliza.Tractores.TomadorNumeroVia.Trim()) ' Numero vía
sb.AppendFormat("{0};", poliza.Tractores.TomadorRestoVia.Trim()) ' Resto Vía
If poliza.Propietario Is Nothing OrElse poliza.Propietario.idEntidad = poliza.Tomador.idEntidad Then
' Propietario: el tomador
sb.AppendFormat("{0};", "El Tomador") ' Propietario
sb.AppendFormat("{0};", "") ' Nombre propietario
sb.AppendFormat("{0};", "") ' Apellido 1 propietario
sb.AppendFormat("{0};", "") ' Apellido 2 propietario
sb.AppendFormat("{0};", "") ' Nif/Cif propietario
Else
If ObtenerTipoDocumentoTractoresAxa(poliza.Propietario.CIF) <> bd.enumeraciones.First(Function(x) x.Codigo = "AXATRACTORES.tipoDoc.PersJuridicaCIF").ValorAlfabeticoLargo Then ' Si no es CIF
' Propietario: otro, persona física
sb.AppendFormat("{0};", "Otra persona distinta del Tomador") ' Propietario
sb.AppendFormat("{0};", poliza.Propietario.Nombre.Trim()) ' Nombre propietario
sb.AppendFormat("{0};", poliza.Tractores.PropietarioApellido1.Trim()) ' Apellido 1 propietario
sb.AppendFormat("{0};", poliza.Tractores.PropietarioApellido2.Trim()) ' Apellido 2 propietario
sb.AppendFormat("{0};", poliza.Propietario.CIF.Trim()) ' Nif/Cif propietario
Else
' Propietario: otro, persona jurídica
sb.AppendFormat("{0};", "Otra persona distinta del Tomador") ' Propietario
sb.AppendFormat("{0};", poliza.Propietario.Nombre.Trim()) ' Nombre propietario
sb.AppendFormat("{0};", "") ' Apellido 1 propietario, no tiene.
sb.AppendFormat("{0};", "") ' Apellido 2 propietario, no tiene.
sb.AppendFormat("{0};", poliza.Propietario.CIF.Trim()) ' Nif/Cif propietario
End If
End If
If poliza.Conductor Is Nothing OrElse poliza.Conductor.idEntidad = poliza.Tomador.idEntidad Then
' Conductor: el tomador
sb.AppendFormat("{0};", "El Tomador") ' Conductor Titular
sb.AppendFormat("{0};", "") ' Nombre Conductor
sb.AppendFormat("{0};", "") ' 1º Apellido Conductor
sb.AppendFormat("{0};", "") ' 2º Apellido Conductor
sb.AppendFormat("{0};", "") ' Fecha nacimiento conductor DDMMAAAA
sb.AppendFormat("{0};", "") ' Nif, Cif, Otros
sb.AppendFormat("{0};", "") ' NIF Conductor
sb.AppendFormat("{0};", "") ' SEXO
sb.AppendFormat("=""{0}"";", poliza.Tractores.FechaPermisoConduccion.ToString("ddMMyyyy")) ' Fecha carnét DDMMAAAA
Else
' Conductor: otro
sb.AppendFormat("{0};", "Es otra persona") ' Conductor Titular
sb.AppendFormat("{0};", poliza.Tractores.ConductorNombre.Trim()) ' Nombre Conductor
sb.AppendFormat("{0};", poliza.Tractores.ConductorApellido1.Trim()) ' 1º Apellido Conductor
sb.AppendFormat("{0};", poliza.Tractores.ConductorApellido2.Trim()) ' 2º Apellido Conductor
sb.AppendFormat("=""{0}"";", poliza.Tractores.ConductorFechaNacimiento.ToString("ddMMyyyy")) ' Fecha nacimiento conductor DDMMAAAA
sb.AppendFormat("{0};", ObtenerTipoDocumentoTractoresAxa(poliza.Conductor.CIF)) ' Nif, Cif, Otros
sb.AppendFormat("{0};", poliza.Conductor.CIF.Trim()) ' NIF Conductor
sb.AppendFormat("{0};", ObtenerSexoTractoresAxa(poliza.Tractores.ConductorSexo, bd)) ' SEXO
sb.AppendFormat("=""{0}"";", poliza.Tractores.FechaPermisoConduccion.ToString("ddMMyyyy")) ' Fecha carnét DDMMAAAA
End If
' Conductor autorizado 1 (siempre vacío)
sb.AppendFormat("{0};", "No se declara") ' Conductor Autorizado 1
sb.AppendFormat("{0};", "") ' Nombre Conductor
sb.AppendFormat("{0};", "") ' 1º Apellido Conductor
sb.AppendFormat("{0};", "") ' 2º Apellido Conductor
sb.AppendFormat("{0};", "") ' Fecha nto. Conductor DDMMAAAA
sb.AppendFormat("{0};", "") ' NIF Conductor
sb.AppendFormat("{0};", "") ' SEXO
sb.AppendFormat("{0};", "") ' Fecha carnet DDMMAAAA
' Conductor autorizado 2 (siempre vacío)
sb.AppendFormat("{0};", "No se declara") ' Conductor Autorizado 2
sb.AppendFormat("{0};", "") ' Nombre Conductor
sb.AppendFormat("{0};", "") ' 1º Apellido Conductor
sb.AppendFormat("{0};", "") ' 2º Apellido Conductor
sb.AppendFormat("{0};", "") ' Fecha nto. Conductor DDMMAAAA
sb.AppendFormat("{0};", "") ' NIF Conductor
sb.AppendFormat("{0};", "") ' SEXO
sb.AppendFormat("{0};", "") ' Fecha carnet DDMMAAAA
' Otros datos
sb.AppendFormat("{0};", "No") ' Permiso retirado (fijo)
sb.AppendFormat("{0};", poliza.Tractores.UsoVehiculo.Trim()) ' Uso Vehículo (según tabla)
sb.AppendFormat("{0};", "") ' Accesorios
sb.AppendFormat("{0};", "") ' Tipo de Accesorios
sb.AppendFormat("{0};", "") ' Descripción (Detallar los accesorios separados por comas)
sb.AppendFormat("{0};", "") ' Valor Accesorios (valor total)
sb.AppendFormat("{0};", poliza.Tractores.Peso.ToString.Trim()) ' Peso en Toneladas
sb.AppendFormat("{0};", poliza.Tractores.Marca.Trim()) ' Literal de Marca
sb.AppendFormat("{0};", poliza.Tractores.Modelo.Trim()) ' Literal de Modelo
sb.AppendFormat("{0};", poliza.Tractores.Version.Trim()) ' Literal de Versión
sb.AppendFormat("{0};", "35.000") ' Valor (fijo)
sb.AppendFormat("=""{0}"";", "0,00") ' Valor LUNAS
sb.AppendFormat("{0};", poliza.Matricula.ToUpper.Trim()) ' Matrícula
sb.AppendFormat("=""{0}"";", poliza.Tractores.FechaPrimeraMatriculacion.ToString("ddMMyyyy")) ' Fecha 1ª Matriculación DDMMAAAA
sb.AppendFormat("=""{0}"";", poliza.Tractores.TomadorCodigoPostal.Trim()) ' C.P. circulación (poner el CP del conductor)
sb.AppendFormat("{0};", "NO") ' Alarma (fijo)
sb.AppendFormat("{0};", "NO") ' Garaje (fijo)
sb.AppendFormat("{0};", "Sin definir") ' KM recorridos (fijo)
sb.AppendFormat("{0};", "Terceros sin Asistencia") ' Combinación de Garantías
sb.AppendFormat("{0};", poliza.Tractores.CombinacionAccidentes.Trim()) ' Combinación de Accidentes
sb.AppendFormat("{0};", "Si") ' Kit RC Explotación Agrícola
sb.AppendFormat("{0};", poliza.Tractores.PrimaTotal.Trim()) ' PRIMA TOTAL
sb.AppendFormat("{0};", "") ' Nº PÓLIZA EMITIDA
sb.AppendFormat("{0};", "") ' PNETA EMITIDA
sb.AppendFormat("{0}", "") ' PTOTAL EMITIDA
Catch ex As Exception
Throw New Exception(ex.Message, ex)
End Try
Return sb.ToString
End Function
Public Shared Function PrepararCorreosCsvTractoresAxa(bd As bdGestionAsegasa.gestionasegasaEntities) As Integer
Const danmundebug As Boolean = False
Dim resultadoGuardarCambios As Integer = 0
Try
Dim dHoy As Date = Date.Today
Dim dAyer As Date = Date.Today.AddDays(-1)
' Dim dSemana As Date = Date.Today.AddDays(-7)
Dim idTipoGestionPoliza As String = bd.enumeraciones.First(Function(x) x.Codigo = "TGP.CSVAXA").idEnumeracion
Dim idTipoFicheroCSV As String = bd.enumeraciones.First(Function(x) x.Codigo = "TIPFIC.CSVAXA").idEnumeracion
Dim nLineasPendientesCorreoCsv As Integer = 0
'// Toca hacerlo si tenemos líneas en la tabla gestionesvarias que cumplan las siguientes condiciones
'// - idTipo = idTipoGestionPoliza
'// - fechaProcesado = NULL
Dim lineasPendientesCorreoCsv As List(Of bdGestionAsegasa.gestionesvarias) =
bd.gestionesvarias.Where(Function(x) x.idTipo = idTipoGestionPoliza _
AndAlso Not x.FechaProcesado.HasValue).ToList()
nLineasPendientesCorreoCsv = lineasPendientesCorreoCsv.Count
'// Preparación del correo que sí lleva CSV
For Each linea In lineasPendientesCorreoCsv
Dim listaEnumeraciones As List(Of bdGestionAsegasa.enumeraciones) = bd.enumeraciones.Where(Function(x) x.Codigo.StartsWith("AXATRACTORES.email.")).ToList()
Dim listaDestinatarios As List(Of String) = (From x In bd.enumeraciones Where x.Codigo.StartsWith("AXATRACTORES.email.destinatario") Select x.ValorAlfabeticoLargo.Trim()).ToList()
Dim remitente = (From x In bd.enumeraciones Where x.Codigo = "AXATRACTORES.email.remitente" Select x.ValorAlfabeticoLargo).FirstOrDefault().Trim()
Dim direccionRespuesta As String = (From x In bd.enumeraciones Where x.Codigo = "AXATRACTORES.email.direccionRespuesta" Select x.ValorAlfabeticoLargo).FirstOrDefault().Trim()
Dim asunto = String.Format("{0} {1}",
bd.enumeraciones.First(Function(x) x.Codigo = "AXATRACTORES.email.asunto").ValorAlfabeticoLargo.Trim(),
linea.ficheros.Descripcion.Split(" ").Last)
Dim cuerpo = String.Format("{0} {1}",
bd.enumeraciones.First(Function(x) x.Codigo = "AXATRACTORES.email.cuerpo").ValorAlfabeticoLargo.Trim(),
linea.ficheros.Descripcion.Split(" ").Last)
Dim nombreArchivoCSV As String = String.Format("{0}{1}.csv",
bd.enumeraciones.First(Function(x) x.Codigo = "AXATRACTORES.NombreFicheroCSV").ValorAlfabeticoLargo,
linea.ficheros.Descripcion.Split(" ").Last)
' Enviar el correo (bueno, en realidad guardarlo en la BD para que se envíe)
Dim cuentaCorreo As bdGestionAsegasa.cuentascorreo = bd.cuentascorreo.First(Function(x) x.Codigo = "CSVAXA")
For Each destinatario In listaDestinatarios
bdGestionAsegasa.correos.GeneraRegistroCorreo(bd, asunto, cuerpo, cuentaCorreo, destinatario,,, linea.idFichero)
Next
' Marcar email como enviado. Si no ha dado excepción hasta aquí, significa que ya está en la tabla de salida de correos.
linea.FechaProcesado = Now
If Not danmundebug Then resultadoGuardarCambios += bd.GuardarCambios()
System.Diagnostics.Debug.WriteLine("lineaCSV.enviado: " & resultadoGuardarCambios)
' Notificación Slack
If resultadoGuardarCambios > 0 Then
Try
Dim mensaje As New Text.StringBuilder
mensaje.AppendFormat("Se ha generado un email para AXA conteniendo el archivo CSV con altas de tractores y/o remolques para AXA.```Asunto: {1}{0}Servidor: {2}```", vbCrLf,
asunto, Environment.MachineName)
tsl5.Utilidades.EnviarNotificacionSlack(mensaje.ToString, destinatario:="#asegasa", descripcionRemitente:=Reflection.MethodBase.GetCurrentMethod.ToString)
Catch ex As Exception
' Si esta notificación da error no debe pararse el servicio, así que no hago nada.
End Try
End If
Next
'TODO danmun: Preparación del correo que NO lleva CSV
'// Preparación del correo que NO lleva CSV
'// Sabremos si hay que hacer esto si no hay líneas pendientes de enviar el correo del CSV y si además
'// hoy no se envió ningún email con CSV (esto sirve para evitar problemas cuando se lanzan estos métodos
'// manualmente, desde los botones rojos del Depurador, por ejemplo)
'If nLineasPendientesCorreoCsv = 0 AndAlso Not YaSeEnvióCsvParaHoy(bd) Then
' resultadoGuardarCambios = 0
' Dim idTipoGestionNoCSV As String = bd.enumeraciones.First(Function(x) x.Codigo = "TGP.NOCSVAXA").idEnumeracion
' '// Hacerlo solamente si no existe una línea en `gestionesvarias` de tipo "TGP.NOCSVAXA" con fecha de procesado dAyer
' If bd.gestionesvarias.Where(Function(x) x.idTipo = idTipoGestionNoCSV AndAlso Not (x.FechaProcesado.Value > dAyer AndAlso x.FechaProcesado.Value < dHoy)).Count = 0 Then
' Dim listaEnumeraciones As List(Of bdGestionAsegasa.enumeraciones) = bd.enumeraciones.Where(Function(x) x.Codigo.StartsWith("AXATRACTORES.emailnocsv.")).ToList()
' Dim listaDestinatarios As List(Of String) = listaEnumeraciones.Where(Function(x) x.Codigo.StartsWith("AXATRACTORES.emailnocsv.destinatario")).Select(Function(x) x.ValorAlfabeticoLargo.Trim()).ToList()
' Dim remitente As String = listaEnumeraciones.First(Function(x) x.Codigo = "AXATRACTORES.emailnocsv.remitente").ValorAlfabeticoLargo.Trim()
' Dim direccionRespuesta As String = listaEnumeraciones.Where(Function(x) x.Codigo = "AXATRACTORES.emailnocsv.direccionResp").Select(Function(x) x.ValorAlfabeticoLargo).FirstOrDefault().Trim()
' Dim asunto As String = String.Format("{0} {1}",
' listaEnumeraciones.First(Function(x) x.Codigo = "AXATRACTORES.emailnocsv.asunto").ValorAlfabeticoLargo.Trim(),
' dAyer.ToString("yyyy-MM-dd"))
' Dim cuerpo As String = String.Format("{0} {1} {2}",
' listaEnumeraciones.First(Function(x) x.Codigo = "AXATRACTORES.emailnocsv.cuerpo1").ValorAlfabeticoLargo.Trim(),
' dAyer.ToString("yyyy-MM-dd"),
' listaEnumeraciones.First(Function(x) x.Codigo = "AXATRACTORES.emailnocsv.cuerpo2").ValorAlfabeticoLargo.Trim())
' Dim sDescripcion As String = String.Format("{0} {1}",
' bd.enumeraciones.First(Function(x) x.Codigo = "AXATRACTORES.DescripcionEmailNoTractores").ValorAlfabeticoLargo,
' dAyer.ToString("yyyy-MM-dd"))
' Dim nuevaGestionVaria As New bdGestionAsegasa.gestionesvarias With {
' .FechaCreacion = Now,
' .idTipo = idTipoGestionNoCSV,
' .Descripción = sDescripcion
' }
' bd.gestionesvarias.AddObject(nuevaGestionVaria)
' ' Enviar el correo (bueno, en realidad guardarlo en la BD para que se envíe)
' Dim cuentaCorreo As bdGestionAsegasa.cuentascorreo = bd.cuentascorreo.First(Function(x) x.Codigo = "CSVAXA")
' For Each destinatario In listaDestinatarios
' bdGestionAsegasa.correos.GeneraRegistroCorreo(bd, asunto, cuerpo, cuentaCorreo, destinatario)
' Next
' ' Marcar email como enviado. Si no ha dado excepción hasta aquí, significa que ya está en la tabla de salida de correos.
' nuevaGestionVaria.FechaProcesado = Now
' If Not danmundebug Then resultadoGuardarCambios += bd.GuardarCambios()
' System.Diagnostics.Debug.WriteLine("Guardada gestión varia NO CSV: " & resultadoGuardarCambios)
' ' Notificación Slack
' If resultadoGuardarCambios > 0 Then
' Try
' Dim mensaje As New Text.StringBuilder
' mensaje.AppendFormat("Se ha generado un email para ASEGASA indicando que no se ha enviado archivo CSV de tractores porque no hay altas en el sistema Asegasa-AXA tractores.```Asunto: {1}{0}Servidor: {2}```", vbCrLf,
' asunto, Environment.MachineName)
' tsl5.Utilidades.EnviarNotificacionSlack(mensaje.ToString, destinatario:="#asegasa", descripcionRemitente:=Reflection.MethodBase.GetCurrentMethod.ToString)
' Catch ex As Exception
' ' Si esta notificación da error no debe pararse el servicio, así que no hago nada.
' End Try
' End If
' End If
'End If
Catch ex As Exception
System.Diagnostics.Debug.WriteLine("No hay líneas o se produjo excepción.")
Call AñadeLog(tsl5.Enumeraciones.TipoLog.Fallo, "En «" & System.Reflection.MethodBase.GetCurrentMethod.ToString & "`",
"En método `" & System.Reflection.MethodBase.GetCurrentMethod.ToString & "`. " _
& Environment.MachineName & " " & ex.ToString, ex)
End Try
Return resultadoGuardarCambios
End Function
Public Shared Function YaSeEnvióCsvParaAyer(ByVal bd As bdGestionAsegasa.gestionasegasaEntities) As Boolean
Dim resultado As Boolean = False
Dim idTipoGestionPoliza As String = bd.enumeraciones.First(Function(x) x.Codigo = "TGP.CSVAXA").idEnumeracion
Dim idTipoFicheroCSV As String = bd.enumeraciones.First(Function(x) x.Codigo = "TIPFIC.CSVAXA").idEnumeracion
Dim dAyer As Date = Today.AddDays(-1)
Dim sDescripcion As String = String.Format("{0}{1}.csv",
bd.enumeraciones.First(Function(x) x.Codigo = "AXATRACTORES.NombreFicheroCSV").ValorAlfabeticoLargo,
dAyer.ToString("yyyy-MM-dd"))
resultado = bd.gestionesvarias.Any(Function(x) x.idTipo = idTipoGestionPoliza AndAlso x.FechaProcesado.HasValue _
AndAlso x.Descripción = sDescripcion)
'resultado = (From x In bd.gestionesvarias Where x.idTipo = idTipoGestionPoliza AndAlso x.FechaProcesado.HasValue AndAlso x.Descripción = sDescripcion).Count > 0
Return resultado
End Function
Public Shared Function YaSeEnvióCsvParaHoy(ByVal bd As bdGestionAsegasa.gestionasegasaEntities) As Boolean
Dim resultado As Boolean = False
Dim idTipoGestionPoliza As String = bd.enumeraciones.First(Function(x) x.Codigo = "TGP.CSVAXA").idEnumeracion
Dim idTipoFicheroCSV As String = bd.enumeraciones.First(Function(x) x.Codigo = "TIPFIC.CSVAXA").idEnumeracion
Dim sDescripcion As String = String.Format("{0}{1}.csv",
bd.enumeraciones.First(Function(x) x.Codigo = "AXATRACTORES.NombreFicheroCSV").ValorAlfabeticoLargo,
Today.ToString("yyyy-MM-dd"))
resultado = bd.gestionesvarias.Any(Function(x) x.idTipo = idTipoGestionPoliza AndAlso x.FechaProcesado.HasValue _
AndAlso x.Descripción = sDescripcion)
Return resultado
End Function
Public Shared Function NumeroDeLineasEnElArchivoCSV(ByVal rutaArchivoCSV As String) As Integer
Dim resultado = 0
resultado = IO.File.ReadLines(rutaArchivoCSV).Count()
Return resultado
End Function
''' <summary>
''' Obtiene el siguiente nº de póliza disponible para TractoresAXA.
''' </summary>
''' <param name="bd"></param>
''' <param name="n">Este parámetro se usa solo para depuración. Sirve para simular cuál es el último nº de póliza usado especificándolo en este parámetro.</param>
''' <returns>Devuelve el siguiente nº de póliza disponible ó -1 si no hay ninguno disponible.</returns>
''' <remarks>Para uso en producción es imprescindible evitar usar el segundo parámetro opcional.</remarks>
'Public Shared Function ObtenerNumeroDePolizaDisponibleTractoresAXA(ByVal bd As bdGestionAsegasa.gestionasegasaEntities, Optional ByVal n As UInteger = 0) As String
' Dim resultado As String = ""
' Dim inicio As bdGestionAsegasa.enumeraciones
' Dim fin As bdGestionAsegasa.enumeraciones
' Dim actual As UInteger = 0
' Dim bEncontrado As Boolean = False
' Dim enumNumeracion = (From x In bd.enumeraciones Where x.Codigo.StartsWith("AXATRACTORES.numeracion.") AndAlso x.ValorAlfabetico1.ToUpper.Trim = "DISPONIBLE"
' Order By x.Codigo Select x).ToList()
' Dim idRamoTractores As String = (From x In bd.ramos Where x.Codigo = "1-1" Select x.idRamo).FirstOrDefault
' Dim idRamoRemolques As String = (From x In bd.ramos Where x.Codigo = "1-1-1" Select x.idRamo).FirstOrDefault
' ' De todos los posibles rangos, tengo que elegir el más bajo que esté disponible.
' ' Como lo he ordenado por Codigo, al hacerlo así ya estoy eligiendo el más bajo disponible.
' ' Con rango más bajo me refiero al valor que está dentro del código, no a los números del rango en sí.
' ' Formato del código: "AXATRACTORES.numeracion.0000"
' inicio = enumNumeracion.Where(Function(x) x.Codigo.EndsWith(".inicio")).FirstOrDefault
' fin = enumNumeracion.Where(Function(x) x.Codigo.EndsWith(".fin")).FirstOrDefault
' Try
' If n = 0 Then
' actual = (From x In bd.polizassg Where x.NumeroPoliza >= inicio.ValorNumerico1 AndAlso x.NumeroPoliza <= fin.ValorNumerico1 AndAlso
' (x.idRamo = idRamoTractores OrElse x.idRamo = idRamoRemolques)
' Order By x.NumeroPoliza Descending
' Select x.NumeroPoliza Take 10).ToList().FirstOrDefault
' Else
' actual = n
' End If
' Catch ex As Exception
' ' Nada, significa que aún no existe el primero.
' End Try
' If actual = 0 Then
' ' Si "actual" vale 0 significa que es la primera vez y tenemos que usar el primero del rango.
' resultado = inicio.ValorNumerico1
' bEncontrado = True
' Else
' If actual < inicio.ValorNumerico1 Then
' resultado = inicio.ValorNumerico1
' bEncontrado = True
' ElseIf actual = fin.ValorNumerico1 Then
' ' Caso en el que hay que pasar a usar el siguiente rango.
' ' Hay que marcar el actual rango como completado.
' inicio.ValorAlfabetico1 = "Usado"
' fin.ValorAlfabetico1 = "Usado"
' bd.GuardarCambios()
' resultado = ObtenerNumeroDePolizaDisponibleTractoresAXA(bd)
' ' Sí, esta es una función recursiva. Está comprobado que esta recursividad funciona adecuadamente según los datos que haya en la base de datos.
' ElseIf actual > fin.ValorNumerico1 Then 'El número final sí lo podemos usar, por eso la comparación se hace con ">".
' resultado = -1 'Significa que ya hemos llegado al límite de asignaciones, no podemos asignar más.
' bEncontrado = True
' ' TODO: Mirar si hay otro rango más?
' Dim asunto As String = "TractoresAXA: Se han acabado los nºs de pólizas reservados para el servicio de TractoresAXA. Todas las altas que se realicen a partir de ahora fallarán hasta que se asignen nuevos rangos."
' Dim cuerpo As String = asunto & vbCrLf & " Hay que avisar a ASEGASA para que gestionen con AXA la asignación de un nuevo rango de nºs de pólizas para este servicio." & vbCrLf &
' "En método `" & System.Reflection.MethodBase.GetCurrentMethod.ToString & "`. " _
' & vbCrLf & Environment.MachineName
' Call AñadeLog(tsl5.Enumeraciones.TipoLog.Fallo, asunto, cuerpo)
' tsl5.Utilidades.EnviarNotificacionSlack(asunto, destinatario:="#asegasa", descripcionRemitente:=Reflection.MethodBase.GetCurrentMethod.ToString)
' Else
' ' Caso normal, en el que hay que usar el número que sigue, porque seguimos dentro del rango.
' '
' ' Pero tengo que comprobar que "actual + 1" no esté usado. ¿Cómo lo hago? Bueno, sería mucha
' ' casualidad y mucha mala suerte que dos altas coincidan en el tiempo de tal modo que ambas
' ' pillen el mismo nº de poliza.
' resultado = actual + 1
' bEncontrado = True
' End If
' End If
' ' TODO: danmun: Lanzar aquí mensajes cuando falten 500, 200, 100, 50, 20, 10, avisando.
' 'If bEncontrado Then
' ' Dim numerosReservadosDisponibles As Integer = ComprobarCuantosNumerosReservadosQuedanDisponibles(actual, inicio, fin)
' ' Dim listaDeLimitesParaEnviarAdvertencias As Integer() = {10, 20, 50, 100, 200, 500}
' ' Dim bAdvertenciaEnviada As Boolean = False
' ' ' La idea es la siguiente: dispongo de un array donde tenemos los límites en los que hay que lanzar la advertencia
' ' ' de que se están gastando los nºs de pólizas reservados para TractoresAXA. El array está ordenado de menor a mayor.
' ' ' Al recorrer el array, compruebo: ¿quedan menos de 10 números disponibles? Si es así, lanzo advertencia y ya no vuelvo
' ' ' a realizar más comprobaciones. Si no es así, compruebo con el siguiente límite, que sería 20. Por lo tanto, es posible
' ' ' completar el recorrido del array sin enviar ninguna advertencia o bien enviando solamente 1.
' ' For Each i In listaDeLimitesParaEnviarAdvertencias
' ' If Not bAdvertenciaEnviada AndAlso numerosReservadosDisponibles < i Then
' ' ' Notificación Slack
' ' Try
' ' Dim asunto As String = String.Format("TractoresAXA: quedan menos de {0} nºs de póliza reservados sin usar.", i)
' ' Dim sbCuerpo As New Text.StringBuilder()
' ' sbCuerpo.AppendFormat("*TractoresAXA*: quedan menos de {1} nºs de póliza reservados sin usar.{0}", vbCrLf, i)
' ' sbCuerpo.AppendLine("Es recomendable avisar a ASEGASA para que gestionen con AXA la asignación de un nuevo rango de nºs de pólizas para este servicio.")
' ' sbCuerpo.AppendFormat("```Próximo nº de póliza que va a ser usado de inmediato: {1}{0}Primer nº del rango actual:{2}{0}Último nº del rango actual: {3}{0}Servidor: {4}```{0}", vbCrLf,
' ' resultado, inicio.ValorNumerico1, fin.ValorNumerico1, Environment.MachineName)
' ' sbCuerpo.AppendFormat("En método `{0}` y en máquina `{1}`.", System.Reflection.MethodBase.GetCurrentMethod.ToString, Environment.MachineName)
' ' Call AñadeLog(tsl5.Enumeraciones.TipoLog.Advertencia, asunto, sbCuerpo.ToString)
' ' tsl5.Utilidades.EnviarNotificacionSlack(sbCuerpo.ToString, destinatario:="#asegasa", descripcionRemitente:=Reflection.MethodBase.GetCurrentMethod.ToString)
' ' Catch ex As Exception
' ' ' Si esta notificación da error no debe pararse el servicio, así que no hago nada.
' ' End Try
' ' bAdvertenciaEnviada = True
' ' End If
' ' Next
' 'End If
' Return resultado
'End Function
Private Shared Function ComprobarCuantosNumerosReservadosQuedanDisponibles(ByVal nActual As Integer, ByRef inicio As bdGestionAsegasa.enumeraciones, ByRef fin As bdGestionAsegasa.enumeraciones) As Integer
' TODO: danmun: comprobar que esto funciona bien cuando hay rangos (creo que va a ser que no)
Dim resultado As Integer = 0
resultado = Integer.Parse(fin.ValorNumerico1) - nActual
Debug.WriteLine("ComprobarCuantosNumerosReservadosQuedanDisponibles = " & resultado)
Return resultado
End Function
Private Shared Function ObtenerTipoDocumentoTractoresAxa(ByVal numeroDocumento As String) As String
Dim TipoDI = numeroDocumento.TipoDocumentoIdentidad
If TipoDI = tsl5.ValidarDocumentoIdentidad.TiposDocumentosEnum.CIF Then
Return "CIF"
Else
Return "NIF"
End If
End Function
Private Shared Function ObtenerSexoTractoresAxa(ByVal cadenaSexo As String, ByVal bd As bdGestionAsegasa.gestionasegasaEntities) As String
Dim resultado As String = bd.enumeraciones.First(Function(x) x.Codigo = "AXATRACTORES.sexo.SinInformar").ValorAlfabetico1
Dim axaHombre As String = bd.enumeraciones.First(Function(x) x.Codigo = "AXATRACTORES.sexo.Hombre").ValorAlfabetico1
Dim axaMujer As String = bd.enumeraciones.First(Function(x) x.Codigo = "AXATRACTORES.sexo.Mujer").ValorAlfabetico1
Dim idEnumSexoHombre As Integer = bd.enumeraciones.First(Function(x) x.Codigo = "SEXO.HOMBRE").idEnumeracion
Dim idEnumSexoMujer As Integer = bd.enumeraciones.First(Function(x) x.Codigo = "SEXO.MUJER").idEnumeracion
If cadenaSexo = idEnumSexoHombre Then resultado = axaHombre
If cadenaSexo = idEnumSexoMujer Then resultado = axaMujer
Return resultado
End Function
End Class

View File

@@ -0,0 +1,128 @@
'Imports bdGestionAsegasa
'Imports GestionAsegasa.Enumeraciones
'Public Class ProcesosZurich
' Public Shared Async Function ObtieneDocumentosPolizasPendientes() As Task
' Try
' Dim bd = bdGestionAsegasa.gestionasegasaEntities.NuevoContextoCN()
' Dim idZurich = bd.companias.First(Function(x) x.Codigo = "0013").idCompania
' Dim tipoFichero As Integer = bd.enumeraciones.Where(Function(x) x.Codigo = "TIPFIC.DOCPOL").First.idEnumeracion
' Dim fi As New Date(2024, 10, 5)
' Dim pols = bd.polizassg.Where(Function(x) x.idCompania = idZurich AndAlso x.NumeroPoliza IsNot Nothing AndAlso x.FechaAlta > fi AndAlso x.documentospolizassg.All(Function(y) y.Tipo = 0)).ToList()
' Dim cz = bd.enumeraciones.First(Function(x) x.Codigo = "CONF.0013")
' Dim sv = New ServicioDocumentos(cz.ValorAlfabetico1, cz.ValorAlfabetico2)
' For Each p In pols
' Dim numpol = p.NumeroPoliza.PadLeft(14, "0")
' Dim ld = Await sv.ObtenerDocumentosAsync(numpol, -1)
' ' Obtener la lista de documentos que no son recibos
' Dim ldocs = ld.Document.Where(Function(x) Not String.IsNullOrEmpty(x.documentTypeDesc) AndAlso Not x.documentTypeDesc.ToLower().Contains("recibo"))
' For Each d In ldocs
' Try
' Dim dr = Await sv.DescargarDocumentoAsync("", d.documentCode, False, numpol, ld.policyVersion)
' Dim sha1 = tsl5.crypt.SHA1(dr.documentFileContent.data)
' Dim docpol = p.documentospolizassg.FirstOrDefault(Function(x) x.Hash = sha1)
' If docpol Is Nothing Then
' docpol = New documentospolizassg()
' Dim fichero = New ficheros()
' fichero.Descripcion = d.documentTypeDesc
' fichero.Fecha = Date.Now
' fichero.idTipo = tipoFichero
' fichero.Fichero = dr.documentFileContent.data
' fichero.NombreFichero = dr.documentFileContent.fileName
' fichero.idAplicacion = p.idPoliza
' ' Crear y almacenar el documento de la póliza
' docpol.Descripcion = d.documentTypeDesc.ToUpper
' docpol.ficheros = fichero
' docpol.FechaComprobacion = Date.Now
' docpol.Fecha = Date.Now
' docpol.Codigo = d.documentCode
' docpol.Hash = sha1
' docpol.Tipo = ObtieneTipoDocumento(d.typeCode)
' p.documentospolizassg.Add(docpol)
' Else
' docpol.Codigo = d.documentCode
' docpol.Tipo = ObtieneTipoDocumento(d.typeCode)
' End If
' bd.SaveChanges()
' Catch ex As Exception
' Call bdGestionAsegasa.Utilidades.AñadeLog(tsl5.Enumeraciones.TipoLog.Fallo, "En ObtieneDocumentosPolizasPendientes.", "Rutina: ObtieneDocumentosPolizasPendientes. Poliza:" & p.NumeroPoliza & " dc:" & d.documentCode & " " & bdGestionAsegasa.gestionasegasaEntities.bdga.Servidor & " " & ex.Message, ex)
' End Try
' Next
' Next
' Catch ex As Exception
' Call bdGestionAsegasa.Utilidades.AñadeLog(tsl5.Enumeraciones.TipoLog.Fallo, "En ObtieneDocumentosPolizasPendientes.", "Rutina: ObtieneDocumentosPolizasPendientes. " & bdGestionAsegasa.gestionasegasaEntities.bdga.Servidor & " " & ex.Message, ex)
' End Try
' End Function
' Public Shared Async Function ObtieneDocumentosRecibosPendientes() As Task
' Try
' Dim bd = bdGestionAsegasa.gestionasegasaEntities.NuevoContextoCN()
' Dim idZurich = bd.companias.First(Function(x) x.Codigo = "0013").idCompania
' Dim tipoFichero As Integer = bd.enumeraciones.Where(Function(x) x.Codigo = "TIPFIC.DOCPOL").First.idEnumeracion
' Dim fi As New Date(2024, 9, 23)
' Dim cz = bd.enumeraciones.First(Function(x) x.Codigo = "CONF.0013")
' Dim svRecibos = New ServicioRecibos(cz.ValorAlfabetico1, cz.ValorAlfabetico2)
' Dim svDocumentos = New ServicioDocumentos(cz.ValorAlfabetico1, cz.ValorAlfabetico2)
' Dim recs = bd.recibos.Where(Function(x) x.polizassg.idCompania = idZurich AndAlso x.FechaEfecto > fi AndAlso x.documentospolizassg.Count = 0).ToList()
' Dim dr As ObtenerRecibos.getDuplicatedReceiptResponse = Nothing
' For Each r In recs
' Try
' Dim p = r.polizassg
' dr = Await svRecibos.ObtenerReciboDuplicadoAsync(r.NumeroRecibo, cz.ValorAlfabetico1)
' Dim numpol = p.NumeroPoliza.PadLeft(14, "0")
' Dim bpdf = Await svDocumentos.DescargarDocumentoAsync("", dr.documentCode, False, numpol, dr.policyVersion)
' Dim sha1 = tsl5.crypt.SHA1(bpdf.documentFileContent.data)
' Dim docpol = p.documentospolizassg.FirstOrDefault(Function(x) x.Hash = sha1)
' If docpol Is Nothing Then
' docpol = New documentospolizassg()
' Dim fichero = New ficheros()
' fichero.Descripcion = "RECIBO"
' fichero.Fecha = Date.Now
' fichero.idTipo = tipoFichero
' fichero.Fichero = bpdf.documentFileContent.data
' fichero.NombreFichero = dr.documentCode & ".pdf"
' fichero.idAplicacion = p.idPoliza
' docpol.Descripcion = "RECIBO"
' docpol.ficheros = fichero
' docpol.FechaComprobacion = Date.Now
' docpol.Fecha = Date.Now
' docpol.Codigo = dr.documentCode
' docpol.Hash = sha1
' docpol.Tipo = documentospolizassg.TipoDocumentoEnum.RECIBO
' docpol.idRecibo = r.idRecibo
' p.documentospolizassg.Add(docpol)
' Else
' docpol.Codigo = dr.documentCode
' docpol.Tipo = documentospolizassg.TipoDocumentoEnum.RECIBO
' End If
' bd.SaveChanges()
' dr = Nothing
' Catch ex As Exception
' Call bdGestionAsegasa.Utilidades.AñadeLog(tsl5.Enumeraciones.TipoLog.Fallo, "En ObtieneDocumentosRecibosPendientes.", "Rutina: ObtieneDocumentosRecibosPendientes. Recibo:" & r.CodigoRecibo & If(dr Is Nothing, "", " dc:" & dr.documentCode) & " " & bdGestionAsegasa.gestionasegasaEntities.bdga.Servidor & " " & ex.Message, ex)
' End Try
' Next
' Catch ex As Exception
' Call bdGestionAsegasa.Utilidades.AñadeLog(tsl5.Enumeraciones.TipoLog.Fallo, "En ObtieneDocumentosRecibosPendientes.", "Rutina: ObtieneDocumentosRecibosPendientes. " & bdGestionAsegasa.gestionasegasaEntities.bdga.Servidor & " " & ex.Message, ex)
' End Try
' End Function
' Private Shared Function ObtieneTipoDocumento(typeCode As String) As Integer
' Select Case typeCode
' Case "CL"
' Return documentospolizassg.TipoDocumentoEnum.PÓLIZA
' Case "CE"
' Return documentospolizassg.TipoDocumentoEnum.CERTIFICADO_SEGURO
' Case Else
' Return documentospolizassg.TipoDocumentoEnum.OTROS
' End Select
' End Function
'End Class