diff --git a/edivorce/apps/core/templates/pdf/partials/fact_sheet_f.html b/edivorce/apps/core/templates/pdf/partials/fact_sheet_f.html index ab86e87e..765b5926 100644 --- a/edivorce/apps/core/templates/pdf/partials/fact_sheet_f.html +++ b/edivorce/apps/core/templates/pdf/partials/fact_sheet_f.html @@ -1,47 +1,14 @@ {% load format_utils %} {% if derived.show_fact_sheet_f %}
-

- Supplementary Child Support Fact Sheet F:
- Income Over $150,000 -

- - - - - - - - - - - - - - - - - - - - - - - -
A - Number of children for whom support is claimed: - {{ responses.number_children_seeking_support }} -
BGuidelines table amount for $150,000$ - {{ responses.child_support_amount_under_high_income|money:False }} -
C - Plus {{ responses.percent_income_over_high_income_limit }}% - of income over $150,000 - $ - {{ responses.amount_income_over_high_income_limit|money:False }} -
DGuidelines table amount$ - {{ derived.high_income_amount|money:False }} -
+ {% if derived.show_fact_sheet_f_you %} + {% include 'pdf/partials/fact_sheet_f_table.html' with claimant_id='you'%} + {% endif %} + + {% if derived.show_fact_sheet_f_spouse %} + {% include 'pdf/partials/fact_sheet_f_table.html' with claimant_id='spouse'%} + {% endif %} {% if responses.does_payour_amount_match_guidelines == 'YES' %}

diff --git a/edivorce/apps/core/templates/pdf/partials/fact_sheet_f_table.html b/edivorce/apps/core/templates/pdf/partials/fact_sheet_f_table.html new file mode 100644 index 00000000..a5635ec2 --- /dev/null +++ b/edivorce/apps/core/templates/pdf/partials/fact_sheet_f_table.html @@ -0,0 +1,48 @@ +{% load format_utils %} +

+Supplementary Child Support Fact Sheet F:
+Income Over $150,000 +

+ + + + + + + + + + + + + + + + + + + + + + + +
A + Number of children for whom support is claimed: + {% lookup responses 'number_children_seeking_support_'|add:claimant_id %} +
BGuidelines table amount for $150,000$ + + {% lookup responses 'child_support_amount_under_high_income_'|add:claimant_id True %} + +
C + Plus + {% lookup responses 'percent_income_over_high_income_limit_'|add:claimant_id %}% + of income over $150,000 + $ + + {% lookup responses 'amount_income_over_high_income_limit_'|add:claimant_id True %} + +
DGuidelines table amount$ + + {% lookup responses 'total_guideline_amount_'|add:claimant_id True %} + +
\ No newline at end of file diff --git a/edivorce/apps/core/templatetags/format_utils.py b/edivorce/apps/core/templatetags/format_utils.py index d5425718..767df889 100644 --- a/edivorce/apps/core/templatetags/format_utils.py +++ b/edivorce/apps/core/templatetags/format_utils.py @@ -168,3 +168,13 @@ def integer(value): return int(float(value)) except ValueError: return '' + + +@register.simple_tag() +def lookup(obj, property, money_format=None): + """ Return the value of a dynamic property within an object""" + val = obj.get(property, '') + # if money_format: + # return money(val) + # else: + return val diff --git a/edivorce/apps/core/templatetags/summary_format.py b/edivorce/apps/core/templatetags/summary_format.py index c164f1a1..78ade854 100644 --- a/edivorce/apps/core/templatetags/summary_format.py +++ b/edivorce/apps/core/templatetags/summary_format.py @@ -170,7 +170,8 @@ def format_children(context, source): show_fact_sheet = True elif question == 'Undue Hardship (Fact Sheet E)' and context['derived']['show_fact_sheet_e']: show_fact_sheet = True - elif question == 'Income over $150,000 (Fact Sheet F)' and context['derived']['show_fact_sheet_f']: + elif question == 'Income over $150,000 (Fact Sheet F)' and ( + context['derived']['show_fact_sheet_f_you'] or context['derived']['show_fact_sheet_f_spouse']): show_fact_sheet = True if show_fact_sheet and len(fact_sheet_mapping[question]): diff --git a/edivorce/apps/core/utils/derived.py b/edivorce/apps/core/utils/derived.py index 38b04b01..e9f2727e 100644 --- a/edivorce/apps/core/utils/derived.py +++ b/edivorce/apps/core/utils/derived.py @@ -30,6 +30,8 @@ DERIVED_DATA = [ 'show_fact_sheet_d', 'show_fact_sheet_e', 'show_fact_sheet_f', + 'show_fact_sheet_f_you', + 'show_fact_sheet_f_spouse', 'has_fact_sheets', 'schedule_1_amount', 'child_support_payor', @@ -195,6 +197,16 @@ def show_fact_sheet_f(responses, derived): """ If one of the claimants earns over $150,000, Fact Sheet F is indicated. """ + return show_fact_sheet_f_you(responses, derived) or show_fact_sheet_f_spouse(responses, derived) + + +def show_fact_sheet_f_you(responses, derived): + """ + + :param responses: + :param derived: + :return: + """ payor = child_support_payor(responses, derived) try: @@ -202,12 +214,24 @@ def show_fact_sheet_f(responses, derived): except ValueError: annual = 0 + return (payor == 'Claimant 1' or payor == 'both Claimant 1 and Claimant 2') and annual > 150000 + + +def show_fact_sheet_f_spouse(responses, derived): + """ + + :param responses: + :param derived: + :return: + """ + payor = child_support_payor(responses, derived) + try: - spouses = float(responses.get('spouse_annual_gross_income', 0)) + annual = float(responses.get('spouse_annual_gross_income', 0)) except ValueError: - spouses = 0 + annual = 0 - return (payor == 'Claimant 1' and annual > 150000) or (payor == 'Claimant 2' and spouses > 150000) + return (payor == 'Claimant 2' or payor == 'both Claimant 1 and Claimant 2') and annual > 150000 def has_fact_sheets(responses, derived): @@ -552,7 +576,6 @@ def pursuant_parenting_arrangement(responses, derived): act = 'Pursuant to %s,' % act if act != '' else act try: arrangements = responses.get('order_respecting_arrangement', '').split('\n') - print(arrangements) return ['%s %s' % (act, arrangement.strip()) for arrangement in arrangements if len(arrangement.strip()) > 0]