docs: e-invoicing guide, ADR 0039-0040 and 0.9.0 changelog (#81)
CI / Build and test (SQLite) (pull_request) Successful in 4m27s
CI / PostgreSQL 16 integration (pull_request) Skipped
CI / PostgreSQL 17 integration (pull_request) Skipped
CI / YAML check (pull_request) Successful in 7s
CI / Docker image (pull_request) Successful in 1m30s

The wiki page "Fatturazione elettronica" becomes a complete guide for 0.9 with
nine screenshots of the real screens, and the pages that pointed to M9 now
describe what shipped (demo data and their removal, scheduled jobs, sales,
purchases, Italian tax rules, user guide). ADR 0039 records the e-invoice
design (file rows, progressive, offline checks with SDI codes and in-house
schema, notification dedup, safe polling, routing, SdICoop push with channel
key) and ADR 0040 the generic intermediary contracts and the schema-driven
removal of demo data. Screen polish: dashboard actions in the header, filters
on two rows, tables no longer squeezed, report titles and notification errors;
demo e-invoices get realistic send times and a rejection in the history.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Alby96andClaude Opus 5.5 committed 2026-11-13 13:24:31 +01:00
1 parent b78260beb0
commit 246d6f9357
30 files changed
+569 -199

No files matched your search

@@ -128,14 +128,20 @@ public sealed class DemoEInvoiceSeeder(
await invoices.MarkSentCoreAsync(uow, current, "PEC", null, "<demo-" + exchangeId + "@pec.khaemhat-demo.it>", Actor.System.UserName, cancellationToken)
.ConfigureAwait(false);
// The file was written and sent the day after the document, not today.
var sentAt = new DateTimeOffset(current.DocumentDate.AddDays(1).ToDateTime(new TimeOnly(9, 40)), TimeSpan.FromHours(1)).UtcDateTime;
current.GeneratedAt = sentAt.AddMinutes(-5);
current.SentAt = sentAt;
await uow.Repository<EInvoice, long>().UpdateAsync(current, cancellationToken).ConfigureAwait(false);
if (i < answered)
{
var at = new DateTimeOffset(current.DocumentDate.AddDays(1).ToDateTime(new TimeOnly(10, 15)), TimeSpan.FromHours(1));
var stem = EInvoiceStore.Stem(current.FileName);
var (code, root, body) = (i % 9) switch
{
2 when answered > 3 => ("NS", "NotificaScarto", Rejection(current.FileName, exchangeId, at)),
5 when answered > 6 => ("MC", "NotificaMancataConsegna", Basic(current.FileName, exchangeId, at, "Casella del destinatario piena: fattura messa a disposizione nell'area riservata.")),
1 when answered >= 3 => ("NS", "NotificaScarto", Rejection(current.FileName, exchangeId, at)),
4 when answered >= 5 => ("MC", "NotificaMancataConsegna", Basic(current.FileName, exchangeId, at, "Casella del destinatario piena: fattura messa a disposizione nell'area riservata.")),
_ => ("RC", "RicevutaConsegna", Delivery(current.FileName, exchangeId, at)),
};
var name = stem + "_" + code + "_001.xml";
@@ -22,7 +22,9 @@
<h1>@T["EInvoicing.Channels.Heading"]</h1>
<div class="sub">@T["EInvoicing.Channels.Hint"]</div>
</div>
<button type="button" class="btn" disabled="@_busy" @onclick="PollAsync"><KhIcon Name="refresh" /> @T["EInvoicing.Dashboard.PollNow"]</button>
<div class="kh-headacts">
<button type="button" class="btn" disabled="@_busy" @onclick="PollAsync"><KhIcon Name="refresh" /> @T["EInvoicing.Dashboard.PollNow"]</button>
</div>
</div>
<div class="kh-sdi-channels">
@@ -25,10 +25,23 @@
<h1>@T["EInvoicing.Dashboard.Heading"]</h1>
<div class="sub">@T["EInvoicing.Dashboard.Hint"]</div>
</div>
@if (_dashboard?.Counters.Received is > 0 and var received)
{
<a class="btn" href="@EInvoicingScreens.InboxPath"><KhIcon Name="mail" /> @T.Format("EInvoicing.Dashboard.ReceivedLink", received)</a>
}
<div class="kh-headacts">
@if (_dashboard?.Counters.Received is > 0 and var received)
{
<a class="btn" href="@EInvoicingScreens.InboxPath"><KhIcon Name="mail" /> @T.Format("EInvoicing.Dashboard.ReceivedLink", received)</a>
}
@if (CanSend)
{
<label class="btn kh-filebtn">
<KhIcon Name="upload" /> @T["EInvoicing.Dashboard.ImportReceipts"]
<InputFile OnChange="ImportReceiptsAsync" multiple accept=".xml,.p7m,.zip" disabled="@_busy" />
</label>
@if (Session.Permissions.Allows(EInvoicePermissions.ChannelManage))
{
<button type="button" class="btn" disabled="@_busy" @onclick="PollAsync"><KhIcon Name="refresh" /> @T["EInvoicing.Dashboard.PollNow"]</button>
}
}
</div>
</div>
@if (_dashboard is { } d)
@@ -44,7 +57,7 @@
</div>
}
<KhPanel Tight="true">
<KhPanel Tight="true" Class="kh-sdi-panel">
<div class="filters kh-ledger-filters">
<div class="kh-seg" role="group" aria-label="@T["EInvoicing.Dashboard.View"]">
<button type="button" class="@(_view == EInvoiceView.Issued ? "on" : null)" @onclick="() => SetViewAsync(EInvoiceView.Issued)">@T["EInvoicing.Dashboard.Issued"]</button>
@@ -52,20 +65,14 @@
<button type="button" class="@(_view == EInvoiceView.ToDo ? "on" : null)" @onclick="() => SetViewAsync(EInvoiceView.ToDo)">@T["EInvoicing.Dashboard.ToDo"]</button>
</div>
<input type="search" class="in kh-searchbox" placeholder="@T["EInvoicing.Dashboard.Search"]" aria-label="@T["EInvoicing.Dashboard.Search"]" value="@_search" @onchange="SearchAsync" />
</div>
<div class="filters">
<KhSelect TValue="EInvoiceStatus?" Label="@T["EInvoicing.Fields.Status"]" Name="status" Options="Statuses" Empty="@T["EInvoicing.All"]" Value="_status" ValueChanged="SetStatusAsync" />
<KhDateBox Label="@T["EInvoicing.Fields.From"]" Name="from" Value="_from" ValueChanged="SetFromAsync" />
<KhDateBox Label="@T["EInvoicing.Fields.To"]" Name="to" Value="_to" ValueChanged="SetToAsync" />
<span class="grow"></span>
@if (CanSend)
{
<label class="btn kh-filebtn">
<KhIcon Name="upload" /> @T["EInvoicing.Dashboard.ImportReceipts"]
<InputFile OnChange="ImportReceiptsAsync" multiple accept=".xml,.p7m,.zip" disabled="@_busy" />
</label>
@if (Session.Permissions.Allows(EInvoicePermissions.ChannelManage))
{
<button type="button" class="btn" disabled="@_busy" @onclick="PollAsync"><KhIcon Name="refresh" /> @T["EInvoicing.Dashboard.PollNow"]</button>
}
<button type="button" class="btn" disabled="@(_busy || _files.Count == 0)" @onclick="SendAsync"><KhIcon Name="send" /> @T.Format("EInvoicing.Dashboard.Send", _files.Count)</button>
<button type="button" class="btn primary" disabled="@(_busy || _docs.Count == 0)" @onclick="GenerateAndSendAsync"><KhIcon Name="zap" /> @T.Format("EInvoicing.Dashboard.GenerateAndSend", _docs.Count)</button>
}
@@ -95,7 +102,7 @@
var key = (p.Family, p.DocumentId);
<tr class="@(p.Status == DocumentStatus.SdiRejected ? "err" : _docs.Contains(key) ? "sel" : null)">
<td class="chkcol"><input type="checkbox" aria-label="@(T["EInvoicing.Select"] + " " + p.Number)" checked="@_docs.Contains(key)" @onchange="e => ToggleDoc(key, e.Value is true)" /></td>
<td class="code">
<td>
@if (SalesScreens.RecordUrl(p.Kind, p.DocumentId) is { } url)
{
<a href="@url">@SalesScreens.KindName(T, p.Kind) @p.Number</a>
@@ -245,7 +252,13 @@
<tr>
<td class="code">@n.Code</td>
<td>@T.DateTime(n.ReceivedAt, TimeZoneInfo.Local)</td>
<td class="kh-sdi-desc">@T["EInvoicing.Codes." + n.Code] @(n.Description is { Length: > 0 } desc ? "· " + desc : null)</td>
<td class="kh-sdi-desc">
@T["EInvoicing.Codes." + n.Code] @(n.Description is { Length: > 0 } desc ? "· " + desc : null)
@if (n.Errors is { Length: > 0 } errors)
{
<div class="neg sm kh-prewrap">@errors</div>
}
</td>
<td class="kh-acts"><KhIconButton Icon="download" Text="@n.FileName" Disabled="_busy" OnClick="() => NotificationAsync(n.Id)" /></td>
</tr>
}
@@ -425,7 +438,8 @@
_report.Clear();
foreach (var (doc, generation, sending) in results)
{
var title = doc is null ? string.Empty : SalesScreens.KindName(T, doc.Kind) + " " + doc.Number;
var title = doc is not null ? SalesScreens.KindName(T, doc.Kind) + " " + doc.Number
: generation.Invoice is { } made ? SalesScreens.KindName(T, made.Kind) + " " + made.DocumentNumber : string.Empty;
if (!generation.Success)
{
_report.Add((false, title, EInvoicingScreens.Problems(T, generation.Problems)));
@@ -25,7 +25,7 @@
</div>
</div>
<KhPanel Tight="true">
<KhPanel Tight="true" Class="kh-sdi-panel">
<div class="filters kh-ledger-filters">
<input type="search" class="in kh-searchbox" placeholder="@T["EInvoicing.Inbox.Search"]" aria-label="@T["EInvoicing.Inbox.Search"]" value="@_search" @onchange="SearchAsync" />
<KhSelect TValue="InboxFileStatus?" Label="@T["EInvoicing.Fields.Status"]" Name="istatus" Options="Statuses" Empty="@T["EInvoicing.All"]" Value="_status" ValueChanged="SetStatusAsync" />
@@ -55,7 +55,7 @@
<td><KhBadge Tone="@ToneOf(n)">@n.Code</KhBadge> <span class="sm">@T["EInvoicing.Codes." + n.Code]</span></td>
<td class="code">@n.InvoiceFileName</td>
<td class="code">@n.ExchangeId</td>
<td class="kh-w260"><span class="muted sm" title="@n.Description">@n.Description</span></td>
<td class="kh-w260"><span class="@(n.Errors is { Length: > 0 } ? "neg" : "muted") sm" title="@(n.Errors ?? n.Description)">@(n.Errors ?? n.Description)</span></td>
<td class="kh-acts"><KhIconButton Icon="download" Text="@n.FileName" Disabled="_busy" OnClick="() => DownloadAsync(n.Id)" /></td>
</tr>
}
@@ -95,7 +95,7 @@
await Session.EnsureLoadedAsync();
var today = DateOnly.FromDateTime(Clock.GetLocalNow().DateTime);
_to = today;
_from = today.AddDays(-90);
_from = new DateOnly(today.Year, 1, 1);
if (EInvoiceGuard.Allowed(Session, EInvoicePermissions.Read))
{
await LoadAsync();
+4
View File
@@ -482,3 +482,7 @@ h1[tabindex="-1"]:focus { outline: none; box-shadow: none; }
.kh-sdi-report { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; max-height: 60vh; overflow: auto; }
.kh-sdi-report li { display: flex; gap: 8px; align-items: flex-start; }
.kh-sdi-report li.ok > svg { color: var(--kh-ok); } .kh-sdi-report li.no > svg { color: var(--kh-err); }
.kh-headacts { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.kh-sdi-panel .gridwrap { flex: none; }
.kh-sdi-panel .kh-searchbox { flex: 1; width: auto; min-width: 220px; }
.kh-prewrap { white-space: pre-wrap; }