diff --git a/edivorce/apps/core/static/css/weasyprint.css b/edivorce/apps/core/static/css/weasyprint.css index 06578c8a..fe4b7fa6 100644 --- a/edivorce/apps/core/static/css/weasyprint.css +++ b/edivorce/apps/core/static/css/weasyprint.css @@ -220,3 +220,24 @@ ol.numbered-paragraphs li { .fact-sheet .table.table-bordered tbody tr .total { text-align: right; } + +ol.parens-list { + counter-reset: list; + margin-bottom: 10px; +} + +ol.parens-list > li { + list-style: none; + position: relative; +} + +ol.parens-list > li:before { + counter-increment: list; + content: "(" counter(list, lower-alpha) ") "; + position: absolute; + left: -2.5em; +} + +.th-left { + text-align: left !important; +} diff --git a/edivorce/apps/core/templates/pdf/form37_we.html b/edivorce/apps/core/templates/pdf/form37_we.html index 8387e6e8..f373b396 100644 --- a/edivorce/apps/core/templates/pdf/form37_we.html +++ b/edivorce/apps/core/templates/pdf/form37_we.html @@ -165,7 +165,8 @@
Section 7 expenses (net of tax credits and contribution from child, etc.):
-| - | - | Annual | -Monthly | ++ | + | Annual | +Monthly | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| A | @@ -124,3 +125,4 @@ {{ derived.total_monthly_support_1_and_a|money }} +{% endif %} diff --git a/edivorce/apps/core/templates/pdf/partials/fact_sheet_b.html b/edivorce/apps/core/templates/pdf/partials/fact_sheet_b.html new file mode 100644 index 00000000..159bde61 --- /dev/null +++ b/edivorce/apps/core/templates/pdf/partials/fact_sheet_b.html @@ -0,0 +1,85 @@ +{% load format_utils %} +{% if derived.show_fact_sheet_b %} +|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| + | Claimant 1 | +Claimant 2 | +
|---|---|---|
| + | {{ derived.claimant_1_share_proportion|stringformat:".1f" }} % | +$ + {{ derived.claimant_1_share|money:False }} + | +
| Number of children: {{ responses.number_of_children }} | +||
| Approximate percentage of time children spend with each parent | +{{ responses.time_spent_with_you }} % | +{{ responses.time_spent_with_spouse }} % | +
| Annual Guidelines Income | +$ + {{ responses.annual_gross_income|money:False }} + | +$ + {{ responses.spouse_annual_gross_income|money:False }} + | +
| Guidelines Table Amount | +$ + {{ responses.total_paid_child_support|money:False }} + | +$ + {{ responses.total_spouse_paid_child_support|money:False }} + | +
| + Difference between the Guidelines table amount of Claimant 1 and the + Guidelines table amount of Claimant 2 + | +$ + {{ derived.guideline_amounts_difference|money:False }} + | +|
| Section 7 expenses paid directly by each party | +$ + {{ derived.claimant_1_share|money:False }} + | +$ + {{ derived.claimant_2_share|money:False }} + | +
+ Any other relevant information regarding the conditions, means, needs and + other circumstances of each spouse or of any child for whom support is + sought: +
+ +{{ responses.additional_relevant_spouse_children_info }}
+ ++ It is proposed that child support in the amount of + {{ derived.total_monthly_support_1_and_a|money }} + per month be paid by {{ derived.child_support_payor }}. +
+ +| + | + | Amount | +
|---|---|---|
| A | +Number of children principally resident with Claimant 1 for whom support is claimed | ++ {{ responses.number_of_children_claimant }} + | +
| B | +Claimant 2's annual Guidelines income | +$ + {{ responses.spouse_annual_gross_income|money:False }} + | +
| C | ++ Guidelines table amount payable by Claimant 2 for + {{ responses.number_of_children_claimant|child_or_children }} + | +$ + {{ responses.total_spouse_paid_child_support|money:False }} + | +
| D | +Number of children principally resident with Claimant 2 for whom support is claimed | ++ {{ responses.number_of_children_claimant }} + | +
| E | +Claimant 1's annual Guidelines income | +$ + {{ responses.annual_gross_income|money:False }} + | +
| F | ++ Guidelines table amount payable by Claimant 1 for + {{ responses.number_of_children_claimant|child_or_children }} + | +$ + {{ responses.total_paid_child_support|money:False }} + | +
+ Difference between the Guidelines table amounts at Lines C and F: + {{ derived.guideline_amounts_difference|money }} +
++ The person swearing this affidavit says that the Guidelines table amount + is appropriate. +
+ {% else %} ++ The person swearing this affidavit says that the Guidelines table amount + is inappropriate and that the appropriate amount would be + {{ responses.order_monthly_child_support_amount|money }} + for the following reasons: +
++
+ {% endif %} ++ Responsibility for unusually high debts reasonably incurred to support + the family before separation or in order to earn a living +
+ +| Debt Owed To | +Terms of Debt | +Monthly Amount | +
|---|---|---|
| {{ debt.debt_name }} | +{{ debt.debt_terms }} | +$ + {{ debt.debt_monthly_amount|money:False }} + | +
+ Unusually high expenses for exercising parenting time or contact with, + or access to a child +
+ +| Details of Expense | +Amount | +
|---|---|
| {{ expense.expense_name }} | +$ + {{ expense.expense_amount|money:False }} + | +
+ Legal duty under a court order or separation agreement to support + another person +
+ +| Name of Person | +Relationship | +Nature of Duty | +
|---|---|---|
| {{ supported.non_dependent_name }} | +{{ supported.non_dependent_relationship }} | +{{ supported.non_dependent_reason }} | +
Legal duty to support a child, other than a child for whom support is claimed, who is
+| Name of Person | +Relationship | +Nature of Duty | +
|---|---|---|
| {{ supported.supporting_dependent_name }} | +{{ supported.supporting_dependent_relationship }} | +{{ supported.supporting_dependent_reason }} | +
+ Legal duty to support a person who is unable to support himself or + herself because of illness ordisability +
+ +| Name of Person | +Relationship | +Nature of Duty | +
|---|---|---|
| {{ supported.supporting_disabled_name }} | +{{ supported.supporting_disabled_relationship }} | +{{ supported.supporting_disabled_reason }} | +
Other undue hardship circumstances:
+{{ responses.undue_hardship|linebreaksbr }}
+| Name of Person | +Annual Income | +
|---|---|
| {{ income.income_others_name }} | +$ + {{ income.income_others_amount|money:False }} + | +
| Total | +$ + {{ derived.total_others_income|money:False }} + | +
| A | ++ Number of children for whom support is claimed: + {{ responses.number_children_seeking_support }} + | ++ |
| B | +Guidelines 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 }} + | +
| D | +Guidelines table amount | +$ + {{ derived.high_income_amount|money:False }} + | +
+ We have agreed on the Guidelines table amount set out at Line D above as + the amount of child support. +
+ {% else %} ++ We have agreed on an amount of child support that differs from the Guidelines table amount and the amount of child support agreed on is: +
differs from the Guidelines table amount because:
+reasons
++
+ {% endif %} + +The Federal Child Support Guidelines
-{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/edivorce/apps/core/templatetags/format_utils.py b/edivorce/apps/core/templatetags/format_utils.py index fd134093..5247a7eb 100644 --- a/edivorce/apps/core/templatetags/format_utils.py +++ b/edivorce/apps/core/templatetags/format_utils.py @@ -1,3 +1,6 @@ +# pylint: disable=invalid-name +""" Template formatting helpers """ + from datetime import datetime import locale import re @@ -83,6 +86,7 @@ def checkbox(context, *args, **kwargs): return mark_safe('' % ('-check' if args_pass and kwargs_pass else '')) + @register.filter def claimantize(value, claimant='1'): """ Replace 'you' with 'claimant 1' and 'spouse' with 'claimant 2' """ @@ -90,6 +94,7 @@ def claimantize(value, claimant='1'): value = value.replace('spouse', 'claimant\xa0%s' % '2' if claimant == '1' else '1') return value + @register.filter def age(date): """ @@ -136,4 +141,29 @@ def payorize(context): return payor +@register.filter +def child_or_children(value): + """ Return num followed by 'child' or 'children' as appropriate """ + + try: + value = int(value) + except ValueError: + return '' + + if value == 1: + return '1 child' + + return '%d children' + + +@register.filter +def integer(value): + """ Return value as an int or nothing """ + try: + print(value) + print(float(value)) + print(int(float(value))) + return int(float(value)) + except ValueError: + return '' diff --git a/edivorce/apps/core/utils/derived.py b/edivorce/apps/core/utils/derived.py index 9f970b25..f76fb81f 100644 --- a/edivorce/apps/core/utils/derived.py +++ b/edivorce/apps/core/utils/derived.py @@ -1,4 +1,4 @@ -# pylint: disable=W0613 +# pylint: disable=W0613,C0103 """Values derived from a user's responses. This module provides functions to take a set of responses from a user and create @@ -46,6 +46,15 @@ DERIVED_DATA = [ 'claimant_2_share_proportion', 'claimant_2_share', 'total_monthly_support_1_and_a', + 'guideline_amounts_difference', + 'claimant_debts', + 'claimant_expenses', + 'supported_dependents', + 'supported_non_dependents', + 'supported_disabled', + 'others_income', + 'total_others_income', + 'high_income_amount', ] @@ -168,12 +177,12 @@ def show_fact_sheet_f(responses, derived): """ try: - annual = int(responses.get('annual_gross_income', 0)) + annual = float(responses.get('annual_gross_income', 0)) except ValueError: annual = 0 try: - spouses = int(responses.get('spouse_annual_gross_income', 0)) + spouses = float(responses.get('spouse_annual_gross_income', 0)) except ValueError: spouses = 0 @@ -314,7 +323,7 @@ def claimant_1_share_proportion(responses, derived): def claimant_1_share(responses, derived): """ - Return the proportionate share of claimant 1 for child support, based on + Return the proportionate amount of claimant 1 for child support, based on annual income. """ @@ -335,7 +344,7 @@ def claimant_2_share_proportion(responses, derived): def claimant_2_share(responses, derived): """ - Return the proportionate share of claimant 2 for child support, based on + Return the proportionate amount of claimant 2 for child support, based on annual income. """ @@ -354,3 +363,106 @@ def total_monthly_support_1_and_a(responses, derived): else: total += derived['total_section_seven_expenses'] return total + + +def guideline_amounts_difference(responses, derived): + """ + Return the difference between the guideline amounts to be paid by + claimant 1 and claimant 2 + """ + + try: + amount_1 = float(responses.get('total_paid_child_support', 0)) + except ValueError: + amount_1 = 0 + + try: + amount_2 = float(responses.get('total_spouse_paid_child_support', 0)) + except ValueError: + amount_2 = 0 + + return abs(amount_1 - amount_2) + + +def claimant_debts(responses, derived): + """ Return the parsed array of claimant_debts """ + + try: + return json.loads(responses.get('claimant_debts', [])) + except ValueError: + return [] + + +def claimant_expenses(responses, derived): + """ Return the parsed array of claimant_expenses """ + + try: + return json.loads(responses.get('claimant_expenses', [])) + except ValueError: + return [] + + +def supported_dependents(responses, derived): + """ Return the parsed array of supporting_dependents """ + + try: + return json.loads(responses.get('supporting_dependents', [])) + except ValueError: + return [] + + +def supported_non_dependents(responses, derived): + """ Return the parsed array of supporting_non_dependents """ + + try: + return json.loads(responses.get('supporting_non_dependents', [])) + except ValueError: + return [] + + +def supported_disabled(responses, derived): + """ Return the parsed array of supporting_disabled """ + + try: + return json.loads(responses.get('supporting_disabled', [])) + except ValueError: + return [] + + +def others_income(responses, derived): + """ Return the parsed array of income_others """ + + try: + return json.loads(responses.get('income_others', [])) + except ValueError: + return [] + + +def total_others_income(responses, derived): + """ Return the total of other incomes """ + + total = 0.0 + + for income in derived['others_income']: + try: + total += float(income['income_others_amount']) + except ValueError: + pass + + return total + + +def high_income_amount(responses, derived): + """ Return the guidelines table amount for a high income earner """ + + try: + under = float(responses.get('child_support_amount_under_high_income', 0)) + except ValueError: + under = 0 + + try: + over = float(responses.get('amount_income_over_high_income_limit', 0)) + except ValueError: + over = 0 + + return under + over