@accounter/opcn1214-generator 0.0.0-bootstrap.0 → 0.0.0-stage

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 (477) hide show
  1. package/README.md +2 -336
  2. package/package.json +3 -74
  3. package/.bob/cjs/api/generate.d.ts +0 -44
  4. package/.bob/cjs/api/generate.js +0 -115
  5. package/.bob/cjs/api/parse.d.ts +0 -28
  6. package/.bob/cjs/api/parse.js +0 -38
  7. package/.bob/cjs/api/response.d.ts +0 -24
  8. package/.bob/cjs/api/response.js +0 -75
  9. package/.bob/cjs/api/validate.d.ts +0 -16
  10. package/.bob/cjs/api/validate.js +0 -15
  11. package/.bob/cjs/codec/boolean.d.ts +0 -7
  12. package/.bob/cjs/codec/boolean.js +0 -49
  13. package/.bob/cjs/codec/date.d.ts +0 -6
  14. package/.bob/cjs/codec/date.js +0 -68
  15. package/.bob/cjs/codec/enum.d.ts +0 -4
  16. package/.bob/cjs/codec/enum.js +0 -26
  17. package/.bob/cjs/codec/numeric.d.ts +0 -56
  18. package/.bob/cjs/codec/numeric.js +0 -186
  19. package/.bob/cjs/codec/padding.d.ts +0 -10
  20. package/.bob/cjs/codec/padding.js +0 -26
  21. package/.bob/cjs/codec/percent.d.ts +0 -6
  22. package/.bob/cjs/codec/percent.js +0 -33
  23. package/.bob/cjs/codec/phone.d.ts +0 -4
  24. package/.bob/cjs/codec/phone.js +0 -48
  25. package/.bob/cjs/codec/record.d.ts +0 -18
  26. package/.bob/cjs/codec/record.js +0 -176
  27. package/.bob/cjs/codec/registry.d.ts +0 -8
  28. package/.bob/cjs/codec/registry.js +0 -27
  29. package/.bob/cjs/codec/sections.d.ts +0 -41
  30. package/.bob/cjs/codec/sections.js +0 -177
  31. package/.bob/cjs/codec/text.d.ts +0 -5
  32. package/.bob/cjs/codec/text.js +0 -29
  33. package/.bob/cjs/codec/types.d.ts +0 -36
  34. package/.bob/cjs/codec/types.js +0 -16
  35. package/.bob/cjs/codec/windows1255.d.ts +0 -9
  36. package/.bob/cjs/codec/windows1255.js +0 -38
  37. package/.bob/cjs/errors.d.ts +0 -32
  38. package/.bob/cjs/errors.js +0 -103
  39. package/.bob/cjs/file/assemble.d.ts +0 -17
  40. package/.bob/cjs/file/assemble.js +0 -28
  41. package/.bob/cjs/file/control.d.ts +0 -13
  42. package/.bob/cjs/file/control.js +0 -45
  43. package/.bob/cjs/file/parse.d.ts +0 -18
  44. package/.bob/cjs/file/parse.js +0 -478
  45. package/.bob/cjs/file/split.d.ts +0 -17
  46. package/.bob/cjs/file/split.js +0 -71
  47. package/.bob/cjs/index.d.ts +0 -16
  48. package/.bob/cjs/index.js +0 -28
  49. package/.bob/cjs/layout/2024/layout.generated.d.ts +0 -6919
  50. package/.bob/cjs/layout/2024/layout.generated.js +0 -7224
  51. package/.bob/cjs/layout/2025/index.d.ts +0 -6
  52. package/.bob/cjs/layout/2025/index.js +0 -10
  53. package/.bob/cjs/layout/capital-gains.d.ts +0 -9
  54. package/.bob/cjs/layout/capital-gains.js +0 -15
  55. package/.bob/cjs/layout/countries.d.ts +0 -5
  56. package/.bob/cjs/layout/countries.js +0 -10
  57. package/.bob/cjs/layout/freeze.d.ts +0 -5
  58. package/.bob/cjs/layout/freeze.js +0 -16
  59. package/.bob/cjs/layout/registry.d.ts +0 -10
  60. package/.bob/cjs/layout/registry.js +0 -32
  61. package/.bob/cjs/layout/types.d.ts +0 -82
  62. package/.bob/cjs/layout/types.js +0 -35
  63. package/.bob/cjs/model/codes.generated.d.ts +0 -48
  64. package/.bob/cjs/model/codes.generated.js +0 -628
  65. package/.bob/cjs/model/index.d.ts +0 -3
  66. package/.bob/cjs/model/index.js +0 -5
  67. package/.bob/cjs/model/input.d.ts +0 -543
  68. package/.bob/cjs/model/input.js +0 -24
  69. package/.bob/cjs/model/normalized.d.ts +0 -43
  70. package/.bob/cjs/model/normalized.js +0 -0
  71. package/.bob/cjs/model/options.d.ts +0 -14
  72. package/.bob/cjs/model/options.js +0 -0
  73. package/.bob/cjs/model/schema.d.ts +0 -594
  74. package/.bob/cjs/model/schema.js +0 -339
  75. package/.bob/cjs/normalize/canonical.d.ts +0 -13
  76. package/.bob/cjs/normalize/canonical.js +0 -288
  77. package/.bob/cjs/normalize/capital-gains/assets.d.ts +0 -37
  78. package/.bob/cjs/normalize/capital-gains/assets.js +0 -94
  79. package/.bob/cjs/normalize/capital-gains/index.d.ts +0 -61
  80. package/.bob/cjs/normalize/capital-gains/index.js +0 -149
  81. package/.bob/cjs/normalize/capital-gains/no-withholding.d.ts +0 -18
  82. package/.bob/cjs/normalize/capital-gains/no-withholding.js +0 -36
  83. package/.bob/cjs/normalize/capital-gains/other.d.ts +0 -54
  84. package/.bob/cjs/normalize/capital-gains/other.js +0 -122
  85. package/.bob/cjs/normalize/capital-gains/section6.d.ts +0 -7
  86. package/.bob/cjs/normalize/capital-gains/section6.js +0 -13
  87. package/.bob/cjs/normalize/capital-gains/securities.d.ts +0 -26
  88. package/.bob/cjs/normalize/capital-gains/securities.js +0 -58
  89. package/.bob/cjs/normalize/denormalize.d.ts +0 -42
  90. package/.bob/cjs/normalize/denormalize.js +0 -359
  91. package/.bob/cjs/normalize/derive.d.ts +0 -57
  92. package/.bob/cjs/normalize/derive.js +0 -111
  93. package/.bob/cjs/normalize/enums.d.ts +0 -58
  94. package/.bob/cjs/normalize/enums.js +0 -69
  95. package/.bob/cjs/normalize/fields.d.ts +0 -28
  96. package/.bob/cjs/normalize/fields.js +0 -86
  97. package/.bob/cjs/normalize/foreign.d.ts +0 -22
  98. package/.bob/cjs/normalize/foreign.js +0 -85
  99. package/.bob/cjs/normalize/main.d.ts +0 -24
  100. package/.bob/cjs/normalize/main.js +0 -208
  101. package/.bob/cjs/normalize/paths.d.ts +0 -74
  102. package/.bob/cjs/normalize/paths.js +0 -169
  103. package/.bob/cjs/normalize/phone.d.ts +0 -12
  104. package/.bob/cjs/normalize/phone.js +0 -35
  105. package/.bob/cjs/normalize/rd-investments.d.ts +0 -10
  106. package/.bob/cjs/normalize/rd-investments.js +0 -25
  107. package/.bob/cjs/normalize/related-companies.d.ts +0 -10
  108. package/.bob/cjs/normalize/related-companies.js +0 -25
  109. package/.bob/cjs/normalize/report.d.ts +0 -9
  110. package/.bob/cjs/normalize/report.js +0 -53
  111. package/.bob/cjs/normalize/shareholders.d.ts +0 -10
  112. package/.bob/cjs/normalize/shareholders.js +0 -30
  113. package/.bob/cjs/normalize/text.d.ts +0 -11
  114. package/.bob/cjs/normalize/text.js +0 -41
  115. package/.bob/cjs/normalize/today.d.ts +0 -4
  116. package/.bob/cjs/normalize/today.js +0 -14
  117. package/.bob/cjs/pipeline.d.ts +0 -13
  118. package/.bob/cjs/pipeline.js +0 -37
  119. package/.bob/cjs/response/codes.d.ts +0 -2
  120. package/.bob/cjs/response/codes.js +0 -31
  121. package/.bob/cjs/validate/capital-gains-rules.d.ts +0 -6
  122. package/.bob/cjs/validate/capital-gains-rules.js +0 -162
  123. package/.bob/cjs/validate/check-digit.d.ts +0 -10
  124. package/.bob/cjs/validate/check-digit.js +0 -26
  125. package/.bob/cjs/validate/engine.d.ts +0 -5
  126. package/.bob/cjs/validate/engine.js +0 -35
  127. package/.bob/cjs/validate/field-rules.d.ts +0 -4
  128. package/.bob/cjs/validate/field-rules.js +0 -331
  129. package/.bob/cjs/validate/foreign-rules.d.ts +0 -6
  130. package/.bob/cjs/validate/foreign-rules.js +0 -171
  131. package/.bob/cjs/validate/issue.d.ts +0 -51
  132. package/.bob/cjs/validate/issue.js +0 -78
  133. package/.bob/cjs/validate/main-rules.d.ts +0 -24
  134. package/.bob/cjs/validate/main-rules.js +0 -425
  135. package/.bob/cjs/validate/parse-rules.d.ts +0 -31
  136. package/.bob/cjs/validate/parse-rules.js +0 -114
  137. package/.bob/cjs/validate/rules.d.ts +0 -746
  138. package/.bob/cjs/validate/rules.js +0 -680
  139. package/.bob/cjs/validate/shape.d.ts +0 -19
  140. package/.bob/cjs/validate/shape.js +0 -231
  141. package/.bob/cjs/validate/shareholder-rules.d.ts +0 -6
  142. package/.bob/cjs/validate/shareholder-rules.js +0 -83
  143. package/.bob/cjs/validate/structure-rules.d.ts +0 -26
  144. package/.bob/cjs/validate/structure-rules.js +0 -130
  145. package/.bob/esm/api/generate.d.ts +0 -44
  146. package/.bob/esm/api/generate.js +0 -111
  147. package/.bob/esm/api/parse.d.ts +0 -28
  148. package/.bob/esm/api/parse.js +0 -34
  149. package/.bob/esm/api/response.d.ts +0 -24
  150. package/.bob/esm/api/response.js +0 -72
  151. package/.bob/esm/api/validate.d.ts +0 -16
  152. package/.bob/esm/api/validate.js +0 -11
  153. package/.bob/esm/codec/boolean.d.ts +0 -7
  154. package/.bob/esm/codec/boolean.js +0 -46
  155. package/.bob/esm/codec/date.d.ts +0 -6
  156. package/.bob/esm/codec/date.js +0 -64
  157. package/.bob/esm/codec/enum.d.ts +0 -4
  158. package/.bob/esm/codec/enum.js +0 -23
  159. package/.bob/esm/codec/numeric.d.ts +0 -56
  160. package/.bob/esm/codec/numeric.js +0 -175
  161. package/.bob/esm/codec/padding.d.ts +0 -10
  162. package/.bob/esm/codec/padding.js +0 -21
  163. package/.bob/esm/codec/percent.d.ts +0 -6
  164. package/.bob/esm/codec/percent.js +0 -30
  165. package/.bob/esm/codec/phone.d.ts +0 -4
  166. package/.bob/esm/codec/phone.js +0 -45
  167. package/.bob/esm/codec/record.d.ts +0 -18
  168. package/.bob/esm/codec/record.js +0 -172
  169. package/.bob/esm/codec/registry.d.ts +0 -8
  170. package/.bob/esm/codec/registry.js +0 -23
  171. package/.bob/esm/codec/sections.d.ts +0 -41
  172. package/.bob/esm/codec/sections.js +0 -170
  173. package/.bob/esm/codec/text.d.ts +0 -5
  174. package/.bob/esm/codec/text.js +0 -26
  175. package/.bob/esm/codec/types.d.ts +0 -36
  176. package/.bob/esm/codec/types.js +0 -12
  177. package/.bob/esm/codec/windows1255.d.ts +0 -9
  178. package/.bob/esm/codec/windows1255.js +0 -32
  179. package/.bob/esm/errors.d.ts +0 -32
  180. package/.bob/esm/errors.js +0 -94
  181. package/.bob/esm/file/assemble.d.ts +0 -17
  182. package/.bob/esm/file/assemble.js +0 -25
  183. package/.bob/esm/file/control.d.ts +0 -13
  184. package/.bob/esm/file/control.js +0 -41
  185. package/.bob/esm/file/parse.d.ts +0 -18
  186. package/.bob/esm/file/parse.js +0 -474
  187. package/.bob/esm/file/split.d.ts +0 -17
  188. package/.bob/esm/file/split.js +0 -68
  189. package/.bob/esm/index.d.ts +0 -16
  190. package/.bob/esm/index.js +0 -11
  191. package/.bob/esm/layout/2024/layout.generated.d.ts +0 -6919
  192. package/.bob/esm/layout/2024/layout.generated.js +0 -7221
  193. package/.bob/esm/layout/2025/index.d.ts +0 -6
  194. package/.bob/esm/layout/2025/index.js +0 -7
  195. package/.bob/esm/layout/capital-gains.d.ts +0 -9
  196. package/.bob/esm/layout/capital-gains.js +0 -11
  197. package/.bob/esm/layout/countries.d.ts +0 -5
  198. package/.bob/esm/layout/countries.js +0 -7
  199. package/.bob/esm/layout/freeze.d.ts +0 -5
  200. package/.bob/esm/layout/freeze.js +0 -13
  201. package/.bob/esm/layout/registry.d.ts +0 -10
  202. package/.bob/esm/layout/registry.js +0 -27
  203. package/.bob/esm/layout/types.d.ts +0 -82
  204. package/.bob/esm/layout/types.js +0 -32
  205. package/.bob/esm/model/codes.generated.d.ts +0 -48
  206. package/.bob/esm/model/codes.generated.js +0 -625
  207. package/.bob/esm/model/index.d.ts +0 -3
  208. package/.bob/esm/model/index.js +0 -2
  209. package/.bob/esm/model/input.d.ts +0 -543
  210. package/.bob/esm/model/input.js +0 -21
  211. package/.bob/esm/model/normalized.d.ts +0 -43
  212. package/.bob/esm/model/normalized.js +0 -0
  213. package/.bob/esm/model/options.d.ts +0 -14
  214. package/.bob/esm/model/options.js +0 -0
  215. package/.bob/esm/model/schema.d.ts +0 -594
  216. package/.bob/esm/model/schema.js +0 -335
  217. package/.bob/esm/normalize/canonical.d.ts +0 -13
  218. package/.bob/esm/normalize/canonical.js +0 -285
  219. package/.bob/esm/normalize/capital-gains/assets.d.ts +0 -37
  220. package/.bob/esm/normalize/capital-gains/assets.js +0 -87
  221. package/.bob/esm/normalize/capital-gains/index.d.ts +0 -61
  222. package/.bob/esm/normalize/capital-gains/index.js +0 -142
  223. package/.bob/esm/normalize/capital-gains/no-withholding.d.ts +0 -18
  224. package/.bob/esm/normalize/capital-gains/no-withholding.js +0 -31
  225. package/.bob/esm/normalize/capital-gains/other.d.ts +0 -54
  226. package/.bob/esm/normalize/capital-gains/other.js +0 -112
  227. package/.bob/esm/normalize/capital-gains/section6.d.ts +0 -7
  228. package/.bob/esm/normalize/capital-gains/section6.js +0 -9
  229. package/.bob/esm/normalize/capital-gains/securities.d.ts +0 -26
  230. package/.bob/esm/normalize/capital-gains/securities.js +0 -52
  231. package/.bob/esm/normalize/denormalize.d.ts +0 -42
  232. package/.bob/esm/normalize/denormalize.js +0 -354
  233. package/.bob/esm/normalize/derive.d.ts +0 -57
  234. package/.bob/esm/normalize/derive.js +0 -99
  235. package/.bob/esm/normalize/enums.d.ts +0 -58
  236. package/.bob/esm/normalize/enums.js +0 -64
  237. package/.bob/esm/normalize/fields.d.ts +0 -28
  238. package/.bob/esm/normalize/fields.js +0 -81
  239. package/.bob/esm/normalize/foreign.d.ts +0 -22
  240. package/.bob/esm/normalize/foreign.js +0 -81
  241. package/.bob/esm/normalize/main.d.ts +0 -24
  242. package/.bob/esm/normalize/main.js +0 -204
  243. package/.bob/esm/normalize/paths.d.ts +0 -74
  244. package/.bob/esm/normalize/paths.js +0 -161
  245. package/.bob/esm/normalize/phone.d.ts +0 -12
  246. package/.bob/esm/normalize/phone.js +0 -32
  247. package/.bob/esm/normalize/rd-investments.d.ts +0 -10
  248. package/.bob/esm/normalize/rd-investments.js +0 -22
  249. package/.bob/esm/normalize/related-companies.d.ts +0 -10
  250. package/.bob/esm/normalize/related-companies.js +0 -22
  251. package/.bob/esm/normalize/report.d.ts +0 -9
  252. package/.bob/esm/normalize/report.js +0 -50
  253. package/.bob/esm/normalize/shareholders.d.ts +0 -10
  254. package/.bob/esm/normalize/shareholders.js +0 -27
  255. package/.bob/esm/normalize/text.d.ts +0 -11
  256. package/.bob/esm/normalize/text.js +0 -37
  257. package/.bob/esm/normalize/today.d.ts +0 -4
  258. package/.bob/esm/normalize/today.js +0 -11
  259. package/.bob/esm/pipeline.d.ts +0 -13
  260. package/.bob/esm/pipeline.js +0 -34
  261. package/.bob/esm/response/codes.d.ts +0 -2
  262. package/.bob/esm/response/codes.js +0 -28
  263. package/.bob/esm/validate/capital-gains-rules.d.ts +0 -6
  264. package/.bob/esm/validate/capital-gains-rules.js +0 -159
  265. package/.bob/esm/validate/check-digit.d.ts +0 -10
  266. package/.bob/esm/validate/check-digit.js +0 -23
  267. package/.bob/esm/validate/engine.d.ts +0 -5
  268. package/.bob/esm/validate/engine.js +0 -32
  269. package/.bob/esm/validate/field-rules.d.ts +0 -4
  270. package/.bob/esm/validate/field-rules.js +0 -328
  271. package/.bob/esm/validate/foreign-rules.d.ts +0 -6
  272. package/.bob/esm/validate/foreign-rules.js +0 -168
  273. package/.bob/esm/validate/issue.d.ts +0 -51
  274. package/.bob/esm/validate/issue.js +0 -72
  275. package/.bob/esm/validate/main-rules.d.ts +0 -24
  276. package/.bob/esm/validate/main-rules.js +0 -420
  277. package/.bob/esm/validate/parse-rules.d.ts +0 -31
  278. package/.bob/esm/validate/parse-rules.js +0 -110
  279. package/.bob/esm/validate/rules.d.ts +0 -746
  280. package/.bob/esm/validate/rules.js +0 -676
  281. package/.bob/esm/validate/shape.d.ts +0 -19
  282. package/.bob/esm/validate/shape.js +0 -227
  283. package/.bob/esm/validate/shareholder-rules.d.ts +0 -6
  284. package/.bob/esm/validate/shareholder-rules.js +0 -80
  285. package/.bob/esm/validate/structure-rules.d.ts +0 -26
  286. package/.bob/esm/validate/structure-rules.js +0 -122
  287. package/.bob/tsconfig.tsbuildinfo +0 -1
  288. package/.gitattributes +0 -1
  289. package/CLAUDE.md +0 -39
  290. package/dist/cjs/index.js +0 -28
  291. package/dist/esm/index.js +0 -11
  292. package/documentation/IMPLEMENTATION_PLAN.md +0 -2258
  293. package/documentation/SPEC.md +0 -1803
  294. package/documentation/layout/2024/codes.csv +0 -261
  295. package/documentation/layout/2024/countries.csv +0 -256
  296. package/documentation/layout/2024/fields.csv +0 -271
  297. package/documentation/layout/2024/records.csv +0 -18
  298. package/documentation/layout/README.md +0 -87
  299. package/documentation/specifications/1214-2024.pdf +0 -0
  300. package/documentation/tools/extract_layout.py +0 -191
  301. package/scripts/generate-layout.ts +0 -23
  302. package/scripts/layout/csv.ts +0 -111
  303. package/scripts/layout/derived-codes.ts +0 -12
  304. package/scripts/layout/render.ts +0 -364
  305. package/scripts/layout/sources.ts +0 -51
  306. package/scripts/layout/values.ts +0 -42
  307. package/scripts/render-rules-table.ts +0 -66
  308. package/src/api/generate.ts +0 -169
  309. package/src/api/parse.ts +0 -58
  310. package/src/api/response.ts +0 -110
  311. package/src/api/validate.ts +0 -26
  312. package/src/codec/boolean.ts +0 -62
  313. package/src/codec/date.ts +0 -75
  314. package/src/codec/enum.ts +0 -28
  315. package/src/codec/numeric.ts +0 -208
  316. package/src/codec/padding.ts +0 -33
  317. package/src/codec/percent.ts +0 -35
  318. package/src/codec/phone.ts +0 -54
  319. package/src/codec/record.ts +0 -206
  320. package/src/codec/registry.ts +0 -27
  321. package/src/codec/sections.ts +0 -208
  322. package/src/codec/text.ts +0 -31
  323. package/src/codec/types.ts +0 -47
  324. package/src/codec/windows1255.ts +0 -38
  325. package/src/errors.ts +0 -114
  326. package/src/file/assemble.ts +0 -42
  327. package/src/file/control.ts +0 -59
  328. package/src/file/parse.ts +0 -620
  329. package/src/file/split.ts +0 -86
  330. package/src/index.ts +0 -70
  331. package/src/layout/2024/layout.generated.ts +0 -7238
  332. package/src/layout/2025/index.ts +0 -9
  333. package/src/layout/capital-gains.ts +0 -20
  334. package/src/layout/countries.ts +0 -7
  335. package/src/layout/freeze.ts +0 -13
  336. package/src/layout/registry.ts +0 -33
  337. package/src/layout/types.ts +0 -134
  338. package/src/model/codes.generated.ts +0 -1190
  339. package/src/model/index.ts +0 -4
  340. package/src/model/input.ts +0 -594
  341. package/src/model/normalized.ts +0 -38
  342. package/src/model/options.ts +0 -17
  343. package/src/model/schema.ts +0 -381
  344. package/src/normalize/canonical.ts +0 -374
  345. package/src/normalize/capital-gains/assets.ts +0 -112
  346. package/src/normalize/capital-gains/index.ts +0 -212
  347. package/src/normalize/capital-gains/no-withholding.ts +0 -46
  348. package/src/normalize/capital-gains/other.ts +0 -153
  349. package/src/normalize/capital-gains/section6.ts +0 -14
  350. package/src/normalize/capital-gains/securities.ts +0 -73
  351. package/src/normalize/denormalize.ts +0 -426
  352. package/src/normalize/derive.ts +0 -136
  353. package/src/normalize/enums.ts +0 -87
  354. package/src/normalize/fields.ts +0 -110
  355. package/src/normalize/foreign.ts +0 -114
  356. package/src/normalize/main.ts +0 -284
  357. package/src/normalize/paths.ts +0 -184
  358. package/src/normalize/phone.ts +0 -45
  359. package/src/normalize/rd-investments.ts +0 -38
  360. package/src/normalize/related-companies.ts +0 -37
  361. package/src/normalize/report.ts +0 -59
  362. package/src/normalize/shareholders.ts +0 -42
  363. package/src/normalize/text.ts +0 -40
  364. package/src/normalize/today.ts +0 -15
  365. package/src/pipeline.ts +0 -42
  366. package/src/response/codes.ts +0 -30
  367. package/src/validate/capital-gains-rules.ts +0 -199
  368. package/src/validate/check-digit.ts +0 -25
  369. package/src/validate/engine.ts +0 -45
  370. package/src/validate/field-rules.ts +0 -383
  371. package/src/validate/foreign-rules.ts +0 -274
  372. package/src/validate/issue.ts +0 -121
  373. package/src/validate/main-rules.ts +0 -678
  374. package/src/validate/parse-rules.ts +0 -169
  375. package/src/validate/rules.ts +0 -747
  376. package/src/validate/shape.ts +0 -278
  377. package/src/validate/shareholder-rules.ts +0 -92
  378. package/src/validate/structure-rules.ts +0 -136
  379. package/tests/api/batch.test.ts +0 -227
  380. package/tests/api/exports.test.ts +0 -355
  381. package/tests/api/generate.test.ts +0 -409
  382. package/tests/api/parse.test.ts +0 -789
  383. package/tests/api/response.test.ts +0 -152
  384. package/tests/api/validate.test.ts +0 -86
  385. package/tests/codec/numeric.test.ts +0 -325
  386. package/tests/codec/record.test.ts +0 -318
  387. package/tests/codec/registry.test.ts +0 -17
  388. package/tests/codec/sections.test.ts +0 -333
  389. package/tests/codec/text.test.ts +0 -454
  390. package/tests/codec/windows1255.test.ts +0 -46
  391. package/tests/docs/readme.test.ts +0 -69
  392. package/tests/edge-cases.test.ts +0 -359
  393. package/tests/errors.test.ts +0 -138
  394. package/tests/file/assemble.test.ts +0 -188
  395. package/tests/file/split.test.ts +0 -61
  396. package/tests/fixtures/builders.ts +0 -512
  397. package/tests/fixtures/files.ts +0 -78
  398. package/tests/fixtures/golden/README.md +0 -37
  399. package/tests/fixtures/golden/VERIFICATION.md +0 -72
  400. package/tests/fixtures/golden/batch-50.input.ts +0 -92
  401. package/tests/fixtures/golden/batch-50.opcn +0 -150
  402. package/tests/fixtures/golden/capital-gains-max.input.ts +0 -177
  403. package/tests/fixtures/golden/capital-gains-max.opcn +0 -17
  404. package/tests/fixtures/golden/cg-27.input.ts +0 -63
  405. package/tests/fixtures/golden/cg-27.opcn +0 -4
  406. package/tests/fixtures/golden/cg-50.input.ts +0 -59
  407. package/tests/fixtures/golden/cg-50.opcn +0 -4
  408. package/tests/fixtures/golden/cg-51.input.ts +0 -60
  409. package/tests/fixtures/golden/cg-51.opcn +0 -4
  410. package/tests/fixtures/golden/cg-54.input.ts +0 -53
  411. package/tests/fixtures/golden/cg-54.opcn +0 -4
  412. package/tests/fixtures/golden/cg-60.input.ts +0 -77
  413. package/tests/fixtures/golden/cg-60.opcn +0 -4
  414. package/tests/fixtures/golden/cg-63.input.ts +0 -51
  415. package/tests/fixtures/golden/cg-63.opcn +0 -4
  416. package/tests/fixtures/golden/cg-64.input.ts +0 -62
  417. package/tests/fixtures/golden/cg-64.opcn +0 -4
  418. package/tests/fixtures/golden/cg-65.input.ts +0 -79
  419. package/tests/fixtures/golden/cg-65.opcn +0 -4
  420. package/tests/fixtures/golden/cg-66.input.ts +0 -53
  421. package/tests/fixtures/golden/cg-66.opcn +0 -4
  422. package/tests/fixtures/golden/cg-77.input.ts +0 -109
  423. package/tests/fixtures/golden/cg-77.opcn +0 -4
  424. package/tests/fixtures/golden/foreign.input.ts +0 -202
  425. package/tests/fixtures/golden/foreign.opcn +0 -27
  426. package/tests/fixtures/golden/hebrew-edge.input.ts +0 -90
  427. package/tests/fixtures/golden/hebrew-edge.opcn +0 -8
  428. package/tests/fixtures/golden/kibbutz.input.ts +0 -31
  429. package/tests/fixtures/golden/kibbutz.opcn +0 -2
  430. package/tests/fixtures/golden/main-full.input.ts +0 -780
  431. package/tests/fixtures/golden/main-full.opcn +0 -101
  432. package/tests/fixtures/golden/minimal.input.ts +0 -37
  433. package/tests/fixtures/golden/minimal.opcn +0 -3
  434. package/tests/fixtures/golden/related-and-rd.input.ts +0 -59
  435. package/tests/fixtures/golden/related-and-rd.opcn +0 -11
  436. package/tests/fixtures/random.ts +0 -843
  437. package/tests/golden/fixtures.test.ts +0 -627
  438. package/tests/golden/golden.test.ts +0 -95
  439. package/tests/helpers/coverage.ts +0 -18
  440. package/tests/helpers/sample-values.ts +0 -114
  441. package/tests/layout/codegen-sync.test.ts +0 -19
  442. package/tests/layout/integrity.test.ts +0 -232
  443. package/tests/layout/registry.test.ts +0 -98
  444. package/tests/model/code-unions.test.ts +0 -91
  445. package/tests/model/schema.test.ts +0 -1031
  446. package/tests/normalize/canonical.test.ts +0 -728
  447. package/tests/normalize/capital-gains.test.ts +0 -1850
  448. package/tests/normalize/coverage.test.ts +0 -88
  449. package/tests/normalize/denormalize.test.ts +0 -318
  450. package/tests/normalize/enums.test.ts +0 -118
  451. package/tests/normalize/foreign.test.ts +0 -273
  452. package/tests/normalize/main.test.ts +0 -839
  453. package/tests/normalize/paths.test.ts +0 -257
  454. package/tests/normalize/rd-investments.test.ts +0 -99
  455. package/tests/normalize/related-companies.test.ts +0 -106
  456. package/tests/normalize/shareholders.test.ts +0 -117
  457. package/tests/normalize/text.test.ts +0 -86
  458. package/tests/pipeline.test.ts +0 -96
  459. package/tests/roundtrip/determinism.test.ts +0 -207
  460. package/tests/roundtrip/property.test.ts +0 -126
  461. package/tests/roundtrip/roundtrip.test.ts +0 -573
  462. package/tests/rules/cases.ts +0 -873
  463. package/tests/rules/rules.test.ts +0 -69
  464. package/tests/rules/spec-sync.test.ts +0 -80
  465. package/tests/scripts/csv.test.ts +0 -78
  466. package/tests/scripts/values.test.ts +0 -80
  467. package/tests/validate/capital-gains-rules.test.ts +0 -307
  468. package/tests/validate/check-digit.test.ts +0 -42
  469. package/tests/validate/field-rules.test.ts +0 -867
  470. package/tests/validate/foreign-rules.test.ts +0 -255
  471. package/tests/validate/issue.test.ts +0 -96
  472. package/tests/validate/main-rules.test.ts +0 -761
  473. package/tests/validate/parse-rules.test.ts +0 -293
  474. package/tests/validate/shareholder-rules.test.ts +0 -143
  475. package/tsconfig.json +0 -10
  476. package/tsconfig.typecheck.json +0 -9
  477. package/vitest.config.ts +0 -11
