diff --git a/HerramientaCASA/Components/Pages/HerramientaCASAS.razor b/HerramientaCASA/Components/Pages/HerramientaCASAS.razor index 48632f7..42de33e 100644 --- a/HerramientaCASA/Components/Pages/HerramientaCASAS.razor +++ b/HerramientaCASA/Components/Pages/HerramientaCASAS.razor @@ -8,7 +8,7 @@ @using PuppeteerSharp @using Microsoft.AspNetCore.Components.Server.ProtectedBrowserStorage @inject ProtectedLocalStorage ProtectedLocalStore -@inject IJSRuntime JS +@inject IJSRuntime JSA @rendermode InteractiveServer @inject NavigationManager Navigation @@ -52,7 +52,7 @@ -@* *@ + @* *@ @@ -60,7 +60,7 @@
-
+
@@ -72,7 +72,7 @@ -
+
@@ -81,7 +81,7 @@
- +
@code { [Parameter] @@ -169,9 +169,9 @@ casa = System.Text.Json.JsonSerializer.Deserialize(CASAJson); - if ((simu.FechaModificacion != null && simu.FechaModificacion < fechaActVar) || (simu.FechaModificacion==null && simu.FechaCreacion x.Descripcion == casa.NombreSimulacion && x.idTipoSimulacion == idtipoSimulacion)) + if (bd.simulaciones.Any(x => x.Descripcion == casa.NombreSimulacion && x.idTipoSimulacion == idtipoSimulacion)) { mensajes.Add(new ToastMessage - { - Type = ToastType.Danger, - Message = $"Ya existe una simulación con el mismo nombre.", - }); + { + Type = ToastType.Danger, + Message = $"Ya existe una simulación con el mismo nombre.", + }); cerrarPopupGuardar(); } else @@ -215,10 +215,10 @@ if (listadoSimulacionesExistentes.Any(x => x.Descripcion == casa.NombreSimulacion)) { mensajes.Add(new ToastMessage - { - Type = ToastType.Danger, - Message = $"Ya existe una simulación con el mismo nombre.", - }); + { + Type = ToastType.Danger, + Message = $"Ya existe una simulación con el mismo nombre.", + }); cerrarPopupGuardar(); } else @@ -233,22 +233,22 @@ 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); mensajes.Add(new ToastMessage - { - Type = ToastType.Primary, - Message = $"Simulación creada correctamente.", - }); + { + Type = ToastType.Primary, + Message = $"Simulación creada correctamente.", + }); Navigation.NavigateTo(link, true); } private void actualizarSimulacion(string jsonObjeto) { - UtilidadesCASA.actualziarObjeto(bd, jsonObjeto, casa.NombreSimulacion, idSimulador); + UtilidadesCASA.actualziarObjeto(bd, jsonObjeto, casa.NombreSimulacion, idSimulador); cerrarPopupGuardar(); mensajes.Add(new ToastMessage - { - Type = ToastType.Primary, - Message = $"Simulación actualizada correctamente.", - }); + { + Type = ToastType.Primary, + Message = $"Simulación actualizada correctamente.", + }); } private void clonarCASA() @@ -287,7 +287,7 @@ var cssPath = Path.Combine(Environment.CurrentDirectory, "wwwroot", "Content", "Site.css"); var cssContent = await File.ReadAllTextAsync(cssPath); - var contenidoHtml = await JS.InvokeAsync("obtenerContenidoHtml"); + var contenidoHtml = await JSA.InvokeAsync("obtenerContenidoHtmlDespacho"); var fullHtml = $@" @@ -299,17 +299,15 @@ "; - var fileName = $"factura_{DateTime.Now:yyyyMMddHHmmss}.pdf"; - var filePath = Path.Combine("wwwroot", fileName); var browserFetcher = new BrowserFetcher(); await browserFetcher.DownloadAsync(); using var browser = await Puppeteer.LaunchAsync(new LaunchOptions - { - Headless = true, - Args = new[] { "--ignore-certificate-errors" } - }); + { + Headless = true, + Args = new[] { "--ignore-certificate-errors" } + }); using var page = await browser.NewPageAsync(); @@ -317,20 +315,18 @@ await page.SetContentAsync(fullHtml); - await page.PdfAsync(filePath, new PdfOptions + var pdfBytes = await page.PdfDataAsync(new PdfOptions + { + PrintBackground = true, + Format = PuppeteerSharp.Media.PaperFormat.A4, + MarginOptions = new PuppeteerSharp.Media.MarginOptions { - PrintBackground = true, - Format = PuppeteerSharp.Media.PaperFormat.A4, - MarginOptions = new PuppeteerSharp.Media.MarginOptions - { - Top = "20mm", - Bottom = "20mm" - } - }); + Top = "20mm", + Bottom = "20mm" + } + }); - pdfUrl = "/" + fileName; - - Navigation.NavigateTo(pdfUrl, true); + await JSA.InvokeVoidAsync("mostrarPdf", Convert.ToBase64String(pdfBytes)); } } @@ -338,16 +334,24 @@ \ No newline at end of file diff --git a/HerramientaCASA/Components/Pages/Imprimir/HerramientaCASAImprimir.razor b/HerramientaCASA/Components/Pages/Imprimir/HerramientaCASAImprimir.razor index 48676d9..8546789 100644 --- a/HerramientaCASA/Components/Pages/Imprimir/HerramientaCASAImprimir.razor +++ b/HerramientaCASA/Components/Pages/Imprimir/HerramientaCASAImprimir.razor @@ -64,8 +64,8 @@ Incremento por externalización - @objetoCASA.CostesProduccion.CoeficienteCostesExternalizacion - + @objetoCASA.CostesProduccion.CoeficienteCostesExternalizacion % + @@ -138,7 +138,7 @@ Plazo de presentación de la documentación: - @objetoCASA.CostesProduccion.PlazoPresentacionDocumentos + @objetoCASA.CostesProduccion.PlazoPresentacionDocumentos meses @@ -160,14 +160,14 @@ - - + + - + @@ -185,12 +185,16 @@ - - - - + + + + + + +
TrabajosHorasTrabajosHoras
Horas elaboración documentación@objetoCASA.TrabajoProfesional.HorasTPEDocumentacion.MilesYDecimales() h@objetoCASA.TrabajoProfesional.HorasTPEDocumentacion.MilesYDecimales() h
@objetoCASA.TrabajoProfesional.HorasTPEDireccion.MilesYDecimales() h
HORAS TRABAJO PROFESIONAL@objetoCASA.TrabajoProfesional.HorasTPE.MilesYDecimales() h
Horas trabajo profesional @objetoCASA.TrabajoProfesional.TotalHorasTPE.MilesYDecimales() h
+ @@ -201,42 +205,36 @@ -
+
Costes Asociados a los Servicios de Arquitectura
- +
+ + - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + +
COSTES DE PRODUCCIÓN DEL TRABAJO PROFESIONAL:
Concepto
COSTES DE PRODUCCIÓN DEL TRABAJO PROFESIONAL @objetoCASA.CostesProduccion.CostesProduccionTrabProf.MilesYDecimales() €
Beneficio (antes de impuestos) - @objetoCASA.CostesProduccion.Beneficio -
- Precio del trabajo profesional: @objetoCASA.CostesProduccion.PrecioTrabProf.MilesYDecimales() € -
+ @objetoCASA.CostesProduccion.CostesProduccionTrabProf.MilesYDecimales() € +
Beneficio (antes de impuestos) +
+ @objetoCASA.CostesProduccion.Beneficio % +
+
+ Precio del trabajo profesional: @objetoCASA.CostesProduccion.PrecioTrabProf.MilesYDecimales() € +
+
@if (objetoCASA.CostesProduccion.OtrosTrabajos.Count != 0) @@ -261,7 +259,7 @@ { @otroTrabajo.Denominacion - @otroTrabajo.Coste.MilesYDecimales() + @otroTrabajo.Coste.MilesYDecimales() € } @@ -279,7 +277,7 @@ - + Precio del encargo: @objetoCASA.CostesProduccion.PrecioDelEncargo.MilesYDecimales() € diff --git a/HerramientaCASA/Components/Pages/Licitaciones.razor b/HerramientaCASA/Components/Pages/Licitaciones.razor index 43cb591..0b59d0e 100644 --- a/HerramientaCASA/Components/Pages/Licitaciones.razor +++ b/HerramientaCASA/Components/Pages/Licitaciones.razor @@ -400,7 +400,7 @@ var cssPath = Path.Combine(Environment.CurrentDirectory, "wwwroot", "Content", "Site.css"); var cssContent = await File.ReadAllTextAsync(cssPath); - var contenidoHtml = await JS.InvokeAsync("obtenerContenidoHtml"); + var contenidoHtml = await JS.InvokeAsync("obtenerContenidoHtmlLicitaciones"); var fullHtml = $@" @@ -413,9 +413,6 @@ "; - var fileName = $"factura_{DateTime.Now:yyyyMMddHHmmss}.pdf"; - var filePath = Path.Combine("wwwroot", fileName); - var browserFetcher = new BrowserFetcher(); await browserFetcher.DownloadAsync(); @@ -431,20 +428,18 @@ await page.SetContentAsync(fullHtml); - await page.PdfAsync(filePath, new PdfOptions + var pdfBytes = await page.PdfDataAsync(new PdfOptions + { + PrintBackground = true, + Format = PuppeteerSharp.Media.PaperFormat.A4, + MarginOptions = new PuppeteerSharp.Media.MarginOptions { - PrintBackground = true, - Format = PuppeteerSharp.Media.PaperFormat.A4, - MarginOptions = new PuppeteerSharp.Media.MarginOptions - { - Top = "20mm", - Bottom = "20mm" - } - }); + Top = "20mm", + Bottom = "20mm" + } + }); - pdfUrl = "/" + fileName; - - Navigation.NavigateTo(pdfUrl, true); + await JS.InvokeVoidAsync("mostrarPdf", Convert.ToBase64String(pdfBytes)); } @@ -487,11 +482,18 @@ \ No newline at end of file diff --git a/HerramientaCASA/Components/Pages/LicitacionesURBAN.razor b/HerramientaCASA/Components/Pages/LicitacionesURBAN.razor index 83718c6..51b5b96 100644 --- a/HerramientaCASA/Components/Pages/LicitacionesURBAN.razor +++ b/HerramientaCASA/Components/Pages/LicitacionesURBAN.razor @@ -470,7 +470,7 @@ var cssPath = Path.Combine(Environment.CurrentDirectory, "wwwroot", "Content", "Site.css"); var cssContent = await File.ReadAllTextAsync(cssPath); - var contenidoHtml = await JS.InvokeAsync("obtenerContenidoHtml"); + var contenidoHtml = await JS.InvokeAsync("obtenerContenidoHtmlLiciUrban"); var fullHtml = $@" @@ -500,7 +500,7 @@ await page.SetContentAsync(fullHtml); - await page.PdfAsync(filePath, new PdfOptions + var pdfBytes = await page.PdfDataAsync(new PdfOptions { PrintBackground = true, Format = PuppeteerSharp.Media.PaperFormat.A4, @@ -511,9 +511,7 @@ } }); - pdfUrl = "/" + fileName; - - Navigation.NavigateTo(pdfUrl, true); + await JS.InvokeVoidAsync("mostrarPdf", Convert.ToBase64String(pdfBytes)); } } @@ -521,11 +519,18 @@ \ No newline at end of file diff --git a/HerramientaCASA/wwwroot/factura_20250729144732.pdf b/HerramientaCASA/wwwroot/factura_20250729144732.pdf deleted file mode 100644 index bd4952a..0000000 Binary files a/HerramientaCASA/wwwroot/factura_20250729144732.pdf and /dev/null differ diff --git a/HerramientaCASA/wwwroot/factura_20250730092236.pdf b/HerramientaCASA/wwwroot/factura_20250730092236.pdf deleted file mode 100644 index e2f317b..0000000 Binary files a/HerramientaCASA/wwwroot/factura_20250730092236.pdf and /dev/null differ