agregado procesos y bd clases
This commit is contained in:
190
bdAsegasa/Extensiones/vf_recibosextendidos.cs
Normal file
190
bdAsegasa/Extensiones/vf_recibosextendidos.cs
Normal file
@@ -0,0 +1,190 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using bdAsegasa.dbcontext;
|
||||
using tsUtilidades;
|
||||
using tsUtilidades.Extensiones;
|
||||
namespace bdAsegasa.db
|
||||
{
|
||||
public partial class vf_recibosextendidos
|
||||
{
|
||||
private static List<enumeraciones> TiposPago;
|
||||
|
||||
public string Situacion_Web => gestionasegasaEntities.ObtieneSituacionWeb(this.idSituacion, this.idTipoPago);
|
||||
|
||||
public string CiaNumeroPoliza => $"{this.Compania}/{this.NumeroPoliza}";
|
||||
public string CompaniaNumeros => $"{this.Compania} (Números de asistencia)";
|
||||
|
||||
public recibos.EstadoRecibo Estado
|
||||
{
|
||||
get
|
||||
{
|
||||
var est = recibos.EstadoRecibo.PENDIENTE;
|
||||
if (this.idRemesa.HasValue) est = recibos.EstadoRecibo.REMESADO;
|
||||
|
||||
if (this.idTipoPago == bdAsegasa.db.gestionasegasaEntities.TipoPagoCia() || this.idTipoPago == bdAsegasa.db.gestionasegasaEntities.TipoPagoFAE()) est = recibos.EstadoRecibo.GESTION_COBRO_CIA;
|
||||
if (this.FechaLiquidacionAgente.HasValue) est = recibos.EstadoRecibo.LIQUIDADO;
|
||||
if (this.FechaBaja.HasValue && this.idCausaBaja != bdAsegasa.db.gestionasegasaEntities.CabaSupl() && this.idCausaBaja != bdAsegasa.db.gestionasegasaEntities.CabaSust()) est = recibos.EstadoRecibo.BAJA;
|
||||
if (this.FechaDevolucionBanco.HasValue) est = recibos.EstadoRecibo.DEVUELTO_BANCO;
|
||||
return est;
|
||||
}
|
||||
}
|
||||
|
||||
public string EstadoRecibo => Estado.ToString().Replace("_", " ");
|
||||
|
||||
public string IBANoTipoPago
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this.idTipoPago.HasValue)
|
||||
{
|
||||
if (TiposPago == null)
|
||||
{
|
||||
// Asumiendo que bdGestionAsegasa es una clase estática o accesible en el contexto
|
||||
var bdtmp = bdAsegasa.tscgestionasegasa.NuevoContexto();
|
||||
|
||||
TiposPago = bdtmp.enumeraciones
|
||||
.Where(x => x.idGrupoEnumeracionNavigation.Grupo == "TIPP")
|
||||
.ToList();
|
||||
}
|
||||
|
||||
var tp = TiposPago.FirstOrDefault(x => x.idEnumeracion == this.idTipoPago);
|
||||
|
||||
if (tp == null)
|
||||
{
|
||||
return "* DESCONOCIDO *";
|
||||
}
|
||||
else
|
||||
{
|
||||
if (tp.Codigo == "TIPP.BA")
|
||||
{
|
||||
if (string.IsNullOrEmpty(IBAN.NothingAVacio()))
|
||||
{
|
||||
return "BANCARIO SIN IBAN ASIGNADO";
|
||||
}
|
||||
else
|
||||
{
|
||||
return IBAN;
|
||||
}
|
||||
}
|
||||
|
||||
return tp.Descripcion;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return "* NO ASIGNADO *";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public string TipoPago
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this.idTipoPago.HasValue)
|
||||
{
|
||||
if (TiposPago == null)
|
||||
{
|
||||
var bdtmp = bdAsegasa.tscgestionasegasa.NuevoContexto();
|
||||
|
||||
TiposPago = bdtmp.enumeraciones
|
||||
.Where(x => x.idGrupoEnumeracionNavigation.Grupo == "TIPP")
|
||||
.ToList();
|
||||
}
|
||||
|
||||
var tp = TiposPago.FirstOrDefault(x => x.idEnumeracion == this.idTipoPago);
|
||||
|
||||
if (tp == null)
|
||||
{
|
||||
return "* DESCONOCIDO *";
|
||||
}
|
||||
else
|
||||
{
|
||||
return tp.Descripcion;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return "* NO ASIGNADO *";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool IBANCorrecto => tsUtilidades.Bancos.Genericas.IBANCorrecto(this.IBAN) && this.IBAN != "ES8200000000000000000000";
|
||||
|
||||
public int? idSubAgente_Especial
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this.idSubagente.HasValue && this.CodigoAgente == "000047002186")
|
||||
{
|
||||
using (var bd = tscgestionasegasa.NuevoContexto())
|
||||
{
|
||||
var codigoBase = this.CodigoSubAgente.Substring(0, 2) + "00";
|
||||
var subage = bd.subagentes.FirstOrDefault(x => x.idAgente == this.idAgente && x.Codigo == codigoBase);
|
||||
return subage?.idSubagente ?? this.idSubagente;
|
||||
}
|
||||
}
|
||||
return this.idSubagente;
|
||||
}
|
||||
}
|
||||
|
||||
public string NumeroPolizaSuplementoLargo => (this.NumeroSuplemento == 0) ? this.NumeroPoliza : $"{this.NumeroPoliza} ({this.NumeroSuplemento})";
|
||||
public string NumeroPolizaSuplemento => (this.NumeroSuplemento == 0) ? this.NumeroPoliza : $"{this.NumeroPoliza}#{this.NumeroSuplemento}";
|
||||
|
||||
public double LiquidoCia => Math.Round((double)((this.TotalRecibo ?? 0) - (this.TotalComision ?? 0)), 2);
|
||||
public double PrimaNetaBonificada => Math.Round((double)((this.PrimaNeta ?? 0) + (this.BonificacionORecargo ?? 0)), 2);
|
||||
|
||||
public double ImporteALiquidarAgente
|
||||
{
|
||||
get
|
||||
{
|
||||
int factor = EsRetornoComision_TMP ? -1 : 1;
|
||||
return Math.Round(factor * (double)(this.ComisionAgente ?? 0), 2, MidpointRounding.AwayFromZero);
|
||||
}
|
||||
}
|
||||
|
||||
public string TipoLiquidacionAgente => EsRetornoComision_TMP ? "RETORNO COMISION" : "LIQUIDACIÓN";
|
||||
|
||||
public bool EsRetornoComision_TMP { get; set; }
|
||||
public int idRegularizacion_TMP { get; set; }
|
||||
|
||||
private static int? idTippPE;
|
||||
public bool CuentaContableTomadorErronea
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!idTippPE.HasValue)
|
||||
{
|
||||
using var bd = tscgestionasegasa.NuevoContexto();
|
||||
idTippPE = bd.enumeraciones.First(x => x.Codigo == "TIPP.PE").idEnumeracion;
|
||||
}
|
||||
return this.idTipoPago == idTippPE.Value && (this.CuentaContableTomador ?? "").Length != 8;
|
||||
}
|
||||
}
|
||||
|
||||
public string TelefonoMovilValido
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this.Telefono1Tomador.EsNumeroTelefonoMovilEspañolValido())
|
||||
{
|
||||
return this.Telefono1Tomador;
|
||||
}
|
||||
else if (this.Telefono2Tomador.EsNumeroTelefonoMovilEspañolValido())
|
||||
{
|
||||
return this.Telefono2Tomador;
|
||||
}
|
||||
else
|
||||
{
|
||||
return "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public string ProvinciaTomador => (this.CodigoPostalTomador?.Length > 2) ? this.CodigoPostalTomador.Substring(0, 2) : "";
|
||||
|
||||
public bool AntiguedadMayor2M => (DateTime.Today - this.FechaEfecto.ToDateTime(TimeOnly.MinValue)).TotalDays > 60;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user