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 @@
  • -
      + {% if responses.how_will_calculate_income == 'using specific rules' %} +
      1. Claimant 1's annual income as determined under sections 15 to 20 of the Guidelines: {{ responses.annual_gross_income|money }} @@ -174,11 +175,14 @@ 20 of the Guidelines: {{ responses.spouse_annual_gross_income|money }}
      2. -
      3. Claimant 1 and Claimant 2 have entered into an agreement as - to income pursuant to section 15(2) of the Guidelines, a copy - of which agreement is attached.
      4. -
      5. Section 4 is omitted as inapplicable.
      + {% elif responses.how_will_calculate_income == 'entered agreement' %} + Claimant 1 and Claimant 2 have entered into an agreement as to + income pursuant to section 15(2) of the Guidelines, a copy of which + agreement is attached. + {% else %} + Section 4 is omitted as inapplicable. + {% endif %}
    1. @@ -301,6 +305,11 @@ {% include 'pdf/partials/notary_signature.html' with name=responses.name_you %} {% include 'pdf/partials/notary_signature.html' with name=responses.name_spouse %} {% include 'pdf/partials/fact_sheet_a.html' %} + {% include 'pdf/partials/fact_sheet_b.html' %} + {% include 'pdf/partials/fact_sheet_c.html' %} + {% include 'pdf/partials/fact_sheet_d.html' %} + {% include 'pdf/partials/fact_sheet_e.html' %} + {% include 'pdf/partials/fact_sheet_f.html' %} Printed on {% now "F jS, Y" %} from https://justice.gov.bc.ca/divorce diff --git a/edivorce/apps/core/templates/pdf/partials/fact_sheet_a.html b/edivorce/apps/core/templates/pdf/partials/fact_sheet_a.html index 838ecabb..b998cf85 100644 --- a/edivorce/apps/core/templates/pdf/partials/fact_sheet_a.html +++ b/edivorce/apps/core/templates/pdf/partials/fact_sheet_a.html @@ -1,4 +1,5 @@ {% load format_utils %} +{% if derived.show_fact_sheet_a %}

      Supplementary Child Support Fact Sheet A
      @@ -7,13 +8,13 @@

      Section 7 expenses (net of tax credits and contribution from child, etc.):

      - +
      - - - - + + + + @@ -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 %} +
      +

      + Supplementary Child Support Fact Sheet B:
      + If the Circumstances Described in s. 9 of the Child Support Guidelines Exist +

      + +
      AnnualMonthlyAnnualMonthly
      A
      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Claimant 1Claimant 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 }}. +

      + +

      +{% endif %} diff --git a/edivorce/apps/core/templates/pdf/partials/fact_sheet_c.html b/edivorce/apps/core/templates/pdf/partials/fact_sheet_c.html new file mode 100644 index 00000000..df4fd47a --- /dev/null +++ b/edivorce/apps/core/templates/pdf/partials/fact_sheet_c.html @@ -0,0 +1,72 @@ +{% load format_utils %} +{% if derived.show_fact_sheet_c %} +
      +

      + Supplementary Child Support Fact Sheet C:
      + If the Circumstances Described in s. 8 of the Child Support Guidelines Exist +

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      Amount
      ANumber of children principally resident with Claimant 1 for whom support is claimed + {{ responses.number_of_children_claimant }} +
      BClaimant 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 }} +
      DNumber of children principally resident with Claimant 2 for whom support is claimed + {{ responses.number_of_children_claimant }} +
      EClaimant 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 }} +

      +
      +{% endif %} diff --git a/edivorce/apps/core/templates/pdf/partials/fact_sheet_d.html b/edivorce/apps/core/templates/pdf/partials/fact_sheet_d.html new file mode 100644 index 00000000..db383069 --- /dev/null +++ b/edivorce/apps/core/templates/pdf/partials/fact_sheet_d.html @@ -0,0 +1,39 @@ +{% load format_utils %} +{% if derived.show_fact_sheet_d %} +
      +

      + Supplementary Child Support Fact Sheet D:
      + Child(ren) 19 Years or Older +

      + +
        +
      1. + Number of child(ren) 19 years of age or older for whom support is claimed: + {{ responses.number_children_over_19_need_support }} +
      2. +
      3. + Child support is to be paid by {{ derived.child_support_payor }} (the “payor”) +
      4. +
      5. + Monthly Guidelines table amount of the payor under Schedule 1 of the Guidelines: + {{ derived.schedule_1_amount|money }} +
      6. +
      + + {% if responses.does_payour_amount_match_guidelines == 'YES' %} +

      + 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 %} +
      +{% endif %} diff --git a/edivorce/apps/core/templates/pdf/partials/fact_sheet_e.html b/edivorce/apps/core/templates/pdf/partials/fact_sheet_e.html new file mode 100644 index 00000000..0223e5e8 --- /dev/null +++ b/edivorce/apps/core/templates/pdf/partials/fact_sheet_e.html @@ -0,0 +1,180 @@ +{% load format_utils %} +{% if derived.show_fact_sheet_e %} +
      +

      + Supplementary Child Support Fact Sheet E:
      + Undue Hardship +

      + +
        + {% if derived.claimant_debts %} +
      1. +

        + Responsibility for unusually high debts reasonably incurred to support + the family before separation or in order to earn a living +

        + + + + + + + + + {% for debt in derived.claimant_debts %} + + + + + + {% endfor %} + +
        Debt Owed ToTerms of DebtMonthly Amount
        {{ debt.debt_name }}{{ debt.debt_terms }}$ + {{ debt.debt_monthly_amount|money:False }} +
        +
      2. + {% endif %} + + {% if derived.claimant_expenses %} +
      3. +

        + Unusually high expenses for exercising parenting time or contact with, + or access to a child +

        + + + + + + + + {% for expense in derived.claimant_expenses %} + + + + + {% endfor %} + +
        Details of ExpenseAmount
        {{ expense.expense_name }}$ + {{ expense.expense_amount|money:False }} +
        +
      4. + {% endif %} + + {% if derived.supported_non_dependents %} +
      5. +

        + Legal duty under a court order or separation agreement to support + another person +

        + + + + + + + + + {% for supported in derived.supported_non_dependents %} + + + + + + {% endfor %} + +
        Name of PersonRelationshipNature of Duty
        {{ supported.non_dependent_name }}{{ supported.non_dependent_relationship }}{{ supported.non_dependent_reason }}
        +
      6. + {% endif %} + + {% if derived.supported_dependents %} +
      7. +

        Legal duty to support a child, other than a child for whom support is claimed, who is

        +
          +
        1. Under age 19, or
        2. +
        3. + 19 or older but unable to support himself or herself because of + illness, disability or other cause +
        4. +
        + + + + + + + + + {% for supported in derived.supported_dependents %} + + + + + + {% endfor %} + +
        Name of PersonRelationshipNature of Duty
        {{ supported.supporting_dependent_name }}{{ supported.supporting_dependent_relationship }}{{ supported.supporting_dependent_reason }}
        +
      8. + {% endif %} + + {% if derived.supported_disabled %} +
      9. +

        + Legal duty to support a person who is unable to support himself or + herself because of illness ordisability +

        + + + + + + + + + {% for supported in derived.supported_disabled %} + + + + + + {% endfor %} + +
        Name of PersonRelationshipNature of Duty
        {{ supported.supporting_disabled_name }}{{ supported.supporting_disabled_relationship }}{{ supported.supporting_disabled_reason }}
        + {% endif %} +
      10. + +
      11. +

        Other undue hardship circumstances:

        +

        {{ responses.undue_hardship|linebreaksbr }}

        +
      12. + +
      + + {% if derived.others_income %} +

      Income of Other Persons in Household

      + + + + + + + + {% for income in derived.others_income %} + + + + + {% endfor %} + + + + + +
      Name of PersonAnnual Income
      {{ income.income_others_name }}$ + {{ income.income_others_amount|money:False }} +
      Total$ + {{ derived.total_others_income|money:False }} +
      + {% endif %} +
      +{% endif %} diff --git a/edivorce/apps/core/templates/pdf/partials/fact_sheet_f.html b/edivorce/apps/core/templates/pdf/partials/fact_sheet_f.html new file mode 100644 index 00000000..b1f68d45 --- /dev/null +++ b/edivorce/apps/core/templates/pdf/partials/fact_sheet_f.html @@ -0,0 +1,67 @@ +{% 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 responses.does_payour_amount_match_guidelines == 'YES' %} +

      + 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: +

        +
      1. {{ responses.order_monthly_child_support_amount|money }}, and
      2. +
      3. +

        differs from the Guidelines table amount because:

        +

        reasons

        +
      4. +
      +

      +

      +

      + {% endif %} + +
      +{% endif %} diff --git a/edivorce/apps/core/templates/question/06_children_facts.html b/edivorce/apps/core/templates/question/06_children_facts.html index c68781da..f9b923cc 100644 --- a/edivorce/apps/core/templates/question/06_children_facts.html +++ b/edivorce/apps/core/templates/question/06_children_facts.html @@ -1,5 +1,6 @@ {% extends 'base.html' %} {% load input_field %} +{% load format_utils %} {% load step_order %} {% load format_utils %} @@ -637,7 +638,7 @@ {% endif %} -{% if annual_gross_income|add:"0" > 150000 %} +{% if annual_gross_income|integer > 150000 %}

      Income over $150,000 (Fact Sheet F)

      @@ -873,4 +874,4 @@ {% block sidebarText %}

      The Federal Child Support Guidelines

      Step-by-Step guide

      -{% 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