{% set months = {0:"--", 1:"Jan", 2:"Feb", 3:"Mar", 4:"Apr", 5:"May", 6:"Jun", 7:"Jul", 8:"Aug", 9:"Sep", 10:"Oct", 11:"Nov", 12:"Dec"} %} {% if unallocated_credits|length > 0 %}

Credit Notes not assigned to Accounting Period

Show Month {% for credit_note in unallocated_credits %} {% set row_class = 'success' %} {% set row_title = 'Ready to Allocate' %} {% if credit_note.allocations|length == 0 %} {% set row_class = 'error' %} {% set row_title = 'No allocations on Credit Note' %} {% else %} {% set alloc_ex_vat = 0 %} {% for credit_alloc in credit_note.allocations %} {% set alloc_ex_vat = alloc_ex_vat + credit_alloc.amountExVat %} {% endfor %} {% if alloc_ex_vat != credit_note.amountExVat %} {% set row_class = 'warning' %} {% set row_title = 'Allocations do not Match Credit Note amounts' %} {% endif %} {% endif %} {% endfor %}
DatePeriodDoc NumberPartnerMA Accountex VATVATinc VAT
{{ credit_note.creditNoteDate|date("Y/m/d") }} {{ months[credit_note.periodMonth] }} {{ credit_note.periodYear }} {{ credit_note.creditNoteNumber }} {{ credit_note.partner.companyName }} {{ credit_note.maAccount.maAccountName }} {{ credit_note.amountExVat|number_format(2, '.', ' ') }} {{ credit_note.vat|number_format(2, '.', ' ') }} {{ credit_note.amountIncVat|number_format(2, '.', ' ') }}
{% endif %} {% if credit_notes_period_set|length > 0 %}

Credit Notes assigned to Accounting Period

