fixed ljp calculation

MK/finance_workflow
mariusrklein 8 months ago
parent 8929951212
commit 1f57108299

@ -298,6 +298,11 @@ class Statement(CommonModel):
def total_bills_theoretic(self): def total_bills_theoretic(self):
return sum([bill.amount for bill in self.bill_set.all()]) 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 @property
def euro_per_km(self): def euro_per_km(self):
if self.excursion is None: if self.excursion is None:
@ -407,8 +412,13 @@ class Statement(CommonModel):
@property @property
def paid_ljp_contributions(self): def paid_ljp_contributions(self):
if hasattr(self.excursion, 'ljpproposal') and self.ljp_to: 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, return cvt_to_decimal(
0.9 * float(self.total_bills_theoretic) + float(self.total_staff))) 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: else:
return 0 return 0
@ -457,6 +467,7 @@ class Statement(CommonModel):
'theoretical_total_staff': self.theoretical_total_staff, 'theoretical_total_staff': self.theoretical_total_staff,
'real_staff_count': self.real_staff_count, 'real_staff_count': self.real_staff_count,
'total_subsidies': self.total_subsidies, 'total_subsidies': self.total_subsidies,
'total_allowance': self.total_allowance,
'subsidy_to': self.subsidy_to, 'subsidy_to': self.subsidy_to,
'allowance_to': self.allowance_to, 'allowance_to': self.allowance_to,
'paid_ljp_contributions': self.paid_ljp_contributions, 'paid_ljp_contributions': self.paid_ljp_contributions,

@ -160,7 +160,7 @@ Once their proposal was approved, the ljp contributions of should be paid to:{%
{% trans "Contributions by the association" %} {% trans "Contributions by the association" %}
</td> </td>
<td> <td>
{{ total_subsidies_theoretical }}€ {{ total_subsidies }}€
</td> </td>
</tr> </tr>
<tr> <tr>

Loading…
Cancel
Save