-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html.backup
More file actions
458 lines (423 loc) · 22.1 KB
/
Copy pathindex.html.backup
File metadata and controls
458 lines (423 loc) · 22.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<title>TaxSyncQC — Estimation officielle Québec 2025</title>
<style>
body { font-family: -apple-system, BlinkMacSystemFont, sans-serif; max-width: 800px; margin: 1rem auto; padding: 0 1rem; line-height: 1.5; }
.lang-toggle { text-align: right; margin-bottom: 1rem; }
.tabs { display: flex; margin-bottom: 1rem; border-bottom: 1px solid #ccc; }
.tab-btn { padding: 0.75rem 1.5rem; background: #f0f0f0; border: none; cursor: pointer; }
.tab-btn.active { background: #1890ff; color: white; }
.tab-content { display: none; }
.tab-content.active { display: block; }
fieldset { border: 1px solid #ddd; border-radius: 6px; padding: 1rem; margin-bottom: 1.5rem; }
legend { font-weight: bold; padding: 0 0.5rem; }
.input-group { margin-bottom: 1rem; }
label { display: block; font-weight: bold; margin-bottom: 0.25rem; }
.box-label { color: #1890ff; font-family: monospace; }
.hint { font-size: 0.85rem; color: #666; margin-top: 0.25rem; }
input, select { width: 100%; padding: 0.5rem; border: 1px solid #ccc; border-radius: 4px; }
.toggle { margin: 1rem 0; }
button { background: #1890ff; color: white; padding: 0.75rem 1.5rem; border: none; border-radius: 4px; cursor: pointer; font-size: 1.1em; }
.result { background: #e6f7ff; border-left: 4px solid #1890ff; padding: 1rem; margin: 1.5rem 0; border-radius: 4px; }
.warnings { color: #fa8c16; margin-top: 1rem; }
.json-output { background: #f5f5f5; padding: 1rem; border-radius: 4px; overflow-x: auto; font-family: monospace; font-size: 0.9em; }
</style>
</head>
<body>
<div class="lang-toggle">
<button onclick="setLang('en')" id="btn-en">EN</button>
<button onclick="setLang('fr')" id="btn-fr" style="font-weight:bold">FR</button>
</div>
<h1 data-i18n="title">💰 TaxSyncQC — Estimation officielle Québec 2025</h1>
<p data-i18n="subtitle">Basé sur les documents <strong>RL-1-T(2025-10)</strong> et <strong>T4 (2025)</strong> de Revenu Québec et l'ARC.</p>
<div class="toggle">
<label>
<input type="checkbox" id="modeToggle" onchange="toggleMode()">
<span data-i18n="advancedMode">Mode avancé (tous les champs)</span>
</label>
</div>
<div class="tabs">
<button class="tab-btn active" onclick="showTab('rl1')" data-i18n="tabRL1">RL-1 (Revenu Québec)</button>
<button class="tab-btn" onclick="showTab('t4')" data-i18n="tabT4">T4 (ARC)</button>
<button class="tab-btn" onclick="showTab('both')" data-i18n="tabBoth">Les deux</button>
</div>
<!-- RL-1 Tab -->
<div id="rl1Tab" class="tab-content active">
<form id="rl1Form">
<fieldset>
<legend data-i18n="essentialRequired">✅ Essentiel (requis)</legend>
<div class="input-group">
<label><span class="box-label">Case A</span> — <span data-i18n="rl1BoxA">Revenu d'emploi (Ligne 101)</span></label>
<input type="number" id="rl1_A" step="100" placeholder="Ex: 60000">
<div class="hint" data-i18n="hintRL1BoxA">Box A — top left on RL-1</div>
</div>
<div class="input-group">
<label><span class="box-label">Case F</span> — <span data-i18n="rl1BoxF">Cotisations syndicales (Ligne 397.1)</span></label>
<input type="number" id="rl1_F" step="1" placeholder="Ex: 400">
</div>
<div class="input-group">
<label data-i18n="sinLabel">NAS</label>
<input type="text" id="rl1_sin" maxlength="11" placeholder="Ex: 123 456 789">
</div>
</fieldset>
<fieldset id="rl1Deductions" style="display:none;">
<legend data-i18n="deductions">⚠️ Déductions</legend>
<div class="input-group">
<label><span class="box-label">Case B.A</span> — <span data-i18n="rl1BoxBA">Cotisations RRQ (Ligne 98)</span></label>
<input type="number" id="rl1_BA" step="1">
</div>
<div class="input-group">
<label><span class="box-label">Case H</span> — <span data-i18n="rl1BoxH">Prime d'assurance parentale (Ligne 97)</span></label>
<input type="number" id="rl1_H" step="1">
</div>
<div class="input-group">
<label><span class="box-label">Case D</span> — <span data-i18n="rl1BoxD">Cotisations RPA (Ligne 205)</span></label>
<input type="number" id="rl1_D" step="1">
</div>
<div class="input-group">
<label><span class="box-label">Case D-1</span> — <span data-i18n="rl1BoxD1">Arrangement de retraite (Ligne 207)</span></label>
<input type="number" id="rl1_D1" step="1">
</div>
<div class="input-group">
<label><span class="box-label">Case N</span> — <span data-i18n="rl1BoxN">Dons de bienfaisance (Ligne 395)</span></label>
<input type="number" id="rl1_N" step="1">
</div>
</fieldset>
<fieldset id="rl1Benefits" style="display:none;">
<legend data-i18n="taxableBenefits">🔹 Avantages imposables (inclus dans la Case A)</legend>
<div class="input-group">
<label><span class="box-label">Case J</span> — <span data-i18n="rl1BoxJ">Régime privé de soins de santé (Ligne 381)</span></label>
<input type="number" id="rl1_J" step="1">
</div>
<div class="input-group">
<label><span class="box-label">Case K</span> — <span data-i18n="rl1BoxK">Déplacements (région éloignée) (Ligne 236)</span></label>
<input type="number" id="rl1_K" step="1">
</div>
<div class="input-group">
<label><span class="box-label">Case L</span> — <span data-i18n="rl1BoxL">Autres avantages</span></label>
<input type="number" id="rl1_L" step="1">
</div>
<div class="input-group">
<label><span class="box-label">Case M</span> — <span data-i18n="rl1BoxM">Commissions (Ligne 100)</span></label>
<input type="number" id="rl1_M" step="1">
</div>
</fieldset>
</form>
</div>
<!-- T4 Tab -->
<div id="t4Tab" class="tab-content">
<form id="t4Form">
<fieldset>
<legend data-i18n="essentialRequired">✅ Essentiel (requis)</legend>
<div class="input-group">
<label><span class="box-label">Box 14</span> — <span data-i18n="t4Box14">Revenus d'emploi (Ligne 10100)</span></label>
<input type="number" id="t4_14" step="100" placeholder="Ex: 60000">
<div class="hint" data-i18n="hintT4Box14">Box 14 — center-left on T4</div>
</div>
<div class="input-group">
<label><span class="box-label">Box 44</span> — <span data-i18n="t4Box44">Cotisations syndicales (Ligne 21200)</span></label>
<input type="number" id="t4_44" step="1" placeholder="Ex: 400">
</div>
<div class="input-group">
<label data-i18n="sinLabelT4">SIN</label>
<input type="text" id="t4_sin" maxlength="11" placeholder="Ex: 123-456-789">
</div>
</fieldset>
<fieldset id="t4Deductions" style="display:none;">
<legend data-i18n="deductions">⚠️ Déductions</legend>
<div class="input-group">
<label><span class="box-label">Box 17</span> — <span data-i18n="t4Box17">Cotisations RRQ (QC)</span> / <span class="box-label">Box 16</span> — <span data-i18n="t4Box16">RPC (autres)</span></label>
<input type="number" id="t4_17" step="1" placeholder="QC: Box 17">
<input type="number" id="t4_16" step="1" placeholder="Elsewhere: Box 16">
</div>
<div class="input-group">
<label><span class="box-label">Box 55</span> — <span data-i18n="t4Box55">RPAP (QC)</span> / <span class="box-label">Box 18</span> — <span data-i18n="t4Box18">AE</span></label>
<input type="number" id="t4_55" step="1" placeholder="QC: Box 55">
<input type="number" id="t4_18" step="1" placeholder="Elsewhere: Box 18">
</div>
<div class="input-group">
<label><span class="box-label">Box 20</span> — <span data-i18n="t4Box20">Cotisations RPA (Ligne 20700)</span></label>
<input type="number" id="t4_20" step="1">
</div>
<div class="input-group">
<label><span class="box-label">Box 52</span> — <span data-i18n="t4Box52">Facteur d'équivalence (Ligne 20600)</span></label>
<input type="number" id="t4_52" step="1">
</div>
<div class="input-group">
<label><span class="box-label">Box 46</span> — <span data-i18n="t4Box46">Dons de bienfaisance</span></label>
<input type="number" id="t4_46" step="1">
</div>
</fieldset>
<fieldset id="t4Benefits" style="display:none;">
<legend data-i18n="taxableBenefitsT4">🔹 Avantages imposables (déjà inclus dans Box 14)</legend>
<div class="input-group">
<label><span class="box-label">Boxes 30, 32, 34, 36, 38, 40</span> — <span data-i18n="t4BoxBenefits">Avantages divers (logement, auto, prêts, etc.)</span></label>
<input type="number" id="t4_benefits" step="1" placeholder="Total si connu">
</div>
</fieldset>
</form>
</div>
<!-- Both Tab -->
<div id="bothTab" class="tab-content">
<p data-i18n="bothTabDesc">Entrez les données des deux formulaires ci-dessus — utile pour les travailleurs en double statut (ex: autochtone, réserviste).</p>
</div>
<div class="input-group">
<label data-i18n="rrspContribution">Contribution RRSP ($)</label>
<input type="range" id="rrspSlider" min="0" max="31560" value="0" step="100" oninput="updateRrsp(this.value)">
<div id="rrspValue">$0</div>
</div>
<button type="button" onclick="calculate()" data-i18n="estimateButton">Estimer les crédits</button>
<div id="output"></div>
<div id="jsonOutput" class="json-output" style="display:none;"></div>
<script>
let lang = 'fr';
const translations = {
en: {
title: "💰 TaxSyncQC — Official Quebec 2025 Estimator",
subtitle: "Based on <strong>RL-1-T(2025-10)</strong> and <strong>T4 (2025)</strong> from Revenu Québec and CRA.",
advancedMode: "Advanced mode (all fields)",
tabRL1: "RL-1 (Revenu Québec)",
tabT4: "T4 (CRA)",
tabBoth: "Both",
essentialRequired: "✅ Essential (required)",
rl1BoxA: "Employment income (Line 101)",
hintRL1BoxA: "Box A — top left on RL-1",
rl1BoxF: "Union dues (Line 397.1)",
sinLabel: "SIN",
sinLabelT4: "SIN",
deductions: "⚠️ Deductions",
rl1BoxBA: "QPP contributions (Line 98)",
rl1BoxH: "Parental insurance premium (Line 97)",
rl1BoxD: "RPP contributions (Line 205)",
rl1BoxD1: "Retirement arrangement (Line 207)",
rl1BoxN: "Charitable donations (Line 395)",
taxableBenefits: "🔹 Taxable benefits (included in Box A)",
rl1BoxJ: "Private health services plan (Line 381)",
rl1BoxK: "Travel (remote area) (Line 236)",
rl1BoxL: "Other benefits",
rl1BoxM: "Commissions (Line 100)",
t4Box14: "Employment income (Line 10100)",
hintT4Box14: "Box 14 — center-left on T4",
t4Box44: "Union dues (Line 21200)",
t4Box17: "QPP contributions (QC)",
t4Box16: "CPP (other provinces)",
t4Box55: "QPIP (QC)",
t4Box18: "EI",
t4Box20: "RPP contributions (Line 20700)",
t4Box52: "Pension adjustment (Line 20600)",
t4Box46: "Charitable donations",
taxableBenefitsT4: "🔹 Taxable benefits (already included in Box 14)",
t4BoxBenefits: "Various benefits (housing, car, loans, etc.)",
bothTabDesc: "Enter data from both forms above — useful for dual-status workers (e.g., Indigenous, reservist).",
rrspContribution: "RRSP Contribution ($)",
estimateButton: "Estimate Credits",
resultTitle: "🧾 Quebec + Federal Estimate (2025)",
grossIncome: "💼 Gross income",
afterRRSP: "📉 After RRSP",
taxSavings: "💰 Tax savings",
qcSection: "🇶🇨 Quebec",
solidarityCredit: "💰 Solidarity credit",
workPremium: "👷 Work premium",
fedSection: "🇨🇦 Federal",
bpaSavings: "🛡️ BPA savings",
cwb: "💵 CWB",
totalBenefit: "🎯 Total benefit",
cashRefund: "💸 Cash refund",
warnings: "⚠️ Warnings:",
warningUnionDues: "Union dues missing — may be deductible",
warningSIN: "SIN missing — required"
},
fr: {
title: "💰 TaxSyncQC — Estimation officielle Québec 2025",
subtitle: "Basé sur les documents <strong>RL-1-T(2025-10)</strong> et <strong>T4 (2025)</strong> de Revenu Québec et l'ARC.",
advancedMode: "Mode avancé (tous les champs)",
tabRL1: "RL-1 (Revenu Québec)",
tabT4: "T4 (ARC)",
tabBoth: "Les deux",
essentialRequired: "✅ Essentiel (requis)",
rl1BoxA: "Revenu d'emploi (Ligne 101)",
hintRL1BoxA: "Case A — en haut à gauche du RL-1",
rl1BoxF: "Cotisations syndicales (Ligne 397.1)",
sinLabel: "NAS",
sinLabelT4: "NAS",
deductions: "⚠️ Déductions",
rl1BoxBA: "Cotisations RRQ (Ligne 98)",
rl1BoxH: "Prime d'assurance parentale (Ligne 97)",
rl1BoxD: "Cotisations RPA (Ligne 205)",
rl1BoxD1: "Arrangement de retraite (Ligne 207)",
rl1BoxN: "Dons de bienfaisance (Ligne 395)",
taxableBenefits: "🔹 Avantages imposables (inclus dans la Case A)",
rl1BoxJ: "Régime privé de soins de santé (Ligne 381)",
rl1BoxK: "Déplacements (région éloignée) (Ligne 236)",
rl1BoxL: "Autres avantages",
rl1BoxM: "Commissions (Ligne 100)",
t4Box14: "Revenus d'emploi (Ligne 10100)",
hintT4Box14: "Case 14 — au centre gauche du T4",
t4Box44: "Cotisations syndicales (Ligne 21200)",
t4Box17: "Cotisations RRQ (QC)",
t4Box16: "RPC (autres provinces)",
t4Box55: "RPAP (QC)",
t4Box18: "AE",
t4Box20: "Cotisations RPA (Ligne 20700)",
t4Box52: "Facteur d'équivalence (Ligne 20600)",
t4Box46: "Dons de bienfaisance",
taxableBenefitsT4: "🔹 Avantages imposables (déjà inclus dans Case 14)",
t4BoxBenefits: "Avantages divers (logement, auto, prêts, etc.)",
bothTabDesc: "Entrez les données des deux formulaires ci-dessus — utile pour les travailleurs en double statut (ex: autochtone, réserviste).",
rrspContribution: "Contribution RRSP ($)",
estimateButton: "Estimer les crédits",
resultTitle: "🧾 Estimation Québec + Fédéral (2025)",
grossIncome: "💼 Revenu brut",
afterRRSP: "📉 Après RRSP",
taxSavings: "💰 Économie d'impôt",
qcSection: "🇶🇨 Québec",
solidarityCredit: "💰 Crédit solidarité",
workPremium: "👷 Prime au travail",
fedSection: "🇨🇦 Fédéral",
bpaSavings: "🛡️ Économies BPA",
cwb: "💵 PTE",
totalBenefit: "🎯 Avantage total",
cashRefund: "💸 Remboursement",
warnings: "⚠️ Avertissements :",
warningUnionDues: "Cotisations syndicales manquantes — peuvent être déductibles",
warningSIN: "NAS manquant — obligatoire"
}
};
const _ = (key) => translations[lang][key] || key;
function setLang(l) {
lang = l;
document.getElementById('btn-en').style.fontWeight = l === 'en' ? 'bold' : 'normal';
document.getElementById('btn-fr').style.fontWeight = l === 'fr' ? 'bold' : 'normal';
document.documentElement.lang = l;
document.title = _('title').replace(/<[^>]*>/g, '');
// Update all elements with data-i18n attribute
document.querySelectorAll('[data-i18n]').forEach(el => {
const key = el.getAttribute('data-i18n');
el.innerHTML = _(key);
});
}
function toggleMode() {
const advanced = document.getElementById('modeToggle').checked;
['rl1Deductions', 'rl1Benefits', 't4Deductions', 't4Benefits'].forEach(id => {
document.getElementById(id).style.display = advanced ? 'block' : 'none';
});
document.getElementById('jsonOutput').style.display = advanced ? 'block' : 'none';
}
function showTab(tabId) {
['rl1Tab', 't4Tab', 'bothTab'].forEach(id => {
document.getElementById(id).classList.toggle('active', id === tabId + 'Tab');
});
document.querySelectorAll('.tab-btn').forEach(btn => btn.classList.remove('active'));
event.target.classList.add('active');
}
function updateRrsp(val) {
document.getElementById('rrspValue').textContent = `$${parseInt(val).toLocaleString()}`;
}
function getFormData() {
const isRL1 = document.getElementById('rl1Tab').classList.contains('active');
const form = isRL1 ? 'rl1' : 't4';
const data = {
source: isRL1 ? 'RL-1' : 'T4',
rl1: { A: null, F: null, sin: null },
t4: { '14': null, '44': null, sin: null }
};
if (isRL1) {
data.rl1.A = parseFloat(document.getElementById('rl1_A').value) || 0;
data.rl1.F = parseFloat(document.getElementById('rl1_F').value) || null;
data.rl1.sin = document.getElementById('rl1_sin').value;
if (document.getElementById('modeToggle').checked) {
data.rl1['B.A'] = parseFloat(document.getElementById('rl1_BA').value) || null;
data.rl1.H = parseFloat(document.getElementById('rl1_H').value) || null;
data.rl1.D = parseFloat(document.getElementById('rl1_D').value) || null;
data.rl1['D-1'] = parseFloat(document.getElementById('rl1_D1').value) || null;
data.rl1.N = parseFloat(document.getElementById('rl1_N').value) || null;
data.rl1.J = parseFloat(document.getElementById('rl1_J').value) || null;
data.rl1.K = parseFloat(document.getElementById('rl1_K').value) || null;
data.rl1.L = parseFloat(document.getElementById('rl1_L').value) || null;
data.rl1.M = parseFloat(document.getElementById('rl1_M').value) || null;
}
} else {
data.t4['14'] = parseFloat(document.getElementById('t4_14').value) || 0;
data.t4['44'] = parseFloat(document.getElementById('t4_44').value) || null;
data.t4.sin = document.getElementById('t4_sin').value;
if (document.getElementById('modeToggle').checked) {
data.t4['17'] = parseFloat(document.getElementById('t4_17').value) || null;
data.t4['16'] = parseFloat(document.getElementById('t4_16').value) || null;
data.t4['55'] = parseFloat(document.getElementById('t4_55').value) || null;
data.t4['18'] = parseFloat(document.getElementById('t4_18').value) || null;
data.t4['20'] = parseFloat(document.getElementById('t4_20').value) || null;
data.t4['52'] = parseFloat(document.getElementById('t4_52').value) || null;
data.t4['46'] = parseFloat(document.getElementById('t4_46').value) || null;
data.t4.benefits = parseFloat(document.getElementById('t4_benefits').value) || null;
}
}
return data;
}
function calculate() {
const data = getFormData();
const income = data.source === 'RL-1' ? data.rl1.A : data.t4['14'];
const unionDues = data.source === 'RL-1' ? data.rl1.F : data.t4['44'];
const sin = data.source === 'RL-1' ? data.rl1.sin : data.t4.sin;
const rrsp = parseFloat(document.getElementById('rrspSlider').value) || 0;
const effectiveIncome = Math.max(0, income - rrsp);
// Québec credits
const solidarity = effectiveIncome <= 57965 ? 531 : Math.max(0, 531 * (1 - (effectiveIncome - 57965) / 6160));
const workPremium = effectiveIncome < 7200 ? 0 : Math.min(728, Math.min(effectiveIncome - 7200, 33100) * 0.26);
// Federal credits
const cwb = effectiveIncome <= 25539 ? Math.min(effectiveIncome * 0.27, 1519) :
effectiveIncome <= 35539 ? Math.max(0, 1519 - (effectiveIncome - 25539) * 0.15) : 0;
const bpa = Math.max(0, 15705 - Math.max(0, effectiveIncome - 165430) * 15705 / 70000);
const bpaSavings = bpa * 0.15;
// RRSP tax saved
const marginalRate = income <= 51268 ? 0.2885 : income <= 57965 ? 0.3325 : 0.3885;
const taxSaved = rrsp * marginalRate;
const qcTotal = solidarity + workPremium;
const fedTotal = bpaSavings + cwb;
const totalBenefit = qcTotal + fedTotal + taxSaved;
const cashBack = workPremium + cwb;
let html = `<div class="result">
<h3>${_('resultTitle')}</h3>
<p><strong>${_('grossIncome')}: $${income.toLocaleString()}</strong></p>
${rrsp > 0 ? `<p>${_('afterRRSP')} ($${rrsp.toLocaleString()}): $${effectiveIncome.toLocaleString()}</p>` : ''}
${rrsp > 0 ? `<p>${_('taxSavings')}: $${taxSaved.toFixed(2)}</p>` : ''}
<h4>${_('qcSection')}</h4>
<p>${_('solidarityCredit')}: $${solidarity.toFixed(2)}</p>
<p>${_('workPremium')}: $${workPremium.toFixed(2)}</p>
<h4>${_('fedSection')}</h4>
<p>${_('bpaSavings')}: $${bpaSavings.toFixed(2)}</p>
<p>${_('cwb')}: $${cwb.toFixed(2)}</p>
<hr>
<p><strong>${_('totalBenefit')}: $${totalBenefit.toFixed(2)}</strong></p>
<p style="font-size: 1.2em; color: #1890ff;"><strong>${_('cashRefund')}: $${cashBack.toFixed(2)}</strong></p>
</div>`;
const warnings = [];
if (unionDues === null) warnings.push(_('warningUnionDues'));
if (!sin || !/\d{9}/.test(sin.replace(/\D/g, ''))) warnings.push(_('warningSIN'));
if (warnings.length > 0) {
html += `<div class="warnings"><strong>${_('warnings')}</strong><ul>`;
warnings.forEach(w => html += `<li>${w}</li>`);
html += '</ul></div>';
}
document.getElementById('output').innerHTML = html;
// Show structured JSON for automation
if (document.getElementById('modeToggle').checked) {
const exportData = {
...data,
analysis: {
effectiveIncome,
qcCredits: { solidarity, workPremium },
fedCredits: { bpaSavings, cwb },
rrspImpact: { contribution: rrsp, taxSaved }
}
};
document.getElementById('jsonOutput').textContent = JSON.stringify(exportData, null, 2);
}
}
// Init
setLang('fr');
</script>
</body>
</html>