From 8dc64bf8ecd25adc6c4d011eceb537d8d57de8fb Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Sat, 22 Feb 2020 00:40:11 -0500 Subject: [PATCH] Add Form 1040 Schedule 2. --- src/fed2019/Form1040.test.ts | 3 +- src/fed2019/Form1040.ts | 85 ++++++++++++++++++++++++++++++++++-- 2 files changed, 83 insertions(+), 5 deletions(-) diff --git a/src/fed2019/Form1040.test.ts b/src/fed2019/Form1040.test.ts index bbd533c..57936ef 100644 --- a/src/fed2019/Form1040.test.ts +++ b/src/fed2019/Form1040.test.ts @@ -1,7 +1,7 @@ import Person from '../Person'; import TaxReturn from '../TaxReturn'; -import Form1040, { FilingStatus } from './Form1040'; +import Form1040, { FilingStatus, Schedule2 } from './Form1040'; import Form1099DIV from './Form1099DIV'; import Form1099INT from './Form1099INT'; import FormW2 from './FormW2'; @@ -14,6 +14,7 @@ test('w2 wages', () => { tr.addForm(new FormW2({ employer: 'BB', employee: pb, wages: 36.32, fedIncomeTax: 0 })); const f1040 = new Form1040({ filingStatus: FilingStatus.MarriedFilingJoint }); tr.addForm(f1040); + tr.addForm(new Schedule2); expect(f1040.getValue(tr, '1')).toBe(1000036.32); f1040.getValue(tr, '23'); }); diff --git a/src/fed2019/Form1040.ts b/src/fed2019/Form1040.ts index 4535f8c..b3fdda9 100644 --- a/src/fed2019/Form1040.ts +++ b/src/fed2019/Form1040.ts @@ -111,16 +111,15 @@ export default class Form1040 extends Form { }, 'Tax'), '12b': new ComputedLine((tr: TaxReturn): number => { - // TODO: add Sched 2.L3 - return this.getValue(tr, '12a'); - }), + return this.getValue(tr, '12a') + tr.getForm('Schedule 2').getValue(tr, '3'); + }, 'Additional tax'), // Not supported: 13a - child tax credit '13b': new ComputedLine((tr: TaxReturn): number => { // TODO: add Sched 3.L7 return 0; - }), + }, 'Additional credits'), '14': new ComputedLine((tr: TaxReturn): number => { const l12b = this.getValue(tr, '12b'); @@ -170,5 +169,83 @@ export default class Form1040 extends Form { return 0; }, 'Amount you owe'), }; +}; + +export class Schedule2 extends Form { + readonly name = 'Schedule 2'; + protected readonly _lines = { + '1': new ComputedLine((tr: TaxReturn): number => { + // TODO - this is just using Taxable Income, rather than AMT-limited + // income + const taxableIncome = tr.getForm('1040').getValue(tr, '11b'); + switch (tr.getForm('1040').getInput('filingStatus')) { + case FilingStatus.Single: + if (taxableIncome < 510300) + return 0; + case FilingStatus.MarriedFilingJoint: + if (taxableIncome < 1020600) + return 0; + case FilingStatus.MarriedFilingSeparate: + if (taxableIncome < 510300) + return 0; + } + throw new UnsupportedFeatureError('The AMT is not supported'); + }, 'AMT'), + // 2 is not supported (Excess advance premium tax credit repayment) + '3': new ComputedLine((tr: TaxReturn): number => { + // Should include line 2. + return this.getValue(tr, '1'); + }), + + // 4 is not supported (Self-employment tax.) + // 5 is not supported (Unreported social security and Medicare tax from) + // 6 is not supported (Additional tax on IRAs, other qualified retirement plans, and other tax-favored accounts) + // 7 is not supported (Household employment taxes.) + '8': new ComputedLine((tr: TaxReturn): number => { + const f1040 = tr.getForm('1040'); + const wages = f1040.getLine('1').value(tr); + const agi = f1040.getLine('8b').value(tr); + + let additionalMedicare: boolean, niit: boolean; + switch (f1040.getInput('filingStatus')) { + case FilingStatus.Single: + if (wages > 200000) { + additionalMedicare = true; + niit = true; + } + break; + case FilingStatus.MarriedFilingJoint: + if (wages > 250000) { + additionalMedicare = true; + niit = true; + } + break; + case FilingStatus.MarriedFilingSeparate: + if (wages > 125000) { + additionalMedicare = true; + niit = true; + } + break; + } + + let value = 0; + + if (additionalMedicare) { + const f8959 = tr.getForm('8959'); + } + + if (niit) { + const f8960 = tr.getForm('8960'); + } + + return value; + }), + // 9 is not supported (Section 965 net tax liability installment from Form 965-A) + + '10': new ComputedLine((tr: TaxReturn): number => { + // Should be lines 4 - 8. + return this.getValue(tr, '8'); + }) + }; }; -- 2.43.5