您好我的MVC应用中有一个实体,其中包含交易行的字段。
我想使用此实体来参考购买发票和销售发票。
以下是抽象类购买发票和销售发票将从那里继承。
public abstract class InvoiceAbstractClass:IParentTransaction { [键] public int Id {get;组; }
[Required]
public string ParentTransactionType {get; set; }
[Required]
[DisplayName("Currency")]
[DefaultValue("GBP")]
public string Currency { get; set; }
[Required]
[DisplayName("Date")]
public DateTime ParentTransactionDateTime { get; set; }
[Required]
[DisplayName("Due Date")]
public DateTime InvoiceDueDate { get; set; }
[Required]
[DisplayName("Invoice Number")]
public string ParentTransactionReference { get; set; }
[Required]
public virtual ICollection<TransactionLines> TransactionLines { get; set; }
[Required]
[DisplayName("VAT")]
public double VatTotal { get; set; }
[Required]
[DisplayName("Invoice Total")]
public double TransactionTotal { get; set; }
}
}
以下是交易行类enter code here
应该有父transactionType和Id字段(i-e puchase / sales invoice and Id)
公共类TransactionLines { [键] public int Id {get;组; }
public int ParentTransactionId { get; set; }
[Required]
[Display(Name = "Details" )]
public string TransactionLineDetails {get; set;}
public int Quantity { get; set; }
[Required]
public decimal UnitAmount { get; set; }
[Required]
public int AccountId { get; set; }
[Required]
VatRate VatRate { get; set; }
[Required]
public double VatAmount { get; set; }
public string ReportingCategoryOne { get; set; }
public string ReportingCategoryTwo { get; set; }
public string ReportingCategoryThree { get; set; }
public string ReportingCategoryFour { get; set; }
public decimal Total
{
get
{
return Quantity * UnitAmount;
}
}
}
任何指针都将受到赞赏。