namespace Apollinare.Domain.Entities.Warehouse;
///
/// Storico valorizzazione magazzino per periodo
///
public class StockValuation : BaseEntity
{
///
/// Data della valorizzazione
///
public DateTime ValuationDate { get; set; }
///
/// Periodo di riferimento (YYYYMM)
///
public int Period { get; set; }
///
/// Articolo
///
public int ArticleId { get; set; }
///
/// Magazzino (null = totale tutti i magazzini)
///
public int? WarehouseId { get; set; }
///
/// Quantità a fine periodo
///
public decimal Quantity { get; set; }
///
/// Metodo di valorizzazione usato
///
public ValuationMethod Method { get; set; }
///
/// Costo unitario calcolato
///
public decimal UnitCost { get; set; }
///
/// Valore totale = Quantity * UnitCost
///
public decimal TotalValue { get; set; }
///
/// Quantità in carico nel periodo
///
public decimal InboundQuantity { get; set; }
///
/// Valore carichi nel periodo
///
public decimal InboundValue { get; set; }
///
/// Quantità in scarico nel periodo
///
public decimal OutboundQuantity { get; set; }
///
/// Valore scarichi nel periodo
///
public decimal OutboundValue { get; set; }
///
/// Se è una chiusura definitiva (non più modificabile)
///
public bool IsClosed { get; set; }
///
/// Data chiusura
///
public DateTime? ClosedDate { get; set; }
///
/// Utente che ha chiuso
///
public string? ClosedBy { get; set; }
///
/// Note
///
public string? Notes { get; set; }
// Navigation properties
public WarehouseArticle? Article { get; set; }
public WarehouseLocation? Warehouse { get; set; }
}
///
/// Dettaglio valorizzazione FIFO/LIFO per layer
///
public class StockValuationLayer : BaseEntity
{
///
/// Articolo
///
public int ArticleId { get; set; }
///
/// Magazzino
///
public int WarehouseId { get; set; }
///
/// Partita (opzionale)
///
public int? BatchId { get; set; }
///
/// Data del layer (data carico originale)
///
public DateTime LayerDate { get; set; }
///
/// Movimento di carico che ha creato il layer
///
public int? SourceMovementId { get; set; }
///
/// Quantità originale del layer
///
public decimal OriginalQuantity { get; set; }
///
/// Quantità residua nel layer
///
public decimal RemainingQuantity { get; set; }
///
/// Costo unitario del layer
///
public decimal UnitCost { get; set; }
///
/// Valore residuo = RemainingQuantity * UnitCost
///
public decimal RemainingValue => RemainingQuantity * UnitCost;
///
/// Se il layer è esaurito
///
public bool IsExhausted { get; set; }
// Navigation properties
public WarehouseArticle? Article { get; set; }
public WarehouseLocation? Warehouse { get; set; }
public ArticleBatch? Batch { get; set; }
public StockMovement? SourceMovement { get; set; }
}