Add UnsupportedLine, to formalize a comment convention that exists in fed2019.
[ustaxlib.git] / src / fed2019 / Form8959.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 { Line, AccumulatorLine, ComputedLine, ReferenceLine, UnsupportedLine, sumFormLines } from '../core/Line';
8 import { clampToZero } from '../core/Math';
9
10 import Form1040, { FilingStatus } from './Form1040';
11 import W2 from './W2';
12
13 export default class Form8959 extends Form<Form8959['lines']> {
14 readonly name = '8959';
15
16 readonly lines = {
17 '1': new AccumulatorLine(W2, '5', 'Medicare wages'),
18 '2': new UnsupportedLine('Unreported tips from Form 4137'),
19 '3': new UnsupportedLine('Wages from Form 8919'),
20 '4': new ComputedLine((tr): number => {
21 return sumFormLines(tr, this, ['1', '2', '3']);
22 }),
23 '5': new ComputedLine((tr): number => {
24 return Form8959.filingStatusLimit(tr.getForm(Form1040).filingStatus);
25 }),
26 '6': new ComputedLine((tr): number => {
27 return clampToZero(this.getValue(tr, '4') - this.getValue(tr, '5'));
28 }),
29 '7': new ComputedLine((tr): number => {
30 return this.getValue(tr, '6') * 0.009;
31 }, 'Additional Medicare tax on Medicare wages'),
32
33 // All of Section 2 and 3 skipped.
34
35 '18': new ComputedLine((tr): number => {
36 // Should include 13 and 17.
37 return this.getValue(tr, '7');
38 }),
39
40 '19': new AccumulatorLine(W2, '6', 'Medicare tax withheld'),
41 '20': new ReferenceLine(Form8959 as any, '1'),
42 '21': new ComputedLine((tr): number => {
43 return this.getValue(tr, '20') * 0.0145;
44 }, 'Regular Medicare withholding on Medicare wages'),
45 '22': new ComputedLine((tr): number => {
46 return clampToZero(this.getValue(tr, '19') - this.getValue(tr, '21'));
47 }, 'Additional Medicare withholding on Medicare wages'),
48 '23': new UnsupportedLine('Additional Medicare Tax withholding on railroad retirement (RRTA) compensation'),
49 '24': new ComputedLine((tr): number => {
50 return this.getValue(tr, '22') + this.getValue(tr, '23');
51 }),
52 };
53
54 static filingStatusLimit(filingStatus: FilingStatus): number {
55 switch (filingStatus) {
56 case FilingStatus.Single: return 200000;
57 case FilingStatus.MarriedFilingJoint: return 250000;
58 case FilingStatus.MarriedFilingSeparate: return 125000;
59 }
60 }
61 };