@@ -1,1803 +0,0 @@
1
- # `@accounter/opcn1214-generator` — Developer Specification
2
-
3
- Status: **implemented** (golden-file verification on shopcn:
4
- [`VERIFICATION.md`](../tests/fixtures/golden/VERIFICATION.md)). Normative source: SHAAM, _"מבנה קובץ
5
- מייצגים (OPCN ואינטרנט מייצג) לטעינת דוחות 1214 מקוון 2024"_, dated 20/01/2025 —
6
- [`specifications/1214-2024.pdf`](specifications/1214-2024.pdf) (71 pages). Machine-readable
7
- extraction of every record layout: [`layout/2024/`](layout/2024/) (see
8
- [`layout/README.md`](layout/README.md)).
9
-
10
- Page references below (`p.N`) are PDF page numbers. Field positions are **1-based**, as in the spec.
11
-
12
- ## 0. How to use this document
13
-
14
- | You want to… | Read |
15
- | ---------------------------------------- | ------------------------------------------------- |
16
- | Understand what the package must do | §1, §2 |
17
- | Know the exact bytes to write | §3 (format), §4 (encoding rules), layout CSVs |
18
- | Start coding | §5 (architecture), §6 (API), §7 (input), §12 (P0) |
19
- | Implement validation | §9 (engine), §10 (rule catalogue) |
20
- | Implement error handling | §11 |
21
- | Write tests | §13 |
22
- | Know what is still uncertain in the spec | §15 (ambiguity register) |
23
- | Add the 2025 (or later) layout | §14 |
24
-
25
- Terminology: **report** = one company's 1214 return for one tax year (one _tik_ + year). **Record**
26
- = one fixed-width line. **Header** = the fixed fields of a record ("פרטים כלליים / כותרת").
27
- **Code-amount section** = the variable list of `code+amount` pairs ("קוד סכום"). **Appendix** =
28
- foreign appendix (2000) or a capital-gains appendix (30xx).
29
-
30
- ---
31
-
32
- ## 1. Goals and scope
33
-
34
- ### 1.1 Goals
35
-
36
- 1. **Generate** a SHAAM-compliant 1214 OPCN file from **structured, typed input**.
37
- 2. **Validate** input against **every rule stated in the spec**, plus a small, clearly-labelled set
38
- of derived consistency checks, and report all problems at once with stable rule IDs.
39
- 3. **Parse** a 1214 OPCN file back into the same structured input (round-trip), for tests, re-import
40
- and diagnosis.
41
- 4. **Stable output:** byte-identical files for identical input; stable rule IDs and issue paths
42
- (semver-governed, §6.5).
43
- 5. **Per-tax-year layouts**: the year selects the layout; unsupported years are rejected.
44
- 6. Parse SHAAM's **response file** (`shumot.shg`, §3.9) so callers can map responses to reports.
45
-
46
- ### 1.2 Non-goals
47
-
48
- - No tax computation. The caller supplies every amount; the package never computes tax, totals or
49
- rates (it only derives structural values such as counts, flags and serial numbers, §7.4).
50
- - No transmission to SHAAM, no OPCN client, no UI.
51
- - No Accounter server/client integration (follow-up; notes in Appendix B).
52
- - No support for the paper form, PDF rendering or form 1214ב (dividend report).
53
-
54
- ### 1.3 Consumers and environment
55
-
56
- - Primary consumer: `@accounter/server` (GraphQL resolver building the 1214 for the annual-audit
57
- workflow, step 18 "Generate 1214 Report").
58
- - Runtime: Node ≥ 20 and modern browsers. **No Node-only APIs at runtime** (no `fs`, no
59
- `import.meta.url` file reads) — layouts are compiled into the bundle.
60
- - Published like the sibling generators (`bob-the-bundler`, ESM + CJS, typings).
61
-
62
- ---
63
-
64
- ## 2. Requirements summary
65
-
66
- | ID | Requirement |
67
- | ---- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
68
- | R-1 | Accept a typed `Report1214Input` (§7) and produce the file text and windows-1255 bytes (§6.2). |
69
- | R-2 | Every record line has exactly the length in §3.2; the file uses CRLF line endings (§3.1). |
70
- | R-3 | Records appear in the canonical order of §3.3; 9999 is generated automatically and is always last. |
71
- | R-4 | All fields are encoded per §4; numeric fields zero-padded, alphanumeric fields space-padded. |
72
- | R-5 | Code-amount sections contain only filled codes, in ascending code order, zero-filled to section length. |
73
- | R-6 | All structural limits are enforced: 1010 ≤ 3; 1020 1–99 (0 only for a kibbutz); 1030 ≤ 5; 2000 ≤ 1; 2200 ≤ 30; capital-gains appendices ≤ 14; 1000 code pairs ≤ 61; ≤ 10 countries per 2200. |
74
- | R-7 | Every rule in §10 marked `spec` is implemented; `derived` rules are implemented with the stated severity. |
75
- | R-8 | `validate1214` never throws on bad data; `generate1214` refuses (throws) when any error-severity issue exists. |
76
- | R-9 | Values the spec defines as derived from other data (§7.4) are computed by the package, never taken from the caller. |
77
- | R-10 | Output is deterministic: same input (including `meta.saveDate`) ⇒ identical bytes; object key order is irrelevant. |
78
- | R-11 | `parse1214(generate1214(x).bytes)` equals `canonicalize(x)` for every valid `x` (§8.4). |
79
- | R-12 | The layout used is selected by `input.taxYear`; supported years: 2024, 2025 (2025 = 2024 layout until a 2025 spec is added, §14). |
80
- | R-13 | Hebrew text is written in logical order, windows-1255, with no bidi control characters (§4.3). |
81
- | R-14 | No silent data loss: values are never truncated or rounded unless the caller opted in (§4.4, `rounding`). |
82
-
83
- ---
84
-
85
- ## 3. File format (physical)
86
-
87
- ### 3.1 File
88
-
89
- - A file contains **one report** (internet upload: exactly one; OPCN may batch up to **50** reports,
90
- p.1 — supported by the batch API, §6.1).
91
- - Each record is one line terminated by **CRLF** (`\r\n`), including the last line (§15 A-5).
92
- - Encoding: **windows-1255** single-byte (§15 A-6) ⇒ character count = byte count; all lengths in
93
- this document are bytes.
94
- - Online structure checker (does not import data): <https://secapp.taxes.gov.il/shopcn> (p.1).
95
-
96
- ### 3.2 Record types (p.2–4)
97
-
98
- Every record starts with the same 136-character prefix, then a header, then (for some records) a
99
- section:
100
-
101
- | Positions | Length | Content |
102
- | --------- | ------ | --------------------------------------- |
103
- | 1–4 | 4 | Form type, always `1214` |
104
- | 5–8 | 4 | Record type (`1000`, `1010`, … `9999`) |
105
- | 9–136 | 128 | Reserved, all `0` |
106
- | 137–… | varies | Header ("פרטים כלליים") |
107
- | after hdr | varies | Section (code-amount or country-amount) |
108
-
109
- | Record | Content | Header | Section | Total | Occurs |
110
- | ------ | ------------------------------------------------------------ | ------ | ------------------- | ----- | --------- |
111
- | 1000 | Main form: company, preparer, declarations, all main amounts | 2048 | 2048 code-amount | 4232 | exactly 1 |
112
- | 1010 | Related companies in Israel/abroad (part C) | 1024 | — | 1160 | 0–3 |
113
- | 1020 | Shareholders and amounts (part D) | 1024 | — | 1160 | 1–99 \* |
114
- | 1030 | Investments in R&D companies | 200 | — | 336 | 0–5 |
115
- | 2000 | Foreign appendix | 1024 | 1024 code-amount | 2184 | 0–1 |
116
- | 2200 | Foreign income by country (one per 2000 code) | 50 | 1024 country-amount | 1210 | 0–30 |
117
- | 3027 | Capital gains — shares (symbol 27) | 1024 | 1024 code-amount | 2184 | } total |
118
- | 3050 | Capital gains — betterment-tax transaction (50) | 1024 | 1024 code-amount | 2184 | } 0–14 |
119
- | 3051 | Capital gains — forced transaction, virtual currency (51) | 1024 | 1024 code-amount | 2184 | } |
120
- | 3054 | Capital gains — oil-partnership units (54) | 1024 | 1024 code-amount | 2184 | } |
121
- | 3060 | Capital gains — securities (60) | 1024 | 1024 code-amount | 2184 | } |
122
- | 3063 | Capital gains — securities under section 6 (63) | 1024 | 1024 code-amount | 2184 | } |
123
- | 3064 | Capital gains — REIT funds (64) | 1024 | 1024 code-amount | 2184 | } |
124
- | 3065 | Capital gains — no withholding, form 1322 (65) | 1024 | 1024 code-amount | 2184 | } |
125
- | 3066 | Capital gains — no withholding, form 1326 (66) | 1024 | 1024 code-amount | 2184 | } |
126
- | 3077 | Capital gains — all other transactions, incl. goodwill (77) | 1024 | 1024 code-amount | 2184 | } |
127
- | 9999 | Control record | 14 | — | 150 | exactly 1 |
128
-
129
- \* At least one shareholder is mandatory except for a kibbutz report (p.1, p.21).
130
-
131
- Section start positions: 1000 → 2185 (p.13); 2000 and all 30xx → 1161 (p.27 prints "1061", a typo,
132
- §15 A-9); 2200 → 187 (p.31).
133
-
134
- The exact header fields of every record (position, length, type, required, Hebrew name, notes, spec
135
- page) are in [`layout/2024/fields.csv`](layout/2024/fields.csv) (270 rows). Every code of every
136
- code-amount section is in [`layout/2024/codes.csv`](layout/2024/codes.csv) (260 rows). Both were
137
- verified for full contiguous coverage of every record (§13.2).
138
-
139
- ### 3.3 Record order within a report
140
-
141
- 1. `1000`
142
- 2. `1010` × n — input order
143
- 3. `1020` × n — input order
144
- 4. `1030` × n — input order
145
- 5. `2000` (if a foreign appendix exists)
146
- 6. `2200` × n — ascending by the 2000 code they break down
147
- 7. Capital-gains records — grouped by record type ascending (`3027` … `3077`), input order within a
148
- type (§15 A-7)
149
- 8. `9999`
150
-
151
- ### 3.4 Header fields
152
-
153
- Each header field has a **type** (`numeric` / `alphanumeric`, the spec's נומרי / אלפאנומרי), a
154
- **length** and a **required** flag (`yes`, `no`, or `conditional` with a Hebrew condition). The CSV
155
- adds a semantic **kind** (§4.2) and the canonical **key** used by the input model. Fillers are
156
- `numeric` (all `0`) or `alphanumeric` (all spaces) per their type.
157
-
158
- ### 3.5 Code-amount sections (p.12–13, p.26, p.34 and each 30xx section)
159
-
160
- - Each entry is `code` (3 digits, zero-padded: capital-gains code `15` is written `015`) followed by
161
- its value with the **width given for that code** in `codes.csv` (1–12), zero-padded on the left.
162
- - Only codes that have a value are written ("when a code has no value, do not write the code at
163
- all", p.13). A value of `0` is written **only** for codes marked `zeroAllowed` (§4.5).
164
- - Entries are concatenated with no separators, in **ascending numeric code order** (determinism; the
165
- spec does not mandate an order).
166
- - The remainder of the section is filled with `0` up to the section length (2048 for 1000; 1024
167
- otherwise). The 1000 text says the zeros go "on the right", i.e. after the last entry.
168
- - Amounts are non-negative integers with no separators or decimal point ("amounts must be positive
169
- numbers only, without commas or dots", p.13). Values the spec says are "stored ×100" are scaled by
170
- the encoder (§4.2).
171
- - 1000 accepts at most **61** entries (p.13).
172
-
173
- ### 3.6 Country-amount section (record 2200, p.30–32)
174
-
175
- - One 2200 record per foreign-appendix code that is flagged "per-country breakdown"
176
- (`perCountryBreakdown=yes` in `codes.csv`, 23 codes) **and** has a value in the 2000 record.
177
- - Header: `137` the 2000 code (3), `140` total deductions/offsets/exemptions for that code (12),
178
- `152` filler (35 zeros).
179
- - Section at 187 (1024): up to **10** entries of `affiliation(1) = 1` + `country(3)` + `income(12)`;
180
- income is before deductions, offsets and exemptions. Remainder `0`-filled.
181
- - `country` is the 3-character country code from
182
- [`layout/2024/countries.csv`](layout/2024/countries.csv) (255 entries), zero-padded (`40` →
183
- `040`). The special code **`-88`** ("country unknown", written literally with the minus) is
184
- allowed **only for 2000 code 439** (p.32).
185
-
186
- ### 3.7 Capital-gains appendices (p.32–59)
187
-
188
- Ten record types share one shape: header 1024 + code-amount 1024. The header begins with the
189
- transaction symbol (`137`, 2 digits, = record type − 3000) and the appendix number (`139`, 3
190
- digits). Five types (3027, 3051, 3065, 3066, 3077) also carry a **"מספר בתל"ם"** sequence number
191
- ("give a running number by the order the capital gains were filled", p.35). At most **14**
192
- capital-gains appendices per report (p.1, p.32); more must be reported on field 962 with reasons
193
- 964–967.
194
-
195
- Guidance quoted from p.38: virtual-currency gains are normally reported with symbol 77 and code 71;
196
- symbol 51 (forced transaction) exists for many monthly realizations without a weighted purchase
197
- date.
198
-
199
- ### 3.8 Control record 9999 (p.59–61)
200
-
201
- | Pos | Len | Value |
202
- | --- | --- | --------------------------------------------------- |
203
- | 137 | 2 | number of 1214 forms — always `01` |
204
- | 139 | 2 | number of 1010 records (≤ 3) |
205
- | 141 | 2 | number of 1020 records (≤ 99) |
206
- | 143 | 2 | `01` if a foreign appendix (2000) exists, else `00` |
207
- | 145 | 2 | number of capital-gains appendices (≤ 14) |
208
- | 147 | 2 | number of 2200 records |
209
- | 149 | 2 | number of 1030 records |
210
-
211
- Always derived (§7.4). General notes (p.61): "record length is fixed; numeric fields are padded with
212
- zeros on the left; alphanumeric fields are padded with spaces on the left".
213
-
214
- ### 3.9 Response file `shumot.shg` (p.61–62)
215
-
216
- After transmission SHAAM returns one line per report: file number (9), tax year (4), response code
217
- (2), optionally followed by a field description for codes 08/33. Codes:
218
-
219
- | Code | Meaning (translated) |
220
- | ----- | ----------------------------------------------------------- |
221
- | 00 | Valid; saved in a temporary state |
222
- | 01 | File type closed, or after the last year allowed for filing |
223
- | 04 | Year blocked |
224
- | 05 | Report already filed |
225
- | 06 | You are not the representative of this file |
226
- | 07 | No file exists for the requested tax year |
227
- | 08 | Non-numeric value + field detail |
228
- | 09 | Report was transmitted |
229
- | 15 | Cannot transmit for the requested tax year |
230
- | 16 | Files mismatch |
231
- | 20 | Calculation type mismatch |
232
- | 21 | Report was transmitted via the internet |
233
- | 23 | A file exists for the spouse too; contact the account card |
234
- | 31 | Invalid record type |
235
- | 32 | Invalid form type |
236
- | 33 | Invalid value + field detail |
237
- | 97 | Report is being handled by the tax office |
238
- | 98 | Representatives-registry connection problem; notify SHAAM |
239
- | 99 | Input data problem; notify SHAAM |
240
- | other | General error; notify SHAAM |
241
-
242
- ---
243
-
244
- ## 4. Field encoding rules
245
-
246
- ### 4.1 General
247
-
248
- - Every value is converted to a string, validated, then padded to the field width. **A value that
249
- does not fit is an error** (`field.length`); the encoder never truncates.
250
- - Numeric fields: only `0`–`9` (exception: `percentLiteral`, §4.2), right-aligned, left-padded with
251
- `0`. An absent optional numeric value is all zeros.
252
- - Alphanumeric fields: right-aligned, left-padded with spaces, per the literal reading of p.61
253
- ("משרשרים רווחים משמאל"). An absent optional alphanumeric value is all spaces. The alignment is a
254
- single constant `ALPHANUMERIC_PAD_SIDE = 'left'` in `src/codec/padding.ts`; it is the first item
255
- to verify on shopcn (§15 A-1).
256
- - Empty strings and strings that are empty after normalization (§4.3) count as absent.
257
-
258
- ### 4.2 Kinds
259
-
260
- `kind` (column in `fields.csv` / `codes.csv`) determines input type, validation and encoding:
261
-
262
- | Kind | Input (TS) | Encoding | Notes |
263
- | -------------------------- | -------------------------------------------- | --------------------------------------------------------------------------------------------------------------------- | ---------------------------------------- |
264
- | `text` | `string` | normalized text, alnum padding | ≤ width |
265
- | `hebrewText` | `string` | as `text`; first character must be a Hebrew letter א–ת (U+05D0–U+05EA) | spec "חייב אות עברית ראשונה" |
266
- | `id9` | `string` of 1–9 digits | numeric, zero-padded to 9 | strings keep leading zeros |
267
- | `shareholderId` | `string` of 1–9 digits | as `id9`; `999999964` (not registered in Israel) and `999999998` (public holding) are valid special values | p.23 |
268
- | `year` | `number` (4 digits) | numeric | must equal the layout year |
269
- | `num` | `number` (non-negative integer) | numeric | counts, office codes, position numbers |
270
- | `digits` | digit `string` (identifier) | numeric, zero-padded; decoded as the full-width string | phone numbers, withholder branch/account |
271
- | `amount` | `number`, integer ≥ 0 (ILS) | numeric | `rounding` option, §4.4 |
272
- | `amountX` | `number`, integer ≥ 0 | digits, **alnum** padding | 1000@1091 (type alphanumeric in spec) |
273
- | `amountX100` | `number` ≥ 0, ≤ 2 decimals (ILS with agorot) | `round(value × 100)`, numeric | "נשמר * 100 מערכו" |
274
- | `rateX100` | `23 \| 50` (percent) | value × 100 → `2300` / `5000`, numeric | capital-gains code 018 |
275
- | `percentX100` | `number` 1–100, ≤ 2 decimals | `round(value × 100)` digits, alnum padding (`10.23` → `1023`) | 1000@949 (§15 A-2) |
276
- | `percentLiteral` | `number` 1–100, ≤ 2 decimals | integer → zero-padded (`100` → `00100`); otherwise `toFixed(2)` then zero-padded (`10.23` → `10.23`, `5.5` → `05.50`) | 1020@199/204/209 (§15 A-3) |
277
- | `date` | ISO `YYYY-MM-DD` string | `DD/MM/YYYY` (10, alphanumeric) | must be a real calendar date |
278
- | `flag` | `boolean` | `true` → `1`, `false`/absent → `0` | spec "1 - סומן" |
279
- | `yesNo` | `boolean` | `true` → `1`, `false` → `2`, absent → `0` (only allowed when not required) | spec "1-כן 2-לא" |
280
- | `enum` | literal union (see §7) | mapped numeric value, numeric | allowed values in `values` column |
281
- | `phonePrefix` | one of the allowed prefixes | prefix digits; padding per field type (alnum for 493/503, numeric for 822) | §15 A-19 |
282
- | `foreignCode` | 2000 code string | numeric(3) | 2200 header |
283
- | `serial`, `count`, `const` | — (derived) | numeric | §7.4 |
284
- | `filler` | — | `0`s (numeric) or spaces (alphanumeric) | |
285
-
286
- Values of kinds `id9` and `shareholderId` must also pass the Israeli check digit (left-pad to 9
287
- digits; multiply the digits alternately by 1, 2, 1, 2, … from the left; add the digits of products
288
- above 9; the total must be divisible by 10). The PDF does not state it, but SHAAM's structure
289
- checker rejects files that fail it (`field.checkDigit`, §15 A-25). The special shareholder IDs
290
- `999999964` and `999999998` pass it. Kind `digits` (phone numbers, bank and withholder accounts) is
291
- not checked.
292
-
293
- Allowed phone prefixes (p.6–7):
294
- `02 03 04 08 09 072 073 074 076 077 050 052 053 054 055 057 058 059`.
295
-
296
- The `values` column grammar: `;`-separated items, each `n`, `n..m` (inclusive range) or `n=label`.
297
-
298
- ### 4.3 Text normalization (before validation and encoding)
299
-
300
- Applied to every `text`/`hebrewText` value, in order:
301
-
302
- 1. Unicode NFC.
303
- 2. Remove bidi controls: U+200E, U+200F, U+202A–U+202E, U+2066–U+2069. (The old design's "RTL
304
- control injection" is explicitly **dropped**: controls occupy bytes and would corrupt widths.)
305
- 3. Replace: NBSP U+00A0 → space; TAB → space; “ ” „ → `"`; ‘ ’ → `'`; – — → `-`.
306
- 4. Trim, then collapse runs of spaces into one.
307
- 5. Any remaining character that is a control character (U+0000–U+001F, U+007F) or is not in the
308
- windows-1255 code page ⇒ `field.charset` error (the value is not modified further). The encoding
309
- helper itself only checks code-page membership (CR/LF of the line separators are valid bytes);
310
- the "no control characters in text" check belongs to the rule.
311
-
312
- Hebrew stays in **logical order** (as typed). Geresh/gershayim (U+05F3/U+05F4) and niqqud are
313
- representable in windows-1255 and are kept. Length checks run on the normalized value.
314
-
315
- ### 4.4 Numbers
316
-
317
- - Amounts are JS `number`s and must be finite and `Number.isSafeInteger` after scaling.
318
- - `amount`/`amountX`: must be an integer. Option `rounding: 'reject' | 'halfUp'` (default
319
- `'reject'`): `'reject'` raises `field.integer`; `'halfUp'` rounds half away from zero and reports
320
- nothing. There is no silent rounding by default (R-14).
321
- - `amountX100`/`percentX100`/`percentLiteral` (and `rateX100`): at most 2 decimals. Check with
322
- integer arithmetic: `p = v * 100`, `scaled = Math.round(p)`; error `field.decimals` if
323
- `Math.abs(p - scaled) > Math.max(1e-6, 4 * Number.EPSILON * Math.abs(p))`. The tolerance grows
324
- with the magnitude because `v * 100` carries a rounding error of about one ulp, which exceeds a
325
- fixed `1e-6` for amounts above about 10^8 (e.g. `9481199461.12 * 100` is off by 1.2e-4); a third
326
- decimal moves `p` by at least 0.1, far above the tolerance at any width of the layout.
327
- - Negative values ⇒ `field.negative` (losses have their own codes; p.13 forbids signs).
328
- - Max value is implied by width (`10^width - 1`); exceeding it ⇒ `field.length`.
329
-
330
- ### 4.5 Zero values in code-amount sections
331
-
332
- - `zeroAllowed=yes` codes (1000: 032, 072, 080, 081, 084, 086, 094, 096, 097, 121, 159; 2000: 442;
333
- 3054: 016) are written when the input value is `0`.
334
- - For every other code, an input value of `0` is treated as "no value": the code is omitted and the
335
- omission is listed in `GenerateResult.summary.omittedZeroCodes` (no issue is raised).
336
- - Required codes (1000: 018, 072, 081, 094, 263, 273; conditional 080, 084; 3051: 071, 016) must be
337
- present (`field.required`); for required codes that are not `zeroAllowed`, `0` counts as missing.
338
-
339
- ---
340
-
341
- ## 5. Architecture
342
-
343
- ### 5.1 Pipeline
344
-
345
- ```
346
- Report1214Input ──(1) shape check (zod, strict)──► (2) normalize + derive ──► NormalizedReport
347
- │
348
- (3) rule engine (field / business / structure) ◄┘
349
- │ no errors
350
- (4) encode records ──► lines ──► (5) CRLF join ──► windows-1255 bytes
351
-
352
- OPCN bytes/text ──(a) decode windows-1255──► (b) split lines ──► (c) decode records by layout ──► NormalizedReport
353
- ──► (d) denormalize ──► Report1214Input ──► (e) rule engine (validation)
354
- ```
355
-
356
- - **`NormalizedReport`** is the single internal model: an ordered list of
357
- `{ recordType, values: Record<FieldKey, Primitive>, codes: Map<Code, number>, countries?: Entry[] }`
358
- where keys are the `key` column of `fields.csv`. Generation and parsing both go through it, which
359
- is what makes the round trip exact.
360
- - The **layout** (per tax year) drives everything generic: field order, widths, kinds, required
361
- flags, allowed values, code tables. Business rules are hand-written functions over
362
- `NormalizedReport`.
363
- - Every stage is a pure function. No I/O, no clock access except the default `saveDate` (§7.4),
364
- which is injectable.
365
-
366
- ### 5.2 Package layout
367
-
368
- ```
369
- packages/opcn1214-generator/
370
- ├── documentation/
371
- │ ├── SPEC.md ← this document
372
- │ ├── layout/README.md ← CSV column reference + provenance
373
- │ ├── layout/2024/{records,fields,codes,countries}.csv ← source of truth for the 2024 layout
374
- │ ├── specifications/1214-2024.pdf ← normative spec
375
- │ └── tools/extract_layout.py ← PDF → raw layout extractor + CSV diff (yearly updates)
376
- ├── scripts/
377
- │ └── generate-layout.ts ← CSV → src/layout/<year>/layout.generated.ts
378
- ├── src/
379
- │ ├── index.ts ← public exports only (§6)
380
- │ ├── api/
381
- │ │ ├── generate.ts ← generate1214, generate1214Batch
382
- │ │ ├── validate.ts ← validate1214
383
- │ │ ├── parse.ts ← parse1214, parse1214Batch
384
- │ │ └── response.ts ← parseResponseFile
385
- │ ├── layout/
386
- │ │ ├── types.ts ← FieldDef, CodeDef, RecordDef, YearLayout, kinds
387
- │ │ ├── registry.ts ← getLayout(year), supportedTaxYears()
388
- │ │ ├── 2024/layout.generated.ts ← generated, committed, `as const`
389
- │ │ └── 2025/index.ts ← 2024 layout + overrides (none yet)
390
- │ ├── model/
391
- │ │ ├── input.ts ← Report1214Input and sub-types (public)
392
- │ │ ├── codes.generated.ts ← code unions per record (generated)
393
- │ │ ├── normalized.ts ← NormalizedReport (internal)
394
- │ │ └── schema.ts ← zod shape schemas (strict objects)
395
- │ ├── normalize/
396
- │ │ ├── text.ts ← §4.3
397
- │ │ ├── report.ts ← input → NormalizedReport (+ §7.4 derivations)
398
- │ │ ├── paths.ts ← pathFor(recordType, index, key), shared with the parser
399
- │ │ ├── denormalize.ts ← NormalizedReport → input (parse path)
400
- │ │ └── canonical.ts ← canonicalize(input, options), §8.4
401
- │ ├── codec/ ← paired encode/decode (D-1)
402
- │ │ ├── types.ts, padding.ts, registry.ts
403
- │ │ ├── numeric.ts, text.ts, date.ts, boolean.ts, enum.ts, percent.ts, phone.ts
404
- │ │ ├── sections.ts ← code-amount and country-amount sections
405
- │ │ ├── record.ts ← prefix + header + section ↔ line
406
- │ │ └── windows1255.ts ← iconv-lite wrapper
407
- │ ├── file/ ← control.ts (9999), assemble.ts, split.ts, parse.ts
408
- │ ├── pipeline.ts ← runPipeline: year → shape → normalize → rules
409
- │ ├── validate/
410
- │ │ ├── issue.ts ← Issue, paths, sorting
411
- │ │ ├── rules.ts ← RULES catalogue (metadata only)
412
- │ │ ├── field-rules.ts ← generic, layout-driven (§10.2)
413
- │ │ ├── main-rules.ts, shareholder-rules.ts, foreign-rules.ts,
414
- │ │ ├── capital-gains-rules.ts, structure-rules.ts, parse-rules.ts
415
- │ │ └── engine.ts ← runs all rules, sorts issues
416
- │ └── errors.ts ← Opcn1214Error hierarchy (§11)
417
- └── tests/ ← §13
418
- ```
419
-
420
- ### 5.3 Layout code generation
421
-
422
- - `documentation/layout/<year>/*.csv` is the **source of truth**. `scripts/generate-layout.ts` (run
423
- with `yarn workspace @accounter/opcn1214-generator generate:layout`, using `tsx`) parses the CSVs
424
- (small RFC-4180 parser, no dependency) and writes `src/layout/<year>/layout.generated.ts` and
425
- `src/model/codes.generated.ts` as `as const` data plus literal-union types:
426
-
427
- ```ts
428
- export type MainFormCode = '008' | '010' | … | '299'; // 102 codes
429
- export type MainFormInputCode = Exclude<MainFormCode, DerivedMainCode>; // 95 codes
430
- export type ForeignAppendixCode = '401' | … | '494'; // 51 codes
431
- export type CountryBreakdownCode = '416' | '417' | … | '461'; // 23 codes
432
- export type CapitalGainsCode<S extends Symbol> = …; // per symbol
433
- export type CountryCode = '-88' | '004' | … ; // 255 codes
434
- ```
435
-
436
- - Generated files are committed; a test regenerates in memory and fails if the committed output
437
- differs (`layout-sync.test.ts`).
438
- - The Hebrew `notesHe` text is emitted as JSDoc on the code unions, so IDEs show the spec note for
439
- each code.
440
-
441
- ### 5.4 Layout types (`src/layout/types.ts`)
442
-
443
- ```ts
444
- export type RecordType =
445
- | '1000'
446
- | '1010'
447
- | '1020'
448
- | '1030'
449
- | '2000'
450
- | '2200'
451
- | '3027'
452
- | '3050'
453
- | '3051'
454
- | '3054'
455
- | '3060'
456
- | '3063'
457
- | '3064'
458
- | '3065'
459
- | '3066'
460
- | '3077'
461
- | '9999'
462
-
463
- export type FieldKind =
464
- | 'text'
465
- | 'hebrewText'
466
- | 'id9'
467
- | 'shareholderId'
468
- | 'year'
469
- | 'num'
470
- | 'digits'
471
- | 'amount'
472
- | 'amountX'
473
- | 'amountX100'
474
- | 'rateX100'
475
- | 'percentX100'
476
- | 'percentLiteral'
477
- | 'date'
478
- | 'flag'
479
- | 'yesNo'
480
- | 'enum'
481
- | 'phonePrefix'
482
- | 'foreignCode'
483
- | 'serial'
484
- | 'count'
485
- | 'const'
486
- | 'filler'
487
-
488
- export interface EnumValue {
489
- value: number
490
- label?: string
491
- }
492
-
493
- export interface FieldDef {
494
- readonly record: RecordType
495
- readonly position: number // 1-based
496
- readonly length: number
497
- readonly type: 'numeric' | 'alphanumeric'
498
- readonly required: 'yes' | 'no' | 'conditional'
499
- readonly key: string // canonical key without the '(derived) ' prefix of the CSV
500
- readonly derived: boolean // true for rows whose CSV key starts with '(derived) '
501
- readonly kind: FieldKind
502
- readonly values?: readonly EnumValue[]
503
- readonly nameHe: string
504
- readonly specPage: number
505
- }
506
-
507
- export interface CodeDef {
508
- readonly record: RecordType
509
- readonly code: string // 3 digits
510
- readonly length: number
511
- readonly required: 'yes' | 'no' | 'conditional'
512
- readonly kind: 'amount' | 'amountX100' | 'rateX100' | 'enum' | 'num'
513
- readonly values?: readonly EnumValue[]
514
- readonly zeroAllowed: boolean
515
- readonly perCountryBreakdown: boolean
516
- readonly derived: boolean // 008, 028, 273, 277, 278, 280, 297, 501–505
517
- readonly notesHe: string
518
- readonly specPage: number
519
- }
520
-
521
- export interface RecordDef {
522
- readonly type: RecordType
523
- readonly order: number
524
- readonly length: number
525
- readonly headerLength: number
526
- readonly section?: {
527
- kind: 'codeAmount' | 'countryAmount'
528
- start: number
529
- length: number
530
- maxEntries: number // 1000: 61; 2200: 10; other records: their number of codes
531
- }
532
- readonly minOccurs: number
533
- readonly maxOccurs: number
534
- readonly fields: readonly FieldDef[] // sorted by position, contiguous 137..header end
535
- readonly codes: readonly CodeDef[]
536
- }
537
-
538
- export interface YearLayout {
539
- readonly taxYear: number
540
- readonly records: Readonly<Record<RecordType, RecordDef>>
541
- readonly countries: ReadonlyMap<string, string> // code → Hebrew name
542
- readonly limits: {
543
- reportsPerFile: 50
544
- capitalGainsAppendices: 14
545
- mainCodePairs: 61
546
- countriesPerRecord: 10
547
- }
548
- }
549
- ```
550
-
551
- ### 5.5 Dependencies
552
-
553
- | Package | Version | Why |
554
- | ------------ | ------- | --------------------------------------------- |
555
- | `zod` | 4.6.7 | strict input shape validation (§9.2) |
556
- | `iconv-lite` | 0.7.3 | windows-1255 encode/decode (same as siblings) |
557
- | dev: `tsx` | 4.23.15 | run `scripts/generate-layout.ts` |
558
-
559
- No other runtime dependencies (no `date-fns`: dates are ISO strings, handled with plain arithmetic).
560
-
561
- ---
562
-
563
- ## 6. Public API
564
-
565
- ### 6.1 Functions
566
-
567
- ```ts
568
- /** Validates without generating. Never throws for bad input; returns every issue found. */
569
- export function validate1214(input: unknown, options?: ValidateOptions): ValidationResult
570
-
571
- /** Validates, then generates. Throws Opcn1214ValidationError if any error-severity issue exists. */
572
- export function generate1214(input: Report1214Input, options?: GenerateOptions): GenerateResult
573
-
574
- /** OPCN batch (p.1: up to 50 reports per file). Each report is generated and validated independently;
575
- * issues carry `reportIndex`. Throws if any report has errors or more than 50 reports are given. */
576
- export function generate1214Batch(
577
- inputs: readonly Report1214Input[],
578
- options?: GenerateOptions
579
- ): GenerateResult
580
-
581
- /** Parses a single-report file. Throws Opcn1214ParseError on structural problems.
582
- * Business-rule issues of the parsed content are returned as `issues`, not thrown. */
583
- export function parse1214(content: string | Uint8Array, options?: ParseOptions): ParseResult
584
-
585
- /** Parses an OPCN batch file (1–50 reports). */
586
- export function parse1214Batch(content: string | Uint8Array, options?: ParseOptions): ParseResult[]
587
-
588
- /** Parses SHAAM's response file shumot.shg (§3.9): one ResponseRecord per non-blank line, in file
589
- * order. Bytes decode as windows-1255; CRLF or LF; blank lines are skipped; an empty file gives [].
590
- * Lines shorter than 15 characters (parse.lineLength) or with a non-digit file number or tax year
591
- * (parse.numeric) throw Opcn1214ParseError carrying every such line. Any 2-character code is
592
- * accepted; an unlisted one means 'General error; notify SHAAM'. */
593
- export function parseResponseFile(content: string | Uint8Array): ResponseRecord[]
594
-
595
- export function supportedTaxYears(): readonly number[] // [2024, 2025]
596
- export function getLayout(taxYear: number): YearLayout // throws for unsupported years
597
- export const RULES: readonly RuleMeta[] // the §10 catalogue, as data
598
- ```
599
-
600
- ### 6.2 Options and results
601
-
602
- ```ts
603
- export interface ValidateOptions {
604
- /** How non-integer amounts are handled. Default 'reject' (error field.integer). */
605
- rounding?: 'reject' | 'halfUp'
606
- /** Used when input.meta.saveDate is absent. Default: today in Asia/Jerusalem. */
607
- today?: () => IsoDate
608
- }
609
- export type GenerateOptions = ValidateOptions
610
- export interface ParseOptions {
611
- /** Encoding of a Uint8Array input. Default 'windows-1255'. Strings are taken as already decoded. */
612
- encoding?: 'windows-1255' | 'utf-8'
613
- }
614
-
615
- export interface ValidationResult {
616
- valid: boolean // true ⇔ errors.length === 0
617
- errors: Issue[] // severity 'error', sorted (§11.3)
618
- warnings: Issue[] // severity 'warning', sorted
619
- }
620
-
621
- export interface GenerateResult {
622
- text: string // the file as a JS string (CRLF line endings)
623
- bytes: Uint8Array // windows-1255 — the artifact to upload
624
- fileName: string // suggestion: `1214_${fileNumber}_${taxYear}.txt` (batch: `1214_batch_${n}.txt`)
625
- // fileNumber: the 9 digits as written at 1000@137 (zero-padded, e.g. '12' → '000000012')
626
- warnings: Issue[]
627
- summary: {
628
- reports: number
629
- records: Partial<Record<RecordType, number>>
630
- mainCodePairs: number // used of 61 (batch: the most of any report)
631
- omittedZeroCodes: Array<{
632
- record: RecordType
633
- recordIndex: number
634
- code: string
635
- reportIndex?: number // batch only
636
- }>
637
- }
638
- }
639
-
640
- export interface ParseResult {
641
- report: Report1214Input // canonical form (§8.4)
642
- issues: Issue[] // validation of the parsed content (errors and warnings)
643
- saveDate: IsoDate // from 1000@165
644
- softwareName: string // from 1000@150
645
- }
646
-
647
- export interface ResponseRecord {
648
- fileNumber: string // 9 digits
649
- taxYear: number
650
- code: string // '00', '05', …
651
- meaning: string // English text from §3.9
652
- accepted: boolean // code === '00'
653
- detail?: string // trailing text for codes 08 / 33, trailing spaces trimmed; absent when empty
654
- line: number
655
- }
656
- ```
657
-
658
- ### 6.3 Errors (details in §11)
659
-
660
- `Opcn1214Error` (base, has `issues: Issue[]`) → `Opcn1214ValidationError` (generate),
661
- `Opcn1214ParseError` (parse), `Opcn1214UnsupportedYearError` (`getLayout`), `Opcn1214InternalError`
662
- (invariant violated — a bug).
663
-
664
- ### 6.4 Exports
665
-
666
- `index.ts` exports exactly: the functions and `RULES` above; types `Report1214Input` and all its
667
- sub-types (§7), the code unions (§5.3), `Issue`, `RuleId`, `RuleMeta`, `Severity`, option/result
668
- types, `YearLayout` and the layout types; the error classes. Nothing else is public.
669
-
670
- ### 6.5 Stability contract (semver)
671
-
672
- | Change | Version bump |
673
- | -------------------------------------------------------------- | ------------ |
674
- | Output bytes change for an input that was already valid | **major** |
675
- | A rule ID or issue `path` format changes or is removed | **major** |
676
- | A new **error** rule | **major** |
677
- | A new **warning** rule (may become an error in the next major) | minor |
678
- | A new supported tax year / layout | minor |
679
- | Message wording | patch |
680
-
681
- Golden files (§13.5) enforce the first row.
682
-
683
- ---
684
-
685
- ## 7. Input model (`src/model/input.ts`)
686
-
687
- ### 7.1 Conventions
688
-
689
- - All money in **ILS**. `amount` fields are whole shekels; `amountX100` fields accept agorot.
690
- - Dates are ISO strings `YYYY-MM-DD` (never `Date` objects — avoids time-zone bugs).
691
- - Identification numbers are **strings** of digits (leading zeros preserved).
692
- - Booleans for flags and yes/no fields; string literal unions for enums.
693
- - Optional properties may be omitted or `undefined`. `null` is rejected (`input.shape`).
694
- - Objects are **strict**: unknown properties are errors (`input.shape`), which also catches typos
695
- and wrong codes in amount maps.
696
- - Code maps use the 3-digit code string as the key, exactly as in `codes.csv` (`'015'`, not `'15'`).
697
-
698
- ### 7.2 Types
699
-
700
- ```ts
701
- export type IsoDate = string // 'YYYY-MM-DD'
702
- export type SupportedTaxYear = 2024 | 2025
703
- export type PhonePrefix =
704
- | '02'
705
- | '03'
706
- | '04'
707
- | '08'
708
- | '09'
709
- | '072'
710
- | '073'
711
- | '074'
712
- | '076'
713
- | '077'
714
- | '050'
715
- | '052'
716
- | '053'
717
- | '054'
718
- | '055'
719
- | '057'
720
- | '058'
721
- | '059'
722
- export interface Phone {
723
- prefix: PhonePrefix
724
- number: string /* exactly 7 digits */
725
- }
726
-
727
- export interface Report1214Input {
728
- taxYear: SupportedTaxYear // 1000@146; selects the layout
729
- meta?: {
730
- softwareName?: string // 1000@150, ≤ 15, default 'ACCOUNTER'
731
- saveDate?: IsoDate // 1000@165, default options.today()
732
- }
733
- company: CompanyDetails
734
- preparer?: PreparerDetails // "המסייע/ת במילוי הדו"ח" (1000@563–827)
735
- declarations: Declarations
736
- otherTaxableIncome?: {
737
- // 1000@887/937/949, "הכנסה חייבת אחרת בארץ ובחו"ל"
738
- source?: string // must start with a Hebrew letter
739
- amount?: number
740
- ratePercent?: number // 1–100, ≤ 2 decimals
741
- }
742
- attachments?: {
743
- donationReceiptsCount?: number // 1000@954, receipts for code 070 (section 46)
744
- withholdingCertificatesCount?: number // 1000@957, certificates for code 010
745
- }
746
- capitalGainsSummary?: {
747
- totalAppendicesCount?: number // 1000@960, all appendices transmitted and not
748
- untransmittedCount?: number // 1000@962
749
- reasons?: {
750
- // 1000@964–968, why appendices were not transmitted
751
- lossOrNoGain?: boolean
752
- overFiveImprovementBalances?: boolean
753
- over14Appendices?: boolean
754
- other?: boolean
755
- otherText?: string // required when `other`
756
- }
757
- }
758
- qualifyingCompany?: {
759
- // 1000@1065–1091, "חברה מזכה" (part A of the form)
760
- purchased?: boolean
761
- israeliPurchaseAmount?: number
762
- foreignPurchaseAmount?: number
763
- amortizationClaimed?: boolean
764
- amortizationAmount?: number // may be 0
765
- }
766
- bankAccount?: {
767
- // → codes 277/278/280=1 (only when changing the account on file)
768
- bank: string // 2 digits
769
- branch: string // 3 digits
770
- account: string // 1–9 digits
771
- }
772
- amounts: Partial<Record<MainFormInputCode, number>> // 1000 code-amount section
773
- relatedCompanies?: RelatedCompany[] // ≤ 3
774
- shareholders: Shareholder[] // 1–99 (0 allowed only for a kibbutz)
775
- rdInvestments?: RdInvestment[] // ≤ 5
776
- foreignAppendix?: ForeignAppendix
777
- capitalGains?: CapitalGainsAppendix[] // ≤ 14 in total
778
- }
779
-
780
- export interface CompanyDetails {
781
- fileNumber: string // 1000@137 "מספר תיק"
782
- registeredName: string // 1000@175, ≤ 50 (SHAAM replaces it with the registry name if different)
783
- withholdingFileNumber?: string // 1000@225 "תיק ניכויים": 9 + fileNumber digits 1–7 + check digit (§15 A-28)
784
- vatFileNumber?: string // 1000@234
785
- occupationDescription?: string // 1000@243
786
- mailingAddress: string // 1000@293
787
- businessAddress: string // 1000@343
788
- booksAddress?: string // 1000@393, where the books are kept
789
- email?: string // 1000@443
790
- phone: Phone // 1000@493/496
791
- fax?: Phone // 1000@503/506
792
- }
793
-
794
- export interface PreparerDetails {
795
- officeName?: string
796
- contactName?: string
797
- name?: string
798
- profession?: string
799
- licensedDealerNumber?: string // 1000@763 "מספר עוסק מורשה (מסייע)"
800
- address?: string
801
- phone?: Phone
802
- }
803
-
804
- export interface Declarations {
805
- // required yes/no (1000@878–882, 1029, 1030)
806
- hasTaxPlanningAction: boolean // 878
807
- hadRelatedPartyTransactions: boolean // 879
808
- controlsBodyOfPersons: boolean // 880
809
- holdsRightsInBodyOfPersons: boolean // 881
810
- appliesAccountingStandards: boolean // 882 (→ code 008 = 1)
811
- directorsReceivedOpinion: boolean // 1029
812
- tookReportablePosition: boolean // 1030
813
- reportablePositions?: number[] // 1034–1046: up to 5 position numbers (form 1346), 1–999
814
-
815
- form6111Obligation?: 'obliged' | 'notObliged' | 'notRelevant' // 834 (→ code 297 = 8 / 9)
816
- financialStatementsAttached?: boolean // 835
817
- familyCompany?: { representativeFileNumber: string } // 836 + 837 (+ code 080 required)
818
- isHouseCompany?: boolean // 846 (+ code 084 required)
819
- form1343Attached?: boolean // 847
820
- form1344Attached?: boolean // 848
821
- claimsCapitalInvestmentLawBenefits?: boolean // 849 (required when code 101 or 102 is filled)
822
- preferredEnterprise?: boolean // 850
823
- beneficiaryEnterprise?: { noticeDate: IsoDate } // 851 + 852; not before the tax year (§15 A-33)
824
- dividendDistributed?: boolean // 862
825
- specialYear?: { balanceSheetDate: IsoDate } // 863 + 864
826
- foreignInvestors?: boolean // 874
827
- consolidatedReport?: 'consolidatedUnderSection23' | 'consolidatesWithParent' | 'notRelevant' // 875 → 1/2/3
828
- partnerInPartnership?: boolean // 876
829
- isKibbutz?: boolean // 877
830
- requestsAdvancePayments?: boolean // 883 (yes/no)
831
- hasBuildingIncome?: boolean // 884 (yes/no; → code 259 required)
832
- isTrustBeneficiary?: boolean // 886
833
- nonDeductibleSalaryExpenses?: boolean // 1031
834
- fewMembersCompany62A?: boolean // 1032
835
- partOfMultinationalGroup?: boolean // 1033 (yes/no)
836
- noBankAccount?: boolean // 1064
837
- /** Forces 833 = yes when capital-gains appendices exist but none are transmitted. */
838
- hasCapitalGainsAppendix?: boolean // 833 (otherwise derived, §7.4)
839
- }
840
-
841
- export interface RelatedCompany {
842
- // 1010
843
- companyName: string // ≤ 50, must start with a Hebrew letter (§15 A-29)
844
- companyFileNumber?: string
845
- relationType:
846
- | 'parent'
847
- | 'subsidiary'
848
- | 'partnership'
849
- | 'kibbutzRelatedCorporation'
850
- | 'jointlyControlled'
851
- | 'granddaughter'
852
- | 'grandmother'
853
- | 'other' // → 1..8
854
- assessingOfficeCode?: number // 2 digits
855
- }
856
-
857
- export interface Shareholder {
858
- // 1020
859
- idNumber: string // 9 digits, or 999999964 / 999999998
860
- fullName: string // must start with a Hebrew letter
861
- isControllingShareholder: boolean
862
- dividendRightsPercent?: number // all shareholders must total 100
863
- votingRightsPercent?: number
864
- otherRightsPercent?: number
865
- isMaterialShareholder?: boolean
866
- salaryMonths1To9?: number
867
- salaryMonths10To12?: number
868
- otherPayments?: number
869
- }
870
-
871
- export interface RdInvestment {
872
- // 1030
873
- companyName: string // ≤ 50, must start with a Hebrew letter (§15 A-29)
874
- companyFileNumber?: string
875
- investmentAmount: number
876
- }
877
-
878
- export interface ForeignAppendix {
879
- // 2000 + 2200
880
- otherTaxableIncomeDescription?: string // required when otherTaxableIncome > 0
881
- otherTaxableIncome?: number
882
- foreignTaxPaidOnOtherIncome?: number
883
- totalForeignTaxableIncome?: number
884
- totalForeignLoss?: number
885
- participationExemptionHoldingCompany?: number
886
- taxRefundDeclaration: boolean // 247 (required yes/no)
887
- taxRefundDeclarationAmount?: number
888
- amounts: Partial<Record<ForeignAppendixCode, number>>
889
- countryBreakdown?: Partial<
890
- Record<
891
- CountryBreakdownCode,
892
- {
893
- deductionsOffsetsAndExemptions?: number // 2200@140
894
- countries: Array<{ country: CountryCode; income: number }> // 1–10
895
- }
896
- >
897
- >
898
- }
899
-
900
- export type CapitalGainsAppendix =
901
- | SharesAppendix
902
- | BettermentTaxAppendix
903
- | ForcedVirtualCurrencyAppendix
904
- | OilPartnershipAppendix
905
- | SecuritiesAppendix
906
- | Section6SecuritiesAppendix
907
- | ReitAppendix
908
- | NoWithholding1322Appendix
909
- | NoWithholding1326Appendix
910
- | OtherTransactionsAppendix
911
-
912
- type AssetLocation = 'abroad' | 'israel' // 1 / 2
913
- interface Withholder {
914
- name?: string /* Hebrew first */
915
- branch?: string
916
- account?: string
917
- }
918
-
919
- export interface SharesAppendix {
920
- // 3027
921
- symbol: 27
922
- expropriation?: boolean
923
- assetDetails?: string
924
- assetLocation?: AssetLocation
925
- relatedParty?: boolean
926
- buyerName?: string
927
- dates?: { code15?: IsoDate; code20?: IsoDate; code53?: IsoDate }
928
- amounts: Partial<Record<CapitalGainsCode<27>, number>>
929
- }
930
- export interface BettermentTaxAppendix {
931
- // 3050
932
- symbol: 50
933
- expropriation?: boolean
934
- assetDetails?: string
935
- purchaseDate: IsoDate
936
- dates: { code15: IsoDate }
937
- amounts: Partial<Record<CapitalGainsCode<50>, number>>
938
- }
939
- export interface ForcedVirtualCurrencyAppendix {
940
- // 3051
941
- symbol: 51
942
- assetDetails?: string
943
- assetLocation?: AssetLocation
944
- relatedParty?: boolean
945
- buyerName?: string /* Hebrew first */
946
- dates: { code15: IsoDate }
947
- walletAddresses?: [string] | [string, string] // ≤ 150 chars each
948
- amounts: Partial<Record<CapitalGainsCode<51>, number>> // 071 (=1) and 016 required
949
- }
950
- export interface OilPartnershipAppendix {
951
- // 3054
952
- symbol: 54
953
- assetDetails?: string
954
- purchaseDate: IsoDate
955
- dates: { code15: IsoDate }
956
- amounts: Partial<Record<CapitalGainsCode<54>, number>>
957
- }
958
- export interface SecuritiesAppendix {
959
- // 3060
960
- symbol: 60
961
- foreignAsset?: boolean
962
- soldToRelatedParty?: boolean
963
- boughtFromRelatedParty?: boolean
964
- gainFromInvestmentFund?: boolean
965
- withholders?: Withholder[] /* ≤ 4 */
966
- lossesCarriedForward?: number
967
- amounts: Partial<Record<CapitalGainsCode<60>, number>>
968
- }
969
- export interface Section6SecuritiesAppendix {
970
- // 3063
971
- symbol: 63
972
- foreignAsset?: boolean
973
- lossesCarriedForward?: number
974
- amounts: Partial<Record<CapitalGainsCode<63>, number>>
975
- }
976
- export interface ReitAppendix extends Omit<SecuritiesAppendix, 'symbol' | 'amounts'> {
977
- // 3064
978
- symbol: 64
979
- amounts: Partial<Record<CapitalGainsCode<64>, number>>
980
- }
981
- export interface NoWithholding1322Appendix extends Omit<SecuritiesAppendix, 'symbol' | 'amounts'> {
982
- // 3065
983
- symbol: 65
984
- withholdingStatus?: 'notWithheldFirstHalf' | 'notWithheldSecondHalf' // → 2 / 3
985
- amounts: Partial<Record<CapitalGainsCode<65>, number>>
986
- }
987
- export interface NoWithholding1326Appendix {
988
- // 3066
989
- symbol: 66
990
- foreignAsset?: boolean
991
- withholdingStatus?: 'notWithheldFirstHalf' | 'notWithheldSecondHalf'
992
- lossesCarriedForward?: number
993
- amounts: Partial<Record<CapitalGainsCode<66>, number>>
994
- }
995
- export interface OtherTransactionsAppendix {
996
- // 3077
997
- symbol: 77
998
- expropriation?: boolean
999
- assetDetails?: string
1000
- assetLocation?: AssetLocation
1001
- relatedParty?: boolean
1002
- buyerName?: string
1003
- dates: { code15: IsoDate; code20: IsoDate }
1004
- improvements?: Array<{
1005
- // ≤ 5 (245 = count)
1006
- expense?: number // ×100 (agorot allowed); > 0 required (cg.improvements.expense, §15 A-32)
1007
- accumulatedDepreciation?: number // ×100; at most expense
1008
- date: IsoDate // required per improvement
1009
- code50Amount?: number // → code 501..505, ×100
1010
- }>
1011
- replacementAsset?: { details?: string; purchaseDate?: IsoDate; price?: number } // 417/467/477
1012
- walletAddresses?: [string] | [string, string] // required when code 071 = 1
1013
- amounts: Partial<
1014
- Record<Exclude<CapitalGainsCode<77>, '501' | '502' | '503' | '504' | '505'>, number>
1015
- >
1016
- }
1017
- ```
1018
-
1019
- ### 7.3 Field ↔ input mapping
1020
-
1021
- The `key` column of `fields.csv` names every header field. For most fields the key **is** the input
1022
- path (`company.fileNumber`, `shareholders[i].fullName` → key `fullName` in record 1020). The
1023
- exceptions are listed here; the normalizer (`normalize/report.ts`) implements exactly this table and
1024
- a test asserts that every non-filler key in `fields.csv` is produced (§13.3).
1025
-
1026
- | Key (record@pos) | Comes from |
1027
- | ---------------------------------------------------- | -------------------------------------------------------------------- |
1028
- | `declarations.familyCompany.isFamilyCompany` (836) | `declarations.familyCompany !== undefined` |
1029
- | `declarations.beneficiaryEnterprise.marked` (851) | `declarations.beneficiaryEnterprise !== undefined` |
1030
- | `declarations.specialYear.marked` (863) | `declarations.specialYear !== undefined` |
1031
- | `declarations.reportablePositions[0..4]` (1034–1046) | `declarations.reportablePositions[i]`, absent → `000` |
1032
- | `declarations.hasCapitalGainsAppendix` (833) | derived, §7.4 |
1033
- | `qualifyingCompany.*` (1065–1091) | `qualifyingCompany.*` (`purchased`/`amortizationClaimed` are yes/no) |
1034
- | `withholders[0..3].*` (3060/3064/3065) | `withholders[i].*` |
1035
- | `withholdingStatus` (3065@146, 3066@143) | `withholdingStatus` (first/second half → 2/3), absent → `0` |
1036
- | `assetLocation` (3027@193, 3051@192, 3077@193) | `assetLocation` (abroad/israel → 1/2), absent → `0` |
1037
- | `dates.code*` (3027/3050/3051/3054/3077) | `dates.code15` / `code20` / `code53`, written `DD/MM/YYYY` |
1038
- | `improvements[0..4].*` (3077) | `improvements[i].expense / accumulatedDepreciation / date` |
1039
- | `walletAddresses[0..1]` (3051/3077) | `walletAddresses[i]` |
1040
-
1041
- The input path of a presence flag (836, 851, 863) is the object it stands for
1042
- (`declarations.familyCompany`); its member keeps its own path. When parsing, the object exists
1043
- exactly when its flag is marked (a member value without the flag is not carried into the report),
1044
- and the reportable positions are the non-zero values of 1034–1046 in field order. 833 = yes is read
1045
- back as `declarations.hasCapitalGainsAppendix: true` only when the derivation of §7.4 does not
1046
- already explain it (no `untransmittedCount > 0`, no capital-gains appendix in the file).
1047
-
1048
- When parsing, `foreignAppendix` exists exactly when the file has a 2000 record; 1000@832 is not read
1049
- back (a disagreeing 832 is `parse.derivedMismatch`).
1050
-
1051
- Records 2200 are keyed by the 2000 code they break down: 2200@137 (`code`) is the key of
1052
- `foreignAppendix.countryBreakdown` and the input path of the breakdown itself
1053
- (`foreignAppendix.countryBreakdown["420"]`); 2200@140 is its `deductionsOffsetsAndExemptions`, and
1054
- the n-th country entry is `foreignAppendix.countryBreakdown["420"].countries[n]` (paths `.country`
1055
- and `.income`). When parsing, every 2200 record is grouped under the 2000 record's
1056
- `countryBreakdown`; there is no `countryBreakdown` without 2200 records.
1057
-
1058
- Capital-gains appendices are keyed by their index in `capitalGains`: a header key of a 30xx record
1059
- maps to `capitalGains[i].<key>` and a code to `capitalGains[i].amounts["022"]`, where `i` is the
1060
- appendix's input index, not its position in the file (records are grouped by type, §3.3). The
1061
- transaction symbol (30xx@137), the appendix number (30xx@139) and the "מספר בתל"ם" sequence
1062
- (3027@255, 3051@234, 3065@325, 3066@154, 3077@487, §7.4) and the improvement count (3077@245) are
1063
- derived and have no input path; the withholding status and the asset location are read back as their
1064
- literals (an absent value, written as 0, stays absent), and the dates under `dates` (no `dates`
1065
- object when none is written). When parsing, `capitalGains` lists the appendices in file order
1066
- (grouped by type ascending), the symbol comes from the record type, and `capitalGains` exists only
1067
- when the file has 30xx records.
1068
-
1069
- The withholders of 3060/3064/3065 are written slot by slot: `withholders[j]` fills the j-th slot
1070
- (header keys `withholders[j].name`, `.branch`, `.account`), so an issue on it is reported at
1071
- `capitalGains[i].withholders[j].<member>`. When parsing, `withholders` lists the slots up to the
1072
- last one with any value; an empty slot before it is read back as `{}` (keeping the indices of the
1073
- slots after it), and `withholders` is absent when no slot has a value.
1074
-
1075
- The wallet addresses of 3051 and 3077 are written slot by slot as well (`walletAddresses[j]`, header
1076
- key `walletAddresses[j]`, issue path `capitalGains[i].walletAddresses[j]`). When parsing,
1077
- `walletAddresses` lists the slots up to the last one with a value; an empty first slot before a
1078
- filled second one is read back as `''`, and `walletAddresses` is absent when no slot has a value.
1079
-
1080
- The improvements of 3077 are written slot by slot: `improvements[j]` fills the j-th slot (header
1081
- keys `improvements[j].expense`, `.accumulatedDepreciation`, `.date`) and its `code50Amount` is code
1082
- `50(j+1)` (501–505, §7.4), so an issue on it is reported at
1083
- `capitalGains[i].improvements[j].<member>` (`.code50Amount` for code 50(j+1); passing 501–505 in
1084
- `amounts` is `input.derivedCode`). Only five improvements have a slot: more than five raise one
1085
- `cg.improvements.max` notice at `capitalGains[i].improvements[5]` (the first improvement not
1086
- written), and the first five are still written. When parsing, `improvements` lists the slots up to
1087
- the last one with any value (a header member or its code 501–505); an empty slot before it is read
1088
- back as `{}`, and `improvements` is absent when no slot has a value; 3077@245 is not read back. The
1089
- replacement asset is read back under `replacementAsset` (no object when none of 417/467/477 is
1090
- written).
1091
-
1092
- Only five reportable positions have a field: more than five raise one `main.reportablePositions.max`
1093
- notice at `declarations.reportablePositions[5]` (the first position not written), and the first five
1094
- are still written.
1095
-
1096
- ### 7.4 Derived values (never taken from the caller)
1097
-
1098
- | Output | Derivation | Enforces (spec) |
1099
- | --------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------ |
1100
- | Prefix (1–136) of every record | `1214` + record type + 128 × `0` | p.4 |
1101
- | 1000@150 software name | `meta.softwareName ?? 'ACCOUNTER'` | required field |
1102
- | 1000@165 save date | `meta.saveDate ?? options.today()` (Asia/Jerusalem) | required field |
1103
- | 1000@832 has foreign appendix | `foreignAppendix ? yes : no` | consistency with 2000 record |
1104
- | 1000@833 has capital-gains appendix | yes if `capitalGains.length > 0` or `untransmittedCount > 0` or `declarations.hasCapitalGainsAppendix === true`, else no | consistency with 30xx records |
1105
- | code 008 | `1` if `appliesAccountingStandards`, else omitted | p.9 (882 → "fill 008 with 1") |
1106
- | code 028 | `capitalGains.length + (untransmittedCount ?? 0)`, omitted if 0 | p.14 "forms attached, transmitted and not" |
1107
- | code 273 | 1029/1030: yes/no → 1, no/yes → 2, yes/yes → 3, no/no → 9 | p.19 mapping |
1108
- | codes 277 / 278 / 280 | from `bankAccount`: 277 = account; 278 = bank(2) + branch(3); 280 = 1 | p.19–20 |
1109
- | code 297 | `form6111Obligation`: obliged → 8, notObliged → 9, otherwise omitted | p.7 (834 → "fill 297 with 8/9") |
1110
- | 1010@137, 1020@137 | 1-based index in input order | serial numbers |
1111
- | 1030@137 | `1` (company) | p.25 |
1112
- | 2200@137 and entry affiliation | the breakdown's 2000 code; affiliation `1` | p.31 |
1113
- | 30xx@137 transaction symbol | `symbol` | p.34 ff. |
1114
- | 30xx@139 appendix number | 1-based index among appendices **of the same symbol**, in emission order | §15 A-7 |
1115
- | "מספר בתל"ם" (3027@255, 3051@234, 3065@325, 3066@154, 3077@487) | 1-based index among **all** capital-gains appendices in emission order | p.35 "running number" |
1116
- | 3077@245 improvement count | `improvements.length` | p.55 |
1117
- | 3077 codes 501–505 | `improvements[i].code50Amount` | p.58 |
1118
- | 9999@137–150 | counts from the generated records (§3.8) | p.60 |
1119
-
1120
- Passing a derived code in an `amounts` map is an error (`input.derivedCode`) whose message names the
1121
- input property that controls it.
1122
-
1123
- Codes 277/278/280 are written only for a well-formed `bankAccount`; a malformed member has no field
1124
- of its own, so the normalizer reports it as a `main.bankAccount.format` notice at
1125
- `bankAccount.<member>` and writes no bank code. When parsing, `bankAccount` exists when any of
1126
- 277/278/280 is present (278 split into bank and branch after padding to 5 digits; an absent 277 or
1127
- 278 reads as zeros), and 297 is read back as `form6111Obligation` (8 → `obliged`, 9 → `notObliged`)
1128
- only when 834 is absent: 834 is the source of truth, and a disagreeing 297 is
1129
- `parse.derivedMismatch`.
1130
-
1131
- ---
1132
-
1133
- ## 8. Data handling
1134
-
1135
- ### 8.1 Generation algorithm (`generate1214`)
1136
-
1137
- 1. `taxYear` → `getLayout` (unsupported ⇒ issue `struct.taxYear.unsupported`, generation stops).
1138
- 2. Shape check with the zod schema for that year (§9.2). Shape errors stop the pipeline (later
1139
- stages assume well-typed input); all shape issues are reported together.
1140
- 3. Normalize: apply §4.3 to text, scale numbers (§4.4), map enums and booleans to their codes, run
1141
- §7.4 derivations, and build `NormalizedReport` in the record order of §3.3.
1142
- 4. Run the rule engine (§9) on `NormalizedReport` (+ the original input for paths).
1143
- 5. If any error ⇒ throw `Opcn1214ValidationError` with all errors and warnings.
1144
- 6. Encode each record: prefix + header fields in position order + section. Assert
1145
- `line.length === RecordDef.length`, otherwise throw `Opcn1214InternalError`.
1146
- 7. Append 9999. Join with `\r\n` and add a final `\r\n`. Encode to windows-1255 with iconv-lite;
1147
- assert byte length = character length (single-byte) and that no `?` replacement was introduced
1148
- (text was already checked by `field.charset`).
1149
- 8. Return `GenerateResult` (§6.2).
1150
-
1151
- `generate1214Batch` runs 1–7 per report, concatenates the reports in input order, and requires 1–50
1152
- reports (`struct.batch.size`, checked first and alone). Issues carry `reportIndex`; if any report
1153
- has an error, every error and warning of every report is thrown together. The result has
1154
- `fileName: '1214_batch_<n>.txt'`, `summary.reports = n`, `summary.records` summed over the reports
1155
- (9999 = n), `summary.mainCodePairs` the most of any report and `omittedZeroCodes` with their
1156
- `reportIndex` (§15 A-26).
1157
-
1158
- ### 8.2 Parsing algorithm (`parse1214`)
1159
-
1160
- 1. Decode: `Uint8Array` → string with windows-1255 (or UTF-8 when `options.encoding`). Strip a UTF-8
1161
- BOM if present. Accept `\r\n` or `\n` line endings; ignore one trailing empty line.
1162
- 2. For each line: check form type (`1214`), record type (known for the year), 128-zero prefix, exact
1163
- length. The tax year is read from the first 1000 record's position 146 and selects the layout; a
1164
- file that does not start with a 1000 record is rejected.
1165
- 3. Check record order (§3.3) and the **maximum** occurrences (minimums are business rules, e.g.
1166
- `struct.shareholders.min`, so a kibbutz file without 1020 records parses); split reports at each
1167
- 9999 (batch). A tax year outside `supportedTaxYears()` is reported as
1168
- `struct.taxYear.unsupported`. `parse.occurrences` is reported once per limit, at the first record
1169
- over it: `RecordDef.maxOccurs` for 1010, 1020, 1030, 2000 and 2200, and 14 for all 30xx records
1170
- together; a second 1000 or 9999 in a report is `parse.order` (or starts the next report of a
1171
- batch), and a 51st report of a batch file is `parse.occurrences` at its first line. `parse1214`
1172
- given a file with a 1000 record after a 9999 record throws `parse.multipleReports` (only that
1173
- issue, at column 1 of that 1000 record); other records after the 9999 stay `parse.order`.
1174
- `parse1214Batch` splits after each 9999 and parses each report on its own (lines after the last
1175
- 9999 form a final report, so a missing final 9999 is `parse.control.missing`); every structural
1176
- issue of every report is thrown together, with its file line and `reportIndex`, and the business
1177
- issues of each `ParseResult` carry `reportIndex` too.
1178
- 4. Decode header fields by layout (inverse of §4.2); header fillers are ignored (only positions
1179
- 9–136 are checked). Numeric fields must be all digits (`percentLiteral` may also hold one `.`
1180
- between digits); alphanumeric values are trimmed of padding spaces. Dates must be valid
1181
- `DD/MM/YYYY` or all spaces. Flag and yes/no fields accept only the digits they are written with
1182
- (flag `0`/`1`, yes/no `0`/`1`/`2`), and phone-prefix fields only an allowed prefix or the absent
1183
- value (spaces, or zeros in 822); any other value is a parse error (codec reason `format`,
1184
- `parse.fieldValue`).
1185
- 5. Decode sections: read `code(3)` + value(width of that code) repeatedly; stop at the first
1186
- position where the remaining text is all `0` (padding). An unknown code, a truncated entry or a
1187
- non-zero tail is a parse error. Duplicate codes are a parse error. Country-amount sections (2200)
1188
- are read the same way, entry by entry (§3.6); an affiliation other than `1`, a malformed country
1189
- code, a truncated entry, a non-zero tail or more than 10 entries is `parse.countrySection` (a
1190
- non-digit income stays `parse.numeric`). A 2200 code (2200@137) that is not a per-country code of
1191
- record 2000, or that an earlier 2200 record of the report already has, is `parse.fieldValue`; a
1192
- 2200 record with no 2000 record before it is `parse.order`.
1193
- 6. Verify 9999 counts against the records actually present. A report without any problem of steps
1194
- 1–6 is then checked for `parse.derivedMismatch`: it is denormalized and normalized again, so
1195
- every derived value (§7.4) is derived by the generator's own derivations from its source in the
1196
- file, and each that differs from the file is an issue at its field or code (column of the code
1197
- entry, or the section start when the code is absent). 833 is read back as
1198
- `hasCapitalGainsAppendix` (§7.4), so only 833 = no while 30xx records or untransmitted appendices
1199
- exist can differ; a required derived field the file leaves empty is `field.required`, not a
1200
- mismatch. The country-entry affiliation of 2200 is `parse.countrySection` (step 5).
1201
- 7. Build `NormalizedReport`, denormalize to `Report1214Input` (canonical form, §8.4), and run the
1202
- rule engine on it; return its issues in `ParseResult.issues` (they are not thrown). Issue paths
1203
- are those of the reconstructed input, the n-th record of a type standing for the n-th input
1204
- element. A required value that the file leaves empty is absent from `ParseResult.report` too (its
1205
- `field.required` issue reports it); `ParseResult.saveDate` / `softwareName` are then `''`.
1206
-
1207
- Structural problems from steps 1–6 throw `Opcn1214ParseError` with every problem found in the file
1208
- (the parser continues to the next line where possible; it does not stop at the first problem). Its
1209
- issues are sorted by line, then column, and each has a 1-based `line` and `column`: the first
1210
- offending character, the start of the record type for `parse.order`, the field position for
1211
- `parse.control.counts`, and column 1 of the line after the last one for `parse.control.missing` (and
1212
- of line 1 for `parse.empty`). A line with a structural problem (encoding, form or record type,
1213
- prefix, length) is not decoded further, but still counts for the order and 9999 checks.
1214
-
1215
- ### 8.3 Determinism
1216
-
1217
- - Output depends only on the input values and `meta.saveDate` (or `options.today()`).
1218
- - Object key order, `amounts` key order and `undefined`-valued properties do not affect output.
1219
- - Code-amount entries are sorted by code; 2200 records by code; capital gains by record type then
1220
- input order (§3.3).
1221
- - No locale-dependent APIs (`toLocaleString`, `Intl` number formatting) are used in encoding.
1222
-
1223
- ### 8.4 Canonical form and round trip
1224
-
1225
- `canonicalize(input)` returns the input as the parser would reconstruct it:
1226
-
1227
- - text normalized (§4.3); optional properties that encode to the empty/zero value removed (`false`
1228
- flags, absent yes/no, empty strings, empty `relatedCompanies` and `rdInvestments` lists, an empty
1229
- `foreignAppendix.countryBreakdown`); `amounts` and `foreignAppendix.amounts` entries with value
1230
- `0` for non `zeroAllowed` codes removed; derived values not present in the input;
1231
- - `meta.saveDate` and `meta.softwareName` set to the values actually written
1232
- (`canonicalize(input, options)` takes the same options as generation, for `today`);
1233
- - digit-string inputs of numeric fields (`id9`, `shareholderId`, `digits`) zero-padded to the field
1234
- width (`'12'` → `'012'` for a 3-digit branch); `bankAccount.account` zero-padded to 9 digits, as
1235
- code 277 holds it (`'678'` → `'000000678'`); breakdown country codes zero-padded to 3 digits
1236
- (`'40'` → `'040'`), incomes of 0 kept;
1237
- - optional numeric header values equal to `0` removed (exception: `amountX` 1000@1091, where 0 is
1238
- meaningful);
1239
- - capital-gains appendices in emission order (grouped by record type ascending, §3.3), an empty
1240
- `capitalGains` list removed; `withholders` as the parser reads the slots back (§7.3): trailing
1241
- empty withholders and an empty list removed, an empty withholder before a filled one kept as `{}`.
1242
-
1243
- Round-trip requirements (tested, §13.6):
1244
-
1245
- 1. `parse1214(generate1214(x).bytes).report` deep-equals `canonicalize(x)` for every valid `x`.
1246
- 2. `generate1214(parse1214(f).report).bytes` equals `f` byte-for-byte for every golden file `f`
1247
- (with the parsed save date and software name passed back in `meta`).
1248
-
1249
- Lossy cases that make (1) use `canonicalize`: `yesNo` absent vs. not-required; `false` flags;
1250
- `percentLiteral` 10 vs 10.0 (both → `00010`); text whitespace.
1251
-
1252
- ### 8.5 Character set and lengths
1253
-
1254
- All width checks happen on the normalized string, whose length equals its byte length in
1255
- windows-1255. JavaScript `string.length` counts UTF-16 code units; after normalization only BMP
1256
- characters representable in windows-1255 remain, so `length` is correct.
1257
-
1258
- ---
1259
-
1260
- ## 9. Validation engine
1261
-
1262
- ### 9.1 Issues
1263
-
1264
- ```ts
1265
- export type Severity = 'error' | 'warning'
1266
-
1267
- export interface Issue {
1268
- ruleId: RuleId // stable, e.g. 'main.familyCompany.code080' (§10)
1269
- severity: Severity
1270
- message: string // English, human-readable, may include values
1271
- path: string // input path, see grammar below; '' for report-level issues
1272
- recordType?: RecordType
1273
- recordIndex?: number // 0-based index among records of that type
1274
- reportIndex?: number // batch only
1275
- field?: { position: number; length: number; nameHe: string } // for field-level issues
1276
- code?: string // for code-amount issues
1277
- value?: unknown // offending value (redacted to 100 chars)
1278
- expected?: string // e.g. 'one of 1, 2, 12'
1279
- specRef?: { page: number; note?: string }
1280
- line?: number // parse issues: 1-based line
1281
- column?: number // parse issues: 1-based column
1282
- }
1283
-
1284
- export interface RuleMeta {
1285
- id: RuleId
1286
- severity: Severity
1287
- // 'spec' = stated in the PDF; 'derived' = our consistency check;
1288
- // 'checker' = enforced by SHAAM's structure checker (shopcn) but not stated in the PDF
1289
- source: 'spec' | 'derived' | 'checker'
1290
- scope: RecordType | 'report' | 'input' | 'parse'
1291
- description: string
1292
- specRef?: { page: number; note?: string }
1293
- }
1294
- ```
1295
-
1296
- **Path grammar:** JavaScript-style access from the root of `Report1214Input`: dot for identifier
1297
- properties, `["…"]` for property names that are not identifiers (all code keys), `[n]` for array
1298
- indexes, `["code"]` for map keys. Examples: `company.phone.prefix`, `shareholders[3].fullName`,
1299
- `amounts["080"]`, `foreignAppendix.countryBreakdown["420"].countries[2].country`,
1300
- `capitalGains[1].improvements[0].date`. Issues found while parsing use the path of the reconstructed
1301
- input when one exists, plus `line`/`column`.
1302
-
1303
- **Sorting** (deterministic): report index → record order (§3.3) → record index → field position or
1304
- code → rule ID.
1305
-
1306
- ### 9.2 Stages
1307
-
1308
- | Stage | Input | Rules | Stops pipeline? |
1309
- | ------------ | ----------------------- | ------------------------------------------------------- | --------------- |
1310
- | 1. Year | `input.taxYear` | `struct.taxYear.unsupported` | yes |
1311
- | 2. Shape | raw input, zod (strict) | `input.shape`, `input.unknownCode`, `input.derivedCode` | yes |
1312
- | 3. Field | `NormalizedReport` | `field.*` (layout-driven) | no |
1313
- | 4. Business | `NormalizedReport` | `main.*`, `shareholders.*`, `foreign.*`, `cg.*` | no |
1314
- | 5. Structure | `NormalizedReport` | `struct.*` | no |
1315
-
1316
- All issues from stages 3–5 are collected (no fail-fast). The zod schema deliberately accepts any
1317
- string for phone prefixes and country codes (the TS types are literal unions): those are checked by
1318
- `field.phonePrefix` and `foreign.breakdown.country.unknown`, so the rules stay reachable for untyped
1319
- callers. Before zod runs, keys of code maps that are unknown or derived are reported as
1320
- `input.unknownCode` / `input.derivedCode` and removed, so they are not reported twice. zod's
1321
- `unrecognized_keys` issues become one `input.shape` issue per key, with the key appended to the
1322
- path. The zod schema is generated per year from the layout (code maps, enum literals) plus the
1323
- hand-written object shapes of §7.2; zod issues are mapped to `input.shape` issues with the zod path
1324
- converted to the path grammar above.
1325
-
1326
- ### 9.3 Generic field rules (stage 3)
1327
-
1328
- Repeated slots: header keys with an index (`withholders[2].name`, `improvements[0].date`,
1329
- `walletAddresses[1]`, `declarations.reportablePositions[3]`) form slots. A `required=yes` field
1330
- inside a slot is required only when the slot is in use, i.e. another key of the same slot has a
1331
- value (D-12).
1332
-
1333
- For every header field and every code with a value, the engine applies the rules implied by its
1334
- `FieldDef`/`CodeDef`: `required`, `kind`, `length`, `values`, `zeroAllowed`. Conditional
1335
- requirements (`required = conditional`) are **not** evaluated generically; each has a named business
1336
- rule in §10.4.
1337
-
1338
- ---
1339
-
1340
- ## 10. Rule catalogue
1341
-
1342
- Severity: **E** = error (blocks generation), **W** = warning. Source: **spec** = stated in the PDF,
1343
- **derived** = consistency check we add (kept few, always justified), **checker** = enforced by
1344
- SHAAM's structure checker (shopcn) but not stated in the PDF (recorded in §15 with the checker's
1345
- message). Every rule must exist in `RULES` and have tests (§13.4).
1346
-
1347
- ### 10.1 Input and structure
1348
-
1349
- | Rule ID | Sev | Source | Condition (violation) | Ref |
1350
- | ----------------------------- | --- | ------- | ------------------------------------------------------------------------------------------------------------------------------- | ------------- |
1351
- | `struct.taxYear.unsupported` | E | derived | `taxYear` not in `supportedTaxYears()` | — |
1352
- | `input.shape` | E | derived | wrong JS type, missing required property, unknown property, `null`, array too long (e.g. > 4 withholders, > 2 wallet addresses) | — |
1353
- | `input.unknownCode` | E | spec | an `amounts` / `countryBreakdown` key that is not a code of that record for the year | p.13, 27, 34+ |
1354
- | `input.derivedCode` | E | derived | caller passed a derived code (008, 028, 273, 277, 278, 280, 297, 501–505) | §7.4 |
1355
- | `struct.relatedCompanies.max` | E | spec | more than 3 related companies | p.2 |
1356
- | `struct.shareholders.min` | E | spec | no shareholders and `declarations.isKibbutz` is not true | p.1, 21 |
1357
- | `struct.shareholders.max` | E | spec | more than 99 shareholders | p.2, 21 |
1358
- | `struct.rdInvestments.max` | E | spec | more than 5 R&D investments | p.2 |
1359
- | `struct.capitalGains.max` | E | spec | more than 14 capital-gains appendices | p.1, 32 |
1360
- | `struct.mainCodePairs.max` | E | spec | more than 61 code-amount pairs in record 1000 (after derivations) | p.13 |
1361
- | `struct.batch.size` | E | spec | batch with 0 or more than 50 reports | p.1 |
1362
-
1363
- ### 10.2 Generic field rules (apply to every field/code by layout)
1364
-
1365
- | Rule ID | Sev | Source | Condition (violation) | Ref |
1366
- | ------------------------- | --- | ------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------- |
1367
- | `field.required` | E | spec | field/code with `required=yes` absent (for codes not `zeroAllowed`, `0` counts as absent) | per field |
1368
- | `field.numeric` | E | spec | numeric field (`id9`, `shareholderId`, `num`, phone number, bank/branch/account) contains non-digits | type column |
1369
- | `field.length` | E | spec | normalized text longer than width, or number with more digits than width | length column |
1370
- | `field.checkDigit` | E | checker | `id9`/`shareholderId` value of 1–9 digits that fails the Israeli check digit (§4.2); values failing `field.numeric`/`field.length` are not checked again | shopcn, §15 A-25 |
1371
- | `field.integer` | E | spec | `amount`/`amountX`/`num` not an integer (`rounding: 'reject'`) | p.13 "no dots" |
1372
- | `field.decimals` | E | spec | `amountX100`/`percentX100`/`percentLiteral`/`rateX100` with more than 2 decimals | p.10, 23, 35 |
1373
- | `field.negative` | E | spec | negative number | p.13 |
1374
- | `field.enum` | E | spec | kinds `enum` and `rateX100` only: value not in `values` (code 014 ∉ {1, 2, 12}; 018 ∉ 2..7; 30xx 018 ∉ {23, 50}; relation type ∉ 1..8) | values column |
1375
- | `field.date` | E | spec | not a valid ISO date (input) / `DD/MM/YYYY` (parse) | date fields |
1376
- | `field.percentRange` | E | spec | percentage outside 1–100 | p.10, 23 |
1377
- | `field.hebrewFirstLetter` | E | spec | `hebrewText` value whose first character is not א–ת | p.9, 23, 34 … |
1378
- | `field.charset` | E | derived | control character or character not representable in windows-1255 (after §4.3) | §4.3 |
1379
- | `field.phonePrefix` | W | spec | prefix not in the allowed list: the prefix is dropped (SHAAM deletes it, p.6); for the required 1000@493 the follow-up `field.required` is the error | p.6–7 |
1380
- | `field.phoneNumber` | E | derived | phone/fax number is not exactly 7 digits (shorter numbers would be silently zero-padded) | p.6 |
1381
-
1382
- The income of every country entry of a 2200 record is a 12-digit `amount` (§3.6) and is checked like
1383
- a code value: `field.negative`, `field.integer`, `field.length`, at
1384
- `foreignAppendix.countryBreakdown["420"].countries[n].income`. Country codes are checked by the
1385
- `foreign.breakdown.country.*` rules (§10.5).
1386
-
1387
- ### 10.3 Record 1000 — conditional and cross-field rules
1388
-
1389
- | Rule ID | Sev | Source | Condition (violation) | Ref |
1390
- | ---------------------------------------------------- | --- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------- |
1391
- | `main.withholdingFile.companyNumber` | E | checker | `company.withholdingFileNumber` given and its first 8 digits are not `9` + the first 7 digits of `company.fileNumber` (left-padded to 9); the message states the expected number (with its check digit, which `field.checkDigit` checks) | shopcn, §15 A-28 |
1392
- | `main.familyCompany.fileNumber` | E | spec | family company (836) without the taxpayer file number (837) | p.7 |
1393
- | `main.familyCompany.code080` | E | spec | family company (836) without code 080 (0 allowed) | p.15 |
1394
- | `main.houseCompany.code084` | E | spec | house company (846) without code 084 (0 allowed) | p.15 |
1395
- | `main.investmentLaw.flag` | E | spec | code 101 or 102 filled but 849 not marked | p.8 |
1396
- | `main.beneficiaryEnterprise.noticeDate` | E | spec | 851 marked without 852 (guaranteed by the input type; checked for JS callers and parsed files) | p.8 |
1397
- | `main.beneficiaryEnterprise.noticeDateBeforeTaxYear` | E | checker | 852 before the start of the tax year: 1 January of `taxYear`, or the start of a special year (the day after the balance-sheet date 864 one year earlier) when that is earlier; no upper bound; the message names the earliest date accepted | shopcn, §15 A-33 |
1398
- | `main.specialYear.balanceSheetDate` | E | spec | 863 marked without 864 (same as above) | p.8 |
1399
- | `main.kibbutz.code226` | E | spec\* | `isKibbutz` but code 226 not filled | p.9, 18 |
1400
- | `main.kibbutz.code226Other` | W | derived | code 226 = 9 ("other cooperative, not kibbutz") while `isKibbutz` | p.18 |
1401
- | `main.buildingIncome.code259` | E | spec | `hasBuildingIncome` (884 = 1) without code 259 | p.9 |
1402
- | `main.cgReasons.otherText` | E | spec | reason "other" (967) marked without text (968) | p.11 |
1403
- | `main.reportablePositions.required` | E | spec | `tookReportablePosition` (1030 = 1) and no position numbers | p.11 |
1404
- | `main.reportablePositions.max` | E | spec | more than 5 positions | p.11 |
1405
- | `main.reportablePositions.unexpected` | W | derived | positions given while `tookReportablePosition` is false | p.11 |
1406
- | `main.rd.records` | E | spec | code 165 > 0 but no 1030 records | p.17 |
1407
- | `main.rd.total` | W | derived | sum of 1030 investment amounts ≠ code 165, in whole shekels; checked when both are present | p.17 |
1408
- | `main.capitalGains.flag` | E | derived | `declarations.hasCapitalGainsAppendix === false` while capital-gains appendices exist | p.7 |
1409
- | `main.cgUntransmitted.reason` | W | derived | `untransmittedCount > 0` and none of the reasons 964–967 marked | p.10–11 |
1410
- | `main.cgUntransmitted.reasonWithoutCount` | W | derived | a reason 964–967 marked while `untransmittedCount` is 0/absent | p.10–11 |
1411
- | `main.appendixTotal.min` | W | derived | `totalAppendicesCount` (960) given and < transmitted appendices (2000 + 30xx) + `untransmittedCount` | p.10 |
1412
- | `main.bankAccount.withNoBank` | W | derived | `noBankAccount` (1064) and `bankAccount` both given | p.12, 19 |
1413
- | `main.bankAccount.format` | E | spec | bank not exactly 2 digits, branch not exactly 3 digits, or account not 1–9 digits | p.19 |
1414
- | `main.qualifyingCompany.purchaseAmounts` | W | derived | `purchased` but neither purchase amount given | p.12 |
1415
- | `main.qualifyingCompany.amortizationAmount` | W | derived | `amortizationClaimed` but no amortization amount | p.12 |
1416
- | `main.attachments.code070` | W | derived | donation receipts count > 0 but code 070 absent | p.10 |
1417
- | `main.attachments.code010` | W | derived | withholding certificates count > 0 but code 010 absent | p.10 |
1418
-
1419
- \* The spec text for 877 is "required in the case of a kibbutz and when field 226 is filled" (§15
1420
- A-13).
1421
-
1422
- For `main.appendixTotal.min`, 960 counts as given only when it is above 0: an optional count of 0 is
1423
- written as absent (§8.4), so input and parsed files are judged alike.
1424
-
1425
- Spec rules that are **enforced by derivation** and therefore need no runtime rule: 834 ⇒ code 297
1426
- (8/9); 882 ⇒ code 008 = 1; code 273 ↔ 1029/1030; 832/833 ↔ appendix records; code 028; serial and
1427
- sequence numbers; all 9999 counts. Their correctness is covered by encoder tests, and in parse mode
1428
- by `parse.derivedMismatch`.
1429
-
1430
- ### 10.4 Records 1010 / 1020 / 1030
1431
-
1432
- | Rule ID | Sev | Source | Condition (violation) | Ref |
1433
- | ----------------------------------- | --- | ------- | ---------------------------------------------------------------------------------------------------- | ---- |
1434
- | `shareholders.dividendRights.total` | E | spec | at least one shareholder has `dividendRightsPercent` and the total ≠ 100.00 (computed in hundredths) | p.23 |
1435
- | `shareholders.duplicateId` | W | derived | the same `idNumber` twice (excluding 999999964 / 999999998) | — |
1436
-
1437
- (Names, relation type, control flag and amounts are covered by §10.2 through the layout's `required`
1438
- and `values` columns.)
1439
-
1440
- ### 10.5 Records 2000 / 2200
1441
-
1442
- | Rule ID | Sev | Source | Condition (violation) | Ref |
1443
- | --------------------------------------------- | --- | ------- | ------------------------------------------------------------------------------------------------------------------------ | ----------- |
1444
- | `foreign.otherIncome.description` | E | spec | `otherTaxableIncome` > 0 without `otherTaxableIncomeDescription` | p.26 |
1445
- | `foreign.refund.amount` | W | derived | `taxRefundDeclaration` true without `taxRefundDeclarationAmount` > 0 | p.26 |
1446
- | `foreign.breakdown.required` | E | spec | a `perCountryBreakdown` code is written in the 2000 section (442 = 0 included, A-24) but has no `countryBreakdown` entry | p.27 |
1447
- | `foreign.breakdown.orphan` | E | spec | a `countryBreakdown` entry for a code not written in the 2000 section (absent, or 0 and omitted) | p.30 |
1448
- | `foreign.breakdown.countries.min` | E | derived | a breakdown with no countries | p.31 |
1449
- | `foreign.breakdown.countries.max` | E | spec | more than 10 countries for one code | p.30 |
1450
- | `foreign.breakdown.country.unknown` | E | spec | country code not in `countries.csv` | p.32, 63–71 |
1451
- | `foreign.breakdown.country.unknownOnlyFor439` | E | spec | `-88` used for a code other than 439 | p.32 |
1452
- | `foreign.breakdown.country.duplicate` | W | derived | the same country twice within one breakdown | — |
1453
-
1454
- ### 10.6 Capital-gains appendices
1455
-
1456
- | Rule ID | Sev | Source | Condition (violation) | Ref |
1457
- | ------------------------------ | --- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------- |
1458
- | `cg.improvements.max` | E | spec | more than 5 improvements in a 3077 appendix (report the excess via 962 / reason 965 instead) | p.10, 55 |
1459
- | `cg.improvements.code50Amount` | W | derived | an improvement without `code50Amount`, or a `code50Amount` with no expense/depreciation | p.58 |
1460
- | `cg.improvements.expense` | E | checker | an improvement in use without `expense` > 0 (at `capitalGains[i].improvements[j].expense`), or with `accumulatedDepreciation` above its `expense` (at `…accumulatedDepreciation`); shopcn counts only improvements with an expense against 245 | shopcn, §15 A-32 |
1461
- | `cg.virtualCurrency.wallet` | E | spec | 3077 with code 071 = 1 and no wallet address ("יש להכניס כתובת הארנק", p.57) | p.57 |
1462
- | `cg.codePairs.max` | E | checker | more than 20 code-amount pairs written in one 30xx record (omitted zero codes do not count; only 3060 and 3065 have more than 20 codes), at `capitalGains[i].amounts` | shopcn, §15 A-30 |
1463
-
1464
- Improvement dates (271/305/339/373/407) are covered by the slot-aware `field.required` (§9.3); the
1465
- rate code 018 and code 092 (3077, §15 A-31) by `field.enum`. Required dates (3050 purchase date and
1466
- code-15 date; 3051 code-15 date; 3054 purchase date and code-15 date; 3077 code-15 and code-20
1467
- dates) and required codes (3051: 071 = 1, 016) are `required=yes` in the layout and covered by
1468
- `field.required`.
1469
-
1470
- ### 10.7 Parse-only rules (`Opcn1214ParseError` issues)
1471
-
1472
- | Rule ID | Condition |
1473
- | ----------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
1474
- | `parse.empty` | no records |
1475
- | `parse.encoding` | bytes that do not decode in the selected encoding |
1476
- | `parse.lineLength` | line length ≠ record length |
1477
- | `parse.formType` | positions 1–4 ≠ `1214` |
1478
- | `parse.recordType` | unknown record type |
1479
- | `parse.prefixFiller` | positions 9–136 not all `0` |
1480
- | `parse.order` | record out of the §3.3 order, a 2200 record with no 2000 record before it, or a second 1000 before a 9999 |
1481
- | `parse.occurrences` | maximum record counts of §3.2 exceeded (minimums are business rules) |
1482
- | `parse.control.missing` | report not terminated by 9999 |
1483
- | `parse.control.counts` | 9999 counts differ from the records present |
1484
- | `parse.multipleReports` | `parse1214` given a batch (use `parse1214Batch`) |
1485
- | `parse.numeric` | non-digit in a numeric field |
1486
- | `parse.date` | invalid `DD/MM/YYYY` |
1487
- | `parse.codeSection` | unknown code, duplicate code, truncated entry, or non-zero data after the last entry |
1488
- | `parse.fieldValue` | header value well-formed for its type but not one it can hold (flag/yes-no digit, phone prefix, a 2200 code that is not a per-country code of 2000 or repeats an earlier 2200 record's) |
1489
- | `parse.countrySection` | malformed country-amount section (affiliation ≠ 1, bad country, truncated entry, non-zero tail, > 10 entries) |
1490
- | `parse.derivedMismatch` | a derived value disagrees with its source (e.g. code 273 vs 1029/1030, 832 vs 2000 presence, serial numbers) |
1491
-
1492
- ---
1493
-
1494
- ## 11. Error handling
1495
-
1496
- ### 11.1 Principles
1497
-
1498
- 1. **Data problems are values, not exceptions,** in `validate1214` and in `ParseResult.issues`.
1499
- 2. **Generation refuses invalid data:** `generate1214` throws `Opcn1214ValidationError` carrying
1500
- every error and warning, so callers can show the complete list at once.
1501
- 3. **Collect all:** no stage short-circuits except year and shape (§9.2), which make later stages
1502
- meaningless.
1503
- 4. **Programmer and internal errors are exceptions:** wrong argument types to the API (`TypeError`),
1504
- unsupported year in `getLayout` (`Opcn1214UnsupportedYearError`), and invariant violations such
1505
- as a wrong line length (`Opcn1214InternalError`, which signals a bug in the package).
1506
- 5. **No silent repair.** The only automatic changes are documented normalization (§4.3), dropping an
1507
- invalid phone prefix (as SHAAM does, with a warning) and omitting `0` for non-`zeroAllowed` codes
1508
- (§4.5, listed in `summary.omittedZeroCodes`).
1509
-
1510
- ### 11.2 Error classes (`src/errors.ts`)
1511
-
1512
- ```ts
1513
- export class Opcn1214Error extends Error {
1514
- readonly issues: readonly Issue[]
1515
- constructor(message: string, issues: readonly Issue[])
1516
- }
1517
- export class Opcn1214ValidationError extends Opcn1214Error {} // generate1214 / generate1214Batch; issues: errors, then warnings (each sorted)
1518
- export class Opcn1214ParseError extends Opcn1214Error {} // parse1214 / parse1214Batch
1519
- export class Opcn1214UnsupportedYearError extends Opcn1214Error {
1520
- readonly taxYear: number
1521
- }
1522
- export class Opcn1214InternalError extends Error {} // bug; never expected in production
1523
- ```
1524
-
1525
- `message` summarizes (`"1214 report has 3 errors: field.required at company.phone.number; …"`, first
1526
- five issues). Every class sets `name` and uses `Error.cause` when wrapping.
1527
-
1528
- ### 11.3 Messages
1529
-
1530
- English, one sentence, includes the Hebrew field name for UI context, e.g.:
1531
- `Required field "מספר טלפון" (1000@496, company.phone.number) is missing.` Messages are not part of
1532
- the stability contract (§6.5); UIs should key on `ruleId` and `path`.
1533
-
1534
- ### 11.4 Server usage pattern (non-normative)
1535
-
1536
- ```ts
1537
- const result = validate1214(input)
1538
- if (!result.valid) return { errors: result.errors, warnings: result.warnings } // show in the UI
1539
- const { bytes, fileName, warnings } = generate1214(input) // cannot throw validation errors now
1540
- ```
1541
-
1542
- ---
1543
-
1544
- ## 12. Implementation plan
1545
-
1546
- The step-by-step plan, with one test-driven prompt per step, is
1547
- [`IMPLEMENTATION_PLAN.md`](IMPLEMENTATION_PLAN.md). Phase mapping: P0 = Part A (layout), P1 = Parts
1548
- B–D (codecs, walking skeleton incl. the parser, record 1000), P2 = Part E (1010, 1030), P3 = Part F
1549
- (2000, 2200), P4 = Part G (capital gains), P5 + P6 = Part H (batches, response file, property tests,
1550
- release). The parser is built with the first report (Part C) and every later step adds encoding and
1551
- decoding together.
1552
-
1553
- ---
1554
-
1555
- ## 13. Testing plan
1556
-
1557
- Framework: Vitest 5 (globals, node environment, as in the sibling packages). Layout:
1558
-
1559
- ```
1560
- tests/
1561
- ├── layout/ integrity.test.ts, codegen-sync.test.ts, registry.test.ts
1562
- ├── encode/ primitives.test.ts, text-normalization.test.ts, code-amount.test.ts, country-amount.test.ts, records/*.test.ts
1563
- ├── rules/ cases.ts (one pass + one fail case per rule), rules.test.ts, coverage.test.ts
1564
- ├── api/ validate.test.ts, generate.test.ts, parse.test.ts, response.test.ts, batch.test.ts
1565
- ├── roundtrip/ roundtrip.test.ts, determinism.test.ts
1566
- └── fixtures/
1567
- ├── builders.ts typed builders: minimalReport(), withShareholders(n), withCapitalGains(...)…
1568
- └── golden/ <name>.input.json, <name>.opcn (windows-1255 bytes), VERIFICATION.md
1569
- ```
1570
-
1571
- ### 13.1 Principles
1572
-
1573
- - Tests import from `src/`, never from `dist/` (they run in the root `unit` project too).
1574
- - Fixtures are built with typed builders, so a model change breaks fixtures at compile time.
1575
- - Every assertion on encoded output checks **exact slices** at layout positions
1576
- (`line.slice(pos - 1, pos - 1 + len)`), not only snapshots.
1577
-
1578
- ### 13.2 Layout integrity (P0)
1579
-
1580
- For each year and record: fields sorted, first at 137, contiguous, the last ends at
1581
- `136 + headerLength`; `136 + headerLength + sectionLength = length`; keys unique per record; every
1582
- `kind` known; `values` parse; codes unique, 3 digits, `length` 1–12; derived codes flagged; 23
1583
- per-country codes in 2000; countries unique; limits match §3.2.
1584
-
1585
- ### 13.3 Normalizer coverage
1586
-
1587
- For a "maximal" input (every optional property set), the normalized 1000…3077 records contain a
1588
- value for **every** non-filler key of `fields.csv`. This catches unmapped fields.
1589
-
1590
- ### 13.4 Rules
1591
-
1592
- - `tests/rules/cases.ts` exports `RULE_CASES: { [K in RuleId]: RuleCase }` (a missing case is a type
1593
- error). `RuleCase` is one of: `{ kind: 'input'; fail(): unknown; pass(): unknown }`
1594
- (validate1214), `{ kind: 'file'; fail(): string | Uint8Array; pass(): … }` (issues from
1595
- `parse1214(...).issues` or from a thrown `Opcn1214ParseError`), `{ kind: 'batch'; … }`
1596
- (`generate1214Batch`), each with optional `path`.
1597
- - `rules.test.ts` iterates `RULES`: the `fail` case yields exactly that rule ID (at `path`, with the
1598
- catalogued severity), the `pass` case does not.
1599
- - `spec-sync.test.ts` asserts `RULES` and the §10 catalogue (the first cell of each §10 table row)
1600
- are the same set — the spec and the code cannot drift apart.
1601
-
1602
- ### 13.5 Golden files
1603
-
1604
- | Fixture | Content |
1605
- | ------------------- | --------------------------------------------------------------------------------------------- |
1606
- | `minimal` | 1000 with only required fields and codes, one shareholder, 9999 |
1607
- | `main-full` | every 1000 field set, 61 code pairs, bank account, 99 shareholders |
1608
- | `kibbutz` | `isKibbutz`, code 226, no shareholders |
1609
- | `related-and-rd` | 3 related companies, 5 R&D investments, code 165 |
1610
- | `foreign` | 2000 with every per-country code, 23 breakdowns incl. `-88` on 439, 10 countries on one code |
1611
- | `cg-<symbol>` × 10 | one appendix per type, all fields filled (3060/3065: 20 of 21 codes, §15 A-30) |
1612
- | `capital-gains-max` | 14 appendices of mixed types, checks numbering and sequence |
1613
- | `hebrew-edge` | Hebrew with geresh/gershayim, final letters, max-width names, typographic quotes (normalized) |
1614
- | `batch-50` | 50 minimal reports |
1615
-
1616
- Each golden `.opcn` file is committed as PENDING and verified on shopcn at the next checkpoint;
1617
- `VERIFICATION.md` records its sha256, which the golden test asserts, so a changed golden cannot pass
1618
- unnoticed. `VERIFICATION.md` also logs date, checker result and any change made. A golden file may
1619
- only change with a major version bump (§6.5) or before the first release.
1620
-
1621
- ### 13.6 Round trip and determinism
1622
-
1623
- - `generate → parse → canonicalize`, deep equality, for every golden input and for randomized inputs
1624
- from the builders (seeded; 200 cases per run).
1625
- - `parse → generate` byte equality for every golden `.opcn`.
1626
- - Shuffling object keys / `amounts` order / input property order produces identical bytes.
1627
- - `meta.saveDate` absent: `options.today` is used; with a fixed `today` the output is stable.
1628
-
1629
- ### 13.7 Negative and edge cases (must be covered)
1630
-
1631
- Text one character over the width; a Hebrew name starting with a digit or quote; an emoji; CR/LF
1632
- inside text; amount `1e21`; `-0`; `NaN`; `0.1 + 0.2` as an ×100 amount (must pass as `0.3`); percent
1633
- `100.001`; date `2024-02-30`; `taxYear: 2023`; 62 code pairs; a zero for a non-`zeroAllowed` code
1634
- (omitted and reported); a zero for 080 in a family company (written); an unknown country; `-88` on
1635
- code 420; a file with LF endings (parse ok); a file with one byte missing on line 3
1636
- (`parse.lineLength` at line 3); 9999 with a wrong count; a 2200 record before its 2000; a 2-digit
1637
- phone prefix on the numeric field 822 (padding as specified).
1638
-
1639
- ### 13.8 Manual verification on shopcn (gate for P1–P4)
1640
-
1641
- 1. Generate the golden file and save the bytes unchanged (`.txt`).
1642
- 2. Upload to <https://secapp.taxes.gov.il/shopcn>; record the result in `VERIFICATION.md`.
1643
- 3. If rejected, record the message, fix the encoder default (§15) and repeat. Never edit the golden
1644
- file by hand.
1645
-
1646
- ### 13.9 CI
1647
-
1648
- `.github/workflows/opcn1214-generator-test.yml`: Node 22/24/26, `yarn install --immutable`,
1649
- `typecheck` (src + tests + scripts via `tsconfig.typecheck.json`), `build` (lint + bob), `test`.
1650
- Locally use the package scripts (`yarn workspace @accounter/opcn1214-generator test --run`); the
1651
- root `yarn test` also runs these tests but its global setup needs Postgres. Tests that read files
1652
- (SPEC.md, CSVs, goldens) resolve paths with `new URL(…, import.meta.url)` because the root runner
1653
- uses the repository root as working directory.
1654
-
1655
- ---
1656
-
1657
- ## 14. Tax-year versioning
1658
-
1659
- - `src/layout/registry.ts` maps `taxYear → YearLayout`. `supportedTaxYears()` returns the keys.
1660
- - **2024** is generated from `documentation/layout/2024/`.
1661
- - **2025** re-exports the 2024 layout with `taxYear: 2025` until SHAAM's 2025 specification is
1662
- added. Known year-sensitive text: the 3065/3066 withholding-status values describe the halves of
1663
- the tax year (the 2024 text says "January–June 2024"); the turnover threshold printed at 834
1664
- (₪256,410) is informational only (not validated).
1665
- - **Adding a year** (e.g. when the 2025 PDF is published):
1666
- 1. Save the PDF to `documentation/specifications/1214-<year>.pdf`.
1667
- 2. `python3 documentation/tools/extract_layout.py extract <pdf> /tmp/raw.json`
1668
- 3. Copy `layout/<prev>/` to `layout/<year>/`, then
1669
- `python3 documentation/tools/extract_layout.py diff /tmp/raw.json documentation/layout/<year>`
1670
- and reconcile every difference in the CSVs (add `key`/`kind`/`values` for new fields/codes; the
1671
- "שינויים ב-<year>" column marks what changed).
1672
- 4. `yarn workspace @accounter/opcn1214-generator generate:layout`; register the year.
1673
- 5. Add golden files for the year; verify on shopcn; add a changeset (minor).
1674
-
1675
- ---
1676
-
1677
- ## 15. Ambiguity register
1678
-
1679
- Decisions are the defaults implemented; "verify" items must be confirmed on shopcn (§13.8) in the
1680
- phase noted, and this table updated with the outcome.
1681
-
1682
- | ID | Topic | Spec says | Decision | Verify |
1683
- | ---- | -------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------- |
1684
- | A-1 | Alphanumeric padding side | p.61: "alphanumeric — when not full, pad spaces **on the left**" | Spaces on the left (right-aligned text). One constant controls it. | P1 — verified (CP-1, 2026-11-17) |
1685
- | A-2 | 1000@949 percentage | Type alphanumeric, length 5; "stored ×100, 10.23% → 1023" | `1023`, alphanumeric padding (→ ` 1023` under A-1) | P1 |
1686
- | A-3 | 1020@199/204/209 percentages | Type numeric, length 5; "10.23% → 10.23; 100% → 00100" | Integers zero-padded; decimals `toFixed(2)` zero-padded (`05.50`); `.` allowed in these fields only | P1 |
1687
- | A-4 | 2000 code value width | p.26 text "amount of 13 positions"; the code table gives 12 for every code | 12 (table) | P3 — verified (CP-3, 2026-11-17) |
1688
- | A-5 | Line separator | Not stated | CRLF after every record, including the last | P1 — verified (CP-1, 2026-11-17) |
1689
- | A-6 | Character encoding | Not stated | windows-1255 (siblings' convention for SHAAM files) | P1 — verified (CP-1, 2026-11-17) |
1690
- | A-7 | Appendix number vs "מספר בתל"ם"; record order of capital gains | Appendix number "running number of the appendix (1,2,3…)"; תל"ם number "running number by the order the capital gains were filled" | Appendix number per symbol; תל"ם number global; records grouped by type ascending | P4 |
1691
- | A-8 | 3060/3065 field 145 values | Lists only "2 - no" (3064 lists "1 - yes") | Yes/no {1, 2} for all three | P4 |
1692
- | A-9 | 2000 section start | p.27 "starts at position 1061" | 1161 (137 + 1024; matches every 30xx record) | P3 — verified (CP-3, 2026-11-17) |
1693
- | A-10 | Section zero-fill side for 2000/30xx | 1000: zeros "on the right"; others unspecified | Zeros after the last entry for all sections | P3 |
1694
- | A-11 | 3077 code 092 (length 1) | No allowed values given | Superseded by A-31: `enum` with the single value 1 | P4 — see A-31 |
1695
- | A-12 | 1000@960 "total number of appendices" | "all appendices transmitted and not transmitted" — which appendix kinds is unclear | Caller-supplied; warning only (`main.appendixTotal.min`) | — |
1696
- | A-13 | 1000@877 kibbutz | "required in the case of a kibbutz and when field 226 is filled" | `isKibbutz` requires code 226; 226 = 9 with `isKibbutz` is a warning | — |
1697
- | A-14 | 9999@143 foreign appendix | Length 2, "1 – if a foreign appendix exists" | `01` / `00` | P3 — verified (CP-3, 2026-11-17) |
1698
- | A-15 | Dividend rights total | "dividend rights of all shareholders should add up to 100%" | Enforced (E) only when at least one shareholder states dividend rights | — |
1699
- | A-16 | Country table completeness | Appendix is "an initial table; follow official publications for updates" | Unknown codes rejected; update `countries.csv` when SHAAM publishes changes | P3 |
1700
- | A-17 | 834 turnover threshold | Label includes "above ₪256,410" | Not validated (the package has no turnover input) | — |
1701
- | A-18 | 3065/3066 withholding status for 2025 | Values describe January–June / July–December **2024** | Interpreted as the halves of the report's tax year | 2025 spec |
1702
- | A-19 | Phone-prefix field types | 493/503 alphanumeric; 822 numeric — same value list | Follow each field's type for padding (` 02` vs `002` for a 2-digit prefix) | P1 |
1703
- | A-20 | Absent optional yes/no | Not stated | `0` | P1 |
1704
- | A-21 | 1091 amortization amount | Type alphanumeric; "0 may be entered" | Digits with alphanumeric padding (`amountX`); 0 is written as `0` | P1 |
1705
- | A-22 | Code order in sections | Not stated | Ascending code order | P1 |
1706
- | A-23 | Data provenance, 3051 header | The PDF table on p.39 lost the position column during extraction | Positions 137/139/142/192/193/194/224 taken from the PDF text layer and verified to chain with the lengths | — |
1707
- | A-24 | Breakdown of code 442 = 0 | A per-country code that "has a value" needs a 2200 record (p.27); 442 is the only per-country code that may be 0 | "Has a value" = written in the 2000 section, so 442 = 0 needs a breakdown; omitted zero codes need none | P3 — verified (CP-3, 2026-11-17) |
1708
- | A-25 | Identifier check digits | Not stated | Every `id9`/`shareholderId` value must pass the Israeli check digit (§4.2; `field.checkDigit`, source `checker`) | Found at CP-2/CP-3; verified (all id9 fixtures passed after FIX-1) |
1709
- | A-26 | Batch summary | Not stated | `mainCodePairs`: the most of any report (61 is per report); `omittedZeroCodes` carry `reportIndex` | — |
1710
- | A-27 | Niqqud in text fields | Not stated | Kept (windows-1255 has them, §4.3); kept out of `hebrew-edge` so a rejection cannot mask its other cases | Unverified on shopcn |
1711
- | A-28 | Withholding file number (1000@225, תיק ניכויים) | Not stated (an `id9` field) | `9` + the first 7 digits of the company file number (1000@137, left-padded to 9) + the Israeli check digit over all 9 digits (`main.withholdingFile.companyNumber` for digits 1–8, `field.checkDigit` for the 9th) | Derived from shopcn probes 2026-11-18; verified (`main-full` passed) |
1712
- | A-29 | Company names of 1010@139 and 1030@138 | Type alphanumeric; no "Hebrew first letter" note | `hebrewText` (`field.hebrewFirstLetter`): shopcn rejected a Latin 1010 name; 1030 by analogy (not yet rejected) | Found on shopcn 2026-11-18; verified (`related-and-rd` passed, 2026-11-18) |
1713
- | A-30 | Code-amount pairs per 30xx record | Section of 1024 positions; 3060 and 3065 list 21 codes | At most 20 pairs written in one appendix (`cg.codePairs.max`): shopcn rejected all 21 | Found on shopcn 2026-11-18; verified (`cg-60`/`cg-65` passed, 2026-11-18) |
1714
- | A-31 | 3077 code 092 values | Code and width 1 only (p.59), no name or values | `enum` with the single value 1 (like 071): shopcn accepted 1 (`cg-77`) and rejected 2 (`capital-gains-max`); its meaning is undocumented | Found on shopcn 2026-11-18; verified (`capital-gains-max` passed) |
1715
- | A-32 | 3077 improvements and their count (245) | 245 is "the number of improvement balances (the number of times code 50 was filled)"; expense and depreciation are optional | Every improvement needs an expense > 0, and its accumulated depreciation may not exceed that expense (`cg.improvements.expense`, source `checker`) | Found on shopcn 2026-11-18; verified (`capital-gains-max` passed) |
1716
- | A-33 | Beneficiary-enterprise notice date (1000@852) | A date (DD/MM/YYYY), required when 851 is marked; no range stated | Not before the start of the tax year (`main.beneficiaryEnterprise.noticeDateBeforeTaxYear`, source `checker`): 1 January of `taxYear`, or the start of a special year when that is earlier; no upper bound | Probed on shopcn 2026-11-18; verified (`main-full` passed); special-year bound not probed |
1717
-
1718
- A-25 was found on shopcn, which validates identifier check digits and stops at the first error:
1719
- `kibbutz` (1000@137 = 570000001) was rejected with "שגיאה בקובץ, ספרת בקורת שגויה", `main-full`
1720
- (1000@225) with "הערך '940000001' אינו תקין במילוי 'תיק ניכויים'" and `related-and-rd` (1010@189)
1721
- with "הערך '510000001' אינו תקין במילוי 'חברות קשורות: תיק חברה'". The fixtures were given valid
1722
- identifiers and regenerated in FIX-1. A-25 still applies to the withholding file number (1000@225,
1723
- an `id9`): FIX-2 kept it there and added A-28 on top.
1724
-
1725
- A-28 to A-31 were found on the shopcn upload of 2026-11-18 and applied in FIX-2:
1726
-
1727
- - A-28: for company file number 514000009, shopcn rejected the withholding file numbers 940000001
1728
- (fails the check digit, does not match the company), 940000003 (passes the check digit, does not
1729
- match the company) and 951400000 (`9` + company digits 1–8, fails the check digit), and accepted
1730
- 951400001 (passes the check digit; digits 2–8 are the company digits 1–7). Message: "הערך
1731
- '940000003' אינו תקין במילוי 'תיק ניכויים'". Hence the rule above; `expectedWithholdingFileNumber`
1732
- (`src/validate/main-rules.ts`) computes the expected number.
1733
- - A-29: "הערך 'Foreign Affiliate Ltd' אינו תקין במילוי 'חברות קשורות: שם חברה'" (1010@139).
1734
- - A-30: "שגיאה בנספח ניירות ערך (נספח מס' 1) לא ניתן למלא יותר מ 20 שדות" (3060) and the same for
1735
- "'לא נוכה מס במקור (1322)'" (3065). The PDF states no such limit.
1736
- - A-31: "שגיאה בקובץ, שגיאה בנספח 77 בשדה 092" for the value 2.
1737
-
1738
- A-32 was found on the shopcn upload of the FIX-2 files (2026-11-18) and applied in FIX-3:
1739
- `capital-gains-max` was rejected with "חוסר התאמה בין הנתונים למספר יתרות השבחה (רווח הון 77 ,3)"
1740
- (appendix 3 of type 77). That appendix declared 2 improvements at 245, but its second improvement
1741
- had an accumulated depreciation and no expense, so shopcn counted 1: it counts an improvement only
1742
- when it has an expense. `cg-77` passed with 5 improvements, each with an expense, a depreciation, a
1743
- date and a code-50 amount. The second half of the rule (depreciation at most the expense) is the
1744
- accounting invariant of a balance (expense less depreciation), not checker evidence.
1745
-
1746
- A-33 was found on the same upload: `main-full` was rejected with "הערך '14/05/2023' אינו תקין במילוי
1747
- 'תאריך מפעל מוטב'". Probes on the verified `minimal` golden (company 514000009, tax year 2024, a
1748
- calendar year) with 851 = 1 and only 852 changed: 14/05/2023 was rejected with the same message;
1749
- 14/05/2024 and 15/01/2025 (after the tax year, before the save date 31/03/2025) were accepted. So
1750
- the notice date may not precede the start of the tax year, and no upper bound was observed. For a
1751
- special year (864 set) the bound is the special year's start (the day after the balance-sheet date
1752
- one year earlier: 2024-09-30 → 2023-10-01, 2024-02-29 → 2023-03-01) when that is before 1 January: a
1753
- permissive extension not covered by the probes.
1754
-
1755
- ---
1756
-
1757
- ## Appendix A — Layout data files
1758
-
1759
- See [`layout/README.md`](layout/README.md). Summary: `records.csv` (17 rows), `fields.csv` (270
1760
- header fields incl. fillers), `codes.csv` (260 codes: 1000 = 102, 2000 = 51, capital gains 107),
1761
- `countries.csv` (255). Extracted from the PDF with `tools/extract_layout.py` and cross-checked
1762
- against the earlier hand-typed JSON: they agree on all positions and lengths except known defects in
1763
- that JSON (off-by-one positions at 1000@613, 2200@140 and the whole 9999 record; 3065 filler 837 vs
1764
- 834; two 3050 dates wrongly optional).
1765
-
1766
- ## Appendix B — Accounter integration notes (follow-up, non-normative)
1767
-
1768
- Findings from `main` that the follow-up server work will need:
1769
-
1770
- - Annual-audit workflow: `packages/client/src/components/screens/operations/annual-audit/index.tsx`
1771
- — step 6 "Add Shareholders Data (1214)" links to routes that do not exist; step 18 "Generate 1214
1772
- Report" links to `/reports/1214` (missing); step 19 compares 1214 tax expenses with the ledger.
1773
- - The closest pattern is the 6111 report:
1774
- `packages/server/src/modules/reports/helpers/shaam6111.helper.ts`
1775
- - `resolvers/shaam6111.resolver.ts`, which returns the file content over GraphQL.
1776
- - Available data: `calculateTaxAmounts` in
1777
- `packages/server/src/modules/reports/helpers/tax.helper.ts` (taxable income, tax expense),
1778
- corporate tax rates (`corporate-taxes` module), business identity and addresses (`businesses` /
1779
- `AdminBusiness`: government ID, withholding and advances file IDs), foreign revenue by country
1780
- (`annualRevenueReport`), securities gains (`foreign-securities`, `securities-semi-annual-report`).
1781
- - Missing data: shareholders with ownership percentages (no table), related companies, R&D
1782
- investments, the declaration flags of record 1000, advance-payment and withholding totals. These
1783
- need a per-year "1214 profile" store and UI before step 18 can be automated.
1784
-
1785
- ## Appendix C — Glossary
1786
-
1787
- | Hebrew | English used here |
1788
- | ------------------------ | ------------------------------------------- |
1789
- | מספר תיק | file number (tax file) |
1790
- | תיק ניכויים | withholding file |
1791
- | המסייע/ת במילוי הדו"ח | preparer |
1792
- | חברה משפחתית / חברת בית | family company / house company |
1793
- | מפעל מוטב / מועדף | beneficiary / preferred enterprise |
1794
- | עמדה חייבת בדיווח | reportable position (form 1346) |
1795
- | נספח חו"ל | foreign appendix |
1796
- | נספח רווח הון / סמל עסקה | capital-gains appendix / transaction symbol |
1797
- | מספר בתל"ם | sequence number |
1798
- | יתרות הוצאות השבחה | improvement-expense balances |
1799
- | מנכה | withholding agent |
1800
- | הפסדים להעברה | losses carried forward |
1801
- | פרטים כלליים (כותרת) | header |
1802
- | קוד סכום | code-amount section |
1803
- | רשומת בקרה | control record |