termninado dividir los excels
This commit is contained in:
@@ -32,7 +32,6 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<button @onclick="generarExcel" class="btnBlue col-1 " style="background-color: #65b7c3 !important;"> <i class="fas fa-print pe-2"></i>Generar Excel</button>
|
|
||||||
|
|
||||||
|
|
||||||
<div class="mt-2">
|
<div class="mt-2">
|
||||||
@@ -49,21 +48,25 @@
|
|||||||
|
|
||||||
<div class="container-fluid pt-3">
|
<div class="container-fluid pt-3">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<Tabs>
|
<Tabs>
|
||||||
<Tab Title="Estadisticas CASA - Edificación" Active>
|
<Tab Title="Estadisticas CASA - Edificación" Active>
|
||||||
<Content>
|
<Content>
|
||||||
<div class="CajaTab p-2">
|
<div class="CajaTab p-2">
|
||||||
<HerramientaCASA.Components.Pages.ConfiguracionPages.EstadisticasTabs.EstadisticaHerraCASATab ListadoHerraCASA="@listadoHerramientaEstadistica.Where(x=> x.idSimulacionNavigation.idTipoSimulacion == 31).ToList()"></HerramientaCASA.Components.Pages.ConfiguracionPages.EstadisticasTabs.EstadisticaHerraCASATab>
|
<CascadingValue Value="this">
|
||||||
|
<HerramientaCASA.Components.Pages.ConfiguracionPages.EstadisticasTabs.EstadisticaHerraCASATab ListadoHerraCASA="@listadoHerramientaEstadistica" ListadoFactoresCASA="listadoHerramientaEstadisticaFactores" ListadoUsosCASA="listadoHerramientaEstadisticaUsos"></HerramientaCASA.Components.Pages.ConfiguracionPages.EstadisticasTabs.EstadisticaHerraCASATab>
|
||||||
|
</CascadingValue>
|
||||||
</div>
|
</div>
|
||||||
</Content>
|
</Content>
|
||||||
|
|
||||||
</Tab>
|
</Tab>
|
||||||
|
|
||||||
<Tab Title="Estadisticas Licitaciones Edificación">
|
<Tab Title="Estadisticas Licitaciones Edificación">
|
||||||
<Content>
|
<Content>
|
||||||
<div class="CajaTab p-2">
|
<div class="CajaTab p-2">
|
||||||
<HerramientaCASA.Components.Pages.ConfiguracionPages.EstadisticasTabs.EstadisticaLiciCASATab ListadoLiciCASA="@listadoHerramientaEstadistica.Where(x => x.idSimulacionNavigation.idTipoSimulacion == 32).ToList()"></HerramientaCASA.Components.Pages.ConfiguracionPages.EstadisticasTabs.EstadisticaLiciCASATab>
|
<CascadingValue Value="this">
|
||||||
|
<HerramientaCASA.Components.Pages.ConfiguracionPages.EstadisticasTabs.EstadisticaLiciCASATab ListadoLiciCASA="@listadoLicitacionesEstadistica" ListadoUsosLicitacion="listadoLicitacionUsos"></HerramientaCASA.Components.Pages.ConfiguracionPages.EstadisticasTabs.EstadisticaLiciCASATab>
|
||||||
|
</CascadingValue>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</Content>
|
</Content>
|
||||||
</Tab>
|
</Tab>
|
||||||
@@ -71,7 +74,11 @@
|
|||||||
<Tab Title="Estadisticas CASA - Urbanismo">
|
<Tab Title="Estadisticas CASA - Urbanismo">
|
||||||
<Content>
|
<Content>
|
||||||
<div class="CajaTab p-2">
|
<div class="CajaTab p-2">
|
||||||
<HerramientaCASA.Components.Pages.ConfiguracionPages.EstadisticasTabs.EstadisticaHerraURBANTab ListadoHerraURBAN="@listadoHerramientaEstadisticaUrban.Where(x => x.idSimulacionNavigation.idTipoSimulacion == 34).ToList()"></HerramientaCASA.Components.Pages.ConfiguracionPages.EstadisticasTabs.EstadisticaHerraURBANTab>
|
<CascadingValue Value="this">
|
||||||
|
|
||||||
|
<HerramientaCASA.Components.Pages.ConfiguracionPages.EstadisticasTabs.EstadisticaHerraURBANTab ListadoHerraURBAN="@listadoHerramientaEstadisticaUrban"></HerramientaCASA.Components.Pages.ConfiguracionPages.EstadisticasTabs.EstadisticaHerraURBANTab>
|
||||||
|
</CascadingValue>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</Content>
|
</Content>
|
||||||
</Tab>
|
</Tab>
|
||||||
@@ -79,7 +86,11 @@
|
|||||||
<Tab Title="Estadisticas Licitación Urbanismo">
|
<Tab Title="Estadisticas Licitación Urbanismo">
|
||||||
<Content>
|
<Content>
|
||||||
<div class="CajaTab p-2">
|
<div class="CajaTab p-2">
|
||||||
<HerramientaCASA.Components.Pages.ConfiguracionPages.EstadisticasTabs.EstadisticaLiciURBANTab ListadoLiciURBAN="@listadoHerramientaEstadisticaUrban.Where(x => x.idSimulacionNavigation.idTipoSimulacion == 35).ToList()"></HerramientaCASA.Components.Pages.ConfiguracionPages.EstadisticasTabs.EstadisticaLiciURBANTab>
|
<CascadingValue Value="this">
|
||||||
|
|
||||||
|
<HerramientaCASA.Components.Pages.ConfiguracionPages.EstadisticasTabs.EstadisticaLiciURBANTab ListadoLiciURBAN="@listadoLicitacionesEstadisticaUrban"></HerramientaCASA.Components.Pages.ConfiguracionPages.EstadisticasTabs.EstadisticaLiciURBANTab>
|
||||||
|
</CascadingValue>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</Content>
|
</Content>
|
||||||
</Tab>
|
</Tab>
|
||||||
@@ -90,8 +101,13 @@
|
|||||||
@code {
|
@code {
|
||||||
|
|
||||||
public List<estadisticas> listadoHerramientaEstadistica { get; set; } = new List<estadisticas>();
|
public List<estadisticas> listadoHerramientaEstadistica { get; set; } = new List<estadisticas>();
|
||||||
|
public List<estadisticas> listadoLicitacionesEstadistica { get; set; } = new List<estadisticas>();
|
||||||
|
|
||||||
public List<estadisticas> listadoHerramientaEstadisticaUrban { get; set; } = new List<estadisticas>();
|
public List<estadisticas> listadoHerramientaEstadisticaUrban { get; set; } = new List<estadisticas>();
|
||||||
|
public List<estadisticas> listadoLicitacionesEstadisticaUrban { get; set; } = new List<estadisticas>();
|
||||||
|
|
||||||
public List<estadisticasusos> listadoHerramientaEstadisticaUsos { get; set; } = new List<estadisticasusos>();
|
public List<estadisticasusos> listadoHerramientaEstadisticaUsos { get; set; } = new List<estadisticasusos>();
|
||||||
|
public List<estadisticasusos> listadoLicitacionUsos { get; set; } = new List<estadisticasusos>();
|
||||||
public List<estadisticasfactores> listadoHerramientaEstadisticaFactores { get; set; } = new List<estadisticasfactores>();
|
public List<estadisticasfactores> listadoHerramientaEstadisticaFactores { get; set; } = new List<estadisticasfactores>();
|
||||||
|
|
||||||
public DateTime? fechaInicio { get; set; } = null;
|
public DateTime? fechaInicio { get; set; } = null;
|
||||||
@@ -101,9 +117,9 @@
|
|||||||
private int totalProyectosTipo = 0;
|
private int totalProyectosTipo = 0;
|
||||||
|
|
||||||
private string mensajeError = "";
|
private string mensajeError = "";
|
||||||
List<ToastMessage> mensajes = new List<ToastMessage>();
|
|
||||||
|
|
||||||
public tsHerramientasCACOA bd;
|
public tsHerramientasCACOA bd;
|
||||||
|
List<ToastMessage> mensajes = new List<ToastMessage>();
|
||||||
|
|
||||||
|
|
||||||
private async Task OnFechaInicioChanged(DateTime? value)
|
private async Task OnFechaInicioChanged(DateTime? value)
|
||||||
@@ -176,16 +192,8 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override async Task OnInitializedAsync()
|
|
||||||
{
|
|
||||||
bd = tsHerramientasCACOA.NuevoContexto(SoloLectura: false);
|
|
||||||
|
|
||||||
inicializarListado();
|
public async Task generarExcel(byte[] arrayListados)
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private async Task generarExcel()
|
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -217,25 +225,7 @@
|
|||||||
|
|
||||||
var ws = wb.Worksheets.Add("Total datos");
|
var ws = wb.Worksheets.Add("Total datos");
|
||||||
|
|
||||||
// Generar tabla HERRAMIENTA/LICITACION CASA
|
var bytes = arrayListados;
|
||||||
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));
|
await JS.InvokeVoidAsync("descargarExcel", nombreExcel, Convert.ToBase64String(bytes));
|
||||||
|
|
||||||
@@ -264,315 +254,17 @@
|
|||||||
throw new Exception("Ocurrió un error en la descarga del excel -> " + ex.Message);
|
throw new Exception("Ocurrió un error en la descarga del excel -> " + ex.Message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
protected override async Task OnInitializedAsync()
|
||||||
private IXLTable? generarTablaPrincipal(IXLWorksheet? ws)
|
|
||||||
{
|
{
|
||||||
var datos = UtilidadesCASA.rellenarListadoCASA(listadoHerramientaEstadistica);
|
bd = tsHerramientasCACOA.NuevoContexto(SoloLectura: false);
|
||||||
|
|
||||||
// INTRODUCIR DATOS PARA LA TABLA
|
inicializarListado();
|
||||||
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()
|
private void inicializarListado()
|
||||||
@@ -580,15 +272,20 @@
|
|||||||
|
|
||||||
if (fechaInicio == null)
|
if (fechaInicio == null)
|
||||||
{
|
{
|
||||||
listadoHerramientaEstadistica = bd.estadisticas.Include(x => x.idSimulacionNavigation).Where(x => x.idSimulacionNavigation.idTipoSimulacion == 31 || x.idSimulacionNavigation.idTipoSimulacion == 32).ToList();
|
listadoHerramientaEstadistica = bd.estadisticas.Include(x => x.idSimulacionNavigation).Where(x => x.idSimulacionNavigation.idTipoSimulacion == 31).ToList();
|
||||||
listadoHerramientaEstadisticaUrban = bd.estadisticas.Include(x => x.idSimulacionNavigation).Where(x => x.idSimulacionNavigation.idTipoSimulacion == 34 || x.idSimulacionNavigation.idTipoSimulacion == 35).ToList();
|
listadoLicitacionesEstadistica = bd.estadisticas.Include(x => x.idSimulacionNavigation).Where(x => x.idSimulacionNavigation.idTipoSimulacion == 32).ToList();
|
||||||
|
|
||||||
|
listadoHerramientaEstadisticaUrban = bd.estadisticas.Include(x => x.idSimulacionNavigation).Where(x => x.idSimulacionNavigation.idTipoSimulacion == 34).ToList();
|
||||||
|
listadoLicitacionesEstadisticaUrban = bd.estadisticas.Include(x => x.idSimulacionNavigation).Where(x => x.idSimulacionNavigation.idTipoSimulacion == 35).ToList();
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var listadoPorTipoCASA = bd.estadisticas.Include(x => x.idSimulacionNavigation).Where(x => x.idSimulacionNavigation.idTipoSimulacion == 31 || x.idSimulacionNavigation.idTipoSimulacion == 32).ToList();
|
var listadoHerraCASA = bd.estadisticas.Include(x => x.idSimulacionNavigation).Where(x => x.idSimulacionNavigation.idTipoSimulacion == 31).ToList();
|
||||||
|
var listadoLicitacionCASA = bd.estadisticas.Include(x => x.idSimulacionNavigation).Where(x => x.idSimulacionNavigation.idTipoSimulacion == 32).ToList();
|
||||||
|
|
||||||
listadoHerramientaEstadistica = listadoPorTipoCASA.Where(x => (x.idSimulacionNavigation.FechaCreacion >= fechaInicio) && (x.idSimulacionNavigation.FechaModificacion ?? x.idSimulacionNavigation.FechaCreacion).Date <= fechaFinal).ToList();
|
listadoHerramientaEstadistica = listadoHerraCASA.Where(x => (x.idSimulacionNavigation.FechaCreacion >= fechaInicio) && (x.idSimulacionNavigation.FechaModificacion ?? x.idSimulacionNavigation.FechaCreacion).Date <= fechaFinal).ToList();
|
||||||
|
listadoLicitacionesEstadistica = listadoHerraCASA.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();
|
var listadoPorTipoURBAN = bd.estadisticas.Include(x => x.idSimulacionNavigation).Where(x => x.idSimulacionNavigation.idTipoSimulacion == 34 || x.idSimulacionNavigation.idTipoSimulacion == 35).ToList();
|
||||||
|
|
||||||
@@ -597,8 +294,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
listadoHerramientaEstadisticaUsos = bd.estadisticasusos.AsEnumerable().Where(x => listadoHerramientaEstadistica.Any(y => y.idSimulacion == x.idSimulacion)).ToList();
|
listadoHerramientaEstadisticaUsos = bd.estadisticasusos.AsEnumerable().Where(x => listadoHerramientaEstadistica.Any(y => y.idSimulacion == x.idSimulacion)).ToList();
|
||||||
|
listadoLicitacionUsos = bd.estadisticasusos.AsEnumerable().Where(x => listadoLicitacionesEstadistica.Any(y => y.idSimulacion == x.idSimulacion)).ToList();
|
||||||
|
|
||||||
listadoHerramientaEstadisticaFactores = bd.estadisticasfactores.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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,11 +6,18 @@
|
|||||||
@using ClosedXML.Excel
|
@using ClosedXML.Excel
|
||||||
@using Microsoft.EntityFrameworkCore
|
@using Microsoft.EntityFrameworkCore
|
||||||
@using bdHerramientaCACOA.db
|
@using bdHerramientaCACOA.db
|
||||||
|
@inject IJSRuntime JS
|
||||||
|
|
||||||
|
@using ClosedXML.Excel
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
|
|
||||||
|
|
||||||
@if (totalProyectosTipo != 0)
|
@if (totalProyectosTipo != 0)
|
||||||
{
|
{
|
||||||
|
<div class="col-12 text-end">
|
||||||
|
<button @onclick="ExportarExcelCasa" class="btnBlue col-1 " style="background-color: #65b7c3 !important;"> <i class="fas fa-print pe-2"></i>Generar Excel</button>
|
||||||
|
</div>
|
||||||
<div class="mt-2" style="padding:50px;">
|
<div class="mt-2" style="padding:50px;">
|
||||||
<div class="mb-4">
|
<div class="mb-4">
|
||||||
<label class="fw-bold">Total simulaciones herramienta CASA: <span>@totalProyectosTipo</span> </label>
|
<label class="fw-bold">Total simulaciones herramienta CASA: <span>@totalProyectosTipo</span> </label>
|
||||||
@@ -132,12 +139,26 @@
|
|||||||
|
|
||||||
[Parameter]
|
[Parameter]
|
||||||
public List<estadisticas> ListadoHerraCASA { get; set; } = new List<estadisticas>();
|
public List<estadisticas> ListadoHerraCASA { get; set; } = new List<estadisticas>();
|
||||||
|
[Parameter]
|
||||||
|
public List<estadisticasfactores> ListadoFactoresCASA { get; set; } = new List<estadisticasfactores>();
|
||||||
|
[Parameter]
|
||||||
|
public List<estadisticasusos> ListadoUsosCASA { get; set; } = new List<estadisticasusos>();
|
||||||
|
|
||||||
private int totalProyectosTipo = 0;
|
private int totalProyectosTipo = 0;
|
||||||
|
|
||||||
public EstadistiaHerraCasaVM estadisticasTotales = new EstadistiaHerraCasaVM();
|
public EstadistiaHerraCasaVM estadisticasTotales = new EstadistiaHerraCasaVM();
|
||||||
|
|
||||||
|
[CascadingParameter]
|
||||||
|
public ConfiguracionPages.EstadisticasConf _Parent { get; set; }
|
||||||
|
|
||||||
|
public tsHerramientasCACOA bd;
|
||||||
|
|
||||||
|
|
||||||
|
protected override async Task OnInitializedAsync()
|
||||||
|
{
|
||||||
|
bd = tsHerramientasCACOA.NuevoContexto(SoloLectura: false);
|
||||||
|
}
|
||||||
|
|
||||||
protected override void OnParametersSet()
|
protected override void OnParametersSet()
|
||||||
{
|
{
|
||||||
inicializarListado();
|
inicializarListado();
|
||||||
@@ -175,4 +196,19 @@
|
|||||||
|
|
||||||
hacerCalculos(ListadoHerraCASA);
|
hacerCalculos(ListadoHerraCASA);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private async Task ExportarExcelCasa()
|
||||||
|
{
|
||||||
|
var bytes = UtilidadesCASA.GenerarExcelCasa(bd,ListadoHerraCASA, ListadoUsosCASA, ListadoFactoresCASA);
|
||||||
|
|
||||||
|
_Parent.generarExcel(bytes);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -10,6 +10,10 @@
|
|||||||
|
|
||||||
@if (totalProyectosTipo != 0)
|
@if (totalProyectosTipo != 0)
|
||||||
{
|
{
|
||||||
|
<div class="col-12 text-end">
|
||||||
|
<button @onclick="generarTablaUrban" class="btnBlue col-1 " style="background-color: #65b7c3 !important;"> <i class="fas fa-print pe-2"></i>Generar Excel</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="mt-2" style="padding:50px;">
|
<div class="mt-2" style="padding:50px;">
|
||||||
<div class="mb-4">
|
<div class="mb-4">
|
||||||
<label class="fw-bold">Total simulaciones herramienta URBAN: <span>@totalProyectosTipo</span> </label>
|
<label class="fw-bold">Total simulaciones herramienta URBAN: <span>@totalProyectosTipo</span> </label>
|
||||||
@@ -198,6 +202,18 @@
|
|||||||
public EstadisticasUrbanVM estadisticasTotales = new EstadisticasUrbanVM();
|
public EstadisticasUrbanVM estadisticasTotales = new EstadisticasUrbanVM();
|
||||||
private int totalProyectosTipo = 0;
|
private int totalProyectosTipo = 0;
|
||||||
|
|
||||||
|
|
||||||
|
[CascadingParameter]
|
||||||
|
public ConfiguracionPages.EstadisticasConf _Parent { get; set; }
|
||||||
|
|
||||||
|
public tsHerramientasCACOA bd;
|
||||||
|
|
||||||
|
|
||||||
|
protected override async Task OnInitializedAsync()
|
||||||
|
{
|
||||||
|
bd = tsHerramientasCACOA.NuevoContexto(SoloLectura: false);
|
||||||
|
}
|
||||||
|
|
||||||
private void hacerCalculos(List<bdHerramientaCACOA.db.estadisticas> listadoEstadistica)
|
private void hacerCalculos(List<bdHerramientaCACOA.db.estadisticas> listadoEstadistica)
|
||||||
{
|
{
|
||||||
estadisticasTotales.numeroTrabajadores = UtilidadesCASA.comprobarNull(listadoEstadistica.Sum(x => x.numeroTrabajadores), totalProyectosTipo);
|
estadisticasTotales.numeroTrabajadores = UtilidadesCASA.comprobarNull(listadoEstadistica.Sum(x => x.numeroTrabajadores), totalProyectosTipo);
|
||||||
@@ -230,4 +246,11 @@
|
|||||||
hacerCalculos(ListadoHerraURBAN);
|
hacerCalculos(ListadoHerraURBAN);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private async Task generarTablaUrban()
|
||||||
|
{
|
||||||
|
var bytes = UtilidadesCASA.GenerarExcelURBAN(bd, ListadoHerraURBAN, "Herramienta URBAN");
|
||||||
|
|
||||||
|
_Parent.generarExcel(bytes);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -7,9 +7,12 @@
|
|||||||
@using bdHerramientaCACOA.db
|
@using bdHerramientaCACOA.db
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
|
|
||||||
@if (totalProyectosTipo != 0)
|
@if (totalProyectosTipo != 0)
|
||||||
{
|
{
|
||||||
|
<div class="col-12 text-end">
|
||||||
|
<button @onclick="ExportarExcelCasa" class="btnBlue col-1 " style="background-color: #65b7c3 !important;"> <i class="fas fa-print pe-2"></i>Generar Excel</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="mt-2" style="padding:50px;">
|
<div class="mt-2" style="padding:50px;">
|
||||||
<div class="mb-4">
|
<div class="mb-4">
|
||||||
@@ -118,9 +121,23 @@
|
|||||||
[Parameter]
|
[Parameter]
|
||||||
public List<estadisticas> ListadoLiciCASA { get; set; } = new List<estadisticas>();
|
public List<estadisticas> ListadoLiciCASA { get; set; } = new List<estadisticas>();
|
||||||
|
|
||||||
|
[Parameter]
|
||||||
|
public List<estadisticasusos> ListadoUsosLicitacion { get; set; } = new List<estadisticasusos>();
|
||||||
|
|
||||||
public EstadistiaHerraCasaVM estadisticasTotales = new EstadistiaHerraCasaVM();
|
public EstadistiaHerraCasaVM estadisticasTotales = new EstadistiaHerraCasaVM();
|
||||||
private int totalProyectosTipo = 0;
|
private int totalProyectosTipo = 0;
|
||||||
|
|
||||||
|
[CascadingParameter]
|
||||||
|
public ConfiguracionPages.EstadisticasConf _Parent { get; set; }
|
||||||
|
|
||||||
|
public tsHerramientasCACOA bd;
|
||||||
|
|
||||||
|
|
||||||
|
protected override async Task OnInitializedAsync()
|
||||||
|
{
|
||||||
|
bd = tsHerramientasCACOA.NuevoContexto(SoloLectura: false);
|
||||||
|
}
|
||||||
|
|
||||||
private void hacerCalculos(List<bdHerramientaCACOA.db.estadisticas> listadoEstadistica)
|
private void hacerCalculos(List<bdHerramientaCACOA.db.estadisticas> listadoEstadistica)
|
||||||
{
|
{
|
||||||
estadisticasTotales.costeDespacho = UtilidadesCASA.comprobarNull(listadoEstadistica.Sum(x => x.costeHoraDespachoProf), totalProyectosTipo);
|
estadisticasTotales.costeDespacho = UtilidadesCASA.comprobarNull(listadoEstadistica.Sum(x => x.costeHoraDespachoProf), totalProyectosTipo);
|
||||||
@@ -143,4 +160,11 @@
|
|||||||
totalProyectosTipo = ListadoLiciCASA.Count();
|
totalProyectosTipo = ListadoLiciCASA.Count();
|
||||||
hacerCalculos(ListadoLiciCASA);
|
hacerCalculos(ListadoLiciCASA);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private async Task ExportarExcelCasa()
|
||||||
|
{
|
||||||
|
var bytes = UtilidadesCASA.GenerarExcelCasa(bd, ListadoLiciCASA, ListadoUsosLicitacion, null);
|
||||||
|
|
||||||
|
_Parent.generarExcel(bytes);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -10,6 +10,11 @@
|
|||||||
|
|
||||||
@if (totalProyectosTipo != 0)
|
@if (totalProyectosTipo != 0)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
<div class="col-12 text-end">
|
||||||
|
<button @onclick="generarTablaUrban" class="btnBlue col-1 " style="background-color: #65b7c3 !important;"> <i class="fas fa-print pe-2"></i>Generar Excel</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="mt-2" style="padding:50px;">
|
<div class="mt-2" style="padding:50px;">
|
||||||
<div class="mb-4">
|
<div class="mb-4">
|
||||||
<label class="fw-bold">Total simulaciones licitación URBAN: <span>@totalProyectosTipo</span> </label>
|
<label class="fw-bold">Total simulaciones licitación URBAN: <span>@totalProyectosTipo</span> </label>
|
||||||
@@ -152,6 +157,18 @@
|
|||||||
public EstadisticasUrbanVM estadisticasTotales = new EstadisticasUrbanVM();
|
public EstadisticasUrbanVM estadisticasTotales = new EstadisticasUrbanVM();
|
||||||
private int totalProyectosTipo = 0;
|
private int totalProyectosTipo = 0;
|
||||||
|
|
||||||
|
|
||||||
|
[CascadingParameter]
|
||||||
|
public ConfiguracionPages.EstadisticasConf _Parent { get; set; }
|
||||||
|
|
||||||
|
public tsHerramientasCACOA bd;
|
||||||
|
|
||||||
|
|
||||||
|
protected override async Task OnInitializedAsync()
|
||||||
|
{
|
||||||
|
bd = tsHerramientasCACOA.NuevoContexto(SoloLectura: false);
|
||||||
|
}
|
||||||
|
|
||||||
private void hacerCalculos(List<bdHerramientaCACOA.db.estadisticas> listadoEstadistica)
|
private void hacerCalculos(List<bdHerramientaCACOA.db.estadisticas> listadoEstadistica)
|
||||||
{
|
{
|
||||||
estadisticasTotales.costeDespacho = UtilidadesCASA.comprobarNull(listadoEstadistica.Sum(x => x.costeHoraDespachoProf), totalProyectosTipo);
|
estadisticasTotales.costeDespacho = UtilidadesCASA.comprobarNull(listadoEstadistica.Sum(x => x.costeHoraDespachoProf), totalProyectosTipo);
|
||||||
@@ -175,4 +192,11 @@
|
|||||||
hacerCalculos(ListadoLiciURBAN);
|
hacerCalculos(ListadoLiciURBAN);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private async Task generarTablaUrban()
|
||||||
|
{
|
||||||
|
var bytes = UtilidadesCASA.GenerarExcelURBAN(bd, ListadoLiciURBAN, "Licitación URBAN");
|
||||||
|
|
||||||
|
_Parent.generarExcel(bytes);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -3,6 +3,7 @@ using bdHerramientaCACOA.db;
|
|||||||
using bdHerramientaCACOA.dbcontext;
|
using bdHerramientaCACOA.dbcontext;
|
||||||
using bdHerramientaCACOA.HerramientaURBAN;
|
using bdHerramientaCACOA.HerramientaURBAN;
|
||||||
using BlazorBootstrap;
|
using BlazorBootstrap;
|
||||||
|
using ClosedXML.Excel;
|
||||||
using DocumentFormat.OpenXml.Office2013.Drawing.ChartStyle;
|
using DocumentFormat.OpenXml.Office2013.Drawing.ChartStyle;
|
||||||
using HerramientaCASA.Components.Pages;
|
using HerramientaCASA.Components.Pages;
|
||||||
using HerramientaCASA.Components.Pages.HerramientaCASATabs;
|
using HerramientaCASA.Components.Pages.HerramientaCASATabs;
|
||||||
@@ -1067,7 +1068,7 @@ namespace HerramientaCASA
|
|||||||
return listadoEstadisticaFactoresExcel;
|
return listadoEstadisticaFactoresExcel;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<EstadisticasUrbanVM> rellenarListadoURBAN(tsHerramientasCACOA bd, List<bdHerramientaCACOA.db.estadisticas> listadoEstadisticaUrban)
|
public static List<EstadisticasUrbanVM> rellenarListadoURBAN(List<bdHerramientaCACOA.db.estadisticas> listadoEstadisticaUrban)
|
||||||
{
|
{
|
||||||
List<EstadisticasUrbanVM> listadoEstadisticasUrbanExcel = new List<EstadisticasUrbanVM>();
|
List<EstadisticasUrbanVM> listadoEstadisticasUrbanExcel = new List<EstadisticasUrbanVM>();
|
||||||
|
|
||||||
@@ -1113,5 +1114,378 @@ namespace HerramientaCASA
|
|||||||
|
|
||||||
return semanas;
|
return semanas;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static byte[] GenerarExcelCasa(
|
||||||
|
tsHerramientasCACOA bd,
|
||||||
|
List<estadisticas> listadoHerramientaEstadistica,
|
||||||
|
List<estadisticasusos> listadoHerramientaEstadisticaUsos,
|
||||||
|
List<estadisticasfactores> listadoHerramientaEstadisticaFactores)
|
||||||
|
{
|
||||||
|
using var wb = new XLWorkbook();
|
||||||
|
IXLWorksheet ws ;
|
||||||
|
string tituloExcel = "Herramienta CASA";
|
||||||
|
|
||||||
|
if (listadoHerramientaEstadisticaFactores == null)
|
||||||
|
{
|
||||||
|
tituloExcel = "Licitación CASA";
|
||||||
|
ws = wb.Worksheets.Add("Licitación CASA");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ws = wb.Worksheets.Add("Herramienta CASA");
|
||||||
|
}
|
||||||
|
|
||||||
|
var tablaPrincipal = generarTablaPrincipal(ws, listadoHerramientaEstadistica, tituloExcel);
|
||||||
|
|
||||||
|
int filaSiguiente = tablaPrincipal.RangeAddress.LastAddress.RowNumber + 5;
|
||||||
|
|
||||||
|
int ultimaFilaUso = generarTablaUsos(bd,ws, filaSiguiente, listadoHerramientaEstadisticaUsos);
|
||||||
|
ultimaFilaUso += 5;
|
||||||
|
|
||||||
|
if (listadoHerramientaEstadisticaFactores != null)
|
||||||
|
{
|
||||||
|
generarTablaFactores(bd, ws, ultimaFilaUso, listadoHerramientaEstadisticaFactores);
|
||||||
|
}
|
||||||
|
|
||||||
|
using var ms = new MemoryStream();
|
||||||
|
wb.SaveAs(ms);
|
||||||
|
return ms.ToArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static IXLTable? generarTablaPrincipal(IXLWorksheet? ws, List<estadisticas> listadoHerramientaEstadistica, string tituloExcel)
|
||||||
|
{
|
||||||
|
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 = tituloExcel;
|
||||||
|
|
||||||
|
// 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 static int generarTablaUsos(tsHerramientasCACOA bd, IXLWorksheet ws, int filaValida, List<estadisticasusos> listadoHerramientaEstadisticaUsos)
|
||||||
|
{
|
||||||
|
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 static int generarTablaFactores(tsHerramientasCACOA bd, IXLWorksheet ws, int filaValida, List<estadisticasfactores> listadoHerramientaEstadisticaFactores)
|
||||||
|
{
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public static byte[] GenerarExcelURBAN(tsHerramientasCACOA bd, List<estadisticas> listadoUrbanEstadistica, string tipoHerramienta)
|
||||||
|
{
|
||||||
|
using var wb = new XLWorkbook();
|
||||||
|
IXLWorksheet ws;
|
||||||
|
string tituloExcel = tipoHerramienta;
|
||||||
|
ws = wb.Worksheets.Add(tipoHerramienta);
|
||||||
|
|
||||||
|
crearTablaURBAN( ws,listadoUrbanEstadistica, tipoHerramienta);
|
||||||
|
|
||||||
|
using var ms = new MemoryStream();
|
||||||
|
wb.SaveAs(ms);
|
||||||
|
return ms.ToArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private static IXLTable? crearTablaURBAN(IXLWorksheet? ws, List<estadisticas> listadoHerramientaEstadisticaUrban, string tituloExcel)
|
||||||
|
{
|
||||||
|
var datos = UtilidadesCASA.rellenarListadoURBAN(listadoHerramientaEstadisticaUrban);
|
||||||
|
|
||||||
|
// 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 = tituloExcel;
|
||||||
|
|
||||||
|
// 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 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;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user