@classytic/ca-tax 0.0.17 → 0.0.19
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.
- package/CHANGELOG.md +182 -0
- package/dist/forms/index.d.mts +2 -2
- package/dist/forms/index.mjs +2 -2
- package/dist/forms.mjs +746 -1356
- package/dist/index.d.mts +132 -20
- package/dist/index.mjs +3 -3
- package/dist/index3.d.mts +187 -1198
- package/dist/index4.d.mts +3 -3
- package/dist/t2/index.d.mts +3 -3
- package/dist/t2/index.mjs +3 -3
- package/dist/t2.mjs +213 -839
- package/package.json +4 -2
package/dist/t2.mjs
CHANGED
|
@@ -251,11 +251,6 @@ const AT1_SCHEDULES_WITH_BUILDERS = Object.freeze([
|
|
|
251
251
|
"002",
|
|
252
252
|
"003",
|
|
253
253
|
"004",
|
|
254
|
-
"005",
|
|
255
|
-
"006",
|
|
256
|
-
"007",
|
|
257
|
-
"008",
|
|
258
|
-
"009",
|
|
259
254
|
"010",
|
|
260
255
|
"012",
|
|
261
256
|
"013",
|
|
@@ -424,14 +419,16 @@ function schedule18Values(result) {
|
|
|
424
419
|
put("076", result.taxableCapitalGain);
|
|
425
420
|
result.abil.forEach((entry, i) => {
|
|
426
421
|
const n = i + 1;
|
|
427
|
-
values.push({
|
|
428
|
-
lineItemId: at1LineItemId("018",
|
|
429
|
-
value
|
|
430
|
-
});
|
|
431
|
-
values.push({
|
|
432
|
-
lineItemId: at1LineItemId("018", "084", n),
|
|
433
|
-
value: entry.kind === "shares" ? 1 : 2
|
|
422
|
+
const row = (fieldId, value) => values.push({
|
|
423
|
+
lineItemId: at1LineItemId("018", fieldId, n),
|
|
424
|
+
value
|
|
434
425
|
});
|
|
426
|
+
row("082", entry.name);
|
|
427
|
+
row("084", entry.kind === "shares" ? 1 : 2);
|
|
428
|
+
if (entry.dateOfAcquisition) row("086", entry.dateOfAcquisition);
|
|
429
|
+
row("088", entry.proceeds);
|
|
430
|
+
row("090", entry.acb);
|
|
431
|
+
row("092", entry.outlays);
|
|
435
432
|
});
|
|
436
433
|
put("094", result.allowableBusinessInvestmentLoss);
|
|
437
434
|
return {
|
|
@@ -679,6 +676,10 @@ function schedule12Values(input) {
|
|
|
679
676
|
pair("032", "033", input.cogpe);
|
|
680
677
|
pair("036", "037", input.reservesDeductedPriorYear);
|
|
681
678
|
pair("038", "039", input.reservesClaimedCurrentYear);
|
|
679
|
+
if (input.other && input.other.alberta !== input.other.federal) {
|
|
680
|
+
pair("040", "041", input.other);
|
|
681
|
+
if (input.other.explanation) put("048", input.other.explanation);
|
|
682
|
+
}
|
|
682
683
|
const alwaysPair = (albertaField, federalField, p) => {
|
|
683
684
|
if (!p) return;
|
|
684
685
|
put(albertaField, p.alberta);
|
|
@@ -693,7 +694,99 @@ function schedule12Values(input) {
|
|
|
693
694
|
alwaysPair("056", "057", input.donations?.charitable);
|
|
694
695
|
alwaysPair("058", "059", input.donations?.gifts);
|
|
695
696
|
alwaysPair("130", "131", input.restrictedInterestAndFinancing);
|
|
697
|
+
alwaysPair("060", "061", input.taxableDividendsDeductible);
|
|
698
|
+
alwaysPair("062", "063", input.partVI1Deduction);
|
|
699
|
+
alwaysPair("074", "075", input.centralCreditUnion);
|
|
700
|
+
alwaysPair("078", "079", input.prospectorsShares);
|
|
701
|
+
alwaysPair("140", "141", input.nonQualifiedSecurities);
|
|
702
|
+
alwaysPair("082", "083", input.section110_5Additions);
|
|
696
703
|
put("054", input.albertaNetIncomeForTax);
|
|
704
|
+
const filed = /* @__PURE__ */ new Map();
|
|
705
|
+
for (const v of values) if (typeof v.value === "number") filed.set(v.lineItemId.slice(3, 6), v.value);
|
|
706
|
+
const n = (field) => filed.get(field) ?? 0;
|
|
707
|
+
const sum = (fields) => fields.reduce((t, f) => t + n(f), 0);
|
|
708
|
+
put("050", sum([
|
|
709
|
+
"007",
|
|
710
|
+
"013",
|
|
711
|
+
"015",
|
|
712
|
+
"019",
|
|
713
|
+
"037",
|
|
714
|
+
"041"
|
|
715
|
+
]) - sum([
|
|
716
|
+
"005",
|
|
717
|
+
"009",
|
|
718
|
+
"011",
|
|
719
|
+
"017",
|
|
720
|
+
"021",
|
|
721
|
+
"023",
|
|
722
|
+
"027",
|
|
723
|
+
"029",
|
|
724
|
+
"031",
|
|
725
|
+
"033",
|
|
726
|
+
"039"
|
|
727
|
+
]));
|
|
728
|
+
/**
|
|
729
|
+
* 090 / 091 — taxable income, Alberta and federal. Both mandatory, and
|
|
730
|
+
* neither was filed; 090 is also what AT1 page 2 line 062 is taken from
|
|
731
|
+
* ("Enter this amount on AT1 page 2, line 062"), so its absence left the
|
|
732
|
+
* jacket's own taxable income undisclosed on the schedule that derives it.
|
|
733
|
+
*
|
|
734
|
+
* The printed form numbers the two Area B subtotals 080 (Alberta) and 081
|
|
735
|
+
* (federal) and strikes:
|
|
736
|
+
*
|
|
737
|
+
* 090 = 054 − 080 + 082 091 = 002 − 081 + 083
|
|
738
|
+
*
|
|
739
|
+
* with the qualification, printed under each: "If there is an amount at line
|
|
740
|
+
* 082 and line 054 − line 080 is negative, then line 090 must equal line
|
|
741
|
+
* 082" (and the same for 083/081/091). That is not rounding defensiveness —
|
|
742
|
+
* a corporation whose deductions exhaust its income reports its ITA s.110.5
|
|
743
|
+
* additions as the figure, not a negative.
|
|
744
|
+
*
|
|
745
|
+
* 080 and 081 are NOT transmitted — they carry no line-number marker on the
|
|
746
|
+
* page, and §3.2.3.13 defines no row for either, expanding both inline
|
|
747
|
+
* instead. So they are summed here rather than emitted, exactly as 052 is on
|
|
748
|
+
* page 1. The members below are the spec's own expansion, which matches the
|
|
749
|
+
* Alberta and federal deduction columns of Area B row for row.
|
|
750
|
+
*/
|
|
751
|
+
const AREA_B_ALBERTA = [
|
|
752
|
+
"056",
|
|
753
|
+
"058",
|
|
754
|
+
"060",
|
|
755
|
+
"062",
|
|
756
|
+
"064",
|
|
757
|
+
"066",
|
|
758
|
+
"068",
|
|
759
|
+
"070",
|
|
760
|
+
"072",
|
|
761
|
+
"074",
|
|
762
|
+
"078",
|
|
763
|
+
"130",
|
|
764
|
+
"140"
|
|
765
|
+
];
|
|
766
|
+
const AREA_B_FEDERAL = [
|
|
767
|
+
"057",
|
|
768
|
+
"059",
|
|
769
|
+
"061",
|
|
770
|
+
"063",
|
|
771
|
+
"065",
|
|
772
|
+
"067",
|
|
773
|
+
"069",
|
|
774
|
+
"071",
|
|
775
|
+
"073",
|
|
776
|
+
"075",
|
|
777
|
+
"079",
|
|
778
|
+
"131",
|
|
779
|
+
"141"
|
|
780
|
+
];
|
|
781
|
+
/**
|
|
782
|
+
* The formula, applied to the lines this builder emitted. Used only when the
|
|
783
|
+
* caller did not supply the real figure — see `taxableIncome` on the input
|
|
784
|
+
* for why supplying it matters: this sum is only as complete as the deduction
|
|
785
|
+
* lines actually modelled, and a missing one overstates the result.
|
|
786
|
+
*/
|
|
787
|
+
const derive = (income, deductions, additions) => income - deductions < 0 && additions > 0 ? additions : income - deductions + additions;
|
|
788
|
+
put("090", input.taxableIncome?.alberta ?? derive(n("054"), sum(AREA_B_ALBERTA), n("082")));
|
|
789
|
+
put("091", input.taxableIncome?.federal ?? derive(n("002"), sum(AREA_B_FEDERAL), n("083")));
|
|
697
790
|
return {
|
|
698
791
|
scheduleId: "012",
|
|
699
792
|
values
|
|
@@ -924,13 +1017,20 @@ function schedule10Values(input) {
|
|
|
924
1017
|
put("040", input.otherLoss.result.remainingLoss);
|
|
925
1018
|
}
|
|
926
1019
|
if (input.capital) {
|
|
927
|
-
const rate = input.inclusionRate ?? .5;
|
|
928
1020
|
put("042", input.capital.currentYearLoss);
|
|
929
|
-
|
|
1021
|
+
const rateFields = [
|
|
1022
|
+
"043",
|
|
1023
|
+
"045",
|
|
1024
|
+
"047"
|
|
1025
|
+
];
|
|
1026
|
+
const grossFields = [
|
|
930
1027
|
"044",
|
|
931
1028
|
"046",
|
|
932
1029
|
"048"
|
|
933
|
-
]
|
|
1030
|
+
];
|
|
1031
|
+
for (const [f, c] of zip(rateFields, input.capital.carrybacks)) put(f, (c.inclusionRate ?? input.inclusionRate ?? .5).toFixed(6));
|
|
1032
|
+
for (const [f, c] of zip(grossFields, input.capital.carrybacks)) put(f, c.amount);
|
|
1033
|
+
put("050", input.capital.remainingLoss);
|
|
934
1034
|
}
|
|
935
1035
|
return {
|
|
936
1036
|
scheduleId: "010",
|
|
@@ -1056,16 +1156,16 @@ function schedule16Values(result) {
|
|
|
1056
1156
|
}
|
|
1057
1157
|
//#endregion
|
|
1058
1158
|
//#region src/t2/at1/schedules/at4970-ieg-projects.ts
|
|
1059
|
-
const nn$
|
|
1159
|
+
const nn$31 = (v) => Math.max(0, Math.round(v ?? 0));
|
|
1060
1160
|
function computeAt4970(input) {
|
|
1061
1161
|
const projects = input.projects.map((p) => ({
|
|
1062
1162
|
title: p.title,
|
|
1063
1163
|
...p.projectCode !== void 0 ? { projectCode: p.projectCode } : {},
|
|
1064
|
-
albertaPortion: nn$
|
|
1065
|
-
otherPortion: nn$
|
|
1066
|
-
salariesAndWages: nn$
|
|
1067
|
-
federalProxyAmount: nn$
|
|
1068
|
-
albertaProxyAmount: nn$
|
|
1164
|
+
albertaPortion: nn$31(p.albertaPortion),
|
|
1165
|
+
otherPortion: nn$31(p.otherPortion),
|
|
1166
|
+
salariesAndWages: nn$31(p.salariesAndWages),
|
|
1167
|
+
federalProxyAmount: nn$31(p.federalProxyAmount),
|
|
1168
|
+
albertaProxyAmount: nn$31(p.albertaProxyAmount)
|
|
1069
1169
|
}));
|
|
1070
1170
|
const totals = {
|
|
1071
1171
|
albertaPortion: projects.reduce((s, p) => s + p.albertaPortion, 0),
|
|
@@ -1076,7 +1176,7 @@ function computeAt4970(input) {
|
|
|
1076
1176
|
};
|
|
1077
1177
|
const jurisdictions = (input.jurisdictions ?? []).map((j) => ({
|
|
1078
1178
|
jurisdiction: j.jurisdiction,
|
|
1079
|
-
amountIncurred: nn$
|
|
1179
|
+
amountIncurred: nn$31(j.amountIncurred)
|
|
1080
1180
|
}));
|
|
1081
1181
|
return {
|
|
1082
1182
|
projects,
|
|
@@ -1192,15 +1292,15 @@ function computeAllocationFactor(input) {
|
|
|
1192
1292
|
*
|
|
1193
1293
|
* Whole dollars, pure.
|
|
1194
1294
|
*/
|
|
1195
|
-
const nn$
|
|
1295
|
+
const nn$30 = (v) => Math.max(0, Math.round(v ?? 0));
|
|
1196
1296
|
const raw = (v) => Math.round(v ?? 0);
|
|
1197
1297
|
function computeItc(input, roomCap, issues) {
|
|
1198
|
-
const certificatesIssued = nn$
|
|
1199
|
-
const carryforwardFromPriorYear = nn$
|
|
1200
|
-
const expired = nn$
|
|
1298
|
+
const certificatesIssued = nn$30(input.certificatesIssued);
|
|
1299
|
+
const carryforwardFromPriorYear = nn$30(input.carryforwardFromPriorYear);
|
|
1300
|
+
const expired = nn$30(input.expired);
|
|
1201
1301
|
const availableBeforeClaim = certificatesIssued + carryforwardFromPriorYear;
|
|
1202
1302
|
const cap = Math.min(availableBeforeClaim, roomCap);
|
|
1203
|
-
const wanted = input.amountApplied != null ? nn$
|
|
1303
|
+
const wanted = input.amountApplied != null ? nn$30(input.amountApplied) : cap;
|
|
1204
1304
|
const amountApplied = Math.max(0, Math.min(wanted, cap));
|
|
1205
1305
|
const carryforwardToNextYear = availableBeforeClaim - amountApplied - expired;
|
|
1206
1306
|
if (carryforwardToNextYear < 0) issues.push(`Alberta Schedule 3 (ITC): expired (${expired}) plus the amount applied (${amountApplied}) exceed the available pool (${availableBeforeClaim}) by ${-carryforwardToNextYear}. Check the 100/102/104/106 inputs.`);
|
|
@@ -1214,17 +1314,17 @@ function computeItc(input, roomCap, issues) {
|
|
|
1214
1314
|
};
|
|
1215
1315
|
}
|
|
1216
1316
|
function computeCitc(input, roomCap, itcApplied, itcCarryforwardRemaining, issues) {
|
|
1217
|
-
const certificatesIssued = nn$
|
|
1218
|
-
const carryforwardFromPriorYear = nn$
|
|
1219
|
-
const expired = nn$
|
|
1317
|
+
const certificatesIssued = nn$30(input.certificatesIssued);
|
|
1318
|
+
const carryforwardFromPriorYear = nn$30(input.carryforwardFromPriorYear);
|
|
1319
|
+
const expired = nn$30(input.expired);
|
|
1220
1320
|
const availableBeforeClaim = certificatesIssued + carryforwardFromPriorYear;
|
|
1221
1321
|
let amountApplied;
|
|
1222
1322
|
if (itcCarryforwardRemaining > 0) {
|
|
1223
1323
|
amountApplied = 0;
|
|
1224
|
-
if (input.amountApplied != null && nn$
|
|
1324
|
+
if (input.amountApplied != null && nn$30(input.amountApplied) > 0) issues.push(`Alberta Schedule 3 (CITC): a claim of ${nn$30(input.amountApplied)} was requested, but the Investor Tax Credit still has an unused carryforward balance (${itcCarryforwardRemaining}) after this year's application, so line 204 must be nil until ITC is fully drawn down.`);
|
|
1225
1325
|
} else {
|
|
1226
1326
|
const cap = Math.min(availableBeforeClaim, Math.max(0, roomCap - itcApplied));
|
|
1227
|
-
const wanted = input.amountApplied != null ? nn$
|
|
1327
|
+
const wanted = input.amountApplied != null ? nn$30(input.amountApplied) : cap;
|
|
1228
1328
|
amountApplied = Math.max(0, Math.min(wanted, cap));
|
|
1229
1329
|
}
|
|
1230
1330
|
const carryforwardToNextYear = availableBeforeClaim - amountApplied - expired;
|
|
@@ -1243,18 +1343,18 @@ function computeApitc(input, roomCap, issues) {
|
|
|
1243
1343
|
const first = input.firstPreceding ?? {};
|
|
1244
1344
|
const second = input.secondPreceding ?? {};
|
|
1245
1345
|
const thirdToTenth = input.thirdToTenthPreceding ?? {};
|
|
1246
|
-
const currentAvailable = nn$
|
|
1247
|
-
const firstAvailable = nn$
|
|
1248
|
-
const secondAvailable = nn$
|
|
1249
|
-
const thirdToTenthAvailable = nn$
|
|
1346
|
+
const currentAvailable = nn$30(current.received);
|
|
1347
|
+
const firstAvailable = nn$30(first.availableAtBeginning);
|
|
1348
|
+
const secondAvailable = nn$30(second.availableAtBeginning);
|
|
1349
|
+
const thirdToTenthAvailable = nn$30(thirdToTenth.availableAtBeginning);
|
|
1250
1350
|
const currentCap = Math.round(currentAvailable * .2);
|
|
1251
1351
|
const firstCap = Math.round(firstAvailable * .3);
|
|
1252
1352
|
const secondCap = Math.round(secondAvailable * .5);
|
|
1253
1353
|
const thirdToTenthCap = thirdToTenthAvailable;
|
|
1254
|
-
const currentAsk = Math.min(current.amountApplied != null ? nn$
|
|
1255
|
-
const firstAsk = Math.min(first.amountApplied != null ? nn$
|
|
1256
|
-
const secondAsk = Math.min(second.amountApplied != null ? nn$
|
|
1257
|
-
const thirdToTenthAsk = Math.min(thirdToTenth.amountApplied != null ? nn$
|
|
1354
|
+
const currentAsk = Math.min(current.amountApplied != null ? nn$30(current.amountApplied) : currentCap, currentCap);
|
|
1355
|
+
const firstAsk = Math.min(first.amountApplied != null ? nn$30(first.amountApplied) : firstCap, firstCap);
|
|
1356
|
+
const secondAsk = Math.min(second.amountApplied != null ? nn$30(second.amountApplied) : secondCap, secondCap);
|
|
1357
|
+
const thirdToTenthAsk = Math.min(thirdToTenth.amountApplied != null ? nn$30(thirdToTenth.amountApplied) : thirdToTenthCap, thirdToTenthCap);
|
|
1258
1358
|
const totalRequested = currentAsk + firstAsk + secondAsk + thirdToTenthAsk;
|
|
1259
1359
|
let room = Math.max(0, roomCap);
|
|
1260
1360
|
const allocate = (ask) => {
|
|
@@ -1270,7 +1370,7 @@ function computeApitc(input, roomCap, issues) {
|
|
|
1270
1370
|
if (totalApplied < totalRequested) issues.push(`Alberta Schedule 3 (APITC): the shared Maximum Allowable Deduction room (${roomCap}) was insufficient to cover ${totalRequested} requested across vintages; ${totalRequested - totalApplied} went unapplied. Allocation prioritized the oldest vintage first (closest to the 10-year expiry) — the spec states only the combined ceiling on 312, not an application order across 304/306/308/310. Supply amountApplied on each vintage directly for exact filing parity.`);
|
|
1271
1371
|
const totalReceived = currentAvailable;
|
|
1272
1372
|
const carryforwardFromPriorYear = firstAvailable + secondAvailable + thirdToTenthAvailable;
|
|
1273
|
-
const expired = nn$
|
|
1373
|
+
const expired = nn$30(input.expiredThisYear);
|
|
1274
1374
|
const availableForCarryforward = totalReceived + carryforwardFromPriorYear - totalApplied - expired;
|
|
1275
1375
|
if (availableForCarryforward < 0) issues.push(`Alberta Schedule 3 (APITC): applied (${totalApplied}) plus expired (${expired}) exceed the available pool (${totalReceived + carryforwardFromPriorYear}) by ${-availableForCarryforward}. Check the 300/302/312/314 inputs.`);
|
|
1276
1376
|
return {
|
|
@@ -1304,11 +1404,11 @@ function computeApitc(input, roomCap, issues) {
|
|
|
1304
1404
|
function computeSchedule3(input) {
|
|
1305
1405
|
const issues = [];
|
|
1306
1406
|
const mad = input.mad ?? {};
|
|
1307
|
-
const line068 = nn$
|
|
1308
|
-
const line070 = nn$
|
|
1309
|
-
const line071 = nn$
|
|
1310
|
-
const line072 = nn$
|
|
1311
|
-
const line074 = nn$
|
|
1407
|
+
const line068 = nn$30(mad.taxPayableBeforeDeduction);
|
|
1408
|
+
const line070 = nn$30(mad.line070);
|
|
1409
|
+
const line071 = nn$30(mad.line071);
|
|
1410
|
+
const line072 = nn$30(mad.line072);
|
|
1411
|
+
const line074 = nn$30(mad.line074);
|
|
1312
1412
|
const room602 = raw(line068) - (line070 + line071 + line072 + line074);
|
|
1313
1413
|
const itcCitcCap = Math.max(0, room602);
|
|
1314
1414
|
const itc = computeItc(input.itc ?? {}, itcCitcCap, issues);
|
|
@@ -1374,26 +1474,26 @@ function schedule3Values(result) {
|
|
|
1374
1474
|
}
|
|
1375
1475
|
//#endregion
|
|
1376
1476
|
//#region src/t2/at1/schedules/schedule4-foreign-investment-tax-credit.ts
|
|
1377
|
-
const nn$
|
|
1477
|
+
const nn$29 = (v) => Math.max(0, v ?? 0);
|
|
1378
1478
|
/** Round to 3 decimal places, half-up — the precision the spec directs for D and G. */
|
|
1379
1479
|
function round3(v) {
|
|
1380
1480
|
return Math.round((v + Number.EPSILON) * 1e3) / 1e3;
|
|
1381
1481
|
}
|
|
1382
1482
|
function computeSchedule4(input) {
|
|
1383
1483
|
const issues = [];
|
|
1384
|
-
const albertaTaxableIncome = nn$
|
|
1385
|
-
const royaltyTaxDeduction = nn$
|
|
1484
|
+
const albertaTaxableIncome = nn$29(input.albertaTaxableIncome);
|
|
1485
|
+
const royaltyTaxDeduction = nn$29(input.royaltyTaxDeduction);
|
|
1386
1486
|
const allocationFactor = input.allocationFactor ?? 0;
|
|
1387
|
-
const basicAlbertaTax = nn$
|
|
1487
|
+
const basicAlbertaTax = nn$29(input.basicAlbertaTax);
|
|
1388
1488
|
const denominator = (albertaTaxableIncome - royaltyTaxDeduction) * allocationFactor;
|
|
1389
1489
|
const countries = input.countries.map((c) => {
|
|
1390
1490
|
if (!c.country) issues.push("Alberta Schedule 4: a country code is required for each occurrence (004002).");
|
|
1391
|
-
const netForeignInvestmentIncome = nn$
|
|
1392
|
-
const fedForeignTaxPaid = nn$
|
|
1393
|
-
const fedIta2012Deduction = nn$
|
|
1491
|
+
const netForeignInvestmentIncome = nn$29(c.netForeignInvestmentIncome);
|
|
1492
|
+
const fedForeignTaxPaid = nn$29(c.fedForeignTaxPaid);
|
|
1493
|
+
const fedIta2012Deduction = nn$29(c.fedIta2012Deduction);
|
|
1394
1494
|
const albertaDeduction = Math.max(c.albertaActa82Deduction ?? fedIta2012Deduction, fedIta2012Deduction);
|
|
1395
1495
|
const taxPaidNetOfDeduction = Math.max(0, fedForeignTaxPaid - albertaDeduction);
|
|
1396
|
-
const federalNonBusinessForeignTaxCredit = nn$
|
|
1496
|
+
const federalNonBusinessForeignTaxCredit = nn$29(c.fedNonBusinessForeignTaxCredit);
|
|
1397
1497
|
let incomeProrationAmount;
|
|
1398
1498
|
if (denominator === 0) {
|
|
1399
1499
|
incomeProrationAmount = 0;
|
|
@@ -1449,765 +1549,6 @@ function schedule4Values(result) {
|
|
|
1449
1549
|
};
|
|
1450
1550
|
}
|
|
1451
1551
|
//#endregion
|
|
1452
|
-
//#region src/t2/at1/schedules/schedule5-royalty-tax-deduction.ts
|
|
1453
|
-
const nn$33 = (v) => Math.max(0, Math.round(v ?? 0));
|
|
1454
|
-
const num$2 = (v) => Math.round(v ?? 0);
|
|
1455
|
-
function processSuccessoredPool(entries, label, issues) {
|
|
1456
|
-
return (entries ?? []).map((e, i) => {
|
|
1457
|
-
const hasBrought = e.poolBroughtForward !== void 0;
|
|
1458
|
-
const hasAcquired = e.acquisitionAmount !== void 0;
|
|
1459
|
-
if (hasBrought && hasAcquired) issues.push(`Alberta Schedule 5: ${label} occurrence ${i + 1} (${e.vendorName}) has both a pool-brought-forward and an acquisition amount; the spec allows only one per occurrence. Using poolBroughtForward and ignoring acquisitionAmount.`);
|
|
1460
|
-
else if (!hasBrought && !hasAcquired) issues.push(`Alberta Schedule 5: ${label} occurrence ${i + 1} (${e.vendorName}) has neither a pool-brought-forward nor an acquisition amount; treating the pool base as zero.`);
|
|
1461
|
-
const base = nn$33(hasBrought ? e.poolBroughtForward : e.acquisitionAmount);
|
|
1462
|
-
const baseKind = hasBrought ? "broughtForward" : hasAcquired ? "acquired" : "unspecified";
|
|
1463
|
-
const propertyIncome = nn$33(e.propertyIncome);
|
|
1464
|
-
const claim = Math.min(base, propertyIncome);
|
|
1465
|
-
return {
|
|
1466
|
-
vendorName: e.vendorName,
|
|
1467
|
-
dateOfEvent: e.dateOfEvent,
|
|
1468
|
-
base,
|
|
1469
|
-
baseKind,
|
|
1470
|
-
propertyIncome,
|
|
1471
|
-
claim,
|
|
1472
|
-
carryForwardBeforeTransfer: base - claim
|
|
1473
|
-
};
|
|
1474
|
-
});
|
|
1475
|
-
}
|
|
1476
|
-
function computeAlbertaSchedule5(input) {
|
|
1477
|
-
const issues = [];
|
|
1478
|
-
const crownCharges = nn$33(input.crownChargesNetOfReimbursements);
|
|
1479
|
-
const resourceAllowance = nn$33(input.albertaResourceAllowance ?? input.federalResourceAllowance);
|
|
1480
|
-
const reimbursements = nn$33(input.reimbursementsForCrownCharges);
|
|
1481
|
-
const predecessorTransfersTotal = (input.predecessorTransfers ?? []).reduce((s, t) => s + nn$33(t.amountTransferred), 0);
|
|
1482
|
-
const attributedRoyaltyIncomeCarryForwardIn = nn$33(input.openingUnsuccessoredPoolBalance) + predecessorTransfersTotal;
|
|
1483
|
-
const unsuccessoredPoolAvailable = crownCharges - resourceAllowance - reimbursements + attributedRoyaltyIncomeCarryForwardIn;
|
|
1484
|
-
const hasSuccessoredPools = input.hasSuccessoredPools ?? false;
|
|
1485
|
-
if (!hasSuccessoredPools && ((input.secondSuccessoredPools?.length ?? 0) > 0 || (input.firstSuccessoredPools?.length ?? 0) > 0)) issues.push("Alberta Schedule 5: hasSuccessoredPools (005200) is false, but successored pool occurrences were supplied. Per the spec, 005101-005140 must not exist when 005200 = 2 (No); the supplied occurrences were ignored.");
|
|
1486
|
-
const secondSuccessoredPools = hasSuccessoredPools ? processSuccessoredPool(input.secondSuccessoredPools, "second successored (SSPI)", issues) : [];
|
|
1487
|
-
const firstSuccessoredPools = hasSuccessoredPools ? processSuccessoredPool(input.firstSuccessoredPools, "first successored (FSPI)", issues) : [];
|
|
1488
|
-
const secondSuccessoredSubtotal = secondSuccessoredPools.reduce((s, e) => s + e.carryForwardBeforeTransfer, 0);
|
|
1489
|
-
const firstSuccessoredSubtotal = firstSuccessoredPools.reduce((s, e) => s + e.carryForwardBeforeTransfer, 0);
|
|
1490
|
-
const successoredTotal = secondSuccessoredPools.reduce((s, e) => s + e.claim, 0) + firstSuccessoredPools.reduce((s, e) => s + e.claim, 0);
|
|
1491
|
-
const albertaTaxableIncome = num$2(input.albertaTaxableIncomeBeforeDeduction);
|
|
1492
|
-
const crtdMaxClaimable = Math.max(0, Math.min(unsuccessoredPoolAvailable, albertaTaxableIncome - successoredTotal));
|
|
1493
|
-
const crtdClaim = input.crtdAmountClaimed != null ? Math.max(0, Math.min(Math.round(input.crtdAmountClaimed), crtdMaxClaimable)) : crtdMaxClaimable;
|
|
1494
|
-
const poolAvailableCarryForward = unsuccessoredPoolAvailable - crtdClaim;
|
|
1495
|
-
const transferredOnDisposal = nn$33(input.transferredOnDisposal);
|
|
1496
|
-
const uncappedTotal = crtdClaim + successoredTotal;
|
|
1497
|
-
const totalRoyaltyTaxDeduction = Math.max(0, Math.min(uncappedTotal, albertaTaxableIncome));
|
|
1498
|
-
if (totalRoyaltyTaxDeduction < uncappedTotal && uncappedTotal > albertaTaxableIncome) if (albertaTaxableIncome < 0) issues.push(`Alberta Schedule 5: Alberta taxable income before the deduction (AT1 line 062) is ${albertaTaxableIncome}, which is negative. AT1 line 064 is specified as "005016 + 005140, cannot exceed 000062" with no stated floor; this engine floors the combined deduction at zero rather than reporting a negative Royalty Tax Deduction. The successored-pool claims (005140 = ${successoredTotal}) are computed independently of line 062 and are NOT reduced by this cap — review manually if this scenario occurs.`);
|
|
1499
|
-
else issues.push(`Alberta Schedule 5: the combined Royalty Tax Deduction (005016 + 005140 = ${uncappedTotal}) exceeds Alberta taxable income before the deduction (AT1 line 062 = ${albertaTaxableIncome}); AT1 line 064 is capped at ${totalRoyaltyTaxDeduction} per the spec.`);
|
|
1500
|
-
const netOfResourceAllowance = crownCharges - resourceAllowance;
|
|
1501
|
-
const carryForwardRaw = netOfResourceAllowance >= 0 ? netOfResourceAllowance + attributedRoyaltyIncomeCarryForwardIn - totalRoyaltyTaxDeduction - transferredOnDisposal : attributedRoyaltyIncomeCarryForwardIn - totalRoyaltyTaxDeduction - transferredOnDisposal;
|
|
1502
|
-
const attributedRoyaltyIncomeCarryForwardOut = Math.max(0, carryForwardRaw);
|
|
1503
|
-
if (input.poolTransfer) {
|
|
1504
|
-
const { type, acquirerName } = input.poolTransfer;
|
|
1505
|
-
if ((type === 1 || type === 2) && !acquirerName) issues.push("Alberta Schedule 5: pool transfer type (005026) is 1 or 2, but the acquiring corporation's legal name (005027) is missing.");
|
|
1506
|
-
if (type === 3 && acquirerName) issues.push("Alberta Schedule 5: pool transfer type (005026) is 3 (no transfer), but an acquiring corporation name (005027) was supplied. Per the spec, 005027 must be blank when 005026 = 3.");
|
|
1507
|
-
}
|
|
1508
|
-
if (input.changeInControlEndedPrecedingYear !== void 0 && input.at1TaxYearEndChanged !== void 0 && input.at1TaxYearEndChangeReason !== void 0) {
|
|
1509
|
-
const cicChangedYearEnd = input.at1TaxYearEndChanged && input.at1TaxYearEndChangeReason === 2;
|
|
1510
|
-
if (input.changeInControlEndedPrecedingYear !== cicChangedYearEnd) issues.push(`Alberta Schedule 5: 005100 (change in control ended the preceding taxation year) is ${input.changeInControlEndedPrecedingYear}, which is inconsistent with AT1 core 000038/000039 (tax year end changed due to change in control = ${cicChangedYearEnd}). Per the spec, these must agree in both directions.`);
|
|
1511
|
-
}
|
|
1512
|
-
const formRequired = crownCharges > 0 || attributedRoyaltyIncomeCarryForwardIn > 0 || hasSuccessoredPools;
|
|
1513
|
-
return {
|
|
1514
|
-
crownCharges,
|
|
1515
|
-
resourceAllowance,
|
|
1516
|
-
reimbursements,
|
|
1517
|
-
predecessorTransfersTotal,
|
|
1518
|
-
attributedRoyaltyIncomeCarryForwardIn,
|
|
1519
|
-
unsuccessoredPoolAvailable,
|
|
1520
|
-
crtdMaxClaimable,
|
|
1521
|
-
crtdClaim,
|
|
1522
|
-
poolAvailableCarryForward,
|
|
1523
|
-
transferredOnDisposal,
|
|
1524
|
-
secondSuccessoredPools,
|
|
1525
|
-
firstSuccessoredPools,
|
|
1526
|
-
secondSuccessoredSubtotal,
|
|
1527
|
-
firstSuccessoredSubtotal,
|
|
1528
|
-
successoredTotal,
|
|
1529
|
-
totalRoyaltyTaxDeduction,
|
|
1530
|
-
attributedRoyaltyIncomeCarryForwardOut,
|
|
1531
|
-
...input.poolTransfer !== void 0 ? { poolTransfer: input.poolTransfer } : {},
|
|
1532
|
-
...input.changeInControlEndedPrecedingYear !== void 0 ? { changeInControlEndedPrecedingYear: input.changeInControlEndedPrecedingYear } : {},
|
|
1533
|
-
formRequired,
|
|
1534
|
-
issues
|
|
1535
|
-
};
|
|
1536
|
-
}
|
|
1537
|
-
/** `005` + field id + 3-digit occurrence — the nine-digit AT1 line item id. */
|
|
1538
|
-
function schedule5LineItemId(fieldId, occurrence = 1) {
|
|
1539
|
-
return `005${fieldId}${String(occurrence).padStart(3, "0")}`;
|
|
1540
|
-
}
|
|
1541
|
-
function putSuccessoredPool(values, entries, fields) {
|
|
1542
|
-
entries.forEach((e, i) => {
|
|
1543
|
-
const n = i + 1;
|
|
1544
|
-
const put = (fieldId, value) => values.push({
|
|
1545
|
-
lineItemId: schedule5LineItemId(fieldId, n),
|
|
1546
|
-
value
|
|
1547
|
-
});
|
|
1548
|
-
put(fields.vendorName, e.vendorName);
|
|
1549
|
-
put(fields.dateOfEvent, e.dateOfEvent);
|
|
1550
|
-
if (e.baseKind === "broughtForward") put(fields.broughtForward, e.base);
|
|
1551
|
-
else if (e.baseKind === "acquired") put(fields.acquired, e.base);
|
|
1552
|
-
put(fields.propertyIncome, e.propertyIncome);
|
|
1553
|
-
put(fields.claim, e.claim);
|
|
1554
|
-
put(fields.carryForward, e.carryForwardBeforeTransfer);
|
|
1555
|
-
});
|
|
1556
|
-
}
|
|
1557
|
-
function schedule5Values(result) {
|
|
1558
|
-
const values = [];
|
|
1559
|
-
const put = (fieldId, value) => values.push({
|
|
1560
|
-
lineItemId: schedule5LineItemId(fieldId),
|
|
1561
|
-
value
|
|
1562
|
-
});
|
|
1563
|
-
put("001", result.crownCharges);
|
|
1564
|
-
put("005", result.resourceAllowance);
|
|
1565
|
-
put("007", result.reimbursements);
|
|
1566
|
-
put("011", result.attributedRoyaltyIncomeCarryForwardIn);
|
|
1567
|
-
put("016", result.crtdClaim);
|
|
1568
|
-
put("017", result.poolAvailableCarryForward);
|
|
1569
|
-
put("023", result.transferredOnDisposal);
|
|
1570
|
-
put("025", result.attributedRoyaltyIncomeCarryForwardOut);
|
|
1571
|
-
if (result.poolTransfer) {
|
|
1572
|
-
put("026", result.poolTransfer.type);
|
|
1573
|
-
if (result.poolTransfer.acquirerName) put("027", result.poolTransfer.acquirerName);
|
|
1574
|
-
}
|
|
1575
|
-
if (result.changeInControlEndedPrecedingYear !== void 0) put("100", result.changeInControlEndedPrecedingYear ? 1 : 2);
|
|
1576
|
-
putSuccessoredPool(values, result.secondSuccessoredPools, {
|
|
1577
|
-
vendorName: "101",
|
|
1578
|
-
dateOfEvent: "103",
|
|
1579
|
-
broughtForward: "105",
|
|
1580
|
-
acquired: "107",
|
|
1581
|
-
propertyIncome: "109",
|
|
1582
|
-
claim: "111",
|
|
1583
|
-
carryForward: "113"
|
|
1584
|
-
});
|
|
1585
|
-
put("115", result.secondSuccessoredSubtotal);
|
|
1586
|
-
putSuccessoredPool(values, result.firstSuccessoredPools, {
|
|
1587
|
-
vendorName: "121",
|
|
1588
|
-
dateOfEvent: "123",
|
|
1589
|
-
broughtForward: "125",
|
|
1590
|
-
acquired: "127",
|
|
1591
|
-
propertyIncome: "129",
|
|
1592
|
-
claim: "131",
|
|
1593
|
-
carryForward: "133"
|
|
1594
|
-
});
|
|
1595
|
-
put("135", result.firstSuccessoredSubtotal);
|
|
1596
|
-
put("140", result.successoredTotal);
|
|
1597
|
-
return {
|
|
1598
|
-
scheduleId: "005",
|
|
1599
|
-
values
|
|
1600
|
-
};
|
|
1601
|
-
}
|
|
1602
|
-
//#endregion
|
|
1603
|
-
//#region src/t2/at1/schedules/schedule6-royalty-tax-credit.ts
|
|
1604
|
-
const rd$1 = (v) => Math.round(v ?? 0);
|
|
1605
|
-
const nn$32 = (v) => Math.max(0, Math.round(v ?? 0));
|
|
1606
|
-
const round4$1 = (v) => Math.round(v * 1e4) / 1e4;
|
|
1607
|
-
function computeWeightedAverageRate(quarters, issues) {
|
|
1608
|
-
if (quarters.length === 0) {
|
|
1609
|
-
issues.push("Alberta Schedule 6: no quarters were supplied for the weighted average rate (006008 is mandatory). Defaulted to 0 — supply the RTC quarterly rate(s) from Alberta Treasury Board and Finance's published rate table.");
|
|
1610
|
-
return 0;
|
|
1611
|
-
}
|
|
1612
|
-
const totalDays = quarters.reduce((s, q) => s + Math.max(0, q.days), 0);
|
|
1613
|
-
if (totalDays <= 0) {
|
|
1614
|
-
issues.push("Alberta Schedule 6: the quarters supplied for 006008 total zero days.");
|
|
1615
|
-
return 0;
|
|
1616
|
-
}
|
|
1617
|
-
const weighted = quarters.reduce((s, q) => s + Math.max(0, q.days) / totalDays * q.rate, 0);
|
|
1618
|
-
return round4$1(weighted);
|
|
1619
|
-
}
|
|
1620
|
-
function resolveAllocations(allocations, pool, issues) {
|
|
1621
|
-
const totalRequested = allocations.reduce((s, a) => s + nn$32(a.allocatedAmount), 0);
|
|
1622
|
-
if (totalRequested > pool) issues.push(`Alberta Schedule 6: the associated group allocated ${totalRequested} of a Crown Royalty Shelter pool of ${pool} (006034 occurrences exceed the $2,000,000 × (006028/365) limit). Allocations were capped in the order given — the group must agree a valid split.`);
|
|
1623
|
-
let remaining = pool;
|
|
1624
|
-
return allocations.map((a) => {
|
|
1625
|
-
const requestedAmount = nn$32(a.allocatedAmount);
|
|
1626
|
-
const allocatedAmount = Math.min(requestedAmount, remaining);
|
|
1627
|
-
remaining -= allocatedAmount;
|
|
1628
|
-
return {
|
|
1629
|
-
name: a.name,
|
|
1630
|
-
...a.albertaCan !== void 0 ? { albertaCan: a.albertaCan } : {},
|
|
1631
|
-
allocatedAmount,
|
|
1632
|
-
requestedAmount
|
|
1633
|
-
};
|
|
1634
|
-
});
|
|
1635
|
-
}
|
|
1636
|
-
function schedule6LineItemId(fieldId, occurrence = 1) {
|
|
1637
|
-
return `006${fieldId}${String(occurrence).padStart(3, "0")}`;
|
|
1638
|
-
}
|
|
1639
|
-
/**
|
|
1640
|
-
* Emits every field this module's own MAPPINGS transcription actually defines
|
|
1641
|
-
* a number for: 006002/004/006/008, and — only when the corporation is
|
|
1642
|
-
* associated — the ACRS section (006022-028) and the AACRS allocation table
|
|
1643
|
-
* (006030-034, one occurrence per row).
|
|
1644
|
-
*
|
|
1645
|
-
* ── No credit amount is filed here, because none exists on this schedule ────
|
|
1646
|
-
*
|
|
1647
|
-
* See the module docstring's "CONFIRMED: there is no 'credit' dollar amount
|
|
1648
|
-
* to compute here" section — the Alberta Royalty Tax Credit is an instalment
|
|
1649
|
-
* program (AT1 jacket line 000082, the shared "Payments & Instalments"
|
|
1650
|
-
* schedule), not a value Schedule 6 computes and files. This builder emits
|
|
1651
|
-
* exactly the three components the schedule DOES define (006004, 006006,
|
|
1652
|
-
* 006008) plus the ACRS/AACRS detail when associated — matching
|
|
1653
|
-
* `schedule3Values`'s `At1ScheduleDataLike` shape exactly: `{ scheduleId,
|
|
1654
|
-
* values }`.
|
|
1655
|
-
*/
|
|
1656
|
-
function schedule6Values(result) {
|
|
1657
|
-
const values = [];
|
|
1658
|
-
const put = (fieldId, value, occurrence = 1) => values.push({
|
|
1659
|
-
lineItemId: schedule6LineItemId(fieldId, occurrence),
|
|
1660
|
-
value
|
|
1661
|
-
});
|
|
1662
|
-
put("002", result.associatedWithCrownRoyaltyCorporations ? 1 : 2);
|
|
1663
|
-
put("004", result.albertaCrownRoyaltyIncurred);
|
|
1664
|
-
put("006", result.crownRoyaltyShelter);
|
|
1665
|
-
put("008", result.weightedAverageRate);
|
|
1666
|
-
if (result.associatedWithCrownRoyaltyCorporations && result.longestAssociatedYear) {
|
|
1667
|
-
if (result.longestAssociatedYear.albertaCan !== void 0) values.push({
|
|
1668
|
-
lineItemId: schedule6LineItemId("022"),
|
|
1669
|
-
value: result.longestAssociatedYear.albertaCan
|
|
1670
|
-
});
|
|
1671
|
-
if (result.longestAssociatedYear.taxationYearBeginning !== void 0) values.push({
|
|
1672
|
-
lineItemId: schedule6LineItemId("024"),
|
|
1673
|
-
value: result.longestAssociatedYear.taxationYearBeginning
|
|
1674
|
-
});
|
|
1675
|
-
if (result.longestAssociatedYear.taxationYearEnding !== void 0) values.push({
|
|
1676
|
-
lineItemId: schedule6LineItemId("026"),
|
|
1677
|
-
value: result.longestAssociatedYear.taxationYearEnding
|
|
1678
|
-
});
|
|
1679
|
-
put("028", result.longestAssociatedYear.days);
|
|
1680
|
-
result.allocations.forEach((a, i) => {
|
|
1681
|
-
const occurrence = i + 1;
|
|
1682
|
-
values.push({
|
|
1683
|
-
lineItemId: schedule6LineItemId("030", occurrence),
|
|
1684
|
-
value: a.name
|
|
1685
|
-
});
|
|
1686
|
-
if (a.albertaCan !== void 0) values.push({
|
|
1687
|
-
lineItemId: schedule6LineItemId("032", occurrence),
|
|
1688
|
-
value: a.albertaCan
|
|
1689
|
-
});
|
|
1690
|
-
put("034", a.allocatedAmount, occurrence);
|
|
1691
|
-
});
|
|
1692
|
-
}
|
|
1693
|
-
return {
|
|
1694
|
-
scheduleId: "006",
|
|
1695
|
-
values
|
|
1696
|
-
};
|
|
1697
|
-
}
|
|
1698
|
-
function computeAlbertaSchedule6(input) {
|
|
1699
|
-
const issues = [];
|
|
1700
|
-
const associatedWithCrownRoyaltyCorporations = input.associatedWithCrownRoyaltyCorporations ?? false;
|
|
1701
|
-
const albertaCrownRoyaltyIncurred = rd$1(input.albertaCrownRoyaltyIncurred);
|
|
1702
|
-
const weightedAverageRate = computeWeightedAverageRate(input.quarters ?? [], issues);
|
|
1703
|
-
const formRequired = albertaCrownRoyaltyIncurred > 0;
|
|
1704
|
-
if (!associatedWithCrownRoyaltyCorporations) {
|
|
1705
|
-
const days = Math.max(0, Math.min(input.taxationYearDays ?? 365, 365));
|
|
1706
|
-
return {
|
|
1707
|
-
associatedWithCrownRoyaltyCorporations,
|
|
1708
|
-
albertaCrownRoyaltyIncurred,
|
|
1709
|
-
crownRoyaltyShelter: Math.round(2e6 * (days / 365)),
|
|
1710
|
-
weightedAverageRate,
|
|
1711
|
-
aggregateShelterPool: 0,
|
|
1712
|
-
allocations: [],
|
|
1713
|
-
totalAllocated: 0,
|
|
1714
|
-
formRequired,
|
|
1715
|
-
issues
|
|
1716
|
-
};
|
|
1717
|
-
}
|
|
1718
|
-
if (!input.longestAssociatedYear) issues.push("Alberta Schedule 6: the corporation is associated with one or more corporations that incurred Alberta Crown Royalty (006002 = 1), but no ACRS data (006022-006028, the associated corporation with the longest taxation year) was supplied. The Crown Royalty Shelter pool defaulted to zero.");
|
|
1719
|
-
const days = Math.max(0, Math.min(input.longestAssociatedYear?.days ?? 0, 365));
|
|
1720
|
-
const aggregateShelterPool = Math.round(2e6 * (days / 365));
|
|
1721
|
-
const rawAllocations = input.allocations ?? [];
|
|
1722
|
-
if (rawAllocations.length === 0) issues.push("Alberta Schedule 6: the corporation is associated (006002 = 1), but no AACRS allocation rows (006030-006034) were supplied. This filer's own Crown Royalty Shelter (006006) defaulted to zero.");
|
|
1723
|
-
const allocations = resolveAllocations(rawAllocations, aggregateShelterPool, issues);
|
|
1724
|
-
const totalAllocated = allocations.reduce((s, a) => s + a.allocatedAmount, 0);
|
|
1725
|
-
return {
|
|
1726
|
-
associatedWithCrownRoyaltyCorporations,
|
|
1727
|
-
albertaCrownRoyaltyIncurred,
|
|
1728
|
-
crownRoyaltyShelter: allocations[0]?.allocatedAmount ?? 0,
|
|
1729
|
-
weightedAverageRate,
|
|
1730
|
-
longestAssociatedYear: {
|
|
1731
|
-
...input.longestAssociatedYear?.albertaCan !== void 0 ? { albertaCan: input.longestAssociatedYear.albertaCan } : {},
|
|
1732
|
-
...input.longestAssociatedYear?.taxationYearBeginning !== void 0 ? { taxationYearBeginning: input.longestAssociatedYear.taxationYearBeginning } : {},
|
|
1733
|
-
...input.longestAssociatedYear?.taxationYearEnding !== void 0 ? { taxationYearEnding: input.longestAssociatedYear.taxationYearEnding } : {},
|
|
1734
|
-
days
|
|
1735
|
-
},
|
|
1736
|
-
aggregateShelterPool,
|
|
1737
|
-
allocations,
|
|
1738
|
-
totalAllocated,
|
|
1739
|
-
formRequired,
|
|
1740
|
-
issues
|
|
1741
|
-
};
|
|
1742
|
-
}
|
|
1743
|
-
//#endregion
|
|
1744
|
-
//#region src/t2/at1/schedules/schedule7-royalty-supplemental.ts
|
|
1745
|
-
/** Signed whole-dollar rounding — no floor, several of these lines are marked "+/-". */
|
|
1746
|
-
const rd = (v) => Math.round(v ?? 0);
|
|
1747
|
-
/** Non-negative whole-dollar rounding, for the "+"-only lines. */
|
|
1748
|
-
const nn$31 = (v) => Math.max(0, Math.round(v ?? 0));
|
|
1749
|
-
const round4 = (v) => Math.round(v * 1e4) / 1e4;
|
|
1750
|
-
function resolvePartnership(p, index, issues) {
|
|
1751
|
-
if (!p.name) issues.push(`Alberta Schedule 7: partnership row ${index + 1} has no name (007071 is mandatory for every PITI occurrence).`);
|
|
1752
|
-
if (p.interestPercent < 0 || p.interestPercent > 1) issues.push(`Alberta Schedule 7: ${p.name || `partnership row ${index + 1}`} has an interest of ${p.interestPercent}, expected a decimal between 0 and 1 (007073, e.g. .7500 for 75%).`);
|
|
1753
|
-
return {
|
|
1754
|
-
name: p.name,
|
|
1755
|
-
interestPercent: round4(p.interestPercent),
|
|
1756
|
-
...p.fiscalPeriodEnd !== void 0 ? { fiscalPeriodEnd: p.fiscalPeriodEnd } : {},
|
|
1757
|
-
shareEligibleForCredit: nn$31(p.shareEligibleForCredit),
|
|
1758
|
-
shareOtherRoyaltiesNotEligible: nn$31(p.shareOtherRoyaltiesNotEligible),
|
|
1759
|
-
shareOtherCrownChargesEligibleForDeduction: nn$31(p.shareOtherCrownChargesEligibleForDeduction)
|
|
1760
|
-
};
|
|
1761
|
-
}
|
|
1762
|
-
function resolveAdjustment(a, index, issues) {
|
|
1763
|
-
if (!a.priorProductionPeriodEnd) issues.push(`Alberta Schedule 7: prior-year adjustment row ${index + 1} has no prior production period (007083 is mandatory for every ACRA occurrence).`);
|
|
1764
|
-
if (a.sourceOfAdjustment !== 1 && a.sourceOfAdjustment !== 2) issues.push(`Alberta Schedule 7: prior-year adjustment row ${index + 1} has no valid source code (007085 must be 1 = Dept. of Resource Development or 2 = Operator).`);
|
|
1765
|
-
return {
|
|
1766
|
-
...a.priorProductionPeriodEnd !== void 0 ? { priorProductionPeriodEnd: a.priorProductionPeriodEnd } : {},
|
|
1767
|
-
...a.sourceOfAdjustment !== void 0 ? { sourceOfAdjustment: a.sourceOfAdjustment } : {},
|
|
1768
|
-
increase: nn$31(a.increase),
|
|
1769
|
-
decrease: nn$31(a.decrease),
|
|
1770
|
-
adjustmentNotEligibleForCredit: rd(a.adjustmentNotEligibleForCredit)
|
|
1771
|
-
};
|
|
1772
|
-
}
|
|
1773
|
-
function schedule7LineItemId(fieldId, occurrence = 1) {
|
|
1774
|
-
return `007${fieldId}${String(occurrence).padStart(3, "0")}`;
|
|
1775
|
-
}
|
|
1776
|
-
/**
|
|
1777
|
-
* Emits CPI (007003-029), the computed totals 007051 and 007061, and the two
|
|
1778
|
-
* repeating sections — PITI (007071-081, one occurrence per partnership) and
|
|
1779
|
-
* ACRA (007083-091, one occurrence per prior-year adjustment).
|
|
1780
|
-
*
|
|
1781
|
-
* 007061 is filed even though it has no defining row of its own anywhere in
|
|
1782
|
-
* this schedule's MAPPINGS block (spec lines 6654-7251) — see the module
|
|
1783
|
-
* docstring's "Two totals with NO defining row of their own in this MAPPINGS
|
|
1784
|
-
* table" section. It is a real Schedule 7 output line: AT1 Schedule 5's own
|
|
1785
|
-
* field 005001 definition (spec lines 5237-5248) names it explicitly as
|
|
1786
|
-
* "Schedule 7, line 061" and gives its formula in full, so it is filed here
|
|
1787
|
-
* under that citation rather than omitted for lack of a home row.
|
|
1788
|
-
*/
|
|
1789
|
-
function schedule7Values$1(result) {
|
|
1790
|
-
const values = [];
|
|
1791
|
-
const put = (fieldId, value, occurrence = 1) => values.push({
|
|
1792
|
-
lineItemId: schedule7LineItemId(fieldId, occurrence),
|
|
1793
|
-
value
|
|
1794
|
-
});
|
|
1795
|
-
put("003", result.eligibleCrownRoyalty);
|
|
1796
|
-
put("005", result.otherRoyaltiesNotEligible);
|
|
1797
|
-
put("007", result.royaltyPaidToOtherJurisdictions);
|
|
1798
|
-
put("009", result.nonDeductibleCrownLeaseRentals);
|
|
1799
|
-
put("011", result.mineralTaxes);
|
|
1800
|
-
put("013", result.saskatchewanResourcesSurcharge);
|
|
1801
|
-
result.otherNonDeductibleCrownChargeTypes.forEach((name, i) => {
|
|
1802
|
-
values.push({
|
|
1803
|
-
lineItemId: schedule7LineItemId(String(14 + i).padStart(3, "0")),
|
|
1804
|
-
value: name
|
|
1805
|
-
});
|
|
1806
|
-
});
|
|
1807
|
-
put("017", result.otherNonDeductibleCrownCharges);
|
|
1808
|
-
put("025", result.crownLeaseRentalsCapitalized);
|
|
1809
|
-
if (result.otherBalanceSheetDeductionName !== void 0) values.push({
|
|
1810
|
-
lineItemId: schedule7LineItemId("027"),
|
|
1811
|
-
value: result.otherBalanceSheetDeductionName
|
|
1812
|
-
});
|
|
1813
|
-
put("029", result.otherBalanceSheetDeduction);
|
|
1814
|
-
result.partnerships.forEach((p, i) => {
|
|
1815
|
-
const occurrence = i + 1;
|
|
1816
|
-
values.push({
|
|
1817
|
-
lineItemId: schedule7LineItemId("071", occurrence),
|
|
1818
|
-
value: p.name
|
|
1819
|
-
});
|
|
1820
|
-
put("073", p.interestPercent, occurrence);
|
|
1821
|
-
if (p.fiscalPeriodEnd !== void 0) values.push({
|
|
1822
|
-
lineItemId: schedule7LineItemId("075", occurrence),
|
|
1823
|
-
value: p.fiscalPeriodEnd
|
|
1824
|
-
});
|
|
1825
|
-
put("077", p.shareEligibleForCredit, occurrence);
|
|
1826
|
-
put("079", p.shareOtherRoyaltiesNotEligible, occurrence);
|
|
1827
|
-
put("081", p.shareOtherCrownChargesEligibleForDeduction, occurrence);
|
|
1828
|
-
});
|
|
1829
|
-
result.priorYearAdjustments.forEach((a, i) => {
|
|
1830
|
-
const occurrence = i + 1;
|
|
1831
|
-
if (a.priorProductionPeriodEnd !== void 0) values.push({
|
|
1832
|
-
lineItemId: schedule7LineItemId("083", occurrence),
|
|
1833
|
-
value: a.priorProductionPeriodEnd
|
|
1834
|
-
});
|
|
1835
|
-
if (a.sourceOfAdjustment !== void 0) put("085", a.sourceOfAdjustment, occurrence);
|
|
1836
|
-
put("087", a.increase, occurrence);
|
|
1837
|
-
put("089", a.decrease, occurrence);
|
|
1838
|
-
put("091", a.adjustmentNotEligibleForCredit, occurrence);
|
|
1839
|
-
});
|
|
1840
|
-
put("051", result.totalAdjustments);
|
|
1841
|
-
put("061", result.crownChargesNetOfReimbursements);
|
|
1842
|
-
return {
|
|
1843
|
-
scheduleId: "007",
|
|
1844
|
-
values
|
|
1845
|
-
};
|
|
1846
|
-
}
|
|
1847
|
-
function computeAlbertaSchedule7(input) {
|
|
1848
|
-
const issues = [];
|
|
1849
|
-
const eligibleCrownRoyalty = rd(input.eligibleCrownRoyalty);
|
|
1850
|
-
const otherRoyaltiesNotEligible = rd(input.otherRoyaltiesNotEligible);
|
|
1851
|
-
const royaltyPaidToOtherJurisdictions = rd(input.royaltyPaidToOtherJurisdictions);
|
|
1852
|
-
const nonDeductibleCrownLeaseRentals = rd(input.nonDeductibleCrownLeaseRentals);
|
|
1853
|
-
const mineralTaxes = rd(input.mineralTaxes);
|
|
1854
|
-
const saskatchewanResourcesSurcharge = rd(input.saskatchewanResourcesSurcharge);
|
|
1855
|
-
const otherNonDeductibleCrownChargeTypes = (input.otherNonDeductibleCrownChargeTypes ?? []).slice(0, 3);
|
|
1856
|
-
if ((input.otherNonDeductibleCrownChargeTypes?.length ?? 0) > 3) issues.push("Alberta Schedule 7: more than three other non-deductible crown charge types were supplied (007014/015/016 allow three); only the first three were kept.");
|
|
1857
|
-
let otherNonDeductibleCrownCharges = rd(input.otherNonDeductibleCrownCharges);
|
|
1858
|
-
if (otherNonDeductibleCrownChargeTypes.length === 0 && otherNonDeductibleCrownCharges !== 0) {
|
|
1859
|
-
issues.push("Alberta Schedule 7: an amount was given for other non-deductible crown charges (007017) but no charge type was named (007014/015/016). The spec defaults 007017 to zero when no type is named; the amount was zeroed out.");
|
|
1860
|
-
otherNonDeductibleCrownCharges = 0;
|
|
1861
|
-
}
|
|
1862
|
-
const crownLeaseRentalsCapitalized = rd(input.crownLeaseRentalsCapitalized);
|
|
1863
|
-
let otherBalanceSheetDeduction = nn$31(input.otherBalanceSheetDeduction);
|
|
1864
|
-
if (!input.otherBalanceSheetDeductionName && otherBalanceSheetDeduction !== 0) {
|
|
1865
|
-
issues.push("Alberta Schedule 7: an amount was given for another balance sheet eligible deduction (007029) but no deduction was named (007027). The spec defaults 007029 to zero when no name is given; the amount was zeroed out.");
|
|
1866
|
-
otherBalanceSheetDeduction = 0;
|
|
1867
|
-
}
|
|
1868
|
-
const partnerships = (input.partnerships ?? []).map((p, i) => resolvePartnership(p, i, issues));
|
|
1869
|
-
const totalPartnershipShareEligibleForCredit = partnerships.reduce((s, p) => s + p.shareEligibleForCredit, 0);
|
|
1870
|
-
const totalPartnershipShareOtherRoyaltiesNotEligible = partnerships.reduce((s, p) => s + p.shareOtherRoyaltiesNotEligible, 0);
|
|
1871
|
-
const totalPartnershipShareOtherCrownCharges = partnerships.reduce((s, p) => s + p.shareOtherCrownChargesEligibleForDeduction, 0);
|
|
1872
|
-
const priorYearAdjustments = (input.priorYearAdjustments ?? []).map((a, i) => resolveAdjustment(a, i, issues));
|
|
1873
|
-
const totalIncrease = priorYearAdjustments.reduce((s, a) => s + a.increase, 0);
|
|
1874
|
-
const totalDecrease = priorYearAdjustments.reduce((s, a) => s + a.decrease, 0);
|
|
1875
|
-
const totalAdjustmentNotEligible = priorYearAdjustments.reduce((s, a) => s + a.adjustmentNotEligibleForCredit, 0);
|
|
1876
|
-
const totalAdjustments = priorYearAdjustments.length === 0 ? 0 : totalIncrease - totalDecrease + totalAdjustmentNotEligible;
|
|
1877
|
-
const crownChargesNetOfReimbursements = eligibleCrownRoyalty + otherRoyaltiesNotEligible + royaltyPaidToOtherJurisdictions + nonDeductibleCrownLeaseRentals + mineralTaxes + saskatchewanResourcesSurcharge + otherNonDeductibleCrownCharges + crownLeaseRentalsCapitalized + otherBalanceSheetDeduction + totalPartnershipShareEligibleForCredit + totalPartnershipShareOtherRoyaltiesNotEligible + totalPartnershipShareOtherCrownCharges - totalAdjustments;
|
|
1878
|
-
const albertaCrownRoyaltyForSchedule6 = eligibleCrownRoyalty + totalPartnershipShareEligibleForCredit - totalIncrease + totalDecrease;
|
|
1879
|
-
return {
|
|
1880
|
-
eligibleCrownRoyalty,
|
|
1881
|
-
otherRoyaltiesNotEligible,
|
|
1882
|
-
royaltyPaidToOtherJurisdictions,
|
|
1883
|
-
nonDeductibleCrownLeaseRentals,
|
|
1884
|
-
mineralTaxes,
|
|
1885
|
-
saskatchewanResourcesSurcharge,
|
|
1886
|
-
otherNonDeductibleCrownChargeTypes,
|
|
1887
|
-
otherNonDeductibleCrownCharges,
|
|
1888
|
-
crownLeaseRentalsCapitalized,
|
|
1889
|
-
...input.otherBalanceSheetDeductionName !== void 0 ? { otherBalanceSheetDeductionName: input.otherBalanceSheetDeductionName } : {},
|
|
1890
|
-
otherBalanceSheetDeduction,
|
|
1891
|
-
partnerships,
|
|
1892
|
-
totalPartnershipShareEligibleForCredit,
|
|
1893
|
-
totalPartnershipShareOtherRoyaltiesNotEligible,
|
|
1894
|
-
totalPartnershipShareOtherCrownCharges,
|
|
1895
|
-
priorYearAdjustments,
|
|
1896
|
-
totalAdjustments,
|
|
1897
|
-
crownChargesNetOfReimbursements,
|
|
1898
|
-
albertaCrownRoyaltyForSchedule6,
|
|
1899
|
-
issues
|
|
1900
|
-
};
|
|
1901
|
-
}
|
|
1902
|
-
//#endregion
|
|
1903
|
-
//#region src/t2/at1/schedules/schedule8-political-contributions.ts
|
|
1904
|
-
const nn$30 = (v) => Math.max(0, Math.round(v ?? 0));
|
|
1905
|
-
function yearOf(dateIso) {
|
|
1906
|
-
if (!dateIso || dateIso.length < 4) return void 0;
|
|
1907
|
-
const y = Number(dateIso.slice(0, 4));
|
|
1908
|
-
return Number.isFinite(y) ? y : void 0;
|
|
1909
|
-
}
|
|
1910
|
-
/** Tiered rate for the "all made in 2003 or earlier" branch. */
|
|
1911
|
-
function tierTo2003(a) {
|
|
1912
|
-
if (a <= 150) return a * .75;
|
|
1913
|
-
if (a <= 825) return 112.5 + (a - 150) * .5;
|
|
1914
|
-
return 450 + (a - 825) * .333;
|
|
1915
|
-
}
|
|
1916
|
-
/** Tiered rate for the "all made in 2004 or later" branch. */
|
|
1917
|
-
function tierFrom2004(a) {
|
|
1918
|
-
if (a <= 200) return a * .75;
|
|
1919
|
-
if (a <= 900) return 150 + (a - 200) * .5;
|
|
1920
|
-
return 600 + (a - 900) * .333;
|
|
1921
|
-
}
|
|
1922
|
-
function computeSchedule8$1(input) {
|
|
1923
|
-
const issues = [];
|
|
1924
|
-
const contributions = input.contributions ?? [];
|
|
1925
|
-
contributions.forEach((c, i) => {
|
|
1926
|
-
if (!c.dateOfDonation) issues.push(`Alberta Schedule 8: contribution #${i + 1} (${c.name || "unnamed"}) has no date of donation (008006) — the spec requires one for every receipted contribution.`);
|
|
1927
|
-
if (!c.receiptNumber) issues.push(`Alberta Schedule 8: contribution #${i + 1} (${c.name || "unnamed"}) has no official receipt number (008004).`);
|
|
1928
|
-
});
|
|
1929
|
-
const partnershipContributionsTo2003 = nn$30(input.partnershipContributionsTo2003);
|
|
1930
|
-
const partnershipContributionsFrom2004 = nn$30(input.partnershipContributionsFrom2004);
|
|
1931
|
-
const totalDirect = contributions.reduce((sum, c) => sum + nn$30(c.amount), 0);
|
|
1932
|
-
const directTo2003 = contributions.filter((c) => (yearOf(c.dateOfDonation) ?? 0) <= 2003).reduce((sum, c) => sum + nn$30(c.amount), 0);
|
|
1933
|
-
const directFrom2004 = contributions.filter((c) => (yearOf(c.dateOfDonation) ?? 9999) >= 2004).reduce((sum, c) => sum + nn$30(c.amount), 0);
|
|
1934
|
-
const directIn2004Only = contributions.filter((c) => yearOf(c.dateOfDonation) === 2004).reduce((sum, c) => sum + nn$30(c.amount), 0);
|
|
1935
|
-
const hasTo2003 = directTo2003 > 0 || partnershipContributionsTo2003 > 0;
|
|
1936
|
-
const hasFrom2004 = directFrom2004 > 0 || partnershipContributionsFrom2004 > 0;
|
|
1937
|
-
if (!hasTo2003 && !hasFrom2004) return {
|
|
1938
|
-
contributions,
|
|
1939
|
-
partnershipContributionsTo2003,
|
|
1940
|
-
partnershipContributionsFrom2004,
|
|
1941
|
-
period: "none",
|
|
1942
|
-
creditBeforeCeiling: 0,
|
|
1943
|
-
credit: 0,
|
|
1944
|
-
issues
|
|
1945
|
-
};
|
|
1946
|
-
const taxYearBeginYear = yearOf(input.taxYearBegin);
|
|
1947
|
-
const taxYearEndYear = yearOf(input.taxYearEnd);
|
|
1948
|
-
const taxYearStraddles2003to2004 = taxYearBeginYear === 2003 && taxYearEndYear === 2004;
|
|
1949
|
-
const ceiling = input.remainingBasicTax;
|
|
1950
|
-
let period;
|
|
1951
|
-
let rawCredit;
|
|
1952
|
-
let credit;
|
|
1953
|
-
if (hasTo2003 && !hasFrom2004) {
|
|
1954
|
-
period = "to-2003";
|
|
1955
|
-
rawCredit = tierTo2003(totalDirect + partnershipContributionsTo2003);
|
|
1956
|
-
if (ceiling == null) {
|
|
1957
|
-
issues.push("Alberta Schedule 8: remainingBasicTax (000068 − (000070+000071+000072)) was not supplied, so no political contributions credit can be claimed for the 2003-or-earlier rate period.");
|
|
1958
|
-
credit = 0;
|
|
1959
|
-
} else credit = Math.max(0, Math.round(Math.min(rawCredit, 750, ceiling)));
|
|
1960
|
-
} else if (hasFrom2004 && !hasTo2003) {
|
|
1961
|
-
period = "from-2004";
|
|
1962
|
-
rawCredit = tierFrom2004(totalDirect + partnershipContributionsFrom2004);
|
|
1963
|
-
if (ceiling == null) {
|
|
1964
|
-
issues.push("Alberta Schedule 8: remainingBasicTax (000068 − (000070+000071+000072)) was not supplied, so no political contributions credit can be claimed for the 2004-or-later rate period.");
|
|
1965
|
-
credit = 0;
|
|
1966
|
-
} else credit = Math.max(0, Math.round(Math.min(rawCredit, 1e3, ceiling)));
|
|
1967
|
-
} else if (taxYearStraddles2003to2004) {
|
|
1968
|
-
period = "straddle-2003-2004";
|
|
1969
|
-
const x = directIn2004Only + partnershipContributionsFrom2004;
|
|
1970
|
-
const y = totalDirect + partnershipContributionsTo2003 + partnershipContributionsFrom2004;
|
|
1971
|
-
const a = Math.min(y, 150);
|
|
1972
|
-
const b = Math.min(Math.max(0, x - a), 50);
|
|
1973
|
-
const c = Math.min(Math.max(0, y - (a + b)), 675);
|
|
1974
|
-
const d = Math.min(Math.max(0, x - (a + b + c)), 225);
|
|
1975
|
-
const e = Math.min(Math.max(0, y - (a + b + c + d)), 900);
|
|
1976
|
-
const f = Math.min(Math.max(0, x - (a + b + c + d + e)), 300);
|
|
1977
|
-
rawCredit = .75 * a + .75 * b + .5 * c + .5 * d + e / 3 + f / 3;
|
|
1978
|
-
credit = Math.max(0, Math.round(rawCredit));
|
|
1979
|
-
} else {
|
|
1980
|
-
period = "none";
|
|
1981
|
-
rawCredit = 0;
|
|
1982
|
-
credit = 0;
|
|
1983
|
-
issues.push("Alberta Schedule 8: contributions span both the 2003-or-earlier and 2004-or-later rate periods, but the tax year does not begin in 2003 and end in 2004 — the spec only defines a mixed-period formula for that straddling tax year. No credit computed.");
|
|
1984
|
-
}
|
|
1985
|
-
return {
|
|
1986
|
-
contributions,
|
|
1987
|
-
partnershipContributionsTo2003,
|
|
1988
|
-
partnershipContributionsFrom2004,
|
|
1989
|
-
period,
|
|
1990
|
-
creditBeforeCeiling: Math.round(rawCredit),
|
|
1991
|
-
credit,
|
|
1992
|
-
issues
|
|
1993
|
-
};
|
|
1994
|
-
}
|
|
1995
|
-
/**
|
|
1996
|
-
* Net File line items for AT1 Schedule 8: one PCD occurrence per contribution
|
|
1997
|
-
* (002 name, 004 receipt number, 006 date, 008 amount), plus the two APC
|
|
1998
|
-
* partnership totals (012, 013).
|
|
1999
|
-
*
|
|
2000
|
-
* Does NOT emit jacket line 000074 (the actual tax credit) — that is a
|
|
2001
|
-
* jacket line, not a Schedule 8 line. Use `result.credit` for that.
|
|
2002
|
-
*/
|
|
2003
|
-
function schedule8Values$1(result) {
|
|
2004
|
-
const values = [];
|
|
2005
|
-
result.contributions.forEach((c, i) => {
|
|
2006
|
-
const n = i + 1;
|
|
2007
|
-
const put = (fieldId, value) => values.push({
|
|
2008
|
-
lineItemId: at1LineItemId("008", fieldId, n),
|
|
2009
|
-
value
|
|
2010
|
-
});
|
|
2011
|
-
put("002", c.name);
|
|
2012
|
-
put("004", c.receiptNumber);
|
|
2013
|
-
put("006", c.dateOfDonation);
|
|
2014
|
-
put("008", Math.max(0, Math.round(c.amount)));
|
|
2015
|
-
});
|
|
2016
|
-
values.push({
|
|
2017
|
-
lineItemId: at1LineItemId("008", "012"),
|
|
2018
|
-
value: result.partnershipContributionsTo2003
|
|
2019
|
-
});
|
|
2020
|
-
values.push({
|
|
2021
|
-
lineItemId: at1LineItemId("008", "013"),
|
|
2022
|
-
value: result.partnershipContributionsFrom2004
|
|
2023
|
-
});
|
|
2024
|
-
return {
|
|
2025
|
-
scheduleId: "008",
|
|
2026
|
-
values
|
|
2027
|
-
};
|
|
2028
|
-
}
|
|
2029
|
-
//#endregion
|
|
2030
|
-
//#region src/t2/at1/schedules/schedule9-sred-tax-credit.ts
|
|
2031
|
-
const nn$29 = (v) => Math.max(0, Math.round(v ?? 0));
|
|
2032
|
-
/** Signed whole-dollar rounding, for fields the spec marks "+/-". */
|
|
2033
|
-
const signed = (v) => Math.round(v);
|
|
2034
|
-
/** 009120's flat rate — "lesser of line 009031 and 009108 X 10%". */
|
|
2035
|
-
const ALBERTA_SRED_TAX_CREDIT_RATE = .1;
|
|
2036
|
-
/** Alberta's SR&ED program did not exist before this date (line 009104's note). */
|
|
2037
|
-
const ALBERTA_SRED_PROGRAM_START = "2009-01-01";
|
|
2038
|
-
/** Alberta SR&ED expenditures carried out after this date are not eligible (module docstring). */
|
|
2039
|
-
const ALBERTA_SRED_EXPENDITURE_CUTOFF = "2019-12-31";
|
|
2040
|
-
/**
|
|
2041
|
-
* 009104 / 009206's day-prorated $4,000,000 expenditure limit. Days are clamped
|
|
2042
|
-
* to [0, 366] — 366 only for a year genuinely spanning a February 29, per the
|
|
2043
|
-
* spec's own note.
|
|
2044
|
-
*/
|
|
2045
|
-
function computeSchedule9MaximumExpenditureLimit(daysInTaxYear = 365) {
|
|
2046
|
-
return Math.round(4e6 * (Math.max(0, Math.min(daysInTaxYear, 366)) / 365));
|
|
2047
|
-
}
|
|
2048
|
-
function computeAlbertaSchedule9(input) {
|
|
2049
|
-
const issues = [];
|
|
2050
|
-
const federalQualifiedExpenditures = nn$29(input.federalQualifiedExpenditures);
|
|
2051
|
-
const albertaPortionOfExpenditures = nn$29(input.albertaPortionOfExpenditures);
|
|
2052
|
-
const federalProxyAmountInAlbertaPortion = nn$29(input.federalProxyAmountInAlbertaPortion);
|
|
2053
|
-
const albertaProxyAmount = nn$29(input.albertaProxyAmount);
|
|
2054
|
-
const albertaCreditReducingFederalExpense = nn$29(input.albertaCreditReducingFederalExpense);
|
|
2055
|
-
const priorYearFederalItcReceived = nn$29(input.priorYearFederalItcReceived);
|
|
2056
|
-
const totalAlbertaExpendituresAllYears = nn$29(input.totalAlbertaExpendituresAllYears);
|
|
2057
|
-
const totalFederalExpendituresAllYears = nn$29(input.totalFederalExpendituresAllYears);
|
|
2058
|
-
const albertaPortionOfRepayments = nn$29(input.albertaPortionOfRepayments);
|
|
2059
|
-
const disposalRecapture = nn$29(input.disposalRecapture);
|
|
2060
|
-
const priorYearFederalItcAdjustment = nn$29(input.priorYearFederalItcAdjustment);
|
|
2061
|
-
if (albertaPortionOfExpenditures > federalQualifiedExpenditures) issues.push(`Alberta Schedule 9: the Alberta portion of expenditures (009005 = ${albertaPortionOfExpenditures}) exceeds the federal total (009003 = ${federalQualifiedExpenditures}). 009005 must not exceed 009003.`);
|
|
2062
|
-
const priorYearItcAlbertaPortion = totalFederalExpendituresAllYears > 0 ? Math.round(priorYearFederalItcReceived * totalAlbertaExpendituresAllYears / totalFederalExpendituresAllYears) : 0;
|
|
2063
|
-
if (totalFederalExpendituresAllYears === 0 && priorYearFederalItcReceived > 0) issues.push("Alberta Schedule 9: a prior-year federal ITC (009015) was supplied but total federal expenditures for those years (009019) is nil, so no Alberta portion (009023) could be allocated. Supply 009019 if a prior-year ITC allocation is expected.");
|
|
2064
|
-
const derivedEligibleExpenditures = albertaPortionOfExpenditures - federalProxyAmountInAlbertaPortion + albertaProxyAmount + albertaCreditReducingFederalExpense - priorYearItcAlbertaPortion + albertaPortionOfRepayments;
|
|
2065
|
-
const eligibleExpenditures = input.eligibleExpenditures !== void 0 ? signed(input.eligibleExpenditures) : derivedEligibleExpenditures;
|
|
2066
|
-
if (input.eligibleExpenditures === void 0) issues.push(`Alberta Schedule 9: line 009031 ("Total eligible expenditures for Alberta purposes") has no formula in the TRA spec's mapping tables (the text jumps from 009025 to 009040). Derived here as 005 − 007 + 009 + 011 − 023 + 025 = ${derivedEligibleExpenditures}, from the lines the spec captions unambiguously "Deduct"/"Add". Supply eligibleExpenditures directly to override with the authoritative figure — see the Guide to Claiming the Alberta SR&ED Tax Credit.`);
|
|
2067
|
-
if (input.fieldOfScience === void 0) issues.push("Alberta Schedule 9: line 009040 (primary field of science or technology) is mandatory on the live form and was not supplied.");
|
|
2068
|
-
const isAssociated = input.isAssociated ?? false;
|
|
2069
|
-
const nonAssociatedMaximumExpenditureLimit = computeSchedule9MaximumExpenditureLimit(input.daysInTaxYear ?? 365);
|
|
2070
|
-
let maximumExpenditureLimit;
|
|
2071
|
-
if (isAssociated) if (input.allocatedExpenditureLimit === void 0) {
|
|
2072
|
-
issues.push("Alberta Schedule 9: the corporation is associated (009100 = 1) but no allocated expenditure limit (009102) was supplied. Complete the Allocation of the Maximum Expenditure Limit (page 3) and pass its result as allocatedExpenditureLimit — see allocateSchedule9ExpenditureLimit.");
|
|
2073
|
-
maximumExpenditureLimit = 0;
|
|
2074
|
-
} else maximumExpenditureLimit = nn$29(input.allocatedExpenditureLimit);
|
|
2075
|
-
else maximumExpenditureLimit = nonAssociatedMaximumExpenditureLimit;
|
|
2076
|
-
if (input.taxationYearEnd !== void 0 && input.taxationYearEnd > "2019-12-31") issues.push(`Alberta Schedule 9: the taxation year end (${input.taxationYearEnd}) falls after ${ALBERTA_SRED_EXPENDITURE_CUTOFF}. The Alberta SR&ED Tax Credit may not be claimed for expenditures carried out in Alberta after that date — confirm albertaPortionOfExpenditures (009005) excludes any post-cutoff spending.`);
|
|
2077
|
-
const netCredit = Math.round(Math.min(eligibleExpenditures, maximumExpenditureLimit) * ALBERTA_SRED_TAX_CREDIT_RATE) - disposalRecapture - priorYearFederalItcAdjustment;
|
|
2078
|
-
return {
|
|
2079
|
-
federalQualifiedExpenditures,
|
|
2080
|
-
albertaPortionOfExpenditures,
|
|
2081
|
-
federalProxyAmountInAlbertaPortion,
|
|
2082
|
-
albertaProxyAmount,
|
|
2083
|
-
albertaCreditReducingFederalExpense,
|
|
2084
|
-
priorYearFederalItcReceived,
|
|
2085
|
-
totalAlbertaExpendituresAllYears,
|
|
2086
|
-
totalFederalExpendituresAllYears,
|
|
2087
|
-
priorYearItcAlbertaPortion,
|
|
2088
|
-
albertaPortionOfRepayments,
|
|
2089
|
-
eligibleExpenditures,
|
|
2090
|
-
derivedEligibleExpenditures,
|
|
2091
|
-
fieldOfScience: input.fieldOfScience,
|
|
2092
|
-
isAssociated,
|
|
2093
|
-
nonAssociatedMaximumExpenditureLimit,
|
|
2094
|
-
maximumExpenditureLimit,
|
|
2095
|
-
disposalRecapture,
|
|
2096
|
-
priorYearFederalItcAdjustment,
|
|
2097
|
-
netCredit,
|
|
2098
|
-
issues
|
|
2099
|
-
};
|
|
2100
|
-
}
|
|
2101
|
-
/**
|
|
2102
|
-
* Allocate the day-prorated $4,000,000 maximum expenditure limit among an
|
|
2103
|
-
* associated group (page 3). Per the spec, EACH occurrence of 009240 and the
|
|
2104
|
-
* SUM of all occurrences are independently capped at the limit — unlike a
|
|
2105
|
-
* running-remainder split, one member requesting more than the limit does not
|
|
2106
|
-
* consume another member's room; it is simply capped and flagged.
|
|
2107
|
-
*/
|
|
2108
|
-
function allocateSchedule9ExpenditureLimit(daysInLongestYear, requested) {
|
|
2109
|
-
const issues = [];
|
|
2110
|
-
const days = Math.max(0, Math.min(daysInLongestYear, 366));
|
|
2111
|
-
const maximumExpenditureLimit = computeSchedule9MaximumExpenditureLimit(days);
|
|
2112
|
-
const members = requested.map((m) => {
|
|
2113
|
-
const requestedAmount = nn$29(m.allocated);
|
|
2114
|
-
if (requestedAmount > maximumExpenditureLimit) issues.push(`Alberta Schedule 9: ${m.name} was allocated ${requestedAmount}, exceeding the maximum expenditure limit of ${maximumExpenditureLimit} (009240 cannot exceed $4,000,000 x 009206/365). Capped at ${maximumExpenditureLimit}.`);
|
|
2115
|
-
return {
|
|
2116
|
-
name: m.name,
|
|
2117
|
-
...m.albertaCan !== void 0 ? { albertaCan: m.albertaCan } : {},
|
|
2118
|
-
allocated: Math.min(requestedAmount, maximumExpenditureLimit)
|
|
2119
|
-
};
|
|
2120
|
-
});
|
|
2121
|
-
const totalAllocated = members.reduce((s, m) => s + m.allocated, 0);
|
|
2122
|
-
if (totalAllocated > maximumExpenditureLimit) issues.push(`Alberta Schedule 9: the associated group allocated a total of ${totalAllocated}, exceeding the maximum expenditure limit of ${maximumExpenditureLimit} (the sum of all 009240 occurrences cannot exceed $4,000,000 x 009206/365). The group must agree a valid split.`);
|
|
2123
|
-
return {
|
|
2124
|
-
daysInLongestYear: days,
|
|
2125
|
-
maximumExpenditureLimit,
|
|
2126
|
-
members,
|
|
2127
|
-
totalAllocated,
|
|
2128
|
-
claimantAllocatedAmount: members[0]?.allocated ?? 0,
|
|
2129
|
-
unallocated: Math.max(0, maximumExpenditureLimit - totalAllocated),
|
|
2130
|
-
issues
|
|
2131
|
-
};
|
|
2132
|
-
}
|
|
2133
|
-
function schedule9LineItemId(fieldId, occurrence = 1) {
|
|
2134
|
-
return `009${fieldId}${String(occurrence).padStart(3, "0")}`;
|
|
2135
|
-
}
|
|
2136
|
-
/**
|
|
2137
|
-
* Field ids per the spec transcription in the module docstring: 003-025 (the
|
|
2138
|
-
* expenditure buildup), 040 (field of science), 100-120 (the credit
|
|
2139
|
-
* calculation), and — when `group` is supplied — 200-240 (page 3's
|
|
2140
|
-
* allocation). Line 031 has no confirmed transmitted status of its own (see
|
|
2141
|
-
* the module docstring's "line 009031 has no formula in the spec text"), but
|
|
2142
|
-
* is filed anyway alongside 106 since both carry the identical "Total
|
|
2143
|
-
* eligible expenditures for Alberta purposes" figure per the spec's own
|
|
2144
|
-
* cross-reference ("106 ... Value must equal 009031").
|
|
2145
|
-
*/
|
|
2146
|
-
function schedule9Values(result, group) {
|
|
2147
|
-
const values = [];
|
|
2148
|
-
const put = (fieldId, value) => values.push({
|
|
2149
|
-
lineItemId: schedule9LineItemId(fieldId),
|
|
2150
|
-
value
|
|
2151
|
-
});
|
|
2152
|
-
put("003", result.federalQualifiedExpenditures);
|
|
2153
|
-
put("005", result.albertaPortionOfExpenditures);
|
|
2154
|
-
put("007", result.federalProxyAmountInAlbertaPortion);
|
|
2155
|
-
put("009", result.albertaProxyAmount);
|
|
2156
|
-
put("011", result.albertaCreditReducingFederalExpense);
|
|
2157
|
-
put("015", result.priorYearFederalItcReceived);
|
|
2158
|
-
put("017", result.totalAlbertaExpendituresAllYears);
|
|
2159
|
-
put("019", result.totalFederalExpendituresAllYears);
|
|
2160
|
-
put("023", result.priorYearItcAlbertaPortion);
|
|
2161
|
-
put("025", result.albertaPortionOfRepayments);
|
|
2162
|
-
put("031", result.eligibleExpenditures);
|
|
2163
|
-
if (result.fieldOfScience !== void 0) put("040", result.fieldOfScience);
|
|
2164
|
-
put("100", result.isAssociated ? 1 : 2);
|
|
2165
|
-
if (result.isAssociated) put("102", result.maximumExpenditureLimit);
|
|
2166
|
-
else put("104", result.nonAssociatedMaximumExpenditureLimit);
|
|
2167
|
-
put("106", result.eligibleExpenditures);
|
|
2168
|
-
put("108", result.maximumExpenditureLimit);
|
|
2169
|
-
put("112", result.disposalRecapture);
|
|
2170
|
-
put("116", result.priorYearFederalItcAdjustment);
|
|
2171
|
-
put("120", result.netCredit);
|
|
2172
|
-
if (group) {
|
|
2173
|
-
if (group.longestYearCan !== void 0) values.push({
|
|
2174
|
-
lineItemId: schedule9LineItemId("200"),
|
|
2175
|
-
value: group.longestYearCan
|
|
2176
|
-
});
|
|
2177
|
-
if (group.longestYearBegin !== void 0) values.push({
|
|
2178
|
-
lineItemId: schedule9LineItemId("202"),
|
|
2179
|
-
value: group.longestYearBegin
|
|
2180
|
-
});
|
|
2181
|
-
if (group.longestYearEnd !== void 0) values.push({
|
|
2182
|
-
lineItemId: schedule9LineItemId("204"),
|
|
2183
|
-
value: group.longestYearEnd
|
|
2184
|
-
});
|
|
2185
|
-
values.push({
|
|
2186
|
-
lineItemId: schedule9LineItemId("206"),
|
|
2187
|
-
value: group.allocation.daysInLongestYear
|
|
2188
|
-
});
|
|
2189
|
-
group.allocation.members.forEach((m, i) => {
|
|
2190
|
-
const occurrence = i + 1;
|
|
2191
|
-
values.push({
|
|
2192
|
-
lineItemId: schedule9LineItemId("220", occurrence),
|
|
2193
|
-
value: m.name
|
|
2194
|
-
});
|
|
2195
|
-
if (m.albertaCan !== void 0) values.push({
|
|
2196
|
-
lineItemId: schedule9LineItemId("230", occurrence),
|
|
2197
|
-
value: m.albertaCan
|
|
2198
|
-
});
|
|
2199
|
-
values.push({
|
|
2200
|
-
lineItemId: schedule9LineItemId("240", occurrence),
|
|
2201
|
-
value: m.allocated
|
|
2202
|
-
});
|
|
2203
|
-
});
|
|
2204
|
-
}
|
|
2205
|
-
return {
|
|
2206
|
-
scheduleId: "009",
|
|
2207
|
-
values
|
|
2208
|
-
};
|
|
2209
|
-
}
|
|
2210
|
-
//#endregion
|
|
2211
1552
|
//#region src/t2/at1/schedules/schedule15-resource-related-deductions.ts
|
|
2212
1553
|
/**
|
|
2213
1554
|
* Alberta AT1 Schedule 15 — Alberta Resource Related Deductions.
|
|
@@ -3760,26 +3101,6 @@ function computeAlbertaReturn(input) {
|
|
|
3760
3101
|
schedulePayloads.push(schedule4Values(sched.foreignInvestmentTaxCredit));
|
|
3761
3102
|
issues.push(...sched.foreignInvestmentTaxCredit.issues);
|
|
3762
3103
|
}
|
|
3763
|
-
if (sched?.royaltyTaxDeduction) {
|
|
3764
|
-
schedulePayloads.push(schedule5Values(sched.royaltyTaxDeduction));
|
|
3765
|
-
issues.push(...sched.royaltyTaxDeduction.issues);
|
|
3766
|
-
}
|
|
3767
|
-
if (sched?.royaltyTaxCredit) {
|
|
3768
|
-
schedulePayloads.push(schedule6Values(sched.royaltyTaxCredit));
|
|
3769
|
-
issues.push(...sched.royaltyTaxCredit.issues);
|
|
3770
|
-
}
|
|
3771
|
-
if (sched?.royaltySupplemental) {
|
|
3772
|
-
schedulePayloads.push(schedule7Values$1(sched.royaltySupplemental));
|
|
3773
|
-
issues.push(...sched.royaltySupplemental.issues);
|
|
3774
|
-
}
|
|
3775
|
-
if (sched?.politicalContributions) {
|
|
3776
|
-
schedulePayloads.push(schedule8Values$1(sched.politicalContributions));
|
|
3777
|
-
issues.push(...sched.politicalContributions.issues);
|
|
3778
|
-
}
|
|
3779
|
-
if (sched?.sredTaxCredit) {
|
|
3780
|
-
schedulePayloads.push(schedule9Values(sched.sredTaxCredit.result, sched.sredTaxCredit.group));
|
|
3781
|
-
issues.push(...sched.sredTaxCredit.result.issues);
|
|
3782
|
-
}
|
|
3783
3104
|
if (sched?.lossCarryback) schedulePayloads.push(schedule10Values(sched.lossCarryback));
|
|
3784
3105
|
if (sched?.reconciliation) schedulePayloads.push(schedule12Values(sched.reconciliation));
|
|
3785
3106
|
if (sched?.cca) {
|
|
@@ -3857,15 +3178,29 @@ const at1Engine = {
|
|
|
3857
3178
|
//#endregion
|
|
3858
3179
|
//#region src/t2/at1/filing/at1-line-items.ts
|
|
3859
3180
|
/**
|
|
3860
|
-
* AT1 line 000090 — balance unpaid (overpayment),
|
|
3181
|
+
* AT1 line 000090 — balance unpaid (overpayment), as the PRINTED form strikes
|
|
3182
|
+
* it:
|
|
3183
|
+
*
|
|
3184
|
+
* 000088 = 000129 + 000082 + 000085 + 000086 + 000115 + 000087
|
|
3185
|
+
* 000090 = 000080 − 000088
|
|
3861
3186
|
*
|
|
3862
|
-
*
|
|
3187
|
+
* 088 is a printed subtotal with no line code of its own, so only 090 is
|
|
3188
|
+
* filed. Signed — a negative result is an overpayment, and line 000092 then
|
|
3189
|
+
* chooses between a refund and applying it to next year.
|
|
3863
3190
|
*
|
|
3864
|
-
*
|
|
3865
|
-
*
|
|
3191
|
+
* This used to follow §3.2.3.1's own line-090 rule,
|
|
3192
|
+
* `000080 - (000081 + 000082 + 00085 + 000086 + 000087)`, which nets the
|
|
3193
|
+
* ELIMINATED Alberta SR&ED tax credit and omits both the Innovation
|
|
3194
|
+
* Employment Grant and the Film and Television Tax Credit — two credits the
|
|
3195
|
+
* same specification marks mandatory. Every corporation claiming an IEG was
|
|
3196
|
+
* therefore filed with a balance overstated by the whole grant. See
|
|
3197
|
+
* `AT1_BALANCE_CREDIT_LINES` in `../forms/jacket.ts` for the full evidence,
|
|
3198
|
+
* and `albertaBalanceUnpaidPerSpec` below for the figure the specification
|
|
3199
|
+
* would produce — the review layer reports the difference rather than letting
|
|
3200
|
+
* the disagreement pass silently.
|
|
3866
3201
|
*/
|
|
3867
3202
|
function albertaBalanceUnpaid(d) {
|
|
3868
|
-
return d.albertaTaxPayable - ((d.
|
|
3203
|
+
return d.albertaTaxPayable - ((d.innovationEmploymentGrant ?? 0) + (d.instalmentsPaid ?? 0) + (d.interactiveDigitalMediaTaxCredit ?? 0) + (d.capitalGainsRefund ?? 0) + (d.filmAndTelevisionTaxCredit ?? 0) + (d.otherCredits ?? 0));
|
|
3869
3204
|
}
|
|
3870
3205
|
/**
|
|
3871
3206
|
* "Critical Mandatory" fields, named in §3.2.3 of the specification:
|
|
@@ -6098,6 +5433,10 @@ function computeAlbertaSchedule18(input) {
|
|
|
6098
5433
|
const abil = (input.abilEntries ?? []).map((e) => ({
|
|
6099
5434
|
name: e.name,
|
|
6100
5435
|
kind: e.kind,
|
|
5436
|
+
...e.dateOfAcquisition ? { dateOfAcquisition: e.dateOfAcquisition } : {},
|
|
5437
|
+
proceeds: nn$23(e.proceeds),
|
|
5438
|
+
acb: nn$23(e.acb),
|
|
5439
|
+
outlays: nn$23(e.outlays),
|
|
6101
5440
|
businessInvestmentLoss: nn$23(e.proceeds) - (nn$23(e.acb) + nn$23(e.outlays))
|
|
6102
5441
|
}));
|
|
6103
5442
|
const totalBil = abil.reduce((s, e) => s + Math.min(0, e.businessInvestmentLoss), 0);
|
|
@@ -9140,6 +8479,24 @@ function computeSchedule101(input) {
|
|
|
9140
8479
|
* schedules): AAII refundable tax + RDTOH, Part IV tax, M&P, associated-group
|
|
9141
8480
|
* allocation, provincial/AT1 tax (computed separately).
|
|
9142
8481
|
*/
|
|
8482
|
+
/**
|
|
8483
|
+
* Every `issues` string the given sub-results raised, in one flat list.
|
|
8484
|
+
*
|
|
8485
|
+
* Deliberately structural rather than a hand-written list of fields: a result
|
|
8486
|
+
* qualifies by HAVING an `issues` array, so a schedule that starts raising them
|
|
8487
|
+
* is surfaced without anyone remembering to come back here. Duplicates are
|
|
8488
|
+
* dropped — two schedules can reach the same conclusion about the same missing
|
|
8489
|
+
* input, and a preparer should be told once.
|
|
8490
|
+
*/
|
|
8491
|
+
function collectIssues(results) {
|
|
8492
|
+
const seen = /* @__PURE__ */ new Set();
|
|
8493
|
+
for (const value of Object.values(results)) {
|
|
8494
|
+
const issues = value?.issues;
|
|
8495
|
+
if (!Array.isArray(issues)) continue;
|
|
8496
|
+
for (const issue of issues) if (typeof issue === "string" && issue !== "") seen.add(issue);
|
|
8497
|
+
}
|
|
8498
|
+
return [...seen];
|
|
8499
|
+
}
|
|
9143
8500
|
/** Date | ISO string | undefined → `YYYY-MM-DD` ('' when absent/invalid). */
|
|
9144
8501
|
function isoDay(v) {
|
|
9145
8502
|
if (v instanceof Date) return Number.isNaN(v.getTime()) ? "" : v.toISOString().slice(0, 10);
|
|
@@ -9683,6 +9040,23 @@ function computeFederalT2(input) {
|
|
|
9683
9040
|
federalTaxPayable: partI.partITaxPayable,
|
|
9684
9041
|
totalFederalTax,
|
|
9685
9042
|
totalTax,
|
|
9043
|
+
issues: collectIssues({
|
|
9044
|
+
eifel: eifelWithIssues,
|
|
9045
|
+
...eifelChain ? {
|
|
9046
|
+
eifelAdjustedTaxableIncome: eifelChain.ati,
|
|
9047
|
+
eifelLimitation: eifelChain.limitation,
|
|
9048
|
+
eifelCapacity: eifelChain.capacity,
|
|
9049
|
+
eifelIfe: eifelChain.ife,
|
|
9050
|
+
eifelIfr: eifelChain.ifr
|
|
9051
|
+
} : {},
|
|
9052
|
+
...partVI1 ? { partVI1 } : {},
|
|
9053
|
+
...class13 ? { class13 } : {},
|
|
9054
|
+
...class14 ? { class14 } : {},
|
|
9055
|
+
...class141AdditionalAllowance ? { class141AdditionalAllowance } : {},
|
|
9056
|
+
...associatedAllocation ? { associatedAllocation } : {},
|
|
9057
|
+
...sredItc ? { sredItc } : {},
|
|
9058
|
+
...firstReturn ? { firstReturn } : {}
|
|
9059
|
+
}),
|
|
9686
9060
|
schedulePayloads: federalSchedulePayloads({
|
|
9687
9061
|
schedule1,
|
|
9688
9062
|
netIncomeForTax: schedule1.netIncomeForTax,
|
|
@@ -10608,4 +9982,4 @@ function computeMpDeduction(input, rates = MP_RATES_2024) {
|
|
|
10608
9982
|
};
|
|
10609
9983
|
}
|
|
10610
9984
|
//#endregion
|
|
10611
|
-
export { computeSchedule6 as $,
|
|
9985
|
+
export { computeSchedule6 as $, resolveRates as $i, resolveCcaRates as $n, computeIegReductionFactor as $r, dividendsDeductibleS112 as $t, LRIP_INVESTMENT_CORPORATION_MULTIPLE as A, schedule12LossDeductions as Ai, AT1_RESERVE_LINES as An, renderRsiHeader as Ar, computeExcessIfe as At, computeZetm as B, schedule2Values$1 as Bi, CLASS_14_1_MINIMUM_DEDUCTION as Bn, assertCriticalFields as Br, assessEifel as Bt, runConformance as C, SINGLE_JURISDICTION_ALBERTA_FACTOR as Ci, AT1_DONATION_INCOME_RATE as Cn, RSI_NEGATIVE_PREFIX as Cr, EIFEL_STANDARD_RATIO_FROM as Ct, SCHEDULE_88_MAX_URLS as D, AT1_SCHEDULES_WITH_BUILDERS as Di, SECTION_34_2_GROSS_UP as Dn, formatRsiDate as Dr, computeBorrowings as Dt, computeSchedule101 as E, AT1_SCHEDULES_WITHOUT_BUILDERS as Ei, AT1_DISPOSITION_CATEGORIES as En, formatRsiAmount as Er, ratioOfPermissibleExpenses as Et, LARGE_CORPORATION_THRESHOLD as F, schedule18Values as Fi, computeAlbertaSchedule13 as Fn, At1MandatoryFieldMissingError as Fr, computeLossPortionFromIfe as Ft, computeCde as G, computeDayWeightedGeneralTax as Gi, computeClass13 as Gn, computeAlbertaReturn as Gr, PROVINCE_RATES_2024 as Gt, computeBusinessLimitAllocation as H, computeAlbertaTax as Hi, CLASS_14_1_TRANSITIONAL_RATE as Hn, at1YesNo as Hr, computeRifeUnderSubsection111_8 as Ht, computeTaxableCapital as I, schedule1Values$1 as Ii, UnsupportedCcaClassError as In, At1TaxPayableMismatchError as Ir, computePartnershipIfe as It, computeCumulativeForeignResource as J, resolveAlbertaTaxRates as Ji, computeClass141RecaptureReduction as Jn, computeIegAgreement as Jr, resolveProvinceRates as Jt, computeCee as K, AB_TAX_2024 as Ki, computeClass14 as Kn, allocateIegEvenly as Kr, PROVINCE_RATE_BOOK as Kt, computeSchedule31 as L, schedule20Values as Li, computeCcaClass as Ln, albertaBalanceUnpaid as Lr, computePartnershipIfeAddBack as Lt, computeSchedule54 as M, schedule13Values as Mi, computeAlbertaSchedule17 as Mn, renderAt1NetFile as Mr, computeInterestAndFinancingExpenses as Mt, computeGrip as N, schedule16Values as Ni, assistanceFrom as Nn, AT1_CRITICAL_MANDATORY_FIELDS as Nr, computeInterestAndFinancingRevenues as Nt, normalizeSchedule88 as O, at1LineItemId as Oi, computeAlbertaSchedule18 as On, formatRsiText as Or, computeCapitalizedIfe as Ot, computeSchedule43 as P, schedule17Values as Pi, computeAlbertaSchedule16 as Pn, At1CriticalFieldMissingError as Pr, computeLoans as Pt, computeSpecifiedForeignExploration as Q, latestRateYear as Qi, isDecliningBalanceClass as Qn, computeIegBaseAmount as Qr, computeTaxableIncome as Qt, ITC_RECAPTURE_PERIOD_YEARS as R, schedule21Values$1 as Ri, computeCcaSchedule as Rn, assertAt1MandatoryComplete as Rr, computeResourceIfe as Rt, formatConformanceReport as S, schedule3Values as Si, AT1_DONATION_GAIN_RATE as Sn, RSI_DELIMITER as Sr, EIFEL_STANDARD_RATIO as St, computeFederalT2 as T, computeAt4970 as Ti, computeSchedule20 as Tn, RsiLineItemError as Tr, computeEifelLimitation as Tt, computeSchedule21 as U, computeAlbertaSbd as Ui, MAX_LEASEHOLD_PERIODS as Un, xmlEscape as Ur, FOREIGN_TAX_CREDIT_GROSS_UP as Ut, allocateEvenly as V, schedule4970Values as Vi, CLASS_14_1_RECAPTURE_REDUCTION_RATE as Vn, at1TaxPayableDeductions as Vr, computeEifelCapacity as Vt, computeSchedule13 as W, AB_GENERAL_RATE_BANDS as Wi, MIN_LEASEHOLD_PERIODS as Wn, at1Engine as Wr, computeAdjustedTaxableIncome as Wt, computeForeignExploration as X, extendRateBook as Xi, CCA_DECLINING_BALANCE_RATES_2024 as Xn, IEG_2024 as Xr, dayWeightedRate as Xt, computeDepletion as Y, earliestRateYear as Yi, leaseholdPeriods as Yn, computeIegGroupFigures as Yr, blendProvinceRateTable as Yt, computeSchedule12ResourceDeductions as Z, hasExactRateYear as Zi, CCA_RATE_BOOK as Zn, computeIeg as Zr, charitableDonationsDeduction as Zt, QC_TAX_2024 as _, computeSfedeCountrySuccessor as _i, computeRifeContinuity as _n, toRsiHeader as _r, terminalLossDeduction as _t, computeCanadianMPProfits as a, computeCdeRegular as ai, computeAggregateInvestmentIncome as an, albertaDispositionAdjustments as ar, computePart4Rdtoh as at, T2_LINE_META as b, schedule4Values as bi, computeLimitedPartnershipLossRow as bn, toRsiSchedule as br, partVI1DeductionMultiple as bt, computeSmallManufacturerTest as c, computeCeeSuccessor as ci, CORP_TAX_2024 as cn, albertaResourceDeductionDifference as cr, amortizationAddBack as ct, t2Engine as d, computeCmedb as di, federalSchedulePayloads as dn, reconcileAlbertaNetIncome as dr, computeSchedule1 as dt, computeIegEligibleExpenditures as ei, netCapitalLossApplied as en, albertaAbilDifference as er, computeProvincialAllocation as et, renderCo17DraftReturn as f, computeEdaRegular as fi, parseT2LineItemId as fn, LossCarrybackError as fr, deferredIncomeTaxProvisionAddBack as ft, computeQuebecTax as g, computeSfedeCountryRegular as gi, computeOtherLossByYearOfOrigin as gn, validateAt1Transmitter as gr, recaptureAddBack as gt, computeQuebecAllocationFactor as h, computeFedeSuccessor as hi, computeNonCapitalLossByYearOfOrigin as hn, assertAt1TransmitterValid as hr, mealsAndEntertainmentAddBack as ht, SMALL_MANUFACTURER_INCOME_THRESHOLD as i, computeCcogpeSuccessor as ii, computeAdjustedAggregateInvestmentIncome as in, albertaCurrentYearLoss as ir, REFUNDABLE_PART_I_RATE as it, LRIP_INVESTMENT_INCOME_FACTOR as j, schedule12Values as ji, AT1_RESERVE_TOTAL_LINES as jn, renderRsiLineItem as jr, computeExemptIfe as jt, computeSchedule55 as k, schedule10Values as ki, AT1_RESERVE_KINDS as kn, renderAt1Rsi as kr, computeClause95Amounts as kt, computeT2Settlement as l, computeCfreRegular as li, CORP_TAX_RATE_BOOK as ln, albertaTerminalLossDifference as lr, assertSchedule1Fileable as lt, computeQuebecReturn as m, computeFedeRegular as mi, T2_CERTIFICATION_FIXTURES as mn, At1TransmitterInvalidError as mr, incomeTaxProvisionAddBack as mt, MP_GROSS_REVENUE_THRESHOLD as n, computeAlbertaSchedule15 as ni, computeCcpcActiveBusinessTax as nn, albertaCcaDifference as nr, computeSchedule4Losses as nt, computeMpDeduction as o, computeCdeSuccessor as oi, computeBusinessLimit as on, albertaRecaptureDifference as or, computeSchedule2 as ot, co17Engine as p, computeEdaSuccessor as pi, t2LineItemId as pn, computeLossCarryback as pr, findSchedule1LineDefects as pt, computeCogpe as q, AB_TAX_RATE_BOOK as qi, computeClass141AdditionalAllowance as qn, allocateIegExpenditureLimit as qr, isSchedule5Province as qt, MP_RATES_2024 as r, computeCcogpeRegular as ri, computePartITax as rn, albertaCcaScheduleAdjustments as rr, PART_IV_RATE as rt, computePart2MPProfits as s, computeCeeRegular as si, computeSBD as sn, albertaReserveDifference as sr, Schedule1NotFileableError as st, MP_EXCLUDED_ACTIVITIES as t, iegT661SourceLine as ti, nonCapitalLossApplied as tn, albertaCapitalGainDifference as tr, computeSchedule5 as tt, renderT2DraftReturn as u, computeCfreSuccessor as ui, resolveCorpTaxRates as un, computeSchedule12 as ur, ccaDeduction as ut, QC_TAX_RATE_BOOK as v, schedule15Values as vi, computeLossSchedule as vn, toRsiJacketSchedules as vr, PART_VI_1_DEDUCTION_BANDS as vt, runConformanceSuite as w, computeAllocationFactor as wi, computeDonationMaximum as wn, RSI_WORD_GAP as wr, EIFEL_TRANSITIONAL_RATIO as wt, foldT2Lines as x, computeSchedule3 as xi, computeLimitedPartnershipLosses as xn, RSI_COLUMN_GAP as xr, EIFEL_FIRST_YEAR_START as xt, resolveQuebecTaxRates as y, computeSchedule4 as yi, computeLossContinuity as yn, toRsiLineItems as yr, computePartVI1Deduction as yt, computeItcRecapture as z, schedule29Values as zi, computeSchedule8 as zn, assertAt1TaxPayableReconciles as zr, EIFEL_EFFECTIVE_FROM as zt };
|