Add a Form1040.filingStatus accessor.
authorRobert Sesek <rsesek@bluestatic.org>
Sat, 14 Mar 2020 12:14:59 +0000 (08:14 -0400)
committerRobert Sesek <rsesek@bluestatic.org>
Sat, 14 Mar 2020 12:14:59 +0000 (08:14 -0400)
src/fed2019/Form1040.ts
src/fed2019/Form8959.ts
src/fed2019/Form8960.ts
src/fed2019/Schedule2.ts
src/fed2019/Schedule3.ts
src/fed2019/ScheduleD.ts
src/fed2019/TaxReturn.ts

index f6fdc94d0607b00954b9867a875b1e0e8658ef5f..2a46b5596082d8193959195bb97ca583ec1ca865 100644 (file)
@@ -77,7 +77,7 @@ export default class Form1040 extends Form<Form1040['_lines'], Form1040Input> {
 
     '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<Form1040['_lines'], Form1040Input> {
     '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<Form1040['_lines'], Form1040Input> {
       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<Form1040['_lines'], Form1040Input> {
     '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 {
index b9f7c6bdf525eca0ceecf79cf0e36e58c23ff7c9..5efa5817dd82c7261819aad28f4541f30abd06fd 100644 (file)
@@ -17,7 +17,7 @@ export default class Form8959 extends Form<Form8959['_lines']> {
       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'));
index ea24d3474e581c3a23a6890e43a12ae893313bff..10dfdddbd561ca37650875847b4794a5e45f9803 100644 (file)
@@ -51,7 +51,7 @@ export default class Form8960 extends Form<Form8960['_lines']> {
     '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'))),
index ca2c46f50110ce437e2d9a5b0fdf08039d961bb3..d54747337f1c0e7533e9e0287383221c0ac0392a 100644 (file)
@@ -17,7 +17,7 @@ export default class Schedule2 extends Form<Schedule2['_lines']> {
       // 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<Schedule2['_lines']> {
     '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;
 
index 36db26523292d352445472488fa06fc8454e3755..313eb546bbf11bd3d844d42d9aca8dcf7c16b8c3 100644 (file)
@@ -22,7 +22,7 @@ export default class Schedule3 extends Form<Schedule3['_lines'], Schedule3Input>
 
       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);
index e7661a180818f34b4a1762c03ffae4910ec6ad6f..6e26fea38a86fc6ea3dcc776db3680de912dccaa 100644 (file)
@@ -71,7 +71,7 @@ export default class ScheduleD extends Form<ScheduleD['_lines']> {
     '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<ScheduleDTaxWorksheet['_lines']>
     '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<ScheduleDTaxWorksheet['_lines']>
     '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<ScheduleDTaxWorksheet['_lines']>
     '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<ScheduleDTaxWorksheet['_lines']>
     }),
     '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<ScheduleDTaxWorksheet['_lines']>
     }),
     '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'))),
   };
index 9a7892f5f9b11af0faf61f8fc2ff21ca66dd9559..1080fed6c4869d49cb179d3cec4fd08f5b6e1bfe 100644 (file)
@@ -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;
   }
 };