]> src.bluestatic.org Git - ustaxlib.git/blob - fed2020/Schedule3.ts
Upgrade to Node v16 for Github workflows.
[ustaxlib.git] / fed2020 / Schedule3.ts
1 // Copyright 2020 Blue Static <https://www.bluestatic.org>
2 // This program is free software licensed under the GNU General Public License,
3 // version 3.0. The full text of the license can be found in LICENSE.txt.
4 // SPDX-License-Identifier: GPL-3.0-only
5
6 import { Form, TaxReturn } from '../core';
7 import { AccumulatorLine, ComputedLine, InputLine, ReferenceLine, UnsupportedLine, sumFormLines } from '../core/Line';
8 import { NotFoundError, UnsupportedFeatureError } from '../core/Errors';
9
10 import { Schedule3 as Schedule3_2019 } from '../fed2019';
11
12 import { Form1040, FilingStatus } from '.';
13 import { Form1099DIV } from '.';
14 import { Form1099INT } from '.';
15 import { Form1116 } from '.';
16 import { Schedule2 } from '.';
17
18 export default class Schedule3 extends Schedule3_2019 {
19 readonly name = 'Schedule 3';
20
21 readonly lines = {
22 // Part 1
23 '1': new ComputedLine((tr): number => {
24 const f1040 = tr.getForm(Form1040);
25
26 const totalForeignTax = (new AccumulatorLine(Form1099DIV, '7')).value(tr) +
27 (new AccumulatorLine(Form1099INT, '6')).value(tr);
28 const limit = tr.constants.foreignTaxCreditWithoutForm1116Limit[f1040.filingStatus];
29
30 if (totalForeignTax < limit) {
31 const sched2l2 = new ReferenceLine(Schedule2, '2', undefined, 0);
32 return Math.min(totalForeignTax, f1040.tax(tr) + sched2l2.value(tr));
33 }
34 // This should be line 35, to make up for the new lines 22 and 23 in the 2020 F1116,
35 // but those would be unsupported. Instead, use the 2019 form and read the old line
36 // (33) for the same result value.
37 return tr.getForm(Form1116).getValue(tr, '33');
38 }, 'Foreign tax credit'),
39 '2': new UnsupportedLine('Credit for child and dependent care expenses. Attach Form 2441'),
40 '3': new UnsupportedLine('Education credits from Form 8863, line 19'),
41 '4': new UnsupportedLine('Retirement savings contributions credit. Attach Form 8880'),
42 '5': new UnsupportedLine('Residential energy credits. Attach Form 5695'),
43 '6a': new UnsupportedLine('Form 3800'),
44 '6b': new UnsupportedLine('Form 8801'),
45 '6c': new UnsupportedLine('Other nonrefundable credits'),
46 '7': new ComputedLine((tr): number => {
47 return sumFormLines(tr, this, ['1', '2', '3', '4', '5', '6a', '6b', '6c']);
48 }),
49
50 // Part 2
51 '8': new UnsupportedLine('Net premium tax credit. Attach Form 8962'),
52 '9': new UnsupportedLine('Amount paid with request for extension to file (see instructions)'),
53 '10': new UnsupportedLine('Excess social security and tier 1 RRTA tax withheld'),
54 '11': new UnsupportedLine('Credit for federal tax on fuels. Attach Form 4136'),
55 '12a': new UnsupportedLine('Form 2439'),
56 '12b': new UnsupportedLine('Qualified sick and family leave credits from Schedule H and Form 7202'),
57 '12c': new UnsupportedLine('Health coverage credit from Form 8885'),
58 '12d': new UnsupportedLine('Other'),
59 '12e': new UnsupportedLine('Deferral for certain Schedule H or SE filers'),
60 '12f': new ComputedLine((tr) => sumFormLines(tr, this, ['12a', '12b', '12c', '12d', '12e'])),
61 '13': new ComputedLine((tr) => sumFormLines(tr, this, ['8', '9', '10', '11', '12f'])),
62 };
63 };