Skip to main content

FONCTION CALCUL EFFECTIFS ETP


Bonjour,

Via une édition historique je dois récupérer mes ETP. J’ai créé une fonction calcul mais je ne parviens pas à la faire remonter dans mon édition. un idée du pb? Ma Stockvar qui remonte dans mon édition est “EffectifSSMois”

Begin

// Initialisation de l'effectif
Effectif = 0

// Exclure les types de contrat non comptabilisés
If SAL.S41.G01.00.012.001 In ("29", "88", "89", "90", "91", "92", "93", "94") Then
    Call StockeVar("EffectifSSMois", 0)
    Return
Endif

// Cas CDD court
If SAL.S41.G01.00.012.001 = "02" Then
    Duree = DiffDays(EMP.DTDEB, EMP.DTFIN) + 1
    If Duree <= 30 Then
        Call StockeVar("EffectifSSMois", 1 / 12)
        Return
    Endif
Endif

// Dates du mois
DateDebutMois = Date(1, BUL.MOIS, BUL.ANNEE)
DateFinMois = Date(DaysInMonth(BUL.MOIS, BUL.ANNEE), BUL.MOIS, BUL.ANNEE)

// Début réel
If EMP.DTDEB > DateDebutMois Then
    DDEB = EMP.DTDEB
Else
    DDEB = DateDebutMois
Endif

// Fin réelle
If EMP.DTFIN <> Date(1,1,1) And EMP.DTFIN < DateFinMois Then
    DFIN = EMP.DTFIN
Else
    DFIN = DateFinMois
Endif

// Jours de présence
Jours = DiffDays(DDEB, DFIN) + 1

// Si forfait jours
If BUL.S41.G01.00.013 = "10" Then
    Effectif = Jours / BUL.NBJMOIS
Else
    TP = BUL.NBHMCONTRAT / 151.67
    Effectif = (Jours / BUL.NBJMOIS) * TP
Endif

// Stockage pour édition
Call StockeVar("EffectifSSMois", Effectif)

End