Kleinunternehmer Mode
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
@page "/"
|
||||
@page "/invoices"
|
||||
@using Server.Data
|
||||
@using Server.Model
|
||||
@rendermode InteractiveServer
|
||||
|
||||
@@ -18,7 +19,18 @@
|
||||
<p class="card-text">
|
||||
@invoice.Customer?.Name<br />
|
||||
@invoice.Items.Count Artikel<br />
|
||||
@($"{invoice.TotalNetto:N2} €") Netto<br />
|
||||
@if (SettingsData.Instance.Kleinunternehmer)
|
||||
{
|
||||
@($"{invoice.TotalNetto:N2} €")<br />
|
||||
}
|
||||
else
|
||||
{
|
||||
<div>
|
||||
@($"{invoice.TotalNetto:N2} €") Netto<br />
|
||||
@($"{invoice.TotalBrutto:N2} €") Brutto<br />
|
||||
</div>
|
||||
}
|
||||
|
||||
</p>
|
||||
<a href="@($"edit/{invoice.InvoiceId}")" class="btn btn-sm btn-primary">Bearbeiten</a>
|
||||
<button class="btn btn-sm btn-info" @onclick="() => GenerateDocumentAsync(invoice)"><i class="fas fa-file-pdf"></i></button>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
@page "/edit/{InvoiceId}"
|
||||
@using QuestPDF
|
||||
@using Server.Data
|
||||
@using Server.Model
|
||||
@rendermode InteractiveServer
|
||||
@@ -85,18 +86,21 @@
|
||||
<InputNumber TValue="double" class="form-control" @bind-Value="@item.Quantity"></InputNumber>
|
||||
</div>
|
||||
<div class="col-sm">
|
||||
<label class="form-label mb-0">Price (Netto)</label>
|
||||
<label class="form-label mb-0">Price @(SettingsData.Instance.Kleinunternehmer ? string.Empty : "(Netto)")</label>
|
||||
<InputNumber TValue="double" class="form-control" @bind-Value="@item.PriceNetto"></InputNumber>
|
||||
</div>
|
||||
<div class="col-sm">
|
||||
<label class="form-label mb-0">Tax Type</label>
|
||||
<InputSelect @bind-Value="@item.TaxType" class="form-select">
|
||||
@foreach (var taxType in Enum.GetValues(typeof(TaxType)))
|
||||
{
|
||||
<option value="@taxType">@taxType</option>
|
||||
}
|
||||
</InputSelect>
|
||||
</div>
|
||||
@if (!SettingsData.Instance.Kleinunternehmer)
|
||||
{
|
||||
<div class="col-sm">
|
||||
<label class="form-label mb-0">Tax Type</label>
|
||||
<InputSelect @bind-Value="@item.TaxType" class="form-select">
|
||||
@foreach (var taxType in Enum.GetValues(typeof(TaxType)))
|
||||
{
|
||||
<option value="@taxType">@taxType</option>
|
||||
}
|
||||
</InputSelect>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
|
||||
<div class="mb-1 mt-2">
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System.Globalization;
|
||||
using System.Net.Mime;
|
||||
using QuestPDF;
|
||||
using QuestPDF.Drawing;
|
||||
using QuestPDF.Fluent;
|
||||
using QuestPDF.Helpers;
|
||||
@@ -39,7 +40,16 @@ namespace Server.Model
|
||||
{
|
||||
container.PaddingVertical(40).Column(outerColumn =>
|
||||
{
|
||||
outerColumn.Item().Element(ComposeItemTable);
|
||||
if (SettingsData.Instance.Kleinunternehmer)
|
||||
{
|
||||
outerColumn.Item().Element(ComposeItemTableKleinunternehmer);
|
||||
outerColumn.Item().PaddingTop(10).Text("Im Sinne der Kleinunternehmerregelung nach § 19 UStG. enthält der ausgewiesene Betrag keine Umsatzsteuer.");
|
||||
}
|
||||
else
|
||||
{
|
||||
outerColumn.Item().Element(ComposeItemTable);
|
||||
}
|
||||
|
||||
|
||||
outerColumn.Item().Row(row =>
|
||||
{
|
||||
@@ -48,11 +58,15 @@ namespace Server.Model
|
||||
if (!string.IsNullOrWhiteSpace(Model.Comment))
|
||||
col.Item().PaddingTop(25).Element(ComposeComments);
|
||||
});
|
||||
|
||||
row.AutoItem().Column(col =>
|
||||
|
||||
if (!SettingsData.Instance.Kleinunternehmer)
|
||||
{
|
||||
col.Item().Element(ComposeTaxTable);
|
||||
});
|
||||
row.AutoItem().Column(col =>
|
||||
{
|
||||
col.Item().Element(ComposeTaxTable);
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
outerColumn.Spacing(5);
|
||||
@@ -121,6 +135,61 @@ namespace Server.Model
|
||||
table.Cell().Element(c => c.BorderTop(1).BorderColor(Colors.Black)).AlignRight().TextSmall($"{totalTax:N2} €");
|
||||
});
|
||||
}
|
||||
|
||||
private void ComposeItemTableKleinunternehmer(IContainer container)
|
||||
{
|
||||
container.Table(table =>
|
||||
{
|
||||
// Define columns
|
||||
table.ColumnsDefinition(columns =>
|
||||
{
|
||||
columns.RelativeColumn(3); // Beschreibung
|
||||
columns.ConstantColumn(20, Unit.Millimetre); // Menge
|
||||
columns.ConstantColumn(24, Unit.Millimetre); // Einzelpreis
|
||||
columns.ConstantColumn(24, Unit.Millimetre); // Gesamtpreis
|
||||
});
|
||||
|
||||
// Describe header
|
||||
table.Header(header =>
|
||||
{
|
||||
header.Cell().Element(CellStyle).Text("Beschreibung").SemiBold();
|
||||
header.Cell().Element(CellStyle).AlignCenter().Text("Menge").SemiBold();
|
||||
header.Cell().Element(CellStyle).AlignRight().Text("Einzelpreis").SemiBold();
|
||||
header.Cell().Element(CellStyle).AlignRight().Text("Gesamtpreis").SemiBold();
|
||||
|
||||
static IContainer CellStyle(IContainer container)
|
||||
{
|
||||
return container.DefaultTextStyle(x => x.SemiBold()).BorderBottom(1).BorderColor(Colors.Black);
|
||||
}
|
||||
});
|
||||
|
||||
// Describe content
|
||||
foreach (var item in Model.Items ?? [])
|
||||
{
|
||||
|
||||
// Beschreibung
|
||||
table.Cell().Element(CellStyle).Column(column =>
|
||||
{
|
||||
column.Item().Text(item.Name);
|
||||
if(!string.IsNullOrWhiteSpace(item.Description))
|
||||
column.Item().TextSmall(item.Description);
|
||||
});
|
||||
|
||||
table.Cell().Element(CellStyle).AlignCenter().Text(txt => txt.Span($"{item.Quantity:N2}"));
|
||||
|
||||
// string as currency format
|
||||
table.Cell().Element(CellStyle).AlignRight().Text($"{item.PriceNetto:N2} €");
|
||||
table.Cell().Element(CellStyle).AlignRight().Text($"{item.PriceNetto * item.Quantity:N2} €");
|
||||
}
|
||||
|
||||
table.Cell().ColumnSpan(3).Element(CellStyle).PaddingTop(10).Text("Rechnungsbetrag").Medium();
|
||||
table.Cell().Element(CellStyle).PaddingTop(10).AlignRight().Text($"{Model.Items.Sum(x=> x.PriceNetto*x.Quantity):N2} €").Medium();
|
||||
|
||||
return;
|
||||
|
||||
static IContainer CellStyle(IContainer container) => container.BorderBottom(1).BorderColor(Colors.Grey.Lighten2).PaddingVertical(5);
|
||||
});
|
||||
}
|
||||
|
||||
private void ComposeItemTable(IContainer container)
|
||||
{
|
||||
@@ -141,7 +210,6 @@ namespace Server.Model
|
||||
// Describe header
|
||||
table.Header(header =>
|
||||
{
|
||||
|
||||
header.Cell().Text("").SemiBold();
|
||||
header.Cell().Text("").SemiBold();
|
||||
header.Cell().AlignRight().Text("Einzelpreis").SemiBold();
|
||||
@@ -260,7 +328,7 @@ namespace Server.Model
|
||||
|
||||
row.RelativeItem().AlignMiddle().PaddingRight(10, Unit.Millimetre).Background(Colors.Red.Medium).Column(col =>
|
||||
{
|
||||
col.Item().AlignRight().Text("www.example.com");
|
||||
//col.Item().AlignRight().Text("www.example.com");
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
public PaymentData? PaymentData { get; set; }
|
||||
|
||||
public double TotalNetto => Items?.Sum(x => x.PriceNetto*x.Quantity) ?? 0d;
|
||||
public double TotalBrutto => Items?.Sum(x => x.PriceBrutto*x.Quantity) ?? 0d;
|
||||
}
|
||||
|
||||
public class PaymentData
|
||||
|
||||
Reference in New Issue
Block a user