@endora-commerce/mod-invoices 0.108.0 → 0.110.0
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/dist/admin/pages/InvoiceDetail.d.ts.map +1 -1
- package/dist/admin/pages/InvoiceDetail.js +1 -1
- package/dist/admin/pages/InvoiceDetail.js.map +1 -1
- package/dist/admin/templates/invoice-puck-config.d.ts.map +1 -1
- package/dist/admin/templates/invoice-puck-config.js +227 -135
- package/dist/admin/templates/invoice-puck-config.js.map +1 -1
- package/dist/backend/document/block-descriptions.d.ts.map +1 -1
- package/dist/backend/document/block-descriptions.js +2 -0
- package/dist/backend/document/block-descriptions.js.map +1 -1
- package/dist/backend/document/invoice-document-type.d.ts +6 -1
- package/dist/backend/document/invoice-document-type.d.ts.map +1 -1
- package/dist/backend/document/invoice-document-type.js +25 -1
- package/dist/backend/document/invoice-document-type.js.map +1 -1
- package/dist/backend/entities/invoice-line.entity.d.ts +18 -1
- package/dist/backend/entities/invoice-line.entity.d.ts.map +1 -1
- package/dist/backend/entities/invoice-line.entity.js +20 -0
- package/dist/backend/entities/invoice-line.entity.js.map +1 -1
- package/dist/backend/index.d.ts.map +1 -1
- package/dist/backend/index.js +36 -4
- package/dist/backend/index.js.map +1 -1
- package/dist/backend/invoices-prose.d.ts +65 -0
- package/dist/backend/invoices-prose.d.ts.map +1 -0
- package/dist/backend/invoices-prose.js +80 -0
- package/dist/backend/invoices-prose.js.map +1 -0
- package/dist/backend/pdf-components/embed-logo-images.d.ts.map +1 -1
- package/dist/backend/pdf-components/embed-logo-images.js +2 -15
- package/dist/backend/pdf-components/embed-logo-images.js.map +1 -1
- package/dist/backend/pdf-components/sample.d.ts.map +1 -1
- package/dist/backend/pdf-components/sample.js +1 -0
- package/dist/backend/pdf-components/sample.js.map +1 -1
- package/dist/backend/pdf-components/sections.d.ts +22 -6
- package/dist/backend/pdf-components/sections.d.ts.map +1 -1
- package/dist/backend/pdf-components/sections.js +70 -37
- package/dist/backend/pdf-components/sections.js.map +1 -1
- package/dist/backend/pdf-components/tree-mapper.d.ts +3 -0
- package/dist/backend/pdf-components/tree-mapper.d.ts.map +1 -1
- package/dist/backend/pdf-components/tree-mapper.js +5 -5
- package/dist/backend/pdf-components/tree-mapper.js.map +1 -1
- package/dist/backend/plugin.d.ts +13 -1
- package/dist/backend/plugin.d.ts.map +1 -1
- package/dist/backend/plugin.js +4 -2
- package/dist/backend/plugin.js.map +1 -1
- package/dist/backend/routes.customer.d.ts +3 -3
- package/dist/backend/routes.customer.d.ts.map +1 -1
- package/dist/backend/routes.customer.js +17 -9
- package/dist/backend/routes.customer.js.map +1 -1
- package/dist/backend/seeds/generic-invoice-template.d.ts +13 -7
- package/dist/backend/seeds/generic-invoice-template.d.ts.map +1 -1
- package/dist/backend/seeds/generic-invoice-template.js +36 -19
- package/dist/backend/seeds/generic-invoice-template.js.map +1 -1
- package/dist/backend/services/auto-issue-reactor.d.ts.map +1 -1
- package/dist/backend/services/auto-issue-reactor.js +6 -2
- package/dist/backend/services/auto-issue-reactor.js.map +1 -1
- package/dist/backend/services/corrective-invoice.d.ts +167 -16
- package/dist/backend/services/corrective-invoice.d.ts.map +1 -1
- package/dist/backend/services/corrective-invoice.js +389 -52
- package/dist/backend/services/corrective-invoice.js.map +1 -1
- package/dist/backend/services/cross-module-context.d.ts +7 -0
- package/dist/backend/services/cross-module-context.d.ts.map +1 -1
- package/dist/backend/services/cross-module-context.js +19 -0
- package/dist/backend/services/cross-module-context.js.map +1 -1
- package/dist/backend/services/invoice-copy-host.service.d.ts.map +1 -1
- package/dist/backend/services/invoice-copy-host.service.js +3 -0
- package/dist/backend/services/invoice-copy-host.service.js.map +1 -1
- package/dist/backend/services/invoice-email-dispatch.d.ts +7 -0
- package/dist/backend/services/invoice-email-dispatch.d.ts.map +1 -1
- package/dist/backend/services/invoice-email-dispatch.js +10 -3
- package/dist/backend/services/invoice-email-dispatch.js.map +1 -1
- package/dist/backend/services/invoice-line-builder.d.ts +4 -0
- package/dist/backend/services/invoice-line-builder.d.ts.map +1 -1
- package/dist/backend/services/invoice-line-builder.js +1 -0
- package/dist/backend/services/invoice-line-builder.js.map +1 -1
- package/dist/backend/services/invoice-paid.d.ts +56 -0
- package/dist/backend/services/invoice-paid.d.ts.map +1 -0
- package/dist/backend/services/invoice-paid.js +74 -0
- package/dist/backend/services/invoice-paid.js.map +1 -0
- package/dist/backend/services/invoice-service.d.ts +53 -2
- package/dist/backend/services/invoice-service.d.ts.map +1 -1
- package/dist/backend/services/invoice-service.js +135 -29
- package/dist/backend/services/invoice-service.js.map +1 -1
- package/dist/backend/services/kept-quantities.d.ts +24 -0
- package/dist/backend/services/kept-quantities.d.ts.map +1 -0
- package/dist/backend/services/kept-quantities.js +32 -0
- package/dist/backend/services/kept-quantities.js.map +1 -0
- package/dist/backend/services/order-returns-lock.d.ts +19 -0
- package/dist/backend/services/order-returns-lock.d.ts.map +1 -0
- package/dist/backend/services/order-returns-lock.js +37 -0
- package/dist/backend/services/order-returns-lock.js.map +1 -0
- package/dist/manifest.d.ts +11 -3
- package/dist/manifest.d.ts.map +1 -1
- package/dist/manifest.js +14 -1
- package/dist/manifest.js.map +1 -1
- package/dist/migrations/20261108T073244_invoices_invoice_line_kind.d.ts +21 -0
- package/dist/migrations/20261108T073244_invoices_invoice_line_kind.d.ts.map +1 -0
- package/dist/migrations/20261108T073244_invoices_invoice_line_kind.js +28 -0
- package/dist/migrations/20261108T073244_invoices_invoice_line_kind.js.map +1 -0
- package/dist/migrations/index.d.ts +2 -1
- package/dist/migrations/index.d.ts.map +1 -1
- package/dist/migrations/index.js +3 -1
- package/dist/migrations/index.js.map +1 -1
- package/docs/invoices.md +120 -12
- package/i18n/en.json +41 -2
- package/i18n/pl.json +41 -2
- package/package.json +16 -16
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Migration } from '@mikro-orm/migrations';
|
|
2
|
+
/**
|
|
3
|
+
* Issue #904, Phase A — `invoice_lines.line_kind`: what a line is, one of
|
|
4
|
+
* `goods`, `delivery`, `payment_surcharge`, `discount` or `price_reduction`.
|
|
5
|
+
*
|
|
6
|
+
* A charge line used to be told apart from the discount line by having no
|
|
7
|
+
* `order_item_id` and by its sign. Once delivery and the payment surcharge
|
|
8
|
+
* carry the goods' VAT, a charge line sits inside a goods rate's row, and the
|
|
9
|
+
* per-rate maths of a correction has to tell it from a goods line at the same
|
|
10
|
+
* rate: the kind has to be stated, not inferred.
|
|
11
|
+
*
|
|
12
|
+
* Written for every line of an invoice or a proforma issued from now on, the
|
|
13
|
+
* 0 % charge lines included. Nullable, no backfill: `null` is a line issued
|
|
14
|
+
* before (or a line no writer has named yet), read by the inference it always
|
|
15
|
+
* was — an issued document is never rewritten.
|
|
16
|
+
*/
|
|
17
|
+
export declare class Migration20261108T073244InvoicesInvoiceLineKind extends Migration {
|
|
18
|
+
up(): Promise<void>;
|
|
19
|
+
down(): Promise<void>;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=20261108T073244_invoices_invoice_line_kind.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"20261108T073244_invoices_invoice_line_kind.d.ts","sourceRoot":"","sources":["../../src/migrations/20261108T073244_invoices_invoice_line_kind.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAElD;;;;;;;;;;;;;;GAcG;AACH,qBAAa,+CAAgD,SAAQ,SAAS;IAC7D,EAAE,IAAI,OAAO,CAAC,IAAI,CAAC;IAQnB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;CAIrC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Migration } from '@mikro-orm/migrations';
|
|
2
|
+
/**
|
|
3
|
+
* Issue #904, Phase A — `invoice_lines.line_kind`: what a line is, one of
|
|
4
|
+
* `goods`, `delivery`, `payment_surcharge`, `discount` or `price_reduction`.
|
|
5
|
+
*
|
|
6
|
+
* A charge line used to be told apart from the discount line by having no
|
|
7
|
+
* `order_item_id` and by its sign. Once delivery and the payment surcharge
|
|
8
|
+
* carry the goods' VAT, a charge line sits inside a goods rate's row, and the
|
|
9
|
+
* per-rate maths of a correction has to tell it from a goods line at the same
|
|
10
|
+
* rate: the kind has to be stated, not inferred.
|
|
11
|
+
*
|
|
12
|
+
* Written for every line of an invoice or a proforma issued from now on, the
|
|
13
|
+
* 0 % charge lines included. Nullable, no backfill: `null` is a line issued
|
|
14
|
+
* before (or a line no writer has named yet), read by the inference it always
|
|
15
|
+
* was — an issued document is never rewritten.
|
|
16
|
+
*/
|
|
17
|
+
export class Migration20261108T073244InvoicesInvoiceLineKind extends Migration {
|
|
18
|
+
async up() {
|
|
19
|
+
this.addSql('alter table "invoice_lines" add column if not exists "line_kind" varchar(24) null;');
|
|
20
|
+
this.addSql('alter table "invoice_lines" drop constraint if exists "invoice_lines_line_kind_check";');
|
|
21
|
+
this.addSql(`alter table "invoice_lines" add constraint "invoice_lines_line_kind_check" check ("line_kind" is null or "line_kind" in ('goods', 'delivery', 'payment_surcharge', 'discount', 'price_reduction'));`);
|
|
22
|
+
}
|
|
23
|
+
async down() {
|
|
24
|
+
this.addSql('alter table "invoice_lines" drop constraint if exists "invoice_lines_line_kind_check";');
|
|
25
|
+
this.addSql('alter table "invoice_lines" drop column if exists "line_kind";');
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=20261108T073244_invoices_invoice_line_kind.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"20261108T073244_invoices_invoice_line_kind.js","sourceRoot":"","sources":["../../src/migrations/20261108T073244_invoices_invoice_line_kind.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAElD;;;;;;;;;;;;;;GAcG;AACH,MAAM,OAAO,+CAAgD,SAAQ,SAAS;IACnE,KAAK,CAAC,EAAE;QACf,IAAI,CAAC,MAAM,CAAC,oFAAoF,CAAC,CAAC;QAClG,IAAI,CAAC,MAAM,CAAC,wFAAwF,CAAC,CAAC;QACtG,IAAI,CAAC,MAAM,CACT,qMAAqM,CACtM,CAAC;IACJ,CAAC;IAEQ,KAAK,CAAC,IAAI;QACjB,IAAI,CAAC,MAAM,CAAC,wFAAwF,CAAC,CAAC;QACtG,IAAI,CAAC,MAAM,CAAC,gEAAgE,CAAC,CAAC;IAChF,CAAC;CACF"}
|
|
@@ -29,6 +29,7 @@ import { Migration20260914T133603InvoicesErpImportedSaleDocuments } from './2026
|
|
|
29
29
|
import { Migration20260926T230239InvoicesImportIdentity } from './20260926T230239_invoices_import_identity.js';
|
|
30
30
|
import { Migration20261017T075839InvoicesDropInvoiceTemplates } from './20261017T075839_invoices_drop_invoice_templates.js';
|
|
31
31
|
import { Migration20261024T145631InvoicesVatSummary } from './20261024T145631_invoices_vat_summary.js';
|
|
32
|
+
import { Migration20261108T073244InvoicesInvoiceLineKind } from './20261108T073244_invoices_invoice_line_kind.js';
|
|
32
33
|
export declare const migrations: (typeof Migration20260629T125121InvoicesModule)[];
|
|
33
|
-
export { Migration20260629T125121InvoicesModule, Migration20260801T111000InvoicesGenericTemplateReseed, Migration20260817T201110InvoicesCorrectionIdempotencyKey, Migration20260903T101756InvoicesNamespaceBlockNames, Migration20260914T133603InvoicesErpImportedSaleDocuments, Migration20260926T230239InvoicesImportIdentity, Migration20261017T075839InvoicesDropInvoiceTemplates, Migration20261024T145631InvoicesVatSummary, };
|
|
34
|
+
export { Migration20260629T125121InvoicesModule, Migration20260801T111000InvoicesGenericTemplateReseed, Migration20260817T201110InvoicesCorrectionIdempotencyKey, Migration20260903T101756InvoicesNamespaceBlockNames, Migration20260914T133603InvoicesErpImportedSaleDocuments, Migration20260926T230239InvoicesImportIdentity, Migration20261017T075839InvoicesDropInvoiceTemplates, Migration20261024T145631InvoicesVatSummary, Migration20261108T073244InvoicesInvoiceLineKind, };
|
|
34
35
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/migrations/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAAE,sCAAsC,EAAE,MAAM,sCAAsC,CAAC;AAC9F,OAAO,EAAE,qDAAqD,EAAE,MAAM,uDAAuD,CAAC;AAC9H,OAAO,EAAE,wDAAwD,EAAE,MAAM,0DAA0D,CAAC;AACpI,OAAO,EAAE,mDAAmD,EAAE,MAAM,qDAAqD,CAAC;AAC1H,OAAO,EAAE,wDAAwD,EAAE,MAAM,2DAA2D,CAAC;AACrI,OAAO,EAAE,8CAA8C,EAAE,MAAM,+CAA+C,CAAC;AAC/G,OAAO,EAAE,oDAAoD,EAAE,MAAM,sDAAsD,CAAC;AAC5H,OAAO,EAAE,0CAA0C,EAAE,MAAM,2CAA2C,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/migrations/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAAE,sCAAsC,EAAE,MAAM,sCAAsC,CAAC;AAC9F,OAAO,EAAE,qDAAqD,EAAE,MAAM,uDAAuD,CAAC;AAC9H,OAAO,EAAE,wDAAwD,EAAE,MAAM,0DAA0D,CAAC;AACpI,OAAO,EAAE,mDAAmD,EAAE,MAAM,qDAAqD,CAAC;AAC1H,OAAO,EAAE,wDAAwD,EAAE,MAAM,2DAA2D,CAAC;AACrI,OAAO,EAAE,8CAA8C,EAAE,MAAM,+CAA+C,CAAC;AAC/G,OAAO,EAAE,oDAAoD,EAAE,MAAM,sDAAsD,CAAC;AAC5H,OAAO,EAAE,0CAA0C,EAAE,MAAM,2CAA2C,CAAC;AACvG,OAAO,EAAE,+CAA+C,EAAE,MAAM,iDAAiD,CAAC;AAElH,eAAO,MAAM,UAAU,mDAUtB,CAAC;AAEF,OAAO,EACL,sCAAsC,EACtC,qDAAqD,EACrD,wDAAwD,EACxD,mDAAmD,EACnD,wDAAwD,EACxD,8CAA8C,EAC9C,oDAAoD,EACpD,0CAA0C,EAC1C,+CAA+C,GAChD,CAAC"}
|
package/dist/migrations/index.js
CHANGED
|
@@ -29,6 +29,7 @@ import { Migration20260914T133603InvoicesErpImportedSaleDocuments } from './2026
|
|
|
29
29
|
import { Migration20260926T230239InvoicesImportIdentity } from './20260926T230239_invoices_import_identity.js';
|
|
30
30
|
import { Migration20261017T075839InvoicesDropInvoiceTemplates } from './20261017T075839_invoices_drop_invoice_templates.js';
|
|
31
31
|
import { Migration20261024T145631InvoicesVatSummary } from './20261024T145631_invoices_vat_summary.js';
|
|
32
|
+
import { Migration20261108T073244InvoicesInvoiceLineKind } from './20261108T073244_invoices_invoice_line_kind.js';
|
|
32
33
|
export const migrations = [
|
|
33
34
|
Migration20260629T125121InvoicesModule,
|
|
34
35
|
Migration20260801T111000InvoicesGenericTemplateReseed,
|
|
@@ -38,6 +39,7 @@ export const migrations = [
|
|
|
38
39
|
Migration20260926T230239InvoicesImportIdentity,
|
|
39
40
|
Migration20261017T075839InvoicesDropInvoiceTemplates,
|
|
40
41
|
Migration20261024T145631InvoicesVatSummary,
|
|
42
|
+
Migration20261108T073244InvoicesInvoiceLineKind,
|
|
41
43
|
];
|
|
42
|
-
export { Migration20260629T125121InvoicesModule, Migration20260801T111000InvoicesGenericTemplateReseed, Migration20260817T201110InvoicesCorrectionIdempotencyKey, Migration20260903T101756InvoicesNamespaceBlockNames, Migration20260914T133603InvoicesErpImportedSaleDocuments, Migration20260926T230239InvoicesImportIdentity, Migration20261017T075839InvoicesDropInvoiceTemplates, Migration20261024T145631InvoicesVatSummary, };
|
|
44
|
+
export { Migration20260629T125121InvoicesModule, Migration20260801T111000InvoicesGenericTemplateReseed, Migration20260817T201110InvoicesCorrectionIdempotencyKey, Migration20260903T101756InvoicesNamespaceBlockNames, Migration20260914T133603InvoicesErpImportedSaleDocuments, Migration20260926T230239InvoicesImportIdentity, Migration20261017T075839InvoicesDropInvoiceTemplates, Migration20261024T145631InvoicesVatSummary, Migration20261108T073244InvoicesInvoiceLineKind, };
|
|
43
45
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/migrations/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAAE,sCAAsC,EAAE,MAAM,sCAAsC,CAAC;AAC9F,OAAO,EAAE,qDAAqD,EAAE,MAAM,uDAAuD,CAAC;AAC9H,OAAO,EAAE,wDAAwD,EAAE,MAAM,0DAA0D,CAAC;AACpI,OAAO,EAAE,mDAAmD,EAAE,MAAM,qDAAqD,CAAC;AAC1H,OAAO,EAAE,wDAAwD,EAAE,MAAM,2DAA2D,CAAC;AACrI,OAAO,EAAE,8CAA8C,EAAE,MAAM,+CAA+C,CAAC;AAC/G,OAAO,EAAE,oDAAoD,EAAE,MAAM,sDAAsD,CAAC;AAC5H,OAAO,EAAE,0CAA0C,EAAE,MAAM,2CAA2C,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/migrations/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAAE,sCAAsC,EAAE,MAAM,sCAAsC,CAAC;AAC9F,OAAO,EAAE,qDAAqD,EAAE,MAAM,uDAAuD,CAAC;AAC9H,OAAO,EAAE,wDAAwD,EAAE,MAAM,0DAA0D,CAAC;AACpI,OAAO,EAAE,mDAAmD,EAAE,MAAM,qDAAqD,CAAC;AAC1H,OAAO,EAAE,wDAAwD,EAAE,MAAM,2DAA2D,CAAC;AACrI,OAAO,EAAE,8CAA8C,EAAE,MAAM,+CAA+C,CAAC;AAC/G,OAAO,EAAE,oDAAoD,EAAE,MAAM,sDAAsD,CAAC;AAC5H,OAAO,EAAE,0CAA0C,EAAE,MAAM,2CAA2C,CAAC;AACvG,OAAO,EAAE,+CAA+C,EAAE,MAAM,iDAAiD,CAAC;AAElH,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,sCAAsC;IACtC,qDAAqD;IACrD,wDAAwD;IACxD,mDAAmD;IACnD,wDAAwD;IACxD,8CAA8C;IAC9C,oDAAoD;IACpD,0CAA0C;IAC1C,+CAA+C;CAChD,CAAC;AAEF,OAAO,EACL,sCAAsC,EACtC,qDAAqD,EACrD,wDAAwD,EACxD,mDAAmD,EACnD,wDAAwD,EACxD,8CAA8C,EAC9C,oDAAoD,EACpD,0CAA0C,EAC1C,+CAA+C,GAChD,CAAC"}
|
package/docs/invoices.md
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
---
|
|
2
|
-
title:
|
|
2
|
+
title: Invoices
|
|
3
3
|
description: PDF invoice / proforma generation + asset linkage
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
# `invoices`
|
|
6
|
+
# Invoices (`invoices`)
|
|
7
7
|
|
|
8
8
|
Generates proforma and final invoice PDFs, registers them under the
|
|
9
9
|
`assets` module, and links them from the originating Order.
|
|
@@ -36,23 +36,131 @@ price this precisely: the VAT Act names the unit net price without fixing its de
|
|
|
36
36
|
|
|
37
37
|
### What a VAT invoice records as paid, and when it is not issued
|
|
38
38
|
|
|
39
|
-
A VAT invoice records as paid what was
|
|
40
|
-
captured payment attempt less
|
|
39
|
+
A VAT invoice records as paid what was received for the order and kept:
|
|
40
|
+
each captured payment attempt, less everything refunded. An order recorded as
|
|
41
41
|
paid with nothing captured (a confirmed bank transfer), or with `payments`
|
|
42
|
-
absent,
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
42
|
+
absent, was received in its stored total. An order on credit terms is unpaid by
|
|
43
|
+
arrangement when it is invoiced, and nothing of it is counted as paid.
|
|
44
|
+
|
|
45
|
+
Every refund counts once, whichever way it was made:
|
|
46
|
+
|
|
47
|
+
- a refund through the payment gateway, as `payments` recorded it;
|
|
48
|
+
- a return settled with a **refund by bank transfer** (any order not paid
|
|
49
|
+
through a gateway — the operator makes the transfer) or with a **credit to
|
|
50
|
+
the credit limit**, as the return recorded it. A refund still waiting for a
|
|
51
|
+
person to make it is not counted;
|
|
52
|
+
- an order an operator marked as **refunded** was refunded everything that was
|
|
53
|
+
received for it: its whole total when nothing was captured, and what was
|
|
54
|
+
captured otherwise — a refund settled by hand, for example after the gateway
|
|
55
|
+
reported an amount the payment could not record. The mark is never added to
|
|
56
|
+
refunds already recorded: a gateway refund on the payment counts once.
|
|
57
|
+
|
|
58
|
+
With the `returns` module switched off, only the refunds `payments` recorded
|
|
59
|
+
are deducted.
|
|
60
|
+
|
|
61
|
+
An order **refunded in full before it was invoiced** — the refunds equal what
|
|
62
|
+
was received and cover the whole order total — is not invoiced: there is no
|
|
63
|
+
sale left to document. Issuing answers `422 INVOICE_ORDER_REFUNDED` and draws
|
|
64
|
+
no number; automatic issuance skips the order and logs the reason. An order
|
|
65
|
+
refunded only in part is invoiced, with what was kept as paid. An order
|
|
66
|
+
**returned in full** before it was invoiced — every product line back through
|
|
67
|
+
settled returns, and no delivery or payment surcharge kept — counts the same,
|
|
68
|
+
whether or not the refund has been paid out yet (one still waiting for a person
|
|
69
|
+
to make it, or for the payment gateway to confirm it). When the delivery or the
|
|
70
|
+
surcharge is kept, the invoice is issued with only that line. A consumer's
|
|
71
|
+
withdrawal from the whole order refunds both (see *Returns*), so a B2C order
|
|
72
|
+
returned in full usually has nothing left and is refused. A delivery the
|
|
73
|
+
operator reduced to the standard price leaves the difference, which is invoiced
|
|
74
|
+
alone.
|
|
75
|
+
|
|
76
|
+
An invoice issued **after a return was settled** lists only what the buyer
|
|
77
|
+
kept: there is no invoice yet to correct, so the invoice itself documents the
|
|
78
|
+
sale that is left. Each order line is invoiced at its ordered quantity less the
|
|
79
|
+
quantity of the order's settled returns (kind *return*, settled with a refund or
|
|
80
|
+
a credit), whether or not the money has been paid out yet; a line returned in
|
|
81
|
+
full is left off. A replacement, a repair and a complaint change no line. The
|
|
82
|
+
delivery and payment-surcharge lines are the order's, less what a consumer's
|
|
83
|
+
withdrawal refunded of them; a line with nothing left is left off. The discount line carries
|
|
84
|
+
only the kept goods' share: the order discount less the part the settled returns
|
|
85
|
+
carried back with their refunds, and it is left off when nothing remains. VAT is
|
|
86
|
+
still calculated per rate on the sum of the nets, so the invoice equals what is
|
|
87
|
+
left paid to the cent. A proforma lists the same kept lines, and is not refused
|
|
88
|
+
for an order refunded in full. With the `returns` module switched off, every
|
|
89
|
+
line is invoiced at its ordered quantity.
|
|
90
|
+
|
|
91
|
+
A **complaint refunded before the order was invoiced** currently shows on the
|
|
92
|
+
invoice as amount due: the invoice lists the goods in full, and the complaint
|
|
93
|
+
refund is deducted from what was paid.
|
|
94
|
+
|
|
95
|
+
### Corrective invoices
|
|
96
|
+
|
|
97
|
+
A return or a complaint settled with a refund or a credit **after** the order
|
|
98
|
+
was invoiced gets a corrective invoice (`kind: correction`), one per case. It
|
|
99
|
+
credits gross amounts, at the VAT rate of the invoice line it corrects, and never
|
|
100
|
+
more than is left of the invoice. A replacement or a repair moves no money and
|
|
101
|
+
issues no correction.
|
|
102
|
+
|
|
103
|
+
**A return** credits the goods that came back. On an invoice issued under the
|
|
104
|
+
per-rate VAT method, the correction is worked out from what the invoice keeps:
|
|
105
|
+
|
|
106
|
+
- When the case refunds its default amount, the invoice keeps, at each rate,
|
|
107
|
+
exactly the VAT on the sum of the nets of the kept quantities: the same
|
|
108
|
+
figures an invoice issued after the return would show. For example, returning
|
|
109
|
+
one unit of 3 × 10.01 net at 23 % (36.94 gross) refunds 12.32, and the
|
|
110
|
+
correction credits 10.01 net and 2.31 VAT, which leaves 20.02 net and 4.60 VAT.
|
|
111
|
+
- When the operator approved a lower amount, the invoice keeps the rest of the
|
|
112
|
+
gross at that rate, split into net and VAT by the same rule. For a few amounts
|
|
113
|
+
no net gives that gross exactly (6.00 of 12.32 at 23 %, for example). The
|
|
114
|
+
correction itself then follows the rule, and what the invoice keeps may differ
|
|
115
|
+
from it by 0.01 at that rate until the next correction. The money is always
|
|
116
|
+
exact.
|
|
117
|
+
- The share of the order discount that the returned goods carried is credited
|
|
118
|
+
back on a 0 % line.
|
|
119
|
+
- The delivery and the payment surcharge are credited only on a consumer's
|
|
120
|
+
withdrawal: the return that completes the withdrawal from a B2C order. Each is
|
|
121
|
+
credited on a line of its own (`lineKind` `delivery` or `payment_surcharge`),
|
|
122
|
+
named like the invoice's line and at its VAT rate (0 % today), for the amount
|
|
123
|
+
the settlement refunded. After a full withdrawal the invoice nets to zero. A
|
|
124
|
+
correction that would credit more of a charge than the invoice still charges
|
|
125
|
+
for it is refused with `422 VALIDATION_FAILED`
|
|
126
|
+
(`code: correction_exceeds_charge_remaining`), before any money moves.
|
|
127
|
+
Business customers' returns never credit them.
|
|
128
|
+
|
|
129
|
+
**A complaint** settled with money is a **price reduction**: the buyer keeps the
|
|
130
|
+
goods, so their price is reduced and no quantity comes back. The correction's
|
|
131
|
+
line is named *Obniżka ceny (reklamacja RMA-…): product* and has quantity 0. Its
|
|
132
|
+
net value is the reduction, and its unit price is the reduction spread over the
|
|
133
|
+
units still on the invoice. It credits no discount, because the discount stays
|
|
134
|
+
with the kept goods, and it does not lower the quantity a later return of the
|
|
135
|
+
same line is credited from. For an integration that reads correction lines: a
|
|
136
|
+
goods line with quantity 0 is a price reduction.
|
|
137
|
+
|
|
138
|
+
A correction that would credit more goods at one VAT rate than the invoice still
|
|
139
|
+
charges at that rate is refused with
|
|
140
|
+
`422 VALIDATION_FAILED` (`code: correction_exceeds_rate_remaining`), before any
|
|
141
|
+
money moves.
|
|
142
|
+
|
|
143
|
+
The **amount due** is the gross less what was paid, and never negative. When
|
|
144
|
+
more was paid than the gross, the amount due is 0 and the invoice states the
|
|
145
|
+
difference as the **overpayment** (`overpayment` in the API, the
|
|
146
|
+
*Overpayment* row on the admin screen, *Nadpłata* on the PDF — the label is a
|
|
147
|
+
setting of the totals block, and the row can be hidden there).
|
|
50
148
|
|
|
51
149
|
## Entities
|
|
52
150
|
|
|
53
151
|
`Invoice` (number, issued/dated timestamps, asset reference,
|
|
54
152
|
`type ∈ {proforma, final}`).
|
|
55
153
|
|
|
154
|
+
`InvoiceLine` (an immutable snapshot of one line at issuance). Its `lineKind`
|
|
155
|
+
says what the line is: `goods`, `delivery`, `payment_surcharge` or `discount`
|
|
156
|
+
on an invoice or a proforma, with `price_reduction` reserved for a
|
|
157
|
+
correction's line. Every line of a document issued from this release records
|
|
158
|
+
it, the 0 % delivery and surcharge lines included; it changes no amount. A line
|
|
159
|
+
issued before, and a correction's goods and discount lines, carry `null` and are
|
|
160
|
+
told apart as before, by whether they name an order line and by their sign. A
|
|
161
|
+
correction's credited delivery or surcharge carries `delivery` or
|
|
162
|
+
`payment_surcharge`.
|
|
163
|
+
|
|
56
164
|
## Numbering
|
|
57
165
|
|
|
58
166
|
Two facts about an invoice number pull in opposite directions, and both are
|
package/i18n/en.json
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"errors.INVOICE_NUMBER_PATTERN_COLLIDES": "This numbering pattern can produce the same document number as another sales channel. Invoice numbers must be unique across the whole platform.",
|
|
16
16
|
"errors.INVOICE_NUMBER_PATTERN_COLLIDES.other_channel": "This numbering pattern can produce the same document number as sales channel \"{channel}\". Invoice numbers are unique across the whole platform, so give this channel a pattern the other one cannot repeat — adding the channel token is the usual way.",
|
|
17
17
|
"errors.INVOICE_NUMBER_PATTERN_COLLIDES.no_sequence_token": "This numbering pattern has no sequence token, so every document in this channel would be given the same number. The field description lists the tokens you can use.",
|
|
18
|
-
"errors.INVOICE_ORDER_REFUNDED": "This order
|
|
18
|
+
"errors.INVOICE_ORDER_REFUNDED": "This order was refunded or returned in full before it was invoiced, so there is no sale left to invoice. Nothing was issued.",
|
|
19
19
|
"errors.INVOICE_NUMBER_ALREADY_ISSUED": "This document number is already in use. Invoice numbers are unique across the whole platform.",
|
|
20
20
|
"errors.INVOICE_NUMBER_ALREADY_ISSUED.other_channel": "Invoice number {number} is already used by sales channel \"{channel}\". Give this channel its own numbering pattern before issuing again — nothing was issued.",
|
|
21
21
|
"errors.INVOICE_NUMBER_ALREADY_ISSUED.same_channel": "Invoice number {number} has already been issued in this sales channel, so its numbering pattern is producing repeats — nothing was issued.",
|
|
@@ -42,5 +42,44 @@
|
|
|
42
42
|
"blocks.invoiceFooter.description": "The legal footer printed at the bottom of the invoice.",
|
|
43
43
|
"blocks.category.invoice": "Invoice sections",
|
|
44
44
|
"documentTypes.invoice.label": "Invoice",
|
|
45
|
-
"documentTypes.invoice.description": "The invoice PDF: downloaded by administrators and customers, and attached to the invoice e-mail."
|
|
45
|
+
"documentTypes.invoice.description": "The invoice PDF: downloaded by administrators and customers, and attached to the invoice e-mail.",
|
|
46
|
+
"pdf.title.invoice": "Invoice",
|
|
47
|
+
"pdf.title.proforma": "Proforma invoice",
|
|
48
|
+
"pdf.title.correction": "Corrective invoice",
|
|
49
|
+
"pdf.title.wz": "Goods dispatch note",
|
|
50
|
+
"pdf.title.numbered": "{title} No. {number}",
|
|
51
|
+
"pdf.label.ksefNumber": "KSeF number",
|
|
52
|
+
"pdf.label.issuedAt": "Issue date",
|
|
53
|
+
"pdf.label.saleDate": "Sale date",
|
|
54
|
+
"pdf.label.paymentDue": "Payment due",
|
|
55
|
+
"pdf.label.paymentMethod": "Payment method",
|
|
56
|
+
"pdf.label.seller": "Seller",
|
|
57
|
+
"pdf.label.buyer": "Buyer",
|
|
58
|
+
"pdf.label.taxId": "Tax ID",
|
|
59
|
+
"pdf.column.ordinal": "No.",
|
|
60
|
+
"pdf.column.name": "Name",
|
|
61
|
+
"pdf.column.unit": "Unit",
|
|
62
|
+
"pdf.column.quantity": "Qty",
|
|
63
|
+
"pdf.column.unitNet": "Net price",
|
|
64
|
+
"pdf.column.taxRate": "Rate",
|
|
65
|
+
"pdf.column.net": "Net value",
|
|
66
|
+
"pdf.column.gross": "Gross value",
|
|
67
|
+
"pdf.vat.rate": "VAT rate",
|
|
68
|
+
"pdf.vat.amount": "VAT amount",
|
|
69
|
+
"pdf.label.total": "Total",
|
|
70
|
+
"pdf.label.paid": "Paid",
|
|
71
|
+
"pdf.label.amountDue": "Amount due",
|
|
72
|
+
"pdf.label.overpayment": "Overpayment",
|
|
73
|
+
"pdf.label.inWords": "In words",
|
|
74
|
+
"pdf.footer.default": "Thank you for your business.\n{{var seller.legalName}} · Tax ID {{var seller.taxId}}",
|
|
75
|
+
"lines.item": "Item",
|
|
76
|
+
"lines.unit.piece": "pcs",
|
|
77
|
+
"lines.unit.service": "svc",
|
|
78
|
+
"lines.delivery": "Delivery",
|
|
79
|
+
"lines.paymentSurcharge": "Payment method surcharge",
|
|
80
|
+
"lines.discount": "Discount",
|
|
81
|
+
"lines.priceReduction": "Price reduction (complaint {rma}): {product}",
|
|
82
|
+
"lines.priceReductionUnreferenced": "Price reduction (complaint): {product}",
|
|
83
|
+
"actions.openInvoices.keywords": "invoices",
|
|
84
|
+
"settingGroups.invoices.name": "Invoices"
|
|
46
85
|
}
|
package/i18n/pl.json
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"errors.INVOICE_NUMBER_PATTERN_COLLIDES": "Ten wzorzec numeracji może wygenerować taki sam numer dokumentu jak inny kanał sprzedaży. Numery faktur muszą być unikalne w całej platformie.",
|
|
16
16
|
"errors.INVOICE_NUMBER_PATTERN_COLLIDES.other_channel": "Ten wzorzec numeracji może wygenerować taki sam numer dokumentu jak kanał sprzedaży \"{channel}\". Numery faktur są unikalne w całej platformie, więc nadaj temu kanałowi wzorzec, którego tamten nie może powtórzyć — zwykle wystarczy dodać token kanału.",
|
|
17
17
|
"errors.INVOICE_NUMBER_PATTERN_COLLIDES.no_sequence_token": "Ten wzorzec numeracji nie zawiera tokenu sekwencji, więc każdy dokument w tym kanale otrzymałby ten sam numer. Dostępne tokeny są wymienione w opisie pola.",
|
|
18
|
-
"errors.INVOICE_ORDER_REFUNDED": "
|
|
18
|
+
"errors.INVOICE_ORDER_REFUNDED": "Za to zamówienie w całości zwrócono pieniądze lub towary przed wystawieniem faktury, więc nie ma sprzedaży do zafakturowania. Niczego nie wystawiono.",
|
|
19
19
|
"errors.INVOICE_NUMBER_ALREADY_ISSUED": "Ten numer dokumentu jest już zajęty. Numery faktur są unikalne w całej platformie.",
|
|
20
20
|
"errors.INVOICE_NUMBER_ALREADY_ISSUED.other_channel": "Numer faktury {number} jest już używany przez kanał sprzedaży \"{channel}\". Nadaj temu kanałowi własny wzorzec numeracji przed ponowną próbą — nic nie zostało wystawione.",
|
|
21
21
|
"errors.INVOICE_NUMBER_ALREADY_ISSUED.same_channel": "Numer faktury {number} został już wystawiony w tym kanale sprzedaży, więc jego wzorzec numeracji generuje powtórzenia — nic nie zostało wystawione.",
|
|
@@ -42,5 +42,44 @@
|
|
|
42
42
|
"blocks.invoiceFooter.description": "Stopka prawna drukowana na dole faktury.",
|
|
43
43
|
"blocks.category.invoice": "Sekcje faktury",
|
|
44
44
|
"documentTypes.invoice.label": "Faktura",
|
|
45
|
-
"documentTypes.invoice.description": "PDF faktury: pobierany przez administratorów i klientów oraz dołączany do e-maila z fakturą."
|
|
45
|
+
"documentTypes.invoice.description": "PDF faktury: pobierany przez administratorów i klientów oraz dołączany do e-maila z fakturą.",
|
|
46
|
+
"pdf.title.invoice": "Faktura",
|
|
47
|
+
"pdf.title.proforma": "Faktura proforma",
|
|
48
|
+
"pdf.title.correction": "Faktura korygująca",
|
|
49
|
+
"pdf.title.wz": "Dokument WZ",
|
|
50
|
+
"pdf.title.numbered": "{title} nr {number}",
|
|
51
|
+
"pdf.label.ksefNumber": "Numer w KSeF",
|
|
52
|
+
"pdf.label.issuedAt": "Data wystawienia",
|
|
53
|
+
"pdf.label.saleDate": "Data sprzedaży",
|
|
54
|
+
"pdf.label.paymentDue": "Termin płatności",
|
|
55
|
+
"pdf.label.paymentMethod": "Metoda płatności",
|
|
56
|
+
"pdf.label.seller": "Sprzedawca",
|
|
57
|
+
"pdf.label.buyer": "Nabywca",
|
|
58
|
+
"pdf.label.taxId": "NIP",
|
|
59
|
+
"pdf.column.ordinal": "Lp",
|
|
60
|
+
"pdf.column.name": "Nazwa",
|
|
61
|
+
"pdf.column.unit": "Jedn.",
|
|
62
|
+
"pdf.column.quantity": "Ilość",
|
|
63
|
+
"pdf.column.unitNet": "Cena netto",
|
|
64
|
+
"pdf.column.taxRate": "Stawka",
|
|
65
|
+
"pdf.column.net": "Wartość netto",
|
|
66
|
+
"pdf.column.gross": "Wartość brutto",
|
|
67
|
+
"pdf.vat.rate": "Stawka VAT",
|
|
68
|
+
"pdf.vat.amount": "Kwota VAT",
|
|
69
|
+
"pdf.label.total": "Razem",
|
|
70
|
+
"pdf.label.paid": "Zapłacono",
|
|
71
|
+
"pdf.label.amountDue": "Do zapłaty",
|
|
72
|
+
"pdf.label.overpayment": "Nadpłata",
|
|
73
|
+
"pdf.label.inWords": "Słownie",
|
|
74
|
+
"pdf.footer.default": "Dziękujemy za współpracę.\n{{var seller.legalName}} · NIP {{var seller.taxId}}",
|
|
75
|
+
"lines.item": "Pozycja",
|
|
76
|
+
"lines.unit.piece": "szt.",
|
|
77
|
+
"lines.unit.service": "usł.",
|
|
78
|
+
"lines.delivery": "Dostawa",
|
|
79
|
+
"lines.paymentSurcharge": "Dopłata za metodę płatności",
|
|
80
|
+
"lines.discount": "Rabat",
|
|
81
|
+
"lines.priceReduction": "Obniżka ceny (reklamacja {rma}): {product}",
|
|
82
|
+
"lines.priceReductionUnreferenced": "Obniżka ceny (reklamacja): {product}",
|
|
83
|
+
"actions.openInvoices.keywords": "faktury",
|
|
84
|
+
"settingGroups.invoices.name": "Faktury"
|
|
46
85
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@endora-commerce/mod-invoices",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.110.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"description": "Invoice generation, numbering, PDF templates, corrections, and email delivery.",
|
|
@@ -62,12 +62,12 @@
|
|
|
62
62
|
"react": "^19",
|
|
63
63
|
"react-router-dom": "^7",
|
|
64
64
|
"zod": "^4",
|
|
65
|
-
"@endora-commerce/admin-kit": "0.
|
|
66
|
-
"@endora-commerce/contracts": "0.
|
|
67
|
-
"@endora-commerce/email-components": "0.
|
|
68
|
-
"@endora-commerce/page-builder-admin": "0.
|
|
69
|
-
"@endora-commerce/page-builder-core": "0.
|
|
70
|
-
"@endora-commerce/platform": "0.
|
|
65
|
+
"@endora-commerce/admin-kit": "0.110.0",
|
|
66
|
+
"@endora-commerce/contracts": "0.110.0",
|
|
67
|
+
"@endora-commerce/email-components": "0.110.0",
|
|
68
|
+
"@endora-commerce/page-builder-admin": "0.110.0",
|
|
69
|
+
"@endora-commerce/page-builder-core": "0.110.0",
|
|
70
|
+
"@endora-commerce/platform": "0.110.0"
|
|
71
71
|
},
|
|
72
72
|
"peerDependenciesMeta": {
|
|
73
73
|
"@endora-commerce/admin-kit": {
|
|
@@ -98,23 +98,23 @@
|
|
|
98
98
|
"@types/node": "^22.9.0",
|
|
99
99
|
"@types/pdfmake": "^0.3.2",
|
|
100
100
|
"@types/react": "^19.2.14",
|
|
101
|
-
"fastify": "^5.12.
|
|
101
|
+
"fastify": "^5.12.8",
|
|
102
102
|
"lucide-react": "^1.11.0",
|
|
103
103
|
"pdfmake": "^0.3.7",
|
|
104
104
|
"react": "^19.2.5",
|
|
105
105
|
"react-router-dom": "^7.18.2",
|
|
106
106
|
"typescript": "^5.9.3",
|
|
107
|
-
"vitest": "^4.1.
|
|
107
|
+
"vitest": "^4.1.12",
|
|
108
108
|
"zod": "^4.2.0",
|
|
109
|
-
"@endora-commerce/admin-kit": "0.
|
|
110
|
-
"@endora-commerce/contracts": "0.
|
|
111
|
-
"@endora-commerce/email-components": "0.
|
|
112
|
-
"@endora-commerce/page-builder-admin": "0.
|
|
113
|
-
"@endora-commerce/page-builder-core": "0.
|
|
114
|
-
"@endora-commerce/platform": "0.
|
|
109
|
+
"@endora-commerce/admin-kit": "0.110.0",
|
|
110
|
+
"@endora-commerce/contracts": "0.110.0",
|
|
111
|
+
"@endora-commerce/email-components": "0.110.0",
|
|
112
|
+
"@endora-commerce/page-builder-admin": "0.110.0",
|
|
113
|
+
"@endora-commerce/page-builder-core": "0.110.0",
|
|
114
|
+
"@endora-commerce/platform": "0.110.0"
|
|
115
115
|
},
|
|
116
116
|
"scripts": {
|
|
117
|
-
"build": "tsc -p tsconfig.build.json && tsc -p tsconfig.ui.json",
|
|
117
|
+
"build": "node ../../../scripts/clean-package-dist.mjs --src src --out dist && tsc -p tsconfig.build.json && tsc -p tsconfig.ui.build.json",
|
|
118
118
|
"typecheck": "tsc -p tsconfig.json && tsc -p tsconfig.ui.json --noEmit",
|
|
119
119
|
"lint": "eslint src",
|
|
120
120
|
"test": "vitest run"
|