namespace AgriculturalPlatform.Api.Models;
/// 农产品反向开票(收购发票:收购方向农户开具)
public class Invoice
{
public int Id { get; set; }
/// 发票号码(如 FP20260812-0001)
public string InvoiceNo { get; set; } = string.Empty;
/// 开票批次号(批量开票时同一批共用)
public string BatchNo { get; set; } = string.Empty;
/// 票种:农产品收购发票
public string InvoiceKind { get; set; } = "农产品收购发票";
/// 销售方(农户)
public int FarmerId { get; set; }
public Farmer? Farmer { get; set; }
/// 收购方(公司/站/个体)
public int PurchaserOrgId { get; set; }
public Organization? PurchaserOrg { get; set; }
/// 关联收购单(可空)
public int? PurchaseOrderId { get; set; }
public PurchaseOrder? PurchaseOrder { get; set; }
/// 品名(冗余,便于发票展示)
public int ProductId { get; set; }
public Product? Product { get; set; }
/// 数量
public decimal Quantity { get; set; }
public string Unit { get; set; } = "公斤";
public decimal UnitPrice { get; set; }
/// 价税合计(元)
public decimal Amount { get; set; }
/// 税率(%),农产品收购发票免税为 0
public decimal TaxRate { get; set; } = 0m;
public decimal TaxAmount { get; set; }
public DateTime IssueDate { get; set; } = DateTime.Now;
public InvoiceStatus Status { get; set; } = InvoiceStatus.Issued;
/// 开票人
public int? OperatorId { get; set; }
public User? Operator { get; set; }
public DateTime? ReversedAt { get; set; }
public string ReverseReason { get; set; } = string.Empty;
public DateTime CreatedAt { get; set; } = DateTime.Now;
}