Add UnsupportedLine, to formalize a comment convention that exists in fed2019.
[ustaxlib.git] / src / fed2019 / 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 Form1040, { FilingStatus } from './Form1040';
11 import Form1099DIV from './Form1099DIV';
12 import Form1099INT from './Form1099INT';
13 import Form1116 from './Form1116';
14 import Schedule2 from './Schedule2';
15
16 export interface Schedule3Input {
17 estimatedTaxPayments?: number;
18 };
19
20 export default class Schedule3 extends Form<Schedule3['lines'], Schedule3Input> {
21 readonly name = 'Schedule 3';
22
23 readonly lines = {
24 // Part 1
25 '1': new ComputedLine((tr): number => {
26 const f1040 = tr.getForm(Form1040);
27
28 const totalForeignTax = (new AccumulatorLine(Form1099DIV, '7')).value(tr) +
29 (new AccumulatorLine(Form1099INT, '6')).value(tr);
30 const limit = f1040.filingStatus == FilingStatus.MarriedFilingJoint ? 600 : 300;
31
32 if (totalForeignTax < limit) {
33 const sched2l2 = new ReferenceLine(Schedule2, '2', undefined, 0);
34 return Math.min(totalForeignTax, f1040.getValue(tr, '12a') + sched2l2.value(tr));
35 }
36 return tr.getForm(Form1116).getValue(tr, '33');
37 }, 'Foreign tax credit'),
38 '2': new UnsupportedLine('Credit for child and dependent care expenses. Attach Form 2441'),
39 '3': new UnsupportedLine('Education credits from Form 8863, line 19'),
40 '4': new UnsupportedLine('Retirement savings contributions credit. Attach Form 8880'),
41 '5': new UnsupportedLine('Residential energy credits. Attach Form 5695'),
42 '6a': new UnsupportedLine('Form 3800'),
43 '6b': new UnsupportedLine('Form 8801'),
44 '6c': new UnsupportedLine('Other nonrefundable credits'),
45 '7': new ComputedLine((tr): number => {
46 return sumFormLines(tr, this, ['1', '2', '3', '4', '5', '6a', '6b', '6c']);
47 }),
48
49 // Part 2
50 '8': new InputLine<Schedule3Input>('estimatedTaxPayments'),
51 '9': new UnsupportedLine('Net premium tax credit. Attach Form 8962'),
52 '10': new UnsupportedLine('Amount paid with request for extension to file (see instructions)'),
53 '11': new UnsupportedLine('Excess social security and tier 1 RRTA tax withheld'),
54 '12': new UnsupportedLine('Credit for federal tax on fuels. Attach Form 4136'),
55 '13a': new UnsupportedLine('Form 2439'),
56 // 13b is reserved
57 '13c': new UnsupportedLine('Form 8885'),
58 '13d': new UnsupportedLine('Other refundable credits'),
59 '14': new ComputedLine((tr): number => {
60 return sumFormLines(tr, this, ['8', '9', '10', '11', '12', '13a', '13c', '13d']);
61 }),
62 };
63 };