@opencxh/domain 1.290.0 → 1.292.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.
@@ -78,6 +78,11 @@ export type MatchTarget = {
78
78
  kind: "scheduled_posting";
79
79
  scheduledPostingId: string;
80
80
  }
81
+ /** Straight onto a balance item (a current account): its ledger account, with it as sub-account. */
82
+ | {
83
+ kind: "financing";
84
+ financingItemId: string;
85
+ }
81
86
  /** The other side of a transfer between two own accounts. */
82
87
  | {
83
88
  kind: "transfer";
@@ -136,10 +141,12 @@ export interface BankRule {
136
141
  descriptionContains?: string;
137
142
  direction?: "in" | "out";
138
143
  };
144
+ /** With `financingItemId` the line goes onto that current account; `accountId` is then its account. */
139
145
  action: {
140
146
  accountId: string;
141
147
  taxCode?: string;
142
148
  description?: string;
149
+ financingItemId?: string;
143
150
  };
144
151
  /** High lands in "Klaar om te bevestigen", medium in "Controleren". */
145
152
  confidence: "high" | "medium";
@@ -3,6 +3,7 @@
3
3
  * normalised on write, compared normalised everywhere: `NL91 abna 0417 1643 00` and
4
4
  * `NL91ABNA0417164300` are one account.
5
5
  */
6
+ /** Both are letters and digits only: spaces, dots, dashes and the like are layout. */
6
7
  export declare function normalizeIban(value: string): string;
7
8
  export declare function normalizeVatNumber(value: string): string;
8
9
  /** Normalised, blanks dropped, duplicates removed, order kept. */
@@ -1,2 +1,2 @@
1
- export * from './types';
2
1
  export * from './identifiers';
2
+ export * from './types';
@@ -1,5 +1,5 @@
1
- import { PostalAddress } from '../organization/types';
2
1
  import { LifecycleStage } from '../contact/lifecycle';
2
+ import { PostalAddress } from '../organization/types';
3
3
  import { OwnerScope } from '../scope/types';
4
4
  /** Same meaning as {@link ContactOrigin}: `shadow` is a lazily cached hit, a landed row is `own`. */
5
5
  export type CompanyOrigin = "own" | "shadow";
@@ -1,5 +1,5 @@
1
1
  import { Cents } from '../money/money';
2
- import { AccrualTerms, CurrentAccountTerms, FinancingItem, FixedAssetTerms, LoanTerms, ScheduledPosting } from './types';
2
+ import { AccrualTerms, CurrentAccountRelation, CurrentAccountTerms, FinancingItem, FixedAssetTerms, LoanTerms, ScheduledPosting } from './types';
3
3
  /** `day` plus `months`, on the same day of the month or the last one when it is shorter. */
4
4
  export declare function addMonths(day: string, months: number): string;
5
5
  export interface Installment {
@@ -32,6 +32,8 @@ export declare function interestPeriods(openedOn: string, through: string, caden
32
32
  to: string;
33
33
  }[];
34
34
  export declare const EXCESSIVE_LENDING_THRESHOLD_CENTS = 50000000;
35
+ /** Who a current account is with; anything unknown or missing is the director. */
36
+ export declare const currentAccountRelation: (terms?: Partial<Pick<CurrentAccountTerms, "relation">>) => CurrentAccountRelation;
35
37
  /** Wet excessief lenen: how far the director's debt to the BV is toward the threshold. */
36
38
  export declare function excessiveLending(directorOwesCents: Cents, thresholdCents?: number): {
37
39
  over: boolean;
@@ -18,15 +18,18 @@ export interface LoanTerms {
18
18
  /** Interest expense (received) or income (given). */
19
19
  interestAccountId: string;
20
20
  }
21
+ /** Who the current account is with; absent on items made before it existed: the director. */
22
+ export type CurrentAccountRelation = "director" | "group_company" | "participation" | "other_company";
21
23
  export interface CurrentAccountTerms {
22
24
  kind: "current_account";
25
+ relation?: CurrentAccountRelation;
23
26
  /** A business rate: what the tax authority expects between a BV and its director. */
24
27
  ratePercent: string;
25
28
  cadence: "quarterly" | "yearly";
26
29
  /** Interest income when the director owes, expense when the BV owes. */
27
30
  interestIncomeAccountId: string;
28
31
  interestExpenseAccountId: string;
29
- /** Wet excessief lenen: a signal above this debt of the director. A setting, default € 500.000. */
32
+ /** Wet excessief lenen: a signal above this debt of the director (director only). Default € 500.000. */
30
33
  thresholdCents?: Cents;
31
34
  }
32
35
  export interface ParticipationTerms {
@@ -14,6 +14,8 @@ export interface VatLine {
14
14
  taxCents: Cents;
15
15
  taxPointDate: string;
16
16
  counterpartyCompanyId?: string;
17
+ /** The journal line it came from: the drill-down from a box back to the bookings. */
18
+ ref?: string;
17
19
  }
18
20
  export declare const NL_VAT_BOXES: readonly ["1a", "1b", "1c", "1d", "1e", "2a", "3a", "3b", "3c", "4a", "4b", "5a", "5b", "5c", "5g"];
19
21
  export type VatBox = (typeof NL_VAT_BOXES)[number];
@@ -35,6 +37,8 @@ export interface VatReturnFigures {
35
37
  }[];
36
38
  /** Lines whose code is unknown: they are in no box, and the checklist says so. */
37
39
  unknownCodes: string[];
40
+ /** With `trace`: per box, the `ref` of every line that counted in it. */
41
+ refs?: Partial<Record<VatBox, string[]>>;
38
42
  }
39
43
  /**
40
44
  * The boxes for one period. Reverse charge on purchase (`selfAssessed`) is owed in its own box
@@ -49,6 +53,8 @@ export declare function vatReturn(input: {
49
53
  taxonomy?: string;
50
54
  /** The code a self-assessed purchase is taxed at: the standard rate. */
51
55
  standardKey?: string;
56
+ /** Also say which lines counted in which box (`refs`). */
57
+ trace?: boolean;
52
58
  }): VatReturnFigures;
53
59
  /** The periods a return is filed over, and when it is due: the month after, at its end. */
54
60
  export declare function vatPeriods(year: number, cadence?: "quarter" | "month" | "year"): {