Fetch bills

This commit is contained in:
Emily 2019-04-26 05:52:27 +01:00
parent 24c9fae040
commit 80ec3d23a6
2 changed files with 8 additions and 6 deletions

View File

@ -22,7 +22,7 @@ def dashboard():
@glob.app.route("/bills") @glob.app.route("/bills")
@flask_login.login_required @flask_login.login_required
def bills(): def bills():
conn = glob.get_sql_connection() conn = glob.make_sql_connection()
cur = conn.cursor() cur = conn.cursor()
cur.execute(""" cur.execute("""
@ -36,6 +36,7 @@ def bills():
data.append(row) data.append(row)
cur.close() cur.close()
conn.close()
return render_template("pages/bills.html", data=data) return render_template("pages/bills.html", data=data)
@glob.app.route("/warranties") @glob.app.route("/warranties")

View File

@ -11,21 +11,22 @@
<tr> <tr>
<th scope="col">Payment to</th> <th scope="col">Payment to</th>
<th scope="col">Description</th> <th scope="col">Description</th>
<th scope="col">Sum</th> <th scope="col" style="width: 120px">Sum</th>
<th scope="col">KID</th> <th scope="col" style="width: 120px">KID</th>
<th scope="col">Date Due</th> <th scope="col" style="width: 120px">Date Due</th>
<th scope="col">Payment status</th> <th scope="col" style="width: 150px">Payment status</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
{% for row in data %} {% for row in data %}
<!--<tr class="table-{{ 'success' if row[5] else 'danger' }}">-->
<tr> <tr>
<th>{{ row[0] }}</th> <th>{{ row[0] }}</th>
<td>{{ row[1] }}</td> <td>{{ row[1] }}</td>
<td>{{ row[2] }}</td> <td>{{ row[2] }}</td>
<td>{{ row[3] }}</td> <td>{{ row[3] }}</td>
<td>{{ row[4] }}</td> <td>{{ row[4] }}</td>
<td>{{ row[5] }}</td> <td style="background-color:{{ '#4F4' if row[5] else '#F44' }};"></td>
</tr> </tr>
{% endfor %} {% endfor %}
</tbody> </tbody>