@using System @using System.Globalization @using System.Text.Json @using System.Collections.Generic @model Domain.Dtos.Stock.ExpeditionDto @{ Layout = null; var ci = CultureInfo.GetCultureInfo("es-AR"); CultureInfo.CurrentCulture = ci; CultureInfo.CurrentUICulture = ci; // Parseo seguro del snapshot (claves EXACTAS del JSON: Professional, Institution, Patient, SurgeryDate) SurgerySnapshot snap; if (string.IsNullOrWhiteSpace(Model.ExtrainfoJson)) { snap = new SurgerySnapshot(); } else { try { snap = JsonSerializer.Deserialize(Model.ExtrainfoJson) ?? new SurgerySnapshot(); } catch { snap = new SurgerySnapshot(); } } var reprintText = Model.Printcount > 0 ? (" — Reimpresión " + Model.Printcount) : ""; } @functions { // Mapear 1:1 con tu JSON de ExtrainfoJson MODELO ORTOPEDIA public class SurgerySnapshot { public string? Professional { get; set; } // "PECHERVSKY PABLO GUSTAVO" public string? Institution { get; set; } // "CORPORACION MEDICA LABORAL S.A." public string? Patient { get; set; } // "ALEXIS LASTRA" public DateTime? SurgeryDate { get; set; } // "2025-06-10T03:00:00" } public static string FQty(decimal q) => q.ToString("G29", CultureInfo.InvariantCulture); // DateTime? public static string FDate(DateTime? d) => d.HasValue ? d.Value.ToString("dd/MM/yyyy") : string.Empty; // DateOnly? (por si tus Items usan DateOnly? en Expiration) public static string FDate(DateOnly? d) => d.HasValue ? d.Value.ToString("dd/MM/yyyy") : string.Empty; } Nota de Entrega @Model.Expeditionnumber
Estado: @((string.IsNullOrWhiteSpace(Model.StatusLabel) ? "DESCONOCIDO" : Model.StatusLabel) + reprintText)
Origen: @(Model.LocationName ?? "-")
Institución: @snap.Institution Profesional: @snap.Professional
Paciente: @snap.Patient Fecha CX: @FDate(snap.SurgeryDate)
@if (Model.Items != null && Model.Items.Count > 0) { int repeat = 100; // ← poné 1 para desactivar el stress-test for (int r = 0; r < repeat; r++) { foreach (var it in Model.Items) { } } } else { }
# Código Descripción Lote Venc. Serie Cant.
@r @it.FactoryCode @it.ProductName @it.Batch @FDate(it.Expiration) @it.Serial @FQty(it.Quantity)
Sin ítems
Renglones: @Model.TotalItems
Unidades: @FQty(Model.TotalQuantity)
Observaciones: @(Model.Observations ?? string.Empty)