sinfactura-types 1.9.0 → 1.9.1

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.
Files changed (2) hide show
  1. package/dist/report.d.ts +115 -0
  2. package/package.json +1 -1
package/dist/report.d.ts CHANGED
@@ -32,5 +32,120 @@ declare global {
32
32
  /** `cost - returnCost`. */
33
33
  netCost: number;
34
34
  }
35
+ /**
36
+ * One FAC/NC/net bucket of the ventas IVA summary (api#2011).
37
+ *
38
+ * ⚠️ Every amount is a POSITIVE magnitude, including `credit`. The netting is
39
+ * expressed by the `net` bucket, never by a sign on `credit` — same
40
+ * convention the fiscal files use, where a credit-note row also stays
41
+ * positive and the `CbteTipo` carries the sign semantics.
42
+ */
43
+ interface ReportInvoicesAmounts {
44
+ /** Voucher count in this bucket. */
45
+ quantity: number;
46
+ /** Neto gravado summed over every declared alícuota. */
47
+ neto: number;
48
+ /** Débito fiscal (IVA) summed over every declared alícuota. */
49
+ iva: number;
50
+ /** `ImpTotal` sum. */
51
+ total: number;
52
+ }
53
+ /**
54
+ * One day of the `GET /reports?mode=invoices&date=YYYYMM` ventas summary
55
+ * (api#2011 / types#113).
56
+ *
57
+ * Covers only AUTHORIZED (deliverable) vouchers — `pending_cae` and
58
+ * `rejected` are excluded upstream, and legacy rows with no `fiscalStatus`
59
+ * count as authorized.
60
+ */
61
+ interface ReportInvoicesResume {
62
+ /**
63
+ * `YYYYMMDD` as a NUMBER.
64
+ *
65
+ * ⚠️ Was typed `string` in the app's local copy of this shape while the
66
+ * API has always returned `Invoice.dated`, a number. Canonicalizing here
67
+ * fixes that drift — the same class of bug as `ReportSales.date`.
68
+ */
69
+ date: number;
70
+ /** Count of ALL deliverable vouchers this day, credit notes included. */
71
+ quantity: number;
72
+ /**
73
+ * Legacy roll-up columns. These sum EVERY deliverable voucher with a
74
+ * POSITIVE sign — credit notes included — so `total` is a mixture of
75
+ * debits and credits rather than a meaningful sales figure. Retained
76
+ * unchanged for wire compatibility; prefer `gross`/`credit`/`net` below.
77
+ *
78
+ * `neto10`/`neto21`/`iva10`/`iva21` only ever covered AFIP `Iva[].Id` 4
79
+ * (10,5 %) and 5 (21 %); `neto`/`iva` are the all-alícuota roll-ups added
80
+ * by api#1961.
81
+ */
82
+ neto10: number;
83
+ neto21: number;
84
+ iva10: number;
85
+ iva21: number;
86
+ neto: number;
87
+ iva: number;
88
+ total: number;
89
+ /** Non-credit vouchers — facturas and notas de débito. */
90
+ gross: ReportInvoicesAmounts;
91
+ /**
92
+ * Notas de crédito only, as positive magnitudes. Classified via the
93
+ * canonical `NC_CBTE_TIPOS` family, NOT a hardcoded `[3, 8, 13]`.
94
+ *
95
+ * ⚠️ Notas de DÉBITO are deliberately NOT here — a débito increases what
96
+ * is owed, so it belongs in `gross`. Netting both would move the total in
97
+ * the wrong direction.
98
+ */
99
+ credit: ReportInvoicesAmounts;
100
+ /** `gross - credit`, field by field. The figure an operator should read. */
101
+ net: ReportInvoicesAmounts;
102
+ }
103
+ /**
104
+ * One voucher row of the ventas summary's spreadsheet export.
105
+ *
106
+ * ⚠️ Mixed string/number by design — the padded fiscal columns are strings
107
+ * while the amounts are numbers. The app's local copy typed this
108
+ * `Record<string, string>[]`, which was wrong for five of the ten fields.
109
+ */
110
+ interface ReportInvoicesVoucherRow {
111
+ FECHA: string;
112
+ CBTE_TIPO: string;
113
+ PTO_VTA: string;
114
+ CBTE_NUMERO: number;
115
+ RAZON_SOCIAL: string;
116
+ CUIT: string;
117
+ NETO: number;
118
+ NETO10: number;
119
+ NETO21: number;
120
+ TOTAL: number;
121
+ }
122
+ /**
123
+ * `GET /reports?mode=invoices&date=YYYYMM` response payload.
124
+ *
125
+ * Carries BOTH the operator-facing summary (`resume`, `period`) and the ARCA
126
+ * REGINFO_CV_VENTAS flat files (`customers`, `reg_alicuotas`, `reg_cbte`).
127
+ *
128
+ * ⚠️ The two are produced from the same voucher set but must never share sign
129
+ * semantics: the summary nets credit notes, the flat files keep every voucher
130
+ * a positive magnitude carrying its own `CbteTipo`. A sign leak into the
131
+ * fixed-width records corrupts a filing.
132
+ */
133
+ interface ReportInvoices {
134
+ /** Per-day rows, ascending by `date`. */
135
+ resume: ReportInvoicesResume[];
136
+ /** Same FAC/NC/net split aggregated over the whole selected period (api#2011). */
137
+ period: {
138
+ gross: ReportInvoicesAmounts;
139
+ credit: ReportInvoicesAmounts;
140
+ net: ReportInvoicesAmounts;
141
+ };
142
+ invoices: ReportInvoicesVoucherRow[];
143
+ /** REGINFO_CV_VENTAS fixed-width padrón de clientes. */
144
+ customers: string;
145
+ /** REGINFO_CV_VENTAS_ALICUOTAS.TXT — one record per declared alícuota. */
146
+ reg_alicuotas: string;
147
+ /** REGINFO_CV_VENTAS_CBTE.TXT — one record per voucher. */
148
+ reg_cbte: string;
149
+ }
35
150
  }
36
151
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sinfactura-types",
3
- "version": "1.9.0",
3
+ "version": "1.9.1",
4
4
  "main": "dist/index.js",
5
5
  "type": "module",
6
6
  "types": "./dist/index.d.ts",