{% extends 'D2BillingBundle::base.html.twig' %} {% 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"} %} {% block head_script_extra %} {##} {% endblock head_script_extra %} {% block page_header %}
Billing Run.
{% for k, v in app.request.query %} {% if k|lower not in ['search', 'page', 'year', 'month'] %} {% endif %} {% endfor %}
{% endblock page_header %} {% block content %} {% if is_period_data == true %} {% if partner_invoice_data|length > 0 %} {% endif %} {% if unresolved_calc_rules|length > 0 %} {% endif %} {% if unallocated_credit_notes|length > 0 %} {% endif %} {% if credit_note_allocations|length > 0 %} {% endif %} {% if allocated_allocations|length > 0 %} {% endif %} {% if adjusted_master|length > 0 %} {% endif %} {% set ubwc = 0 %} {% for key, unbilled_data in unbilled_waybills %} {% set ubwc = ubwc + unbilled_data['data']|length %} {% endfor %} {% if ubwc > 0 %} {% set wp = 0 %} {% endif %}
{% if unassigned_master|length > 0 %}

Warning: Un-assigned Waybills!

{% for item in unassigned_master %} {% endfor %}
{% endif %}
{% if alert_master|length > 0 %}

Warning: Alerts not cleared on Waybills!

{% for item in alert_master %} {% endfor %}
{% endif %}

Partner Summary

Calc Rule Exceptions

{% set months = {0:"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"} %}

Warning: Credit Notes without Allocations!

{% set months = {0:"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"} %}

Available Credit Allocations

{% set months = {0:"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"} %}

Allocated Credit Allocations

{% for credit_allocation in allocated_allocations %} {% set adjustments = null %} {% set item_totals = d2_credit_alloc_item_amount(credit_allocation.id) %} {% set item_color = '#DFF0D8' %} {% 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) %} {% if (adj_data['ex_vat']|abs != credit_allocation.amountExVat) or (adj_data['vat']|abs != credit_allocation.vat) or (adj_data['inc_vat']|abs != credit_allocation.amountIncVat) %} {% set color = '#F2DEDE' %} {% else %} {% set color = '#DFF0D8' %} {% endif %} {% if adj_data['ex_vat'] != 0.00 or adj_data['vat'] != 0.00 or adj_data['inc_vat'] != 0.00 %} {% else %} {% endif %} {% else %} {% endif %} {% endfor %}
Item AmountCredit AmountAdjustment Amount
DatePeriodAccounting PeriodCredit NoteCustomerPartnerAccountInvoiceWaybillCreditex 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 %} {{ credit_allocation.creditNote.creditNoteNumber }} {% if credit_allocation.customer %}{{ credit_allocation.customer.companyName }}{% else %}NOT SET{% 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 %} {% 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, '.', ' ') }}

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 != adjusted_waybill['cred_ex_vat']) or (adjusted_waybill['adj_vat']|abs != adjusted_waybill['cred_vat']) or (adjusted_waybill['adj_inc_vat']|abs != adjusted_waybill['cred_inc_vat']) %} {% set color = '#F2DEDE' %} {% else %} {% set color = '#FCF8E3' %} {% endif %} {% endif %} {% endfor %} {% endfor %}

Un-billed Waybills ({{ months[previous_month] }} {{ previous_year }})

