More distinction for monthly payments

This commit is contained in:
Drew DeVault 2016-07-04 16:37:52 -04:00
parent fd281f3eaf
commit 1ea97dc898
2 changed files with 10 additions and 10 deletions

View File

@ -61,8 +61,10 @@ def admin():
donations=donations, donations=donations,
one_times=lambda p: sum([d.amount for d in p.donations if d.type == DonationType.one_time]), one_times=lambda p: sum([d.amount for d in p.donations if d.type == DonationType.one_time]),
recurring=lambda p: sum([d.amount for d in p.donations if d.type == DonationType.monthly and d.active]), recurring=lambda p: sum([d.amount for d in p.donations if d.type == DonationType.monthly and d.active]),
recurring_ever=lambda p: sum([d.amount * d.payments for d in p.donations if d.type == DonationType.monthly]),
unspecified_one_times=sum([d.amount for d in unspecified if d.type == DonationType.one_time]), unspecified_one_times=sum([d.amount for d in unspecified if d.type == DonationType.one_time]),
unspecified_recurring=sum([d.amount for d in unspecified if d.type == DonationType.monthly and d.active]), unspecified_recurring=sum([d.amount for d in unspecified if d.type == DonationType.monthly and d.active]),
unspecified_recurring_ever=sum([d.amount * d.payments for d in unspecified if d.type == DonationType.monthly]),
total_one_time=sum([d.amount for d in Donation.query.filter(Donation.type == DonationType.one_time)]), total_one_time=sum([d.amount for d in Donation.query.filter(Donation.type == DonationType.one_time)]),
total_recurring=sum([d.amount for d in Donation.query.filter(Donation.type == DonationType.monthly, Donation.active == True)]), total_recurring=sum([d.amount for d in Donation.query.filter(Donation.type == DonationType.monthly, Donation.active == True)]),
total_recurring_ever=sum([d.amount * d.payments for d in Donation.query.filter(Donation.type == DonationType.monthly)]), total_recurring_ever=sum([d.amount * d.payments for d in Donation.query.filter(Donation.type == DonationType.monthly)]),

View File

@ -49,14 +49,15 @@
{% endif %} {% endif %}
<h2>Projects</h2> <h2>Projects</h2>
<div class="row"> <div class="row">
<div class="col-md-6"> <div class="col-md-9">
<table class="table"> <table class="table">
<thead> <thead>
<tr> <tr>
<th style="width: 10%"></th> <th style="width: 10%"></th>
<th>Project Name</th> <th>Project Name</th>
<th>One-time</th> <th>One-time</th>
<th>Recurring</th> <th>Recurring (active)</th>
<th>Recurring (total paid)</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -66,6 +67,7 @@
<td>{{ project.name }}</td> <td>{{ project.name }}</td>
<td>${{ "{:.2f}".format(one_times(project) / 100) }}</td> <td>${{ "{:.2f}".format(one_times(project) / 100) }}</td>
<td>${{ "{:.2f}".format(recurring(project) / 100) }}</td> <td>${{ "{:.2f}".format(recurring(project) / 100) }}</td>
<td>${{ "{:.2f}".format(recurring_ever(project) / 100) }}</td>
</tr> </tr>
{% endfor %} {% endfor %}
<tr> <tr>
@ -73,23 +75,19 @@
<td>(not specified)</td> <td>(not specified)</td>
<td>${{ "{:.2f}".format(unspecified_one_times / 100) }}</td> <td>${{ "{:.2f}".format(unspecified_one_times / 100) }}</td>
<td>${{ "{:.2f}".format(unspecified_recurring / 100) }}</td> <td>${{ "{:.2f}".format(unspecified_recurring / 100) }}</td>
<td>${{ "{:.2f}".format(unspecified_recurring_ever / 100) }}</td>
</tr> </tr>
<tr> <tr>
<td></td> <td></td>
<td><strong>Total</strong></td> <td><strong>Total</strong></td>
<td>${{ "{:.2f}".format(total_one_time / 100) }}</td> <td>${{ "{:.2f}".format(total_one_time / 100) }}</td>
<td>${{ "{:.2f}".format(total_recurring / 100) }} (active)</td> <td>${{ "{:.2f}".format(total_recurring / 100) }}</td>
</tr> <td>${{ "{:.2f}".format(total_recurring_ever / 100) }}</td>
<tr>
<td></td>
<td><strong>Total</strong></td>
<td></td>
<td>${{ "{:.2f}".format(total_recurring_ever / 100) }} (paid)</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
</div> </div>
<div class="col-md-6 well"> <div class="col-md-3 well">
<h4>Add Project</h4> <h4>Add Project</h4>
<p>Donors will not be given a choice of project unless you have at least 2.</p> <p>Donors will not be given a choice of project unless you have at least 2.</p>
<form method="POST" action="{{root}}/create-project"> <form method="POST" action="{{root}}/create-project">