hecho rf 16

This commit is contained in:
2025-01-30 17:24:03 -03:00
parent ac2de71179
commit 029f8e5fce
3 changed files with 85 additions and 4 deletions

View File

@@ -47,6 +47,34 @@ public class RepositorioEstadisticas: RepositorioBase<RepositorioEstadisticas> {
return data;
}
public ChartData? ObtenerDatosPagosContrato(long idcontrato) {
var con = Context;
var cont = con.Contratos.Include(c=>c.Idcanons).ThenInclude(x=>x.IdreciboNavigation)
.Where(x=>x.Habilitado==1)
.FirstOrDefault(x=>x.Id == idcontrato);
if(cont==null)return null;
var data = new ChartData();
data.Labels= ["Pago", "Sin Pagar", "Pago Atrasado"];
Dataset d1 = new();
d1.Label="Estadistica Pagos";
var l = new List<string>(["0","0","0"]);
l[0] = cont.Idcanons.Where(x=>x.Pagado == 1Lu && x.IdreciboNavigation != null && x.IdreciboNavigation.Fecha <= x.Fecha)
.Count().ToString();
l[1] = cont.Idcanons.Where(x=>x.Pagado==0).Count().ToString();
l[2] = cont.Idcanons.Where(x=>x.Pagado == 1Lu && x.IdreciboNavigation != null && x.IdreciboNavigation.Fecha > x.Fecha)
.Count().ToString();
d1.Data.AddRange(l);
data.Datasets.Add(d1);
return data;
}
public IQueryable<Contrato> TablaObtenerContratosIniciadosPorAño(int year) {
var con = Context;
var contratosPorMes = con.Contratos.Include(x=>x.IddivisaNavigation).Include(x=>x.IdpropiedadNavigation)
@@ -69,4 +97,5 @@ public class RepositorioEstadisticas: RepositorioBase<RepositorioEstadisticas> {
return l;
}
}