{% form_theme form 'bootstrap_4_layout.html.twig' %}
{% extends 'back.html.twig' %}
{% block title %}Listes des factures{% endblock %}
{% block body %}
<div class="row">
<div class="col-md-12">
<h3>Rechnungen Liste</h3>
<hr>
</div>
</div>
<div class="row">
<div class="col-md-12 m_t_20">
<ul class="ul_action">
<li><a href="{{ path('piece_new') }}" class="btn btn-sm btn-primary"> <span class="fa fa-plus"></span>
Rechnung</a></li>
</ul>
</div>
</div>
{% set col_user='col-md-4' %}
{% set col_date='col-md-3' %}
{% if app.user.isSuperAdmin %}
{% set col_user='col-md-3' %}
{% set col_date='col-md-2' %}
{% endif %}
{{ form_start(form) }}
<div class="row">
<div class="col-md-2">
{{ form_row(form.code,{'value':app.request.get('code')}) }}
</div>
<div class="col-md-3">
{{ form_row(form.client,{'value':app.request.get('client')}) }}
</div>
{% if app.user.isSuperAdmin %}
<div class="{{ col_user }}">
{{ form_row(form.user,{'value':app.request.get('user')}) }}
</div>
{% endif %}
<div class="{{ col_date }}">
{{ form_row(form.dateDu,{'value':app.request.get('dateDu')}) }}
</div>
<div class="{{ col_date }}">
{{ form_row(form.dateAu,{'value':app.request.get('dateAu')}) }}
</div>
</div>
<div class="row">
<div class="col-md-2">
{{ form_row(form.amountHTMin,{'value':app.request.get('amountHTMin')}) }}
</div>
<div class="col-md-2">
{{ form_row(form.amountHTMax,{'value':app.request.get('amountHTMax')}) }}
</div>
<div class="col-md-2">
{{ form_row(form.amountTVAMin,{'value':app.request.get('amountTVAMin')}) }}
</div>
<div class="col-md-2">
{{ form_row(form.amountTVAMax,{'value':app.request.get('amountTVAMax')}) }}
</div>
<div class="col-md-2">
{{ form_row(form.discountMin,{'value':app.request.get('discountMin')}) }}
</div>
<div class="col-md-2">
{{ form_row(form.discountMax,{'value':app.request.get('discountMax')}) }}
</div>
</div>
<div class="row">
<div class="col-md-2">
{{ form_row(form.amountDiscountMin,{'value':app.request.get('amountDiscountMin')}) }}
</div>
<div class="col-md-2">
{{ form_row(form.amountDiscountMax,{'value':app.request.get('amountDiscountMax')}) }}
</div>
<div class="col-md-2">
{{ form_row(form.amountTTCMin,{'value':app.request.get('amountTTCMin')}) }}
</div>
<div class="col-md-2">
{{ form_row(form.amountTTCMax,{'value':app.request.get('amountTTCMax')}) }}
</div>
<div class="col-md-2">
{{ form_row(form.soldeMin,{'value':app.request.get('soldeMin')}) }}
</div>
<div class="col-md-2">
{{ form_row(form.soldeMax,{'value':app.request.get('soldeMax')}) }}
</div>
</div>
<div class="row m_b_20">
<div class="col-md-1 m_t_30">
<button type="submit" class="btn btn-success btn-sm"><span class="fa fa-search"
title="Recherche"></span>
</button>
<a href="{{ path('piece_index') }}" class="btn btn-danger btn-sm" title="Initilisieren"><span
class="fa fa-redo"></span></a>
</div>
</div>
{{ form_end(form) }}
<div class="row">
<div class="col-md-12">
<div class="table-responsive">
<table class="table table-condensed">
<thead>
<tr>
<th>Datum</th>
<th>N°</th>
<th>Kunde</th>
{% if app.user.isSuperAdmin %}
<th class="text-right">Betrag Einkauf</th>
<th class="text-right">Betrag Marge</th>
{% endif %}
<th class="text-right">Betrag Ohne Mwst</th>
<th class="text-right">Betrag Mwst</th>
<th class="text-right">Betrag Rabatt</th>
<th class="text-right">Gute Rabatt</th>
<th class="text-right">Betrag Inkl Mwst</th>
<th class="text-right">Solde</th>
<th class="text-right">Aktion</th>
</tr>
</thead>
<tbody>
{% if pieces|length>0 %}
{% for piece in pieces %}
<tr>
<td>{{ piece.date ? piece.date|date('d/m/Y') : '' }}</td>
<td>{{ piece.numero }}</td>
<td>{{ piece.client ? piece.client.nomComplet }}</td>
{% if app.user.isSuperAdmin %}
<td class="text-right">{{ piece.amountBuyHT }}</td>
<td class="text-right">{{ piece.amountMarge }}</td>
{% endif %}
<td class="text-right">{{ piece.amountHT }}</td>
<td class="text-right">{{ piece.amountTVA }}</td>
<td class="text-right">{{ piece.amountDiscount }}</td>
<td class="text-right">{{ piece.amountDiscountTotal ? piece.amountDiscountTotal : '0.00' }}</td>
<td class="text-right">{{ piece.amountTTC }}</td>
<td class="text-right">
{% if piece.solde == 0 %}
<span class="badge badge-success" style="font-size: 100% !important">
{% else %}
<span class="badge badge-danger" style="font-size: 100% !important">
{% endif %}
{{ piece.solde|number_format(2, '.', ' ') }}
</span>
</td>
<td>
<ul class="ul_action">
<li><a href="{{ path('piece_show', {'id': piece.id}) }}"
class="btn btn-sm btn-info"><span class="fa fa-info-circle"></span>
Détails</a></li>
{% if app.user.isSuperAdmin or getParam('param_title') != 'IRON-APP' %}
<li><a href="{{ path('piece_edit', {'id': piece.id}) }}"
class="btn btn-sm btn-warning"><span class="fa fa-edit"></span> Aendern</a>
</li>
{% endif %}
</ul>
</td>
</tr>
{% endfor %}
<tr>
<th colspan="3">SUMME</th>
{% if app.user.isSuperAdmin %}
<th class="text-right">{{ totaux['amountBuyHT']|number_format(2, '.', ' ') }}</th>
<th class="text-right">{{ totaux['amountMarge']|number_format(2, '.', ' ') }}</th>
{% endif %}
<th class="text-right">{{ totaux['amountHT']|number_format(2, '.', ' ') }}</th>
<th class="text-right">{{ totaux['amountTVA']|number_format(2, '.', ' ') }}</th>
<th class="text-right">{{ totaux['amountDiscount']|number_format(2, '.', ' ') }}</th>
<th class="text-right">{{ totaux['amountDiscountTotal']|number_format(2, '.', ' ') }}</th>
<th class="text-right">{{ totaux['amountTTC']|number_format(2, '.', ' ') }}</th>
<th class="text-right">{{ totaux['soldeTotal']|number_format(2, '.', ' ') }}</th>
<th colspan="2"></th>
</tr>
{% else %}
<tr>
<td colspan="12">
<div class="alert alert-info">Kein elemente Verfügbar</div>
</td>
</tr>
{% endif %}
</tbody>
</table>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="navigation">
{{ knp_pagination_render(pieces) }}
</div>
</div>
</div>
{% endblock %}
{% block javascripts %}
<script>
$('#piece_search_client').select2();
</script>
{% endblock %}