diff --git a/jdav_web/finance/models.py b/jdav_web/finance/models.py index 4783009..5765aef 100644 --- a/jdav_web/finance/models.py +++ b/jdav_web/finance/models.py @@ -298,6 +298,11 @@ class Statement(CommonModel): def total_bills_theoretic(self): return sum([bill.amount for bill in self.bill_set.all()]) + @property + def total_bills_not_covered(self): + """Returns the sum of bills that are not marked for reimbursement by the finance officer""" + return sum([bill.amount for bill in self.bill_set.all()]) - self.total_bills + @property def euro_per_km(self): if self.excursion is None: @@ -407,8 +412,13 @@ class Statement(CommonModel): @property def paid_ljp_contributions(self): if hasattr(self.excursion, 'ljpproposal') and self.ljp_to: - return cvt_to_decimal((1-settings.LJP_TAX) * min(settings.LJP_CONTRIBUTION_PER_DAY * self.excursion.ljp_participant_count * self.excursion.ljp_duration, - 0.9 * float(self.total_bills_theoretic) + float(self.total_staff))) + return cvt_to_decimal( + min( + (1-settings.LJP_TAX) * settings.LJP_CONTRIBUTION_PER_DAY * self.excursion.ljp_participant_count * self.excursion.ljp_duration, + (1-settings.LJP_TAX) * 0.9 * (float(self.total_bills_not_covered) + float(self.total_staff) ), + float(self.total_bills_not_covered) + ) + ) else: return 0 @@ -457,6 +467,7 @@ class Statement(CommonModel): 'theoretical_total_staff': self.theoretical_total_staff, 'real_staff_count': self.real_staff_count, 'total_subsidies': self.total_subsidies, + 'total_allowance': self.total_allowance, 'subsidy_to': self.subsidy_to, 'allowance_to': self.allowance_to, 'paid_ljp_contributions': self.paid_ljp_contributions, diff --git a/jdav_web/finance/templates/admin/overview_submitted_statement.html b/jdav_web/finance/templates/admin/overview_submitted_statement.html index 34d69f8..0d97736 100644 --- a/jdav_web/finance/templates/admin/overview_submitted_statement.html +++ b/jdav_web/finance/templates/admin/overview_submitted_statement.html @@ -160,7 +160,7 @@ Once their proposal was approved, the ljp contributions of should be paid to:{% {% trans "Contributions by the association" %} - {{ total_subsidies_theoretical }}€ + {{ total_subsidies }}€