add new
This commit is contained in:
453
RS_system/Views/Colaboracion/Create.cshtml
Normal file
453
RS_system/Views/Colaboracion/Create.cshtml
Normal file
@@ -0,0 +1,453 @@
|
||||
@model Rs_system.Models.ViewModels.RegistrarColaboracionViewModel
|
||||
@{
|
||||
ViewData["Title"] = "Nueva Colaboración";
|
||||
}
|
||||
|
||||
<div class="d-flex justify-content-between align-items-center mb-4">
|
||||
<div>
|
||||
<h4 class="mb-1">Nueva Colaboración</h4>
|
||||
<p class="text-muted mb-0">Registrar colaboración económica mensual</p>
|
||||
</div>
|
||||
<div>
|
||||
<a asp-controller="TipoColaboracion" asp-action="Index" class="btn btn-outline-primary me-2">
|
||||
<i class="bi bi-gear me-1"></i> Gestionar Tipos
|
||||
</a>
|
||||
<a asp-action="Index" class="btn btn-outline-secondary">
|
||||
<i class="bi bi-arrow-left me-1"></i> Volver
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card-custom">
|
||||
<form asp-action="Create" method="post" id="colaboracionForm">
|
||||
<div asp-validation-summary="ModelOnly" class="alert alert-danger"></div>
|
||||
|
||||
<!-- Selección de Miembro con Búsqueda -->
|
||||
<div class="mb-4">
|
||||
<h6 class="text-primary border-bottom pb-2">Información del Miembro</h6>
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<label for="buscarMiembro" class="form-label">Buscar Miembro</label>
|
||||
<input type="text"
|
||||
id="buscarMiembro"
|
||||
class="form-control"
|
||||
placeholder="Escriba el nombre del miembro..."
|
||||
autocomplete="off" />
|
||||
<div id="resultadosBusqueda" class="list-group mt-2" style="display: none; position: absolute; z-index: 1000; max-height: 300px; overflow-y: auto; width: 90%;"></div>
|
||||
|
||||
<input type="hidden" asp-for="MiembroId" id="miembroIdHidden" />
|
||||
|
||||
<!-- Mostrar miembro seleccionado -->
|
||||
<div id="miembroSeleccionado" class="mt-3" style="display: none;">
|
||||
<div class="alert alert-success d-flex justify-content-between align-items-center mb-2">
|
||||
<div>
|
||||
<i class="bi bi-person-check me-2"></i>
|
||||
<strong id="nombreMiembroSeleccionado"></strong>
|
||||
</div>
|
||||
<button type="button" class="btn btn-sm btn-outline-danger" onclick="limpiarMiembro()">
|
||||
<i class="bi bi-x"></i> Cambiar
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<!-- Historial de Últimos Pagos -->
|
||||
<div id="infoUltimosPagos" style="display: none;">
|
||||
<div class="card border-info bg-light">
|
||||
<div class="card-header bg-transparent border-info py-1 px-3">
|
||||
<small class="text-info fw-bold"><i class="bi bi-clock-history me-1"></i> Últimos meses pagados</small>
|
||||
</div>
|
||||
<div class="card-body py-2 px-3">
|
||||
<div id="listaUltimosPagos" class="d-flex flex-wrap gap-2"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<span asp-validation-for="MiembroId" class="text-danger"></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Período de Colaboración -->
|
||||
<div class="mb-4">
|
||||
<h6 class="text-primary border-bottom pb-2">Período a Cubrir</h6>
|
||||
<div class="row">
|
||||
<div class="col-md-3">
|
||||
<label asp-for="MesInicial" class="form-label"></label>
|
||||
<select asp-for="MesInicial" class="form-select" id="mesInicial" onchange="calcularSugerido()">
|
||||
<option value="1">Enero</option>
|
||||
<option value="2">Febrero</option>
|
||||
<option value="3">Marzo</option>
|
||||
<option value="4">Abril</option>
|
||||
<option value="5">Mayo</option>
|
||||
<option value="6">Junio</option>
|
||||
<option value="7">Julio</option>
|
||||
<option value="8">Agosto</option>
|
||||
<option value="9">Septiembre</option>
|
||||
<option value="10">Octubre</option>
|
||||
<option value="11">Noviembre</option>
|
||||
<option value="12">Diciembre</option>
|
||||
</select>
|
||||
<span asp-validation-for="MesInicial" class="text-danger"></span>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<label asp-for="AnioInicial" class="form-label"></label>
|
||||
<select asp-for="AnioInicial" class="form-select" id="anioInicial" onchange="calcularSugerido()">
|
||||
@for (int i = DateTime.Now.Year; i >= DateTime.Now.Year - 5; i--)
|
||||
{
|
||||
<option value="@i">@i</option>
|
||||
}
|
||||
</select>
|
||||
<span asp-validation-for="AnioInicial" class="text-danger"></span>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<label asp-for="MesFinal" class="form-label"></label>
|
||||
<select asp-for="MesFinal" class="form-select" id="mesFinal" onchange="calcularSugerido()">
|
||||
<option value="1">Enero</option>
|
||||
<option value="2">Febrero</option>
|
||||
<option value="3">Marzo</option>
|
||||
<option value="4">Abril</option>
|
||||
<option value="5">Mayo</option>
|
||||
<option value="6">Junio</option>
|
||||
<option value="7">Julio</option>
|
||||
<option value="8">Agosto</option>
|
||||
<option value="9">Septiembre</option>
|
||||
<option value="10">Octubre</option>
|
||||
<option value="11">Noviembre</option>
|
||||
<option value="12">Diciembre</option>
|
||||
</select>
|
||||
<span asp-validation-for="MesFinal" class="text-danger"></span>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<label asp-for="AnioFinal" class="form-label"></label>
|
||||
<select asp-for="AnioFinal" class="form-select" id="anioFinal" onchange="calcularSugerido()">
|
||||
@for (int i = DateTime.Now.Year + 1; i >= DateTime.Now.Year - 5; i--)
|
||||
{
|
||||
<option value="@i" selected="@(i == DateTime.Now.Year)">@i</option>
|
||||
}
|
||||
</select>
|
||||
<span asp-validation-for="AnioFinal" class="text-danger"></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Tipos de Colaboración -->
|
||||
<div class="mb-4">
|
||||
<h6 class="text-primary border-bottom pb-2">Tipos de Colaboración</h6>
|
||||
<div class="row">
|
||||
@if (Model.TiposDisponibles != null && Model.TiposDisponibles.Any())
|
||||
{
|
||||
@foreach (var tipo in Model.TiposDisponibles)
|
||||
{
|
||||
var esTransporteOLimpieza = tipo.Nombre.Equals("Transporte", StringComparison.OrdinalIgnoreCase) ||
|
||||
tipo.Nombre.Equals("Limpieza", StringComparison.OrdinalIgnoreCase);
|
||||
|
||||
<div class="col-md-6 mb-2">
|
||||
<div class="form-check">
|
||||
<input class="form-check-input tipo-checkbox"
|
||||
type="checkbox"
|
||||
name="TiposSeleccionados"
|
||||
value="@tipo.Id"
|
||||
id="tipo_@tipo.Id"
|
||||
data-monto="@tipo.MontoSugerido"
|
||||
@(esTransporteOLimpieza ? "checked" : "")
|
||||
onchange="calcularSugerido()">
|
||||
<label class="form-check-label" for="tipo_@tipo.Id">
|
||||
<strong>@tipo.Nombre</strong>
|
||||
<span class="badge bg-success ms-2">$@tipo.MontoSugerido.ToString("N2")/mes</span>
|
||||
@if (!string.IsNullOrEmpty(tipo.Descripcion))
|
||||
{
|
||||
<br><small class="text-muted">@tipo.Descripcion</small>
|
||||
}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="col-12">
|
||||
<div class="alert alert-warning">
|
||||
No hay tipos de colaboración activos. <a asp-controller="TipoColaboracion" asp-action="Index">Gestionar tipos</a>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
<span asp-validation-for="TiposSeleccionados" class="text-danger"></span>
|
||||
</div>
|
||||
|
||||
<!-- Tipo Prioritario -->
|
||||
<div class="mb-4">
|
||||
<h6 class="text-primary border-bottom pb-2">Priorización (Opcional)</h6>
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<label asp-for="TipoPrioritario" class="form-label"></label>
|
||||
<select asp-for="TipoPrioritario" class="form-select" id="tipoPrioritario">
|
||||
<option value="">Sin prioridad - Distribuir equitativamente</option>
|
||||
@if (Model.TiposDisponibles != null)
|
||||
{
|
||||
@foreach (var tipo in Model.TiposDisponibles)
|
||||
{
|
||||
<option value="@tipo.Id">@tipo.Nombre (se pagará primero $@tipo.MontoSugerido por mes)</option>
|
||||
}
|
||||
}
|
||||
</select>
|
||||
<small class="form-text text-muted">
|
||||
Si selecciona un tipo prioritario, el monto se asignará primero a ese tipo usando su monto sugerido,
|
||||
y el resto se distribuirá equitativamente entre los demás tipos.
|
||||
</small>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Monto Total -->
|
||||
<div class="mb-4">
|
||||
<h6 class="text-primary border-bottom pb-2">Monto de la Colaboración</h6>
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<label asp-for="MontoTotal" class="form-label"></label>
|
||||
<div class="input-group input-group-lg">
|
||||
<span class="input-group-text">$</span>
|
||||
<input asp-for="MontoTotal"
|
||||
type="number"
|
||||
step="0.01"
|
||||
class="form-control"
|
||||
id="montoTotal"
|
||||
placeholder="0.00"
|
||||
required />
|
||||
</div>
|
||||
<span asp-validation-for="MontoTotal" class="text-danger"></span>
|
||||
<small class="form-text text-muted">Monto total que entrega el miembro</small>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<label class="form-label">Resumen</label>
|
||||
<div class="card bg-light">
|
||||
<div class="card-body">
|
||||
<div class="d-flex justify-content-between mb-2">
|
||||
<span>Meses a cubrir:</span>
|
||||
<strong id="totalMeses">0</strong>
|
||||
</div>
|
||||
<div class="d-flex justify-content-between mb-2">
|
||||
<span>Tipos seleccionados:</span>
|
||||
<strong id="totalTipos">0</strong>
|
||||
</div>
|
||||
<hr class="my-2">
|
||||
<div class="d-flex justify-content-between mb-2">
|
||||
<span class="text-info">Monto sugerido:</span>
|
||||
<strong class="text-info">$<span id="montoSugerido">0.00</span></strong>
|
||||
</div>
|
||||
<div id="alertaDiferencia" class="alert alert-warning py-1 px-2 mb-0 mt-2" style="display: none; font-size: 0.85rem;">
|
||||
<i class="bi bi-exclamation-triangle me-1"></i>
|
||||
<span id="mensajeDiferencia"></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Observaciones -->
|
||||
<div class="mb-4">
|
||||
<label asp-for="Observaciones" class="form-label"></label>
|
||||
<textarea asp-for="Observaciones" class="form-control" rows="3" placeholder="Notas opcionales sobre esta colaboración"></textarea>
|
||||
<span asp-validation-for="Observaciones" class="text-danger"></span>
|
||||
</div>
|
||||
|
||||
<div class="d-flex justify-content-end gap-2">
|
||||
<a asp-action="Index" class="btn btn-secondary">Cancelar</a>
|
||||
<button type="submit" class="btn btn-primary-custom">
|
||||
<i class="bi bi-save me-1"></i> Registrar Colaboración
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
@section Scripts {
|
||||
<script>
|
||||
let timeoutBusqueda = null;
|
||||
|
||||
// Búsqueda de miembros
|
||||
document.getElementById('buscarMiembro').addEventListener('input', function(e) {
|
||||
const termino = e.target.value;
|
||||
const resultadosDiv = document.getElementById('resultadosBusqueda');
|
||||
|
||||
clearTimeout(timeoutBusqueda);
|
||||
|
||||
if (termino.length < 2) {
|
||||
resultadosDiv.style.display = 'none';
|
||||
return;
|
||||
}
|
||||
|
||||
timeoutBusqueda = setTimeout(async () => {
|
||||
try {
|
||||
const response = await fetch('@Url.Action("BuscarMiembros", "Colaboracion")?termino=' + encodeURIComponent(termino));
|
||||
const miembros = await response.json();
|
||||
|
||||
if (miembros.length === 0) {
|
||||
resultadosDiv.innerHTML = '<div class="list-group-item text-muted">No se encontraron resultados</div>';
|
||||
resultadosDiv.style.display = 'block';
|
||||
return;
|
||||
}
|
||||
|
||||
let html = '';
|
||||
miembros.forEach(miembro => {
|
||||
html += `
|
||||
<button type="button" class="list-group-item list-group-item-action" onclick="seleccionarMiembro(${miembro.id}, '${miembro.text}')">
|
||||
<div class="d-flex justify-content-between align-items-center">
|
||||
<div>
|
||||
<i class="bi bi-person me-2"></i>
|
||||
<strong>${miembro.text}</strong>
|
||||
</div>
|
||||
${miembro.telefono ? '<small class="text-muted">' + miembro.telefono + '</small>' : ''}
|
||||
</div>
|
||||
</button>
|
||||
`;
|
||||
});
|
||||
|
||||
resultadosDiv.innerHTML = html;
|
||||
resultadosDiv.style.display = 'block';
|
||||
} catch (error) {
|
||||
console.error('Error al buscar miembros:', error);
|
||||
}
|
||||
}, 300);
|
||||
});
|
||||
|
||||
// Cerrar resultados cuando se hace clic fuera
|
||||
document.addEventListener('click', function(e) {
|
||||
const buscarInput = document.getElementById('buscarMiembro');
|
||||
const resultadosDiv = document.getElementById('resultadosBusqueda');
|
||||
|
||||
if (!buscarInput.contains(e.target) && !resultadosDiv.contains(e.target)) {
|
||||
resultadosDiv.style.display = 'none';
|
||||
}
|
||||
});
|
||||
|
||||
function seleccionarMiembro(id, nombre) {
|
||||
document.getElementById('miembroIdHidden').value = id;
|
||||
document.getElementById('nombreMiembroSeleccionado').textContent = nombre;
|
||||
document.getElementById('miembroSeleccionado').style.display = 'block';
|
||||
document.getElementById('buscarMiembro').value = '';
|
||||
document.getElementById('buscarMiembro').style.display = 'none';
|
||||
document.getElementById('resultadosBusqueda').style.display = 'none';
|
||||
|
||||
// Cargar historial de pagos
|
||||
cargarHistorialPagos(id);
|
||||
}
|
||||
|
||||
function limpiarMiembro() {
|
||||
document.getElementById('miembroIdHidden').value = '';
|
||||
document.getElementById('miembroSeleccionado').style.display = 'none';
|
||||
document.getElementById('buscarMiembro').style.display = 'block';
|
||||
document.getElementById('buscarMiembro').focus();
|
||||
|
||||
// Ocultar historial
|
||||
document.getElementById('infoUltimosPagos').style.display = 'none';
|
||||
document.getElementById('listaUltimosPagos').innerHTML = '';
|
||||
}
|
||||
|
||||
async function cargarHistorialPagos(miembroId) {
|
||||
const contenedor = document.getElementById('infoUltimosPagos');
|
||||
const lista = document.getElementById('listaUltimosPagos');
|
||||
|
||||
lista.innerHTML = '<div class="spinner-border spinner-border-sm text-info" role="status"></div> Cargando historial...';
|
||||
contenedor.style.display = 'block';
|
||||
|
||||
try {
|
||||
const response = await fetch('@Url.Action("ObtenerUltimosPagos", "Colaboracion")?miembroId=' + miembroId);
|
||||
const pagos = await response.json();
|
||||
|
||||
if (pagos && pagos.length > 0) {
|
||||
let html = '';
|
||||
pagos.forEach(p => {
|
||||
const colorClass = p.ultimoMes > 0 ? 'bg-white text-info border border-info' : 'bg-secondary text-white';
|
||||
html += `
|
||||
<span class="badge ${colorClass} fw-normal p-2">
|
||||
<strong>${p.nombreTipo}:</strong> ${p.ultimoPeriodoTexto}
|
||||
</span>
|
||||
`;
|
||||
});
|
||||
lista.innerHTML = html;
|
||||
} else {
|
||||
lista.innerHTML = '<span class="text-muted small">No hay historial de pagos registrado.</span>';
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Error al cargar historial:', error);
|
||||
lista.innerHTML = '<span class="text-danger small"><i class="bi bi-exclamation-circle"></i> Error al cargar historial</span>';
|
||||
}
|
||||
}
|
||||
|
||||
function calcularSugerido() {
|
||||
try {
|
||||
// Obtener valores
|
||||
const mesInicial = parseInt(document.getElementById('mesInicial').value);
|
||||
const anioInicial = parseInt(document.getElementById('anioInicial').value);
|
||||
const mesFinal = parseInt(document.getElementById('mesFinal').value);
|
||||
const anioFinal = parseInt(document.getElementById('anioFinal').value);
|
||||
|
||||
// Calcular total de meses
|
||||
const fechaInicial = new Date(anioInicial, mesInicial - 1, 1);
|
||||
const fechaFinal = new Date(anioFinal, mesFinal - 1, 1);
|
||||
|
||||
let totalMeses = 0;
|
||||
if (fechaFinal >= fechaInicial) {
|
||||
totalMeses = ((anioFinal - anioInicial) * 12) + (mesFinal - mesInicial) + 1;
|
||||
}
|
||||
|
||||
// Obtener tipos seleccionados y sus montos
|
||||
const tiposCheckboxes = document.querySelectorAll('.tipo-checkbox:checked');
|
||||
const totalTipos = tiposCheckboxes.length;
|
||||
|
||||
// Calcular monto sugerido total
|
||||
let montoSugeridoTotal = 0;
|
||||
tiposCheckboxes.forEach(checkbox => {
|
||||
const montoPorMes = parseFloat(checkbox.getAttribute('data-monto')) || 0;
|
||||
montoSugeridoTotal += montoPorMes * totalMeses;
|
||||
});
|
||||
|
||||
// Actualizar UI
|
||||
document.getElementById('totalMeses').textContent = totalMeses;
|
||||
document.getElementById('totalTipos').textContent = totalTipos;
|
||||
document.getElementById('montoSugerido').textContent = montoSugeridoTotal.toFixed(2);
|
||||
|
||||
// Comparar con monto ingresado
|
||||
const montoIngresado = parseFloat(document.getElementById('montoTotal').value) || 0;
|
||||
const alertaDiv = document.getElementById('alertaDiferencia');
|
||||
const mensajeSpan = document.getElementById('mensajeDiferencia');
|
||||
|
||||
if (montoIngresado > 0) {
|
||||
if (Math.abs(montoIngresado - montoSugeridoTotal) > 0.01) {
|
||||
const diferencia = montoIngresado - montoSugeridoTotal;
|
||||
if (diferencia > 0) {
|
||||
mensajeSpan.textContent = `Sobra: $${diferencia.toFixed(2)}`;
|
||||
alertaDiv.className = 'alert alert-info py-1 px-2 mb-0 mt-2';
|
||||
} else {
|
||||
mensajeSpan.textContent = `Falta: $${Math.abs(diferencia).toFixed(2)}`;
|
||||
alertaDiv.className = 'alert alert-warning py-1 px-2 mb-0 mt-2';
|
||||
}
|
||||
alertaDiv.style.display = 'block';
|
||||
} else {
|
||||
alertaDiv.style.display = 'none';
|
||||
}
|
||||
} else {
|
||||
alertaDiv.style.display = 'none';
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Error al calcular sugerido:', error);
|
||||
}
|
||||
}
|
||||
|
||||
// Calcular cuando cambia el monto total
|
||||
document.getElementById('montoTotal')?.addEventListener('input', calcularSugerido);
|
||||
|
||||
// Calcular al cargar la página
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
calcularSugerido();
|
||||
});
|
||||
|
||||
// Show error messages
|
||||
@if (TempData["Error"] != null)
|
||||
{
|
||||
<text>
|
||||
toastr.error('@TempData["Error"]');
|
||||
</text>
|
||||
}
|
||||
</script>
|
||||
}
|
||||
130
RS_system/Views/Colaboracion/Details.cshtml
Normal file
130
RS_system/Views/Colaboracion/Details.cshtml
Normal file
@@ -0,0 +1,130 @@
|
||||
@model Rs_system.Models.Colaboracion
|
||||
@{
|
||||
ViewData["Title"] = "Detalle de Colaboración";
|
||||
}
|
||||
|
||||
<div class="d-flex justify-content-between align-items-center mb-4">
|
||||
<div>
|
||||
<h4 class="mb-1">Detalle de Colaboración #@Model.Id</h4>
|
||||
<p class="text-muted mb-0">Información completa de la colaboración</p>
|
||||
</div>
|
||||
<a asp-action="Index" class="btn btn-outline-secondary">
|
||||
<i class="bi bi-arrow-left me-1"></i> Volver
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<!-- Información Principal -->
|
||||
<div class="col-md-6 mb-4">
|
||||
<div class="card-custom">
|
||||
<h6 class="text-primary border-bottom pb-2 mb-3">Información de Registro</h6>
|
||||
|
||||
<div class="mb-3">
|
||||
<label class="text-muted small">Miembro</label>
|
||||
<div><strong>@Model.Miembro.Persona.Nombres @Model.Miembro.Persona.Apellidos</strong></div>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label class="text-muted small">Fecha de Registro</label>
|
||||
<div>@Model.FechaRegistro.ToString("dd/MM/yyyy HH:mm")</div>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label class="text-muted small">Registrado por</label>
|
||||
<div>@(Model.RegistradoPor ?? "Sistema")</div>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label class="text-muted small">Monto Total</label>
|
||||
<div><h4 class="text-success mb-0">$@Model.MontoTotal.ToString("N2")</h4></div>
|
||||
</div>
|
||||
|
||||
@if (!string.IsNullOrEmpty(Model.Observaciones))
|
||||
{
|
||||
<div class="mb-3">
|
||||
<label class="text-muted small">Observaciones</label>
|
||||
<div class="alert alert-info mb-0">@Model.Observaciones</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Desglose Detallado -->
|
||||
<div class="col-md-6 mb-4">
|
||||
<div class="card-custom">
|
||||
<h6 class="text-primary border-bottom pb-2 mb-3">Desglose por Tipo</h6>
|
||||
|
||||
@{
|
||||
var porTipo = Model.Detalles.GroupBy(d => d.TipoColaboracion.Nombre);
|
||||
}
|
||||
|
||||
@foreach (var grupo in porTipo)
|
||||
{
|
||||
<div class="mb-3">
|
||||
<div class="d-flex justify-content-between align-items-center mb-2">
|
||||
<h6 class="mb-0">@grupo.Key</h6>
|
||||
<span class="badge bg-primary">@grupo.Count() meses</span>
|
||||
</div>
|
||||
<div class="text-muted small">
|
||||
Total: <strong class="text-success">$@grupo.Sum(d => d.Monto).ToString("N2")</strong>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Tabla de Detalles Mensuales -->
|
||||
<div class="card-custom">
|
||||
<h6 class="text-primary border-bottom pb-2 mb-3">Meses Cubiertos</h6>
|
||||
|
||||
<div class="table-responsive">
|
||||
<table class="table-custom">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Mes</th>
|
||||
<th>Año</th>
|
||||
<th>Tipo</th>
|
||||
<th class="text-end">Monto</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var detalle in Model.Detalles.OrderBy(d => d.Anio).ThenBy(d => d.Mes))
|
||||
{
|
||||
<tr>
|
||||
<td>
|
||||
@{
|
||||
var fecha = new DateTime(detalle.Anio, detalle.Mes, 1);
|
||||
}
|
||||
@fecha.ToString("MMMM", new System.Globalization.CultureInfo("es-ES"))
|
||||
</td>
|
||||
<td>@detalle.Anio</td>
|
||||
<td>
|
||||
<span class="badge bg-primary">@detalle.TipoColaboracion.Nombre</span>
|
||||
</td>
|
||||
<td class="text-end">
|
||||
<strong>$@detalle.Monto.ToString("N2")</strong>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr class="table-active">
|
||||
<td colspan="3" class="text-end"><strong>TOTAL:</strong></td>
|
||||
<td class="text-end">
|
||||
<h5 class="mb-0 text-success">$@Model.Detalles.Sum(d => d.Monto).ToString("N2")</h5>
|
||||
</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="d-flex justify-content-between mt-4">
|
||||
<a asp-action="Index" class="btn btn-secondary">
|
||||
<i class="bi bi-arrow-left me-1"></i> Volver al Listado
|
||||
</a>
|
||||
<a asp-action="EstadoCuenta" asp-route-id="@Model.MiembroId" class="btn btn-primary-custom">
|
||||
<i class="bi bi-file-text me-1"></i> Ver Estado de Cuenta del Miembro
|
||||
</a>
|
||||
</div>
|
||||
133
RS_system/Views/Colaboracion/EstadoCuenta.cshtml
Normal file
133
RS_system/Views/Colaboracion/EstadoCuenta.cshtml
Normal file
@@ -0,0 +1,133 @@
|
||||
@model Rs_system.Models.ViewModels.EstadoCuentaViewModel
|
||||
@{
|
||||
ViewData["Title"] = "Estado de Cuenta";
|
||||
}
|
||||
|
||||
<div class="d-flex justify-content-between align-items-center mb-4">
|
||||
<div>
|
||||
<h4 class="mb-1">Estado de Cuenta</h4>
|
||||
<p class="text-muted mb-0">@Model.NombreMiembro</p>
|
||||
</div>
|
||||
<div>
|
||||
<button onclick="window.print()" class="btn btn-outline-secondary me-2">
|
||||
<i class="bi bi-printer me-1"></i> Imprimir
|
||||
</button>
|
||||
<a asp-action="Index" class="btn btn-primary-custom">
|
||||
<i class="bi bi-arrow-left me-1"></i> Volver
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Encabezado del Estado de Cuenta -->
|
||||
<div class="card-custom mb-4" style="border: 2px solid #198754;">
|
||||
<div class="text-center py-4">
|
||||
<h3 class="mb-3">ESTADO DE CUENTA DE COLABORACIONES</h3>
|
||||
<h5 class="text-primary mb-2">@Model.NombreMiembro</h5>
|
||||
<p class="text-muted mb-0">Fecha de consulta: @Model.FechaConsulta.ToString("dd/MM/yyyy HH:mm")</p>
|
||||
</div>
|
||||
<hr>
|
||||
<div class="text-center py-3">
|
||||
<h6 class="text-muted mb-2">Total Aportado</h6>
|
||||
<h2 class="text-success mb-0">$@Model.TotalAportado.ToString("N2")</h2>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Historial por Tipo de Colaboración -->
|
||||
@if (Model.HistorialPorTipos.Any())
|
||||
{
|
||||
@foreach (var historial in Model.HistorialPorTipos)
|
||||
{
|
||||
<div class="card-custom mb-4">
|
||||
<div class="d-flex justify-content-between align-items-center mb-3">
|
||||
<h5 class="mb-0">
|
||||
<span class="badge bg-primary">@historial.TipoNombre</span>
|
||||
</h5>
|
||||
<h6 class="mb-0 text-success">
|
||||
Total: $@historial.TotalTipo.ToString("N2")
|
||||
</h6>
|
||||
</div>
|
||||
|
||||
<div class="table-responsive">
|
||||
<table class="table-custom">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Mes / Año</th>
|
||||
<th>Fecha de Pago</th>
|
||||
<th class="text-end">Monto</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var registro in historial.Registros.OrderByDescending(r => r.Anio).ThenByDescending(r => r.Mes))
|
||||
{
|
||||
<tr>
|
||||
<td><strong>@registro.MesTexto</strong></td>
|
||||
<td>@registro.FechaRegistro.ToString("dd/MM/yyyy")</td>
|
||||
<td class="text-end">
|
||||
<strong>$@registro.Monto.ToString("N2")</strong>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr class="table-active">
|
||||
<td colspan="2" class="text-end"><strong>Subtotal @historial.TipoNombre:</strong></td>
|
||||
<td class="text-end">
|
||||
<strong class="text-success">$@historial.TotalTipo.ToString("N2")</strong>
|
||||
</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
||||
<!-- Total General -->
|
||||
<div class="card-custom" style="border: 2px solid #198754;">
|
||||
<div class="d-flex justify-content-between align-items-center py-3">
|
||||
<h4 class="mb-0">TOTAL GENERAL</h4>
|
||||
<h3 class="mb-0 text-success">$@Model.TotalAportado.ToString("N2")</h3>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="card-custom">
|
||||
<div class="alert alert-info mb-0">
|
||||
<i class="bi bi-info-circle me-2"></i>
|
||||
Este miembro aún no tiene colaboraciones registradas.
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
||||
<!-- Pie de página para impresión -->
|
||||
<div class="mt-5 text-center text-muted" style="page-break-before: auto;">
|
||||
<hr>
|
||||
<p class="mb-1"><small>Este documento es un comprobante de colaboraciones realizadas</small></p>
|
||||
<p class="mb-0"><small>Generado el @DateTime.Now.ToString("dd/MM/yyyy HH:mm")</small></p>
|
||||
</div>
|
||||
|
||||
<style>
|
||||
@@media print {
|
||||
.btn, .no-print {
|
||||
display: none !important;
|
||||
}
|
||||
.card-custom {
|
||||
border: 1px solid #dee2e6;
|
||||
page-break-inside: avoid;
|
||||
}
|
||||
body {
|
||||
background: white;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@section Scripts {
|
||||
<script>
|
||||
@if (TempData["Error"] != null)
|
||||
{
|
||||
<text>
|
||||
toastr.error('@TempData["Error"]');
|
||||
</text>
|
||||
}
|
||||
</script>
|
||||
}
|
||||
147
RS_system/Views/Colaboracion/Index.cshtml
Normal file
147
RS_system/Views/Colaboracion/Index.cshtml
Normal file
@@ -0,0 +1,147 @@
|
||||
@model IEnumerable<Rs_system.Models.Colaboracion>
|
||||
@{
|
||||
ViewData["Title"] = "Colaboraciones";
|
||||
}
|
||||
|
||||
<div class="d-flex justify-content-between align-items-center mb-4">
|
||||
<div>
|
||||
<h4 class="mb-1">Colaboraciones Económicas</h4>
|
||||
<p class="text-muted mb-0">Registro de colaboraciones mensuales de los miembros</p>
|
||||
</div>
|
||||
<div>
|
||||
<a asp-action="Reportes" class="btn btn-outline-primary me-2">
|
||||
<i class="bi bi-file-earmark-bar-graph me-1"></i> Reportes
|
||||
</a>
|
||||
<a asp-action="Create" class="btn btn-primary-custom">
|
||||
<i class="bi bi-plus-lg me-1"></i> Nueva Colaboración
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Summary Cards -->
|
||||
<div class="row mb-4">
|
||||
<div class="col-md-4">
|
||||
<div class="card-custom text-center">
|
||||
<h6 class="text-muted mb-2">Total Recaudado Hoy</h6>
|
||||
<h3 class="text-primary mb-0">
|
||||
$@Model.Where(c => c.FechaRegistro.Date == DateTime.Today).Sum(c => c.MontoTotal).ToString("N2")
|
||||
</h3>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<div class="card-custom text-center">
|
||||
<h6 class="text-muted mb-2">Colaboraciones Hoy</h6>
|
||||
<h3 class="text-success mb-0">
|
||||
@Model.Count(c => c.FechaRegistro.Date == DateTime.Today)
|
||||
</h3>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<div class="card-custom text-center">
|
||||
<h6 class="text-muted mb-2">Total Registros</h6>
|
||||
<h3 class="text-info mb-0">@Model.Count()</h3>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Collaborations Table -->
|
||||
<div class="card-custom">
|
||||
<div class="table-responsive">
|
||||
<table class="table-custom">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Fecha</th>
|
||||
<th>Miembro</th>
|
||||
<th>Tipos</th>
|
||||
<th>Período</th>
|
||||
<th>Monto</th>
|
||||
<th>Registrado por</th>
|
||||
<th class="text-center">Acciones</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@if (!Model.Any())
|
||||
{
|
||||
<tr>
|
||||
<td colspan="7" class="text-center text-muted py-4">
|
||||
<i class="bi bi-cash-coin fs-1 d-block mb-2"></i>
|
||||
No hay colaboraciones registradas
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
@foreach (var colaboracion in Model)
|
||||
{
|
||||
<tr>
|
||||
<td>
|
||||
<strong>@colaboracion.FechaRegistro.ToString("dd/MM/yyyy")</strong><br>
|
||||
<small class="text-muted">@colaboracion.FechaRegistro.ToString("HH:mm")</small>
|
||||
</td>
|
||||
<td>
|
||||
<strong>@colaboracion.Miembro.Persona.Nombres @colaboracion.Miembro.Persona.Apellidos</strong>
|
||||
</td>
|
||||
<td>
|
||||
@{
|
||||
var tipos = colaboracion.Detalles.Select(d => d.TipoColaboracion.Nombre).Distinct();
|
||||
}
|
||||
@foreach (var tipo in tipos)
|
||||
{
|
||||
<span class="badge bg-primary me-1">@tipo</span>
|
||||
}
|
||||
</td>
|
||||
<td>
|
||||
@{
|
||||
var ordenados = colaboracion.Detalles.OrderBy(d => d.Anio).ThenBy(d => d.Mes).ToList();
|
||||
var primero = ordenados.First();
|
||||
var ultimo = ordenados.Last();
|
||||
|
||||
if (primero.Anio == ultimo.Anio && primero.Mes == ultimo.Mes)
|
||||
{
|
||||
var fecha = new DateTime(primero.Anio, primero.Mes, 1);
|
||||
<text>@fecha.ToString("MMMM yyyy", new System.Globalization.CultureInfo("es-ES"))</text>
|
||||
}
|
||||
else
|
||||
{
|
||||
var fechaInicio = new DateTime(primero.Anio, primero.Mes, 1);
|
||||
var fechaFin = new DateTime(ultimo.Anio, ultimo.Mes, 1);
|
||||
<text>@fechaInicio.ToString("MMM yyyy", new System.Globalization.CultureInfo("es-ES")) - @fechaFin.ToString("MMM yyyy", new System.Globalization.CultureInfo("es-ES"))</text>
|
||||
}
|
||||
}
|
||||
</td>
|
||||
<td>
|
||||
<strong class="text-success">$@colaboracion.MontoTotal.ToString("N2")</strong>
|
||||
</td>
|
||||
<td>
|
||||
<small>@(colaboracion.RegistradoPor ?? "Sistema")</small>
|
||||
</td>
|
||||
<td class="text-center">
|
||||
<a asp-action="Details" asp-route-id="@colaboracion.Id" class="btn btn-sm btn-outline-primary" title="Ver detalles">
|
||||
<i class="bi bi-eye"></i>
|
||||
</a>
|
||||
<a asp-action="EstadoCuenta" asp-route-id="@colaboracion.MiembroId" class="btn btn-sm btn-outline-info" title="Estado de cuenta">
|
||||
<i class="bi bi-file-text"></i>
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@section Scripts {
|
||||
<script>
|
||||
// Show success/error messages
|
||||
@if (TempData["Success"] != null)
|
||||
{
|
||||
<text>
|
||||
toastr.success('@TempData["Success"]');
|
||||
</text>
|
||||
}
|
||||
@if (TempData["Error"] != null)
|
||||
{
|
||||
<text>
|
||||
toastr.error('@TempData["Error"]');
|
||||
</text>
|
||||
}
|
||||
</script>
|
||||
}
|
||||
150
RS_system/Views/Colaboracion/Reporte.cshtml
Normal file
150
RS_system/Views/Colaboracion/Reporte.cshtml
Normal file
@@ -0,0 +1,150 @@
|
||||
@model Rs_system.Models.ViewModels.ReporteColaboracionesViewModel
|
||||
@{
|
||||
ViewData["Title"] = "Reporte de Colaboraciones";
|
||||
}
|
||||
|
||||
<div class="d-flex justify-content-between align-items-center mb-4">
|
||||
<div>
|
||||
<h4 class="mb-1">Reporte de Colaboraciones</h4>
|
||||
<p class="text-muted mb-0">
|
||||
Del @Model.FechaInicio.ToString("dd/MM/yyyy") al @Model.FechaFin.ToString("dd/MM/yyyy")
|
||||
</p>
|
||||
</div>
|
||||
<div>
|
||||
<button onclick="window.print()" class="btn btn-outline-secondary me-2">
|
||||
<i class="bi bi-printer me-1"></i> Imprimir
|
||||
</button>
|
||||
<a asp-action="Reportes" class="btn btn-primary-custom">
|
||||
<i class="bi bi-arrow-left me-1"></i> Nuevo Reporte
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Resumen General -->
|
||||
<div class="row mb-4">
|
||||
<div class="col-md-4">
|
||||
<div class="card-custom text-center">
|
||||
<h6 class="text-muted mb-2">Total Recaudado</h6>
|
||||
<h2 class="text-success mb-0">$@Model.TotalRecaudado.ToString("N2")</h2>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<div class="card-custom text-center">
|
||||
<h6 class="text-muted mb-2">Total Movimientos</h6>
|
||||
<h2 class="text-primary mb-0">@Model.Movimientos.Count</h2>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<div class="card-custom text-center">
|
||||
<h6 class="text-muted mb-2">Tipos de Colaboración</h6>
|
||||
<h2 class="text-info mb-0">@Model.DesglosePorTipos.Count</h2>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Desglose por Tipo -->
|
||||
<div class="card-custom mb-4">
|
||||
<h6 class="text-primary border-bottom pb-2 mb-3">Desglose por Tipo de Colaboración</h6>
|
||||
|
||||
@if (Model.DesglosePorTipos.Any())
|
||||
{
|
||||
<div class="table-responsive">
|
||||
<table class="table-custom">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Tipo de Colaboración</th>
|
||||
<th class="text-center">Cantidad de Meses</th>
|
||||
<th class="text-end">Total Recaudado</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var tipo in Model.DesglosePorTipos.OrderByDescending(t => t.TotalRecaudado))
|
||||
{
|
||||
<tr>
|
||||
<td>
|
||||
<span class="badge bg-primary">@tipo.TipoNombre</span>
|
||||
</td>
|
||||
<td class="text-center">@tipo.CantidadMeses</td>
|
||||
<td class="text-end">
|
||||
<strong class="text-success">$@tipo.TotalRecaudado.ToString("N2")</strong>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr class="table-active">
|
||||
<td colspan="2" class="text-end"><strong>TOTAL:</strong></td>
|
||||
<td class="text-end">
|
||||
<h5 class="mb-0 text-success">$@Model.TotalRecaudado.ToString("N2")</h5>
|
||||
</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="alert alert-info">
|
||||
No hay datos para el período seleccionado.
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
|
||||
<!-- Detalle de Movimientos -->
|
||||
<div class="card-custom">
|
||||
<h6 class="text-primary border-bottom pb-2 mb-3">Detalle de Movimientos</h6>
|
||||
|
||||
@if (Model.Movimientos.Any())
|
||||
{
|
||||
<div class="table-responsive">
|
||||
<table class="table-custom">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Fecha</th>
|
||||
<th>Miembro</th>
|
||||
<th>Tipos</th>
|
||||
<th>Período Cubierto</th>
|
||||
<th class="text-end">Monto</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var movimiento in Model.Movimientos.OrderByDescending(m => m.Fecha))
|
||||
{
|
||||
<tr>
|
||||
<td>@movimiento.Fecha.ToString("dd/MM/yyyy HH:mm")</td>
|
||||
<td><strong>@movimiento.NombreMiembro</strong></td>
|
||||
<td>
|
||||
@foreach (var tipo in movimiento.TiposColaboracion.Split(", "))
|
||||
{
|
||||
<span class="badge bg-primary me-1">@tipo</span>
|
||||
}
|
||||
</td>
|
||||
<td>@movimiento.PeriodoCubierto</td>
|
||||
<td class="text-end">
|
||||
<strong>$@movimiento.Monto.ToString("N2")</strong>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="alert alert-info">
|
||||
No hay movimientos registrados en este período.
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
|
||||
<style>
|
||||
@@media print {
|
||||
.btn, .no-print {
|
||||
display: none !important;
|
||||
}
|
||||
.card-custom {
|
||||
border: 1px solid #dee2e6;
|
||||
page-break-inside: avoid;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
118
RS_system/Views/Colaboracion/Reportes.cshtml
Normal file
118
RS_system/Views/Colaboracion/Reportes.cshtml
Normal file
@@ -0,0 +1,118 @@
|
||||
@{
|
||||
ViewData["Title"] = "Reportes de Colaboraciones";
|
||||
}
|
||||
|
||||
<div class="d-flex justify-content-between align-items-center mb-4">
|
||||
<div>
|
||||
<h4 class="mb-1">Reportes de Colaboraciones</h4>
|
||||
<p class="text-muted mb-0">Generar reportes por rango de fechas</p>
|
||||
</div>
|
||||
<a asp-action="Index" class="btn btn-outline-secondary">
|
||||
<i class="bi bi-arrow-left me-1"></i> Volver
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="card-custom">
|
||||
<form asp-action="GenerarReporte" method="post">
|
||||
<div class="row mb-4">
|
||||
<div class="col-md-4">
|
||||
<label for="fechaInicio" class="form-label">Fecha Inicio</label>
|
||||
<input type="date"
|
||||
class="form-control"
|
||||
id="fechaInicio"
|
||||
name="fechaInicio"
|
||||
value="@ViewBag.FechaInicio?.ToString("yyyy-MM-dd")"
|
||||
required />
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<label for="fechaFin" class="form-label">Fecha Fin</label>
|
||||
<input type="date"
|
||||
class="form-control"
|
||||
id="fechaFin"
|
||||
name="fechaFin"
|
||||
value="@ViewBag.FechaFin?.ToString("yyyy-MM-dd")"
|
||||
required />
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<label class="form-label"> </label>
|
||||
<button type="submit" class="btn btn-primary-custom w-100">
|
||||
<i class="bi bi-search me-1"></i> Generar Reporte
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<!-- Acceso rápido -->
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<h6 class="text-muted mb-3">Accesos Rápidos</h6>
|
||||
</div>
|
||||
<div class="col-md-3 mb-2">
|
||||
<button class="btn btn-outline-primary w-100" onclick="reporteHoy()">
|
||||
<i class="bi bi-calendar-day me-1"></i> Hoy
|
||||
</button>
|
||||
</div>
|
||||
<div class="col-md-3 mb-2">
|
||||
<button class="btn btn-outline-primary w-100" onclick="reporteSemana()">
|
||||
<i class="bi bi-calendar-week me-1"></i> Esta Semana
|
||||
</button>
|
||||
</div>
|
||||
<div class="col-md-3 mb-2">
|
||||
<button class="btn btn-outline-primary w-100" onclick="reporteMes()">
|
||||
<i class="bi bi-calendar-month me-1"></i> Este Mes
|
||||
</button>
|
||||
</div>
|
||||
<div class="col-md-3 mb-2">
|
||||
<button class="btn btn-outline-primary w-100" onclick="reporteAnio()">
|
||||
<i class="bi bi-calendar3 me-1"></i> Este Año
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@section Scripts {
|
||||
<script>
|
||||
function setFechas(inicio, fin) {
|
||||
document.getElementById('fechaInicio').value = inicio;
|
||||
document.getElementById('fechaFin').value = fin;
|
||||
}
|
||||
|
||||
function reporteHoy() {
|
||||
const hoy = new Date().toISOString().split('T')[0];
|
||||
setFechas(hoy, hoy);
|
||||
}
|
||||
|
||||
function reporteSemana() {
|
||||
const hoy = new Date();
|
||||
const inicioSemana = new Date(hoy);
|
||||
inicioSemana.setDate(hoy.getDate() - hoy.getDay());
|
||||
const finSemana = new Date(inicioSemana);
|
||||
finSemana.setDate(inicioSemana.getDate() + 6);
|
||||
|
||||
setFechas(inicioSemana.toISOString().split('T')[0], finSemana.toISOString().split('T')[0]);
|
||||
}
|
||||
|
||||
function reporteMes() {
|
||||
const hoy = new Date();
|
||||
const inicio = new Date(hoy.getFullYear(), hoy.getMonth(), 1);
|
||||
const fin = new Date(hoy.getFullYear(), hoy.getMonth() + 1, 0);
|
||||
|
||||
setFechas(inicio.toISOString().split('T')[0], fin.toISOString().split('T')[0]);
|
||||
}
|
||||
|
||||
function reporteAnio() {
|
||||
const hoy = new Date();
|
||||
const inicio = new Date(hoy.getFullYear(), 0, 1);
|
||||
const fin = new Date(hoy.getFullYear(), 11, 31);
|
||||
|
||||
setFechas(inicio.toISOString().split('T')[0], fin.toISOString().split('T')[0]);
|
||||
}
|
||||
|
||||
@if (TempData["Error"] != null)
|
||||
{
|
||||
<text>
|
||||
toastr.error('@TempData["Error"]');
|
||||
</text>
|
||||
}
|
||||
</script>
|
||||
}
|
||||
Reference in New Issue
Block a user