Compare commits

..

No commits in common. "bfff69fb47fef5826b7b13a95f77279425702f05" and "569005ec94b2d527ae29ab1fe1a7554d80b3c2db" have entirely different histories.

3 changed files with 2 additions and 36 deletions

View File

@ -269,19 +269,8 @@
}
}
private async Task ExportarExcel()
private void ExportarExcel()
{
Filters.Page = 1;
Filters.PageSize = int.MaxValue; // Exportar todos los resultados
try
{
await deliveryNoteService.ExportFilteredAsync(Filters);
toastService.ShowSuccess("Exportación completada.");
}
catch (Exception ex)
{
toastService.ShowError($"Error: {ex.Message}");
}
toastService.ShowInfo("La exportación a Excel se implementará en una próxima story.");
}
}

View File

@ -2,8 +2,6 @@ using Domain.Dtos.Sales;
using Domain.Generics;
using Microsoft.JSInterop;
using System.Net.Http.Json;
using System.Text;
using System.Text.Json;
namespace phronCare.UIBlazor.Services.Sales.DeliveryNotes
{
@ -123,25 +121,5 @@ namespace phronCare.UIBlazor.Services.Sales.DeliveryNotes
throw new Exception($"ExportPdfAsync: {ex.Message}", ex);
}
}
public async Task ExportFilteredAsync(DeliveryNoteSearchParams searchParams)
{
var content = new StringContent(JsonSerializer.Serialize(searchParams), Encoding.UTF8, "application/json");
var response = await _http.PostAsync("/api/deliverynote/exportfiltered", content);
if (!response.IsSuccessStatusCode)
{
var serverMessage = await response.Content.ReadAsStringAsync();
throw new Exception(string.IsNullOrWhiteSpace(serverMessage)
? "No se pudo exportar el Excel de remitos."
: serverMessage);
}
var bytes = await response.Content.ReadAsByteArrayAsync();
var base64 = Convert.ToBase64String(bytes);
var fileName = $"{DateTime.Now:yyyyMMddHHmm}_deliverynotes.xlsx";
await _js.InvokeVoidAsync("saveAsFile", fileName, base64);
}
}
}

View File

@ -11,6 +11,5 @@ namespace phronCare.UIBlazor.Services.Sales.DeliveryNotes
Task<IEnumerable<DeliveryNoteDto>> GetByQuoteIdAsync(int quoteId);
Task<DeliveryNoteCreateResponse> CreateAndIssueAsync(DeliveryNoteCreateRequest request);
Task ExportPdfAsync(int deliveryNoteId, string deliveryNoteNumber);
Task ExportFilteredAsync(DeliveryNoteSearchParams searchParams);
}
}