add new
This commit is contained in:
68
RS_system/Models/ViewModels/ArticuloViewModel.cs
Normal file
68
RS_system/Models/ViewModels/ArticuloViewModel.cs
Normal file
@@ -0,0 +1,68 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Rs_system.Models;
|
||||
|
||||
namespace Rs_system.Models.ViewModels;
|
||||
|
||||
public class ArticuloViewModel
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
[Required(ErrorMessage = "El código es obligatorio")]
|
||||
[StringLength(50, ErrorMessage = "El código no puede exceder los 50 caracteres")]
|
||||
public string Codigo { get; set; } = string.Empty;
|
||||
|
||||
[Required(ErrorMessage = "El nombre es obligatorio")]
|
||||
[StringLength(100, ErrorMessage = "El nombre no puede exceder los 100 caracteres")]
|
||||
public string Nombre { get; set; } = string.Empty;
|
||||
|
||||
[StringLength(500, ErrorMessage = "La descripción no puede exceder los 500 caracteres")]
|
||||
public string? Descripcion { get; set; }
|
||||
|
||||
[StringLength(100)]
|
||||
public string? Marca { get; set; }
|
||||
|
||||
[StringLength(100)]
|
||||
public string? Modelo { get; set; }
|
||||
|
||||
[Display(Name = "Número de Serie")]
|
||||
[StringLength(100)]
|
||||
public string? NumeroSerie { get; set; }
|
||||
|
||||
[Range(0, 99999999.99)]
|
||||
public decimal Precio { get; set; } = 0;
|
||||
|
||||
[Display(Name = "Fecha de Adquisición")]
|
||||
public DateOnly? FechaAdquisicion { get; set; }
|
||||
|
||||
public string? ImagenUrl { get; set; }
|
||||
|
||||
[Display(Name = "Imagen")]
|
||||
public IFormFile? ImagenFile { get; set; }
|
||||
|
||||
[Display(Name = "Tipo de Control")]
|
||||
public string? TipoControl { get; set; } = "UNITARIO"; // Default for View
|
||||
|
||||
[Display(Name = "Cantidad Inicial")]
|
||||
[Range(1, 100000)]
|
||||
public int CantidadInicial { get; set; } = 1;
|
||||
|
||||
public int CategoriaId { get; set; }
|
||||
|
||||
[Display(Name = "Estado")]
|
||||
[Required(ErrorMessage = "El estado es obligatorio")]
|
||||
public int EstadoId { get; set; }
|
||||
|
||||
[Display(Name = "Ubicación")]
|
||||
[Required(ErrorMessage = "La ubicación es obligatoria")]
|
||||
public int UbicacionId { get; set; }
|
||||
|
||||
public bool Activo { get; set; } = true;
|
||||
|
||||
// Display properties for lists/details
|
||||
public string? CategoriaNombre { get; set; }
|
||||
public string? EstadoNombre { get; set; }
|
||||
public string? EstadoColor { get; set; }
|
||||
public string? UbicacionNombre { get; set; }
|
||||
public int CantidadGlobal { get; set; }
|
||||
}
|
||||
41
RS_system/Models/ViewModels/EstadoCuentaViewModel.cs
Normal file
41
RS_system/Models/ViewModels/EstadoCuentaViewModel.cs
Normal file
@@ -0,0 +1,41 @@
|
||||
namespace Rs_system.Models.ViewModels;
|
||||
|
||||
public class EstadoCuentaViewModel
|
||||
{
|
||||
public long MiembroId { get; set; }
|
||||
public string NombreMiembro { get; set; } = string.Empty;
|
||||
public DateTime FechaConsulta { get; set; }
|
||||
|
||||
public List<HistorialPorTipo> HistorialPorTipos { get; set; } = new();
|
||||
public decimal TotalAportado { get; set; }
|
||||
}
|
||||
|
||||
public class HistorialPorTipo
|
||||
{
|
||||
public string TipoNombre { get; set; } = string.Empty;
|
||||
public List<RegistroMensual> Registros { get; set; } = new();
|
||||
public decimal TotalTipo { get; set; }
|
||||
}
|
||||
|
||||
public class RegistroMensual
|
||||
{
|
||||
public int Mes { get; set; }
|
||||
public int Anio { get; set; }
|
||||
public decimal Monto { get; set; }
|
||||
public DateTime FechaRegistro { get; set; }
|
||||
|
||||
public string MesTexto => ObtenerMesTexto();
|
||||
|
||||
private string ObtenerMesTexto()
|
||||
{
|
||||
try
|
||||
{
|
||||
var fecha = new DateTime(Anio, Mes, 1);
|
||||
return fecha.ToString("MMMM yyyy", new System.Globalization.CultureInfo("es-ES"));
|
||||
}
|
||||
catch
|
||||
{
|
||||
return $"{Mes}/{Anio}";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Rs_system.Models;
|
||||
|
||||
namespace Rs_system.Models.ViewModels;
|
||||
|
||||
public class RegistrarColaboracionViewModel
|
||||
{
|
||||
[Required(ErrorMessage = "Debe seleccionar un miembro")]
|
||||
public long MiembroId { get; set; }
|
||||
|
||||
[Display(Name = "Mes Inicial")]
|
||||
[Required(ErrorMessage = "Debe seleccionar el mes inicial")]
|
||||
[Range(1, 12, ErrorMessage = "Mes debe estar entre 1 y 12")]
|
||||
public int MesInicial { get; set; }
|
||||
|
||||
[Display(Name = "Año Inicial")]
|
||||
[Required(ErrorMessage = "Debe seleccionar el año inicial")]
|
||||
[Range(2000, 2100, ErrorMessage = "Año debe estar entre 2000 y 2100")]
|
||||
public int AnioInicial { get; set; }
|
||||
|
||||
[Display(Name = "Mes Final")]
|
||||
[Required(ErrorMessage = "Debe seleccionar el mes final")]
|
||||
[Range(1, 12, ErrorMessage = "Mes debe estar entre 1 y 12")]
|
||||
public int MesFinal { get; set; }
|
||||
|
||||
[Display(Name = "Año Final")]
|
||||
[Required(ErrorMessage = "Debe seleccionar el año final")]
|
||||
[Range(2000, 2100, ErrorMessage = "Año debe estar entre 2000 y 2100")]
|
||||
public int AnioFinal { get; set; }
|
||||
|
||||
[Required(ErrorMessage = "Debe seleccionar al menos un tipo de colaboración")]
|
||||
public List<long> TiposSeleccionados { get; set; } = new();
|
||||
|
||||
[Required(ErrorMessage = "Debe ingresar el monto total")]
|
||||
[Range(0.01, 999999.99, ErrorMessage = "El monto total debe ser mayor a 0")]
|
||||
[Display(Name = "Monto Total Entregado")]
|
||||
public decimal MontoTotal { get; set; }
|
||||
|
||||
[Display(Name = "Tipo de Colaboración Prioritaria")]
|
||||
public long? TipoPrioritario { get; set; }
|
||||
|
||||
[MaxLength(500, ErrorMessage = "Las observaciones no pueden exceder 500 caracteres")]
|
||||
[Display(Name = "Observaciones")]
|
||||
public string? Observaciones { get; set; }
|
||||
|
||||
// Para cargar en el formulario
|
||||
public List<TipoColaboracion> TiposDisponibles { get; set; } = new();
|
||||
|
||||
// Propiedad calculada: Total de meses
|
||||
public int TotalMeses
|
||||
{
|
||||
get
|
||||
{
|
||||
try
|
||||
{
|
||||
var fechaInicial = new DateTime(AnioInicial, MesInicial, 1);
|
||||
var fechaFinal = new DateTime(AnioFinal, MesFinal, 1);
|
||||
|
||||
if (fechaFinal < fechaInicial)
|
||||
return 0;
|
||||
|
||||
return ((AnioFinal - AnioInicial) * 12) + (MesFinal - MesInicial) + 1;
|
||||
}
|
||||
catch
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Propiedad calculada: Monto sugerido total basado en los tipos seleccionados
|
||||
public decimal MontoSugeridoTotal
|
||||
{
|
||||
get
|
||||
{
|
||||
if (TiposDisponibles == null || !TiposSeleccionados.Any())
|
||||
return 0;
|
||||
|
||||
var tiposSeleccionadosData = TiposDisponibles
|
||||
.Where(t => TiposSeleccionados.Contains(t.Id))
|
||||
.ToList();
|
||||
|
||||
var montoSugeridoPorMes = tiposSeleccionadosData.Sum(t => t.MontoSugerido);
|
||||
return montoSugeridoPorMes * TotalMeses;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
namespace Rs_system.Models.ViewModels;
|
||||
|
||||
public class ReporteColaboracionesViewModel
|
||||
{
|
||||
public DateTime FechaInicio { get; set; }
|
||||
public DateTime FechaFin { get; set; }
|
||||
public decimal TotalRecaudado { get; set; }
|
||||
|
||||
public List<DesglosePorTipo> DesglosePorTipos { get; set; } = new();
|
||||
public List<DetalleMovimiento> Movimientos { get; set; } = new();
|
||||
}
|
||||
|
||||
public class DesglosePorTipo
|
||||
{
|
||||
public string TipoNombre { get; set; } = string.Empty;
|
||||
public int CantidadMeses { get; set; }
|
||||
public decimal TotalRecaudado { get; set; }
|
||||
}
|
||||
|
||||
public class DetalleMovimiento
|
||||
{
|
||||
public long ColaboracionId { get; set; }
|
||||
public DateTime Fecha { get; set; }
|
||||
public string NombreMiembro { get; set; } = string.Empty;
|
||||
public string TiposColaboracion { get; set; } = string.Empty;
|
||||
public string PeriodoCubierto { get; set; } = string.Empty;
|
||||
public decimal Monto { get; set; }
|
||||
}
|
||||
39
RS_system/Models/ViewModels/UltimoPagoViewModel.cs
Normal file
39
RS_system/Models/ViewModels/UltimoPagoViewModel.cs
Normal file
@@ -0,0 +1,39 @@
|
||||
namespace Rs_system.Models.ViewModels;
|
||||
|
||||
public class UltimoPagoViewModel
|
||||
{
|
||||
public long TipoId { get; set; }
|
||||
public string NombreTipo { get; set; }
|
||||
public int UltimoMes { get; set; }
|
||||
public int UltimoAnio { get; set; }
|
||||
public DateTime FechaUltimoPago { get; set; }
|
||||
|
||||
public string UltimoPeriodoTexto
|
||||
{
|
||||
get
|
||||
{
|
||||
if (UltimoMes == 0 || UltimoAnio == 0) return "Sin pagos registrados";
|
||||
return $"{ObtenerNombreMes(UltimoMes)} {UltimoAnio}";
|
||||
}
|
||||
}
|
||||
|
||||
private string ObtenerNombreMes(int mes)
|
||||
{
|
||||
return mes switch
|
||||
{
|
||||
1 => "Enero",
|
||||
2 => "Febrero",
|
||||
3 => "Marzo",
|
||||
4 => "Abril",
|
||||
5 => "Mayo",
|
||||
6 => "Junio",
|
||||
7 => "Julio",
|
||||
8 => "Agosto",
|
||||
9 => "Septiembre",
|
||||
10 => "Octubre",
|
||||
11 => "Noviembre",
|
||||
12 => "Diciembre",
|
||||
_ => ""
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user