Add order invoice fields
This commit is contained in:
@@ -1,12 +1,20 @@
|
|||||||
using System.ComponentModel.DataAnnotations.Schema;
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
|
||||||
namespace Distribution.Models
|
namespace Distribution.Models
|
||||||
{
|
{
|
||||||
public class Order : Template
|
public class Order : Template
|
||||||
{
|
{
|
||||||
public Guid FK_SaleId { get; set; }
|
public Guid? FK_SaleId { get; set; }
|
||||||
[ForeignKey("FK_SaleId")]
|
[ForeignKey("FK_SaleId")]
|
||||||
public Sale Sale { get; set; }
|
public Sale? Sale { get; set; }
|
||||||
|
|
||||||
|
public Guid CreatedByUserId { get; set; }
|
||||||
|
[ForeignKey("CreatedByUserId")]
|
||||||
|
public User CreatedByUser { get; set; }
|
||||||
|
|
||||||
|
/// <summary>Set once an Invoice is created for this PO (either mode). No DB-level FK
|
||||||
|
/// constraint — configured explicitly in Fluent API per order_invoice_lifecycle.md.</summary>
|
||||||
|
public Guid? InvoiceId { get; set; }
|
||||||
|
|
||||||
public DateTime OrderDate { get; set; }
|
public DateTime OrderDate { get; set; }
|
||||||
public Guid FK_StoreId { get; set; }
|
public Guid FK_StoreId { get; set; }
|
||||||
@@ -16,6 +24,15 @@ namespace Distribution.Models
|
|||||||
public OrderStatus Status { get; set; } = OrderStatus.Pending;
|
public OrderStatus Status { get; set; } = OrderStatus.Pending;
|
||||||
public DateTime? FulfilledAt { get; set; }
|
public DateTime? FulfilledAt { get; set; }
|
||||||
|
|
||||||
|
/// <summary>Null = Shop PO (items editable). Set = Confirmed PO (items locked). Not modeled
|
||||||
|
/// as an explicit field in order_invoice_lifecycle.md's diagram, but required to implement
|
||||||
|
/// its Business Rule 1 (item edits gated on confirmation) independent of Invoice existing —
|
||||||
|
/// Mode B confirms a PO with no Invoice at all.</summary>
|
||||||
|
public DateTime? ConfirmedAt { get; set; }
|
||||||
|
public Guid? ConfirmedByUserId { get; set; }
|
||||||
|
[ForeignKey("ConfirmedByUserId")]
|
||||||
|
public User? ConfirmedByUser { get; set; }
|
||||||
|
|
||||||
public ICollection<OrderItem> OrderItems { get; set; } = new List<OrderItem>();
|
public ICollection<OrderItem> OrderItems { get; set; } = new List<OrderItem>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user