Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fyst 789/add child credit xml pdf #4903

Merged
merged 19 commits into from
Nov 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 63 additions & 2 deletions app/controllers/state_file/questions/df_return_sample.xml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,68 @@
</FilingSecurityInformation>
</ReturnHeader>
<ReturnData documentCnt="8">
<IRS1040 documentId="IRS10400001">
<IRS2441 documentId="IRS24414">
<CareProviderGrp>
<CareProviderPersonName>
<PersonFirstNm>Mrs</PersonFirstNm>
<PersonLastNm>Doubtfire</PersonLastNm>
</CareProviderPersonName>
<CareProviderNameControlTxt>DOUB</CareProviderNameControlTxt>
<USAddress>
<AddressLine1Txt>543</AddressLine1Txt>
<CityNm>Great Falls</CityNm>
<StateAbbreviationCd>ME</StateAbbreviationCd>
<ZIPCd>40332</ZIPCd>
</USAddress>
<SSN>111111111</SSN>
<HouseholdEmployeeInd>false</HouseholdEmployeeInd>
<PaidAmt>2000</PaidAmt>
</CareProviderGrp>
<QualifyingPersonGrp>
<QualifyingPersonName>
<PersonFirstNm>Uno</PersonFirstNm>
<PersonLastNm>testerface</PersonLastNm>
</QualifyingPersonName>
<QualifyingPersonNameControlTxt>TEST</QualifyingPersonNameControlTxt>
<QualifyingPersonSSN>222001111</QualifyingPersonSSN>
</QualifyingPersonGrp>
<QualifyingPersonGrp>
<QualifyingPersonName>
<PersonFirstNm>Duo</PersonFirstNm>
<PersonLastNm>testerface</PersonLastNm>
</QualifyingPersonName>
<QualifyingPersonNameControlTxt>TEST</QualifyingPersonNameControlTxt>
<QualifyingPersonSSN>123001234</QualifyingPersonSSN>
<QualifiedCareExpensesPaidAmt>2000</QualifiedCareExpensesPaidAmt>
</QualifyingPersonGrp>
<TotalQlfdExpensesOrLimitAmt>2000</TotalQlfdExpensesOrLimitAmt>
<PrimaryEarnedIncomeAmt>50000</PrimaryEarnedIncomeAmt>
<SpouseEarnedIncomeAmt>50000</SpouseEarnedIncomeAmt>
<SmallerOfExpensesOrIncomeAmt>2000</SmallerOfExpensesOrIncomeAmt>
<AdjustedGrossIncomeAmt>50000</AdjustedGrossIncomeAmt>
<CareExpensesDecimalAmt>0.20</CareExpensesDecimalAmt>
<CalculatedTentativeExpenseAmt>400</CalculatedTentativeExpenseAmt>
<TotalEligCDCCAmt>400</TotalEligCDCCAmt>
<TaxLiabLmtFromCrLmtWrkshtAmt>3193</TaxLiabLmtFromCrLmtWrkshtAmt>
<CreditForChildAndDepdCareAmt>400</CreditForChildAndDepdCareAmt>
<DependentCareBenefitsAmt>2000</DependentCareBenefitsAmt>
<AdjustedDepdCareBenefitsAmt>2000</AdjustedDepdCareBenefitsAmt>
<QualifiedExpensesAmt>2000</QualifiedExpensesAmt>
<SmallerOfAdjOrQualifiedAmt>2000</SmallerOfAdjOrQualifiedAmt>
<EarnedIncomeAmt>48000</EarnedIncomeAmt>
<SpouseIncomeAmt>48000</SpouseIncomeAmt>
<TentativeExclusionAmt>2000</TentativeExclusionAmt>
<SpecifiedAmt>5000</SpecifiedAmt>
<PropshpPrtshpLessAdjBnftAmt>2000</PropshpPrtshpLessAdjBnftAmt>
<ExcludedBenefitsAmt>2000</ExcludedBenefitsAmt>
<TaxableBenefitsAmt>0</TaxableBenefitsAmt>
<AllowedCaredForAmt>6000</AllowedCaredForAmt>
<SumOfDedAndExcludedBenefitsAmt>2000</SumOfDedAndExcludedBenefitsAmt>
<NetAllowableAmt>4000</NetAllowableAmt>
<TotalQualifiedExpensesAmt>2000</TotalQualifiedExpensesAmt>
<SmallerOfTotalQlfyExpensesAmt>2000</SmallerOfTotalQlfyExpensesAmt>
</IRS2441>
<IRS1040 documentId="IRS10400001">
<IndividualReturnFilingStatusCd>4</IndividualReturnFilingStatusCd>
<VirtualCurAcquiredDurTYInd>false</VirtualCurAcquiredDurTYInd>
<Primary65OrOlderInd>X</Primary65OrOlderInd>
Expand Down Expand Up @@ -259,4 +320,4 @@
<StandardOrNonStandardCd>S</StandardOrNonStandardCd>
</IRSW2>
</ReturnData>
</Return>
</Return>
11 changes: 11 additions & 0 deletions app/lib/efile/id/id39_r_calculator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@ def initialize(value_access_tracker:, lines:, intake:)
@value_access_tracker = value_access_tracker
@lines = lines
@intake = intake
@direct_file_data = intake.direct_file_data
@direct_file_json_data = intake.direct_file_json_data
end

def calculate
set_line(:ID39R_B_LINE_3, :calculate_sec_b_line_3)
set_line(:ID39R_B_LINE_6, :calculate_sec_b_line_6)
set_line(:ID39R_B_LINE_18, :calculate_sec_b_line_18)
@lines.transform_values(&:value)
end
Expand All @@ -27,6 +29,15 @@ def calculate_sec_b_line_3
sum.round
end

def calculate_sec_b_line_6
[
@direct_file_data.total_qualifying_dependent_care_expenses,
[12_000 - @direct_file_data.excluded_benefits_amount, 0].max,
@direct_file_data.primary_earned_income_amount,
@direct_file_data.spouse_earned_income_amount,
].min
end

def calculate_sec_b_line_18
@intake.has_health_insurance_premium_yes? ? @intake.health_insurance_paid_amount&.round : 0
end
Expand Down
3 changes: 2 additions & 1 deletion app/lib/efile/id/id40_calculator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,12 @@ def initialize(year:, intake:, include_source: false)
@id39r = Efile::Id::Id39RCalculator.new(
value_access_tracker: @value_access_tracker,
lines: @lines,
intake: @intake
intake: @intake,
)
end

def calculate
@id39r.calculate
set_line(:ID40_LINE_6A, :calculate_line_6a)
set_line(:ID40_LINE_6B, :calculate_line_6b)
set_line(:ID40_LINE_6C, :calculate_line_6c)
Expand Down
29 changes: 29 additions & 0 deletions app/lib/efile/id/id_39r_calculator.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
module Efile
module Id
class Id39rCalculator < ::Efile::TaxCalculator
attr_reader :lines

def initialize(value_access_tracker:, lines:, intake:, year:)
super(intake: intake, year: year)

@value_access_tracker = value_access_tracker
@lines = lines
@intake = intake
@direct_file_data = intake.direct_file_data
end

def calculate
set_line(:ID39R_B_LINE_6, :calculate_line_b_6)
end

def calculate_line_b_6
[
@direct_file_data.total_qualifying_dependent_care_expenses,
[12_000 - @direct_file_data.excluded_benefits_amount, 0].max,
@direct_file_data.primary_earned_income_amount,
@direct_file_data.spouse_earned_income_amount,
].min
end
end
end
end
2 changes: 2 additions & 0 deletions app/lib/efile/line_data.yml
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,8 @@ NYC_EIC_RATE_WK_LINE_5:
label: 'Enter the decimal from the NYC EIC rate table.'
NYC_EIC_RATE_WK_LINE_6:
label: 'Subtract line 4 from line 5 or enter the decimal from the NYC EIC rate table. Also enter on Worksheet C, line 2.'
ID39R_B_LINE_6:
label: 'Child/dependent care. Complete worksheet on page 30, and include federal Form 2441'
ID39R_B_LINE_3:
label: 'Interest from U.S. government obligations'
ID39R_B_LINE_18:
Expand Down
11 changes: 6 additions & 5 deletions app/lib/pdf_filler/id39r_pdf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,19 @@ def initialize(submission)

def hash_for_pdf
answers = {
"BL6" => @xml_document.at('Form39R ChildCareCreditAmt')&.text,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@powersurge360 how come you included the Form39R here, as opposed to the other selectors IncomeUSObligations and HealthInsurancePaid fields?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think you strictly need it if there is only one particular ChildCareCreditAmt. I mostly did it for clarity and specificity I suppose.

"BL3" => @xml_document.at('IncomeUSObligations')&.text,
"BL18" => @xml_document.at('HealthInsurancePaid')&.text,
}
@submission.data_source.dependents.drop(4).first(3).each_with_index do |dependent, index|
answers.merge!(
"FR#{index+1}FirstName" => dependent.first_name,
"FR#{index+1}LastName" => dependent.last_name,
"FR#{index+1}SSN" => dependent.ssn,
"FR#{index+1}Birthdate" => dependent.dob.strftime('%m/%d/%Y'),
"FR#{index + 1}FirstName" => dependent.first_name,
"FR#{index + 1}LastName" => dependent.last_name,
"FR#{index + 1}SSN" => dependent.ssn,
"FR#{index + 1}Birthdate" => dependent.dob.strftime('%m/%d/%Y'),
)
end
answers
end
end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ class Id39R < SubmissionBuilder::Document
def document
build_xml_doc("Form39R") do |xml|
xml.IncomeUSObligations calculated_fields.fetch(:ID39R_B_LINE_3)
xml.ChildCareCreditAmt calculated_fields.fetch(:ID39R_B_LINE_6)
xml.HealthInsurancePaid calculated_fields.fetch(:ID39R_B_LINE_18)
end
end
Expand All @@ -22,4 +23,4 @@ def calculated_fields
end
end
end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ def document
end

private

def filing_status
FILING_STATUS_OPTIONS[@submission.data_source.filing_status]
end
Expand All @@ -49,4 +50,4 @@ def calculated_fields
end
end
end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,4 @@ def supported_documents
end
end
end
end
end
17 changes: 16 additions & 1 deletion app/models/direct_file_data.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ class DirectFileData < DfXmlAccessor
primary_blind: 'IRS1040 PrimaryBlindInd',
spouse_blind: 'IRS1040 SpouseBlindInd',
qualifying_children_under_age_ssn_count: 'IRS1040Schedule8812 QlfyChildUnderAgeSSNCnt',
excluded_benefits_amount: 'IRS2441 ExcludedBenefitsAmt',
primary_earned_income_amount: 'IRS2441 PrimaryEarnedIncomeAmt',
spouse_earned_income_amount: 'IRS2441 SpouseEarnedIncomeAmt',
spouse_claimed_dependent: 'IRS1040 SpouseClaimAsDependentInd',
total_qualifying_dependent_care_expenses: 'IRS2441 TotalQlfdExpensesOrLimitAmt'
}.freeze
Expand Down Expand Up @@ -723,6 +726,18 @@ def determine_eic_attribute(node)
'unfilled'
end
end

def excluded_benefits_amount=(value)
write_df_xml_value(__method__, value)
end

def primary_earned_income_amount=(value)
write_df_xml_value(__method__, value)
end

def spouse_earned_income_amount=(value)
write_df_xml_value(__method__, value)
end

class DfW2 < DfW2Accessor
def w2_box12
Expand Down Expand Up @@ -854,4 +869,4 @@ def can_override?(attribute)

