Skip to content
Snippets Groups Projects
Commit 59c2689b authored by Frank Poetzsch-Heffter's avatar Frank Poetzsch-Heffter
Browse files

budget should be integer

parent 1da1ccf9
No related branches found
No related tags found
1 merge request!86Merge school-apps
......@@ -50,7 +50,7 @@ class Account(models.Model):
costcenter = models.ForeignKey(to=Costcenter, on_delete=models.CASCADE, blank=False, verbose_name="Kostenstelle")
income = models.BooleanField(default=False,
verbose_name="Einnahmekonto") # True, wenn es sich um ein Einnahmekonto handelt
budget = models.DecimalField(max_digits=9, decimal_places=2, default=0.00, verbose_name="Budget")
budget = models.IntegerField(default=0, verbose_name="Budget")
saldo = models.DecimalField(max_digits=9, decimal_places=2, default=0.00)
rest = models.DecimalField(max_digits=9, decimal_places=2, default=0.00)
......
......@@ -37,8 +37,8 @@
<tr>
<th>Buchungskonto</th>
<th>Kostenstelle</th>
<th>erwartete Einnahmen</th>
<th>erwartete Ausgaben</th>
<th class="right-align">erwartete Einnahmen</th>
<th class="right-align">erwartete Ausgaben</th>
<th>Aktionen</th>
</tr>
</thead>
......@@ -48,11 +48,11 @@
<td>{{ account.name }}</td>
<td>{{ account.costcenter }}</td>
{% if account.income %}
<td class="green-text">{{ account.budget }}</td>
<td class="green-text right-align">{{ account.budget }}</td>
<td></td>
{% else %}
<td></td>
<td class="red-text">{{ account.budget }}</td>
<td class="red-text right-align">{{ account.budget }}</td>
{% endif %}
<td class="right-align">
<a href="{% url 'account_edit' account.id %}"
......
......@@ -254,11 +254,11 @@ def expenses(request):
try:
rest = account.budget - saldo
except:
rest = 0
rest = account.budget
try:
Account.objects.filter(id=account.id).update(saldo=saldo, rest=rest)
except:
Account.objects.filter(id=account.id).update(saldo=0, rest=0)
Account.objects.filter(id=account.id).update(saldo=0, rest=account.budget)
cost_center_accounts[cost_center.name] = list(
Account.objects.filter(costcenter=cost_center).order_by('-income'))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment