{% if esculation_options[esculation['level']] == 'CREDIT NOTE' %}
{% set alloc = d2_partner_get_waybill_credit_alloc( partner_id, esculation['id'] ) %}
{% if alloc is not null %}
{% if alloc.creditNote is not null %}
{{ alloc.creditNote.getCreditNoteNumber() }}
{% else %}
NO CREDIT NOTE FOUND
{% endif %}
{% else %}
NO CREDIT ALLOCATION FOUND
{% endif %}
{% endif %}
{% if esculation_options[esculation['level']] == 'CREDITS REQUEST' %}
{% set request = d2_partner_get_waybill_credit_request( partner_id, esculation['id'] ) %}
{% if request is not null %}
{{ request.getDocNo() }}
{% else %}
NO CREDIT REQUEST FOUND
{% endif %}
{% endif %}
{% if esculation_options[esculation['level']] == 'BILL CHARGE' or esculation_options[esculation['level']] == 'QUOTED' %}
{% set quotation = d2_partner_get_waybill_quote( partner_id, esculation['id'] ) %}
{% if quotation is not null %}
{{ quotation.getDocNo() }}
{% else %}
NO QUOTE FOUND
{% endif %}
{% endif %}
{% if app.request.get('page') is not null %}
{% set current_page = app.request.get('page') %}
{% else %}
{% set current_page = 1 %}
{% endif %}
{% if invoice_file_list|length != 0 %}
{% for entity in invoice_file_list %}
{% if loop.first %}
{% endif %}
{% if is_granted('ROLE_ADMIN_WAYBILL_FILE_MANAGE') %}
{% if entity.getProcessStatus == constant('D2\\CamposBundle\\Entity\\InvoiceFile::TYPE_PS_IMPORTED') or entity.getProcessStatus == constant('D2\\CamposBundle\\Entity\\InvoiceFile::TYPE_PS_PAUSED') %}
{% elseif entity.getProcessStatus == constant('D2\\CamposBundle\\Entity\\InvoiceFile::TYPE_PS_PROCESSING') or entity.getProcessStatus == constant('D2\\CamposBundle\\Entity\\InvoiceFile::TYPE_PS_RELEASED')%}
{% endif %}
{% endif %}
{% if entity.getProcessStatus == constant('D2\\CamposBundle\\Entity\\InvoiceFile::TYPE_PS_PROCESSED') or entity.getProcessStatus == constant('D2\\CamposBundle\\Entity\\InvoiceFile::TYPE_PS_CHECKED') %}
{% if is_granted('ROLE_ADMIN_WAYBILL_VIEW') %}
{% endif %}
{% if is_granted('ROLE_ADMIN_WAYBILL_FILE_MANAGE') and entity.getLocked != true %}