@accounter/shaam6111-generator 0.1.5-alpha-20251211104015-b8754b56e4fb5cb5ab09ff1ee8b5ea7f8fa59f2f → 0.1.5-alpha-20251211105553-850821f760a4152f9e24e7fca4d23874a887bbe3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +61 -69
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -32,11 +32,7 @@ pnpm add @accounter/shaam6111-generator
32
32
  Create a structured report and generate a compliant SHAAM 6111 report string:
33
33
 
34
34
  ```typescript
35
- import {
36
- generateReport,
37
- IndividualOrCompanyEnum,
38
- ReportData,
39
- } from '@accounter/shaam6111-generator';
35
+ import { generateReport, IndividualOrCompanyEnum, ReportData } from '@accounter/shaam6111-generator'
40
36
 
41
37
  // Create report data structure
42
38
  const reportData: ReportData = {
@@ -57,28 +53,28 @@ const reportData: ReportData = {
57
53
  taxAdjustmentEntryCount: 2,
58
54
  balanceSheetEntryCount: 2,
59
55
  currencyType: 1, // Shekels
60
- amountsInThousands: 2, // No
56
+ amountsInThousands: 2 // No
61
57
  },
62
58
  profitAndLoss: [
63
59
  { code: 1001, amount: 500000 }, // Revenue
64
60
  { code: 2001, amount: 300000 }, // Expenses
65
- { code: 6666, amount: 200000 }, // Profit
61
+ { code: 6666, amount: 200000 } // Profit
66
62
  ],
67
63
  taxAdjustment: [
68
64
  { code: 100, amount: 200000 }, // Accounting profit
69
- { code: 400, amount: 200000 }, // Taxable income
65
+ { code: 400, amount: 200000 } // Taxable income
70
66
  ],
71
67
  balanceSheet: [
72
68
  { code: 6000, amount: 300000 }, // Assets
73
- { code: 7800, amount: 300000 }, // Liabilities + Equity
69
+ { code: 7800, amount: 300000 } // Liabilities + Equity
74
70
  ],
75
- individualOrCompany: IndividualOrCompanyEnum.COMPANY,
76
- };
71
+ individualOrCompany: IndividualOrCompanyEnum.COMPANY
72
+ }
77
73
 
78
74
  // Generate the report
79
- const reportString = generateReport(reportData);
75
+ const reportString = generateReport(reportData)
80
76
 
81
- console.log(reportString);
77
+ console.log(reportString)
82
78
  // Output: Properly formatted SHAAM 6111 report string
83
79
  ```
84
80
 
@@ -87,24 +83,24 @@ console.log(reportString);
87
83
  Parse an existing SHAAM 6111 report into structured data:
88
84
 
89
85
  ```typescript
90
- import fs from 'fs';
91
- import { parseReport } from '@accounter/shaam6111-generator';
86
+ import fs from 'fs'
87
+ import { parseReport } from '@accounter/shaam6111-generator'
92
88
 
93
89
  // Read report content
94
- const reportContent = fs.readFileSync('path/to/report.txt', 'utf-8');
90
+ const reportContent = fs.readFileSync('path/to/report.txt', 'utf-8')
95
91
 
96
92
  // Parse the report
97
93
  try {
98
- const reportData = parseReport(reportContent);
99
-
100
- console.log('Tax File Number:', reportData.header.taxFileNumber);
101
- console.log('Tax Year:', reportData.header.taxYear);
102
- console.log('Business Type:', reportData.header.businessType);
103
- console.log('Profit & Loss Entries:', reportData.profitAndLoss.length);
104
- console.log('Tax Adjustment Entries:', reportData.taxAdjustment.length);
105
- console.log('Balance Sheet Entries:', reportData.balanceSheet.length);
94
+ const reportData = parseReport(reportContent)
95
+
96
+ console.log('Tax File Number:', reportData.header.taxFileNumber)
97
+ console.log('Tax Year:', reportData.header.taxYear)
98
+ console.log('Business Type:', reportData.header.businessType)
99
+ console.log('Profit & Loss Entries:', reportData.profitAndLoss.length)
100
+ console.log('Tax Adjustment Entries:', reportData.taxAdjustment.length)
101
+ console.log('Balance Sheet Entries:', reportData.balanceSheet.length)
106
102
  } catch (error) {
107
- console.error('Error parsing report:', error);
103
+ console.error('Error parsing report:', error)
108
104
  }
109
105
  ```
110
106
 
