do not show the expense which represents the actual reimbursement, and do not count it towards the total

This commit is contained in:
Thomas Steen Rasmussen 2018-08-30 12:39:43 +02:00
parent 93b0bff50b
commit fc3a993547
3 changed files with 3 additions and 7 deletions

View file

@ -34,7 +34,7 @@
<td>{{ reim.notes|default:"N/A" }}</td>
<td>{{ reim.amount }} DKK</td>
<td>{{ reim.paid }}</td>
<td>{% for expense in reim.expenses.all %}{{ expense.pk }}<br>{% endfor %}</td>
<td>{% for expense in reim.expenses.all %}{% if not expense.paid_by_bornhack %}{{ expense.pk }} - {{ expense.amount }} DKK - {{ expense.description }}<br>{% endif %}{% endfor %}</td>
<td>
<a class="btn btn-primary" href="{% url "backoffice:reimbursement_detail" camp_slug=camp.slug pk=reim.pk %}">Details</a>
</td>

View file

@ -175,7 +175,7 @@ class Reimbursement(CampRelatedModel, UUIDModel):
The total amount for a reimbursement is calculated by adding up the amounts for all the related expenses
"""
amount = 0
for expense in self.expenses.all():
for expense in self.expenses.filter(paid_by_bornhack=False):
amount += expense.amount
return amount

View file

@ -3,17 +3,13 @@
<div class="panel-body">
<table class="table">
<tr>
<th>Amount</th>
<th>Total Amount</th>
<td>{{ reimbursement.amount }} DKK</td>
</tr>
<tr>
<th>Economy Team Notes</th>
<td>{{ reimbursement.notes|default:"N/A" }}</td>
</tr>
<tr>
<th>Total amount</th>
<td>{{ reimbursement.amount }} DKK</td>
</tr>
<tr>
<th>Paid</th>
<td>{{ reimbursement.paid }}</td>