using System.ComponentModel.DataAnnotations.Schema;
namespace Distribution.Models
{
public class PurchaseOrderItem : Template
{
public Guid FK_PurchaseOrderId { get; set; }
[ForeignKey("FK_PurchaseOrderId")]
public PurchaseOrder PurchaseOrder { get; set; }
public Guid FK_ItemId { get; set; }
[ForeignKey("FK_ItemId")]
public Item Item { get; set; }
public int Quantity { get; set; }
/// Agreed cost per unit at the time the PO was issued.
public decimal UnitCost { get; set; }
/// Running total, incremented by createGoodsReceipt; drives PurchaseOrder.Status.
public int ReceivedQuantity { get; set; } = 0;
///
/// Set by cancelPurchaseOrderLine. Outstanding qty for receiving purposes is
/// Quantity - ReceivedQuantity - CancelledQuantity.
///
public int CancelledQuantity { get; set; } = 0;
/// True once this line is individually cancelled.
public bool IsCancelled { get; set; } = false;
}
}