Split Schedule2 into its own file.
authorRobert Sesek <rsesek@bluestatic.org>
Sun, 8 Mar 2020 06:17:52 +0000 (01:17 -0500)
committerRobert Sesek <rsesek@bluestatic.org>
Sun, 8 Mar 2020 06:17:52 +0000 (01:17 -0500)
src/fed2019/Form1040.test.ts
src/fed2019/Form1040.ts
src/fed2019/Form8959.test.ts
src/fed2019/Schedule2.ts [new file with mode: 0644]

index 8523a38b1b1e16427ffb09d4ed84a49862dd6a46..6549ac6eb3bce063f00cf992a9ce70c284fb58b1 100644 (file)
@@ -2,11 +2,12 @@ import Person from '../Person';
 import TaxReturn from '../TaxReturn';
 import { NotFoundError } from '../Errors';
 
-import Form1040, { FilingStatus, Schedule2 } from './Form1040';
+import Form1040, { FilingStatus } from './Form1040';
 import Form1099DIV from './Form1099DIV';
 import Form1099INT from './Form1099INT';
 import Form1099B, { GainType } from './Form1099B';
 import Form1099R, { Box7Code } from './Form1099R';
+import Schedule2 from './Schedule2';
 import ScheduleD, { ScheduleDTaxWorksheet } from './ScheduleD';
 import Form8606 from './Form8606';
 import Form8959 from './Form8959';
index 4d9fe8e942b6bc35f42245f11668abfa348026a4..8c5d829eacae75ce11f926064fc5b3948b178e54 100644 (file)
@@ -10,6 +10,7 @@ import Form1099INT from './Form1099INT';
 import Form1099DIV from './Form1099DIV';
 import Form1099R, { Box7Code } from './Form1099R';
 import FormW2 from './FormW2';
+import Schedule2 from './Schedule2';
 import ScheduleD, { ScheduleDTaxWorksheet } from './ScheduleD';
 
 export enum FilingStatus {
@@ -183,87 +184,6 @@ export default class Form1040 extends Form<Form1040['_lines'], Form1040Input> {
   };
 };
 
-export class Schedule2 extends Form<Schedule2['_lines']> {
-  readonly name = 'Schedule 2';
-
-  protected readonly _lines = {
-    '1': new ComputedLine((tr): number => {
-      // TODO - this is just using Taxable Income, rather than AMT-limited
-      // income
-      const f1040 = tr.getForm(Form1040);
-      const taxableIncome = f1040.getValue(tr, '11b');
-      switch (f1040.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': new ComputedLine(() => 0, 'Excess advance premium tax credit repayment'),  // Not supported.
-    '3': new ComputedLine((tr): 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): number => {
-      const f1040 = tr.getForm(Form1040);
-      const wages = f1040.getLine('1').value(tr);
-
-      let niit: boolean;
-      const filingStatus = f1040.getInput('filingStatus');
-
-      const additionalMedicare = wages > Form8959.filingStatusLimit(filingStatus);
-
-      switch (f1040.getInput('filingStatus')) {
-        case FilingStatus.Single:
-          if (wages > 200000) {
-            niit = true;
-          }
-          break;
-        case FilingStatus.MarriedFilingJoint:
-          if (wages > 250000) {
-            niit = true;
-          }
-          break;
-        case FilingStatus.MarriedFilingSeparate:
-          if (wages > 125000) {
-            niit = true;
-          }
-          break;
-      }
-
-      let value = 0;
-
-      if (additionalMedicare) {
-        const f8959 = tr.getForm(Form8959);
-        value += f8959.getValue(tr, '18');
-      }
-
-      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): number => {
-      // Should be lines 4 - 8.
-      return this.getValue(tr, '8');
-    })
-  };
-};
-
 export function computeTax(income: number, filingStatus: FilingStatus): number {
   if (income < 100000)
     throw new UnsupportedFeatureError('Tax-table tax liability not supported');
index 474ca22480170e3fde4e31a3d9a5ed5b8dfef168..ed55f94c1eb537113685fccd414c4daeb08abb0c 100644 (file)
@@ -3,7 +3,8 @@ import TaxReturn from '../TaxReturn';
 
 import FormW2 from './FormW2';
 import Form8959 from './Form8959';
-import Form1040, { Schedule2, FilingStatus } from './Form1040';
+import Form1040, { FilingStatus } from './Form1040';
+import Schedule2 from './Schedule2';
 
 describe('additional medicare tax', () => {
   const filingStatusToResults = {
diff --git a/src/fed2019/Schedule2.ts b/src/fed2019/Schedule2.ts
new file mode 100644 (file)
index 0000000..aed3406
--- /dev/null
@@ -0,0 +1,89 @@
+import Form from '../Form';
+import TaxReturn from '../TaxReturn';
+import { ComputedLine } from '../Line';
+import { UnsupportedFeatureError } from '../Errors';
+
+import Form1040, { FilingStatus } from './Form1040';
+import Form8959 from './Form8959';
+
+export default class Schedule2 extends Form<Schedule2['_lines']> {
+  readonly name = 'Schedule 2';
+
+  protected readonly _lines = {
+    '1': new ComputedLine((tr): number => {
+      // TODO - this is just using Taxable Income, rather than AMT-limited
+      // income
+      const f1040 = tr.getForm(Form1040);
+      const taxableIncome = f1040.getValue(tr, '11b');
+      switch (f1040.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': new ComputedLine(() => 0, 'Excess advance premium tax credit repayment'),  // Not supported.
+    '3': new ComputedLine((tr): 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): number => {
+      const f1040 = tr.getForm(Form1040);
+      const wages = f1040.getLine('1').value(tr);
+
+      let niit: boolean;
+      const filingStatus = f1040.getInput('filingStatus');
+
+      const additionalMedicare = wages > Form8959.filingStatusLimit(filingStatus);
+
+      switch (f1040.getInput('filingStatus')) {
+        case FilingStatus.Single:
+          if (wages > 200000) {
+            niit = true;
+          }
+          break;
+        case FilingStatus.MarriedFilingJoint:
+          if (wages > 250000) {
+            niit = true;
+          }
+          break;
+        case FilingStatus.MarriedFilingSeparate:
+          if (wages > 125000) {
+            niit = true;
+          }
+          break;
+      }
+
+      let value = 0;
+
+      if (additionalMedicare) {
+        const f8959 = tr.getForm(Form8959);
+        value += f8959.getValue(tr, '18');
+      }
+
+      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): number => {
+      // Should be lines 4 - 8.
+      return this.getValue(tr, '8');
+    })
+  };
+};
+