From 22d4bd2cd51f08707e72f51e4abdf2e35a8135e5 Mon Sep 17 00:00:00 2001 From: s3lph Date: Fri, 7 Sep 2018 19:06:47 +0200 Subject: [PATCH] Fixed trailing whitespace. --- matemat/db/facade.py | 4 ++-- templates/receipt.txt | 26 ++++++++++++++++++++++++++ templates/transaction.txt | 2 ++ 3 files changed, 30 insertions(+), 2 deletions(-) create mode 100644 templates/receipt.txt create mode 100644 templates/transaction.txt diff --git a/matemat/db/facade.py b/matemat/db/facade.py index 8b956ad..9d4d924 100644 --- a/matemat/db/facade.py +++ b/matemat/db/facade.py @@ -612,7 +612,7 @@ class MatematDatabase(object): fromdate, min_id = row created: datetime = datetime.fromtimestamp(fromdate) cursor.execute(''' - SELECT t.ta_id, t.value, t.old_balance, t.date, c.ta_id, d.ta_id, m.ta_id, c.product, m.agent, m.reason + SELECT t.ta_id, t.value, t.old_balance, t.date, c.ta_id, d.ta_id, m.ta_id, c.product, m.agent, m.reason FROM transactions AS t LEFT JOIN consumptions AS c ON t.ta_id = c.ta_id @@ -642,7 +642,7 @@ class MatematDatabase(object): if write: cursor.execute(''' INSERT INTO receipts (user_id, first_ta_id, last_ta_id) - VALUES (:user_id, :first_ta, :last_ta) + VALUES (:user_id, :first_ta, :last_ta) ''', { 'user_id': user.id, 'first_ta': transactions[0].id, diff --git a/templates/receipt.txt b/templates/receipt.txt new file mode 100644 index 0000000..a047f9c --- /dev/null +++ b/templates/receipt.txt @@ -0,0 +1,26 @@ + + =================================================================== + MATEMAT RECEIPT + =================================================================== + + User: {{ user|safe }} + Accounting period: {{ fdate|safe }} -- {{ tdate|safe }} + + + Opening balance: {{ fbal|safe }} + + Transactions: + {% for t in transactions %} + {% include 'transaction.txt' %} + {% endfor %} + + ------------ + Closing balance: {{ tbal|safe }} + + =================================================================== + + {{ instance_name|striptags }}{% if receipt_id > 1 %} + Receipt N° {{ receipt_id|safe }}{% endif %} + + This receipt is only provided for informational purposes and has no + legal force. diff --git a/templates/transaction.txt b/templates/transaction.txt new file mode 100644 index 0000000..78b3039 --- /dev/null +++ b/templates/transaction.txt @@ -0,0 +1,2 @@ +{{ t.receipt_date|safe }} {{ t.receipt_description.ljust(36)|safe }} {% if t.receipt_message is none %}{{ t.receipt_value.rjust(8)|safe }}{% else %} + {{ t.receipt_message.ljust(36)|safe }} {{ t.receipt_value.rjust(8)|safe }}{% endif %} \ No newline at end of file