]> src.bluestatic.org Git - ustaxlib.git/blob - src/fed2019/Form8960.ts
Simplify the Trace API further.
[ustaxlib.git] / src / fed2019 / Form8960.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 { ComputedLine, ReferenceLine } from '../core/Line';
8 import { clampToZero } from '../core/Math';
9
10 import Form1040, { FilingStatus } from './Form1040';
11 import Schedule1 from './Schedule1';
12
13 export default class Form8960 extends Form<Form8960['_lines']> {
14 readonly name = '8960';
15
16 protected readonly _lines = {
17 // Part 1
18 // Section 6013 elections not supported.
19 '1': new ReferenceLine(Form1040, '2b', 'Taxable interest'),
20 '2': new ReferenceLine(Form1040, '3b', 'Ordinary dividends'),
21 // 3 not supported - Annuities
22 // 4a not supported - Rental real estate, royalties, partnerships, S corporations, trusts, etc
23 // 4b not supported - Adjustment for net income or loss derived in the ordinary course of a nonsection 1411 trade or business
24 // 4c not supported - 4a+4b
25 '5a': new ComputedLine((tr): number => {
26 return (new ReferenceLine(Form1040, '6')).value(tr) +
27 (new ReferenceLine(Schedule1, '4', undefined, 0)).value(tr);
28 }, 'Net gain or loss'),
29 // 5b not supported - Net gain or loss from disposition of property that is not subject to net investment income tax
30 // 5c not supported - Adjustment from disposition of partnership interest or S corporation stock
31 '5d': new ComputedLine((tr): number => {
32 // Should include 5b-5c.
33 return this.getValue(tr, '5a');
34 }),
35 // 6 not supported - Adjustments to investment income for certain CFCs and PFICs
36 // 7 not supported - Other modifications to investment income
37 '8': new ComputedLine((tr): number => {
38 return this.getValue(tr, '1') +
39 this.getValue(tr, '2') +
40 /*this.getValue(tr, '3') +
41 this.getValue(tr, '4c') +*/
42 this.getValue(tr, '5d') /*+
43 this.getValue(tr, '6') +
44 this.getValue(tr, '7')*/;
45 }),
46
47 // Part 2
48 // 9a not supported - Investment interest expenses
49 // 9b not supported - State, local, and foreign income tax
50 // 9c not supported - Miscellaneous investment expenses
51 // 9d not supported - 9a+9b+9c
52 // 10 not supported - Additional modifications
53 '11': new ComputedLine(() => 0, 'Total deductions and modifications'), // Not supported - 9d+10.
54
55 // Part 3
56 '12': new ComputedLine((tr): number => this.getValue(tr, '8') - this.getValue(tr, '11'), 'Net investment income'),
57 '13': new ReferenceLine(Form1040, '8b', 'Modified adjusted gross income'),
58 '14': new ComputedLine((tr): number => {
59 return Form8960.filingStatusLimit(tr.getForm(Form1040).filingStatus);
60 }, 'Threshold'),
61 '15': new ComputedLine((tr): number => clampToZero(this.getValue(tr, '13') - this.getValue(tr, '14'))),
62 '16': new ComputedLine((tr): number => Math.min(this.getValue(tr, '12'), this.getValue(tr, '15'))),
63 '17': new ComputedLine((tr): number => this.getValue(tr, '16') * 0.038, 'Net investment income tax'),
64
65 // 18 - 21 not supported (Estates and Trusts)
66 };
67
68 static filingStatusLimit(filingStatus: FilingStatus): number {
69 switch (filingStatus) {
70 case FilingStatus.MarriedFilingJoint: return 250000;
71 case FilingStatus.MarriedFilingSeparate: return 125000;
72 case FilingStatus.Single: return 200000;
73 }
74 }
75 };