moved charge fees from forms to config.
This commit is contained in:
@@ -1,3 +1,5 @@
|
|||||||
|
from django.utils.translation import ugettext_lazy as _
|
||||||
|
|
||||||
COMMON_CHAR_FIELD_LENGTH = 250
|
COMMON_CHAR_FIELD_LENGTH = 250
|
||||||
|
|
||||||
TITLE_MAX_LENGTH = COMMON_CHAR_FIELD_LENGTH
|
TITLE_MAX_LENGTH = COMMON_CHAR_FIELD_LENGTH
|
||||||
@@ -11,4 +13,91 @@ MEETING_POINT_OTHER_MAX_LENGTH = COMMON_CHAR_FIELD_LENGTH
|
|||||||
BASECAMP_MAX_LENGTH = COMMON_CHAR_FIELD_LENGTH
|
BASECAMP_MAX_LENGTH = COMMON_CHAR_FIELD_LENGTH
|
||||||
ACCOMMODATION_OTHER_MAX_LENGTH = COMMON_CHAR_FIELD_LENGTH
|
ACCOMMODATION_OTHER_MAX_LENGTH = COMMON_CHAR_FIELD_LENGTH
|
||||||
MEALS_OTHER_MAX_LENGTH = COMMON_CHAR_FIELD_LENGTH
|
MEALS_OTHER_MAX_LENGTH = COMMON_CHAR_FIELD_LENGTH
|
||||||
ADDITIONAL_COSTS_MAX_LENGTH = COMMON_CHAR_FIELD_LENGTH
|
ADDITIONAL_COSTS_MAX_LENGTH = COMMON_CHAR_FIELD_LENGTH
|
||||||
|
|
||||||
|
FEE_MATRIX = {
|
||||||
|
'0': {'description': _(u'Keiner'),
|
||||||
|
'trainer_fee': 0,
|
||||||
|
'pre_meeting_fee': 0,
|
||||||
|
'trainer_day_fee': 0,
|
||||||
|
'participant_fee': 0,
|
||||||
|
'participant_day_fee': 0,
|
||||||
|
},
|
||||||
|
'A': {'description': '',
|
||||||
|
'trainer_fee': 20,
|
||||||
|
'pre_meeting_fee': 20,
|
||||||
|
'trainer_day_fee': 50,
|
||||||
|
'participant_fee': 10,
|
||||||
|
'participant_day_fee': 10,
|
||||||
|
},
|
||||||
|
'B': {'description': '',
|
||||||
|
'trainer_fee': 40,
|
||||||
|
'pre_meeting_fee': 20,
|
||||||
|
'trainer_day_fee': 75,
|
||||||
|
'participant_fee': 10,
|
||||||
|
'participant_day_fee': 20,
|
||||||
|
},
|
||||||
|
'C': {'description': '',
|
||||||
|
'trainer_fee': 10,
|
||||||
|
'pre_meeting_fee': 20,
|
||||||
|
'trainer_day_fee': 60,
|
||||||
|
'participant_fee': 10,
|
||||||
|
'participant_day_fee': 30,
|
||||||
|
},
|
||||||
|
'D': {'description': '',
|
||||||
|
'trainer_fee': 30,
|
||||||
|
'pre_meeting_fee': 20,
|
||||||
|
'trainer_day_fee': 75,
|
||||||
|
'participant_fee': 20,
|
||||||
|
'participant_day_fee': 40,
|
||||||
|
},
|
||||||
|
'E': {'description': '',
|
||||||
|
'trainer_fee': 60,
|
||||||
|
'pre_meeting_fee': 20,
|
||||||
|
'trainer_day_fee': 75,
|
||||||
|
'participant_fee': 40,
|
||||||
|
'participant_day_fee': 40,
|
||||||
|
},
|
||||||
|
'F': {'description': '',
|
||||||
|
'trainer_fee': 60,
|
||||||
|
'pre_meeting_fee': 20,
|
||||||
|
'trainer_day_fee': 85,
|
||||||
|
'participant_fee': 40,
|
||||||
|
'participant_day_fee': 45,
|
||||||
|
},
|
||||||
|
'G': {'description': '',
|
||||||
|
'trainer_fee': 60,
|
||||||
|
'pre_meeting_fee': 20,
|
||||||
|
'trainer_day_fee': 75,
|
||||||
|
'participant_fee': 35,
|
||||||
|
'participant_day_fee': 30,
|
||||||
|
},
|
||||||
|
'H': {'description': '',
|
||||||
|
'trainer_fee': 60,
|
||||||
|
'pre_meeting_fee': 20,
|
||||||
|
'trainer_day_fee': 85,
|
||||||
|
'participant_fee': 35,
|
||||||
|
'participant_day_fee': 30,
|
||||||
|
},
|
||||||
|
'I': {'description': '',
|
||||||
|
'trainer_fee': 60,
|
||||||
|
'pre_meeting_fee': 20,
|
||||||
|
'trainer_day_fee': 75,
|
||||||
|
'participant_fee': 25,
|
||||||
|
'participant_day_fee': 25,
|
||||||
|
},
|
||||||
|
'J': {'description': '',
|
||||||
|
'trainer_fee': 60,
|
||||||
|
'pre_meeting_fee': 20,
|
||||||
|
'trainer_day_fee': 85,
|
||||||
|
'participant_fee': 25,
|
||||||
|
'participant_day_fee': 25,
|
||||||
|
},
|
||||||
|
'K': {'description': '',
|
||||||
|
'trainer_fee': 60,
|
||||||
|
'pre_meeting_fee': 20,
|
||||||
|
'trainer_day_fee': 130,
|
||||||
|
'participant_fee': 40,
|
||||||
|
'participant_day_fee': 40,
|
||||||
|
},
|
||||||
|
}
|
||||||
@@ -760,27 +760,28 @@ class ChargesForm(EventCreateForm):
|
|||||||
charge_key = forms.CharField(disabled=True,
|
charge_key = forms.CharField(disabled=True,
|
||||||
label=_(u'Abrechnungsschlüssel'),
|
label=_(u'Abrechnungsschlüssel'),
|
||||||
)
|
)
|
||||||
orga_fee = forms.FloatField(disabled=True,
|
trainer_fee = forms.FloatField(disabled=True,
|
||||||
label=_(u'Pauschale Trainer*in'),
|
label=_(u'Pauschale Trainer*in'),
|
||||||
)
|
)
|
||||||
pre_meeting_fee = forms.FloatField(disabled=True,
|
pre_meeting_fee = forms.FloatField(disabled=True,
|
||||||
label=_(u'Pauschale Vortreffen'),
|
label=_(u'Pauschale Vortreffen'),
|
||||||
)
|
)
|
||||||
orga_day_fee = forms.FloatField(disabled=True,
|
trainer_day_fee = forms.FloatField(disabled=True,
|
||||||
label=_(u'Tagespauschale Trainer*in'),
|
label=_(u'Tagespauschale Trainer*in'),
|
||||||
)
|
)
|
||||||
participation_fee = forms.FloatField(disabled=True,
|
participant_fee = forms.FloatField(disabled=True,
|
||||||
label=_(u'Pauschale Teilnehmer*in'),
|
label=_(u'Pauschale Teilnehmer*in'),
|
||||||
)
|
)
|
||||||
participation_day_fee = forms.FloatField(disabled=True,
|
participant_day_fee = forms.FloatField(disabled=True,
|
||||||
label=_(u'Tagepauschale Teilnehmer*in'),
|
label=_(u'Tagepauschale Teilnehmer*in'),
|
||||||
)
|
)
|
||||||
|
|
||||||
trainer_reward = forms.FloatField(disabled=True,
|
trainer_reward = forms.FloatField(disabled=True,
|
||||||
label=_(u'Aufwandsentschädigung Trainer*in'),
|
label=_(u'Aufwandsentschädigung Trainer*in'),
|
||||||
)
|
)
|
||||||
|
|
||||||
charge = forms.FloatField(label=_(u'Teilnahmegebühr'))
|
charge = forms.FloatField(label=_(u'Teilnahmegebühr'))
|
||||||
|
|
||||||
additional_costs = forms.CharField(required=False,
|
additional_costs = forms.CharField(required=False,
|
||||||
max_length=config.ADDITIONAL_COSTS_MAX_LENGTH,
|
max_length=config.ADDITIONAL_COSTS_MAX_LENGTH,
|
||||||
label=_(u'Zusätzliche Kosten (Text)'),
|
label=_(u'Zusätzliche Kosten (Text)'),
|
||||||
@@ -803,88 +804,28 @@ class ChargesForm(EventCreateForm):
|
|||||||
|
|
||||||
if ski_lift:
|
if ski_lift:
|
||||||
charge_key = 'K'
|
charge_key = 'K'
|
||||||
orga_fee = 60
|
|
||||||
pre_meeting_fee = 20
|
|
||||||
orga_day_fee = 130
|
|
||||||
participation_fee = 40
|
|
||||||
participation_day_fee = 40
|
|
||||||
elif sport == 'W' and not last_day:
|
elif sport == 'W' and not last_day:
|
||||||
charge_key = _(u'Keiner')
|
charge_key = '0'
|
||||||
orga_fee = 0
|
|
||||||
pre_meeting_fee = 0
|
|
||||||
orga_day_fee = 0
|
|
||||||
participation_fee = 0
|
|
||||||
participation_day_fee = 0
|
|
||||||
elif sport == 'W' and terrain != 'alpine':
|
elif sport == 'W' and terrain != 'alpine':
|
||||||
charge_key = u'A'
|
charge_key = u'A'
|
||||||
orga_fee = 20
|
|
||||||
pre_meeting_fee = 20
|
|
||||||
orga_day_fee = 50
|
|
||||||
participation_fee = 10
|
|
||||||
participation_day_fee = 10
|
|
||||||
elif sport == 'W':
|
elif sport == 'W':
|
||||||
charge_key = u'B'
|
charge_key = u'B'
|
||||||
orga_fee = 40
|
|
||||||
pre_meeting_fee = 20
|
|
||||||
orga_day_fee = 75
|
|
||||||
participation_fee = 10
|
|
||||||
participation_day_fee = 20
|
|
||||||
elif terrain != 'alpine' and not last_day:
|
elif terrain != 'alpine' and not last_day:
|
||||||
charge_key = u'C'
|
charge_key = u'C'
|
||||||
orga_fee = 10
|
|
||||||
pre_meeting_fee = 20
|
|
||||||
orga_day_fee = 60
|
|
||||||
participation_fee = 10
|
|
||||||
participation_day_fee = 30
|
|
||||||
elif terrain != 'alpine':
|
elif terrain != 'alpine':
|
||||||
charge_key = u'D'
|
charge_key = u'D'
|
||||||
orga_fee = 30
|
|
||||||
pre_meeting_fee = 20
|
|
||||||
orga_day_fee = 75
|
|
||||||
participation_fee = 20
|
|
||||||
participation_day_fee = 40
|
|
||||||
elif mode == 'training' and country in ('DE', 'AU'):
|
elif mode == 'training' and country in ('DE', 'AU'):
|
||||||
charge_key = u'G'
|
charge_key = u'G'
|
||||||
orga_fee = 60
|
|
||||||
pre_meeting_fee = 20
|
|
||||||
orga_day_fee = 75
|
|
||||||
participation_fee = 35
|
|
||||||
participation_day_fee = 30
|
|
||||||
elif mode == 'training':
|
elif mode == 'training':
|
||||||
charge_key = u'H'
|
charge_key = u'H'
|
||||||
orga_fee = 60
|
|
||||||
pre_meeting_fee = 20
|
|
||||||
orga_day_fee = 85
|
|
||||||
participation_fee = 35
|
|
||||||
participation_day_fee = 30
|
|
||||||
elif sport == 'K' and country in ('DE', 'AU'):
|
elif sport == 'K' and country in ('DE', 'AU'):
|
||||||
charge_key = u'E'
|
charge_key = u'E'
|
||||||
orga_fee = 60
|
|
||||||
pre_meeting_fee = 20
|
|
||||||
orga_day_fee = 75
|
|
||||||
participation_fee = 40
|
|
||||||
participation_day_fee = 40
|
|
||||||
elif sport == 'K':
|
elif sport == 'K':
|
||||||
charge_key = u'F'
|
charge_key = u'F'
|
||||||
orga_fee = 60
|
|
||||||
pre_meeting_fee = 20
|
|
||||||
orga_day_fee = 85
|
|
||||||
participation_fee = 40
|
|
||||||
participation_day_fee = 45
|
|
||||||
elif country in ('DE', 'AU'):
|
elif country in ('DE', 'AU'):
|
||||||
charge_key = u'I'
|
charge_key = u'I'
|
||||||
orga_fee = 60
|
|
||||||
pre_meeting_fee = 20
|
|
||||||
orga_day_fee = 75
|
|
||||||
participation_fee = 25
|
|
||||||
participation_day_fee = 25
|
|
||||||
else:
|
else:
|
||||||
charge_key = u'J'
|
charge_key = u'J'
|
||||||
orga_fee = 60
|
|
||||||
pre_meeting_fee = 20
|
|
||||||
orga_day_fee = 85
|
|
||||||
participation_fee = 25
|
|
||||||
participation_day_fee = 25
|
|
||||||
|
|
||||||
additional_costs_text = ugettext(u'Fahrtkosten')
|
additional_costs_text = ugettext(u'Fahrtkosten')
|
||||||
|
|
||||||
@@ -901,21 +842,30 @@ class ChargesForm(EventCreateForm):
|
|||||||
else:
|
else:
|
||||||
n_pre_meetings = 0
|
n_pre_meetings = 0
|
||||||
|
|
||||||
trainer_reward = orga_fee + ndays * orga_day_fee + n_pre_meetings * pre_meeting_fee
|
fees = config.FEE_MATRIX[charge_key]
|
||||||
charge = participation_fee + ndays * participation_day_fee
|
|
||||||
|
trainer_reward = (
|
||||||
|
fees['trainer_fee']
|
||||||
|
+ ndays * fees['trainer_day_fee']
|
||||||
|
+ n_pre_meetings * fees['pre_meeting_fee']
|
||||||
|
)
|
||||||
|
charge = (
|
||||||
|
fees['participant_fee']
|
||||||
|
+ ndays * fees['participant_day_fee']
|
||||||
|
)
|
||||||
if arrival_previous_day:
|
if arrival_previous_day:
|
||||||
trainer_reward += orga_day_fee / 2
|
trainer_reward += fees['trainer_day_fee'] / 2.0
|
||||||
charge += participation_day_fee / 2
|
charge += fees['participant_day_fee'] / 2.0
|
||||||
|
|
||||||
if charge > 0:
|
if charge > 0:
|
||||||
additional_costs_text = u'%s %s' % (ugettext(u'zzgl.'), additional_costs_text)
|
additional_costs_text = u'%s %s' % (ugettext(u'zzgl.'), additional_costs_text)
|
||||||
|
|
||||||
self.fields['charge_key'].initial = charge_key
|
self.fields['charge_key'].initial = fees['description'] or charge_key
|
||||||
self.fields['orga_fee'].initial = orga_fee
|
self.fields['trainer_fee'].initial = fees['trainer_fee']
|
||||||
self.fields['pre_meeting_fee'].initial = pre_meeting_fee
|
self.fields['pre_meeting_fee'].initial = fees['pre_meeting_fee']
|
||||||
self.fields['orga_day_fee'].initial = orga_day_fee
|
self.fields['trainer_day_fee'].initial = fees['trainer_day_fee']
|
||||||
self.fields['participation_fee'].initial = participation_fee
|
self.fields['participant_fee'].initial = fees['participant_day_fee']
|
||||||
self.fields['participation_day_fee'].initial = participation_day_fee
|
self.fields['participant_day_fee'].initial = fees['participant_day_fee']
|
||||||
self.fields['trainer_reward'].initial = trainer_reward
|
self.fields['trainer_reward'].initial = trainer_reward
|
||||||
|
|
||||||
self.fields['charge'].initial = charge
|
self.fields['charge'].initial = charge
|
||||||
|
|||||||
@@ -11,10 +11,10 @@
|
|||||||
{% bootstrap_field form.charge_key %}
|
{% bootstrap_field form.charge_key %}
|
||||||
</div>
|
</div>
|
||||||
<div class="col-sm-4">
|
<div class="col-sm-4">
|
||||||
{% bootstrap_field form.orga_fee %}
|
{% bootstrap_field form.trainer_fee %}
|
||||||
</div>
|
</div>
|
||||||
<div class="col-sm-4">
|
<div class="col-sm-4">
|
||||||
{% bootstrap_field form.orga_day_fee %}
|
{% bootstrap_field form.trainer_day_fee %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
@@ -22,10 +22,10 @@
|
|||||||
{% bootstrap_field form.pre_meeting_fee %}
|
{% bootstrap_field form.pre_meeting_fee %}
|
||||||
</div>
|
</div>
|
||||||
<div class="col-sm-4">
|
<div class="col-sm-4">
|
||||||
{% bootstrap_field form.participation_fee %}
|
{% bootstrap_field form.participant_fee %}
|
||||||
</div>
|
</div>
|
||||||
<div class="col-sm-4">
|
<div class="col-sm-4">
|
||||||
{% bootstrap_field form.participation_day_fee %}
|
{% bootstrap_field form.participant_day_fee %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user