sinfactura-types 1.10.329 → 1.10.331
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/caea.d.ts +46 -0
- package/dist/cjs/inventory.js +1 -0
- package/dist/inventory.d.ts +17 -2
- package/dist/inventory.js +1 -0
- package/dist/lot.d.ts +46 -0
- package/package.json +1 -1
package/dist/caea.d.ts
CHANGED
|
@@ -45,5 +45,51 @@ declare global {
|
|
|
45
45
|
monthMinutesPct?: number;
|
|
46
46
|
monthsFlagged: number;
|
|
47
47
|
}
|
|
48
|
+
/**
|
|
49
|
+
* Why a CAEA period is being held back from the automatic inform. Closed set
|
|
50
|
+
* of bare codes — render from the code, never from prose.
|
|
51
|
+
*
|
|
52
|
+
* `DATA_DRIFT` — the period row counts CAEA-stamped invoices
|
|
53
|
+
* (`invoiceCount > 0`) yet no invoice carrying its code can be found, in
|
|
54
|
+
* either the owed or the already-informed state. The inform job refuses both
|
|
55
|
+
* to report the period as unused and to mark it informed; it stays that way
|
|
56
|
+
* until someone investigates. It will NOT resolve on its own.
|
|
57
|
+
*/
|
|
58
|
+
type CaeaPeriodHeldReason = 'DATA_DRIFT';
|
|
59
|
+
/**
|
|
60
|
+
* The per-period facts `GET /caea` DERIVES AT READ from the period's invoices.
|
|
61
|
+
*
|
|
62
|
+
* ⚠️ None of this is ever stored. It is deliberately not part of `CAEAPeriod`
|
|
63
|
+
* (the row): no writer sets these fields, and a row read by any other path
|
|
64
|
+
* does not carry them.
|
|
65
|
+
*
|
|
66
|
+
* `owedInvoices` — how many of the period's CAEA-stamped invoices are still
|
|
67
|
+
* owed to ARCA, counted with the same rule the inform job uses to pick what it
|
|
68
|
+
* sends. It is NOT `invoiceCount`: that is the period's running TOTAL of
|
|
69
|
+
* stamped invoices and never decreases. A PARTIAL inform (some vouchers
|
|
70
|
+
* accepted, some rejected or deferred) leaves the period `active` with
|
|
71
|
+
* `invoiceCount` untouched and `owedInvoices` reduced but non-zero — quote
|
|
72
|
+
* this number, not the total, when saying what is pending. It is also NOT
|
|
73
|
+
* `CAEAInformResult.pendingInvoices`, which counts only the owed invoices that
|
|
74
|
+
* cannot be informed because their frozen det snapshot is missing. A period
|
|
75
|
+
* already `informed` reads `0`.
|
|
76
|
+
*
|
|
77
|
+
* `invoiceReadTruncated` — `true` when the invoice read behind these facts
|
|
78
|
+
* stopped at its read bound before finishing. `owedInvoices` is then a LOWER
|
|
79
|
+
* bound (say "at least N"), and `held` is never asserted from a short read.
|
|
80
|
+
*
|
|
81
|
+
* `held` — `true` when the period has ended, is still awaiting inform, and the
|
|
82
|
+
* inform job classifies it as one it will not inform automatically. `false`
|
|
83
|
+
* means not held — always present, never absent. `reason` is present exactly
|
|
84
|
+
* when `held` is `true`.
|
|
85
|
+
*/
|
|
86
|
+
interface CaeaPeriodDerived {
|
|
87
|
+
owedInvoices: number;
|
|
88
|
+
invoiceReadTruncated: boolean;
|
|
89
|
+
held: boolean;
|
|
90
|
+
reason?: CaeaPeriodHeldReason;
|
|
91
|
+
}
|
|
92
|
+
/** One entry of the `GET /caea` period history: the stored row plus what the read derives. */
|
|
93
|
+
type CaeaPeriodView = CAEAPeriod & CaeaPeriodDerived;
|
|
48
94
|
}
|
|
49
95
|
export {};
|
package/dist/cjs/inventory.js
CHANGED
package/dist/inventory.d.ts
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* move `InventoryLevel.reserved`, not `onHand`, so a naive `Σ quantity` over a
|
|
8
8
|
* product's partition double-counts every hold. See `StockMovementType`.
|
|
9
9
|
*/
|
|
10
|
-
export declare const STOCK_MOVEMENT_TYPES: readonly ["receipt", "sale", "transfer_in", "transfer_out", "adjustment", "return", "reservation", "release", "write_off"];
|
|
10
|
+
export declare const STOCK_MOVEMENT_TYPES: readonly ["receipt", "sale", "transfer_in", "transfer_out", "adjustment", "return", "reservation", "release", "write_off", "lot_consumption"];
|
|
11
11
|
/**
|
|
12
12
|
* Why an operator moved stock by hand. Runtime value for the same
|
|
13
13
|
* one-list-not-three reason as `STOCK_MOVEMENT_TYPES`.
|
|
@@ -544,8 +544,23 @@ declare global {
|
|
|
544
544
|
* - `return` — a customer gave goods back. Increases `onHand`.
|
|
545
545
|
* - `write_off` — stock destroyed, expired or otherwise removed with no sale.
|
|
546
546
|
* Decreases `onHand`.
|
|
547
|
+
* - `lot_consumption` — units of a NAMED batch were deliberately used up:
|
|
548
|
+
* dispensed, compounded, fitted, assembled into something else. Decreases
|
|
549
|
+
* `onHand`, and always carries a `lotId`.
|
|
547
550
|
* - `reservation` / `release` — a hold was placed or lifted.
|
|
548
551
|
*
|
|
552
|
+
* ⚠️ **`lot_consumption` is NOT a lot-stamped `write_off`, and the distinction
|
|
553
|
+
* is the reason it exists rather than a naming preference.** A `write_off` is
|
|
554
|
+
* SHRINKAGE — units the store lost and cannot bill for — and every loss report
|
|
555
|
+
* built on this ledger totals that type. A consumed unit was used on purpose
|
|
556
|
+
* and is not a loss; folding it into `write_off` would inflate shrinkage by
|
|
557
|
+
* exactly the store's consumption, permanently, with no attribute left to
|
|
558
|
+
* unpick the two afterwards. It is not an `adjustment` either: an adjustment
|
|
559
|
+
* reads as a counting error and would pollute stock-accuracy figures the same
|
|
560
|
+
* way. ⚠️ It carries NO `reason` — `StockMovementReason` is the vocabulary of
|
|
561
|
+
* loss and correction, and the closest member (`other`) would say less than
|
|
562
|
+
* the type already does.
|
|
563
|
+
*
|
|
549
564
|
* ⚠️ **`sale` and `return` are vocabulary this ledger ACCEPTS, not traffic it
|
|
550
565
|
* receives.** The order, sale and marketplace paths write the store-wide income
|
|
551
566
|
* and sale ledgers and never this one — the two books run side by side with
|
|
@@ -568,7 +583,7 @@ declare global {
|
|
|
568
583
|
* REMOVING one is not — rows carrying it are permanent and this platform never
|
|
569
584
|
* backfills.
|
|
570
585
|
*/
|
|
571
|
-
type StockMovementType = 'receipt' | 'sale' | 'transfer_in' | 'transfer_out' | 'adjustment' | 'return' | 'reservation' | 'release' | 'write_off';
|
|
586
|
+
type StockMovementType = 'receipt' | 'sale' | 'transfer_in' | 'transfer_out' | 'adjustment' | 'return' | 'reservation' | 'release' | 'write_off' | 'lot_consumption';
|
|
572
587
|
/**
|
|
573
588
|
* Why an operator adjusted or wrote off stock. Set only on `adjustment` and
|
|
574
589
|
* `write_off` movements; a `sale` or a `receipt` has a reference, not a
|
package/dist/inventory.js
CHANGED
package/dist/lot.d.ts
CHANGED
|
@@ -139,5 +139,51 @@ declare global {
|
|
|
139
139
|
*/
|
|
140
140
|
search?: string;
|
|
141
141
|
}
|
|
142
|
+
/**
|
|
143
|
+
* A `Lot` joined with the units still on hand from that batch — the row shape
|
|
144
|
+
* the lot read answers with, and the input shape the FEFO candidate ordering
|
|
145
|
+
* takes.
|
|
146
|
+
*
|
|
147
|
+
* ⚠️ **`remaining` is DERIVED at read time and is stored nowhere.** There is
|
|
148
|
+
* no counter on the `Lot` row and deliberately none: it would be a second
|
|
149
|
+
* source of truth that drifts the first moment a movement is written without
|
|
150
|
+
* decrementing it, which is exactly what {@link Lot.receivedQuantity}'s own
|
|
151
|
+
* note refuses. The server sums every `MOV#` ledger row across the store's
|
|
152
|
+
* warehouses that carries this `lotId`, over the movement types that move
|
|
153
|
+
* `onHand` only — `reservation` and `release` move `reserved` and are
|
|
154
|
+
* excluded, so a hold never depletes a batch.
|
|
155
|
+
*/
|
|
156
|
+
interface LotWithRemaining extends Lot {
|
|
157
|
+
/**
|
|
158
|
+
* Units of this batch still on hand, store-wide. Signed sum, so it can be
|
|
159
|
+
* ZERO (an exhausted batch) and — on a store whose outflows are not all
|
|
160
|
+
* lot-stamped — NEGATIVE.
|
|
161
|
+
*
|
|
162
|
+
* ⚠️ **Its relationship to `receivedQuantity` is a starting point, not an
|
|
163
|
+
* identity.** `receivedQuantity` is what ARRIVED and is immutable;
|
|
164
|
+
* `remaining` is what is left, and the two differ by every stamped outflow.
|
|
165
|
+
* `remaining > receivedQuantity` is legal and normal — a return or a
|
|
166
|
+
* correcting adjustment stamped with this `lotId` raises it above what
|
|
167
|
+
* arrived. A consumer must not render `receivedQuantity - remaining` as
|
|
168
|
+
* "consumed" and must not clamp one against the other.
|
|
169
|
+
*
|
|
170
|
+
* ⚠️ **Its relationship to `Product.stock` is NONE, and nothing reconciles
|
|
171
|
+
* them.** `Product.stock` is the store-wide scalar the order, sale and
|
|
172
|
+
* marketplace paths move; the `MOV#` ledger this figure is summed from is
|
|
173
|
+
* the SEPARATE per-location book only explicit inventory operations write
|
|
174
|
+
* (see `Warehouse`'s own note on the two books). `Σ remaining` over a
|
|
175
|
+
* product's lots is therefore not `Product.stock`, is not converging on it,
|
|
176
|
+
* and a screen that subtracts one from the other shows an operator a
|
|
177
|
+
* shortfall with no cause. Nothing structurally forces an outflow to carry
|
|
178
|
+
* a `lotId` either, so a lot total exceeding on-hand means un-stamped
|
|
179
|
+
* movements, never data loss.
|
|
180
|
+
*
|
|
181
|
+
* ⚠️ **Only as complete as the read that produced it.** The envelope's
|
|
182
|
+
* `truncated` covers this figure as well as the list: a truncated ledger
|
|
183
|
+
* walk yields a remaining that is a partial sum, and a partial sum is the
|
|
184
|
+
* same class of lie a partial list is.
|
|
185
|
+
*/
|
|
186
|
+
remaining: number;
|
|
187
|
+
}
|
|
142
188
|
}
|
|
143
189
|
export {};
|