Last active
December 4, 2019 17:01
-
-
Save walison17/4489af914f5f05f3f12f0aee57dd4fd4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% load financeiro_tags %} | |
{% for _, contas in contas_por_data %} | |
{% for conta in contas %} | |
<tr> | |
<td class="center-align"> | |
<a href="{% url 'core:person_client_home' pk=conta.pessoa.id %}"> | |
<i class="material-icons prefix">home</i> | |
</a> | |
</td> | |
<td class="center-align"> | |
<a href="{% url 'financeiro:financeiro_update' id=conta.id %}">{{ conta.id|linebreaks }}</a> | |
</td> | |
<td class="center-align"> | |
{{ conta.historico|linebreaks }} | |
</td> | |
<td class="left-align"> | |
{{ conta.pessoa|linebreaks }} | |
</td> | |
<td class="right-align {% if conta.operacao == 'd' %}blue{% else %}red{% endif %}-text"> | |
{{ conta.valor_vendido|floatformat:"2" }} | |
</td> | |
<td class="center-align"> | |
{{ conta.data_vencimento|date:"d/m/Y" }} | |
</td> | |
<td class="center-align">{{ conta.data_pagamento|date:"d/m/Y"}}</td> | |
</tr> | |
{% endfor %} | |
<tr> | |
<td colspan="6">TOTAL: {{ contas|totalizar }}</td> | |
</tr> | |
{% endfor %} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import itertools | |
def financeiro_list(request): | |
q = request.GET.get('searchInput') | |
contas = Conta.objects.filter(pessoa__is_representative=False).order_by('data_vencimento') | |
if q: | |
contas = contas.filter( | |
Q(pessoa__name__icontains=q) | |
| Q(pessoa__cdalterdata__icontains=q) | |
| Q(valor_vendido__icontains=q) | |
| Q(historico__descricao__icontains=q) | |
) | |
contas = itertools.groupby(list(contas), lambda x: x.data_vencimento) | |
return render(request, 'financeiro_list.html', {'contas_por_data': contas}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment