def __init__(f, inputs={}): super(F1040, f).__init__(inputs) f.must_file = True f.addForm(f) if inputs['status'] == FilingStatus.JOINT: sse = [] for i in [0, 1]: inputs2 = copy.copy(inputs) for j in ['wages', 'wages_ss', 'business_income']: inputs2[j] = inputs[j][i] x = F1040sse(inputs2) f.addForm(x) sse.append(x) else: sse = F1040sse(inputs) f.addForm(sse) f['6d'] = inputs['exemptions'] f['7'] = f.spouseSum(inputs, 'wages') f['8a'] = inputs.get('taxable_interest') f['8b'] = inputs.get('tax_exempt_interest') f['9a'] = inputs.get('dividends') f['9b'] = inputs.get('qualified_dividends') f['12'] = f.spouseSum(inputs, 'business_income') sd = F1040sd(inputs) f.addForm(sd) if sd.mustFile(): f['13'] = sd['21'] or sd['16'] else: f['13'] = inputs.get('capital_gain_dist') f['22'] = f.rowsum([ '7', '8a', '9a', '10', '11', '12', '13', '14', '15b', '16b', '17', '18', '19', '20b', '21' ]) if inputs['status'] == FilingStatus.JOINT: if sse[0].mustFile() or sse[1].mustFile(): f['27'] = ((sse[0]['A6'] or sse[0]['B13'] or 0) + (sse[1]['A6'] or sse[1]['B13'] or 0)) else: if sse.mustFile(): f['27'] = sse['A6'] or sse['B13'] f['36'] = f.rowsum([ '23', '24', '25', '26', '27', '28', '29', '30', '31a', '32', '33', '34', '35' ]) f['37'] = f['22'] - f['36'] f['38'] = f['37'] sa = F1040sa(inputs, f) std = f.STD_DED[inputs['status']] file_sched_a = sa['29'] > std if file_sched_a: f['40'] = sa['29'] f.addForm(sa) else: f['40'] = std f['41'] = f['38'] - f['40'] f['42'] = f.EXEMPTION * f['6d'] f['43'] = 0 if f['42'] > f['41'] else f['41'] - f['42'] # TODO: Schedule D tax worksheet assert (not sd['18'] and not sd['19']) f['44'] = f.div_cap_gain_tax_worksheet(inputs, sd) # Compute line 47 now because it's needed by AMT foreign_tax = inputs.get('foreign_tax', 0) assert (foreign_tax < 300 or (foreign_tax < 600 and inputs['status'] == FilingStatus.JOINT)) if foreign_tax: f['47'] = min(foreign_tax, f['44']) f6251 = F6251(inputs, f, sa if file_sched_a else None, sd) f['45'] = f6251.get('35') f.addForm(f6251) f['46'] = f.rowsum(['44', '45']) f['51'] = f.child_tax_credit(inputs) f['54'] = f.rowsum(['47', '48', '49', '50', '51', '52', '53']) f['55'] = max(0, f['46'] - f['54']) if inputs['status'] == FilingStatus.JOINT: if sse[0].mustFile() or sse[1].mustFile(): f['56'] = ((sse[0]['A5'] or sse[0]['B12'] or 0) + (sse[1]['A5'] or sse[1]['B12'] or 0)) else: if sse.mustFile(): f['56'] = sse['A5'] or sse['B12'] f['61'] = f.rowsum(['55', '56', '57', '58', '59', '60']) f['62'] = inputs.get('withholding') f['63'] = inputs.get('estimated_payments') # TODO: EIC if inputs.get('ss_withheld'): if inputs['status'] == FilingStatus.JOINT: if inputs['ss_withheld'][0] > f.SS_MAX: f['69'] = inputs['ss_withheld'][0] - f.SS_MAX if inputs['ss_withheld'][1] > f.SS_MAX: f['69'] += inputs['ss_withheld'][1] - f.SS_MAX else: if inputs['ss_withheld'] > f.SS_MAX: f['69'] = inputs['ss_withheld'] - f.SS_MAX f['72'] = f.rowsum( ['62', '63', '64a', '65', '66', '67', '68', '69', '70', '71']) if f['72'] > f['61']: f['73'] = f['72'] - f['61'] else: f['76'] = f['61'] - f['72']
def __init__(f, inputs={}): super(F1040, f).__init__(inputs) f.must_file = True f.addForm(f) if inputs['status'] == FilingStatus.JOINT: sse = [] for i in [0, 1]: inputs2 = copy.copy(inputs) for j in ['wages', 'wages_ss', 'business_income']: if j in inputs: inputs2[j] = inputs[j][i] x = F1040sse(inputs2) f.addForm(x) sse.append(x) else: sse = F1040sse(inputs) f.addForm(sse) f2441 = F2441(inputs, sse) f.addForm(f2441) f['6d'] = inputs['exemptions'] f['7'] = f.spouseSum(inputs, 'wages') + f2441['26'] f['8a'] = inputs.get('taxable_interest') f['8b'] = inputs.get('tax_exempt_interest') f['9a'] = inputs.get('dividends') f['9b'] = inputs.get('qualified_dividends') f['10'] = inputs.get('state_refund_taxable') f['12'] = f.spouseSum(inputs, 'business_income') sd = F1040sd(inputs) f.addForm(sd) if sd.mustFile(): f['13'] = sd['21'] or sd['16'] else: f['13'] = inputs.get('capital_gain_dist') if 'F8606' in inputs: if inputs['status'] == FilingStatus.JOINT: f8606 = [ f.addForm(F8606(inputs, 0)), f.addForm(F8606(inputs, 1)) ] f['15b'] = (f8606[0]['15c'] + f8606[0]['18'] + f8606[0]['25'] + f8606[1]['15c'] + f8606[1]['18'] + f8606[1]['25']) \ or None else: f8606 = f.addForm(F8606(inputs, None)) f['15b'] = f8606.rowsum(['15c', '18', '25']) f['19'] = inputs.get('unemployment') f['22'] = f.rowsum([ '7', '8a', '9a', '10', '11', '12', '13', '14', '15b', '16b', '17', '18', '19', '20b', '21' ]) if inputs['status'] == FilingStatus.JOINT: if sse[0].mustFile() or sse[1].mustFile(): f['27'] = ((sse[0]['A6'] or sse[0]['B13'] or 0) + (sse[1]['A6'] or sse[1]['B13'] or 0)) else: if sse.mustFile(): f['27'] = sse['A6'] or sse['B13'] f['36'] = f.rowsum([ '23', '24', '25', '26', '27', '28', '29', '30', '31a', '32', '33', '34', '35' ]) f.comment['37'] = 'AGI' f['37'] = f['22'] - f['36'] f['38'] = f['37'] sa = F1040sa(inputs, f) std = f.STD_DED[inputs['status']] if 'itemize_deductions' in inputs: file_sched_a = inputs['itemize_deductions'] else: file_sched_a = sa['29'] > std if file_sched_a: f.comment['40'] = 'Itemized deductions' f['40'] = sa['29'] f.addForm(sa) else: # TODO: claimed as dependent or born before Jan 2, 1952 or blind f.comment['40'] = 'Standard deduction' f['40'] = std f['41'] = f['38'] - f['40'] f.comment['42'] = 'Exemptions' f['42'] = f.deduction_for_exemptions(inputs['status']) f.comment['43'] = 'Taxable income' f['43'] = max(0, f['41'] - f['42']) # TODO: Schedule D tax worksheet assert (not sd['18'] and not sd['19']) f.comment['44'] = 'Tax' f['44'] = f.div_cap_gain_tax_worksheet(inputs, sd)['27'] # Compute line 46 and 48 now because it's needed by AMT foreign_tax = inputs.get('foreign_tax', 0) assert (foreign_tax < 300 or (foreign_tax < 600 and inputs['status'] == FilingStatus.JOINT)) if foreign_tax: f['48'] = min(foreign_tax, f['44'] + f['46']) f6251 = F6251(inputs, f, sa if file_sched_a else None, sd) f.comment['45'] = 'AMT' f['45'] = f6251.get('35') f.addForm(f6251) f['47'] = f.rowsum(['44', '45', '46']) f['49'] = f2441.part2(f) f['52'] = f.child_tax_credit(inputs) f8801 = F8801(inputs, f, f6251) f['54'] = f8801.get('25') f.addForm(f8801) f.comment['55'] = 'Total credits' f['55'] = f.rowsum(['48', '49', '50', '51', '52', '53', '54']) f['56'] = max(0, f['47'] - f['55']) if inputs['status'] == FilingStatus.JOINT: if sse[0].mustFile() or sse[1].mustFile(): f['57'] = ((sse[0]['A5'] or sse[0]['B12'] or 0) + (sse[1]['A5'] or sse[1]['B12'] or 0)) else: if sse.mustFile(): f['57'] = sse['A5'] or sse['B12'] f8959 = F8959(inputs, f, sse) f8960 = F8960(inputs, f, sa if file_sched_a else None) f['62'] = f8959['18'] + f8960['17'] or None f.addForm(f8959) f.addForm(f8960) f.comment['63'] = 'Total tax' f['63'] = f.rowsum(['56', '57', '58', '59', '60a', '60b', '61', '62']) f['64'] = inputs.get('withholding', 0) + f8959['24'] f['65'] = inputs.get('estimated_payments') # TODO: EIC if inputs.get('ss_withheld'): if inputs['status'] == FilingStatus.JOINT: if inputs['ss_withheld'][0] > f.SS_MAX: f['71'] = inputs['ss_withheld'][0] - f.SS_MAX if inputs['ss_withheld'][1] > f.SS_MAX: f['71'] += inputs['ss_withheld'][1] - f.SS_MAX else: if inputs['ss_withheld'] > f.SS_MAX: f['71'] = inputs['ss_withheld'] - f.SS_MAX f.comment['74'] = 'Total payments' f['74'] = f.rowsum( ['64', '65', '66a', '67', '68', '69', '70', '71', '72', '73']) if f['74'] > f['63']: f.comment['75'] = 'Refund' f['75'] = f['74'] - f['63'] else: f.comment['78'] = 'Amount you owe' f['78'] = f['63'] - f['74'] f8801_2018 = F8801_2018(inputs, f, f6251, f8801, sd) f.addForm(f8801_2018)
def __init__(f, inputs={}): super(F1040, f).__init__(inputs) f.must_file = True f.addForm(f) if inputs['status'] == FilingStatus.JOINT: sse = [] for i in [0, 1]: inputs2 = copy.copy(inputs) for j in ['wages', 'wages_ss', 'business_income']: if j in inputs: inputs2[j] = inputs[j][i] x = F1040sse(inputs2) f.addForm(x) sse.append(x) else: sse = F1040sse(inputs) f.addForm(sse) f2441 = F2441(inputs, sse) f.addForm(f2441) f.comment['1'] = 'Wages' f['1'] = f.spouseSum(inputs, 'wages') + f2441['26'] f['2a'] = inputs.get('tax_exempt_interest') f['2b'] = inputs.get('taxable_interest') f['3a'] = inputs.get('qualified_dividends') f['3b'] = inputs.get('dividends') if 'F8606' in inputs: if inputs['status'] == FilingStatus.JOINT: f8606 = [ f.addForm(F8606(inputs, 0)), f.addForm(F8606(inputs, 1)) ] f['4b'] = (f8606[0]['15c'] + f8606[0]['18'] + f8606[0]['25c'] + f8606[1]['15c'] + f8606[1]['18'] + f8606[1]['25c']) \ or None else: f8606 = f.addForm(F8606(inputs, None)) f['4b'] = f8606.rowsum(['15c', '18', '25c']) f['s12'] = f.spouseSum(inputs, 'business_income') sd = F1040sd(inputs) f.addForm(sd) if sd.mustFile(): f['s13'] = sd['21'] or sd['16'] else: f['s13'] = inputs.get('capital_gain_dist') f['s10'] = inputs.get('state_refund_taxable') f['s19'] = inputs.get('unemployment') f['s22'] = f.rowsum([ 's10', 's11', 's12', 's13', 's14', 's15b', 's16b', 's17', 's18', 's19', 's20b', 's21' ]) f.comment['6'] = 'Total Income' f['6'] = f.rowsum(['1', '2b', '3b', '4b', '5b', 's22']) if inputs['status'] == FilingStatus.JOINT: if sse[0].mustFile() or sse[1].mustFile(): f['s27'] = ((sse[0]['A6'] or sse[0]['B13'] or 0) + (sse[1]['A6'] or sse[1]['B13'] or 0)) else: if sse.mustFile(): f['s27'] = sse['A6'] or sse['B13'] f['s36'] = f.rowsum([ 's23', 's24', 's25', 's26', 's27', 's28', 's29', 's30', 's31a', 's32', 's33', 's34', 's35' ]) f.comment['7'] = 'AGI' f['7'] = f['6'] - f['s36'] sa = F1040sa(inputs, f) std = f.STD_DED[inputs['status']] if 'itemize_deductions' in inputs: sa.must_file = inputs['itemize_deductions'] else: sa.must_file = sa['17'] > std f.addForm(sa) if sa.mustFile(): f.comment['8'] = 'Itemized deductions' f['8'] = sa['17'] else: # TODO: claimed as dependent or born before Jan 2, 1952 or blind f.comment['8'] = 'Standard deduction' f['8'] = std f.comment['10'] = 'Taxable Income' f['10'] = max(0, f['7'] - f['8'] - f['9']) # TODO: Schedule D tax worksheet assert (not sd['18'] and not sd['19']) f.comment['11a'] = 'Regular Tax' f['11a'] = f.div_cap_gain_tax_worksheet(inputs, sd)['27'] # Compute line s48 now because it's needed by AMT foreign_tax = inputs.get('foreign_tax', 0) assert (foreign_tax < 300 or (foreign_tax < 600 and inputs['status'] == FilingStatus.JOINT)) if foreign_tax: f['s48'] = foreign_tax f6251 = F6251(inputs, f, sa if sa.mustFile() else None, sd, sd) f.comment['s45'] = 'AMT' f['s45'] = f6251.get('11') f.addForm(f6251) f['s47'] = f.rowsum(['s45', 's46']) f.comment['11'] = 'Tax' f['11'] = f['11a'] + f['s47'] f['s49'] = f2441.part2(f) f.comment['12a'] = 'Child Tax Credit' f['12a'] = f.child_tax_credit(inputs) f8801 = F8801(inputs, f, f6251) f['s54'] = f8801.get('25') f.addForm(f8801) f.comment['s55'] = 'Nonrefundable credits' f['s55'] = f.rowsum(['s48', 's49', 's50', 's51', 's52', 's53', 's54']) f.comment['12'] = 'Total Credits' f['12'] = f['12a'] + f['s55'] f['13'] = max(0, f['11'] - f['12']) if inputs['status'] == FilingStatus.JOINT: if sse[0].mustFile() or sse[1].mustFile(): f['s57'] = ((sse[0]['A5'] or sse[0]['B12'] or 0) + (sse[1]['A5'] or sse[1]['B12'] or 0)) else: if sse.mustFile(): f['s57'] = sse['A5'] or sse['B12'] f8959 = F8959(inputs, sse) f8960 = F8960(inputs, f, sa if sa.mustFile() else None) f['s62'] = f8959['18'] + f8960['17'] or None f.addForm(f8959) f.addForm(f8960) f['s64'] = f.rowsum( ['s57', 's58', 's59', 's60a', 's60b', 's61', 's62']) f.comment['14'] = 'Other Taxes' f['14'] = f['s64'] f.comment['15'] = 'Total Tax' f['15'] = f.rowsum(['13', '14']) f.comment['16'] = 'Withholding' f['16'] = inputs.get('withholding', 0) + f8959['24'] f['s66'] = inputs.get('estimated_payments') if inputs.get('ss_withheld'): if inputs['status'] == FilingStatus.JOINT: if inputs['ss_withheld'][0] > f.SS_MAX: f['s72'] = inputs['ss_withheld'][0] - f.SS_MAX if inputs['ss_withheld'][1] > f.SS_MAX: f['s72'] += inputs['ss_withheld'][1] - f.SS_MAX else: if inputs['ss_withheld'] > f.SS_MAX: f['s72'] = inputs['ss_withheld'] - f.SS_MAX f['s75'] = f.rowsum(['s66', 's70', 's71', 's72', 's73', 's74']) # TODO: EIC f.comment['17'] = 'Refundable Credits' f['17'] = f['s75'] f.comment['18'] = 'Total payments' f['18'] = f.rowsum(['16', '17']) if f['18'] > f['15']: f.comment['19'] = 'Refund' f['19'] = f['18'] - f['15'] else: f.comment['22'] = 'Amount you owe' f['22'] = f['15'] - f['18'] f8801_2019 = F8801_2019(inputs, f, f6251, f8801, sd) f.addForm(f8801_2019)