iobroker.e-invoices 0.8.0 → 0.8.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +64 -9
- package/build/lib/api-server.js +15 -7
- package/build/lib/api-server.js.map +2 -2
- package/io-package.json +27 -1
- package/package.json +1 -1
- package/www/assets/index-B4qb37lK.css +1 -0
- package/www/assets/index-Dpe2izSm.js +536 -0
- package/www/index.html +2 -2
- package/www/sw.js +1 -1
- package/www/assets/index-0cend9Vv.css +0 -1
- package/www/assets/index-BhTvcEA0.js +0 -485
package/README.md
CHANGED
|
@@ -49,10 +49,12 @@ network.
|
|
|
49
49
|
|
|
50
50
|
### PWA
|
|
51
51
|
|
|
52
|
-
Open `http://<iobroker-host>:8093/` for the invoice dashboard, the
|
|
53
|
-
multi-step wizard (seller → buyer → lines → review), invoice
|
|
54
|
-
validation, attachments and downloads, layout templates with PDF
|
|
55
|
-
backups and a status page.
|
|
52
|
+
Open `http://<iobroker-host>:8093/` for the invoice dashboard, the offers tab
|
|
53
|
+
("Angebote"), the multi-step wizard (seller → buyer → lines → review), invoice
|
|
54
|
+
details with validation, attachments and downloads, layout templates with PDF
|
|
55
|
+
preview, backups and a status page. The header bar carries the tabs only — the
|
|
56
|
+
"+ Neu" buttons sit where their lists are, and the status page names the app
|
|
57
|
+
next to the version and the schema.
|
|
56
58
|
|
|
57
59
|
### Attachments (Anlagen)
|
|
58
60
|
|
|
@@ -111,11 +113,23 @@ only offers with `GET /api/invoices?docType=quote`.
|
|
|
111
113
|
overrides that — and a second open converted draft is refused. The offer
|
|
112
114
|
itself is never touched.
|
|
113
115
|
- **Not revenue:** offers are never dunned and stay out of the accounting
|
|
114
|
-
exports
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
116
|
+
exports. CSV, DATEV and XLSX only export invoices unless the caller asks
|
|
117
|
+
otherwise: without a `docType` parameter they are pinned to invoices, the
|
|
118
|
+
explicit counter-word is `?docType=all` (and `?docType=quote` exports the
|
|
119
|
+
offers alone).
|
|
120
|
+
|
|
121
|
+
In the PWA, offers have their own tab (**Angebote**): the list shows the state
|
|
122
|
+
(open, accepted, rejected, expired), records the customer's answer and turns an
|
|
123
|
+
accepted offer into an invoice draft in one click ("In Rechnung umwandeln").
|
|
124
|
+
"+ Neues Angebot" opens the wizard with the document type preselected — the same
|
|
125
|
+
wizard as for invoices, without the invoice-only fields: no "Fällig am", no
|
|
126
|
+
Skonto, no payment terms, but a "Gültig bis" date that follows the issue date
|
|
127
|
+
(30 days) while it stays untouched. An invoice draft made from an offer links
|
|
128
|
+
back ("Zugrunde liegendes Angebot"), and the offer lists the invoices it became.
|
|
129
|
+
The wording of every screen comes from one table per document type
|
|
130
|
+
(`src-www/src/labels.ts`), which mirrors the server's `documentLabels()` — no
|
|
131
|
+
offer screen says "Rechnung". The booking list and the three accounting exports
|
|
132
|
+
stay pinned to `docType=invoice`, so the two document types never mix.
|
|
119
133
|
|
|
120
134
|
### States
|
|
121
135
|
|
|
@@ -242,6 +256,47 @@ validation and hybrid embedding, `pdfkit`, `exceljs`, `jszip`,
|
|
|
242
256
|
-->
|
|
243
257
|
### **WORK IN PROGRESS**
|
|
244
258
|
|
|
259
|
+
### 0.8.2 (2026-10-01)
|
|
260
|
+
* (alex) The header bar carries the tabs and nothing else now: the "+ Neu" button
|
|
261
|
+
moved to the lists it creates records for (the invoice dashboard and the offers
|
|
262
|
+
tab own theirs), and the app names itself on the status page, next to the
|
|
263
|
+
version and the schema, instead of in the navigation.
|
|
264
|
+
* (alex) The accounting exports decide the document type themselves: CSV, DATEV
|
|
265
|
+
and XLSX are pinned to invoices even when the caller sends no `docType` at all
|
|
266
|
+
(the dashboard buttons keep sending `docType=invoice`), `?docType=all` exports
|
|
267
|
+
both types and `?docType=quote` only the offers. One helper (`docTypeFilter()`)
|
|
268
|
+
carries the rule; the invoice list route shares it without a fallback of its own.
|
|
269
|
+
* (alex) The offer suite of the browser tests covers the rest of the life cycle:
|
|
270
|
+
the "no" of a customer together with the sent mark, the batch issue of the
|
|
271
|
+
drafts a search shows, the accepted offer that becomes two invoices (a second
|
|
272
|
+
draft is refused while the first is open and allowed once it is issued) and the
|
|
273
|
+
offer that ran out of time ("Verfallen", which can still be accepted). Coverage:
|
|
274
|
+
`npm run test:ts` 181, `npm run test:api` 41, `npm run test:pwa` 21,
|
|
275
|
+
`npm run test:e2e` 17, lint and `tsc` clean.
|
|
276
|
+
|
|
277
|
+
### 0.8.1 (2026-10-01)
|
|
278
|
+
* (alex) Offers are part of the PWA now: the new tab "Angebote" lists them with
|
|
279
|
+
their state (open, accepted, rejected, expired), records the answer of the
|
|
280
|
+
customer with a reason and turns an accepted offer into an invoice draft in one
|
|
281
|
+
click. "+ Neues Angebot" opens the wizard with the document type preselected —
|
|
282
|
+
the same steps as an invoice, only the payment due date, the cash discount and
|
|
283
|
+
the payment terms are replaced by the validity date ("Gültig bis"), which
|
|
284
|
+
follows the issue date (30 days) while it has not been touched.
|
|
285
|
+
* (alex) The interface speaks the language of the document it shows: one table
|
|
286
|
+
per document type (`src-www/src/labels.ts`, mirroring `documentLabels()` and
|
|
287
|
+
the quotation life cycle of the server) replaces the hard-wired "Rechnung", the
|
|
288
|
+
detail page carries accept, reject and convert and prints the decision the way
|
|
289
|
+
the sight PDF does. Offer and invoice link to each other in both directions
|
|
290
|
+
("Zugrunde liegendes Angebot" / "Daraus hervorgegangene Rechnung(en)"; the
|
|
291
|
+
invoice list gained a `sourceDocumentId` filter for that).
|
|
292
|
+
* (alex) The booking list and the accounting exports never carry an offer: the
|
|
293
|
+
dashboard and its XLSX/CSV/DATEV buttons pin `docType=invoice`, so the document
|
|
294
|
+
type is no longer left to the caller. Coverage: a browser test walks the whole
|
|
295
|
+
chain (wizard → issue → accept → convert → export) and checks that the
|
|
296
|
+
A-number stays out of the list and out of the CSV — `npm run test:ts` 181,
|
|
297
|
+
`npm run test:api` 41, `npm run test:pwa` 18, `npm run test:e2e` 13, lint and
|
|
298
|
+
`tsc` clean.
|
|
299
|
+
|
|
245
300
|
### 0.8.0 (2026-10-01)
|
|
246
301
|
* (alex) The adapter knows a second document type: offers ("Angebote"). The
|
|
247
302
|
document type is data now (`doc_type`: `invoice` | `quote`, migration v12) —
|
package/build/lib/api-server.js
CHANGED
|
@@ -52,11 +52,18 @@ var import_pdf = require("./pdf");
|
|
|
52
52
|
var import_templates = require("./templates");
|
|
53
53
|
var import_validation = require("./validation");
|
|
54
54
|
var import_zugferd = require("./zugferd");
|
|
55
|
-
function
|
|
55
|
+
function docTypeFilter(query, fallback) {
|
|
56
|
+
const raw = (typeof query.docType === "string" ? query.docType : "").trim().toLowerCase();
|
|
57
|
+
if (raw === "all") {
|
|
58
|
+
return void 0;
|
|
59
|
+
}
|
|
60
|
+
return raw ? (0, import_invoice_model.normalizeDocumentType)(raw) : fallback;
|
|
61
|
+
}
|
|
62
|
+
function filteredInvoices(db, query, fallbackDocType) {
|
|
56
63
|
const status = typeof query.status === "string" ? query.status : void 0;
|
|
57
64
|
const year = typeof query.year === "string" ? Number(query.year) : void 0;
|
|
58
65
|
const text = typeof query.q === "string" ? query.q : void 0;
|
|
59
|
-
const docType =
|
|
66
|
+
const docType = docTypeFilter(query, fallbackDocType);
|
|
60
67
|
return db.listInvoices({
|
|
61
68
|
status: status && ["draft", "issued", "cancelled"].includes(status) ? status : void 0,
|
|
62
69
|
year: Number.isInteger(year) ? year : void 0,
|
|
@@ -309,8 +316,9 @@ function createApiServer(deps) {
|
|
|
309
316
|
const query = typeof req.query.q === "string" ? req.query.q : void 0;
|
|
310
317
|
const limit = typeof req.query.limit === "string" ? Number(req.query.limit) : void 0;
|
|
311
318
|
const offset = typeof req.query.offset === "string" ? Number(req.query.offset) : void 0;
|
|
312
|
-
const docType =
|
|
313
|
-
|
|
319
|
+
const docType = docTypeFilter(req.query);
|
|
320
|
+
const sourceDocumentId = typeof req.query.sourceDocumentId === "string" ? req.query.sourceDocumentId : void 0;
|
|
321
|
+
res.json(db.listInvoices({ status, year, docType, sourceDocumentId, query, limit, offset }));
|
|
314
322
|
})
|
|
315
323
|
);
|
|
316
324
|
app.post(
|
|
@@ -339,7 +347,7 @@ function createApiServer(deps) {
|
|
|
339
347
|
app.get("/api/invoices/export.csv", (req, res) => {
|
|
340
348
|
res.type("text/csv; charset=utf-8");
|
|
341
349
|
res.set("Content-Disposition", 'attachment; filename="rechnungen.csv"');
|
|
342
|
-
res.send((0, import_csv.renderInvoiceListCsv)(filteredInvoices(db, req.query)));
|
|
350
|
+
res.send((0, import_csv.renderInvoiceListCsv)(filteredInvoices(db, req.query, "invoice")));
|
|
343
351
|
});
|
|
344
352
|
app.get("/api/invoices/export.datev", (req, res) => {
|
|
345
353
|
var _a2, _b2, _c2;
|
|
@@ -348,10 +356,10 @@ function createApiServer(deps) {
|
|
|
348
356
|
res.type("text/plain; charset=iso-8859-1");
|
|
349
357
|
res.set("Content-Disposition", 'attachment; filename="rechnungen.datev"');
|
|
350
358
|
res.send(`${head}
|
|
351
|
-
${(0, import_csv.renderDatevRows)(filteredInvoices(db, req.query))}`);
|
|
359
|
+
${(0, import_csv.renderDatevRows)(filteredInvoices(db, req.query, "invoice"))}`);
|
|
352
360
|
});
|
|
353
361
|
app.get("/api/invoices/export.xlsx", (req, res) => {
|
|
354
|
-
const invoices = filteredInvoices(db, req.query);
|
|
362
|
+
const invoices = filteredInvoices(db, req.query, "invoice");
|
|
355
363
|
const stamp = (/* @__PURE__ */ new Date()).toISOString().slice(0, 10);
|
|
356
364
|
void (0, import_excel.renderInvoiceListWorkbook)(invoices, `Rechnungs\xFCbersicht ${stamp}`).then(
|
|
357
365
|
(buffer) => {
|