XRechnung erweitert

This commit is contained in:
2025-12-01 18:44:48 +01:00
parent 64d6d9a02f
commit 0e115c509a
4 changed files with 69 additions and 46 deletions

View File

@@ -137,7 +137,7 @@
FontSize="13" FontSize="13"
Foreground="#FFFFFF" Foreground="#FFFFFF"
Initialized="btn_xRechnung_Initialized" Initialized="btn_xRechnung_Initialized"
ToolTip="xRechnung erstellen" /> ToolTip="E-Rechnung erstellen" />
<Button <Button
x:Name="btn_edit" x:Name="btn_edit"
Width="20" Width="20"

View File

@@ -13,6 +13,7 @@ namespace BeWo.Data.Models.XRechnung
public string Date { get; set; } public string Date { get; set; }
public string Currency { get; set; } public string Currency { get; set; }
public string Notice { get; set; } public string Notice { get; set; }
public string CancellationNumber { get; set; }
public XRInvoicePeriod Period { get; set; } public XRInvoicePeriod Period { get; set; }
public XRInvoicePayment Payment { get; set; } public XRInvoicePayment Payment { get; set; }

View File

@@ -8,11 +8,11 @@ namespace BeWo.Data.Models.XRechnung
{ {
public class XRPosition public class XRPosition
{ {
public int Quantity { get; set; } public decimal Quantity { get; set; }
public string QuantityType { get; set; } public string QuantityType { get; set; }
public string Text { get; set; } public string Text { get; set; }
public int Net { get; set; } public decimal Net { get; set; }
public int NetTotal { get; set; } public decimal NetTotal { get; set; }
public decimal Tax { get; set; } public decimal Tax { get; set; }
public decimal TaxSum { get; set; } public decimal TaxSum { get; set; }
public string TaxType { get; set; } public string TaxType { get; set; }

View File

@@ -56,6 +56,10 @@ namespace BeWo.Service.Plugins
var str = //ServiceConfigReader.GetInvoiceTestJsonString(); var str = //ServiceConfigReader.GetInvoiceTestJsonString();
calculate(invoice_base); calculate(invoice_base);
str = str.Replace("19.0", "19");
str = str.Replace("76.0", "76");
// Erstelle Url ohne weitere Authentifizierung // Erstelle Url ohne weitere Authentifizierung
var token_url = GetTokenUrl(report_url); var token_url = GetTokenUrl(report_url);
@@ -152,59 +156,77 @@ namespace BeWo.Service.Plugins
xRechnung.Invoice.Number = invoice.InvoiceNumber; xRechnung.Invoice.Number = invoice.InvoiceNumber;
xRechnung.Invoice.Date = invoice.InvoiceDate?.ToString("yyyyMMdd") ?? undefinded; xRechnung.Invoice.Date = invoice.InvoiceDate?.ToString("yyyyMMdd") ?? undefinded;
xRechnung.Invoice.Currency = "EUR"; xRechnung.Invoice.Currency = "EUR";
xRechnung.Invoice.Notice = undefinded; xRechnung.Invoice.Notice = invoice.Notice;
xRechnung.Invoice.CancellationNumber = "";
xRechnung.Invoice.Period.Start = invoice.AccountingPeriodStart?.ToString("yyyyMMdd") ?? undefinded; xRechnung.Invoice.Period.Start = invoice.AccountingPeriodStart?.ToString("yyyyMMdd") ?? undefinded;
xRechnung.Invoice.Period.End = invoice.AccountingPeriodEnd?.ToString("yyyyMMdd") ?? undefinded; xRechnung.Invoice.Period.End = invoice.AccountingPeriodEnd?.ToString("yyyyMMdd") ?? undefinded;
xRechnung.Invoice.Period.Description = undefinded; xRechnung.Invoice.Period.Description = String.Format("Leistungszeitraum {0:dd.MM.yyyy} bis {1:dd.MM.yyyy}", invoice.AccountingPeriodStart, invoice.AccountingPeriodEnd);
xRechnung.Invoice.Payment.Type = undefinded_num;
xRechnung.Invoice.Payment.Type = undefinded_num3; xRechnung.Invoice.Payment.Type = undefinded_num3;
xRechnung.Invoice.Payment.Term = undefinded; xRechnung.Invoice.Payment.Term = "Zahlbar innerhalb 14 Tagen netto";
xRechnung.Invoice.Payment.DueDate = undefinded; xRechnung.Invoice.Payment.DueDate = invoice.InvoiceDate?.AddDays(14).ToString("yyyyMMdd") ?? undefinded;
xRechnung.Seller.Name = undefinded; xRechnung.Seller.Name = "Muster GmbH";
xRechnung.Seller.ID = undefinded; xRechnung.Seller.ID = null;
xRechnung.Seller.TaxID = undefinded; xRechnung.Seller.TaxID = null;
xRechnung.Seller.VatID = undefinded; xRechnung.Seller.VatID = "DE123456789";
xRechnung.Seller.Street = undefinded; xRechnung.Seller.Street = "Musterstr. 1-3";
xRechnung.Seller.ZipCode = undefinded; xRechnung.Seller.ZipCode = "30674";
xRechnung.Seller.City = undefinded; xRechnung.Seller.City = "Frankfurt";
xRechnung.Seller.EMail = undefinded; xRechnung.Seller.EMail = "rechnungen@musterfirma.de";
xRechnung.Seller.CountryCode = "DE"; xRechnung.Seller.CountryCode = "DE";
xRechnung.Seller.Contact.Name = undefinded; xRechnung.Seller.Contact.Name = "Peter Musterfrau";
xRechnung.Seller.Contact.Department = undefinded; xRechnung.Seller.Contact.Department = "Buchhaltung";
xRechnung.Seller.Contact.Phone = undefinded; xRechnung.Seller.Contact.Phone = "+49211171717";
xRechnung.Seller.Contact.EMail = undefinded; xRechnung.Seller.Contact.EMail = "pm@muster.de";
xRechnung.Seller.BankAccount.IBAN = undefinded; xRechnung.Seller.BankAccount.IBAN = "DE38370501980147522957";
xRechnung.Seller.BankAccount.BIC = undefinded; xRechnung.Seller.BankAccount.BIC = "SSKMDEMMXXX";
xRechnung.Seller.BankAccount.Owner = undefinded; xRechnung.Seller.BankAccount.Owner = "Muster GmbH";
xRechnung.Seller.BankAccount.Reference = undefinded; xRechnung.Seller.BankAccount.Reference = "z.B. Rechnungnummer";
xRechnung.Seller.BankAccount.ReferenceID = undefinded; xRechnung.Seller.BankAccount.ReferenceID = "GläubigerID";
xRechnung.Buyer.Name = undefinded; Address rechnungsAdresse = null;
xRechnung.Buyer.ID = undefinded; if (invoice.RecipientOrganisationOid.HasValue)
xRechnung.Buyer.Street = undefinded; {
xRechnung.Buyer.ZipCode = undefinded; var org = DAOFactory.GenericDAO.LoadByID<Organisation>(invoice.RecipientOrganisationOid.Value);
xRechnung.Buyer.City = undefinded; rechnungsAdresse = org.InvoiceAddress ?? org.Address;
xRechnung.Buyer.EMail = undefinded; }
xRechnung.Buyer.CountryCode = undefinded; else if (invoice.RecipientCustomerOid.HasValue)
xRechnung.Buyer.Reference = undefinded; {
xRechnung.Buyer.BankAccount.IBAN = undefinded; var customer = DAOFactory.GenericDAO.LoadByID<Customer>(invoice.RecipientCustomerOid.Value);
xRechnung.Buyer.BankAccount.BIC = undefinded; rechnungsAdresse = customer.Person.InvoiceAddress ?? customer.Person.Address;
xRechnung.Buyer.BankAccount.Owner = undefinded; }
xRechnung.Buyer.BankAccount.MandateID = undefinded;
xRechnung.Buyer.ID = null;
if (rechnungsAdresse != null)
{
xRechnung.Buyer.Street = rechnungsAdresse.Street;
xRechnung.Buyer.ZipCode = rechnungsAdresse.PostalCode;
xRechnung.Buyer.City = rechnungsAdresse.Town;
xRechnung.Buyer.CountryCode = "DE";
}
xRechnung.Buyer.EMail = "rechnungen@kunde.de";
xRechnung.Buyer.Reference = "PO-Nummer oder andere Referenz, die Kunde haben will";
xRechnung.Buyer.BankAccount.IBAN = "DE38370501980147522957";
xRechnung.Buyer.BankAccount.BIC = "SSKMDEMMXXX";
xRechnung.Buyer.BankAccount.Owner = "Muster GmbH";
xRechnung.Buyer.BankAccount.MandateID = "Mandatsreferenznummer";
foreach (var item in invoice.GetInvoiceItems()) foreach (var item in invoice.GetInvoiceItems())
{ {
var position = new XRPosition(); var position = new XRPosition();
position.Quantity = undefinded_num; position.Quantity = item.UnitCount ?? 0;
position.QuantityType = undefinded; position.QuantityType = "H87";
position.Text = undefinded; position.Text = item.ItemDescription;
position.Net = undefinded_num; position.Net = item.AmountPerUnit ?? 0;
position.NetTotal = undefinded_num; position.NetTotal = item.AmountTotal ?? 0;
position.Tax = undefinded_num2; position.Tax = 0;
position.TaxSum = undefinded_num2; position.TaxSum = 0;
position.TaxType = undefinded; position.TaxType = "S";
xRechnung.Position.Add(position); xRechnung.Position.Add(position);
} }