respond_to?("#{attribute}=")
end
end
end
2 changes: 1 addition & 1 deletion app/views/state_file/questions/md_county/edit.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,4 @@
populateSubdivisions(countySelect.value);
});
</script>
<% end %>
<% end %>
Empty file added doc/created.rid
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,67 @@
</AdditionalFilerInformation>
</ReturnHeader>
<ReturnData documentCnt="4">
<IRS2441 documentId="IRS24414">
<CareProviderGrp>
<CareProviderPersonName>
<PersonFirstNm>Mrs</PersonFirstNm>
<PersonLastNm>Doubtfire</PersonLastNm>
</CareProviderPersonName>
<CareProviderNameControlTxt>DOUB</CareProviderNameControlTxt>
<USAddress>
<AddressLine1Txt>543</AddressLine1Txt>
<CityNm>Great Falls</CityNm>
<StateAbbreviationCd>ME</StateAbbreviationCd>
<ZIPCd>40332</ZIPCd>
</USAddress>
<SSN>111111111</SSN>
<HouseholdEmployeeInd>false</HouseholdEmployeeInd>
<PaidAmt>2000</PaidAmt>
</CareProviderGrp>
<QualifyingPersonGrp>
<QualifyingPersonName>
<PersonFirstNm>Uno</PersonFirstNm>
<PersonLastNm>testerface</PersonLastNm>
</QualifyingPersonName>
<QualifyingPersonNameControlTxt>TEST</QualifyingPersonNameControlTxt>
<QualifyingPersonSSN>222001111</QualifyingPersonSSN>
</QualifyingPersonGrp>
<QualifyingPersonGrp>
<QualifyingPersonName>
<PersonFirstNm>Duo</PersonFirstNm>
<PersonLastNm>testerface</PersonLastNm>
</QualifyingPersonName>
<QualifyingPersonNameControlTxt>TEST</QualifyingPersonNameControlTxt>
<QualifyingPersonSSN>123001234</QualifyingPersonSSN>
<QualifiedCareExpensesPaidAmt>2000</QualifiedCareExpensesPaidAmt>
</QualifyingPersonGrp>
<TotalQlfdExpensesOrLimitAmt>2000</TotalQlfdExpensesOrLimitAmt>
<PrimaryEarnedIncomeAmt>50000</PrimaryEarnedIncomeAmt>
<SpouseEarnedIncomeAmt>50000</SpouseEarnedIncomeAmt>
<SmallerOfExpensesOrIncomeAmt>2000</SmallerOfExpensesOrIncomeAmt>
<AdjustedGrossIncomeAmt>50000</AdjustedGrossIncomeAmt>
<CareExpensesDecimalAmt>0.20</CareExpensesDecimalAmt>
<CalculatedTentativeExpenseAmt>400</CalculatedTentativeExpenseAmt>
<TotalEligCDCCAmt>400</TotalEligCDCCAmt>
<TaxLiabLmtFromCrLmtWrkshtAmt>3193</TaxLiabLmtFromCrLmtWrkshtAmt>
<CreditForChildAndDepdCareAmt>400</CreditForChildAndDepdCareAmt>
<DependentCareBenefitsAmt>2000</DependentCareBenefitsAmt>
<AdjustedDepdCareBenefitsAmt>2000</AdjustedDepdCareBenefitsAmt>
<QualifiedExpensesAmt>2000</QualifiedExpensesAmt>
<SmallerOfAdjOrQualifiedAmt>2000</SmallerOfAdjOrQualifiedAmt>
<EarnedIncomeAmt>48000</EarnedIncomeAmt>
<SpouseIncomeAmt>48000</SpouseIncomeAmt>
<TentativeExclusionAmt>2000</TentativeExclusionAmt>
<SpecifiedAmt>5000</SpecifiedAmt>
<PropshpPrtshpLessAdjBnftAmt>2000</PropshpPrtshpLessAdjBnftAmt>
<ExcludedBenefitsAmt>2000</ExcludedBenefitsAmt>
<TaxableBenefitsAmt>0</TaxableBenefitsAmt>
<AllowedCaredForAmt>6000</AllowedCaredForAmt>
<SumOfDedAndExcludedBenefitsAmt>2000</SumOfDedAndExcludedBenefitsAmt>
<NetAllowableAmt>4000</NetAllowableAmt>
<TotalQualifiedExpensesAmt>2000</TotalQualifiedExpensesAmt>
<SmallerOfTotalQlfyExpensesAmt>2000</SmallerOfTotalQlfyExpensesAmt>
</IRS2441>
<IRS1040 documentId="IRS10400001">
<IndividualReturnFilingStatusCd>2</IndividualReturnFilingStatusCd>
<SpouseNm>Moira O'Hara</SpouseNm>
Expand Down Expand Up @@ -276,4 +337,4 @@
<StandardOrNonStandardCd>S</StandardOrNonStandardCd>
</IRSW2>
</ReturnData>
</Return>
</Return>
Loading
Loading