{% extends 'D2PartnerBundle::base.html.twig' %} {% block head_script_extra %} {% endblock head_script_extra %} {% block page_header %} {% set months = {1:"Jan", 2:"Feb", 3:"Mar", 4:"Apr", 5:"May", 6:"Jun", 7:"Jul", 8:"Aug", 9:"Sep", 10:"Oct", 11:"Nov", 12:"Dec"} %}
{% for k, v in app.request.query %} {% if k|lower not in ['search', 'page', 'partner', 'ma_account'] %} {% endif %} {% endfor %}
{% endblock page_header %} {% block content %} {% if error == false %} {% set balance = opening_balance %} {% set cur_month = 0 %} {% set cur_year = 0 %} {% for item in items %} {% if item['type'] == 'STATEMENT' %} {% set cur_month = item['month'] + 1 %} {% set cur_year = item['year'] %} {% if cur_month > 12 %} {% set cur_month = 1 %} {% set cur_year = cur_year + 1 %} {% endif %} {% set derived_aging = d2_shift_derived_statement_aging(derived_aging) %} {% else %} {% set cur_period_indx = item['month'] ~ '/' ~ item['year'] %} {% if item['type'] == 'INVOICE' %} {% set balance = balance + item['debit'] %} {% set derived_aging = d2_update_derived_statement_aging(derived_aging, item['type'], cur_month, cur_year, item['month'], item['year'], item['debit']) %} {% endif %} {% if item['type'] == 'CREDIT' %} {% set balance = balance - item['credit'] %} {% if item['alloc'] is null %} {% set derived_aging = d2_update_derived_statement_aging(derived_aging, item['type'], cur_month, cur_year, item['month'], item['year'], item['credit']) %} {% else %} {% for cred_alloc in item['alloc'] %} {% set derived_aging = d2_update_derived_statement_aging(derived_aging, item['type'], cur_month, cur_year, cred_alloc['month'], cred_alloc['year'], cred_alloc['amount']) %} {% endfor %} {% endif %} {% endif %} {% if item['type'] == 'PAYMENT' %} {% set balance = balance - item['payment'] %} {% set derived_aging = d2_update_derived_statement_aging(derived_aging, item['type'], cur_month, cur_year, item['month'], item['year'], item['payment']) %} {% endif %} {% if item['type'] == 'ADJUSTMENT' %} {% set balance = balance - item['credit'] + item['debit'] %} {% set derived_aging = d2_update_derived_statement_aging(derived_aging, item['type'], cur_month, cur_year, item['month'], item['year'], item['debit'] - item['credit']) %} {% endif %} {% endif %} {% endfor %}
Partner MA Account Period Date Document Debit Credit Balance
{{ opening_balance|number_format(2, '.', '') }}
{{ item['month'] }} / {{ item['year'] }} {{ item['date']|date("Y/m/d") }} {% set statement = d2_partner_get_statement(partner, ma_account, item['month'], item['year']) %}
{% if statement is not null %}Partner Statement{% else %} STATEMENT NOT LOADED {% endif %}
120 days90 days60 days30 daysCurrentDue
{{ item['120_days']|number_format(2, '.', '') }} {{ item['90_days']|number_format(2, '.', '') }} {{ item['60_days']|number_format(2, '.', '') }} {{ item['30_days']|number_format(2, '.', '') }} {{ item['current']|number_format(2, '.', '') }} {{ item['due']|number_format(2, '.', '') }}
Payments{{ item['payment']|number_format(2, '.', ' ') }}
Un-Allocated
{% set period_indx = item['month'] ~ '/' ~ item['year'] %}
Derived Statement
120 days90 days60 days30 daysCurrentDue
{{ derived_aging['120_days']|number_format(2, '.', '') }} {{ derived_aging['90_days']|number_format(2, '.', '') }} {{ derived_aging['60_days']|number_format(2, '.', '') }} {{ derived_aging['30_days']|number_format(2, '.', '') }} {{ derived_aging['current']|number_format(2, '.', '') }} {{ balance|number_format(2, '.', '') }}
Payments{{ derived_aging['payment']|number_format(2, '.', ' ') }}
Un-Allocated
{{ item['partner'] | trim }} {{ item['ma_account'] | trim }} {{ item['month'] }} / {{ item['year'] }} {{ item['date']|date("Y/m/d") }} {% if item['type'] == 'INVOICE' %} {% elseif item['type'] == 'CREDIT' %} {% elseif item['type'] == 'PAYMENT' %} {% elseif item['type'] == 'ADJUSTMENT' %} {% endif %} {{ item['number'] | trim }} {% if item['type'] == 'INVOICE' %} {% set linked_credits = d2_partner_get_invoice_credits(item['id']) %} {% if item['alloc'] and (item['alloc'].amount != item['debit'])%} [Payment: {{ item['alloc'].amount|number_format(2, '.', '') }}] {% elseif item['alloc'] is null%} [Payment not allocated] {% endif %} {% if linked_credits|length > 0 %} [Credits: {% for cred in linked_credits %} {{ cred.creditNote.creditNoteNumber }}: {{ cred.amountIncVat|number_format(2, '.', '') }} {% endfor %} ] {% endif %} {% endif %} {% if item['type'] == 'INVOICE' %} {{ item['debit']|number_format(2, '.', '') }} {% elseif item['type'] == 'ADJUSTMENT' and item['debit'] > 0.00 %} {{ item['debit']|number_format(2, '.', '') }} {% endif %} {% if item['type'] == 'CREDIT' %} {{ item['credit']|number_format(2, '.', '') }} {% elseif item['type'] == 'PAYMENT' %} {{ item['payment']|number_format(2, '.', '') }} {% elseif item['type'] == 'ADJUSTMENT' and item['credit'] > 0.00 %} {{ item['credit']|number_format(2, '.', '') }} {% endif %} {{ balance|number_format(2, '.', '') }}
{% else %}

PLEASE SELECT A PARTNER AND MA ACCOUNT

{% endif %} {% endblock content %}