Created
February 9, 2023 15:11
-
-
Save bjoerntx/916250feb62fa83b5676b592f0c00c5b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public byte[] ZugferdXML { | |
get { | |
var invoice = InvoiceDescriptor.CreateInvoice(this.Id.ToString(), | |
this.OrderDate, CurrencyCodes.USD); | |
invoice.SetBuyer(this.Buyer.Name, | |
this.Buyer.PostalCode, | |
this.Buyer.City, | |
this.Buyer.Address, | |
this.Buyer.CountryCodes, | |
this.Buyer.Id.ToString()); | |
invoice.SetSeller(this.Seller.Name, | |
this.Seller.PostalCode, | |
this.Seller.City, | |
this.Seller.Address, | |
this.Seller.CountryCodes, | |
this.Seller.Id.ToString()); | |
invoice.SetSellerContact($"{this.Seller.BuyerContact.FirstName} {this.Seller.BuyerContact.LastName}"); | |
foreach (LineItem lineItem in this.LineItems) { | |
invoice.AddTradeLineItem(lineItem.Name, lineItem.Description, lineItem.QuantityCode, lineItem.Quantity, lineItem.GrossPrice, lineItem.GrossPrice, lineItem.Quantity); | |
} | |
invoice.LineTotalAmount = LineTotalAmount; | |
invoice.ChargeTotalAmount = invoice.LineTotalAmount; | |
invoice.AllowanceTotalAmount = Allowance; | |
invoice.TaxBasisAmount = invoice.ChargeTotalAmount; | |
invoice.TaxTotalAmount = TaxTotalAmount; | |
invoice.GrandTotalAmount = GrandTotalAmount; | |
MemoryStream ms = new MemoryStream(); | |
invoice.Save(ms, ZUGFeRDVersion.Version1, Profile.Basic); | |
return ms.ToArray(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment