Created
February 3, 2021 22:36
-
-
Save bjoerntx/9067cceafc19bb607e5e204dbf8d4354 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
private Invoice CreateSampleInvoice() { | |
// new zugferd invoice | |
Invoice invoice = new Invoice("A12345", DateTime.Now, CurrencyCode.USD); | |
invoice.Type = InvoiceType.Invoice; | |
invoice.Profile = Profile.Comfort; | |
// buyer | |
invoice.Buyer = new TradeParty { | |
ID = "TX_1", | |
Name = "Text Control GmbH", | |
ContactName = "Peter Paulsen", | |
City = "Bremen", | |
Postcode = "28217", | |
Country = CountryCode.DE, | |
Street = "Überseetor 18" | |
}; | |
// seller | |
invoice.Seller = new TradeParty { | |
ID = "TX_2", | |
Name = "Text Control, LLC", | |
ContactName = "Jack Jackson", | |
City = "Charlotte, NC", | |
Postcode = "28210", | |
Country = CountryCode.US, | |
Street = "6926 Shannon Willow Rd, Suite 400", | |
}; | |
// add tax id's | |
invoice.Seller.SpecifiedTaxRegistrations.Add( | |
new TaxID() { ID = "US12367623", Scheme = TaxScheme.VA }); | |
// add products | |
List<LineItem> lineItems = new List<LineItem>(); | |
lineItems.Add(new LineItem() { | |
Price = 200, | |
ProductID = "A123", | |
Name = "Product A", | |
Quantity = 5, | |
Total = 1000, | |
UnitCode = QuantityCodes.C62 | |
}); | |
// add line items to invoice | |
foreach (LineItem item in lineItems) | |
invoice.LineItems.Add(item); | |
// set the total amount | |
invoice.TotalAmount = 1000; | |
return invoice; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment