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