diff --git a/selfserv/settings.example.py b/selfserv/settings.example.py index bae5801..815e450 100644 --- a/selfserv/settings.example.py +++ b/selfserv/settings.example.py @@ -1,5 +1,6 @@ # Society Self-Service -# Copyright © 2018-2019 Yingtong Li (RunasSudo) +# Copyright © 2018-2023 Yingtong Li (RunasSudo) +# Copyright © 2023 MUMUS Inc. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by @@ -32,6 +33,9 @@ PROMO_LOGO_URL = 'https://placehold.it/2000x500' PROMO_LOGO_LINK = 'https://example.com' PROMO_GROUPS_MANDATORY = ['All Years'] +TICKETING_FEE_PROPORTION = 0.0175 # Previous default was (1-1/1.01884) +TICKETING_FEE_FIXED = 0.30 # Previous default was 0.8133/1.01884 + ABA_USER_NAME = 'Society Name' ABA_BANK_NAME = 'CBA' ABA_BANK_CODE = 0 diff --git a/sstreasury/jinja2/sstreasury/budget_edit.html b/sstreasury/jinja2/sstreasury/budget_edit.html index e2a0087..cc3a8dd 100644 --- a/sstreasury/jinja2/sstreasury/budget_edit.html +++ b/sstreasury/jinja2/sstreasury/budget_edit.html @@ -225,9 +225,12 @@ } }); + const ticketingFeeProportion = {{ settings.TICKETING_FEE_PROPORTION }}; + const ticketingFeeFixed = {{ settings.TICKETING_FEE_FIXED }}; + const editing = true; + var revenue_data = JSON.parse({{ import('json').dumps(import('json').dumps(revision.revenue))|safe }}); var expense_data = JSON.parse({{ import('json').dumps(import('json').dumps(revision.expense))|safe }}); - var editing = true; makeGrid(); dragula([document.querySelector('#revenue_grid tbody')], { diff --git a/sstreasury/jinja2/sstreasury/budget_view.html b/sstreasury/jinja2/sstreasury/budget_view.html index af3ed75..ba50f55 100644 --- a/sstreasury/jinja2/sstreasury/budget_view.html +++ b/sstreasury/jinja2/sstreasury/budget_view.html @@ -385,9 +385,13 @@ diff --git a/sstreasury/models.py b/sstreasury/models.py index d58e969..96de61b 100644 --- a/sstreasury/models.py +++ b/sstreasury/models.py @@ -1,5 +1,6 @@ # Society Self-Service -# Copyright © 2018–2022 Yingtong Li (RunasSudo) +# Copyright © 2018–2023 Yingtong Li (RunasSudo) +# Copyright © 2023 MUMUS Inc. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by @@ -78,6 +79,9 @@ class BudgetRevision(models.Model): expense_no_emergency_fund = models.BooleanField() expense_comments = models.TextField() + ticketing_fee_proportion = models.FloatField() + ticketing_fee_fixed = models.FloatField() + action = models.IntegerField(choices=[(v.value, v.description) for v in BudgetAction]) class Meta: @@ -103,7 +107,7 @@ class BudgetRevision(models.Model): try: total += Decimal(item['Unit price']) * Decimal(item['Units']) if item['IWT'] and item['Unit price'] > 0: - total -= (Decimal(item['Unit price']) - (Decimal(item['Unit price']) - Decimal('0.8133')) / Decimal('1.01884')) * item['Units'] + total -= (Decimal(item['Unit price']) * Decimal(self.ticketing_fee_proportion) + Decimal(self.ticketing_fee_fixed)) * item['Units'] except TypeError: # Invalid unit price, etc. pass diff --git a/sstreasury/static/sstreasury/budget.js b/sstreasury/static/sstreasury/budget.js index aa07095..7a569e9 100644 --- a/sstreasury/static/sstreasury/budget.js +++ b/sstreasury/static/sstreasury/budget.js @@ -30,7 +30,7 @@ function recalcRevTotal(args) { for (var row of args.grid.data) { revTotal += row['Unit price'] * row['Units']; if (row['Unit price'] > 0 && row['IWT']) { - revTotalIWT += (row['Unit price'] - (row['Unit price'] - 0.8133) / 1.01884) * row['Units']; + revTotalIWT += (row['Unit price'] * ticketingFeeProportion + ticketingFeeFixed) * row['Units']; } } @@ -38,7 +38,7 @@ function recalcRevTotal(args) { if (revTotalIWT > 0) { var totalrow = $('