sinfactura-types 1.10.282 → 1.10.284

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.
@@ -52,11 +52,24 @@ declare global {
52
52
  * Soft anomaly markers surfaced for supervisor review. Never hard gates —
53
53
  * none of these may block a punch or withhold a shift.
54
54
  *
55
- * ⚠️ **Membership here is not evidence the api sets it.** Three of the four
55
+ * ⚠️ **Membership here is not evidence the api sets it.** Four of the five
56
56
  * are written; one is published ahead of any emitter:
57
57
  *
58
58
  * - `OVERTIME` — LIVE, from `attendance/_postClockOut.ts`.
59
59
  * - `MISSED_CLOCK_OUT` — LIVE, from `attendanceSweep/index.ts`.
60
+ * - `NO_CLOCK_IN` — LIVE, DERIVED by `projectShiftFromClockEvents`
61
+ * (`services/attendance.ts`), so the live and correction paths share one
62
+ * implementation. It marks a day whose effective punches hold no
63
+ * `CLOCK_IN` at all — only a break pair, or a clock-out that closes
64
+ * nothing — which yields no hours and would otherwise surface nowhere: the
65
+ * missed-clock-out sweep reads the `OpenShift` sentinel, and such a day has
66
+ * none because no clock-in ever claimed one. The day stays `OPEN`, and the
67
+ * flag is what puts it in `GET /attendance/flagged`. ⚠️ It CLEARS the
68
+ * moment a clock-in is supplied — by re-derivation on the correction path,
69
+ * and by subtraction at clock-in, which is the one merging writer that
70
+ * takes a flag away (the punch it is writing is the flag's own refutation).
71
+ * Read its absence as "the day has a clock-in", never as "the day is
72
+ * complete".
60
73
  * - `LATE` — LIVE, from `attendance/_postClockIn.ts` via
61
74
  * `resolveClockInFlagFields`, which resolves the employee's expected start
62
75
  * from the api-local `SCHED#`/`SCHEDEX#` schedule config and compares
@@ -76,7 +89,7 @@ declare global {
76
89
  * believe the anomaly surface is covered. It has already cost one
77
90
  * cross-repo investigation.
78
91
  */
79
- type AttendanceShiftFlag = 'LATE' | 'MISSED_CLOCK_OUT' | 'OUTSIDE_GEOFENCE' | 'OVERTIME';
92
+ type AttendanceShiftFlag = 'LATE' | 'MISSED_CLOCK_OUT' | 'NO_CLOCK_IN' | 'OUTSIDE_GEOFENCE' | 'OVERTIME';
80
93
  /**
81
94
  * The derived daily roll-up — one per employee per day. PK `STORE#{storeId}`,
82
95
  * SK `SHIFT#{date}#{userId}`. The composite id mirrors `CashShift`'s
package/dist/report.d.ts CHANGED
@@ -32,6 +32,27 @@ declare global {
32
32
  /** `cost - returnCost`. Forward-only — see `returns`. */
33
33
  netCost?: number;
34
34
  }
35
+ /**
36
+ * One IVA rate's slice of a `ReportInvoicesAmounts` bucket.
37
+ *
38
+ * ⚠️ The SIGN follows the bucket it sits in, exactly like the scalar
39
+ * `neto`/`iva` beside it: positive magnitudes inside `gross` and `credit`,
40
+ * and `gross - credit` inside `net` — so a rate whose credit notes outweigh
41
+ * its facturas (or that a day credited without invoicing) carries NEGATIVE
42
+ * figures in `net.rates` and only there.
43
+ */
44
+ interface ReportInvoicesRateAmount {
45
+ /**
46
+ * AFIP Iva Id — `3` (0,00 %), `4` (10,50 %), `5` (21,00 %), `6` (27,00 %),
47
+ * `8` (5,00 %), `9` (2,50 %). ARCA *Tablas del SISTEMA* §1 one-for-one; the
48
+ * same numbering `InvoiceAlicuota.id` uses, NOT a percentage.
49
+ */
50
+ id: number;
51
+ /** Neto gravado on this rate. */
52
+ neto: number;
53
+ /** Débito fiscal (IVA) on this rate. */
54
+ iva: number;
55
+ }
35
56
  /**
36
57
  * One FAC/NC/net bucket of the ventas IVA summary. Every amount is a POSITIVE
37
58
  * magnitude, including `credit` — netting is expressed by the `net` bucket only.
@@ -45,6 +66,29 @@ declare global {
45
66
  iva: number;
46
67
  /** `ImpTotal` sum. */
47
68
  total: number;
69
+ /**
70
+ * The per-rate decomposition of `neto`/`iva`, ascending by AFIP Iva Id.
71
+ * SPARSE — a rate absent from the bucket emits no entry, so an empty array
72
+ * means no declared alícuota at all (an export-only or Factura C-only day).
73
+ *
74
+ * ⚠️ **`net.rates` is the netted per-rate base**, and the only one in this
75
+ * payload. The legacy `neto10`/`neto21`/`iva10`/`iva21` columns on
76
+ * `ReportInvoicesResume` sum credit notes with a POSITIVE sign and cover
77
+ * only Iva Ids 4 and 5 — they are neither netted nor complete, and must not
78
+ * be presented as a «base imponible».
79
+ *
80
+ * ⚠️ `neto`/`iva` stay authoritative for the bucket total. Each entry is
81
+ * rounded to 2 decimals independently of the scalar beside it, so the two
82
+ * can disagree by a cent for sub-centavo alícuota bases — which the stored
83
+ * 2-decimal amounts do not produce today. Read the scalar for the total,
84
+ * `rates` for the split; do not re-derive one from the other.
85
+ *
86
+ * ⚠️ Rows whose voucher class declares no débito fiscal — exports
87
+ * (CbteTipo 19/20/21) and the Factura C family — contribute to `quantity`
88
+ * and `total` but to NO rate entry, matching `neto`/`iva`. Their internal
89
+ * `Invoice.alicuotas` breakdown is not declared IVA.
90
+ */
91
+ rates: ReportInvoicesRateAmount[];
48
92
  }
49
93
  /**
50
94
  * One day of the `GET /reports?mode=invoices&date=YYYYMM` ventas summary.
@@ -62,6 +106,11 @@ declare global {
62
106
  * Legacy roll-up columns summing EVERY deliverable voucher with a POSITIVE
63
107
  * sign (credit notes included), so `total` mixes debits and credits.
64
108
  * Retained for wire compatibility; prefer `gross`/`credit`/`net` below.
109
+ *
110
+ * ⚠️ `neto10`/`neto21`/`iva10`/`iva21` are NOT a taxable base. They add a
111
+ * Nota de Crédito to the figure it should reduce, and they cover only Iva
112
+ * Ids 4 and 5 — a voucher on any of the other four declarable rates is
113
+ * missing from them entirely. The netted per-rate base is `net.rates`.
65
114
  */
66
115
  neto10: number;
67
116
  neto21: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sinfactura-types",
3
- "version": "1.10.282",
3
+ "version": "1.10.284",
4
4
  "description": "Shared wire and entity contracts for the SINFACTURA platform.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",