Files
ERP_Distribution/Distribution/Models/GoodsReceipt.cs
T

46 lines
1.8 KiB
C#

using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
namespace Distribution.Models
{
public class GoodsReceipt : Template
{
/// <summary>Null for a direct receipt (goods received without a purchase order).</summary>
public Guid? FK_PurchaseOrderId { get; set; }
[ForeignKey("FK_PurchaseOrderId")]
public PurchaseOrder? PurchaseOrder { get; set; }
/// <summary>Optional supplier for a direct receipt; for PO receipts the supplier comes from the PO.</summary>
public Guid? FK_SupplierId { get; set; }
[ForeignKey("FK_SupplierId")]
public Supplier? Supplier { get; set; }
public Guid FK_ReceivedByUserId { get; set; }
/// <summary>
/// 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.
/// </summary>
public Guid FK_WarehouseId { get; set; }
[ForeignKey("FK_WarehouseId")]
public Warehouse Warehouse { get; set; }
public DateTime ReceivedAt { get; set; } = DateTime.Now;
/// <summary>GRN-wide default discount %, applied to any line that doesn't set its own.</summary>
[Precision(5, 2)]
public decimal DiscountPercent { get; set; }
/// <summary>GRN-wide default VAT %, applied to any line that doesn't set its own.</summary>
[Precision(5, 2)]
public decimal VatPercent { get; set; }
/// <summary>GRN-wide default NBT %, applied to any line that doesn't set its own.</summary>
[Precision(5, 2)]
public decimal NbtPercent { get; set; }
public ICollection<GoodsReceiptItem> Items { get; set; } = [];
}
}