Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion amelie/activities/ajax_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,10 @@ def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
request_person: Optional[Person] = self.request.person if hasattr(self.request, 'person') else None
context['object'] = Participation.objects.get(pk=self.kwargs['pk'])
context['transactions'] = [t for t in context['object'].activitytransaction_set.all() if not t.is_paid()]
context['transactions'] = [t for t in context['object'].activitytransaction_set.filter(settlement=None)]
context['transactions_total'] = sum(t.price for t in context['transactions'])
context['settled_transactions'] = [t for t in context['object'].activitytransaction_set.exclude(settlement=None)]
context['settled_transactions_total'] = sum(t.price for t in context['settled_transactions'])
context['is_roomduty'] = request_person and request_person.is_room_duty()
context['is_committee'] = request_person and context['object'].event.organizer in request_person.current_committees().all()
return context
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,13 @@
<br /><small class="icon scaled-icon icon-arrow_undo">
{% trans 'Previous attempt was reversed' %}
</small>
{% if request.is_board %}
<br /><small class="icon scaled-icon icon-cross">
<abbr title="{% trans "Because this transaction was reversed, we can't create a payment for it here (the reversal might have included other transactions). To mark this as paid, create a payment manually in the person's personal tab." %}">
{% trans 'Cannot create manual payment here' %}
</abbr>
</small>
{% endif %}
{% elif details.0 == 'unpaid' and details.1 == None %}
<br /><small class="icon scaled-icon icon-coins">
{% blocktrans with costs=participation.to_be_paid_costs|intcomma %}Needs manual payment (&euro;&nbsp;{{ costs }}){% endblocktrans %}
Expand All @@ -128,6 +135,13 @@
{% trans 'Enter manual payment' %}
</a>
{% endif %}
{% if request.is_board and details.0 == 'unpaid' and details.1 != None %}
<br /><a class="looks-like-a-button js-load-block"
href="{% url 'activities:activity_participation_create_payment' activity_id=obj.id pk=participation.id %}"
data-container="enrollment_overview">
{% trans 'Enter manual payment' %}
</a>
{% endif %}
{% endwith %}
{% endif %}
</td>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,42 @@ <h3 class="legend">
Create manual payment for {{ participation }}
{% endblocktrans %}
</h3>
{% if settled_transactions %}
<p>{% trans 'The following transactions for this participation have already been settled. They will not be included in the payment:' %}</p>
<div class="table-responsive">
<table class="person_table table">
<thead>
<tr>
<th>{% trans 'Timestamp' %}</th>
<th>{% trans 'Description' %}</th>
<th>{% trans 'Amount' %}</th>
</tr>
</thead>
<tbody>
{% for transaction in settled_transactions %}
<tr>
<td>
{{ transaction.date|date:"d-m-Y H:i" }}
</td>
<td>
<a title="{% trans 'Transaction details (opens in new tab)' %}" href="{{ transaction.get_absolute_url }}" target="_blank">
{{ transaction.description }}
</a>
</td>
<td>
&euro;&nbsp;{{ transaction.price|intcomma }}
</td>
</tr>
{% endfor %}
<tr>
<td></td>
<td class="text-bold">{% trans 'Total' %}</td>
<td class="text-bold">&euro;&nbsp;{{ settled_transactions_total|intcomma }}</td>
</tr>
</tbody>
</table>
</div>
{% endif %}

<p>{% trans 'You are creating a manual payment that will cover the following transactions:' %}</p>

Expand Down
6 changes: 5 additions & 1 deletion amelie/calendar/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,10 @@ def calculate_costs(self) -> Tuple[Decimal, bool]:
def unpaid_transactions(self):
return [t for t in self.activitytransaction_set.all() if not t.is_paid()]

@property
def unsettled_transactions(self):
return [t for t in self.activitytransaction_set.filter(settlement=None)]

