diff --git a/ledger_pyreport/jinja2/cashflow_direct.html b/ledger_pyreport/jinja2/cashflow_direct.html
index 172f0c2..a7603a3 100644
--- a/ledger_pyreport/jinja2/cashflow_direct.html
+++ b/ledger_pyreport/jinja2/cashflow_direct.html
@@ -29,7 +29,7 @@
{% for cashflow in cashflows %}
{% set amount = (-cashflow.get_balance(account) if invert else cashflow.get_balance(account)).exchange(report_commodity, True) %}
-
{% if not amount.near_zero %}{{ amount|a('/transactions?' + {'date': cashflow.date.strftime('%Y-%m-%d'), 'pstart': cashflow.pstart.strftime('%Y-%m-%d'), 'account': account.name, 'cash': 'on' if cash else ''}|urlencode) }}{% endif %} |
+ {% if not amount.near_zero %}{{ amount|a('/transactions?' + {'date_end': cashflow.date.strftime('%Y-%m-%d'), 'date_beg': cashflow.pstart.strftime('%Y-%m-%d'), 'account': account.name, 'cash': 'on' if cash else ''}|urlencode) }}{% endif %} |
{% endfor %}
diff --git a/ledger_pyreport/ledger.py b/ledger_pyreport/ledger.py
index 92fb531..4305442 100644
--- a/ledger_pyreport/ledger.py
+++ b/ledger_pyreport/ledger.py
@@ -131,4 +131,6 @@ def raw_transactions_at_date(date):
if amount.commodity.name not in ledger.commodities:
ledger.commodities[amount.commodity.name] = amount.commodity.strip_price()
+ ledger.transactions.sort(key=lambda t: t.date)
+
return ledger