Skip to content

Instantly share code, notes, and snippets.

@bjoerntx
Created February 9, 2023 15:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bjoerntx/85098cf8a8dff4c1c231089460e9e280 to your computer and use it in GitHub Desktop.
Save bjoerntx/85098cf8a8dff4c1c231089460e9e280 to your computer and use it in GitHub Desktop.
public class Order {
public int Id { get; set; }
public DateTime OrderDate { get; set; }
public ContractParty Buyer { get; set; }
public ContractParty Seller { get; set; }
public Decimal Allowance { get; set; }
public Decimal Vat { get; set; } = 6.5M;
public List<LineItem> LineItems { get; set; } = new List<LineItem>();
public Decimal LineTotalAmount {
get {
return this.LineItems.Sum(item => item.GrossPrice * item.Quantity);
}
}
public Decimal TaxTotalAmount {
get {
return (this.LineTotalAmount / 100) * this.Vat;
}
}
public Decimal GrandTotalAmount {
get {
return this.LineTotalAmount + this.TaxTotalAmount;
}
}
public class LineItem {
public string Name { get; set; }
public string Description { get; set; }
public QuantityCodes QuantityCode { get; set; } = QuantityCodes.H87;
public int Quantity { get; set; }
public decimal GrossPrice { get; set; }
}
public class Seller : ContractParty { }
public class Buyer : ContractParty { }
public class ContractParty {
public int Id { get; set; }
public string Name { get; set; }
public string PostalCode { get; set; }
public string City { get; set; }
public string Address { get; set; }
public CountryCodes CountryCodes { get; set; }
public ContractPartyContact BuyerContact { get; set; }
}
public class ContractPartyContact {
public string FirstName { get; set; }
public string LastName { get; set; }
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment