arregldo tema faltaba cantidad de meses
This commit is contained in:
@@ -26,7 +26,7 @@ public class RepositorioContratos: RepositorioBase<RepositorioContratos> {
|
||||
c.Iddivisa = prop.Iddivisa;
|
||||
c.Id = (con.Contratos.Any() ? con.Contratos.Max(x => x.Id) : 0) + 1;
|
||||
c.Monto = prop.Monto;
|
||||
|
||||
|
||||
con.Contratos.Add(c);
|
||||
con.Notificaciones.Add(n);
|
||||
|
||||
@@ -123,18 +123,32 @@ public class RepositorioContratos: RepositorioBase<RepositorioContratos> {
|
||||
cont.Habilitado = 1;
|
||||
cont.Fechainicio = DateTime.Now;
|
||||
var fecha = cont.Fechainicio;
|
||||
if (cont.MesesDurationContrato < cont.MesesHastaAumento) {
|
||||
for (int i = 0; i < cont.MesesDurationContrato; i++) {
|
||||
Canon can = new Canon{
|
||||
Fecha = fecha.AddMonths(i),
|
||||
Monto = cont.IdpropiedadNavigation.Monto,
|
||||
Pagado = 0,
|
||||
};
|
||||
can.Id = (con.Canons.Any()? con.Canons.Count() :0)+1+i;
|
||||
|
||||
for (int i = 0; i < cont.MesesHastaAumento; i++) {
|
||||
Canon can = new Canon{
|
||||
|
||||
con.Canons.Add(can);
|
||||
cont.Idcanons.Add(can);
|
||||
}
|
||||
} else {
|
||||
for (int i = 0; i < cont.MesesHastaAumento; i++) {
|
||||
Canon can = new Canon{
|
||||
Fecha = fecha.AddMonths(i),
|
||||
Monto = cont.IdpropiedadNavigation.Monto,
|
||||
Pagado = 0,
|
||||
};
|
||||
can.Id = (con.Canons.Any()? con.Canons.Count() :0)+1+i;
|
||||
Monto = cont.IdpropiedadNavigation.Monto,
|
||||
Pagado = 0,
|
||||
};
|
||||
can.Id = (con.Canons.Any()? con.Canons.Count() :0)+1+i;
|
||||
|
||||
|
||||
con.Canons.Add(can);
|
||||
cont.Idcanons.Add(can);
|
||||
con.Canons.Add(can);
|
||||
cont.Idcanons.Add(can);
|
||||
}
|
||||
}
|
||||
return Guardar(con);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user