falta soporte para el menu de propietario de mostrar los archivos

This commit is contained in:
2025-01-19 01:15:06 -03:00
parent 28415f8ba8
commit f5e3c4aacd
10 changed files with 400 additions and 29 deletions

View File

@@ -1,5 +1,6 @@
using Entidades;
using Microsoft.EntityFrameworkCore;
using Org.BouncyCastle.Math.EC.Rfc7748;
namespace Modelo;
@@ -14,17 +15,13 @@ public class RepositorioCanons: RepositorioBase<RepositorioCanons> {
var con = Context;
Canon? cc = null;
var c = con.Canons.FirstOrDefault(x => x.Idrecibo == null &&
x.Fecha == f );
var c = con.Contratos.Include(x=>x.Idcanons).ThenInclude(x=>x.IdreciboNavigation).FirstOrDefault(x => x.Id == idcont);
if (c == null) return null;
//no deberia de tener que usar un foreach pero entity por algun motivo mapeo
//la entidad como muchos a muchos. no hay forma de que un canon tenga multiples
//contratos por como lo codifique pero igualmente
foreach (var i in c.Idcontratos) {
foreach (var j in i.Idcanons) {
if (j.Fecha == f) {
cc = j;
}
foreach (var j in c.Idcanons) {
if (j.Fecha == f) {
cc = j;
break;
}
}
return cc;
@@ -52,6 +49,10 @@ public class RepositorioCanons: RepositorioBase<RepositorioCanons> {
if (cont == null) return false;
int exist = cont.Idcanons.Count();
Canon? d = cont.Idcanons.OrderByDescending(x=>x.Fecha).FirstOrDefault();
if (d == null) return false;
if (exist+cont.MesesHastaAumento >= cont.MesesDurationContrato){
exist = cont.MesesDurationContrato-exist;
} else{
@@ -62,8 +63,14 @@ public class RepositorioCanons: RepositorioBase<RepositorioCanons> {
for (int i = 0; i < exist; i++){
Canon c = new Canon{
Fecha
Fecha = d.Fecha.AddMonths(i==0?1:i+1),
Id = con.Canons.Count()+i+1,
Monto = cont.Monto,
Pagado = 0,
};
con.Canons.Add(c);
cont.Idcanons.Add(c);
}
return Guardar(con);
}
}