From 257a9f6be9a222bb4f9181519c2b38f13b9800db Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Sat, 14 Mar 2020 08:14:59 -0400 Subject: [PATCH] Add a Form1040.filingStatus accessor. --- src/fed2019/Form1040.ts | 12 ++++++++---- src/fed2019/Form8959.ts | 2 +- src/fed2019/Form8960.ts | 2 +- src/fed2019/Schedule2.ts | 4 ++-- src/fed2019/Schedule3.ts | 2 +- src/fed2019/ScheduleD.ts | 12 ++++++------ src/fed2019/TaxReturn.ts | 2 +- 7 files changed, 20 insertions(+), 16 deletions(-) diff --git a/src/fed2019/Form1040.ts b/src/fed2019/Form1040.ts index f6fdc94..2a46b55 100644 --- a/src/fed2019/Form1040.ts +++ b/src/fed2019/Form1040.ts @@ -77,7 +77,7 @@ export default class Form1040 extends Form { '9': new ComputedLine((): number => { // TODO - Itemized deductions. - switch (this.getInput('filingStatus')) { + switch (this.filingStatus) { case FilingStatus.Single: case FilingStatus.MarriedFilingSeparate: return 12200; @@ -89,7 +89,7 @@ export default class Form1040 extends Form { '10': new ComputedLine((tr): number => { const taxableIncome = this.getValue(tr, '8b'); let use8995a = false; - switch (this.getInput('filingStatus')) { + switch (this.filingStatus) { case FilingStatus.Single: use8995a = taxableIncome <= 160700; break; case FilingStatus.MarriedFilingSeparate: use8995a = taxableIncome <= 160725; break; case FilingStatus.MarriedFilingJoint: use8995a = taxableIncome <= 321400; break; @@ -117,7 +117,7 @@ export default class Form1040 extends Form { if (schedD) return schedD.getValue(tr, '47'); - return computeTax(taxableIncome, this.getInput('filingStatus')); + return computeTax(taxableIncome, this.filingStatus); }, 'Tax'), '12b': new ComputedLine((tr): number => { @@ -176,7 +176,11 @@ export default class Form1040 extends Form { '23': new ComputedLine((tr): number => { return clampToZero(this.getValue(tr, '16') - this.getValue(tr, '19')); }, 'Amount you owe'), - }; + } + + get filingStatus(): FilingStatus { + return this.getInput('filingStatus'); + } }; export function computeTax(income: number, filingStatus: FilingStatus): number { diff --git a/src/fed2019/Form8959.ts b/src/fed2019/Form8959.ts index b9f7c6b..5efa581 100644 --- a/src/fed2019/Form8959.ts +++ b/src/fed2019/Form8959.ts @@ -17,7 +17,7 @@ export default class Form8959 extends Form { return this.getValue(tr, '1'); }), '5': new ComputedLine((tr): number => { - return Form8959.filingStatusLimit(tr.getForm(Form1040).getInput('filingStatus')); + return Form8959.filingStatusLimit(tr.getForm(Form1040).filingStatus); }), '6': new ComputedLine((tr): number => { return clampToZero(this.getValue(tr, '4') - this.getValue(tr, '5')); diff --git a/src/fed2019/Form8960.ts b/src/fed2019/Form8960.ts index ea24d34..10dfddd 100644 --- a/src/fed2019/Form8960.ts +++ b/src/fed2019/Form8960.ts @@ -51,7 +51,7 @@ export default class Form8960 extends Form { '12': new ComputedLine((tr): number => this.getValue(tr, '8') - this.getValue(tr, '11'), 'Net investment income'), '13': new ReferenceLine(Form1040, '8b', 'Modified adjusted gross income'), '14': new ComputedLine((tr): number => { - return Form8960.filingStatusLimit(tr.getForm(Form1040).getInput('filingStatus')); + return Form8960.filingStatusLimit(tr.getForm(Form1040).filingStatus); }, 'Threshold'), '15': new ComputedLine((tr): number => clampToZero(this.getValue(tr, '13') - this.getValue(tr, '14'))), '16': new ComputedLine((tr): number => Math.min(this.getValue(tr, '12'), this.getValue(tr, '15'))), diff --git a/src/fed2019/Schedule2.ts b/src/fed2019/Schedule2.ts index ca2c46f..d547473 100644 --- a/src/fed2019/Schedule2.ts +++ b/src/fed2019/Schedule2.ts @@ -17,7 +17,7 @@ export default class Schedule2 extends Form { // income const f1040 = tr.getForm(Form1040); const taxableIncome = f1040.getValue(tr, '11b'); - switch (f1040.getInput('filingStatus')) { + switch (f1040.filingStatus) { case FilingStatus.Single: if (taxableIncome < 510300) return 0; @@ -43,7 +43,7 @@ export default class Schedule2 extends Form { '8': new ComputedLine((tr): number => { const f1040 = tr.getForm(Form1040); const wages = f1040.getLine('1').value(tr); - const filingStatus = f1040.getInput('filingStatus'); + const filingStatus = f1040.filingStatus; let value = 0; diff --git a/src/fed2019/Schedule3.ts b/src/fed2019/Schedule3.ts index 36db265..313eb54 100644 --- a/src/fed2019/Schedule3.ts +++ b/src/fed2019/Schedule3.ts @@ -22,7 +22,7 @@ export default class Schedule3 extends Form const totalForeignTax = (new AccumulatorLine(Form1099DIV, '7')).value(tr) + (new AccumulatorLine(Form1099INT, '6')).value(tr); - const limit = f1040.getInput('filingStatus') == FilingStatus.MarriedFilingJoint ? 600 : 300; + const limit = f1040.filingStatus == FilingStatus.MarriedFilingJoint ? 600 : 300; if (totalForeignTax < limit) { const sched2l2 = new ReferenceLine(Schedule2, '2', undefined, 0); diff --git a/src/fed2019/ScheduleD.ts b/src/fed2019/ScheduleD.ts index e7661a1..6e26fea 100644 --- a/src/fed2019/ScheduleD.ts +++ b/src/fed2019/ScheduleD.ts @@ -71,7 +71,7 @@ export default class ScheduleD extends Form { '21': new ComputedLine((tr): number | undefined => { if (!this.getValue(tr, '17') || !this.getValue(tr, '20')) return undefined; - const filingStatus = tr.getForm(Form1040).getInput('filingStatus'); + const filingStatus = tr.getForm(Form1040).filingStatus; const limit = filingStatus == FilingStatus.MarriedFilingSeparate ? -1500 : -3000; return Math.min(this.getValue(tr, '16'), limit); }, 'Net capital loss'), @@ -107,7 +107,7 @@ export class ScheduleDTaxWorksheet extends Form '13': new ComputedLine((tr): number => this.getValue(tr, '10') - this.getValue(tr, '12')), '14': new ComputedLine((tr): number => clampToZero(this.getValue(tr, '1') - this.getValue(tr, '13'))), '15': new ComputedLine((tr): number => { - switch (tr.getForm(Form1040).getInput('filingStatus')) { + switch (tr.getForm(Form1040).filingStatus) { case FilingStatus.Single: case FilingStatus.MarriedFilingSeparate: return 39375; @@ -120,7 +120,7 @@ export class ScheduleDTaxWorksheet extends Form '18': new ComputedLine((tr): number => clampToZero(this.getValue(tr, '1') - this.getValue(tr, '10'))), '19': new ComputedLine((tr): number => { let threshold: number; - switch (tr.getForm(Form1040).getInput('filingStatus')) { + switch (tr.getForm(Form1040).filingStatus) { case FilingStatus.Single: case FilingStatus.MarriedFilingSeparate: threshold = 160725; @@ -138,7 +138,7 @@ export class ScheduleDTaxWorksheet extends Form '24': new ReferenceLine(ScheduleDTaxWorksheet as any, '22'), '25': new ComputedLine((tr): number => clampToZero(this.getValue(tr, '23') - this.getValue(tr, '24'))), '26': new ComputedLine((tr): number => { - switch (tr.getForm(Form1040).getInput('filingStatus')) { + switch (tr.getForm(Form1040).filingStatus) { case FilingStatus.Single: return 434550; case FilingStatus.MarriedFilingSeparate: @@ -183,7 +183,7 @@ export class ScheduleDTaxWorksheet extends Form }), '44': new ComputedLine((tr): number => { const income = this.getValue(tr, '21'); - return computeTax(income, tr.getForm(Form1040).getInput('filingStatus')); + return computeTax(income, tr.getForm(Form1040).filingStatus); }), '45': new ComputedLine((tr): number => { return this.getValue(tr, '31') + @@ -194,7 +194,7 @@ export class ScheduleDTaxWorksheet extends Form }), '46': new ComputedLine((tr): number => { const income = this.getValue(tr, '1'); - return computeTax(income, tr.getForm(Form1040).getInput('filingStatus')); + return computeTax(income, tr.getForm(Form1040).filingStatus); }), '47': new ComputedLine((tr): number => Math.min(this.getValue(tr, '45'), this.getValue(tr, '46'))), }; diff --git a/src/fed2019/TaxReturn.ts b/src/fed2019/TaxReturn.ts index 9a7892f..1080fed 100644 --- a/src/fed2019/TaxReturn.ts +++ b/src/fed2019/TaxReturn.ts @@ -6,6 +6,6 @@ export default class TaxReturn extends BaseTaxReturn { get year() { return 2019; } get includeJointPersonForms() { - return this.getForm(Form1040).getInput('filingStatus') == FilingStatus.MarriedFilingJoint; + return this.getForm(Form1040).filingStatus == FilingStatus.MarriedFilingJoint; } }; -- 2.22.5