@opencxh/domain 1.293.0 → 1.295.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/entities/agreement/from-quote.d.ts +18 -0
- package/dist/entities/agreement/from-quote.test.d.ts +1 -0
- package/dist/entities/agreement/index.d.ts +2 -0
- package/dist/entities/agreement/lifecycle.d.ts +44 -0
- package/dist/entities/agreement/lifecycle.test.d.ts +1 -0
- package/dist/entities/agreement/schedule.d.ts +4 -0
- package/dist/entities/agreement/types.d.ts +38 -0
- package/dist/entities/bank/match.d.ts +1 -1
- package/dist/entities/bookkeeping/receipt.d.ts +95 -2
- package/dist/entities/bookkeeping/types.d.ts +2 -0
- package/dist/entities/catalog/pricing.d.ts +5 -0
- package/dist/entities/catalog/types.d.ts +23 -1
- package/dist/entities/company/types.d.ts +6 -0
- package/dist/entities/financing/schedule.d.ts +40 -1
- package/dist/entities/financing/types.d.ts +99 -3
- package/dist/entities/ledger/entry.d.ts +12 -6
- package/dist/entities/ledger/template.d.ts +5 -0
- package/dist/entities/ledger/types.d.ts +9 -2
- package/dist/entities/money/index.d.ts +2 -0
- package/dist/entities/money/month-parts.d.ts +19 -0
- package/dist/entities/money/month-parts.test.d.ts +1 -0
- package/dist/entities/money/period-price.d.ts +23 -0
- package/dist/entities/money/period-price.test.d.ts +1 -0
- package/dist/entities/money/totals.d.ts +5 -1
- package/dist/entities/purchase/contract.d.ts +124 -0
- package/dist/entities/purchase/contract.test.d.ts +1 -0
- package/dist/entities/purchase/demand.d.ts +68 -0
- package/dist/entities/purchase/demand.test.d.ts +1 -0
- package/dist/entities/purchase/index.d.ts +7 -0
- package/dist/entities/purchase/kinds.d.ts +8 -0
- package/dist/entities/purchase/logic.d.ts +35 -0
- package/dist/entities/purchase/match.d.ts +98 -0
- package/dist/entities/purchase/match.test.d.ts +1 -0
- package/dist/entities/purchase/packing-slip.d.ts +82 -0
- package/dist/entities/purchase/packing-slip.test.d.ts +1 -0
- package/dist/entities/purchase/purchase.test.d.ts +1 -0
- package/dist/entities/purchase/types.d.ts +147 -0
- package/dist/entities/reports/reports.d.ts +9 -0
- package/dist/entities/transaction/document.d.ts +3 -0
- package/dist/entities/transaction/keys.d.ts +1 -7
- package/dist/entities/transaction/kinds.d.ts +7 -0
- package/dist/entities/transaction/types.d.ts +11 -1
- package/dist/entities/work/index.d.ts +1 -1
- package/dist/entities/work/types.d.ts +1 -1
- package/dist/index.cjs +23 -23
- package/dist/index.d.ts +3 -1
- package/dist/index.js +4187 -3117
- package/dist/platform/bookkeeping.d.ts +29 -3
- package/dist/platform/manifest.d.ts +6 -27
- package/dist/platform/navigation.d.ts +202 -0
- package/dist/platform/navigation.test.d.ts +1 -0
- package/dist/platform/provider.d.ts +7 -0
- package/dist/platform/provisioning.d.ts +88 -0
- package/dist/platform/resource.d.ts +19 -0
- package/dist/platform/resource.test.d.ts +1 -0
- package/dist/platform/routing.d.ts +13 -18
- package/package.json +1 -1
- package/dist/platform/menu.d.ts +0 -26
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { ProvisioningAction, ProvisioningState } from '../../platform/provisioning';
|
|
2
|
+
import { Cents } from '../money/money';
|
|
3
|
+
import { PricePer } from '../money/period-price';
|
|
4
|
+
import { PostalAddress } from '../organization/types';
|
|
5
|
+
import { Transaction, TransactionLine } from '../transaction/types';
|
|
6
|
+
/**
|
|
7
|
+
* What a supplier asks for a product: one row per supplier and product (and validity window).
|
|
8
|
+
* The default offer is the product's cost price; the rest are the alternatives a buyer compares.
|
|
9
|
+
*/
|
|
10
|
+
export interface SupplierOffer {
|
|
11
|
+
id: string;
|
|
12
|
+
organizationId: string;
|
|
13
|
+
businessEntityId?: string;
|
|
14
|
+
supplierCompanyId: string;
|
|
15
|
+
productId: string;
|
|
16
|
+
/** Their article number. */
|
|
17
|
+
vendorSku?: string;
|
|
18
|
+
/**
|
|
19
|
+
* `unit`: a price per purchase unit. `rated`: per record on their rate card (telecom transit) —
|
|
20
|
+
* refused until that part exists, so nobody stores a price that means nothing yet.
|
|
21
|
+
*/
|
|
22
|
+
pricing: "unit" | "rated";
|
|
23
|
+
/** Per purchase unit, for `per` (€ 222 per year) or once. */
|
|
24
|
+
costCents: Cents;
|
|
25
|
+
currency: string;
|
|
26
|
+
per?: PricePer;
|
|
27
|
+
/** The supplier's term: an NCE yearly licence is `year` even when billed monthly. */
|
|
28
|
+
term?: "month" | "year" | "3year";
|
|
29
|
+
/** How often they invoice; `costCents` is per `per`, not per invoice. */
|
|
30
|
+
billedEvery?: "month" | "year" | "once";
|
|
31
|
+
/** What you order in: a roll, a pallet, a box of 50. Absent = the product's own unit. */
|
|
32
|
+
purchaseUnit?: string;
|
|
33
|
+
/** Product units in one purchase unit: a roll of 500 m is 500. */
|
|
34
|
+
unitsPerPurchaseUnit?: number;
|
|
35
|
+
validFrom?: number;
|
|
36
|
+
validTo?: number;
|
|
37
|
+
minQty?: number;
|
|
38
|
+
leadDays?: number;
|
|
39
|
+
/** Days from each term's start the supplier still takes a change (NCE: 7). */
|
|
40
|
+
changeWindowDays?: number;
|
|
41
|
+
/** Ordered through an app instead of by mail (fase 9). */
|
|
42
|
+
provider?: {
|
|
43
|
+
app: string;
|
|
44
|
+
offer: string;
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* Where it lands when that is not the supplier (fase 9b): a Telnyx number on the customer's
|
|
48
|
+
* Eylo account. The platform's own offer takes it in, after the purchase.
|
|
49
|
+
*/
|
|
50
|
+
deliverTo?: {
|
|
51
|
+
app: string;
|
|
52
|
+
offer: string;
|
|
53
|
+
};
|
|
54
|
+
isDefault: boolean;
|
|
55
|
+
createdBy: string;
|
|
56
|
+
createdAt?: number;
|
|
57
|
+
updatedAt?: number;
|
|
58
|
+
}
|
|
59
|
+
/** Ours to keep, or sold on to a customer — decides where the cost books (fase 6). */
|
|
60
|
+
export type PurchaseUse = "own" | "resale";
|
|
61
|
+
export interface PurchaseLine extends TransactionLine {
|
|
62
|
+
offerId?: string;
|
|
63
|
+
/** Sum of the booked receipts, in purchase units; recomputed, never added to. */
|
|
64
|
+
receivedQty: number;
|
|
65
|
+
/** Matched to supplier invoices (fase 7). */
|
|
66
|
+
billedQty: number;
|
|
67
|
+
use: PurchaseUse;
|
|
68
|
+
dimensions?: {
|
|
69
|
+
costCenterId?: string;
|
|
70
|
+
projectId?: string;
|
|
71
|
+
};
|
|
72
|
+
/** Absent = `purchase`. A change or an end points at the contract line it is about. */
|
|
73
|
+
action?: ProvisioningAction;
|
|
74
|
+
contractLine?: {
|
|
75
|
+
contractId: string;
|
|
76
|
+
lineId: string;
|
|
77
|
+
};
|
|
78
|
+
/** A change: the count it should be after. */
|
|
79
|
+
targetQuantity?: number;
|
|
80
|
+
/** When a change or end takes effect (epoch ms): the end of the term, not today. */
|
|
81
|
+
effectiveAt?: number;
|
|
82
|
+
/** Where this line came from in "Te bestellen", so it is not proposed twice. */
|
|
83
|
+
demandKey?: string;
|
|
84
|
+
/** The line of this order it waits for (the customer's account before its numbers). */
|
|
85
|
+
waitsFor?: string;
|
|
86
|
+
/** The supplier's ordering fields (a domain, a region). */
|
|
87
|
+
params?: Record<string, string>;
|
|
88
|
+
provisioning?: LineProvisioning;
|
|
89
|
+
/** The second step when the offer lands elsewhere (`deliverTo`): after a buy, before an end. */
|
|
90
|
+
delivery?: LineProvisioning;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* A line's request at the supplier. `waiting`: its account is not there yet. `manual`: no API —
|
|
94
|
+
* a person does it and fills in the result.
|
|
95
|
+
*/
|
|
96
|
+
export interface LineProvisioning {
|
|
97
|
+
state: ProvisioningState | "waiting" | "manual";
|
|
98
|
+
requestId: string;
|
|
99
|
+
app?: string;
|
|
100
|
+
externalRef?: string;
|
|
101
|
+
fulfillment?: Record<string, string>;
|
|
102
|
+
missing?: {
|
|
103
|
+
key: string;
|
|
104
|
+
reason: string;
|
|
105
|
+
}[];
|
|
106
|
+
error?: string;
|
|
107
|
+
attempts?: number;
|
|
108
|
+
nextAttemptAt?: number;
|
|
109
|
+
updatedAt?: number;
|
|
110
|
+
}
|
|
111
|
+
export interface DeliverTo {
|
|
112
|
+
kind: "own" | "customer" | "site";
|
|
113
|
+
companyId?: string;
|
|
114
|
+
address?: PostalAddress;
|
|
115
|
+
}
|
|
116
|
+
/** A purchase order: a `Transaction` of kind `purchase_order`; `companyId` is the supplier. */
|
|
117
|
+
export interface PurchaseOrder extends Omit<Transaction, "lines"> {
|
|
118
|
+
lines: PurchaseLine[];
|
|
119
|
+
deliverTo: DeliverTo;
|
|
120
|
+
/** Bought for this customer (the M365 seats for Acme). */
|
|
121
|
+
customerCompanyId?: string;
|
|
122
|
+
}
|
|
123
|
+
export interface GoodsReceiptLine {
|
|
124
|
+
poLineId: string;
|
|
125
|
+
/** Purchase units; positive, the movement says the direction. */
|
|
126
|
+
quantity: number;
|
|
127
|
+
serials: string[];
|
|
128
|
+
/** Still to come, as the packing slip says. */
|
|
129
|
+
backorderQty?: number;
|
|
130
|
+
}
|
|
131
|
+
/** Goods in (or back out). Booked is final: a mistake is corrected with a return. */
|
|
132
|
+
export interface GoodsReceipt {
|
|
133
|
+
id: string;
|
|
134
|
+
organizationId: string;
|
|
135
|
+
businessEntityId?: string;
|
|
136
|
+
movement: "in" | "return";
|
|
137
|
+
purchaseOrderId: string;
|
|
138
|
+
supplierCompanyId: string;
|
|
139
|
+
receivedAt: number;
|
|
140
|
+
receivedBy: string;
|
|
141
|
+
source: "manual" | "upload" | "mail";
|
|
142
|
+
fileId?: string;
|
|
143
|
+
supplierRef?: string;
|
|
144
|
+
status: "draft" | "booked";
|
|
145
|
+
lines: GoodsReceiptLine[];
|
|
146
|
+
createdAt?: number;
|
|
147
|
+
}
|
|
@@ -29,6 +29,15 @@ export interface BooksReport {
|
|
|
29
29
|
/** Where the figures come from: our books, or a connected package by name. */
|
|
30
30
|
source: string;
|
|
31
31
|
}
|
|
32
|
+
/** A report row with its amount in this period and in the one it is compared to. */
|
|
33
|
+
export interface ComparedRow extends BooksReportRow {
|
|
34
|
+
priorCents: Cents;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Two reports of the same kind side by side. A row only one of them has (an account that moved
|
|
38
|
+
* last year and not this year) keeps its place under its own parent, with 0 on the other side.
|
|
39
|
+
*/
|
|
40
|
+
export declare function compareReports(current: BooksReport, prior: BooksReport | null): ComparedRow[];
|
|
32
41
|
/** A posted line as the reports need it: account, day, signed amount (debit +). */
|
|
33
42
|
export interface ReportLine {
|
|
34
43
|
accountId: string;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { DocumentBlock } from '../../platform/document-blocks';
|
|
2
2
|
import { DocumentSlots, TemplateContext } from '../document-template/tokens';
|
|
3
3
|
import { TemplateCondition } from '../document-template/types';
|
|
4
|
+
import { PricePer } from '../money/period-price';
|
|
4
5
|
import { TaxRate } from '../money/tax';
|
|
5
6
|
import { PostalAddress } from '../organization/types';
|
|
6
7
|
import { Transaction } from './types';
|
|
@@ -56,6 +57,8 @@ export interface SlotLabels {
|
|
|
56
57
|
optional: string;
|
|
57
58
|
quantity: string;
|
|
58
59
|
unitPrice: string;
|
|
60
|
+
/** After a period price: "222,00 per jaar". */
|
|
61
|
+
per: Record<PricePer, string>;
|
|
59
62
|
net: string;
|
|
60
63
|
tax: string;
|
|
61
64
|
gross: string;
|
|
@@ -7,19 +7,13 @@
|
|
|
7
7
|
* `invoice:412` even if invoices ever move to a finance app; one branded `sales_document:412`
|
|
8
8
|
* would mean a backfill across four apps.
|
|
9
9
|
*/
|
|
10
|
-
export declare const
|
|
10
|
+
export declare const SALES_SCOPE_KINDS: readonly string[];
|
|
11
11
|
export declare const PRODUCT_SCOPE_KIND = "product";
|
|
12
12
|
/** An agreement: what a customer takes every period. Puts it in the customer file. */
|
|
13
13
|
export declare const AGREEMENT_SCOPE_KIND = "agreement";
|
|
14
14
|
/** `invoice:412`. The kind of a transaction *is* its kind key — no mapping table. */
|
|
15
15
|
export declare function transactionScopeKey(kindKey: string, id: string): string;
|
|
16
16
|
export declare function productScopeKey(id: string): string;
|
|
17
|
-
/**
|
|
18
|
-
* The shell path of a document, under the administration it belongs to.
|
|
19
|
-
*
|
|
20
|
-
* `fallbackEntityId` is for a row that predates administrations (`""` = the default one); without
|
|
21
|
-
* either there is no screen to point at, and no link beats a dead one.
|
|
22
|
-
*/
|
|
23
17
|
export declare function transactionHref(row: {
|
|
24
18
|
id: string;
|
|
25
19
|
kindKey: string;
|
|
@@ -53,6 +53,13 @@ export interface TransactionKind {
|
|
|
53
53
|
*/
|
|
54
54
|
credits?: string;
|
|
55
55
|
}
|
|
56
|
+
/** What `apps/sales` issues. Another app's kinds live in their own list, same shape. */
|
|
57
|
+
export declare const SALES_KINDS: readonly TransactionKind[];
|
|
58
|
+
/**
|
|
59
|
+
* Every app's kinds, for looking one up by key. Keys are unique across apps (`invoice` is sales',
|
|
60
|
+
* `purchase_order` will be purchase's), so a key alone names its kind. Never enumerate this in an
|
|
61
|
+
* app: sales lists {@link SALES_KINDS}, or a purchase kind claims sales scopes and series.
|
|
62
|
+
*/
|
|
56
63
|
export declare const TRANSACTION_KINDS: readonly TransactionKind[];
|
|
57
64
|
/**
|
|
58
65
|
* Which kinds the app actually offers today.
|
|
@@ -3,6 +3,7 @@ import { DocumentBlock } from '../../platform/document-blocks';
|
|
|
3
3
|
import { LineUsage } from '../agreement/types';
|
|
4
4
|
import { DocumentSender } from '../document-template/types';
|
|
5
5
|
import { Cents } from '../money/money';
|
|
6
|
+
import { PricePer } from '../money/period-price';
|
|
6
7
|
import { TaxRateKind } from '../money/tax';
|
|
7
8
|
import { OwnerScope } from '../scope/types';
|
|
8
9
|
import { TransactionPaymentTerm } from './payment-term';
|
|
@@ -47,6 +48,11 @@ export interface Transaction {
|
|
|
47
48
|
title?: string;
|
|
48
49
|
reference?: string;
|
|
49
50
|
currency: string;
|
|
51
|
+
/**
|
|
52
|
+
* Euro per unit of `currency`, set when issued in a currency the administration does not keep
|
|
53
|
+
* its books in (the ECB rate of that day). Absent in the books' own currency.
|
|
54
|
+
*/
|
|
55
|
+
fxRate?: string;
|
|
50
56
|
status: TransactionStatus;
|
|
51
57
|
/**
|
|
52
58
|
* The lines, as a column and not a table.
|
|
@@ -154,7 +160,9 @@ export interface Transaction {
|
|
|
154
160
|
* A union and not a free string: kinds and their statuses are **ours**, not the organisation's.
|
|
155
161
|
* Labels follow from the key as `status_<key>`.
|
|
156
162
|
*/
|
|
157
|
-
export type TransactionStatus = "draft" | "sent" | "accepted" | "rejected" | "expired" | "confirmed" | "delivered"
|
|
163
|
+
export type TransactionStatus = "draft" | "sent" | "accepted" | "rejected" | "expired" | "confirmed" | "delivered"
|
|
164
|
+
/** A purchase order whose every line came in. */
|
|
165
|
+
| "received" | "open" | "cancelled"
|
|
158
166
|
/** A newer version of this document went out. Set by the server, never by a person. */
|
|
159
167
|
| "superseded";
|
|
160
168
|
export interface IssuedPaper {
|
|
@@ -175,6 +183,8 @@ export interface TransactionLine {
|
|
|
175
183
|
unitKey: string;
|
|
176
184
|
quantity: number;
|
|
177
185
|
unitPriceCents: Cents;
|
|
186
|
+
/** The period the unit price is for ("€ 25 per month"). Absent = once, per unit. */
|
|
187
|
+
pricePer?: PricePer;
|
|
178
188
|
discountPercent?: number;
|
|
179
189
|
taxRateKey: string;
|
|
180
190
|
/** Which rung of the price ladder produced this amount. Purely to account for it. */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { WorkRecurrence } from './recurrence';
|
|
2
1
|
import { Relation } from '../../platform/resource-source';
|
|
3
2
|
import { OwnerScope } from '../scope/types';
|
|
3
|
+
import { WorkRecurrence } from './recurrence';
|
|
4
4
|
/**
|
|
5
5
|
* Work management — one entity for everything that is *work*.
|
|
6
6
|
*
|