Skip to content

Commit

Permalink
Show public entity expenditure amounts in thousands
Browse files Browse the repository at this point in the history
  • Loading branch information
paulmwatson committed May 13, 2024
1 parent db68929 commit 443a4a5
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
8 changes: 7 additions & 1 deletion budgetportal/templates/public_entity.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{% extends 'page-shell.html' %}
{% load humanize %}
{% load define_action %}
{% load custom_filters %}
{% block page_content %}
<div class="Page-content">
<main class="Page-contentInner is-padding-bottom-0">
Expand Down Expand Up @@ -68,6 +69,11 @@ <h2 class="pull-left">Detailed financial information:</h2>
<div class="Section u-marginBottom20">
<table class="is-width-100-percent has-font-size-0-75-em has-border-bottom-1 has-line-height-2">
<thead>
<tr>
<th colspan="9" align="right"><small>
All Financial Values: R'000
</small></th>
</tr>
<tr>
<th class="is-text-no-wrap">Consol indi</th>
<th class="is-text-no-wrap">Classification 1</th>
Expand All @@ -91,7 +97,7 @@ <h2 class="pull-left">Detailed financial information:</h2>
<td title="{{ expenditure.economic_classification5 }}">{{ expenditure.economic_classification5|truncatechars:40 }}</td>
<td title="{{ expenditure.economic_classification6 }}">{{ expenditure.economic_classification6|truncatechars:40 }}</td>
<td title="{{ expenditure.budget_phase }}" class="is-text-no-wrap">{{ expenditure.budget_phase|truncatechars:40 }}</td>
<td title="{{ expenditure.amount }}">{{ expenditure.amount|intcomma }}</td>
<td title="{{ expenditure.amount }}">{{ expenditure.amount|divide:1000|floatformat:"0"|intcomma }}</td>
</tr>
{% endfor %}
</tbody>
Expand Down
11 changes: 11 additions & 0 deletions budgetportal/templatetags/custom_filters.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from django import template

register = template.Library()


@register.filter
def divide(value, arg):
try:
return int(value) / int(arg)
except (ValueError, ZeroDivisionError):
return None
4 changes: 2 additions & 2 deletions import_plublic_entities_expenditure.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def make_financial_year(year):


# Open the CSV file
with open("ENT_ENE_CashFlow_202324 - Data.csv", newline="") as csvfile:
with open("ENT_ENE_CashFlow_202324 - Data.csv", newline="") as csvfile:
# Create a DictReader object with named columns
csvreader = csv.DictReader(csvfile)

Expand All @@ -37,7 +37,7 @@ def make_financial_year(year):
count = 0
# Loop through each row in the CSV file
for row in csvreader:
if count >= 1000000:
if count >= 10:
break

# Increment the counter
Expand Down

0 comments on commit 443a4a5

Please sign in to comment.