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