{% set displayed_customer_cnt = 0 %} {% if customers|length > 0 %} {% set overall_not_processed_cnt = 0 %} {% set overall_processed_cnt = 0 %} {% set overall_imported_cnt = 0 %} {% set overall_coverage = 0 %} {% set overall_partner_amount = 0 %} {% set imported_overall_partner_amount = 0 %} {% set overall_ma_amount = 0 %} {% set overall_bm_amount = 0 %} {% set overall_final_amount = 0 %} {% set any_stats_processed = false %} {% for customer in customers %} {% set billing_ver = d2_get_billing_ver(customer, month, year)|trim %} {% set export_exists = d2_check_export_ver(customer, month, year) %} {% set report_exists = d2_check_report_ver(customer, month, year) %} {% set billing_alert = d2_check_billing_setup(customer, month, year) %} {% set are_unassigned = false %} {% set are_alerted = false %} {% set is_rule_covered = true %} {% set total_not_processed_cnt = 0 %} {% set total_processed_cnt = 0 %} {% set total_coverage = 0 %} {% set total_report_coverage = 0 %} {% set total_bulk_edit_coverage = 0 %} {% set cust_not_processed_cnt = 0 %} {% set cust_processed_cnt = 0 %} {% set cust_imported = 0 %} {% set cust_coverage = 0 %} {% set cust_partner_amount = 0 %} {% set imported_cust_partner_amount = 0 %} {% set final_cust_amount = 0 %} {% set cust_ma_amount = 0 %} {% set cust_bm_amount = 0 %} {% if show_cust_billing[customer.getId] == true %} {% set displayed_customer_cnt = displayed_customer_cnt + 1 %}

{{ customer.getCompanyName }} V{{ billing_ver }}

