Rechnungen werden in lexoffice nun erstellt

This commit is contained in:
2023-07-12 20:44:06 +02:00
parent 85c43cce77
commit 632f5ab236
7 changed files with 386 additions and 27 deletions

View File

@@ -0,0 +1,4 @@
namespace ConsoleApp3.DataContracts
{
public record Employee(string Name, int Number);
}

View File

@@ -0,0 +1,45 @@
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApp3.DataContracts
{
internal class Invoice
{
[JsonProperty("id")] public string Id { get; set; }
//[JsonProperty("organizationId")] public string OrganizationId { get; set; }
[JsonProperty("createdDate")] public string CreatedDate { get; set; }
[JsonProperty("updatedDate")] public string UpdatedDate { get; set; }
[JsonProperty("version")] public decimal Version { get; set; }
[JsonProperty("language")] public string Language { get; set; }
[JsonProperty("archived")] public bool Archived { get; set; }
[JsonProperty("voucherStatus")] public string VoucherStatus { get; set; }
[JsonProperty("voucherNumber")] public string VoucherNumber { get; set; }
[JsonProperty("voucherDate")] public string VoucherDate { get; set; }
[JsonProperty("dueDate")] public string DueDate { get; set; }
[JsonProperty("address")] public InvoiceAddress Address { get; set; }
[JsonProperty("lineItems")] public List<InvoiceLineItem> LineItems { get; set; }
[JsonProperty("totalPrice")] public TotalPrice TotalPrice { get; set; }
[JsonProperty("taxConditions")] public TaxConditions TaxConditions { get; set; }
[JsonProperty("shippingConditions")] public ShippingConditions ShippingConditions { get; set; }
}
public class ShippingConditions
{
[JsonProperty("shippingDate")] public string shippingDate { get; set; } = "2023-04-22T00:00:00.000+02:00";
[JsonProperty("shippingType")] public string shippingType { get; set; } = "delivery";
}
public class TaxConditions
{
[JsonProperty("taxType")] public string TaxType { get; set; } = "net";
}
public class TotalPrice
{
[JsonProperty("currency")] public string Currency { get; set; } = "EUR";
}
}

View File

@@ -0,0 +1,26 @@
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApp3.DataContracts
{
internal class InvoiceAddress
{
[JsonProperty("contactId")] public string ContactId { get; set; }
[JsonProperty("name")] public string Name { get; set; }
[JsonProperty("supplement")] public string Supplement { get; set; }
[JsonProperty("street")] public string Street { get; set; }
[JsonProperty("city")] public string City { get; set; }
[JsonProperty("zip")] public string Zip { get; set; }
[JsonProperty("countryCode")] public string CountryCode { get; set; }
}
}

View File

@@ -0,0 +1,33 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApp3.DataContracts
{
public record InvoiceItem
{
internal InvoiceItem(string invoiceId, string customer, DateTime date, Employee employee, int account,
string description, decimal amountHours, decimal price)
{
InvoiceId = invoiceId;
Customer = customer;
Date = date;
Employee = employee;
Account = account;
Description = description;
AmountHours = amountHours;
Price = price;
}
public string InvoiceId { get; }
public string Customer { get; }
public DateTime Date { get; }
public Employee Employee { get; }
public int Account { get; }
public string Description { get; }
public decimal AmountHours { get; }
public decimal Price { get; }
}
}

View File

@@ -0,0 +1,21 @@
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApp3.DataContracts
{
internal class InvoiceLineItem
{
[JsonProperty("type")] public string Type { get; set; }
[JsonProperty("name")] public string Name { get; set; }
[JsonProperty("description")] public string Description { get; set; }
[JsonProperty("quantity")] public decimal Quantity { get; set; }
[JsonProperty("unitName")] public string UnitName { get; set; }
[JsonProperty("unitPrice")] public InvoiceLineUnitPrice UnitPrice { get; set; }
[JsonProperty("discountPercentage")] public decimal DiscountPercentage { get; set; }
[JsonProperty("lineItemAmount")] public decimal LineItemAmount { get; set; }
}
}

View File

@@ -0,0 +1,15 @@
using Newtonsoft.Json;
namespace ConsoleApp3.DataContracts
{
public class InvoiceLineUnitPrice
{
[JsonProperty("currency")] public string Currency { get; set; }
[JsonProperty("netAmount")] public decimal NetAmount { get; set; }
[JsonProperty("grossAmount")] public decimal GrossAmount { get; set; }
[JsonProperty("taxRatePercentage")] public decimal TaxRatePercentage { get; set; }
}
}