using System.ComponentModel.DataAnnotations.Schema; using Microsoft.EntityFrameworkCore; namespace Distribution.Models { public class GoodsReceiptItem : Template { public Guid FK_GoodsReceiptId { get; set; } [ForeignKey("FK_GoodsReceiptId")] public GoodsReceipt GoodsReceipt { get; set; } /// Null for a direct receipt line (no purchase order); FK_ItemId is set instead. public Guid? FK_PurchaseOrderItemId { get; set; } [ForeignKey("FK_PurchaseOrderItemId")] public PurchaseOrderItem? PurchaseOrderItem { get; set; } /// Set for direct receipt lines. PO-based lines resolve the item through PurchaseOrderItem. public Guid? FK_ItemId { get; set; } [ForeignKey("FK_ItemId")] public Item? Item { get; set; } /// Added to warehouse stock. public int AcceptedQuantity { get; set; } /// Damaged/short at receipt, not added to stock. public int RejectedQuantity { get; set; } = 0; /// /// Units the supplier gave at no charge. Received into stock like accepted units, but never /// costed and never counted against the purchase order's ordered quantity. /// public int FreeQuantity { get; set; } = 0; /// Cost per base-UOM unit. Only accepted units are costed. [Precision(18, 2)] public decimal UnitCost { get; set; } [Precision(5, 2)] public decimal DiscountPercent { get; set; } [Precision(5, 2)] public decimal VatPercent { get; set; } [Precision(5, 2)] public decimal NbtPercent { get; set; } /// Populated when the received item tracks batches and/or expiry dates. public ICollection Batches { get; set; } = []; /// Populated when the received item tracks serial numbers. public ICollection Serials { get; set; } = []; } }