{% for credit_note in credit_notes_period_set %} {% endfor %}
DatePeriodDoc NumberPartnerMA Accountex VATVATinc VAT
{{ credit_note.creditNoteDate|date("Y/m/d") }} {{ months[credit_note.periodMonth] }} {{ credit_note.periodYear }} {{ credit_note.creditNoteNumber }} {{ credit_note.partner.companyName }} {{ credit_note.maAccount.maAccountName }} {{ credit_note.amountExVat|number_format(2, '.', ' ') }} {{ credit_note.vat|number_format(2, '.', ' ') }} {{ credit_note.amountIncVat|number_format(2, '.', ' ') }}
{% endif %} {# {% if unallocated_credit_notes|length > 0 %}

Credit Notes without Allocations

{% for credit_note in unallocated_credit_notes %} {% endfor %}
Credit Amount
DatePeriodAccounting PeriodCredit NotePartnerAccountex VATVATinc VAT
{{ credit_note.creditNoteDate|date("Y/m/d") }} {{ months[credit_note.periodMonth] }} {{ credit_note.periodYear }} {% if credit_note.vatPeriodMonth != 0 and credit_note.vatPeriodYear != 0 %}{{ months[credit_note.vatPeriodMonth] }} {{ credit_note.vatPeriodYear }}{% endif %} {{ credit_note.creditNoteNumber }} {% if credit_note.partner %}{{ credit_note.partner.companyName }}{% else %}NOT SET{% endif %} {% if credit_note.maAccount %}{{ credit_note.maAccount.maAccountName }}{% else %}NOT SET{% endif %} {{ credit_note.amountExVat|number_format(2, '.', ' ') }} {{ credit_note.vat|number_format(2, '.', ' ') }} {{ credit_note.amountIncVat|number_format(2, '.', ' ') }}
{% endif %} #} {% if credit_note_allocations|length > 0 %} {% set last_credit_note_id = 0 %}

Credit Note Allocations

{% set sum_alloc_ex_vat = 0 %} {% set sum_alloc_vat = 0 %} {% set sum_alloc_inc_vat = 0 %} {% for credit_allocation in credit_note_allocations %} {% set adjustments = null %} {% if last_credit_note_id != credit_allocation.creditNote.id %} {% else %} {% endif %} {% set alloc_color = '#FCF8E3' %} {% if loop.last or (credit_note_allocations[loop.index0+1] is defined and (credit_note_allocations[loop.index0+1].creditNote.id != credit_allocation.creditNote.id)) %} {% set sum_alloc_ex_vat = sum_alloc_ex_vat + credit_allocation.amountExVat %} {% set sum_alloc_vat = sum_alloc_vat + credit_allocation.vat %} {% set sum_alloc_inc_vat = sum_alloc_inc_vat + credit_allocation.amountIncVat %} {% if credit_allocation.creditNote.amountExVat|round(2) != sum_alloc_ex_vat|round(2) or credit_allocation.creditNote.vat|round(2) != sum_alloc_vat|round(2) or credit_allocation.creditNote.amountIncVat|round(2) != sum_alloc_inc_vat|round(2) %} {% set alloc_color = '#F2DEDE' %} {% endif %} {% set sum_alloc_ex_vat = 0 %} {% set sum_alloc_vat = 0 %} {% set sum_alloc_inc_vat = 0 %} {% else %} {% set sum_alloc_ex_vat = sum_alloc_ex_vat + credit_allocation.amountExVat %} {% set sum_alloc_vat = sum_alloc_vat + credit_allocation.vat %} {% set sum_alloc_inc_vat = sum_alloc_inc_vat + credit_allocation.amountIncVat %} {% endif %} {% set item_totals = d2_credit_alloc_item_amount(credit_allocation.id) %} {% set item_color = '#FCF8E3' %} {% if item_totals['ex_vat'] < credit_allocation.amountExVat %} {% set item_color = '#F2DEDE' %} {% endif %} {% if adjustments is not null %} {% set adj_data = d2_calc_adjustment_sum(adjustments) %} {% set color = '#FCF8E3' %} {% if (adj_data['ex_vat']|abs != 0) or (adj_data['vat']|abs != 0) or (adj_data['inc_vat']|abs != 0) %} {% if (adj_data['ex_vat']|abs|round(2) != credit_allocation.amountExVat|round(2)) or (adj_data['vat']|abs|round(2) != credit_allocation.vat|round(2)) or (adj_data['inc_vat']|abs|round(2) != credit_allocation.amountIncVat|round(2)) %} {% set color = '#F2DEDE' %} {% endif %} {% else %} {% endif %} {% else %} {% endif %} {% set last_credit_note_id = credit_allocation.creditNote.id %} {% endfor %}
Credit NoteCredit AllocationItem AmountAllocation AmountWaybill Adjustment
DatePeriodAccounting PeriodPartnerAccountCredit Noteex VATVATinc VATCustomerPeriodInvoiceWaybillCredit ex VATVATinc VATex VATVATinc VATex VATVATinc VAT
{{ credit_allocation.creditNote.creditNoteDate|date("Y/m/d") }} {{ months[credit_allocation.creditNote.periodMonth] }} {{ credit_allocation.creditNote.periodYear }} {% if credit_allocation.creditNote.vatPeriodMonth != 0 and credit_allocation.creditNote.vatPeriodYear != 0 %}{{ months[credit_allocation.creditNote.vatPeriodMonth] }} {{ credit_allocation.creditNote.vatPeriodYear }}{% endif %} {% if credit_allocation.creditNote.partner %}{{ credit_allocation.creditNote.partner.companyName }}{% else %}NOT SET{% endif %} {% if credit_allocation.creditNote.maAccount %}{{ credit_allocation.creditNote.maAccount.maAccountName }}{% else %}NOT SET{% endif %} {{ credit_allocation.creditNote.creditNoteNumber }} {{ credit_allocation.creditNote.amountExVat|number_format(2, '.', ' ') }} {{ credit_allocation.creditNote.vat|number_format(2, '.', ' ') }} {{ credit_allocation.creditNote.amountIncVat|number_format(2, '.', ' ') }}{% if credit_allocation.customer %}{{ credit_allocation.customer.companyName }}{% else %}NOT SET{% endif %} {% if credit_allocation.accountingPeriodMonth != 0 and credit_allocation.accountingPeriodYear != 0 %} {{ months[credit_allocation.accountingPeriodMonth] }} {{ credit_allocation.accountingPeriodYear }} {% endif %} {% if credit_allocation.pdfInvoice is not null %} {{ credit_allocation.pdfInvoice.invoiceNumber|trim }} {% endif %} {% if credit_allocation.rttWaybill is not null %} {% set adjustments = credit_allocation.rttWaybill.adjustments %} {{ credit_allocation.rttWaybill.consignmentId|trim }} {% elseif credit_allocation.courieritWaybill is not null %} {% set adjustments = credit_allocation.courieritWaybill.adjustments %} {{ credit_allocation.courieritWaybill.waybillNumber|trim }} {% elseif credit_allocation.ewcWaybill is not null %} {% set adjustments = credit_allocation.ewcWaybill.adjustments %} {{ credit_allocation.ewcWaybill.waybill|trim }} {% elseif credit_allocation.kingsWaybill is not null %} {% set adjustments = credit_allocation.kingsWaybill.adjustments %} {{ credit_allocation.kingsWaybill.waybill|trim }} {% elseif credit_allocation.cargoworksWaybill is not null %} {% set adjustments = credit_allocation.cargoworksWaybill.adjustments %} {{ credit_allocation.cargoworksWaybill.waybill|trim }} {% elseif credit_allocation.churchillsWaybill is not null %} {% set adjustments = credit_allocation.churchillsWaybill.adjustments %} {{ credit_allocation.churchillsWaybill.waybill|trim }} {% elseif credit_allocation.expresswaysWaybill is not null %} {% set adjustments = credit_allocation.expresswaysWaybill.adjustments %} {{ credit_allocation.expresswaysWaybill.waybill|trim }} {% elseif credit_allocation.utiWaybill is not null %} {% set adjustments = credit_allocation.utiWaybill.adjustments %} {{ credit_allocation.utiWaybill.shipmentNumber|trim }} {% elseif credit_allocation.skynetWaybill is not null %} {% set adjustments = credit_allocation.skynetWaybill.adjustments %} {{ credit_allocation.skynetWaybill.waybill|trim }} {% elseif credit_allocation.gavicWaybill is not null %} {% set adjustments = credit_allocation.gavicWaybill.adjustments %} {{ credit_allocation.gavicWaybill.waybill|trim }} {% elseif credit_allocation.fpDuToitWaybill is not null %} {% set adjustments = credit_allocation.fpDuToitWaybill.adjustments %} {{ credit_allocation.fpDuToitWaybill.waybill|trim }} {% elseif credit_allocation.celticFreightWaybill is not null %} {% set adjustments = credit_allocation.celticFreightWaybill.adjustments %} {{ credit_allocation.celticFreightWaybill.waybill|trim }} {% elseif credit_allocation.bbTransportWaybill is not null %} {% set adjustments = credit_allocation.bbTransportWaybill.adjustments %} {{ credit_allocation.bbTransportWaybill.waybill|trim }} {% elseif credit_allocation.transWorldWaybill is not null %} {% set adjustments = credit_allocation.transWorldWaybill.adjustments %} {{ credit_allocation.transWorldWaybill.waybill|trim }} {% elseif credit_allocation.camposWaybill is not null %} {% set adjustments = credit_allocation.camposWaybill.adjustments %} {{ credit_allocation.camposWaybill.waybill|trim }} {% elseif credit_allocation.aramexWaybill is not null %} {% set adjustments = credit_allocation.aramexWaybill.adjustments %} {{ credit_allocation.aramexWaybill.waybill|trim }} {% elseif credit_allocation.abafaziWaybill is not null %} {% set adjustments = credit_allocation.abafaziWaybill.adjustments %} {{ credit_allocation.abafaziWaybill.waybill|trim }} {% elseif credit_allocation.fedexWaybill is not null %} {% set adjustments = credit_allocation.fedexWaybill.adjustments %} {{ credit_allocation.fedexWaybill.waybill|trim }} {% elseif credit_allocation.emitWaybill is not null %} {% set adjustments = credit_allocation.emitWaybill.adjustments %} {{ credit_allocation.emitWaybill.waybill|trim }} {% elseif credit_allocation.rowelWaybill is not null %} {% set adjustments = credit_allocation.rowelWaybill.adjustments %} {{ credit_allocation.rowelWaybill.waybill|trim }} {% elseif credit_allocation.inMotionWaybill is not null %} {% set adjustments = credit_allocation.inMotionWaybill.adjustments %} {{ credit_allocation.inMotionWaybill.waybill|trim }} {% elseif credit_allocation.adhocWaybillWaybill is not null %} {% set adjustments = credit_allocation.adhocWaybillWaybill.adjustments %} {{ credit_allocation.adhocWaybillWaybill.waybill|trim }} {% elseif credit_allocation.rbAndSonWaybill is not null %} {% set adjustments = credit_allocation.rbAndSonWaybill.adjustments %} {{ credit_allocation.rbAndSonWaybill.waybill|trim }} {% endif %} {% if credit_allocation.skynetReversal is not null %} {% if credit_allocation.skynetReversal.adjustedWaybill is not null %} {% set adjustments = credit_allocation.skynetReversal.adjustedWaybill.adjustments %} {% endif %} {{ credit_allocation.skynetReversal.waybill|trim }} {% elseif credit_allocation.utiReversal is not null %} {% if credit_allocation.utiReversal.adjustedWaybill is not null %} {% set adjustments = credit_allocation.utiReversal.adjustedWaybill.adjustments %} {% endif %} {{ credit_allocation.utiReversal.shipmentNumber|trim }} {% endif %} {{ item_totals['ex_vat']|number_format(2, '.', ' ') }} {{ item_totals['vat']|number_format(2, '.', ' ') }} {{ item_totals['inc_vat']|number_format(2, '.', ' ') }} {{ credit_allocation.amountExVat|number_format(2, '.', ' ') }} {{ credit_allocation.vat|number_format(2, '.', ' ') }} {{ credit_allocation.amountIncVat|number_format(2, '.', ' ') }}{{ adj_data['ex_vat']|number_format(2, '.', ' ') }} {{ adj_data['vat']|number_format(2, '.', ' ') }} {{ adj_data['inc_vat']|number_format(2, '.', ' ') }}
{% endif %} {% if adjusted_master|length > 0 %}

Adjusted Waybills

{% for adjusted_section in adjusted_master %} {% for adjusted_waybill in adjusted_section %} {% if (adjusted_waybill['adj_ex_vat'] != 0) or (adjusted_waybill['adj_vat'] != 0) or (adjusted_waybill['adj_inc_vat'] != 0) %} {% if (adjusted_waybill['adj_ex_vat']|abs|round(2) != adjusted_waybill['cred_ex_vat']|round(2)) or (adjusted_waybill['adj_vat']|abs|round(2) != adjusted_waybill['cred_vat']|round(2)) or (adjusted_waybill['adj_inc_vat']|abs|round(2) != adjusted_waybill['cred_inc_vat']|round(2)) %} {% set color = '#F2DEDE' %} {% else %} {% set color = '#FCF8E3' %} {% endif %} {% endif %} {% endfor %} {% endfor %}
Credit Allocation AmountAdjustment Amount
PartnerCustomerWaybillCredit Noteex VATVATinc VATex VATVATinc VAT
{{ adjusted_waybill['partner'] }} {{ adjusted_waybill['customer'] }} {{ adjusted_waybill['waybill'] }} {{ adjusted_waybill['credit_note'] }} {{ adjusted_waybill['cred_ex_vat']|number_format(2, '.', ' ') }} {{ adjusted_waybill['cred_vat']|number_format(2, '.', ' ') }} {{ adjusted_waybill['cred_inc_vat']|number_format(2, '.', ' ') }} {{ adjusted_waybill['adj_ex_vat']|number_format(2, '.', ' ') }} {{ adjusted_waybill['adj_vat']|number_format(2, '.', ' ') }} {{ adjusted_waybill['adj_inc_vat']|number_format(2, '.', ' ') }}
{% endif %}