using System.ComponentModel.DataAnnotations.Schema; using Microsoft.EntityFrameworkCore; namespace Distribution.Models { public class GoodsReceipt : Template { /// Null for a direct receipt (goods received without a purchase order). public Guid? FK_PurchaseOrderId { get; set; } [ForeignKey("FK_PurchaseOrderId")] public PurchaseOrder? PurchaseOrder { get; set; } /// Optional supplier for a direct receipt; for PO receipts the supplier comes from the PO. public Guid? FK_SupplierId { get; set; } [ForeignKey("FK_SupplierId")] public Supplier? Supplier { get; set; } public Guid FK_ReceivedByUserId { get; set; } /// /// Warehouse the accepted quantities are received into. Not listed as a field in /// docs/15_procurement.md's GoodsReceipt table, but required to write StockBalance/ /// StockMovement rows (both keyed by LocationId+LocationType) for the accepted quantities. /// public Guid FK_WarehouseId { get; set; } [ForeignKey("FK_WarehouseId")] public Warehouse Warehouse { get; set; } public DateTime ReceivedAt { get; set; } = DateTime.Now; /// GRN-wide default discount %, applied to any line that doesn't set its own. [Precision(5, 2)] public decimal DiscountPercent { get; set; } /// GRN-wide default VAT %, applied to any line that doesn't set its own. [Precision(5, 2)] public decimal VatPercent { get; set; } /// GRN-wide default NBT %, applied to any line that doesn't set its own. [Precision(5, 2)] public decimal NbtPercent { get; set; } public ICollection Items { get; set; } = []; } }