1 import Form from '../Form';
2 import TaxReturn from '../TaxReturn';
3 import { Line, AccumulatorLine, ComputedLine, ReferenceLine } from '../Line';
4 import { clampToZero } from '../Math';
6 import Form1040, { FilingStatus } from './Form1040';
7 import FormW2 from './FormW2';
9 export default class Form8959 extends Form<Form8959['_lines']> {
10 readonly name = '8959';
12 protected readonly _lines = {
13 '1': new AccumulatorLine(FormW2, '5', 'Medicare wages'),
14 // 2 is not supported (Unreported tips from Form 4137)
15 // 3 is not supported (Wages from Form 8919)
16 '4': new ComputedLine((tr): number => {
17 // Should include 2-3.
18 return this.getValue(tr, '1');
20 '5': new ComputedLine((tr): number => {
21 return Form8959.filingStatusLimit(tr.getForm(Form1040).getInput('filingStatus'));
23 '6': new ComputedLine((tr): number => {
24 return clampToZero(this.getValue(tr, '4') - this.getValue(tr, '5'));
26 '7': new ComputedLine((tr): number => {
27 return this.getValue(tr, '6') * 0.009;
28 }, 'Additional Medicare tax on Medicare wages'),
30 // All of Section 2 and 3 skipped.
32 '18': new ComputedLine((tr): number => {
33 // Should include 13 and 17.
34 return this.getValue(tr, '7');
37 '19': new AccumulatorLine(FormW2, '6', 'Medicare tax withheld'),
38 '20': new ReferenceLine(Form8959 as any, '1'),
39 '21': new ComputedLine((tr): number => {
40 return this.getValue(tr, '20') * 0.0145;
41 }, 'Regular Medicare withholding on Medicare wages'),
42 '22': new ComputedLine((tr): number => {
43 return clampToZero(this.getValue(tr, '19') - this.getValue(tr, '21'));
44 }, 'Additional Medicare withholding on Medicare wages'),
45 // 23 is not supported (Additional Medicare Tax withholding on railroad retirement (RRTA) compensation)
46 '24': new ComputedLine((tr): number => {
48 return this.getValue(tr, '22');
52 static filingStatusLimit(filingStatus: FilingStatus): number {
53 switch (filingStatus) {
54 case FilingStatus.Single: return 200000;
55 case FilingStatus.MarriedFilingJoint: return 250000;
56 case FilingStatus.MarriedFilingSeparate: return 125000;