saft 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,594 @@
1
+ /*
2
+ ! tailwindcss v3.2.4 | MIT License | https://tailwindcss.com
3
+ */
4
+
5
+ /*
6
+ 1. Prevent padding and border from affecting element width. (https://github.com/mozdevs/cssremedy/issues/4)
7
+ 2. Allow adding a border to an element by just adding a border-width. (https://github.com/tailwindcss/tailwindcss/pull/116)
8
+ */
9
+
10
+ *,
11
+ ::before,
12
+ ::after {
13
+ box-sizing: border-box;
14
+ /* 1 */
15
+ border-width: 0;
16
+ /* 2 */
17
+ border-style: solid;
18
+ /* 2 */
19
+ border-color: #e5e7eb;
20
+ /* 2 */
21
+ }
22
+
23
+ ::before,
24
+ ::after {
25
+ --tw-content: '';
26
+ }
27
+
28
+ /*
29
+ 1. Use a consistent sensible line-height in all browsers.
30
+ 2. Prevent adjustments of font size after orientation changes in iOS.
31
+ 3. Use a more readable tab size.
32
+ 4. Use the user's configured `sans` font-family by default.
33
+ 5. Use the user's configured `sans` font-feature-settings by default.
34
+ */
35
+
36
+ html {
37
+ line-height: 1.5;
38
+ /* 1 */
39
+ -webkit-text-size-adjust: 100%;
40
+ /* 2 */
41
+ -moz-tab-size: 4;
42
+ /* 3 */
43
+ -o-tab-size: 4;
44
+ tab-size: 4;
45
+ /* 3 */
46
+ font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
47
+ /* 4 */
48
+ font-feature-settings: normal;
49
+ /* 5 */
50
+ }
51
+
52
+ /*
53
+ 1. Remove the margin in all browsers.
54
+ 2. Inherit line-height from `html` so users can set them as a class directly on the `html` element.
55
+ */
56
+
57
+ body {
58
+ margin: 0;
59
+ /* 1 */
60
+ line-height: inherit;
61
+ /* 2 */
62
+ }
63
+
64
+ /*
65
+ 1. Add the correct height in Firefox.
66
+ 2. Correct the inheritance of border color in Firefox. (https://bugzilla.mozilla.org/show_bug.cgi?id=190655)
67
+ 3. Ensure horizontal rules are visible by default.
68
+ */
69
+
70
+ hr {
71
+ height: 0;
72
+ /* 1 */
73
+ color: inherit;
74
+ /* 2 */
75
+ border-top-width: 1px;
76
+ /* 3 */
77
+ }
78
+
79
+ /*
80
+ Add the correct text decoration in Chrome, Edge, and Safari.
81
+ */
82
+
83
+ abbr:where([title]) {
84
+ -webkit-text-decoration: underline dotted;
85
+ text-decoration: underline dotted;
86
+ }
87
+
88
+ /*
89
+ Remove the default font size and weight for headings.
90
+ */
91
+
92
+ h1,
93
+ h2,
94
+ h3,
95
+ h4,
96
+ h5,
97
+ h6 {
98
+ font-size: inherit;
99
+ font-weight: inherit;
100
+ }
101
+
102
+ /*
103
+ Reset links to optimize for opt-in styling instead of opt-out.
104
+ */
105
+
106
+ a {
107
+ color: inherit;
108
+ text-decoration: inherit;
109
+ }
110
+
111
+ /*
112
+ Add the correct font weight in Edge and Safari.
113
+ */
114
+
115
+ b,
116
+ strong {
117
+ font-weight: bolder;
118
+ }
119
+
120
+ /*
121
+ 1. Use the user's configured `mono` font family by default.
122
+ 2. Correct the odd `em` font sizing in all browsers.
123
+ */
124
+
125
+ code,
126
+ kbd,
127
+ samp,
128
+ pre {
129
+ font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
130
+ /* 1 */
131
+ font-size: 1em;
132
+ /* 2 */
133
+ }
134
+
135
+ /*
136
+ Add the correct font size in all browsers.
137
+ */
138
+
139
+ small {
140
+ font-size: 80%;
141
+ }
142
+
143
+ /*
144
+ Prevent `sub` and `sup` elements from affecting the line height in all browsers.
145
+ */
146
+
147
+ sub,
148
+ sup {
149
+ font-size: 75%;
150
+ line-height: 0;
151
+ position: relative;
152
+ vertical-align: baseline;
153
+ }
154
+
155
+ sub {
156
+ bottom: -0.25em;
157
+ }
158
+
159
+ sup {
160
+ top: -0.5em;
161
+ }
162
+
163
+ /*
164
+ 1. Remove text indentation from table contents in Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=999088, https://bugs.webkit.org/show_bug.cgi?id=201297)
165
+ 2. Correct table border color inheritance in all Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=935729, https://bugs.webkit.org/show_bug.cgi?id=195016)
166
+ 3. Remove gaps between table borders by default.
167
+ */
168
+
169
+ table {
170
+ text-indent: 0;
171
+ /* 1 */
172
+ border-color: inherit;
173
+ /* 2 */
174
+ border-collapse: collapse;
175
+ /* 3 */
176
+ }
177
+
178
+ /*
179
+ 1. Change the font styles in all browsers.
180
+ 2. Remove the margin in Firefox and Safari.
181
+ 3. Remove default padding in all browsers.
182
+ */
183
+
184
+ button,
185
+ input,
186
+ optgroup,
187
+ select,
188
+ textarea {
189
+ font-family: inherit;
190
+ /* 1 */
191
+ font-size: 100%;
192
+ /* 1 */
193
+ font-weight: inherit;
194
+ /* 1 */
195
+ line-height: inherit;
196
+ /* 1 */
197
+ color: inherit;
198
+ /* 1 */
199
+ margin: 0;
200
+ /* 2 */
201
+ padding: 0;
202
+ /* 3 */
203
+ }
204
+
205
+ /*
206
+ Remove the inheritance of text transform in Edge and Firefox.
207
+ */
208
+
209
+ button,
210
+ select {
211
+ text-transform: none;
212
+ }
213
+
214
+ /*
215
+ 1. Correct the inability to style clickable types in iOS and Safari.
216
+ 2. Remove default button styles.
217
+ */
218
+
219
+ button,
220
+ [type='button'],
221
+ [type='reset'],
222
+ [type='submit'] {
223
+ -webkit-appearance: button;
224
+ /* 1 */
225
+ background-color: transparent;
226
+ /* 2 */
227
+ background-image: none;
228
+ /* 2 */
229
+ }
230
+
231
+ /*
232
+ Use the modern Firefox focus style for all focusable elements.
233
+ */
234
+
235
+ :-moz-focusring {
236
+ outline: auto;
237
+ }
238
+
239
+ /*
240
+ Remove the additional `:invalid` styles in Firefox. (https://github.com/mozilla/gecko-dev/blob/2f9eacd9d3d995c937b4251a5557d95d494c9be1/layout/style/res/forms.css#L728-L737)
241
+ */
242
+
243
+ :-moz-ui-invalid {
244
+ box-shadow: none;
245
+ }
246
+
247
+ /*
248
+ Add the correct vertical alignment in Chrome and Firefox.
249
+ */
250
+
251
+ progress {
252
+ vertical-align: baseline;
253
+ }
254
+
255
+ /*
256
+ Correct the cursor style of increment and decrement buttons in Safari.
257
+ */
258
+
259
+ ::-webkit-inner-spin-button,
260
+ ::-webkit-outer-spin-button {
261
+ height: auto;
262
+ }
263
+
264
+ /*
265
+ 1. Correct the odd appearance in Chrome and Safari.
266
+ 2. Correct the outline style in Safari.
267
+ */
268
+
269
+ [type='search'] {
270
+ -webkit-appearance: textfield;
271
+ /* 1 */
272
+ outline-offset: -2px;
273
+ /* 2 */
274
+ }
275
+
276
+ /*
277
+ Remove the inner padding in Chrome and Safari on macOS.
278
+ */
279
+
280
+ ::-webkit-search-decoration {
281
+ -webkit-appearance: none;
282
+ }
283
+
284
+ /*
285
+ 1. Correct the inability to style clickable types in iOS and Safari.
286
+ 2. Change font properties to `inherit` in Safari.
287
+ */
288
+
289
+ ::-webkit-file-upload-button {
290
+ -webkit-appearance: button;
291
+ /* 1 */
292
+ font: inherit;
293
+ /* 2 */
294
+ }
295
+
296
+ /*
297
+ Add the correct display in Chrome and Safari.
298
+ */
299
+
300
+ summary {
301
+ display: list-item;
302
+ }
303
+
304
+ /*
305
+ Removes the default spacing and border for appropriate elements.
306
+ */
307
+
308
+ blockquote,
309
+ dl,
310
+ dd,
311
+ h1,
312
+ h2,
313
+ h3,
314
+ h4,
315
+ h5,
316
+ h6,
317
+ hr,
318
+ figure,
319
+ p,
320
+ pre {
321
+ margin: 0;
322
+ }
323
+
324
+ fieldset {
325
+ margin: 0;
326
+ padding: 0;
327
+ }
328
+
329
+ legend {
330
+ padding: 0;
331
+ }
332
+
333
+ ol,
334
+ ul,
335
+ menu {
336
+ list-style: none;
337
+ margin: 0;
338
+ padding: 0;
339
+ }
340
+
341
+ /*
342
+ Prevent resizing textareas horizontally by default.
343
+ */
344
+
345
+ textarea {
346
+ resize: vertical;
347
+ }
348
+
349
+ /*
350
+ 1. Reset the default placeholder opacity in Firefox. (https://github.com/tailwindlabs/tailwindcss/issues/3300)
351
+ 2. Set the default placeholder color to the user's configured gray 400 color.
352
+ */
353
+
354
+ input::-moz-placeholder, textarea::-moz-placeholder {
355
+ opacity: 1;
356
+ /* 1 */
357
+ color: #9ca3af;
358
+ /* 2 */
359
+ }
360
+
361
+ input::placeholder,
362
+ textarea::placeholder {
363
+ opacity: 1;
364
+ /* 1 */
365
+ color: #9ca3af;
366
+ /* 2 */
367
+ }
368
+
369
+ /*
370
+ Set the default cursor for buttons.
371
+ */
372
+
373
+ button,
374
+ [role="button"] {
375
+ cursor: pointer;
376
+ }
377
+
378
+ /*
379
+ Make sure disabled buttons don't get the pointer cursor.
380
+ */
381
+
382
+ :disabled {
383
+ cursor: default;
384
+ }
385
+
386
+ /*
387
+ 1. Make replaced elements `display: block` by default. (https://github.com/mozdevs/cssremedy/issues/14)
388
+ 2. Add `vertical-align: middle` to align replaced elements more sensibly by default. (https://github.com/jensimmons/cssremedy/issues/14#issuecomment-634934210)
389
+ This can trigger a poorly considered lint error in some tools but is included by design.
390
+ */
391
+
392
+ img,
393
+ svg,
394
+ video,
395
+ canvas,
396
+ audio,
397
+ iframe,
398
+ embed,
399
+ object {
400
+ display: block;
401
+ /* 1 */
402
+ vertical-align: middle;
403
+ /* 2 */
404
+ }
405
+
406
+ /*
407
+ Constrain images and videos to the parent width and preserve their intrinsic aspect ratio. (https://github.com/mozdevs/cssremedy/issues/14)
408
+ */
409
+
410
+ img,
411
+ video {
412
+ max-width: 100%;
413
+ height: auto;
414
+ }
415
+
416
+ /* Make elements with the HTML hidden attribute stay hidden by default */
417
+
418
+ [hidden] {
419
+ display: none;
420
+ }
421
+
422
+ *, ::before, ::after {
423
+ --tw-border-spacing-x: 0;
424
+ --tw-border-spacing-y: 0;
425
+ --tw-translate-x: 0;
426
+ --tw-translate-y: 0;
427
+ --tw-rotate: 0;
428
+ --tw-skew-x: 0;
429
+ --tw-skew-y: 0;
430
+ --tw-scale-x: 1;
431
+ --tw-scale-y: 1;
432
+ --tw-pan-x: ;
433
+ --tw-pan-y: ;
434
+ --tw-pinch-zoom: ;
435
+ --tw-scroll-snap-strictness: proximity;
436
+ --tw-ordinal: ;
437
+ --tw-slashed-zero: ;
438
+ --tw-numeric-figure: ;
439
+ --tw-numeric-spacing: ;
440
+ --tw-numeric-fraction: ;
441
+ --tw-ring-inset: ;
442
+ --tw-ring-offset-width: 0px;
443
+ --tw-ring-offset-color: #fff;
444
+ --tw-ring-color: rgb(59 130 246 / 0.5);
445
+ --tw-ring-offset-shadow: 0 0 #0000;
446
+ --tw-ring-shadow: 0 0 #0000;
447
+ --tw-shadow: 0 0 #0000;
448
+ --tw-shadow-colored: 0 0 #0000;
449
+ --tw-blur: ;
450
+ --tw-brightness: ;
451
+ --tw-contrast: ;
452
+ --tw-grayscale: ;
453
+ --tw-hue-rotate: ;
454
+ --tw-invert: ;
455
+ --tw-saturate: ;
456
+ --tw-sepia: ;
457
+ --tw-drop-shadow: ;
458
+ --tw-backdrop-blur: ;
459
+ --tw-backdrop-brightness: ;
460
+ --tw-backdrop-contrast: ;
461
+ --tw-backdrop-grayscale: ;
462
+ --tw-backdrop-hue-rotate: ;
463
+ --tw-backdrop-invert: ;
464
+ --tw-backdrop-opacity: ;
465
+ --tw-backdrop-saturate: ;
466
+ --tw-backdrop-sepia: ;
467
+ }
468
+
469
+ ::backdrop {
470
+ --tw-border-spacing-x: 0;
471
+ --tw-border-spacing-y: 0;
472
+ --tw-translate-x: 0;
473
+ --tw-translate-y: 0;
474
+ --tw-rotate: 0;
475
+ --tw-skew-x: 0;
476
+ --tw-skew-y: 0;
477
+ --tw-scale-x: 1;
478
+ --tw-scale-y: 1;
479
+ --tw-pan-x: ;
480
+ --tw-pan-y: ;
481
+ --tw-pinch-zoom: ;
482
+ --tw-scroll-snap-strictness: proximity;
483
+ --tw-ordinal: ;
484
+ --tw-slashed-zero: ;
485
+ --tw-numeric-figure: ;
486
+ --tw-numeric-spacing: ;
487
+ --tw-numeric-fraction: ;
488
+ --tw-ring-inset: ;
489
+ --tw-ring-offset-width: 0px;
490
+ --tw-ring-offset-color: #fff;
491
+ --tw-ring-color: rgb(59 130 246 / 0.5);
492
+ --tw-ring-offset-shadow: 0 0 #0000;
493
+ --tw-ring-shadow: 0 0 #0000;
494
+ --tw-shadow: 0 0 #0000;
495
+ --tw-shadow-colored: 0 0 #0000;
496
+ --tw-blur: ;
497
+ --tw-brightness: ;
498
+ --tw-contrast: ;
499
+ --tw-grayscale: ;
500
+ --tw-hue-rotate: ;
501
+ --tw-invert: ;
502
+ --tw-saturate: ;
503
+ --tw-sepia: ;
504
+ --tw-drop-shadow: ;
505
+ --tw-backdrop-blur: ;
506
+ --tw-backdrop-brightness: ;
507
+ --tw-backdrop-contrast: ;
508
+ --tw-backdrop-grayscale: ;
509
+ --tw-backdrop-hue-rotate: ;
510
+ --tw-backdrop-invert: ;
511
+ --tw-backdrop-opacity: ;
512
+ --tw-backdrop-saturate: ;
513
+ --tw-backdrop-sepia: ;
514
+ }
515
+
516
+ .mb-2 {
517
+ margin-bottom: 0.5rem;
518
+ }
519
+
520
+ .mr-8 {
521
+ margin-right: 2rem;
522
+ }
523
+
524
+ .block {
525
+ display: block;
526
+ }
527
+
528
+ .flex {
529
+ display: flex;
530
+ }
531
+
532
+ .table {
533
+ display: table;
534
+ }
535
+
536
+ .w-80 {
537
+ width: 20rem;
538
+ }
539
+
540
+ .min-w-\[20rem\] {
541
+ min-width: 20rem;
542
+ }
543
+
544
+ .max-w-\[20rem\] {
545
+ max-width: 20rem;
546
+ }
547
+
548
+ .flex-wrap {
549
+ flex-wrap: wrap;
550
+ }
551
+
552
+ .justify-between {
553
+ justify-content: space-between;
554
+ }
555
+
556
+ .whitespace-pre {
557
+ white-space: pre;
558
+ }
559
+
560
+ .border-l-2 {
561
+ border-left-width: 2px;
562
+ }
563
+
564
+ .border-b-2 {
565
+ border-bottom-width: 2px;
566
+ }
567
+
568
+ .pl-2 {
569
+ padding-left: 0.5rem;
570
+ }
571
+
572
+ .text-right {
573
+ text-align: right;
574
+ }
575
+
576
+ .font-semibold {
577
+ font-weight: 600;
578
+ }
579
+
580
+ .capitalize {
581
+ text-transform: capitalize;
582
+ }
583
+
584
+ .underline {
585
+ text-decoration-line: underline;
586
+ }
587
+
588
+ .underline-offset-1 {
589
+ text-underline-offset: 1px;
590
+ }
591
+
592
+ .hover\:underline-offset-2:hover {
593
+ text-underline-offset: 2px;
594
+ }
@@ -0,0 +1,133 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "csv"
4
+
5
+ module SAFT::V2::Norway
6
+ PATH = SAFT.gem_root + "vendor" + "norway"
7
+
8
+ module Types
9
+ include Dry.Types
10
+
11
+ Date = Params::Date
12
+ DateTime = Params::DateTime
13
+ Integer = Coercible::Integer
14
+ Decimal = Coercible::Decimal
15
+ Bool = Params::Bool
16
+ String = Strict::String
17
+
18
+ VatRates = Types::String.enum(
19
+ "Regular rate",
20
+ "Reduced rate, low",
21
+ "Reduced rate, middle",
22
+ "Reduced rate, foodstuffs",
23
+ "Reduced rate, raw fish",
24
+ "Reduced rate",
25
+ "Zero rate",
26
+ )
27
+ end
28
+
29
+ class VatTaxCode < Dry::Struct
30
+ attribute :code, Types::String
31
+ attribute :description_no, Types::String
32
+ attribute :description_en, Types::String
33
+ attribute :tax_rate, Types::VatRates.optional.meta(omittable: true)
34
+ attribute :compensation, Types::Bool.optional.meta(omittable: true)
35
+ end
36
+
37
+ VatTaxCodes = Types::Array.of(VatTaxCode)
38
+
39
+ class Account < Dry::Struct
40
+ attribute :number, Types::String
41
+ attribute :description_no, Types::String
42
+ attribute :description_en, Types::String
43
+ end
44
+
45
+ Accounts = Types::Array.of(Account)
46
+
47
+ def self.vat_codes
48
+ return @vat_codes if defined?(@vat_codes)
49
+
50
+ vat_codes = []
51
+ CSV.foreach(
52
+ SAFT::V2::Norway::PATH + "standard_tax_codes.csv",
53
+ headers: true,
54
+ col_sep: ";",
55
+ ) do |row|
56
+ vat_codes.push({
57
+ code: row["Code"],
58
+ description_no: row["DescriptionNOB"],
59
+ description_en: row["DescriptionENG"],
60
+ tax_rate: row["TaxRate"],
61
+ compensation: row["Compensation"],
62
+ })
63
+ end
64
+
65
+ @vat_codes = VatTaxCodes[vat_codes].freeze
66
+ end
67
+
68
+ def self.std_account_map
69
+ return @std_account_map if defined?(@std_account_map)
70
+
71
+ @std_account_map = {}
72
+ general_ledger_accounts_2_digits
73
+ .each { @std_account_map[_1.number] = _1 }
74
+ general_ledger_accounts_4_digits
75
+ .each { @std_account_map[_1.number] = _1 }
76
+
77
+ @std_account_map
78
+ end
79
+
80
+ def self.std_account(number)
81
+ std_account_map[number]
82
+ end
83
+
84
+ def self.std_account!(number)
85
+ std_account_map.fetch(number)
86
+ end
87
+
88
+ def self.vat_code_map
89
+ return @vat_code_map if defined?(@vat_code_map)
90
+
91
+ @vat_code_map = vat_codes.each_with_object({}) do |vat_code, object|
92
+ object[vat_code.code] = vat_code
93
+ end
94
+ end
95
+
96
+ def self.vat_code(code)
97
+ vat_code_map[code]
98
+ end
99
+
100
+ def self.vat_code!(code)
101
+ vat_code_map.fetch(code)
102
+ end
103
+
104
+ def self.general_ledger_accounts_2_digits
105
+ return @general_ledger_accounts_2_digits if defined?(@general_ledger_accounts_2_digits)
106
+
107
+ @general_ledger_accounts_2_digits = parse_general_ledger_accounts(
108
+ SAFT::V2::Norway::PATH + "general_ledger_standard_accounts_2_character.csv",
109
+ )
110
+ end
111
+
112
+ def self.general_ledger_accounts_4_digits
113
+ return @general_ledger_accounts_4_digits if defined?(@general_ledger_accounts_4_digits)
114
+
115
+ @general_ledger_accounts_4_digits = parse_general_ledger_accounts(
116
+ SAFT::V2::Norway::PATH + "general_ledger_standard_accounts_4_character.csv",
117
+ )
118
+ end
119
+
120
+ def self.parse_general_ledger_accounts(path)
121
+ accounts = []
122
+
123
+ CSV.foreach(path, headers: true, col_sep: ";") do |row|
124
+ accounts.push({
125
+ number: row["AccountID"],
126
+ description_no: row["DescriptionNOB"],
127
+ description_en: row["DescriptionENG"],
128
+ })
129
+ end
130
+
131
+ Accounts[accounts].freeze
132
+ end
133
+ end