Hinweise für Testzeitraum und Rechnungscheck

This commit is contained in:
holger.trampe 2020-12-06 10:28:36 +01:00
parent b79fad9bdc
commit a33db3ba6c
3 changed files with 104 additions and 4 deletions

View File

@ -1,6 +1,6 @@
from django import template from django import template
from django.contrib.auth.models import Group, User from django.contrib.auth.models import Group, User
from users.models import AgencyGroup, Agency, AgencyNetwork, AgencyNetworkPreperation, UserTime, UserYearAbsenceInfo from users.models import AgencyGroup, Agency, AgencyNetwork, AgencyNetworkPreperation, UserTime, UserYearAbsenceInfo, AgencyBills
from standards.models import Standards, StandardCommentRate, StandardComments from standards.models import Standards, StandardCommentRate, StandardComments
from timemanagement.models import Workday, FreeDays, Absence from timemanagement.models import Workday, FreeDays, Absence
from message.models import Message from message.models import Message
@ -858,22 +858,35 @@ def getAgencyBillStatus(agency):
returnvalue = 20 returnvalue = 20
else: else:
today = date.today() today = date.today()
bills = AgencyBills.objects.filter(agency=agency)
activeBill = False
for bill in bills:
if bill.end <= today and bill.billstatus == "paid":
activeBill = True
# Tage, die zwischen Registrierung und heute liegen # Tage, die zwischen Registrierung und heute liegen
daysbetween = (today - regdate).days daysbetween = (today - regdate).days
if agency.paymentplan == 0 and daysbetween <= 30: if agency.paymentplan == 0 and daysbetween <= 30:
returnvalue = 0 returnvalue = 0
elif agency.paymentplan == 0 and daysbetween > 30 and daysbetween < 45: elif agency.paymentplan == 0 and daysbetween > 30 and daysbetween <= 45:
returnvalue = 1 returnvalue = 1
elif agency.paymentplan == 0 and daysbetween > 45 and daysbetween <= 60: elif agency.paymentplan == 0 and daysbetween > 45 and daysbetween <= 60:
returnvalue = 2 returnvalue = 2
elif agency.paymentplan == 0 and daysbetween > 60: elif agency.paymentplan == 0 and daysbetween > 60:
returnvalue = 3 returnvalue = 3
elif agency.paymentplan == 1: elif agency.paymentplan == 1 and activeBill == True:
returnvalue = 10 returnvalue = 10
elif agency.paymentplan == 1 and activeBill == False:
returnvalue = 11
#paymentplan = models.IntegerField(default=0, null=True, blank=True) #paymentplan = models.IntegerField(default=0, null=True, blank=True)
#payment_address = models.EmailField(default=None, blank=True, null=True) #payment_address = models.EmailField(default=None, blank=True, null=True)
return returnvalue return returnvalue

View File

@ -997,6 +997,93 @@ $(document).ready(function(){
}); });
}); });
</script> </script>
{% elif billstatus == 2 %}
<div class="modal fade" tabindex="-1" role="dialog" data-backdrop="static" id="noaccess">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">Testphase abgelaufen</h5>
</div>
<div class="modal-body">
Der Testzeitraum Ihrer Digitalen Agentur ist abgelaufen. Bitte starten Sie ein Abo, da sonst der Zugang zu Ihrer Digitalen Agentur in wenigen Tagen gesperrt wird!
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary" data-dismiss="modal">Schliessen</button>
</div>
</div>
</div>
</div>
<script type="text/javascript">
$(document).ready(function(){
if(!localStorage.getItem("closetest")){
$("#noaccess").modal({
backdrop: 'static',
});
localStorage.setItem("closetest", true);
$("#noaccess").modal("show");
}
});
</script>
{% elif billstatus == 1 %}
<div class="modal fade show" tabindex="-1" role="dialog" data-backdrop="static" id="noaccess">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">Testphase abgelaufen</h5>
</div>
<div class="modal-body">
Der Testzeitraum Ihrer Digitalen Agentur ist abgelaufen. Bitte starten Sie ein Abo, da sonst der Zugang zu Ihrer Digitalen Agentur gesperrt wird!
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary" data-dismiss="modal">Schliessen</button>
</div>
</div>
</div>
</div>
<script type="text/javascript">
$(document).ready(function(){
if(!localStorage.getItem("closetest")){
$("#noaccess").modal({
backdrop: 'static',
});
localStorage.setItem("closetest", true);
$("#noaccess").modal("show");
}
});
</script>
{% elif billstatus == 11%}
{% if request.user|usergperm:"agencyinfo" %}
<div class="modal fade show" tabindex="-1" role="dialog" data-backdrop="static" id="noaccess">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">Offene Rechnungen</h5>
</div>
<div class="modal-body">
Ihre Agentur hat offene Rechnungen! Bitte begleichen Sie die Rechnungen innerhalb von maximal zwei Wochen.
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary" data-dismiss="modal">Schliessen</button>
</div>
</div>
</div>
</div>
<script type="text/javascript">
$(document).ready(function(){
if(!localStorage.getItem("closetest")){
$("#noaccess").modal({
backdrop: 'static',
});
localStorage.setItem("closetest", true);
$("#noaccess").modal("show");
}
});
</script>
{% endif %}
{% endif %} {% endif %}