@@ -113,35 +109,35 @@ try {
113
109
  Validate a report against SHAAM 6111 specifications:
114
110
 
115
111
  ```typescript
116
- import fs from 'fs';
112
+ import fs from 'fs'
117
113
  // Option 2: Validate report data (if you already have parsed data)
118
- import { ReportData, validateData, validateReport } from '@accounter/shaam6111-generator';
114
+ import { ReportData, validateData, validateReport } from '@accounter/shaam6111-generator'
119
115
 
120
116
  // Option 1: Validate a report string
121
- const reportContent = fs.readFileSync('path/to/report.txt', 'utf-8');
122
- const validationResult = validateReport(reportContent);
117
+ const reportContent = fs.readFileSync('path/to/report.txt', 'utf-8')
118
+ const validationResult = validateReport(reportContent)
123
119
 
124
120
  if (validationResult.isValid) {
125
- console.log('Report is valid!');
121
+ console.log('Report is valid!')
126
122
  } else {
127
- console.error('Report validation failed:');
123
+ console.error('Report validation failed:')
128
124
  validationResult.errors.forEach(error => {
129
- console.error(`- ${error.path}: ${error.message}`);
130
- });
125
+ console.error(`- ${error.path}: ${error.message}`)
126
+ })
131
127
  }
132
128
 
133
129
  const reportData: ReportData = {
134
130
  /* ... */
135
- };
136
- const dataValidationResult = validateData(reportData);
131
+ }
132
+ const dataValidationResult = validateData(reportData)
137
133
 
138
134
  if (dataValidationResult.isValid) {
139
- console.log('Report data is valid!');
135
+ console.log('Report data is valid!')
140
136
  } else {
141
- console.error('Report data validation failed:');
137
+ console.error('Report data validation failed:')
142
138
  dataValidationResult.errors.forEach(error => {
143
- console.error(`- ${error.path}: ${error.message}`);
144
- });
139
+ console.error(`- ${error.path}: ${error.message}`)
140
+ })
145
141
  }
146
142
  ```
147
143
 
@@ -150,43 +146,39 @@ if (dataValidationResult.isValid) {
150
146
  Save a report to a file or read a report from a file with proper Windows-1255 encoding:
151
147
 
152
148
  ```typescript
153
- import fs from 'fs';
154
- import {
155
- convertReportToFile,
156
- readReportFromFile,
157
- ReportData,
158
- } from '@accounter/shaam6111-generator';
149
+ import fs from 'fs'
150
+ import { convertReportToFile, readReportFromFile, ReportData } from '@accounter/shaam6111-generator'
159
151
 
160
152
  // Browser environment: Create a File object from report data
161
153
  const reportData: ReportData = {
162
154
  /* ... */
163
- };
164
- const reportFile = convertReportToFile(reportData, 'SHAAM6111.dat');
155
+ }
156
+ const reportFile = convertReportToFile(reportData, 'SHAAM6111.dat')
165
157
 
166
158
  // Handle the File object (e.g., in a browser environment)
167
159
  // For example, trigger a download:
168
- const url = URL.createObjectURL(reportFile);
169
- const a = document.createElement('a');
170
- a.href = url;
171
- a.download = reportFile.name;
172
- document.body.appendChild(a);
173
- a.click();
174
- document.body.removeChild(a);
175
- URL.revokeObjectURL(url);
160
+ const url = URL.createObjectURL(reportFile)
161
+ const a = document.createElement('a')
162
+ a.href = url
163
+ a.download = reportFile.name
164
+ document.body.appendChild(a)
165
+ a.click()
166
+ document.body.removeChild(a)
167
+ URL.revokeObjectURL(url)
176
168
 
177
169
  // Reading a report file (in browser)
178
- const fileInput = document.getElementById('fileInput') as HTMLInputElement;
170
+ const fileInput = document.getElementById('fileInput') as HTMLInputElement
179
171
  fileInput.addEventListener('change', async event => {
180
- const file = fileInput.files?.[0];
172
+ const file = fileInput.files?.[0]
181
173
  if (file) {
182
174
  try {
183
- const reportData = await readReportFromFile(file, true);
184
- console.log('Parsed report data:', reportData);
175
+ const reportData = await readReportFromFile(file, true)
176
+ console.log('Parsed report data:', reportData)
185
177
  } catch (error) {
186
- console.error('Error reading report file:', error);
178
+ console.error('Error reading report file:', error)
187
179
  }
188
180
  }
189
- });
181
+ })
190
182
  ```
191
183
 
192
184
  ### Handling Hebrew Text (Windows-1255 Encoding)
@@ -194,21 +186,21 @@ fileInput.addEventListener('change', async event => {
194
186
  Working with Hebrew text and Windows-1255 encoding:
195
187
 
196
188
  ```typescript
197
- import fs from 'fs';
198
- import { fromWindows1255, toWindows1255 } from '@accounter/shaam6111-generator';
189
+ import fs from 'fs'
190
+ import { fromWindows1255, toWindows1255 } from '@accounter/shaam6111-generator'
199
191
 
200
192
  // Convert Hebrew text to Windows-1255 encoding
201
- const hebrewText = 'חברת תוכנה בע"מ';
202
- const encoded = toWindows1255(hebrewText);
193
+ const hebrewText = 'חברת תוכנה בע"מ'
194
+ const encoded = toWindows1255(hebrewText)
203
195
 
204
196
  // Save encoded text to a file
205
- fs.writeFileSync('hebrew.dat', encoded);
197
+ fs.writeFileSync('hebrew.dat', encoded)
206
198
 
207
199
  // Read encoded text from a file
208
- const readBuffer = fs.readFileSync('hebrew.dat');
209
- const decoded = fromWindows1255(readBuffer);
200
+ const readBuffer = fs.readFileSync('hebrew.dat')
201
+ const decoded = fromWindows1255(readBuffer)
210
202
 
211
- console.log(decoded); // 'חברת תוכנה בע"מ'
203
+ console.log(decoded) // 'חברת תוכנה בע"מ'
212
204
  ```
213
205
 
214
206
  ## API Reference
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@accounter/shaam6111-generator",
3
- "version": "0.1.5-alpha-20251211104015-b8754b56e4fb5cb5ab09ff1ee8b5ea7f8fa59f2f",
3
+ "version": "0.1.5-alpha-20251211105553-850821f760a4152f9e24e7fca4d23874a887bbe3",
4
4
  "description": "Fully typed application that generates, parses, and validates SHAAM 6111 tax reports.",
5
5
  "dependencies": {
6
6
  "iconv-lite": "0.7.0",