From: Olivier Larchevêque Date: Mon, 18 Apr 2011 17:42:03 +0000 (-0400) Subject: comparaison salariale X-Git-Tag: DAE~173 X-Git-Url: http://git.auf.org/?p=auf_rh_dae.git;a=commitdiff_plain;h=7e43f9b68c315fe6ced7b9294d93b08e5f7c70f9 comparaison salariale --- diff --git a/project/dae/templates/dae/embauche-dossier.html b/project/dae/templates/dae/embauche-dossier.html index 9723eab..58d57b1 100644 --- a/project/dae/templates/dae/embauche-dossier.html +++ b/project/dae/templates/dae/embauche-dossier.html @@ -108,15 +108,6 @@
-

- Comparaison salariale - - dans la région pour les employés occupant un poste similaire - -

-
- -

Contrat

diff --git a/project/dae/templates/dae/embauche.html b/project/dae/templates/dae/embauche.html index 477b369..8ac26ff 100644 --- a/project/dae/templates/dae/embauche.html +++ b/project/dae/templates/dae/embauche.html @@ -119,6 +119,34 @@ value="{{ dossier.id }}" /> +
+

Comparaison salariale

+ dans la région pour les employés occupant un poste similaire +
+ + + + + + + + + + {% for d in comparaison_dossiers %} + + + + + + + + + {% endfor %} + +
EmployéPosteDate fin contratSalaireImplantationFamille Emploi
{{ d.employe }}{{ d.poste1.type_poste.nom }} {{ d.complement1 }}{{ d.contrat_date_fin|default:"en cours" }}{{ d.get_salaire_display }}{{ d.poste1.implantation }}{{ d.poste1.type_poste.famille_emploi.nom }}
+
+ +
{% comment %}Wrapper du formulaire de dossier{% endcomment %} {% with forms.dossier as form %} diff --git a/project/dae/views.py b/project/dae/views.py index 4ad6b3f..7367162 100644 --- a/project/dae/views.py +++ b/project/dae/views.py @@ -224,14 +224,32 @@ def embauche(request, key=None, dossier=None): justificationsNouveauForm = JustificationNouvelEmployeForm(instance=dossier) justificationsAutreForm = JustificationAutreEmployeForm(instance=dossier) + # Chargement des données de comparaison + comparaison_dossiers = [] + famille = poste.type_poste.famille_emploi + # postes DAE (vieux dossiers) + postes_region = dae.Poste.objects.filter(implantation__region=poste.implantation.region) + for p in postes_region: + dossiers = p.get_dossiers() + if len(dossiers) > 0 and dossiers[0].poste1.type_poste.famille_emploi == famille: + comparaison_dossiers.append(dossiers[0]) + # poste RHv1 (vieux dossiers) + postes_region = rh.Poste.objects.filter(implantation__region=poste.implantation.region) + for p in postes_region: + dossiers = p.poste1.all().order_by('rh_v1_dossier.date_creation') # through key incohérente... (dossiers) + if len(dossiers) > 0 and dossiers[0].poste1.type_poste.famille_emploi == famille: + comparaison_dossiers.append(dossiers[0]) + vars = dict(step='employe', poste=poste, dossier=dossier, piecesForm=piecesForm, justificationsNouveauForm=justificationsNouveauForm, justificationsAutreForm=justificationsAutreForm, + comparaison_dossiers=comparaison_dossiers, forms=dict(employe=employe_form, dossier=dossier_form, ) ) + return render_to_response('dae/embauche.html', vars, RequestContext(request)) diff --git a/project/rh_v1/models.py b/project/rh_v1/models.py index 024ee82..0816247 100644 --- a/project/rh_v1/models.py +++ b/project/rh_v1/models.py @@ -111,6 +111,22 @@ class Dossier(models.Model): def __unicode__(self): return u'%s : %s %s' % (self.employe, self.poste1, self.complement1) + def get_salaire_display(self): + """ + Moyen rapide de récupérer le salaire correspodant à un dossier. Par contre, + toutes les rémuérations n'ont pas de devise associées, c'est pourquoi on récupère + les anciennes rémunérations pour rechercher si elle existait auparavant. + """ + remun = self.remuneration_set.all() + devise = None + for r in remun: + try: + if r.devise_id is not None: + devise = Devise.objects.get(id=r.devise_id).code + except: + pass + return "%s %s" % (remun[0].montant, devise) + LIEN_PARENTE_CHOICES = ( ('Conjoint', 'Conjoint'), ('Conjointe', 'Conjointe'), @@ -151,6 +167,13 @@ class Remuneration(models.Model): date_annulation = models.DateField(null=True, blank=True) user_annulation = models.IntegerField(null=True, blank=True) #User ou employé + def __unicode__(self): + try: + devise = self.devise.code + except: + devise = "???" + return "%s %s" % (self.montant, devise) + class FamilleEmploi(models.Model): #Identification id = models.IntegerField(primary_key=True)