Imported: {{ cust_arr[customer.id]['billing_imported'] ? 'Active' : 'Inactive' }}
{% if billing_alert != '' %}
{{ billing_alert|raw }}
{% endif %} {% for stat in proc_master %} {% if stat['customer_id'] == customer.getId %} {% set overall_not_processed_cnt = overall_not_processed_cnt + stat['not_processed_cnt'] %} {% set overall_imported_cnt = overall_imported_cnt + stat['billing_import_cnt'] %} {% set overall_processed_cnt = overall_processed_cnt + stat['processed_cnt'] %} {% set total_not_processed_cnt = total_not_processed_cnt + stat['not_processed_cnt'] %} {% set total_processed_cnt = total_processed_cnt + stat['processed_cnt'] %} {% set total_coverage = total_coverage + stat['coverage_cnt'] %} {% set total_report_coverage = total_report_coverage + stat['report_coverage_cnt'] %} {% set total_bulk_edit_coverage = total_bulk_edit_coverage + stat['bulk_edit_coverage_cnt'] %} {% set overall_coverage = overall_coverage + stat['coverage_cnt'] %} {% set cust_not_processed_cnt = cust_not_processed_cnt + stat['not_processed_cnt'] %} {% set cust_processed_cnt = cust_processed_cnt + stat['processed_cnt'] %} {% set cust_coverage = cust_coverage + stat['coverage_cnt'] %} {% set cust_imported = cust_imported + stat['billing_import_cnt'] %} {% set cust_partner_amount = cust_partner_amount + stat['total_ex_vat'] %} {% set imported_cust_partner_amount = imported_cust_partner_amount + stat['imported_ex_vat'] %} {% set final_cust_amount = final_cust_amount + stat['final_ex_vat'] %} {% set cust_ma_amount = cust_ma_amount + stat['adj_total_ex_vat'] %} {% set cust_bm_amount = cust_bm_amount + stat['bm_ex_vat'] %} {% if stat['are_unassigned'] == true %} {% set are_unassigned = true %} {% endif %} {% if stat['are_alerted'] == true %} {% set are_alerted = true %} {% endif %} {% if stat['is_rule_covered'] == false %} {% set is_rule_covered = false %} {% endif %} {% set coverage_color = '#F5F5F5' %} {% set coverage_ok = true %} {% if (stat['not_processed_cnt'] + stat['processed_cnt']) != stat['coverage_cnt'] %} {% set coverage_color = '#F2DEDE' %} {% set coverage_ok = false %} {% endif %} {% if stat['invoice_file_status'] == constant('D2\\RTTBundle\\Entity\\InvoiceFile::TYPE_PS_CHECKED') or stat['invoice_file_status'] == constant('D2\\RTTBundle\\Entity\\InvoiceFile::TYPE_PS_INVOICED') %} {% else %} {% endif %} {% if stat['not_processed_cnt'] != 0 %} {% else %} {% set overall_partner_amount = overall_partner_amount + stat['total_ex_vat'] %} {% set imported_overall_partner_amount = imported_overall_partner_amount + stat['imported_ex_vat'] %} {% set overall_ma_amount = overall_ma_amount + stat['adj_total_ex_vat'] %} {% set overall_bm_amount = overall_bm_amount + stat['bm_ex_vat'] %} {% set overall_final_amount = overall_final_amount + stat['final_ex_vat'] %} {% set any_stats_processed = true %} {% endif %} {% endif %} {% endfor %} {% if credits_breakdown[customer.id] is defined %} {% set cust_partner_amount = cust_partner_amount - credits_breakdown[customer.id]['orig_total'] %} {% set cust_ma_amount = cust_ma_amount - credits_breakdown[customer.id]['markup_total'] %} {% set overall_partner_amount = overall_partner_amount - credits_breakdown[customer.id]['orig_total'] %} {% set overall_ma_amount = overall_ma_amount - credits_breakdown[customer.id]['markup_total'] %} {% set imported_overall_partner_amount = imported_overall_partner_amount - credits_breakdown[customer.id]['imported_ex_vat'] %} {% set imported_cust_partner_amount = imported_cust_partner_amount - credits_breakdown[customer.id]['imported_ex_vat'] %} {% set final_cust_amount = final_cust_amount - credits_breakdown[customer.id]['final_ex_vat'] %} {% set cust_bm_amount = cust_bm_amount - credits_breakdown[customer.id]['bm_total'] %} {% set overall_bm_amount = overall_bm_amount - credits_breakdown[customer.id]['bm_total'] %} {% set overall_final_amount = overall_final_amount - credits_breakdown[customer.id]['final_ex_vat'] %} {% set any_stats_processed = true %} {% endif %} {% if general_invoice_breakdown[customer.id] is defined %} {% set cust_partner_amount = cust_partner_amount + general_invoice_breakdown[customer.id]['orig_total'] %} {% set cust_ma_amount = cust_ma_amount + general_invoice_breakdown[customer.id]['markup_total'] %} {% set overall_partner_amount = overall_partner_amount + general_invoice_breakdown[customer.id]['orig_total'] %} {% set overall_ma_amount = overall_ma_amount + general_invoice_breakdown[customer.id]['markup_total'] %} {% set imported_overall_partner_amount = imported_overall_partner_amount + general_invoice_breakdown[customer.id]['imported_ex_vat'] %} {% set imported_cust_partner_amount = imported_cust_partner_amount + general_invoice_breakdown[customer.id]['imported_ex_vat'] %} {% set final_cust_amount = final_cust_amount + general_invoice_breakdown[customer.id]['final_ex_vat'] %} {% set cust_bm_amount = cust_bm_amount + general_invoice_breakdown[customer.id]['bm_total'] %} {% set overall_bm_amount = overall_bm_amount + general_invoice_breakdown[customer.id]['bm_total'] %} {% set overall_final_amount = overall_final_amount + general_invoice_breakdown[customer.id]['final_ex_vat'] %} {% set any_stats_processed = true %} {% endif %} {% if cust_processed_cnt != 0 %} {% endif %}
Partner Generated Imported
Partner Invoice File Not Proc Proced Rules Imported Amt (excl) Amt (excl) Profit (excl) Margin Amt (excl) Profit (excl) Margin
{{ stat['invoice_file_name'] }}{{ stat['invoice_file_name'] }}{{ stat['not_processed_cnt'] }} {{ stat['processed_cnt'] }} {% if coverage_ok %}{{ stat['coverage_cnt'] }}{% else %}{{ stat['coverage_cnt'] }}{% endif %} {{ stat['billing_import_cnt'] }} R {{ stat['total_ex_vat']|number_format(2, '.', ' ') }} R {{ stat['adj_total_ex_vat']|number_format(2, '.', ' ') }} {% if stat['adj_total_ex_vat'] != 0 %} R {{(stat['adj_total_ex_vat'] - stat['total_ex_vat'])|number_format(2, '.', ' ') }} {% else %} R 0.00 {% endif %} {% if stat['adj_total_ex_vat'] != 0 %} {{ (((stat['adj_total_ex_vat'] - stat['total_ex_vat'])/stat['adj_total_ex_vat'])*100)|number_format(2, '.', ' ') }} {% else %} 0.00 {% endif %} R {{ stat['bm_ex_vat']|number_format(2, '.', ' ') }} {% if stat['bm_ex_vat'] != 0 %} R {{(stat['bm_ex_vat'] - stat['imported_ex_vat'])|number_format(2, '.', ' ') }} {% else %} R 0.00 {% endif %} {% if stat['bm_ex_vat'] != 0 %} {{ (((stat['bm_ex_vat'] - stat['imported_ex_vat'])/stat['bm_ex_vat'])*100)|number_format(2, '.', ' ') }} {% else %} 0.00 {% endif %} View
All Partners OOP CREDITS R {{ (0 - (credits_breakdown[customer.id]['orig_total']))|number_format(2, '.', ' ') }} R {{ (0 - (credits_breakdown[customer.id]['markup_total']))|number_format(2, '.', ' ') }} R {{ (0 - (credits_breakdown[customer.id]['markup_total'] - credits_breakdown[customer.id]['orig_total']))|number_format(2, '.', ' ') }} {% if credits_breakdown[customer.id]['markup_total'] != 0 %} {{ (0 - (((credits_breakdown[customer.id]['markup_total'] - credits_breakdown[customer.id]['orig_total'])/credits_breakdown[customer.id]['markup_total'])*100))|number_format(2, '.', ' ') }} {% else %} 0.00 {% endif %} R {{ (0 - (credits_breakdown[customer.id]['bm_total']))|number_format(2, '.', ' ') }} R {{ (0 - (credits_breakdown[customer.id]['bm_total'] - credits_breakdown[customer.id]['imported_ex_vat']))|number_format(2, '.', ' ') }} {% if credits_breakdown[customer.id]['bm_total'] != 0 %} {{ (0 - (((credits_breakdown[customer.id]['bm_total'] - credits_breakdown[customer.id]['imported_ex_vat'])/credits_breakdown[customer.id]['bm_total'])*100))|number_format(2, '.', ' ') }} {% else %} 0.00 {% endif %} View
All Partners GENERAL INVOICES R {{ (general_invoice_breakdown[customer.id]['orig_total'])|number_format(2, '.', ' ') }} R {{ (general_invoice_breakdown[customer.id]['markup_total'])|number_format(2, '.', ' ') }} R {{ (general_invoice_breakdown[customer.id]['markup_total'] - general_invoice_breakdown[customer.id]['orig_total'])|number_format(2, '.', ' ') }} {% if general_invoice_breakdown[customer.id]['markup_total'] != 0 %} {{ (((general_invoice_breakdown[customer.id]['markup_total'] - general_invoice_breakdown[customer.id]['orig_total'])/general_invoice_breakdown[customer.id]['markup_total'])*100)|number_format(2, '.', ' ') }} {% else %} 0.00 {% endif %} R {{ (general_invoice_breakdown[customer.id]['bm_total'])|number_format(2, '.', ' ') }} R {{ (general_invoice_breakdown[customer.id]['bm_total'] - general_invoice_breakdown[customer.id]['imported_ex_vat'])|number_format(2, '.', ' ') }} {% if general_invoice_breakdown[customer.id]['bm_total'] != 0 %} {{ (((general_invoice_breakdown[customer.id]['bm_total'] - general_invoice_breakdown[customer.id]['imported_ex_vat'])/general_invoice_breakdown[customer.id]['bm_total'])*100)|number_format(2, '.', ' ') }} {% else %} 0.00 {% endif %} View
{{ cust_not_processed_cnt }} {{ cust_processed_cnt }} {{ cust_coverage }} {{ cust_imported }} R {{ cust_partner_amount|number_format(2, '.', ' ') }} R {{ cust_ma_amount|number_format(2, '.', ' ') }} R {{ (cust_ma_amount - cust_partner_amount)|number_format(2, '.', ' ') }} {% if cust_ma_amount != 0 %} {{ (((cust_ma_amount - cust_partner_amount)/cust_ma_amount)*100)|number_format(2, '.', ' ') }} {% else %} 0.00 {% endif %} R {{ cust_bm_amount|number_format(2, '.', ' ') }} R {% if cust_bm_amount != 0 %}{{ (cust_bm_amount - imported_cust_partner_amount)|number_format(2, '.', ' ') }} {% else %} 0.00 {% endif %} {% if cust_bm_amount != 0 %} {{ (((cust_bm_amount - imported_cust_partner_amount)/cust_bm_amount)*100)|number_format(2, '.', ' ') }} {% else %} 0.00 {% endif %}
TOTAL: R {{ final_cust_amount|number_format(2, '.', ' ') }} R {% if final_cust_amount != 0 %}{{ (final_cust_amount - cust_partner_amount)|number_format(2, '.', ' ') }} {% else %} 0.00 {% endif %} {% if final_cust_amount != 0 %} {{ (((final_cust_amount - cust_partner_amount)/final_cust_amount)*100)|number_format(2, '.', ' ') }} {% else %} 0.00 {% endif %}
{% if backgnd_proc_arr[customer.id]['gen'] == true or backgnd_proc_arr[customer.id]['report'] == true or backgnd_proc_arr[customer.id]['clear'] == true or backgnd_proc_arr[customer.id]['export'] == true %}
{% else %} {% endif %} {% set invoice_id = d2_customer_billed(customer.id, year, month) %} {% set must_credit_note = d2_customer_must_credit_note(customer.id, year, month) %} {% set credit_note_id = d2_customer_credit_note(customer.id, year, month) %} {# WHEN WAYBILLS TO BILL #} {% if cust_coverage != 0 %}
{% if is_granted('ROLE_ADMIN_BILLING_RUN_MANAGE') and backgnd_proc_arr[customer.id]['gen'] != true and backgnd_proc_arr[customer.id]['report'] != true and backgnd_proc_arr[customer.id]['clear'] != true %} {% if total_not_processed_cnt != 0 %} {% if are_unassigned == true or are_alerted == true or is_rule_covered == false %} {# Download #} {% if ok_to_edit %}Upload{% endif %} {% if ok_to_edit %}Generate{% endif %} {% if cust_arr[customer.id]['got_bulk_editors'] == true and cust_arr[customer.id]['bulk_edit_status'] == false %} Bulk Edit {% endif %} {% else %} {# Download #} {# Upload #} {% if ok_to_edit %}Generate{% endif %} {% if cust_arr[customer.id]['got_bulk_editors'] == true and cust_arr[customer.id]['bulk_edit_status'] == false %} Bulk Edit {% endif %} {% endif %} {% else %} {% if total_not_processed_cnt == 0 and (invoice_id == false or (must_credit_note == true and credit_note_id == false)) %} {% if ok_to_edit %}Clear{% endif %} {% if cust_arr[customer.id]['report_status'] == true %} {# View Report #} {% else %} Generate Report {% endif %} {# Download #} {% if ok_to_edit %}Upload{% endif %} {% if invoice_id == false %} {% if ok_to_edit %}Invoice{% endif %} {% else %} Invoice: {{ d2_customer_billed_invoice(invoice_id) }} {% endif %} {% if must_credit_note == true and credit_note_id == false%} Credit Note {% elseif credit_note_id != false %} Credit Note: {{ d2_customer_billed_credit_note(credit_note_id) }} {% endif %} {% else %} {% if ok_to_edit %}Reset{% endif %} Invoice: {{ d2_customer_billed_invoice(invoice_id) }} {% if credit_note_id != false %} Credit Note: {{ d2_customer_billed_credit_note(credit_note_id) }} {% endif %} {# Download #} {% if cust_arr[customer.id]['report_status'] == true %} {# View Report #} {# Send #} Send {% else %} Generate Report {% endif %} {% endif %} {% endif %} {% endif %}
{# WHEN CREDIT NOTE / GENERAL INVOICE ONLY - NO WAYBILLS TO BILL #} {% elseif must_credit_note == true or general_invoice_breakdown[customer.id] is defined %} {% if (invoice_id == false or (must_credit_note == true and credit_note_id == false)) %} {% if ok_to_edit %}Clear{% endif %} {% if cust_arr[customer.id]['report_status'] == true %} {# View Report #} {% else %} Generate Report {% endif %} {# Download #} {# Upload #} {% if invoice_id == false %} {% if ok_to_edit %}Invoice{% endif %} {% endif %} {% if must_credit_note == true %} Credit Note {% endif %} {% else %} {% if ok_to_edit %}Reset{% endif %} Invoice: {{ d2_customer_billed_invoice(invoice_id) }} {% if credit_note_id != false %} Credit Note: {{ d2_customer_billed_credit_note(credit_note_id) }} {% endif %} {# Download #} {% if cust_arr[customer.id]['report_status'] == true %} {# View Report #} {# Send #} Send {% else %} Generate Report {% endif %} {% endif %} {% endif %}
{% endif %} {% endfor %} {% set all_coverage_color = '#F5F5F5' %} {% if (overall_not_processed_cnt + overall_processed_cnt) != overall_coverage %} {% set all_coverage_color = '#F2DEDE' %} {% endif %}

Billing Run Summary

{% if any_stats_processed == false %} {% else %} {% endif %}
Partner Generated Imported
Not Proc Proced Rules Imported Amt (excl) Amt (excl) Profit (excl) Margin Amt (excl) Profit (excl) Margin
{{ overall_not_processed_cnt }} {{ overall_processed_cnt }} {{ overall_coverage }} {{ overall_imported_cnt }} R {{ overall_partner_amount|number_format(2, '.', ' ') }} R {{ overall_ma_amount|number_format(2, '.', ' ') }} {% if overall_ma_amount != 0 %} R {{(overall_ma_amount - overall_partner_amount)|number_format(2, '.', ' ') }} {% else %} R 0.00 {% endif %} {% if overall_ma_amount != 0 %} {{ (((overall_ma_amount - overall_partner_amount)/overall_ma_amount)*100)|number_format(2, '.', ' ') }} {% else %} R 0.00 {% endif %} R {{ overall_bm_amount|number_format(2, '.', ' ') }} {% if overall_bm_amount != 0 %} R {{(overall_bm_amount - imported_overall_partner_amount)|number_format(2, '.', ' ') }} {% else %} R 0.00 {% endif %} {% if overall_bm_amount != 0 %} {{ (((overall_bm_amount - imported_overall_partner_amount)/overall_bm_amount)*100)|number_format(2, '.', ' ') }} {% else %} R 0.00 {% endif %}
TOTAL: R {{ overall_final_amount|number_format(2, '.', ' ') }} {% if overall_final_amount != 0 %} R {{(overall_final_amount - overall_partner_amount)|number_format(2, '.', ' ') }} {% else %} R 0.00 {% endif %} {% if overall_final_amount != 0 %} {{ (((overall_final_amount - overall_partner_amount)/overall_final_amount)*100)|number_format(2, '.', ' ') }} {% else %} R 0.00 {% endif %}
{% if show_global_export_import == true %}

Billing Import / Export V{{ billing_global_version }}

Sort Mode
{% set cnt = 0 %} {% set row_cnt = 0 %} {% set rows_per_cnt = (displayed_customer_cnt/3)|round(0, 'ceil') %} {% if all_customers|length > 0 %} {% for customer in all_customers %} {% if show_cust_billing[customer.getId] == true %} {% if cnt == 0 %}
{% elseif cnt == rows_per_cnt %}
{% set row_cnt = row_cnt + 1 %} {% if row_cnt == 3 %}
{% set row_cnt = 0 %} {% else %} {% endif %} {% set cnt = 0 %} {% endif %} {% set cnt = cnt + 1 %} {% endif %} {% endfor %}
{{ customer.internalName }}Active
{% endif %}
{% set zip_exists = d2_check_zip_all_ver(billing_global_version, month, year) %} {# Download #} {% set export_exists = d2_check_export_all_ver(billing_global_version, month, year) %} {% if ok_to_edit == true %} Upload Clear All Customers Generate All Customers {% endif %}
{% endif %} {% endif %} {% else %}
There is currently no waybill data available for processing!
{% endif %} {% endblock content %}