Skip to content

Commit

Permalink
show deleted transactions in cashbox empty summary
Browse files Browse the repository at this point in the history
  • Loading branch information
bradjc committed May 22, 2016
1 parent 53172e5 commit b42e27a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 11 deletions.
3 changes: 2 additions & 1 deletion chezbetty/models/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
ForeignKey,
Boolean,
LargeBinary,
desc
desc,
asc
)

from sqlalchemy.ext.declarative import declarative_base
Expand Down
2 changes: 1 addition & 1 deletion chezbetty/models/transaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@ def __relevant_cash_deposits(self):
# Now get all cash deposits between that cash box empty and this one
q = object_session(self).query(event.Deposit)\
.filter(event.Event.timestamp < self.timestamp)\
.filter(event.Event.deleted==False)
.order_by(asc(event.Event.timestamp))

if previous_cb_empty:
q = q.filter(event.Event.timestamp >= previous_cb_empty.timestamp)
Expand Down
12 changes: 3 additions & 9 deletions chezbetty/templates/admin/event.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,8 @@
<th></th>
<th>Timestamp</th>
<th>Type</th>
<th>From Account:</th>
<th>To Account:</th>
<th>Deleted:</th>
<th class="right">Amount</th>
</tr>
</thead>
Expand All @@ -162,23 +162,17 @@
{% for t in e.transactions %}
{% if t.type == 'cashdeposit' %}

<tr>
<tr {% if e.deleted==True %}style="background-color: #FF9999;"{% endif %}>
<td>{{ button.event(e.id) }}</td>
<td>{{ e.timestamp|pretty_date|safe }}</td>
<td>{{ t.type }}</td>
<td>
{{ t.fr_account_virt|make_link|safe if t.fr_account_virt else "n/a" }}
{# Add account balance next to name for easy lookup. #}
{% if t.fr_account_virt.balance is defined and t.fr_account_virt.type != 'virtual' %}
({{ t.fr_account_virt.balance|format_currency|safe }})
{% endif %}
</td>
<td>
{{ t.to_account_virt|make_link|safe if t.to_account_virt else "n/a" }}
{% if t.to_account_virt.balance is defined and t.to_account_virt.type != 'virtual' %}
({{ t.to_account_virt.balance|format_currency|safe }})
{% endif %}
</td>
<td>{% if e.deleted==True %}DELETED{% endif %}</td>
<td class="right">{{ t.amount|format_currency|safe }}</td>
</tr>
{% endif %}
Expand Down

0 comments on commit b42e27a

Please sign in to comment.