Acabado excel, queda la parte de cofiguracion
This commit is contained in:
@@ -75,6 +75,9 @@
|
||||
<li id="liMS" class="nav-item">
|
||||
<NavLink class="nav-link" href="PuntosInfo">Puntos de información</NavLink>
|
||||
</li>
|
||||
<li id="liMS" class="nav-item">
|
||||
<NavLink class="nav-link" href="Estadisticas">Estadisticas</NavLink>
|
||||
</li>
|
||||
<li id="liMS" class="nav-item">
|
||||
<NavLink class="nav-link" href="Manuales">Manuales</NavLink>
|
||||
</li>
|
||||
|
||||
@@ -0,0 +1,595 @@
|
||||
@page "/Estadisticas"
|
||||
|
||||
@inject NavigationManager Navigation
|
||||
@layout ConfiguracionLayout
|
||||
@using Microsoft.AspNetCore.WebUtilities
|
||||
|
||||
@using BlazorBootstrap
|
||||
@using System.Globalization
|
||||
@using bdHerramientaCACOA.db
|
||||
@rendermode InteractiveServer
|
||||
@inject IJSRuntime JS
|
||||
|
||||
@using ClosedXML.Excel
|
||||
@using Microsoft.EntityFrameworkCore
|
||||
|
||||
<Toasts class="p-3 font-weight-bold" Style="color:white;" AutoHide="true" Delay="4000" Messages="mensajes" Placement="ToastsPlacement.BottomCenter" />
|
||||
|
||||
|
||||
<div class="row" style="justify-content:space-between">
|
||||
<div class="form-group mt-4 col-6">
|
||||
<label>Fecha inicio:</label>
|
||||
<InputDate TValue="DateTime?"
|
||||
Value="fechaInicio"
|
||||
ValueChanged="OnFechaInicioChanged"
|
||||
ValueExpression="@(() => fechaInicio)" />
|
||||
|
||||
<label>Fecha final:</label>
|
||||
<InputDate TValue="DateTime?"
|
||||
Value="fechaFinal"
|
||||
ValueChanged="OnFechaFinalChanged"
|
||||
ValueExpression="@(() => fechaFinal)" />
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div class="mt-2">
|
||||
@if (!string.IsNullOrEmpty(mensajeError))
|
||||
{
|
||||
<label class="text-danger fw-semibold">
|
||||
@mensajeError
|
||||
</label>
|
||||
}
|
||||
</div>
|
||||
|
||||
<button @onclick="generarExcel" class="btnBlue" style="background-color: #65b7c3 !important;"> <i class="fas fa-print pe-2"></i>Generar Excel</button>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="container-fluid pt-3">
|
||||
|
||||
|
||||
|
||||
<Tabs>
|
||||
<Tab Title="Estadisticas Herramienta CASA" Active>
|
||||
<Content>
|
||||
<div class="CajaTab p-2">
|
||||
<HerramientaCASA.Components.Pages.ConfiguracionPages.EstadisticasTabs.EstadisticaHerraCASATab></HerramientaCASA.Components.Pages.ConfiguracionPages.EstadisticasTabs.EstadisticaHerraCASATab>
|
||||
</div>
|
||||
</Content>
|
||||
</Tab>
|
||||
|
||||
<Tab Title="Estadisticas Licitación CASA">
|
||||
<Content>
|
||||
<div class="CajaTab p-2">
|
||||
<HerramientaCASA.Components.Pages.ConfiguracionPages.EstadisticasTabs.EstadisticaLiciCASATab></HerramientaCASA.Components.Pages.ConfiguracionPages.EstadisticasTabs.EstadisticaLiciCASATab>
|
||||
</div>
|
||||
</Content>
|
||||
</Tab>
|
||||
|
||||
<Tab Title="Estadisticas Herramienta URBAN">
|
||||
<Content>
|
||||
<div class="CajaTab p-2">
|
||||
<HerramientaCASA.Components.Pages.ConfiguracionPages.EstadisticasTabs.EstadisticaHerraURBANTab></HerramientaCASA.Components.Pages.ConfiguracionPages.EstadisticasTabs.EstadisticaHerraURBANTab>
|
||||
</div>
|
||||
</Content>
|
||||
</Tab>
|
||||
</Tabs>
|
||||
</div>
|
||||
|
||||
|
||||
@code {
|
||||
|
||||
public List<estadisticas> listadoHerramientaEstadistica { get; set; } = new List<estadisticas>();
|
||||
public List<estadisticas> listadoHerramientaEstadisticaUrban { get; set; } = new List<estadisticas>();
|
||||
public List<estadisticasusos> listadoHerramientaEstadisticaUsos { get; set; } = new List<estadisticasusos>();
|
||||
public List<estadisticasfactores> listadoHerramientaEstadisticaFactores { get; set; } = new List<estadisticasfactores>();
|
||||
|
||||
public DateTime? fechaInicio { get; set; } = null;
|
||||
public DateTime? fechaFinal { get; set; } = null;
|
||||
|
||||
public EstadistiaHerraCasaVM estadisticasTotales = new EstadistiaHerraCasaVM();
|
||||
private int totalProyectosTipo = 0;
|
||||
|
||||
private string mensajeError = "";
|
||||
List<ToastMessage> mensajes = new List<ToastMessage>();
|
||||
|
||||
public tsHerramientasCACOA bd;
|
||||
|
||||
|
||||
private async Task OnFechaInicioChanged(DateTime? value)
|
||||
{
|
||||
fechaInicio = value;
|
||||
|
||||
if (UtilidadesCASA.comprobarFechasNulas(fechaInicio, fechaFinal))
|
||||
{
|
||||
if (UtilidadesCASA.comprobarFechas((DateTime)fechaInicio, (DateTime)fechaFinal))
|
||||
{
|
||||
inicializarListado();
|
||||
mensajeError = "";
|
||||
}
|
||||
else
|
||||
{
|
||||
mensajeError = "La fecha final no puede ser menor que la fecha inicial.";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
inicializarListado();
|
||||
mensajeError = "";
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
public bool IsVisible(bdHerramientaCACOA.db.estadisticas listado)
|
||||
{
|
||||
DateTime? ultimaFecha;
|
||||
if (listado.idSimulacionNavigation.FechaModificacion != null)
|
||||
{
|
||||
ultimaFecha = listado.idSimulacionNavigation.FechaModificacion;
|
||||
}
|
||||
else
|
||||
{
|
||||
ultimaFecha = listado.idSimulacionNavigation.FechaCreacion;
|
||||
}
|
||||
|
||||
if (fechaFinal != null && listado.idSimulacionNavigation.FechaCreacion.Date >= fechaInicio?.Date && ultimaFecha?.Date <= fechaFinal?.Date)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private async Task OnFechaFinalChanged(DateTime? value)
|
||||
{
|
||||
fechaFinal = value;
|
||||
|
||||
if (UtilidadesCASA.comprobarFechasNulas(fechaInicio, fechaFinal))
|
||||
{
|
||||
|
||||
if (UtilidadesCASA.comprobarFechas((DateTime)fechaInicio, (DateTime)fechaFinal))
|
||||
{
|
||||
inicializarListado();
|
||||
mensajeError = "";
|
||||
}
|
||||
else
|
||||
{
|
||||
mensajeError = "La fecha final no puede ser menor que la fecha inicial.";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
inicializarListado();
|
||||
mensajeError = "";
|
||||
}
|
||||
}
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
bd = tsHerramientasCACOA.NuevoContexto(SoloLectura: false);
|
||||
|
||||
inicializarListado();
|
||||
}
|
||||
|
||||
|
||||
|
||||
private async Task generarExcel()
|
||||
{
|
||||
try
|
||||
{
|
||||
bool fechaValida = false;
|
||||
|
||||
string nombreExcel = "";
|
||||
|
||||
|
||||
if ((fechaInicio == null && fechaFinal == null) || (UtilidadesCASA.comprobarFechasNulas(fechaInicio, fechaFinal) && UtilidadesCASA.comprobarFechas((DateTime)fechaInicio, (DateTime)fechaFinal)))
|
||||
{
|
||||
fechaValida = true;
|
||||
}
|
||||
|
||||
if (fechaValida)
|
||||
{
|
||||
|
||||
if (UtilidadesCASA.comprobarFechasNulas(fechaInicio, fechaFinal))
|
||||
{
|
||||
nombreExcel = "Simulaciones_" + (fechaInicio ?? DateTime.Now).Date.ToString() + (fechaFinal ?? DateTime.Now).Date.ToString() + ".xlsx";
|
||||
}
|
||||
else
|
||||
{
|
||||
nombreExcel = "SimulacionesTotales_" + DateTime.Now.ToString() + ".xlsx";
|
||||
}
|
||||
var wb = new XLWorkbook();
|
||||
wb.Properties.Author = "Tecnosis";
|
||||
wb.Properties.Title = "Datos entre fechas";
|
||||
wb.Properties.Subject = "";
|
||||
|
||||
var ws = wb.Worksheets.Add("Total datos");
|
||||
|
||||
// Generar tabla HERRAMIENTA/LICITACION CASA
|
||||
var tablaPrincipal = generarTablaPrincipal(ws);
|
||||
|
||||
int filaSiguiente = tablaPrincipal.RangeAddress.LastAddress.RowNumber + 5;
|
||||
|
||||
// GENERAR TABLA USOS
|
||||
int ultimaFilaUso = generarTablaUsos(bd, ws, filaSiguiente);
|
||||
ultimaFilaUso = ultimaFilaUso + 5;
|
||||
|
||||
// GENERAR TABLA FACTORES
|
||||
int ultimaFilaFactor = generarTablaFactores(bd, ws, ultimaFilaUso);
|
||||
ultimaFilaFactor = ultimaFilaFactor + 5;
|
||||
|
||||
// GENERAR TABLA HERRAMIENTA/LICITACION URBAN
|
||||
generarTablaUrban(bd, ws, ultimaFilaFactor);
|
||||
|
||||
using var ms = new MemoryStream();
|
||||
wb.SaveAs(ms);
|
||||
var bytes = ms.ToArray();
|
||||
|
||||
await JS.InvokeVoidAsync("descargarExcel", nombreExcel, Convert.ToBase64String(bytes));
|
||||
|
||||
mensajes.Add(new ToastMessage
|
||||
{
|
||||
Type = ToastType.Primary,
|
||||
Message = $"Descarga completada.",
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
mensajes.Add(new ToastMessage
|
||||
{
|
||||
Type = ToastType.Warning,
|
||||
Message = $"Fechas incorrectas.",
|
||||
});
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
mensajes.Add(new ToastMessage
|
||||
{
|
||||
Type = ToastType.Danger,
|
||||
Message = $"Error al generar el excel.",
|
||||
});
|
||||
throw new Exception("Ocurrió un error en la descarga del excel -> " + ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
private IXLTable? generarTablaPrincipal(IXLWorksheet? ws)
|
||||
{
|
||||
var datos = UtilidadesCASA.rellenarListadoCASA(listadoHerramientaEstadistica);
|
||||
|
||||
// INTRODUCIR DATOS PARA LA TABLA
|
||||
var table = ws.Cell("B4").InsertTable(datos);
|
||||
|
||||
// OBTENER TAMAÑO DE LA TABLA
|
||||
var firstCol = table.RangeAddress.FirstAddress.ColumnNumber;
|
||||
var lastCol = table.RangeAddress.LastAddress.ColumnNumber;
|
||||
var firstRow = table.RangeAddress.FirstAddress.RowNumber;
|
||||
var lastRow = table.RangeAddress.LastAddress.RowNumber;
|
||||
|
||||
// AUMENTAMOS EL TAMAÑO DEL HEADER UN POCO
|
||||
int filaHeader = table.HeadersRow().RowNumber();
|
||||
ws.Row(filaHeader).Height += 20;
|
||||
|
||||
// OBTENER PRIMERA FILA DE LA TABLA PARA PONER EL TITULO ARRIBA
|
||||
int filaTabla = table.FirstRow().RowNumber();
|
||||
|
||||
// PONER EL TITULO EN LA FILA DE ARRIBA
|
||||
int filaTitulo = filaTabla - 1;
|
||||
|
||||
// SE ESCRIBE EL TITULO
|
||||
ws.Cell(filaTitulo, 2).Value = "Herramienta CASA / Licitacion CASA";
|
||||
|
||||
// SE UNE LAS COLUMNAS
|
||||
ws.Range(filaTitulo, 2, filaTitulo, table.ColumnCount()).Merge();
|
||||
|
||||
// SE LE PONE UN FORMATO
|
||||
var rangoTitulo = ws.Range(filaTitulo, 2, filaTitulo, table.ColumnCount());
|
||||
rangoTitulo.Merge();
|
||||
rangoTitulo.Style.Font.Bold = true;
|
||||
rangoTitulo.Style.Font.FontSize = 14;
|
||||
rangoTitulo.Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
||||
ws.Row(filaTitulo).Height = 25;
|
||||
|
||||
|
||||
// LE PONEMOS FORMATO AL HEADER
|
||||
var headerRange = ws.Range(filaHeader, firstCol, filaHeader, lastCol);
|
||||
headerRange.Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
||||
headerRange.Style.Font.Bold = true;
|
||||
headerRange.Style.Font.FontColor = XLColor.White;
|
||||
headerRange.Style.Fill.BackgroundColor = XLColor.FromHtml("#156082");
|
||||
|
||||
// CENTRAR LOS DATOS
|
||||
var dataRange = ws.Range(firstRow, firstCol, lastRow, lastCol);
|
||||
dataRange.Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
||||
|
||||
// AJUSTAMOS LA TABLA
|
||||
ws.Columns(firstCol, lastCol).AdjustToContents();
|
||||
|
||||
// SE PONE EL TITULO DE LOS HEADERS
|
||||
table.Field(nameof(EstadistiaHerraCasaVM.idSimulacion)).Name = "Id Simulación";
|
||||
table.Field(nameof(EstadistiaHerraCasaVM.numeroTrabajadores)).Name = "Total trabajadores";
|
||||
table.Field(nameof(EstadistiaHerraCasaVM.costeAnualTotal)).Name = "Coste anual total";
|
||||
table.Field(nameof(EstadistiaHerraCasaVM.horasProduccion)).Name = "Horas de producción";
|
||||
table.Field(nameof(EstadistiaHerraCasaVM.costesDirectos)).Name = "Costes directos";
|
||||
table.Field(nameof(EstadistiaHerraCasaVM.costesIndirectos)).Name = "Coste indirectos";
|
||||
table.Field(nameof(EstadistiaHerraCasaVM.costesVariables)).Name = "Coste variables";
|
||||
table.Field(nameof(EstadistiaHerraCasaVM.costeDespacho)).Name = "Coste despacho";
|
||||
table.Field(nameof(EstadistiaHerraCasaVM.totalSuperficie)).Name = "Total superficie";
|
||||
table.Field(nameof(EstadistiaHerraCasaVM.porcentajeFases)).Name = "% fases";
|
||||
|
||||
table.Field(nameof(EstadistiaHerraCasaVM.horasDocumentacion)).Name = "Horas documentación";
|
||||
table.Field(nameof(EstadistiaHerraCasaVM.horasDireccionObra)).Name = "Horas dirección obra";
|
||||
table.Field(nameof(EstadistiaHerraCasaVM.horasTrabajo)).Name = "Horas trabajo";
|
||||
table.Field(nameof(EstadistiaHerraCasaVM.porcentajeExternalizacion)).Name = "% external.";
|
||||
table.Field(nameof(EstadistiaHerraCasaVM.plazoPresentacion)).Name = "Plazo presentación";
|
||||
table.Field(nameof(EstadistiaHerraCasaVM.costeProduccion)).Name = "Coste de producción";
|
||||
table.Field(nameof(EstadistiaHerraCasaVM.beneficio)).Name = "Beneficio";
|
||||
table.Field(nameof(EstadistiaHerraCasaVM.precioTrabajo)).Name = "Precio trabajo";
|
||||
table.Field(nameof(EstadistiaHerraCasaVM.totalOtrosTrabajos)).Name = "Total otros trabajos";
|
||||
table.Field(nameof(EstadistiaHerraCasaVM.precioEncargo)).Name = "Precio encargo";
|
||||
|
||||
return table;
|
||||
}
|
||||
|
||||
private int generarTablaUsos(tsHerramientasCACOA bd, IXLWorksheet ws, int filaValida)
|
||||
{
|
||||
var listaUsos = UtilidadesCASA.rellenarListadoUsos(bd, listadoHerramientaEstadisticaUsos);
|
||||
|
||||
// SE AGRUPA POR IDSIMULACION PARA SEPARAR LOS DATOS POR SIMULACION
|
||||
var simulacion = listaUsos.GroupBy(x => x.idSimulacion);
|
||||
|
||||
int fila = filaValida;
|
||||
|
||||
ws.Cell(fila, 2).Value = "Id Simulación";
|
||||
ws.Cell(fila, 3).Value = "Superficie";
|
||||
ws.Cell(fila, 4).Value = "Uso";
|
||||
ws.Cell(fila, 5).Value = "Tipología";
|
||||
ws.Cell(fila, 6).Value = "Intervención";
|
||||
|
||||
|
||||
// SE PONE EL FORMATO DEL HEADER
|
||||
var headerRange = ws.Range(fila, 2, fila, 6);
|
||||
|
||||
headerRange.Style.Fill.BackgroundColor = XLColor.FromHtml("#156082");
|
||||
headerRange.Style.Font.Bold = true;
|
||||
headerRange.Style.Font.FontColor = XLColor.White;
|
||||
|
||||
headerRange.Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
||||
headerRange.Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
||||
|
||||
ws.Row(fila).Height += 20;
|
||||
|
||||
|
||||
|
||||
// SE PONE EL TITULO ARRIBA DE LA TABLA
|
||||
int filaTitulo = filaValida - 1;
|
||||
|
||||
ws.Cell(filaTitulo, 2).Value = "Usos";
|
||||
var rangoTitulo = ws.Range(filaTitulo, 2, filaTitulo, 6);
|
||||
rangoTitulo.Merge();
|
||||
rangoTitulo.Style.Font.Bold = true;
|
||||
rangoTitulo.Style.Font.FontSize = 14;
|
||||
rangoTitulo.Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
||||
ws.Row(filaTitulo).Height = 25;
|
||||
|
||||
|
||||
fila++;
|
||||
|
||||
// SE CREA LA TABLA RECORRIENDO EL LISTADO
|
||||
foreach (var grupo in simulacion)
|
||||
{
|
||||
// SE PONE CADA COLUMNA
|
||||
foreach (var item in grupo)
|
||||
{
|
||||
ws.Cell(fila, 2).Value = item.idSimulacion;
|
||||
ws.Cell(fila, 3).Value = item.superficie;
|
||||
ws.Cell(fila, 4).Value = item.uso;
|
||||
ws.Cell(fila, 5).Value = item.tipologia;
|
||||
ws.Cell(fila, 6).Value = item.intervencion;
|
||||
|
||||
// SE CENTRA LOS DATOS
|
||||
ws.Range(fila, 2, fila, 6).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
||||
ws.Range(fila, 2, fila, 6).Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
||||
|
||||
fila++;
|
||||
}
|
||||
|
||||
// FILA DE TOTALES POR CADA SIMULACION
|
||||
ws.Cell(fila, 2).Value = $"Total superficie de simulación: {grupo.Key}";
|
||||
|
||||
// SE SUMA EL TOTAL DE SUPERFICIE Y SE PONE UN FORMATO
|
||||
ws.Cell(fila, 3).Value = grupo.Sum(x=> x.superficie);
|
||||
ws.Range(fila, 2, fila, 6).Style.Font.Bold = true;
|
||||
ws.Range(fila, 2, fila, 6).Style.Fill.BackgroundColor = XLColor.LightGray;
|
||||
|
||||
fila++;
|
||||
}
|
||||
|
||||
// AJSUTAR COLUMNAS
|
||||
ws.Columns().AdjustToContents();
|
||||
|
||||
return fila;
|
||||
}
|
||||
|
||||
private int generarTablaFactores(tsHerramientasCACOA bd, IXLWorksheet ws, int filaValida)
|
||||
{
|
||||
var listaUsos = UtilidadesCASA.rellenarListadoFactores(bd, listadoHerramientaEstadisticaFactores);
|
||||
|
||||
// SE AGRUPA POR EL IDSIMULACION PARA DIVIDIR POR SIMULACION
|
||||
var simulacion = listaUsos.GroupBy(x => x.idSimulacion);
|
||||
|
||||
int fila = filaValida;
|
||||
|
||||
ws.Cell(fila, 2).Value = "Id Simulación";
|
||||
ws.Cell(fila, 3).Value = "Nombre";
|
||||
ws.Cell(fila, 4).Value = "Coeficiente";
|
||||
ws.Cell(fila, 5).Value = "Tipo";
|
||||
|
||||
|
||||
// SE PONE UN FORMATO PARA EL HEADER
|
||||
var headerRange = ws.Range(fila, 2, fila, 5);
|
||||
|
||||
headerRange.Style.Fill.BackgroundColor = XLColor.FromHtml("#156082");
|
||||
headerRange.Style.Font.Bold = true;
|
||||
headerRange.Style.Font.FontColor = XLColor.White;
|
||||
|
||||
headerRange.Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
||||
headerRange.Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
||||
|
||||
ws.Row(fila).Height += 20;
|
||||
|
||||
|
||||
// SE PONE EL TITULO
|
||||
|
||||
int filaTitulo = filaValida - 1;
|
||||
|
||||
ws.Cell(filaTitulo, 2).Value = "Factores";
|
||||
var rangoTitulo = ws.Range(filaTitulo, 2, filaTitulo, 5);
|
||||
rangoTitulo.Merge();
|
||||
rangoTitulo.Style.Font.Bold = true;
|
||||
rangoTitulo.Style.Font.FontSize = 14;
|
||||
rangoTitulo.Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
||||
ws.Row(filaTitulo).Height = 25;
|
||||
|
||||
fila++;
|
||||
|
||||
// RECORREMOS EL LISTADO
|
||||
foreach (var grupo in simulacion)
|
||||
{
|
||||
// SE AGREGA LAS COLUMNAS
|
||||
foreach (var item in grupo)
|
||||
{
|
||||
ws.Cell(fila, 2).Value = item.idSimulacion;
|
||||
ws.Cell(fila, 3).Value = item.nombre;
|
||||
ws.Cell(fila, 4).Value = item.coeficiente;
|
||||
ws.Cell(fila, 5).Value = item.tipo;
|
||||
|
||||
ws.Range(fila, 2, fila, 5).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
||||
ws.Range(fila, 2, fila, 5).Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
||||
|
||||
fila++;
|
||||
}
|
||||
|
||||
// FILA TOTAL PARA DIVIDIR
|
||||
ws.Cell(fila, 2).Value = $"";
|
||||
ws.Range(fila, 2, fila, 5).Style.Font.Bold = true;
|
||||
ws.Range(fila, 2, fila, 5).Style.Fill.BackgroundColor = XLColor.LightGray;
|
||||
|
||||
fila++;
|
||||
}
|
||||
|
||||
// AJUSTAMOS COLUMNAS
|
||||
ws.Columns().AdjustToContents();
|
||||
|
||||
return fila;
|
||||
}
|
||||
|
||||
private IXLTable? generarTablaUrban(tsHerramientasCACOA bd, IXLWorksheet? ws, int filaValida)
|
||||
{
|
||||
|
||||
var datos = UtilidadesCASA.rellenarListadoURBAN(bd,listadoHerramientaEstadisticaUrban);
|
||||
|
||||
// AGREGAMOS LA TABLA
|
||||
var table = ws.Cell(filaValida, 2).InsertTable(datos);
|
||||
|
||||
// SE OBTIENE LAS DIMENSIONES DE LA TABLA
|
||||
var firstCol = table.RangeAddress.FirstAddress.ColumnNumber;
|
||||
var lastCol = table.RangeAddress.LastAddress.ColumnNumber;
|
||||
var firstRow = table.RangeAddress.FirstAddress.RowNumber;
|
||||
var lastRow = table.RangeAddress.LastAddress.RowNumber;
|
||||
|
||||
// SE AGREGA MAS ALTURA AL HEADER
|
||||
int filaHeader = table.HeadersRow().RowNumber();
|
||||
ws.Row(filaHeader).Height += 20;
|
||||
|
||||
|
||||
// OBTENEMOS LA PRIMERA FILA DE LA TABLA PARA PONER EL TITULO
|
||||
int filaTabla = table.FirstRow().RowNumber();
|
||||
|
||||
int filaTitulo = filaTabla - 1;
|
||||
|
||||
// SE PONE EL TITULO Y SE CREA EL FORMATO
|
||||
ws.Cell(filaTitulo, 2).Value = "Herramienta URBAN / Licitacion URBAN";
|
||||
|
||||
ws.Range(filaTitulo, 2, filaTitulo, table.ColumnCount()).Merge();
|
||||
|
||||
var rangoTitulo = ws.Range(filaTitulo, 2, filaTitulo, table.ColumnCount());
|
||||
rangoTitulo.Merge();
|
||||
rangoTitulo.Style.Font.Bold = true;
|
||||
rangoTitulo.Style.Font.FontSize = 14;
|
||||
rangoTitulo.Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
||||
ws.Row(filaTitulo).Height = 25;
|
||||
|
||||
|
||||
// PONEMOS EL DISEÑO DEL HEADER
|
||||
var headerRange = ws.Range(filaHeader, firstCol, filaHeader, lastCol);
|
||||
headerRange.Style.Alignment.Vertical = XLAlignmentVerticalValues.Center;
|
||||
headerRange.Style.Font.Bold = true;
|
||||
headerRange.Style.Font.FontColor = XLColor.White;
|
||||
headerRange.Style.Fill.BackgroundColor = XLColor.FromHtml("#e97132");
|
||||
|
||||
// CENTRAMOS LOS DATOS
|
||||
var dataRange = ws.Range(firstRow, firstCol, lastRow, lastCol);
|
||||
dataRange.Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center;
|
||||
|
||||
// AJUSTAMOS LAS COLUMNAS
|
||||
ws.Columns(firstCol, lastCol).AdjustToContents();
|
||||
|
||||
// SE PONE EL NOMBRE AL HEADER
|
||||
table.Field(nameof(EstadisticasUrbanVM.idSimulacion)).Name = "Id Simulación";
|
||||
table.Field(nameof(EstadisticasUrbanVM.numeroTrabajadores)).Name = "Total trabajadores";
|
||||
table.Field(nameof(EstadisticasUrbanVM.costeAnualTotal)).Name = "Coste anual total";
|
||||
table.Field(nameof(EstadisticasUrbanVM.horasProduccion)).Name = "Horas de producción";
|
||||
table.Field(nameof(EstadisticasUrbanVM.costesDirectos)).Name = "Costes directos";
|
||||
table.Field(nameof(EstadisticasUrbanVM.costesIndirectos)).Name = "Coste indirectos";
|
||||
table.Field(nameof(EstadisticasUrbanVM.costesVariables)).Name = "Coste variables";
|
||||
table.Field(nameof(EstadisticasUrbanVM.costeDespacho)).Name = "Coste despacho";
|
||||
table.Field(nameof(EstadisticasUrbanVM.tipoDocumento)).Name = "Tipo de documento";
|
||||
table.Field(nameof(EstadisticasUrbanVM.documento)).Name = "Documento";
|
||||
table.Field(nameof(EstadisticasUrbanVM.dato1)).Name = "Dato 1";
|
||||
table.Field(nameof(EstadisticasUrbanVM.dato2)).Name = "Dato 2";
|
||||
table.Field(nameof(EstadisticasUrbanVM.dato3)).Name = "Dato 3";
|
||||
table.Field(nameof(EstadisticasUrbanVM.porcentajeFases)).Name = "Fases";
|
||||
table.Field(nameof(EstadisticasUrbanVM.innovacion)).Name = "Innovación";
|
||||
table.Field(nameof(EstadisticasUrbanVM.horasTrabajo)).Name = "Horas trabajo";
|
||||
table.Field(nameof(EstadisticasUrbanVM.porcentajeExternalizacion)).Name = "% external.";
|
||||
table.Field(nameof(EstadisticasUrbanVM.costeExternalizacion)).Name = "Coste externalización";
|
||||
table.Field(nameof(EstadisticasUrbanVM.plazoPresentacion)).Name = "Plazo presentación";
|
||||
table.Field(nameof(EstadisticasUrbanVM.costeProduccion)).Name = "Coste de producción";
|
||||
table.Field(nameof(EstadisticasUrbanVM.beneficio)).Name = "Beneficio";
|
||||
table.Field(nameof(EstadisticasUrbanVM.precioTrabajo)).Name = "Precio trabajo";
|
||||
|
||||
return table;
|
||||
}
|
||||
|
||||
|
||||
private void inicializarListado()
|
||||
{
|
||||
|
||||
if (fechaInicio == null)
|
||||
{
|
||||
listadoHerramientaEstadistica = bd.estadisticas.Include(x => x.idSimulacionNavigation).Where(x => x.idSimulacionNavigation.idTipoSimulacion == 31 || x.idSimulacionNavigation.idTipoSimulacion == 32).ToList();
|
||||
listadoHerramientaEstadisticaUrban = bd.estadisticas.Include(x => x.idSimulacionNavigation).Where(x => x.idSimulacionNavigation.idTipoSimulacion == 34 || x.idSimulacionNavigation.idTipoSimulacion == 35).ToList();
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
var listadoPorTipoCASA = bd.estadisticas.Include(x => x.idSimulacionNavigation).Where(x => x.idSimulacionNavigation.idTipoSimulacion == 31 || x.idSimulacionNavigation.idTipoSimulacion == 32).ToList();
|
||||
|
||||
listadoHerramientaEstadistica = listadoPorTipoCASA.Where(x => (x.idSimulacionNavigation.FechaCreacion >= fechaInicio) && (x.idSimulacionNavigation.FechaModificacion ?? x.idSimulacionNavigation.FechaCreacion).Date <= fechaFinal).ToList();
|
||||
|
||||
var listadoPorTipoURBAN = bd.estadisticas.Include(x => x.idSimulacionNavigation).Where(x => x.idSimulacionNavigation.idTipoSimulacion == 34 || x.idSimulacionNavigation.idTipoSimulacion == 35).ToList();
|
||||
|
||||
listadoHerramientaEstadisticaUrban = listadoPorTipoURBAN.Where(x => (x.idSimulacionNavigation.FechaCreacion >= fechaInicio) && (x.idSimulacionNavigation.FechaModificacion ?? x.idSimulacionNavigation.FechaCreacion).Date <= fechaFinal).ToList();
|
||||
|
||||
}
|
||||
|
||||
listadoHerramientaEstadisticaUsos = bd.estadisticasusos.AsEnumerable().Where(x => listadoHerramientaEstadistica.Any(y => y.idSimulacion == x.idSimulacion)).ToList();
|
||||
|
||||
|
||||
listadoHerramientaEstadisticaFactores = bd.estadisticasfactores.AsEnumerable().Where(x => listadoHerramientaEstadistica.Any(y => y.idSimulacion == x.idsimulacion)).ToList();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,239 @@
|
||||
@inject NavigationManager Navigation
|
||||
@layout ConfiguracionLayout
|
||||
@rendermode InteractiveServer
|
||||
@using BlazorBootstrap
|
||||
@using System.Globalization
|
||||
@using ClosedXML.Excel
|
||||
@using Microsoft.EntityFrameworkCore
|
||||
@using bdHerramientaCACOA.db
|
||||
|
||||
<div>
|
||||
|
||||
@if (totalProyectosTipo != 0)
|
||||
{
|
||||
<div class="mt-2" style="padding:50px;">
|
||||
<div class="mb-4">
|
||||
<label class="fw-bold">Total simulaciones herramienta CASA: <span>@totalProyectosTipo</span> </label>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-2 formatoCampos pt-2">
|
||||
<label class="tituloLbl">Total costes directos:</label>
|
||||
<label class="tituloLbl">@estadisticasTotales.costesDirectos.MilesYDecimales() €</label>
|
||||
</div>
|
||||
|
||||
<div class="col-2 formatoCampos pt-2">
|
||||
<label class="tituloLbl">Total costes indirectos:</label>
|
||||
<label class="tituloLbl">@estadisticasTotales.costesIndirectos.MilesYDecimales() €</label>
|
||||
</div>
|
||||
|
||||
<div class="col-2 formatoCampos pt-2">
|
||||
<label class="tituloLbl">Total costes variables:</label>
|
||||
<label class="tituloLbl">@estadisticasTotales.costesVariables.MilesYDecimales() €</label>
|
||||
</div>
|
||||
|
||||
<div class="col-2 formatoCampos pt-2">
|
||||
<label class="tituloLbl">Total coste hora despacho profesional:</label>
|
||||
<label class="tituloLbl">@estadisticasTotales.costeDespacho.MilesYDecimales() €</label>
|
||||
</div>
|
||||
|
||||
<div class="col-2 formatoCampos pt-2">
|
||||
<label class="tituloLbl">Total fases:</label>
|
||||
<label class="tituloLbl">@estadisticasTotales.porcentajeFases %</label>
|
||||
</div>
|
||||
|
||||
<div class="col-2 formatoCampos pt-2">
|
||||
<label class="tituloLbl">Total horas documentación:</label>
|
||||
<label class="tituloLbl">@estadisticasTotales.horasDocumentacion.MilesYDecimales() h</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mt-3">
|
||||
<div class="col-2 formatoCampos pt-2">
|
||||
<label class="tituloLbl">Total horas dirección obra:</label>
|
||||
<label class="tituloLbl">@estadisticasTotales.horasDireccionObra.MilesYDecimales() h</label>
|
||||
</div>
|
||||
|
||||
<div class="col-2 formatoCampos pt-2">
|
||||
<label class="tituloLbl">Total horas TPE:</label>
|
||||
<label class="tituloLbl">@estadisticasTotales.horasTrabajo.MilesYDecimales() h</label>
|
||||
</div>
|
||||
|
||||
<div class="col-2 formatoCampos pt-2">
|
||||
<label class="tituloLbl">Total porcentaje externalización:</label>
|
||||
<label class="tituloLbl">@estadisticasTotales.porcentajeExternalizacion.MilesYDecimales() %</label>
|
||||
</div>
|
||||
|
||||
<div class="col-2 formatoCampos pt-2">
|
||||
<label class="tituloLbl">Total plazo presentación:</label>
|
||||
<label class="tituloLbl">@estadisticasTotales.plazoPresentacion</label>
|
||||
</div>
|
||||
|
||||
<div class="col-2 formatoCampos pt-2">
|
||||
<label class="tituloLbl">Total coste producción:</label>
|
||||
<label class="tituloLbl">@estadisticasTotales.costeProduccion.MilesYDecimales() €</label>
|
||||
</div>
|
||||
|
||||
<div class="col-2 formatoCampos pt-2">
|
||||
<label class="tituloLbl">Total otros trabajos:</label>
|
||||
<label class="tituloLbl">@estadisticasTotales.totalOtrosTrabajos.MilesYDecimales() €</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mt-3">
|
||||
<div class="col-2 formatoCampos pt-2">
|
||||
<label class="tituloLbl">Total porcentaje beneficio:</label>
|
||||
<label class="tituloLbl">@estadisticasTotales.beneficio.MilesYDecimales() %</label>
|
||||
</div>
|
||||
|
||||
<div class="col-2 formatoCampos pt-2">
|
||||
<label class="tituloLbl">Total número trabajadores:</label>
|
||||
<label class="tituloLbl">@estadisticasTotales.numeroTrabajadores</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="mt-5">
|
||||
<label class="tituloLbl">No hay datos entre esas fechas.</label>
|
||||
</div>
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
<Grid TItem="estadisticas"
|
||||
Class="tablaCACOA table"
|
||||
Data="listadoHerramientaEstadistica"
|
||||
AllowFiltering="false"
|
||||
PageSize="10"
|
||||
FixedHeader="true"
|
||||
Height="750"
|
||||
Unit="Unit.Px"
|
||||
EmptyText="No hay registros."
|
||||
PageSizeSelectorVisible="false"
|
||||
Responsive="true">
|
||||
<GridColumns>
|
||||
<GridColumn TItem="estadisticas" HeaderTextAlignment="Alignment.Center" Class="text-end" HeaderText="Total costes directos">
|
||||
<span>@context.costeDirecto</span>
|
||||
</GridColumn>
|
||||
|
||||
<GridColumn TItem="estadisticas" Class="text-end" HeaderTextAlignment="Alignment.Center" HeaderText="Total costes indirectos">
|
||||
<span>@context.costeIndirecto</span>
|
||||
</GridColumn>
|
||||
|
||||
<GridColumn TItem="estadisticas" HeaderTextAlignment="Alignment.Center" Class="text-end" HeaderText="Total costes Variables">
|
||||
<span>@context.costeVariable</span>
|
||||
</GridColumn>
|
||||
|
||||
<GridColumn TItem="estadisticas" HeaderTextAlignment="Alignment.Center" Class="text-end" HeaderText="Total coste hora despacho profesional">
|
||||
<span>@context.costeHoraDespachoProf</span>
|
||||
</GridColumn>
|
||||
|
||||
<GridColumn TItem="estadisticas" HeaderTextAlignment="Alignment.Center" Class="text-end" HeaderText="Total superficie">
|
||||
<span></span>
|
||||
</GridColumn>
|
||||
|
||||
<GridColumn TItem="estadisticas" HeaderTextAlignment="Alignment.Center" Class="text-end" HeaderText="Total fases">
|
||||
<span>@context.totalFases</span>
|
||||
</GridColumn>
|
||||
|
||||
<GridColumn TItem="estadisticas" HeaderTextAlignment="Alignment.Center" Class="text-end" HeaderText="Total horas documentación">
|
||||
<span>@context.horasTPEDocumentacion</span>
|
||||
</GridColumn>
|
||||
|
||||
<GridColumn TItem="estadisticas" HeaderTextAlignment="Alignment.Center" Class="text-end" HeaderText="Total horas dirección de obra">
|
||||
<span>@context.horasTPEDireccionObra</span>
|
||||
</GridColumn>
|
||||
|
||||
<GridColumn TItem="estadisticas" HeaderTextAlignment="Alignment.Center" Class="text-end" HeaderText="Total horas trabajo profesional">
|
||||
<span>@context.horasTPE</span>
|
||||
</GridColumn>
|
||||
|
||||
<GridColumn TItem="estadisticas" HeaderTextAlignment="Alignment.Center" Class="text-end" HeaderText="Total porcentaje externalización">
|
||||
<span>@context.porcentajeExternalizacion</span>
|
||||
</GridColumn>
|
||||
|
||||
<GridColumn TItem="estadisticas" HeaderTextAlignment="Alignment.Center" Class="text-end" HeaderText="Total plazos">
|
||||
<span>@context.plazoPresentacion</span>
|
||||
</GridColumn>
|
||||
|
||||
<GridColumn TItem="estadisticas" HeaderTextAlignment="Alignment.Center" Class="text-end" HeaderText="Total costes de producción">
|
||||
<span>@context.costeProduccion</span>
|
||||
</GridColumn>
|
||||
|
||||
<GridColumn TItem="estadisticas" HeaderTextAlignment="Alignment.Center" Class="text-end" HeaderText="Total otros trabajos">
|
||||
<span>@context.totalOtrosTrabajos</span>
|
||||
</GridColumn>
|
||||
|
||||
<GridColumn TItem="estadisticas" HeaderTextAlignment="Alignment.Center" Class="text-end" HeaderText="Total porcentaje externalización">
|
||||
<span>@context.porcentajeExternalizacion</span>
|
||||
</GridColumn>
|
||||
|
||||
<GridColumn TItem="estadisticas" HeaderTextAlignment="Alignment.Center" Class="text-end" HeaderText="Total porcentaje beneficio">
|
||||
<span>@context.porcentajeBeneficio</span>
|
||||
</GridColumn>
|
||||
|
||||
<GridColumn TItem="estadisticas" HeaderTextAlignment="Alignment.Center" Class="text-end" HeaderText="Total número trabajadores">
|
||||
<span>@context.numeroTrabajadores</span>
|
||||
</GridColumn>
|
||||
</GridColumns>
|
||||
</Grid>
|
||||
|
||||
</div>
|
||||
|
||||
@code {
|
||||
|
||||
public List<estadisticas> listadoHerramientaEstadistica { get; set; } = new List<estadisticas>();
|
||||
public List<estadisticas> listadoHerramientaEstadisticaAux { get; set; } = new List<estadisticas>();
|
||||
|
||||
public DateTime? fechaInicio { get; set; } = null;
|
||||
public DateTime? fechaFinal { get; set; } = null;
|
||||
|
||||
public EstadistiaHerraCasaVM estadisticasTotales = new EstadistiaHerraCasaVM();
|
||||
private int totalProyectosTipo = 0;
|
||||
|
||||
private string mensajeError = "";
|
||||
|
||||
public tsHerramientasCACOA bd;
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
bd = tsHerramientasCACOA.NuevoContexto(SoloLectura: false);
|
||||
|
||||
inicializarListado();
|
||||
}
|
||||
|
||||
private void hacerCalculos(List<bdHerramientaCACOA.db.estadisticas> listadoEstadistica)
|
||||
{
|
||||
estadisticasTotales.costesDirectos =UtilidadesCASA.comprobarNull(listadoEstadistica.Sum(x => x.costeDirecto),totalProyectosTipo);
|
||||
estadisticasTotales.costesIndirectos = UtilidadesCASA.comprobarNull(listadoEstadistica.Sum(x => x.costeIndirecto), totalProyectosTipo);
|
||||
estadisticasTotales.costesVariables = UtilidadesCASA.comprobarNull(listadoEstadistica.Sum(x => x.costeVariable), totalProyectosTipo);
|
||||
estadisticasTotales.costeDespacho = UtilidadesCASA.comprobarNull(listadoEstadistica.Sum(x => x.costeHoraDespachoProf), totalProyectosTipo);
|
||||
estadisticasTotales.porcentajeFases = UtilidadesCASA.comprobarNull(listadoEstadistica.Sum(x => x.totalFases), totalProyectosTipo);
|
||||
estadisticasTotales.horasDocumentacion = UtilidadesCASA.comprobarNull(listadoEstadistica.Sum(x => x.horasTPEDocumentacion), totalProyectosTipo);
|
||||
estadisticasTotales.horasDireccionObra = UtilidadesCASA.comprobarNull(listadoEstadistica.Sum(x => x.horasTPEDireccionObra), totalProyectosTipo);
|
||||
estadisticasTotales.horasTrabajo = UtilidadesCASA.comprobarNull(listadoEstadistica.Sum(x => x.horasTPE), totalProyectosTipo);
|
||||
estadisticasTotales.porcentajeExternalizacion = UtilidadesCASA.comprobarNull(listadoEstadistica.Sum(x => x.porcentajeExternalizacion), totalProyectosTipo);
|
||||
estadisticasTotales.plazoPresentacion = UtilidadesCASA.comprobarNull(listadoEstadistica.Sum(x => x.plazoPresentacion), totalProyectosTipo);
|
||||
estadisticasTotales.costeProduccion = UtilidadesCASA.comprobarNull(listadoEstadistica.Sum(x => x.costeProduccion), totalProyectosTipo);
|
||||
estadisticasTotales.totalOtrosTrabajos = UtilidadesCASA.comprobarNull(listadoEstadistica.Sum(x => x.totalOtrosTrabajos), totalProyectosTipo);
|
||||
estadisticasTotales.beneficio = UtilidadesCASA.comprobarNull(listadoEstadistica.Sum(x => x.porcentajeBeneficio), totalProyectosTipo);
|
||||
estadisticasTotales.numeroTrabajadores = UtilidadesCASA.comprobarNull(listadoEstadistica.Sum(x => x.numeroTrabajadores), totalProyectosTipo);
|
||||
}
|
||||
|
||||
|
||||
private void inicializarListado()
|
||||
{
|
||||
listadoHerramientaEstadistica = bd.estadisticas.Include(x => x.idSimulacionNavigation).Where(x => x.idSimulacionNavigation.idTipoSimulacion == 31).ToList();
|
||||
listadoHerramientaEstadisticaAux = listadoHerramientaEstadistica;
|
||||
|
||||
totalProyectosTipo = listadoHerramientaEstadistica.Count();
|
||||
|
||||
hacerCalculos(listadoHerramientaEstadistica);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,340 @@
|
||||
@inject NavigationManager Navigation
|
||||
@layout ConfiguracionLayout
|
||||
@rendermode InteractiveServer
|
||||
@using BlazorBootstrap
|
||||
@using System.Globalization
|
||||
@using Microsoft.EntityFrameworkCore
|
||||
@using bdHerramientaCACOA.db
|
||||
|
||||
<div>
|
||||
|
||||
<div class="row" style="justify-content:space-between">
|
||||
<div class="form-group mt-4 col-6">
|
||||
<label>Fecha inicio:</label>
|
||||
<InputDate TValue="DateTime?"
|
||||
Value="fechaInicio"
|
||||
ValueChanged="OnFechaInicioChanged"
|
||||
ValueExpression="@(() => fechaInicio)" />
|
||||
|
||||
<label>Fecha final:</label>
|
||||
<InputDate TValue="DateTime?"
|
||||
Value="fechaFinal"
|
||||
ValueChanged="OnFechaFinalChanged"
|
||||
ValueExpression="@(() => fechaFinal)" />
|
||||
|
||||
</div>
|
||||
|
||||
<div class="mt-2">
|
||||
@if (!string.IsNullOrEmpty(mensajeError))
|
||||
{
|
||||
<label class="text-danger fw-semibold">
|
||||
@mensajeError
|
||||
</label>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@if (totalProyectosTipo != 0)
|
||||
{
|
||||
<div class="mt-5" style="padding:50px;">
|
||||
<div class="mb-4">
|
||||
<label class="fw-bold">Total simulaciones herramienta URBAN: <span>@totalProyectosTipo</span> </label>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-2 formatoCampos pt-2">
|
||||
<label class="tituloLbl">Total costes directos:</label>
|
||||
<label class="tituloLbl">@estadisticasTotales.costeDirecto.MilesYDecimales() €</label>
|
||||
</div>
|
||||
|
||||
<div class="col-2 formatoCampos pt-2">
|
||||
<label class="tituloLbl">Total costes indirectos:</label>
|
||||
<label class="tituloLbl">@estadisticasTotales.costeIndirecto.MilesYDecimales() €</label>
|
||||
</div>
|
||||
|
||||
<div class="col-2 formatoCampos pt-2">
|
||||
<label class="tituloLbl">Total costes variables:</label>
|
||||
<label class="tituloLbl">@estadisticasTotales.costeVariable.MilesYDecimales() €</label>
|
||||
</div>
|
||||
|
||||
<div class="col-2 formatoCampos pt-2">
|
||||
<label class="tituloLbl">Total coste hora despacho profesional:</label>
|
||||
<label class="tituloLbl">@estadisticasTotales.costeHoraDespachoProf.MilesYDecimales() €</label>
|
||||
</div>
|
||||
|
||||
<div class="col-2 formatoCampos pt-2">
|
||||
<label class="tituloLbl">Total horas documentación:</label>
|
||||
<label class="tituloLbl">@estadisticasTotales.horasTPEDocumentacion.MilesYDecimales() h</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mt-3">
|
||||
<div class="col-2 formatoCampos pt-2">
|
||||
<label class="tituloLbl">Total horas dirección obra:</label>
|
||||
<label class="tituloLbl">@estadisticasTotales.horasTPEDireccionObra.MilesYDecimales() h</label>
|
||||
</div>
|
||||
|
||||
<div class="col-2 formatoCampos pt-2">
|
||||
<label class="tituloLbl">Total horas TPE:</label>
|
||||
<label class="tituloLbl">@estadisticasTotales.horasTPE.MilesYDecimales() h</label>
|
||||
</div>
|
||||
|
||||
<div class="col-2 formatoCampos pt-2">
|
||||
<label class="tituloLbl">Total porcentaje externalización:</label>
|
||||
<label class="tituloLbl">@estadisticasTotales.porcentajeExternalizacion.MilesYDecimales() %</label>
|
||||
</div>
|
||||
|
||||
<div class="col-2 formatoCampos pt-2">
|
||||
<label class="tituloLbl">Total plazo presentación:</label>
|
||||
<label class="tituloLbl">@estadisticasTotales.plazoPresentacion</label>
|
||||
</div>
|
||||
|
||||
<div class="col-2 formatoCampos pt-2">
|
||||
<label class="tituloLbl">Total coste producción:</label>
|
||||
<label class="tituloLbl">@estadisticasTotales.costeProduccion.MilesYDecimales() €</label>
|
||||
</div>
|
||||
|
||||
<div class="col-2 formatoCampos pt-2">
|
||||
<label class="tituloLbl">Total otros trabajos:</label>
|
||||
<label class="tituloLbl">@estadisticasTotales.totalOtrosTrabajos.MilesYDecimales() €</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mt-3">
|
||||
<div class="col-2 formatoCampos pt-2">
|
||||
<label class="tituloLbl">Total porcentaje beneficio:</label>
|
||||
<label class="tituloLbl">@estadisticasTotales.porcentajeBeneficio.MilesYDecimales() %</label>
|
||||
</div>
|
||||
|
||||
<div class="col-2 formatoCampos pt-2">
|
||||
<label class="tituloLbl">Total número trabajadores:</label>
|
||||
<label class="tituloLbl">@estadisticasTotales.numeroTrabajadores</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="mt-5">
|
||||
<label class="tituloLbl">No hay datos entre esas fechas.</label>
|
||||
</div>
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
<Grid TItem="estadisticas"
|
||||
Class="tablaCACOA table"
|
||||
Data="listadoHerramientaEstadistica"
|
||||
AllowFiltering="false"
|
||||
PageSize="10"
|
||||
FixedHeader="true"
|
||||
Height="750"
|
||||
Unit="Unit.Px"
|
||||
EmptyText="No hay registros."
|
||||
PageSizeSelectorVisible="false"
|
||||
Responsive="true">
|
||||
<GridColumns>
|
||||
<GridColumn TItem="estadisticas" HeaderTextAlignment="Alignment.Center" Class="text-end" HeaderText="Total costes directos">
|
||||
<span>@context.costeDirecto</span>
|
||||
</GridColumn>
|
||||
|
||||
<GridColumn TItem="estadisticas" Class="text-end" HeaderTextAlignment="Alignment.Center" HeaderText="Total costes indirectos">
|
||||
<span>@context.costeIndirecto</span>
|
||||
</GridColumn>
|
||||
|
||||
<GridColumn TItem="estadisticas" HeaderTextAlignment="Alignment.Center" Class="text-end" HeaderText="Total costes Variables">
|
||||
<span>@context.costeVariable</span>
|
||||
</GridColumn>
|
||||
|
||||
<GridColumn TItem="estadisticas" HeaderTextAlignment="Alignment.Center" Class="text-end" HeaderText="Total coste hora despacho profesional">
|
||||
<span>@context.costeHoraDespachoProf</span>
|
||||
</GridColumn>
|
||||
|
||||
<GridColumn TItem="estadisticas" HeaderTextAlignment="Alignment.Center" Class="text-end" HeaderText="Total superficie">
|
||||
<span></span>
|
||||
</GridColumn>
|
||||
|
||||
<GridColumn TItem="estadisticas" HeaderTextAlignment="Alignment.Center" Class="text-end" HeaderText="Total fases">
|
||||
<span>@context.totalFases</span>
|
||||
</GridColumn>
|
||||
|
||||
<GridColumn TItem="estadisticas" HeaderTextAlignment="Alignment.Center" Class="text-end" HeaderText="Total horas documentación">
|
||||
<span>@context.horasTPEDocumentacion</span>
|
||||
</GridColumn>
|
||||
|
||||
<GridColumn TItem="estadisticas" HeaderTextAlignment="Alignment.Center" Class="text-end" HeaderText="Total horas dirección de obra">
|
||||
<span>@context.horasTPEDireccionObra</span>
|
||||
</GridColumn>
|
||||
|
||||
<GridColumn TItem="estadisticas" HeaderTextAlignment="Alignment.Center" Class="text-end" HeaderText="Total horas trabajo profesional">
|
||||
<span>@context.horasTPE</span>
|
||||
</GridColumn>
|
||||
|
||||
<GridColumn TItem="estadisticas" HeaderTextAlignment="Alignment.Center" Class="text-end" HeaderText="Total porcentaje externalización">
|
||||
<span>@context.porcentajeExternalizacion</span>
|
||||
</GridColumn>
|
||||
|
||||
<GridColumn TItem="estadisticas" HeaderTextAlignment="Alignment.Center" Class="text-end" HeaderText="Total plazos">
|
||||
<span>@context.plazoPresentacion</span>
|
||||
</GridColumn>
|
||||
|
||||
<GridColumn TItem="estadisticas" HeaderTextAlignment="Alignment.Center" Class="text-end" HeaderText="Total costes de producción">
|
||||
<span>@context.costeProduccion</span>
|
||||
</GridColumn>
|
||||
|
||||
<GridColumn TItem="estadisticas" HeaderTextAlignment="Alignment.Center" Class="text-end" HeaderText="Total otros trabajos">
|
||||
<span>@context.totalOtrosTrabajos</span>
|
||||
</GridColumn>
|
||||
|
||||
<GridColumn TItem="estadisticas" HeaderTextAlignment="Alignment.Center" Class="text-end" HeaderText="Total porcentaje externalización">
|
||||
<span>@context.porcentajeExternalizacion</span>
|
||||
</GridColumn>
|
||||
|
||||
<GridColumn TItem="estadisticas" HeaderTextAlignment="Alignment.Center" Class="text-end" HeaderText="Total porcentaje beneficio">
|
||||
<span>@context.porcentajeBeneficio</span>
|
||||
</GridColumn>
|
||||
|
||||
<GridColumn TItem="estadisticas" HeaderTextAlignment="Alignment.Center" Class="text-end" HeaderText="Total número trabajadores">
|
||||
<span>@context.numeroTrabajadores</span>
|
||||
</GridColumn>
|
||||
</GridColumns>
|
||||
</Grid>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
@code {
|
||||
|
||||
public List<estadisticas> listadoHerramientaEstadistica { get; set; } = new List<estadisticas>();
|
||||
public List<estadisticas> listadoHerramientaEstadisticaAux { get; set; } = new List<estadisticas>();
|
||||
|
||||
public DateTime? fechaInicio { get; set; } = null;
|
||||
public DateTime? fechaFinal { get; set; } = null;
|
||||
|
||||
public estadisticas estadisticasTotales = new estadisticas();
|
||||
private int totalProyectosTipo = 0;
|
||||
|
||||
private string mensajeError = "";
|
||||
|
||||
private async Task OnFechaInicioChanged(DateTime? value)
|
||||
{
|
||||
fechaInicio = value;
|
||||
if (UtilidadesCASA.comprobarFechasNulas(fechaInicio, fechaFinal))
|
||||
{
|
||||
inicializarListado();
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
if (UtilidadesCASA.comprobarFechas((DateTime)fechaInicio, (DateTime)fechaFinal))
|
||||
{
|
||||
AplicarFiltros();
|
||||
mensajeError = "";
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
mensajeError = "La fecha final no puede ser menor que la fecha inicial.";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private async Task OnFechaFinalChanged(DateTime? value)
|
||||
{
|
||||
fechaFinal = value;
|
||||
|
||||
if (UtilidadesCASA.comprobarFechasNulas(fechaInicio, fechaFinal))
|
||||
{
|
||||
inicializarListado();
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
if (UtilidadesCASA.comprobarFechas((DateTime)fechaInicio, (DateTime)fechaFinal))
|
||||
{
|
||||
AplicarFiltros();
|
||||
mensajeError = "";
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
mensajeError = "La fecha final no puede ser menor que la fecha inicial.";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public tsHerramientasCACOA bd;
|
||||
|
||||
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
bd = tsHerramientasCACOA.NuevoContexto(SoloLectura: false);
|
||||
inicializarListado();
|
||||
|
||||
}
|
||||
|
||||
private void AplicarFiltros()
|
||||
{
|
||||
// Filtra la lista en función de los criterios ingresados
|
||||
listadoHerramientaEstadistica = new List<bdHerramientaCACOA.db.estadisticas>();
|
||||
foreach (bdHerramientaCACOA.db.estadisticas item in listadoHerramientaEstadisticaAux)
|
||||
{
|
||||
if (IsVisible(item) == true)
|
||||
{
|
||||
listadoHerramientaEstadistica.Add(item);
|
||||
}
|
||||
}
|
||||
totalProyectosTipo = listadoHerramientaEstadistica.Count();
|
||||
hacerCalculos(listadoHerramientaEstadistica);
|
||||
}
|
||||
|
||||
public bool IsVisible(bdHerramientaCACOA.db.estadisticas listado)
|
||||
{
|
||||
DateTime? ultimaFecha;
|
||||
if (listado.idSimulacionNavigation.FechaModificacion != null)
|
||||
{
|
||||
ultimaFecha = listado.idSimulacionNavigation.FechaModificacion;
|
||||
}
|
||||
else
|
||||
{
|
||||
ultimaFecha = listado.idSimulacionNavigation.FechaCreacion;
|
||||
}
|
||||
|
||||
if (fechaFinal != null && listado.idSimulacionNavigation.FechaCreacion.Date >= fechaInicio?.Date && ultimaFecha?.Date <= fechaFinal?.Date)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
private void hacerCalculos(List<bdHerramientaCACOA.db.estadisticas> listadoEstadistica)
|
||||
{
|
||||
estadisticasTotales.costeDirecto = UtilidadesCASA.comprobarNull(listadoEstadistica.Sum(x => x.costeDirecto), totalProyectosTipo);
|
||||
estadisticasTotales.costeIndirecto = UtilidadesCASA.comprobarNull(listadoEstadistica.Sum(x => x.costeIndirecto), totalProyectosTipo);
|
||||
estadisticasTotales.costeVariable = UtilidadesCASA.comprobarNull(listadoEstadistica.Sum(x => x.costeVariable), totalProyectosTipo);
|
||||
estadisticasTotales.costeHoraDespachoProf = UtilidadesCASA.comprobarNull(listadoEstadistica.Sum(x => x.costeHoraDespachoProf), totalProyectosTipo);
|
||||
|
||||
estadisticasTotales.horasTPE = UtilidadesCASA.comprobarNull(listadoEstadistica.Sum(x => x.horasTPE), totalProyectosTipo);
|
||||
estadisticasTotales.porcentajeExternalizacion = UtilidadesCASA.comprobarNull(listadoEstadistica.Sum(x => x.porcentajeExternalizacion), totalProyectosTipo);
|
||||
estadisticasTotales.plazoPresentacion = UtilidadesCASA.comprobarNull(listadoEstadistica.Sum(x => x.plazoPresentacion), totalProyectosTipo);
|
||||
estadisticasTotales.costeProduccion = UtilidadesCASA.comprobarNull(listadoEstadistica.Sum(x => x.costeProduccion), totalProyectosTipo);
|
||||
estadisticasTotales.porcentajeBeneficio = UtilidadesCASA.comprobarNull(listadoEstadistica.Sum(x => x.porcentajeBeneficio), totalProyectosTipo);
|
||||
estadisticasTotales.numeroTrabajadores = UtilidadesCASA.comprobarNull(listadoEstadistica.Sum(x => x.numeroTrabajadores), totalProyectosTipo);
|
||||
}
|
||||
|
||||
private void inicializarListado()
|
||||
{
|
||||
listadoHerramientaEstadistica = bd.estadisticas.Include(x => x.idSimulacionNavigation).Where(x => x.idSimulacionNavigation.idTipoSimulacion == 34).ToList();
|
||||
listadoHerramientaEstadisticaAux = listadoHerramientaEstadistica;
|
||||
|
||||
totalProyectosTipo = listadoHerramientaEstadistica.Count();
|
||||
|
||||
hacerCalculos(listadoHerramientaEstadistica);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,255 @@
|
||||
@inject NavigationManager Navigation
|
||||
@layout ConfiguracionLayout
|
||||
@rendermode InteractiveServer
|
||||
@using BlazorBootstrap
|
||||
@using System.Globalization
|
||||
@using Microsoft.EntityFrameworkCore
|
||||
@using bdHerramientaCACOA.db
|
||||
|
||||
<div>
|
||||
|
||||
<div class="row" style="justify-content:space-between">
|
||||
<div class="form-group mt-4 col-6">
|
||||
<label>Fecha inicio:</label>
|
||||
<InputDate TValue="DateTime?"
|
||||
Value="fechaInicio"
|
||||
ValueChanged="OnFechaInicioChanged"
|
||||
ValueExpression="@(() => fechaInicio)" />
|
||||
|
||||
<label>Fecha final:</label>
|
||||
<InputDate TValue="DateTime?"
|
||||
Value="fechaFinal"
|
||||
ValueChanged="OnFechaFinalChanged"
|
||||
ValueExpression="@(() => fechaFinal)" />
|
||||
|
||||
</div>
|
||||
|
||||
<div class="mt-2">
|
||||
@if (!string.IsNullOrEmpty(mensajeError))
|
||||
{
|
||||
<label class="text-danger fw-semibold">
|
||||
@mensajeError
|
||||
</label>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@if (totalProyectosTipo != 0)
|
||||
{
|
||||
|
||||
<div class="mt-5" style="padding:50px;">
|
||||
<div class="mb-4">
|
||||
<label class="fw-bold">Total simulaciones licitación CASA: <span>@totalProyectosTipo</span> </label>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-2 formatoCampos pt-2">
|
||||
<label class="tituloLbl">Total coste hora despacho profesional:</label>
|
||||
<label class="tituloLbl">@estadisticasTotales.costeHoraDespachoProf.MilesYDecimales() €</label>
|
||||
</div>
|
||||
|
||||
<div class="col-2 formatoCampos pt-2">
|
||||
<label class="tituloLbl">Total fases:</label>
|
||||
<label class="tituloLbl">@estadisticasTotales.totalFases %</label>
|
||||
</div>
|
||||
|
||||
<div class="col-2 formatoCampos pt-2">
|
||||
<label class="tituloLbl">Total horas TPE:</label>
|
||||
<label class="tituloLbl">@estadisticasTotales.horasTPE.MilesYDecimales() h</label>
|
||||
</div>
|
||||
|
||||
<div class="col-2 formatoCampos pt-2">
|
||||
<label class="tituloLbl">Total plazo presentación:</label>
|
||||
<label class="tituloLbl">@estadisticasTotales.plazoPresentacion</label>
|
||||
</div>
|
||||
|
||||
<div class="col-2 formatoCampos pt-2">
|
||||
<label class="tituloLbl">Total coste producción:</label>
|
||||
<label class="tituloLbl">@estadisticasTotales.costeProduccion.MilesYDecimales() €</label>
|
||||
</div>
|
||||
|
||||
<div class="col-2 formatoCampos pt-2">
|
||||
<label class="tituloLbl">Total otros trabajos:</label>
|
||||
<label class="tituloLbl">@estadisticasTotales.totalOtrosTrabajos.MilesYDecimales() €</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="mt-5">
|
||||
<label class="tituloLbl">No hay datos entre esas fechas.</label>
|
||||
</div>
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
<Grid TItem="estadisticas"
|
||||
Class="tablaCACOA table"
|
||||
Data="listadoHerramientaEstadistica"
|
||||
AllowFiltering="false"
|
||||
PageSize="10"
|
||||
FixedHeader="true"
|
||||
Height="750"
|
||||
Unit="Unit.Px"
|
||||
EmptyText="No hay registros."
|
||||
PageSizeSelectorVisible="false"
|
||||
Responsive="true">
|
||||
<GridColumns>
|
||||
<GridColumn TItem="estadisticas" HeaderTextAlignment="Alignment.Center" Class="text-end" HeaderText="Total coste hora despacho profesional">
|
||||
<span>@context.costeHoraDespachoProf</span>
|
||||
</GridColumn>
|
||||
|
||||
<GridColumn TItem="estadisticas" HeaderTextAlignment="Alignment.Center" Class="text-end" HeaderText="Total fases">
|
||||
<span>@context.totalFases</span>
|
||||
</GridColumn>
|
||||
|
||||
<GridColumn TItem="estadisticas" HeaderTextAlignment="Alignment.Center" Class="text-end" HeaderText="Total horas trabajo profesional">
|
||||
<span>@context.horasTPE</span>
|
||||
</GridColumn>
|
||||
|
||||
<GridColumn TItem="estadisticas" HeaderTextAlignment="Alignment.Center" Class="text-end" HeaderText="Total plazos">
|
||||
<span>@context.plazoPresentacion</span>
|
||||
</GridColumn>
|
||||
|
||||
<GridColumn TItem="estadisticas" HeaderTextAlignment="Alignment.Center" Class="text-end" HeaderText="Total costes de producción">
|
||||
<span>@context.costeProduccion</span>
|
||||
</GridColumn>
|
||||
|
||||
<GridColumn TItem="estadisticas" HeaderTextAlignment="Alignment.Center" Class="text-end" HeaderText="Total otros trabajos">
|
||||
<span>@context.totalOtrosTrabajos</span>
|
||||
</GridColumn>
|
||||
</GridColumns>
|
||||
</Grid>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
@code {
|
||||
|
||||
public List<estadisticas> listadoHerramientaEstadistica { get; set; } = new List<estadisticas>();
|
||||
public List<estadisticas> listadoHerramientaEstadisticaAux { get; set; } = new List<estadisticas>();
|
||||
|
||||
|
||||
public DateTime? fechaInicio { get; set; } = null;
|
||||
public DateTime? fechaFinal { get; set; } = null;
|
||||
|
||||
public estadisticas estadisticasTotales = new estadisticas();
|
||||
private int totalProyectosTipo = 0;
|
||||
|
||||
private string mensajeError = "";
|
||||
|
||||
private async Task OnFechaInicioChanged(DateTime? value)
|
||||
{
|
||||
fechaInicio = value;
|
||||
if (UtilidadesCASA.comprobarFechasNulas(fechaInicio, fechaFinal))
|
||||
{
|
||||
inicializarListado();
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
if (UtilidadesCASA.comprobarFechas((DateTime)fechaInicio, (DateTime)fechaFinal))
|
||||
{
|
||||
AplicarFiltros();
|
||||
mensajeError = "";
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
mensajeError = "La fecha final no puede ser menor que la fecha inicial.";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private async Task OnFechaFinalChanged(DateTime? value)
|
||||
{
|
||||
fechaFinal = value;
|
||||
if (UtilidadesCASA.comprobarFechasNulas(fechaInicio, fechaFinal))
|
||||
{
|
||||
inicializarListado();
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
if (UtilidadesCASA.comprobarFechas((DateTime)fechaInicio, (DateTime)fechaFinal))
|
||||
{
|
||||
AplicarFiltros();
|
||||
mensajeError = "";
|
||||
}
|
||||
else
|
||||
{
|
||||
mensajeError = "La fecha final no puede ser menor que la fecha inicial.";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public tsHerramientasCACOA bd;
|
||||
|
||||
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
bd = tsHerramientasCACOA.NuevoContexto(SoloLectura: false);
|
||||
inicializarListado();
|
||||
|
||||
}
|
||||
|
||||
private void AplicarFiltros()
|
||||
{
|
||||
// Filtra la lista en función de los criterios ingresados
|
||||
listadoHerramientaEstadistica = new List<bdHerramientaCACOA.db.estadisticas>();
|
||||
foreach (bdHerramientaCACOA.db.estadisticas item in listadoHerramientaEstadisticaAux)
|
||||
{
|
||||
if (IsVisible(item) == true)
|
||||
{
|
||||
listadoHerramientaEstadistica.Add(item);
|
||||
}
|
||||
}
|
||||
totalProyectosTipo = listadoHerramientaEstadistica.Count();
|
||||
hacerCalculos(listadoHerramientaEstadistica);
|
||||
}
|
||||
|
||||
public bool IsVisible(bdHerramientaCACOA.db.estadisticas listado)
|
||||
{
|
||||
DateTime? ultimaFecha;
|
||||
if (listado.idSimulacionNavigation.FechaModificacion != null)
|
||||
{
|
||||
ultimaFecha = listado.idSimulacionNavigation.FechaModificacion;
|
||||
}
|
||||
else
|
||||
{
|
||||
ultimaFecha = listado.idSimulacionNavigation.FechaCreacion;
|
||||
}
|
||||
|
||||
if (fechaFinal != null && listado.idSimulacionNavigation.FechaCreacion.Date >= fechaInicio?.Date && ultimaFecha?.Date <= fechaFinal?.Date)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
private void hacerCalculos(List<bdHerramientaCACOA.db.estadisticas> listadoEstadistica)
|
||||
{
|
||||
estadisticasTotales.costeHoraDespachoProf = UtilidadesCASA.comprobarNull(listadoEstadistica.Sum(x => x.costeHoraDespachoProf), totalProyectosTipo);
|
||||
estadisticasTotales.totalFases = UtilidadesCASA.comprobarNull(listadoEstadistica.Sum(x => x.totalFases), totalProyectosTipo);
|
||||
estadisticasTotales.horasTPE = UtilidadesCASA.comprobarNull(listadoEstadistica.Sum(x => x.horasTPE), totalProyectosTipo);
|
||||
estadisticasTotales.plazoPresentacion = UtilidadesCASA.comprobarNull(listadoEstadistica.Sum(x => x.plazoPresentacion), totalProyectosTipo);
|
||||
estadisticasTotales.costeProduccion = UtilidadesCASA.comprobarNull(listadoEstadistica.Sum(x => x.costeProduccion), totalProyectosTipo);
|
||||
estadisticasTotales.totalOtrosTrabajos = UtilidadesCASA.comprobarNull(listadoEstadistica.Sum(x => x.totalOtrosTrabajos), totalProyectosTipo);
|
||||
}
|
||||
|
||||
private void inicializarListado()
|
||||
{
|
||||
listadoHerramientaEstadistica = bd.estadisticas.Include(x => x.idSimulacionNavigation).Where(x => x.idSimulacionNavigation.idTipoSimulacion == 32).ToList();
|
||||
listadoHerramientaEstadisticaAux = listadoHerramientaEstadistica;
|
||||
|
||||
totalProyectosTipo = listadoHerramientaEstadistica.Count();
|
||||
|
||||
hacerCalculos(listadoHerramientaEstadistica);
|
||||
}
|
||||
}
|
||||
@@ -68,7 +68,7 @@
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="col-12 d-flex align-items-center justify-content-center colorEMenu dive">
|
||||
<div class="col-6 d-flex align-items-center justify-content-center colorEMenu dive">
|
||||
<a href="PuntosInfo">
|
||||
<div>
|
||||
<h4 class="text-center">Puntos de información</h4>
|
||||
@@ -76,6 +76,14 @@
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="col-6 d-flex align-items-center justify-content-center colorAMenu dive">
|
||||
<a href="Estadisticas">
|
||||
<div>
|
||||
<h4 class="text-center">Estadisticas</h4>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
@@ -208,7 +208,7 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
crearSimulacion(jsonObjeto);
|
||||
idSimulador = crearSimulacion(jsonObjeto).ToString();
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -233,7 +233,7 @@
|
||||
HerramientaCASA.UtilidadesCASA.guardarEstadisticas(bd, HerramientaCASA.UtilidadesCASA.TiposSimulaciones.CASA,jsonObjeto,int.Parse(idSimulador));
|
||||
}
|
||||
|
||||
private void crearSimulacion(string jsonObjeto)
|
||||
private int crearSimulacion(string jsonObjeto)
|
||||
{
|
||||
int idSimulacionCreada = UtilidadesCASA.crearObjeto(bd, HerramientaCASA.UtilidadesCASA.TiposSimulaciones.CASA, jsonObjeto, casa.NombreSimulacion, "casa.json", idUser);
|
||||
string link = "/HerramientaCASAS?idSimulador=" + tsUtilidades.crypt.FEncS(idSimulacionCreada.ToString(), "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890.:/-*", "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890.:/-*", 875421649);
|
||||
@@ -244,6 +244,8 @@
|
||||
});
|
||||
|
||||
Navigation.NavigateTo(link, true);
|
||||
|
||||
return idSimulacionCreada;
|
||||
}
|
||||
private void actualizarSimulacion(string jsonObjeto)
|
||||
{
|
||||
|
||||
@@ -169,7 +169,7 @@
|
||||
// para evitar loops
|
||||
int idtipoSimulacion = bd.enumeraciones.First(x => x.Codigo == HerramientaCASA.UtilidadesCASA.obtenerTipoSimulacion(HerramientaCASA.UtilidadesCASA.TiposSimulaciones.URBAN)).idEnumeracion;
|
||||
|
||||
// para evitar loops
|
||||
// para evitar loops
|
||||
|
||||
|
||||
string jsonObjeto = Newtonsoft.Json.JsonConvert.SerializeObject(urban);
|
||||
@@ -187,7 +187,7 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
crearSimulacion(jsonObjeto);
|
||||
idSimulador = crearSimulacion(jsonObjeto).ToString();
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -211,7 +211,7 @@
|
||||
|
||||
HerramientaCASA.UtilidadesCASA.guardarEstadisticas(bd, HerramientaCASA.UtilidadesCASA.TiposSimulaciones.URBAN, jsonObjeto, int.Parse(idSimulador));
|
||||
}
|
||||
private void crearSimulacion(string jsonObjeto)
|
||||
private int crearSimulacion(string jsonObjeto)
|
||||
{
|
||||
int idSimulacionCreada = UtilidadesCASA.crearObjeto(bd, HerramientaCASA.UtilidadesCASA.TiposSimulaciones.URBAN, jsonObjeto, urban.NombreSimulacion, "urban.json", idUser);
|
||||
string link = "/HerramientaURBAN?idSimulador=" + tsUtilidades.crypt.FEncS(idSimulacionCreada.ToString(), "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890.:/-*", "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890.:/-*", 875421649);
|
||||
@@ -222,6 +222,8 @@
|
||||
});
|
||||
|
||||
Navigation.NavigateTo(link, true);
|
||||
|
||||
return idSimulacionCreada;
|
||||
}
|
||||
private void actualizarSimulacion(string jsonObjeto)
|
||||
{
|
||||
|
||||
@@ -313,7 +313,7 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
crearLicitacion(jsonObjeto);
|
||||
idSimulador = crearLicitacion(jsonObjeto).ToString();
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -338,7 +338,7 @@
|
||||
HerramientaCASA.UtilidadesCASA.guardarEstadisticas(bd, HerramientaCASA.UtilidadesCASA.TiposSimulaciones.LICITACIONCASA, jsonObjeto, int.Parse(idSimulador));
|
||||
}
|
||||
|
||||
private void crearLicitacion(string jsonObjeto)
|
||||
private int crearLicitacion(string jsonObjeto)
|
||||
{
|
||||
int idLicitacionCreada = UtilidadesCASA.crearObjeto(bd, HerramientaCASA.UtilidadesCASA.TiposSimulaciones.LICITACIONCASA, jsonObjeto, objetoLicitaciones.Descripcion, "licitaciones.json", idUser);
|
||||
|
||||
@@ -350,6 +350,7 @@
|
||||
Message = $"Licitación creada correctamente.",
|
||||
});
|
||||
Navigation.NavigateTo(link, true);
|
||||
return idLicitacionCreada;
|
||||
}
|
||||
private void actualizarLicitacion(string jsonObjeto)
|
||||
{
|
||||
|
||||
@@ -341,7 +341,7 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
crearSimulacion(jsonObjeto);
|
||||
idSimulador = crearSimulacion(jsonObjeto).ToString();
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -366,7 +366,7 @@
|
||||
|
||||
HerramientaCASA.UtilidadesCASA.guardarEstadisticas(bd, HerramientaCASA.UtilidadesCASA.TiposSimulaciones.URBANDSIMP, jsonObjeto, int.Parse(idSimulador));
|
||||
}
|
||||
private void crearSimulacion(string jsonObjeto)
|
||||
private int crearSimulacion(string jsonObjeto)
|
||||
{
|
||||
int idSimulacionCreada = UtilidadesCASA.crearObjeto(bd, HerramientaCASA.UtilidadesCASA.TiposSimulaciones.URBANDSIMP, jsonObjeto, objetoLicitacionUrban.NombreSimulacion, "licitacionesUrban.json", idUser);
|
||||
string link = "/LicitacionesURBAN?idSimulador=" + tsUtilidades.crypt.FEncS(idSimulacionCreada.ToString(), "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890.:/-*", "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890.:/-*", 875421649);
|
||||
@@ -377,6 +377,7 @@
|
||||
});
|
||||
|
||||
Navigation.NavigateTo(link, true);
|
||||
return idSimulacionCreada;
|
||||
}
|
||||
private void actualizarSimulacion(string jsonObjeto)
|
||||
{
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Blazor.Bootstrap" Version="3.3.1" />
|
||||
<PackageReference Include="ClosedXML" Version="0.105.0" />
|
||||
<PackageReference Include="PuppeteerSharp" Version="20.2.2" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ using bdHerramientaCACOA.db;
|
||||
using bdHerramientaCACOA.dbcontext;
|
||||
using bdHerramientaCACOA.HerramientaURBAN;
|
||||
using BlazorBootstrap;
|
||||
using DocumentFormat.OpenXml.Office2013.Drawing.ChartStyle;
|
||||
using HerramientaCASA.Components.Pages;
|
||||
using HerramientaCASA.Components.Pages.HerramientaCASATabs;
|
||||
using HerramientaCASA.Model;
|
||||
@@ -661,13 +662,13 @@ namespace HerramientaCASA
|
||||
|
||||
if (!comprobarExisteEstadistica(bd, idSimulador))
|
||||
{
|
||||
mapearEstadisticasCASA(estadisticas,casa,idSimulador);
|
||||
mapearEstadisticasCASA(bd,estadisticas,casa,idSimulador);
|
||||
bd.estadisticas.Add(estadisticas);
|
||||
}
|
||||
else
|
||||
{
|
||||
var estadisticaExistente = bd.estadisticas.First(x => x.idSimulacion == idSimulador);
|
||||
mapearEstadisticasCASA(estadisticaExistente, casa, idSimulador);
|
||||
mapearEstadisticasCASA(bd,estadisticaExistente, casa, idSimulador);
|
||||
}
|
||||
break;
|
||||
case TiposSimulaciones.BAJA:
|
||||
@@ -677,13 +678,13 @@ namespace HerramientaCASA
|
||||
|
||||
if (!comprobarExisteEstadistica(bd, idSimulador))
|
||||
{
|
||||
mapearEstadisticasLicitacionCASA(estadisticas, licitacionCASA, idSimulador);
|
||||
mapearEstadisticasLicitacionCASA(bd,estadisticas, licitacionCASA, idSimulador);
|
||||
bd.estadisticas.Add(estadisticas);
|
||||
}
|
||||
else
|
||||
{
|
||||
var estadisticaExistente = bd.estadisticas.First(x => x.idSimulacion == idSimulador);
|
||||
mapearEstadisticasLicitacionCASA(estadisticaExistente, licitacionCASA, idSimulador);
|
||||
mapearEstadisticasLicitacionCASA(bd, estadisticaExistente, licitacionCASA, idSimulador);
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -737,59 +738,369 @@ namespace HerramientaCASA
|
||||
return existeEstadistica;
|
||||
}
|
||||
|
||||
private static void mapearEstadisticasCASA(estadisticas estadistica, CASA casa, int idSimulador)
|
||||
private static void mapearEstadisticasCASA(tsHerramientasCACOA bd,estadisticas estadistica, CASA casa, int idSimulador)
|
||||
{
|
||||
estadistica.idSimulacion = idSimulador;
|
||||
estadistica.numeroTrabajadores = casa.DespachoProfesional.Trabajadores.Sum(x => x.NumTrabajadores);
|
||||
estadistica.totalCosteAnual = casa.DespachoProfesional.CostesDirectosAnuales;
|
||||
estadistica.horasProduccion = casa.DespachoProfesional.HorasTotalesProduccion;
|
||||
estadistica.costeDirecto = casa.DespachoProfesional.CostesDirectos;
|
||||
estadistica.costeIndirecto = casa.DespachoProfesional.TasaCostesIndirectos;
|
||||
estadistica.costeVariable = casa.CostesProduccion.CostesVariables;
|
||||
estadistica.costeHoraDespachoProf = casa.DespachoProfesional.CosteHoraDespachoProfesional;
|
||||
estadistica.totalSupeficie = casa.TrabajoProfesional.Usos.Sum(x=> x.superficie);
|
||||
estadistica.totalFases = casa.TrabajoProfesional.FasesTrabajo.Sum(x => x.Porcentaje);
|
||||
|
||||
estadistica.horasTPEDocumentacion = casa.TrabajoProfesional.HorasTPEDocumentacion;
|
||||
estadistica.horasTPEDireccionObra = casa.TrabajoProfesional.HorasTPEDireccion;
|
||||
estadistica.horasTPE = casa.TrabajoProfesional.TotalHorasTPE;
|
||||
estadistica.porcentajeExternalizacion = casa.CostesProduccion.CoeficienteCostesExternalizacion;
|
||||
estadistica.costeHoraExternalizacion = casa.CostesProduccion.CosteHoraExternalizacion;
|
||||
estadistica.plazoPresentacion = casa.CostesProduccion.PlazoPresentacionDocumentos;
|
||||
estadistica.costeProduccion = casa.CostesProduccion.CostesProduccionTrabProf;
|
||||
estadistica.totalOtrosTrabajos = casa.CostesProduccion.TotalOtrosTrabajos;
|
||||
estadistica.porcentajeBeneficio = casa.CostesProduccion.Beneficio;
|
||||
estadistica.numeroTrabajadores = casa.DespachoProfesional.Trabajadores.Sum(x => x.NumTrabajadores);
|
||||
estadistica.precioTrabajo = casa.CostesProduccion.PrecioTrabProf;
|
||||
estadistica.totalOtrosTrabajos = casa.CostesProduccion.TotalOtrosTrabajos;
|
||||
estadistica.precioEncargo = casa.CostesProduccion.PrecioDelEncargo;
|
||||
|
||||
|
||||
|
||||
// Rellenar listado usos
|
||||
if (casa.TrabajoProfesional.Usos.Count != 0)
|
||||
{
|
||||
|
||||
var listadoBorrar = bd.estadisticasusos.Where(x=> x.idSimulacion == idSimulador).ToList();
|
||||
bd.estadisticasusos.RemoveRange(listadoBorrar);
|
||||
|
||||
foreach (var uso in casa.TrabajoProfesional.Usos)
|
||||
{
|
||||
|
||||
bd.estadisticasusos.Add(new estadisticasusos
|
||||
{
|
||||
idSimulacion = idSimulador,
|
||||
superficie = uso.superficie,
|
||||
idUso = uso.idGrupoTipologia,
|
||||
idTipologia = uso.idTipologia,
|
||||
idIntervencion = uso.idTipoIntervencion
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Rellenar listado factores complejidad
|
||||
if (casa.TrabajoProfesional.FactoresComplejidad.Count != 0)
|
||||
{
|
||||
var listadoBorrar = bd.estadisticasfactores.Where(x => x.idsimulacion == idSimulador).ToList();
|
||||
bd.estadisticasfactores.RemoveRange(listadoBorrar);
|
||||
|
||||
foreach (var factor in casa.TrabajoProfesional.FactoresComplejidad)
|
||||
{
|
||||
|
||||
bd.estadisticasfactores.Add(new estadisticasfactores
|
||||
{
|
||||
idsimulacion = idSimulador,
|
||||
nombre = factor.Nombre,
|
||||
coeficiente = factor.coeficiente,
|
||||
tipo = "Complejidad"
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// Rellenar listado factores rendimiento
|
||||
if (casa.TrabajoProfesional.FactoresRendimiento.Count != 0)
|
||||
{
|
||||
var listadoBorrar = bd.estadisticasfactores.Where(x => x.idsimulacion == idSimulador).ToList();
|
||||
bd.estadisticasfactores.RemoveRange(listadoBorrar);
|
||||
|
||||
foreach (var factor in casa.TrabajoProfesional.FactoresRendimiento)
|
||||
{
|
||||
|
||||
bd.estadisticasfactores.Add(new estadisticasfactores
|
||||
{
|
||||
idsimulacion = idSimulador,
|
||||
nombre = factor.Nombre,
|
||||
coeficiente = factor.coeficiente,
|
||||
tipo = "Rendimiento"
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void mapearEstadisticasLicitacionCASA(estadisticas estadistica, LICITACIONES licitacion, int idSimulador)
|
||||
private static void mapearEstadisticasLicitacionCASA(tsHerramientasCACOA bd, estadisticas estadistica, LICITACIONES licitacion, int idSimulador)
|
||||
{
|
||||
estadistica.idSimulacion = idSimulador;
|
||||
estadistica.costeHoraDespachoProf = licitacion.costeHoraProduccion;
|
||||
estadistica.totalSupeficie = licitacion.Usos.Sum(x => x.superficie);
|
||||
estadistica.totalFases = licitacion.FasesTrabajo.Sum(x=> x.Porcentaje);
|
||||
|
||||
estadistica.horasTPE = licitacion.horasProduccion;
|
||||
estadistica.plazoPresentacion = licitacion.PlazoPresentacionDocumentos;
|
||||
estadistica.costeProduccion = licitacion.CostesProduccionTrabProf;
|
||||
estadistica.precioTrabajo = licitacion.PrecioTrabProf;
|
||||
estadistica.totalOtrosTrabajos = licitacion.TotalOtrosTrabajos;
|
||||
estadistica.precioEncargo = licitacion.PrecioDelEncargo;
|
||||
|
||||
// Rellenar listado usos
|
||||
if (licitacion.Usos.Count != 0)
|
||||
{
|
||||
|
||||
var listadoBorrar = bd.estadisticasusos.Where(x => x.idSimulacion == idSimulador).ToList();
|
||||
bd.estadisticasusos.RemoveRange(listadoBorrar);
|
||||
|
||||
foreach (var uso in licitacion.Usos)
|
||||
{
|
||||
|
||||
bd.estadisticasusos.Add(new estadisticasusos
|
||||
{
|
||||
idSimulacion = idSimulador,
|
||||
superficie = uso.superficie,
|
||||
idUso = uso.idGrupoTipologia,
|
||||
idTipologia = uso.idTipologia,
|
||||
idIntervencion = uso.idTipoIntervencion
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private static void mapearEstadisticasURBAN(estadisticas estadistica, URBAN urban, int idSimulador)
|
||||
{
|
||||
estadistica.idSimulacion = idSimulador;
|
||||
estadistica.numeroTrabajadores = urban.DespachoProfesional.Trabajadores.Sum(x => x.NumTrabajadores);
|
||||
estadistica.totalCosteAnual = urban.DespachoProfesional.CostesDirectosAnuales;
|
||||
estadistica.costeDirecto = urban.DespachoProfesional.CostesDirectos;
|
||||
estadistica.costeIndirecto = urban.DespachoProfesional.TasaCostesIndirectos;
|
||||
estadistica.costeVariable = urban.CostesProduccion.CostesVariables;
|
||||
estadistica.costeHoraDespachoProf = urban.DespachoProfesional.CosteHoraDespachoProfesional;
|
||||
|
||||
//obtener tipodocumento
|
||||
estadistica.tipoDocumento = urban.Enumerados.TiposDeDocumentos.First(x=> x.idEnumeracion == urban.TrabajoProfesional.idTipoDocumentacion).ValorAlfabetico1;
|
||||
|
||||
//obtener documento
|
||||
var listadoDocumentos = urban.Enumerados.ProyectosPorTipo(urban.TrabajoProfesional.idTipoDocumentacion);
|
||||
estadistica.documento = listadoDocumentos.First(x=> x.idtipoproyectos == urban.TrabajoProfesional.idTipoProyecto).Descripcion;
|
||||
|
||||
//obtener datos necesarios
|
||||
var listadoDocumentacionNecesaria = urban.TrabajoProfesional.DatosNecesarios;
|
||||
estadistica.dato1 = listadoDocumentacionNecesaria[0].ValorNecesario.ToString();
|
||||
estadistica.dato2 = listadoDocumentacionNecesaria[1].ValorNecesario.ToString();
|
||||
|
||||
var valorDato3 = listadoDocumentacionNecesaria[2].esCheckbox ? listadoDocumentacionNecesaria[2].esCheckbox.ToString() : listadoDocumentacionNecesaria[2].ValorNecesario.ToString();
|
||||
|
||||
if (valorDato3.ToLower().Contains("false"))
|
||||
{
|
||||
estadistica.dato3 = "FALSO";
|
||||
}else if (valorDato3.ToLower().Contains("true"))
|
||||
{
|
||||
estadistica.dato3 = "VERDADERO";
|
||||
}
|
||||
else
|
||||
{
|
||||
estadistica.dato3 = valorDato3.ToString();
|
||||
}
|
||||
|
||||
estadistica.totalFases = urban.TrabajoProfesional.FasesTrabajoProfesional.Sum(x => x.Porcentaje);
|
||||
estadistica.innovacion = urban.TrabajoProfesional.valorInstrumentos;
|
||||
estadistica.horasTPE = urban.TrabajoProfesional.horasTrabProfesional;
|
||||
estadistica.porcentajeExternalizacion = urban.CostesProduccion.CoeficienteCostesExternalizacion;
|
||||
estadistica.costeHoraExternalizacion = urban.CostesProduccion.CosteHoraExternalizacion;
|
||||
estadistica.plazoPresentacion = urban.CostesProduccion.PlazoPresentacionDocumentos;
|
||||
estadistica.costeProduccion = urban.CostesProduccion.CostesProduccionTrabProf;
|
||||
estadistica.porcentajeBeneficio = urban.CostesProduccion.Beneficio;
|
||||
estadistica.numeroTrabajadores = urban.DespachoProfesional.Trabajadores.Sum(x => x.NumTrabajadores);
|
||||
estadistica.precioTrabajo = urban.CostesProduccion.PrecioTrabajoProfesional;
|
||||
|
||||
|
||||
}
|
||||
|
||||
private static void mapearEstadisticasLicitacionURBAN(estadisticas estadistica, bdHerramientaCACOA.LicitacionesURBAN licitacionUrban, int idSimulador)
|
||||
{
|
||||
estadistica.idSimulacion = idSimulador;
|
||||
estadistica.costeHoraDespachoProf = licitacionUrban.CosteHP;
|
||||
|
||||
//obtener tipodocumento
|
||||
estadistica.tipoDocumento = licitacionUrban.Enumerados.TiposDeDocumentos.First(x => x.idEnumeracion == licitacionUrban.TrabajoProfesional.idTipoDocumentacion).ValorAlfabetico1;
|
||||
|
||||
//obtener documento
|
||||
var listadoDocumentos = licitacionUrban.Enumerados.ProyectosPorTipo(licitacionUrban.TrabajoProfesional.idTipoDocumentacion);
|
||||
estadistica.documento = listadoDocumentos.First(x => x.idtipoproyectos == licitacionUrban.TrabajoProfesional.idTipoProyecto).Descripcion;
|
||||
|
||||
//obtener datos necesarios
|
||||
var listadoDocumentacionNecesaria = licitacionUrban.TrabajoProfesional.DatosNecesarios;
|
||||
estadistica.dato1 = listadoDocumentacionNecesaria[0].ValorNecesario.ToString();
|
||||
estadistica.dato2 = listadoDocumentacionNecesaria[1].ValorNecesario.ToString();
|
||||
|
||||
var valorDato3 = listadoDocumentacionNecesaria[2].esCheckbox ? listadoDocumentacionNecesaria[2].esCheckbox.ToString() : listadoDocumentacionNecesaria[2].ValorNecesario.ToString();
|
||||
|
||||
if (valorDato3.ToLower().Contains("false"))
|
||||
{
|
||||
estadistica.dato3 = "FALSO";
|
||||
}
|
||||
else if (valorDato3.ToLower().Contains("true"))
|
||||
{
|
||||
estadistica.dato3 = "VERDADERO";
|
||||
}
|
||||
else
|
||||
{
|
||||
estadistica.dato3 = valorDato3.ToString();
|
||||
}
|
||||
|
||||
estadistica.totalFases = licitacionUrban.TrabajoProfesional.FasesTrabajoProfesional.Sum(x => x.Porcentaje);
|
||||
estadistica.innovacion = licitacionUrban.TrabajoProfesional.valorInstrumentos;
|
||||
estadistica.horasTPE = licitacionUrban.TrabajoProfesional.horasTrabProfesional;
|
||||
estadistica.plazoPresentacion = licitacionUrban.PlazoPresentacionDocumentos;
|
||||
estadistica.costeProduccion = licitacionUrban.CostesProduccionTrabProf;
|
||||
estadistica.numeroTrabajadores = licitacionUrban.ListaSolvenciaTecnica.Sum(x => x.Cantidad);
|
||||
estadistica.precioTrabajo = licitacionUrban.PrecioDelTrabajo;
|
||||
}
|
||||
|
||||
|
||||
public static double? comprobarNull(double? dato, int cantidadProyecto)
|
||||
{
|
||||
double? datoFinal = null;
|
||||
|
||||
if (dato != null)
|
||||
{
|
||||
datoFinal = dato / cantidadProyecto;
|
||||
}
|
||||
|
||||
return datoFinal;
|
||||
}
|
||||
|
||||
|
||||
public static bool comprobarFechas(DateTime fechaInicio, DateTime fechaFinal)
|
||||
{
|
||||
bool fechaValida = false;
|
||||
|
||||
if (fechaFinal.Date >= fechaInicio.Date)
|
||||
{
|
||||
fechaValida = true;
|
||||
}
|
||||
|
||||
return fechaValida;
|
||||
}
|
||||
|
||||
|
||||
public static bool comprobarFechasNulas(DateTime? fechaInicio, DateTime? fechaFinal)
|
||||
{
|
||||
bool fechaValida = false;
|
||||
|
||||
if (fechaFinal != null && fechaInicio != null)
|
||||
{
|
||||
fechaValida = true;
|
||||
}
|
||||
|
||||
return fechaValida;
|
||||
}
|
||||
|
||||
|
||||
public static List<EstadistiaHerraCasaVM> rellenarListadoCASA(List<bdHerramientaCACOA.db.estadisticas> listadoEstadistica)
|
||||
{
|
||||
List<EstadistiaHerraCasaVM> listadoEstadisticasExcel = new List<EstadistiaHerraCasaVM> ();
|
||||
|
||||
foreach (estadisticas estadistica in listadoEstadistica)
|
||||
{
|
||||
listadoEstadisticasExcel.Add(new EstadistiaHerraCasaVM
|
||||
{
|
||||
idSimulacion = estadistica.idSimulacionNavigation?.Descripcion,
|
||||
numeroTrabajadores = estadistica.numeroTrabajadores,
|
||||
costeAnualTotal = estadistica.totalCosteAnual,
|
||||
horasProduccion = estadistica.horasProduccion,
|
||||
costesDirectos = estadistica.costeDirecto,
|
||||
costesIndirectos = estadistica.costeIndirecto,
|
||||
costesVariables = estadistica.costeVariable,
|
||||
costeDespacho = estadistica.costeHoraDespachoProf,
|
||||
totalSuperficie = estadistica.totalSupeficie,
|
||||
porcentajeFases = estadistica.totalFases,
|
||||
horasDocumentacion = estadistica.horasTPEDocumentacion,
|
||||
horasDireccionObra = estadistica.horasTPEDireccionObra,
|
||||
horasTrabajo = estadistica.horasTPE,
|
||||
porcentajeExternalizacion = estadistica.porcentajeExternalizacion,
|
||||
costeExternalizacion = estadistica.costeHoraExternalizacion,
|
||||
plazoPresentacion = estadistica.plazoPresentacion,
|
||||
costeProduccion = estadistica.costeProduccion,
|
||||
beneficio = estadistica.porcentajeBeneficio,
|
||||
precioTrabajo = estadistica.precioTrabajo,
|
||||
totalOtrosTrabajos = estadistica.totalOtrosTrabajos,
|
||||
precioEncargo = estadistica.precioEncargo
|
||||
});
|
||||
}
|
||||
|
||||
return listadoEstadisticasExcel;
|
||||
}
|
||||
|
||||
public static List<EstadisticaUsosVM> rellenarListadoUsos(tsHerramientasCACOA bd, List<bdHerramientaCACOA.db.estadisticasusos> listadoEstadisticaUsos)
|
||||
{
|
||||
List<EstadisticaUsosVM> listadoEstadisticasUsosExcel = new List<EstadisticaUsosVM>();
|
||||
|
||||
foreach (estadisticasusos estadistica in listadoEstadisticaUsos)
|
||||
{
|
||||
listadoEstadisticasUsosExcel.Add(new EstadisticaUsosVM
|
||||
{
|
||||
idSimulacion = estadistica.idSimulacionNavigation?.Descripcion,
|
||||
superficie = estadistica.superficie,
|
||||
uso = bd.enumeraciones.First(x=> x.idEnumeracion == estadistica.idUso).ValorAlfabetico1,
|
||||
tipologia = bd.tipologias.First(x=> x.idtipologia == estadistica.idTipologia).Descripcion,
|
||||
intervencion = bd.enumeraciones.First(x=> x.idEnumeracion == estadistica.idIntervencion).ValorAlfabetico1,
|
||||
});
|
||||
}
|
||||
|
||||
return listadoEstadisticasUsosExcel;
|
||||
}
|
||||
public static List<EstadisticasFactoresVM> rellenarListadoFactores(tsHerramientasCACOA bd, List<bdHerramientaCACOA.db.estadisticasfactores> listadoEstadisticaFactores)
|
||||
{
|
||||
List<EstadisticasFactoresVM> listadoEstadisticaFactoresExcel = new List<EstadisticasFactoresVM>();
|
||||
|
||||
foreach (estadisticasfactores estadistica in listadoEstadisticaFactores)
|
||||
{
|
||||
listadoEstadisticaFactoresExcel.Add(new EstadisticasFactoresVM
|
||||
{
|
||||
idSimulacion = estadistica.idsimulacionNavigation?.Descripcion,
|
||||
nombre = estadistica.nombre,
|
||||
coeficiente =estadistica.coeficiente,
|
||||
tipo = estadistica.tipo
|
||||
});
|
||||
}
|
||||
|
||||
return listadoEstadisticaFactoresExcel;
|
||||
}
|
||||
|
||||
public static List<EstadisticasUrbanVM> rellenarListadoURBAN(tsHerramientasCACOA bd, List<bdHerramientaCACOA.db.estadisticas> listadoEstadisticaUrban)
|
||||
{
|
||||
List<EstadisticasUrbanVM> listadoEstadisticasUrbanExcel = new List<EstadisticasUrbanVM>();
|
||||
|
||||
foreach (estadisticas estadistica in listadoEstadisticaUrban)
|
||||
{
|
||||
listadoEstadisticasUrbanExcel.Add(new EstadisticasUrbanVM
|
||||
{
|
||||
idSimulacion = estadistica.idSimulacionNavigation?.Descripcion,
|
||||
numeroTrabajadores = estadistica.numeroTrabajadores,
|
||||
costeAnualTotal = estadistica.totalCosteAnual,
|
||||
horasProduccion = estadistica.horasProduccion,
|
||||
costesDirectos = estadistica.costeDirecto,
|
||||
costesIndirectos = estadistica.costeIndirecto,
|
||||
costesVariables = estadistica.costeVariable,
|
||||
costeDespacho = estadistica.costeHoraDespachoProf,
|
||||
tipoDocumento = estadistica.tipoDocumento,
|
||||
documento = estadistica.documento,
|
||||
dato1 = estadistica.dato1,
|
||||
dato2 = estadistica.dato2,
|
||||
dato3 = estadistica.dato3,
|
||||
porcentajeFases = estadistica.totalFases,
|
||||
innovacion = estadistica.innovacion,
|
||||
horasTrabajo = estadistica.horasTPE,
|
||||
porcentajeExternalizacion = estadistica.porcentajeExternalizacion,
|
||||
costeExternalizacion = estadistica.costeHoraExternalizacion,
|
||||
plazoPresentacion = estadistica.plazoPresentacion,
|
||||
costeProduccion = estadistica.costeProduccion,
|
||||
beneficio = estadistica.porcentajeBeneficio,
|
||||
precioTrabajo = estadistica.precioTrabajo,
|
||||
});
|
||||
}
|
||||
|
||||
return listadoEstadisticasUrbanExcel;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
28
HerramientaCASA/ViewModel/EstadistiaHerraCasaVM.cs
Normal file
28
HerramientaCASA/ViewModel/EstadistiaHerraCasaVM.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
namespace HerramientaCASA.ViewModel
|
||||
{
|
||||
public class EstadistiaHerraCasaVM
|
||||
{
|
||||
|
||||
public string? idSimulacion { get; set; }
|
||||
public double? numeroTrabajadores { get; set; }
|
||||
public double? costeAnualTotal { get; set; }
|
||||
public double? horasProduccion { get; set; }
|
||||
public double? costesDirectos { get; set; }
|
||||
public double? costesIndirectos { get; set; }
|
||||
public double? costesVariables { get; set; }
|
||||
public double? costeDespacho { get; set; }
|
||||
public double? totalSuperficie { get; set; }
|
||||
public double? porcentajeFases { get; set; }
|
||||
public double? horasDocumentacion { get; set; }
|
||||
public double? horasDireccionObra { get; set; }
|
||||
public double? horasTrabajo { get; set; }
|
||||
public double? porcentajeExternalizacion { get; set; }
|
||||
public double? costeExternalizacion { get; set; }
|
||||
public double? plazoPresentacion { get; set; }
|
||||
public double? costeProduccion { get; set; }
|
||||
public double? beneficio { get; set; }
|
||||
public double? precioTrabajo { get; set; }
|
||||
public double? totalOtrosTrabajos { get; set; }
|
||||
public double? precioEncargo { get; set; }
|
||||
}
|
||||
}
|
||||
11
HerramientaCASA/ViewModel/EstadisticaUsosVM.cs
Normal file
11
HerramientaCASA/ViewModel/EstadisticaUsosVM.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
namespace HerramientaCASA.ViewModel
|
||||
{
|
||||
public class EstadisticaUsosVM
|
||||
{
|
||||
public string? idSimulacion { get; set; }
|
||||
public double? superficie { get;set; }
|
||||
public string? uso { get; set; }
|
||||
public string? tipologia { get; set; }
|
||||
public string? intervencion { get; set; }
|
||||
}
|
||||
}
|
||||
10
HerramientaCASA/ViewModel/EstadisticasFactoresVM.cs
Normal file
10
HerramientaCASA/ViewModel/EstadisticasFactoresVM.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
namespace HerramientaCASA.ViewModel
|
||||
{
|
||||
public class EstadisticasFactoresVM
|
||||
{
|
||||
public string? idSimulacion { get; set; }
|
||||
public string? nombre { get; set; }
|
||||
public double? coeficiente { get; set; }
|
||||
public string? tipo { get; set; }
|
||||
}
|
||||
}
|
||||
29
HerramientaCASA/ViewModel/EstadisticasUrbanVM.cs
Normal file
29
HerramientaCASA/ViewModel/EstadisticasUrbanVM.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
namespace HerramientaCASA.ViewModel
|
||||
{
|
||||
public class EstadisticasUrbanVM
|
||||
{
|
||||
public string? idSimulacion { get; set; }
|
||||
public double? numeroTrabajadores { get; set; }
|
||||
public double? costeAnualTotal { get; set; }
|
||||
public double? horasProduccion { get; set; }
|
||||
public double? costesDirectos { get; set; }
|
||||
public double? costesIndirectos { get; set; }
|
||||
public double? costesVariables { get; set; }
|
||||
public double? costeDespacho { get; set; }
|
||||
|
||||
public string? tipoDocumento { get; set; }
|
||||
public string? documento { get; set; }
|
||||
public string? dato1 { get; set; }
|
||||
public string? dato2 { get; set; }
|
||||
public string? dato3 { get; set; }
|
||||
public double? porcentajeFases { get; set; }
|
||||
public double? innovacion { get; set; }
|
||||
public double? horasTrabajo { get; set; }
|
||||
public double? porcentajeExternalizacion { get; set; }
|
||||
public double? costeExternalizacion { get; set; }
|
||||
public double? plazoPresentacion { get; set; }
|
||||
public double? costeProduccion { get; set; }
|
||||
public double? beneficio { get; set; }
|
||||
public double? precioTrabajo { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -17,3 +17,11 @@ window.obtenerPDFImprimir = function (paginaImprimir) {
|
||||
let html = DespachoImprimir.outerHTML;
|
||||
return html;
|
||||
};
|
||||
|
||||
|
||||
window.descargarExcel = function (fileName, base64Data) {
|
||||
const link = document.createElement('a');
|
||||
link.href = 'data:application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;base64,' + base64Data;
|
||||
link.download = fileName;
|
||||
link.click();
|
||||
};
|
||||
|
||||
@@ -37,5 +37,29 @@ public partial class estadisticas
|
||||
|
||||
public double? numeroTrabajadores { get; set; }
|
||||
|
||||
public double? totalCosteAnual { get; set; }
|
||||
|
||||
public double? horasProduccion { get; set; }
|
||||
|
||||
public double? totalSupeficie { get; set; }
|
||||
|
||||
public double? costeHoraExternalizacion { get; set; }
|
||||
|
||||
public double? precioEncargo { get; set; }
|
||||
|
||||
public double? precioTrabajo { get; set; }
|
||||
|
||||
public string? tipoDocumento { get; set; }
|
||||
|
||||
public string? documento { get; set; }
|
||||
|
||||
public string? dato1 { get; set; }
|
||||
|
||||
public string? dato2 { get; set; }
|
||||
|
||||
public string? dato3 { get; set; }
|
||||
|
||||
public double? innovacion { get; set; }
|
||||
|
||||
public virtual simulaciones? idSimulacionNavigation { get; set; }
|
||||
}
|
||||
|
||||
19
bdHerramientaCACOA/db/estadisticasfactores.cs
Normal file
19
bdHerramientaCACOA/db/estadisticasfactores.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace bdHerramientaCACOA.db;
|
||||
|
||||
public partial class estadisticasfactores
|
||||
{
|
||||
public int idestadisticasFactores { get; set; }
|
||||
|
||||
public int? idsimulacion { get; set; }
|
||||
|
||||
public string? nombre { get; set; }
|
||||
|
||||
public double? coeficiente { get; set; }
|
||||
|
||||
public string? tipo { get; set; }
|
||||
|
||||
public virtual simulaciones? idsimulacionNavigation { get; set; }
|
||||
}
|
||||
21
bdHerramientaCACOA/db/estadisticasusos.cs
Normal file
21
bdHerramientaCACOA/db/estadisticasusos.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace bdHerramientaCACOA.db;
|
||||
|
||||
public partial class estadisticasusos
|
||||
{
|
||||
public int idestadisticaUsos { get; set; }
|
||||
|
||||
public int? idSimulacion { get; set; }
|
||||
|
||||
public double? superficie { get; set; }
|
||||
|
||||
public int? idUso { get; set; }
|
||||
|
||||
public int? idTipologia { get; set; }
|
||||
|
||||
public int? idIntervencion { get; set; }
|
||||
|
||||
public virtual simulaciones? idSimulacionNavigation { get; set; }
|
||||
}
|
||||
@@ -29,6 +29,10 @@ public partial class simulaciones
|
||||
|
||||
public virtual ICollection<estadisticas> estadisticas { get; set; } = new List<estadisticas>();
|
||||
|
||||
public virtual ICollection<estadisticasfactores> estadisticasfactores { get; set; } = new List<estadisticasfactores>();
|
||||
|
||||
public virtual ICollection<estadisticasusos> estadisticasusos { get; set; } = new List<estadisticasusos>();
|
||||
|
||||
public virtual usuarios idCodigoNavigation { get; set; } = null!;
|
||||
|
||||
public virtual ficheros idFicheroJSONNavigation { get; set; } = null!;
|
||||
|
||||
@@ -28,6 +28,10 @@ public partial class herramientascacoaContext : DbContext
|
||||
|
||||
public virtual DbSet<estadisticas> estadisticas { get; set; }
|
||||
|
||||
public virtual DbSet<estadisticasfactores> estadisticasfactores { get; set; }
|
||||
|
||||
public virtual DbSet<estadisticasusos> estadisticasusos { get; set; }
|
||||
|
||||
public virtual DbSet<factorescorreccion> factorescorreccion { get; set; }
|
||||
|
||||
public virtual DbSet<ficheros> ficheros { get; set; }
|
||||
@@ -165,13 +169,52 @@ public partial class herramientascacoaContext : DbContext
|
||||
entity.HasIndex(e => e.idSimulacion, "FK_estadisticas_simulaciones_idx");
|
||||
|
||||
entity.Property(e => e.idEstadistica).HasColumnType("int(11)");
|
||||
entity.Property(e => e.dato1).HasMaxLength(45);
|
||||
entity.Property(e => e.dato2).HasMaxLength(45);
|
||||
entity.Property(e => e.dato3).HasMaxLength(45);
|
||||
entity.Property(e => e.documento).HasMaxLength(50);
|
||||
entity.Property(e => e.idSimulacion).HasColumnType("int(11)");
|
||||
entity.Property(e => e.tipoDocumento).HasMaxLength(50);
|
||||
|
||||
entity.HasOne(d => d.idSimulacionNavigation).WithMany(p => p.estadisticas)
|
||||
.HasForeignKey(d => d.idSimulacion)
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.HasConstraintName("FK_estadisticas_simulaciones");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<estadisticasfactores>(entity =>
|
||||
{
|
||||
entity.HasKey(e => e.idestadisticasFactores).HasName("PRIMARY");
|
||||
|
||||
entity.HasIndex(e => e.idsimulacion, "FK_estadisticasfactores_simulaciones_idx");
|
||||
|
||||
entity.Property(e => e.idestadisticasFactores).HasColumnType("int(11)");
|
||||
entity.Property(e => e.idsimulacion).HasColumnType("int(11)");
|
||||
entity.Property(e => e.nombre).HasMaxLength(45);
|
||||
entity.Property(e => e.tipo).HasMaxLength(45);
|
||||
|
||||
entity.HasOne(d => d.idsimulacionNavigation).WithMany(p => p.estadisticasfactores)
|
||||
.HasForeignKey(d => d.idsimulacion)
|
||||
.HasConstraintName("FK_estadisticasfactores_simulaciones");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<estadisticasusos>(entity =>
|
||||
{
|
||||
entity.HasKey(e => e.idestadisticaUsos).HasName("PRIMARY");
|
||||
|
||||
entity.HasIndex(e => e.idSimulacion, "FK_estadisticasusos_simulaciones_idx");
|
||||
|
||||
entity.Property(e => e.idestadisticaUsos).HasColumnType("int(11)");
|
||||
entity.Property(e => e.idIntervencion).HasColumnType("int(11)");
|
||||
entity.Property(e => e.idSimulacion).HasColumnType("int(11)");
|
||||
entity.Property(e => e.idTipologia).HasColumnType("int(11)");
|
||||
entity.Property(e => e.idUso).HasColumnType("int(11)");
|
||||
|
||||
entity.HasOne(d => d.idSimulacionNavigation).WithMany(p => p.estadisticasusos)
|
||||
.HasForeignKey(d => d.idSimulacion)
|
||||
.HasConstraintName("FK_estadisticasusos_simulaciones");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<factorescorreccion>(entity =>
|
||||
{
|
||||
entity.HasKey(e => e.idFactorCorreccion).HasName("PRIMARY");
|
||||
|
||||
@@ -47,6 +47,14 @@
|
||||
"Name": "estadisticas",
|
||||
"ObjectType": 0
|
||||
},
|
||||
{
|
||||
"Name": "estadisticasfactores",
|
||||
"ObjectType": 0
|
||||
},
|
||||
{
|
||||
"Name": "estadisticasusos",
|
||||
"ObjectType": 0
|
||||
},
|
||||
{
|
||||
"Name": "factorescorreccion",
|
||||
"ObjectType": 0
|
||||
|
||||
Reference in New Issue
Block a user