From bd6404e3fe6693dae0a208f9eacb12129efe780f Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Thu, 20 Feb 2020 01:23:39 -0500 Subject: [PATCH] Complete Form W-2 and first few lines of 1040. --- src/fed2019/Form1040.test.ts | 15 +++++++++ src/fed2019/Form1040.ts | 18 +++++++++++ src/fed2019/FormW2.test.ts | 13 ++++++++ src/fed2019/FormW2.ts | 60 ++++++++++++++++++++++++++++++++++++ 4 files changed, 106 insertions(+) create mode 100644 src/fed2019/Form1040.test.ts create mode 100644 src/fed2019/Form1040.ts create mode 100644 src/fed2019/FormW2.test.ts create mode 100644 src/fed2019/FormW2.ts diff --git a/src/fed2019/Form1040.test.ts b/src/fed2019/Form1040.test.ts new file mode 100644 index 0000000..ff607a2 --- /dev/null +++ b/src/fed2019/Form1040.test.ts @@ -0,0 +1,15 @@ +import Person from '../Person'; +import TaxReturn from '../TaxReturn'; + +import Form1040 from './Form1040'; +import FormW2 from './FormW2'; + +test('w2 wages', () => { + const pa = Person.self('A'); + const pb = Person.spouse('B'); + const tr = new TaxReturn(2019); + tr.addForm(new FormW2({ employer: 'AA', employee: pa, wages: 100.00 })); + tr.addForm(new FormW2({ employer: 'BB', employee: pb, wages: 36.32 })); + const f1040 = new Form1040(); + expect(f1040.getValue(tr, '1')).toBe(136.32); +}); diff --git a/src/fed2019/Form1040.ts b/src/fed2019/Form1040.ts new file mode 100644 index 0000000..28c4c3c --- /dev/null +++ b/src/fed2019/Form1040.ts @@ -0,0 +1,18 @@ +import Form from '../Form'; +import TaxReturn from '../TaxReturn'; +import { Line, AccumulatorLine } from '../Line'; + +export interface Form1040Input { +}; + +export default class Form1040 extends Form { + get name(): string { return 'Form 1040'; } + + protected getLines(): Line[] { + return [ + new AccumulatorLine('1', 'W-2', '1', 'Wages, salaries, tips, etc.'), + new AccumulatorLine('2a', '1099-INT', '8', 'Tax-exempt interest'), + new AccumulatorLine('2b', '1009-INT', '1', 'Taxable interest'), + ]; + } +}; diff --git a/src/fed2019/FormW2.test.ts b/src/fed2019/FormW2.test.ts new file mode 100644 index 0000000..8e3d719 --- /dev/null +++ b/src/fed2019/FormW2.test.ts @@ -0,0 +1,13 @@ +import W2 from './FormW2'; +import Person from '../Person'; +import TaxReturn from '../TaxReturn'; + +test('input', () => { + const p = Person.self('Bob'); + const w2 = new W2({ employer: 'Acme', employee: p, wages: 1000, fedIncomeTax: 100.40 }); + const tr = new TaxReturn(2019); + expect(w2.getValue(tr, 'c')).toBe('Acme'); + expect(w2.getValue(tr, 'e')).toBe(p); + expect(w2.getValue(tr, '1')).toBe(1000); + expect(w2.getValue(tr, '2')).toBe(100.40); +}); diff --git a/src/fed2019/FormW2.ts b/src/fed2019/FormW2.ts new file mode 100644 index 0000000..a0ca2d9 --- /dev/null +++ b/src/fed2019/FormW2.ts @@ -0,0 +1,60 @@ +import Form, { SupportsMultipleCopies } from '../Form'; +import { Line, InputLine } from '../Line'; +import Person from '../Person'; + +export enum Box13 { + StatutoryEmployee, + RetirementPlan, + ThirdPartySickPay +}; + +export interface CodeAndAmount { + code: string; + amount: number; +}; + +export interface W2Input { + employer: string; + employee: Person; + wages?: number; + fedIncomeTax?: number; + socialSecurityWages?: number; + socialSecuirtyTax?: number; + medicareWages?: number; + medicareTax?: number; + socialSecurityTips?: number; + allocatedTips?: number; + dependentCareBenefits?: number; + nonqualifiedPlans?: number; + box12?: CodeAndAmount[]; + box13?: Box13; + box14?: CodeAndAmount[]; +}; + +class Input extends InputLine {}; + +export default class W2 extends Form implements SupportsMultipleCopies { + get name(): string { return 'W-2'; } + + aggregate(f: Form[]): this { return null; } + + protected getLines(): Line[] { + return [ + new Input('c', 'employer', 'Employer name'), + new Input('e', 'employee', 'Emplyee name'), + new Input('1', 'wages', 'Wages, tips, other compensation'), + new Input('2', 'fedIncomeTax', 'Federal income tax withheld'), + new Input('3', 'socialSecurityWages', 'Social security wages'), + new Input('4', 'socialSecuirtyTax', 'Social security tax withheld'), + new Input('5', 'medicareWages', 'Medicare wages and tips'), + new Input('6', 'medicareTax', 'Medicare tax withheld'), + new Input('7', 'socialSecurityTips', 'Social security tips'), + new Input('8', 'allocatedTips', 'Allocated tips'), + new Input('10', 'dependentCareBenefits', 'Dependent care benefits'), + new Input('11', 'nonqualifiedPlans','Nonqualified plans'), + new Input('12', 'box12', 'Box 12'), + new Input('13', 'box13', 'Box 13'), + new Input('14', 'box14', 'Other'), + ]; + } +}; -- 2.43.5