@property
def to_be_paid_costs(self):
"""
Expand All @@ -126,7 +130,7 @@ def mark_as_paid(self, payment_method, actor: Optional[Person] = None):
from amelie.personal_tab.models import ManualPaymentSettlement

# Get the ActivityTransaction(s) for this Participation that still need to be paid
ats = self.unpaid_transactions
ats = self.unsettled_transactions
if not ats:
return None

Expand Down
4 changes: 3 additions & 1 deletion amelie/members/ajax_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,10 @@ def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
context['person'] = get_object_or_404(Person, id=self.kwargs['id'])
context['membership'] = get_object_or_404(Membership, id=self.kwargs['membership'])
context['transactions'] = [t for t in context['membership'].contributiontransaction_set.all() if not t.is_paid()]
context['transactions'] = [t for t in context['membership'].contributiontransaction_set.filter(settlement=None)]
context['transactions_total'] = sum(t.price for t in context['transactions'])
context['settled_transactions'] = [t for t in context['membership'].contributiontransaction_set.exclude(settlement=None)]
context['settled_transactions_total'] = sum(t.price for t in context['settled_transactions'])
return context

def get_success_url(self, query: Optional[Dict] = None):
Expand Down
2 changes: 1 addition & 1 deletion amelie/members/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -1090,7 +1090,7 @@ def mark_as_paid(self, payment_method, actor: Optional[Person] = None):
from amelie.personal_tab.models import ManualPaymentSettlement

# Get the ContributionTransaction(s) for this Membership that still need to be paid
cts = [t for t in self.contributiontransaction_set.all() if not t.is_paid()]
cts = [t for t in self.contributiontransaction_set.filter(settlement=None)]
if not cts:
return None

Expand Down
14 changes: 14 additions & 0 deletions amelie/members/templates/person_membership.html
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,13 @@
<br /><small class="icon scaled-icon icon-arrow_undo">
{% trans 'Previous attempt was reversed' %}
</small>
{% if request.is_board %}
<br /><small class="icon scaled-icon icon-cross">
<abbr title="{% trans "Because this transaction was reversed, we can't create a payment for it here (the reversal might have included other transactions). To mark this as paid, create a payment manually in the person's personal tab." %}">
{% trans 'Cannot create manual payment here' %}
</abbr>
</small>
{% endif %}
{% elif details.0 == 'unpaid' %}
{% if details.1 == None %}
<br /><small class="icon scaled-icon icon-coins">
Expand All @@ -135,6 +142,13 @@
{% trans 'Enter manual payment' %}
</a>
{% endif %}
{% if request.is_board and details.0 == 'unpaid' and details.1 != None %}
<br /><a class="looks-like-a-button js-load-block"
href="{% url 'members:person_membership_create_payment' id=obj.id membership=membership.id %}"
data-container="person_membership">
{% trans 'Enter manual payment' %}
</a>
{% endif %}
{% endwith %}
{% endif %}
</td>
Expand Down
36 changes: 36 additions & 0 deletions amelie/members/templates/person_membership_create_payment.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,42 @@ <h3 class="legend">
Create manual payment for {{ membership }} of {{ person }}
{% endblocktrans %}
</h3>
{% if settled_transactions %}
<p>{% trans 'The following transactions for this membership have already been settled. They will not be included in the payment:' %}</p>
<div class="table-responsive">
<table class="person_table table">
<thead>
<tr>
<th>{% trans 'Timestamp' %}</th>
<th>{% trans 'Description' %}</th>
<th>{% trans 'Amount' %}</th>
</tr>
</thead>
<tbody>
{% for transaction in settled_transactions %}
<tr>
<td>
{{ transaction.date|date:"d-m-Y H:i" }}
</td>
<td>
<a title="{% trans 'Transaction details (opens in new tab)' %}" href="{{ transaction.get_absolute_url }}" target="_blank">
{{ transaction.description }}
</a>
</td>
<td>
&euro;&nbsp;{{ transaction.price|intcomma }}
</td>
</tr>
{% endfor %}
<tr>
<td></td>
<td class="text-bold">{% trans 'Total' %}</td>
<td class="text-bold">&euro;&nbsp;{{ settled_transactions_total|intcomma }}</td>
</tr>
</tbody>
</table>
</div>
{% endif %}

<p>{% trans 'You are creating a manual payment that will cover the following transactions:' %}</p>

Expand Down
Binary file modified locale/nl/LC_MESSAGES/django.mo
Binary file not shown.
Loading
Loading