Skip to content
Snippets Groups Projects
Commit e1e937be authored by Laurent Lecluse's avatar Laurent Lecluse
Browse files

Répartition AA/AC : nouveau paramètre prorata/MEP PAPS

parent 9ffd67dd
No related branches found
No related tags found
No related merge requests found
...@@ -64,7 +64,7 @@ CREATE OR REPLACE PACKAGE BODY "OSE_DIVERS" AS ...@@ -64,7 +64,7 @@ CREATE OR REPLACE PACKAGE BODY "OSE_DIVERS" AS
RETURN 1; RETURN 1;
END IF; END IF;
RETURN ROUND(nbjaa / (nbjaa + nbjac), 2); RETURN nbjaa / (nbjaa + nbjac);
END IF; END IF;
END IF; END IF;
...@@ -74,6 +74,21 @@ CREATE OR REPLACE PACKAGE BODY "OSE_DIVERS" AS ...@@ -74,6 +74,21 @@ CREATE OR REPLACE PACKAGE BODY "OSE_DIVERS" AS
FUNCTION CALC_HEURES_AA(heures FLOAT, pourc_exercice_aa FLOAT, total_heures FLOAT, cumul_heures FLOAT) RETURN FLOAT IS
BEGIN
IF cumul_heures <= total_heures * pourc_exercice_aa THEN
RETURN heures;
END IF;
IF total_heures * pourc_exercice_aa - cumul_heures + heures > 0 THEN
RETURN total_heures * pourc_exercice_aa - cumul_heures + heures;
END IF;
RETURN 0;
END;
PROCEDURE CALCULER_TABLEAUX_BORD IS PROCEDURE CALCULER_TABLEAUX_BORD IS
BEGIN BEGIN
FOR d IN ( FOR d IN (
......
CREATE OR REPLACE PACKAGE "OSE_DIVERS" AS CREATE OR REPLACE PACKAGE "OSE_DIVERS" AS
FUNCTION CALC_POURC_AA( periode_id NUMERIC, horaire_debut DATE, horaire_fin DATE, annee_id NUMERIC ) RETURN FLOAT; FUNCTION CALC_POURC_AA( periode_id NUMERIC, horaire_debut DATE, horaire_fin DATE, annee_id NUMERIC ) RETURN FLOAT;
FUNCTION CALC_HEURES_AA(heures FLOAT, pourc_exercice_aa FLOAT, total_heures FLOAT, cumul_heures FLOAT) RETURN FLOAT;
PROCEDURE CALCULER_TABLEAUX_BORD; PROCEDURE CALCULER_TABLEAUX_BORD;
PROCEDURE CALCUL_FEUILLE_DE_ROUTE( INTERVENANT_ID NUMERIC ); PROCEDURE CALCUL_FEUILLE_DE_ROUTE( INTERVENANT_ID NUMERIC );
......
...@@ -1172,27 +1172,57 @@ CREATE OR REPLACE PACKAGE BODY "UNICAEN_TBL" AS ...@@ -1172,27 +1172,57 @@ CREATE OR REPLACE PACKAGE BODY "UNICAEN_TBL" AS
viewQuery CLOB; viewQuery CLOB;
BEGIN BEGIN
viewQuery := 'SELECT viewQuery := 'SELECT
annee_id,
service_id,
service_referentiel_id,
formule_res_service_id,
formule_res_service_ref_id,
intervenant_id,
structure_id,
mise_en_paiement_id,
periode_paiement_id,
domaine_fonctionnel_id,
heures_a_payer,
heures_a_payer_pond,
heures_demandees,
heures_payees,
ROUND(pourc_exercice_aa,2) pourc_exercice_aa,
1 - ROUND(pourc_exercice_aa,2) pourc_exercice_ac,
ROUND(heures_aa,2) heures_aa,
heures_demandees - ROUND(heures_aa,2) heures_ac
FROM
(
SELECT
i.annee_id annee_id, i.annee_id annee_id,
frs.service_id service_id, frs.service_id service_id,
null service_referentiel_id, NULL service_referentiel_id,
frs.id formule_res_service_id, frs.id formule_res_service_id,
null formule_res_service_ref_id, NULL formule_res_service_ref_id,
i.id intervenant_id, i.id intervenant_id,
COALESCE( ep.structure_id, i.structure_id ) structure_id, COALESCE( ep.structure_id, i.structure_id ) structure_id,
mep.id mise_en_paiement_id, mep.id mise_en_paiement_id,
mep.periode_paiement_id periode_paiement_id, mep.periode_paiement_id periode_paiement_id,
COALESCE(mep.domaine_fonctionnel_id, e.domaine_fonctionnel_id, to_number(p.valeur)) domaine_fonctionnel_id, COALESCE(mep.domaine_fonctionnel_id, e.domaine_fonctionnel_id, to_number(p.valeur)) domaine_fonctionnel_id,
frs.heures_compl_fi + frs.heures_compl_fc + frs.heures_compl_fa + frs.heures_compl_fc_majorees heures_a_payer, frs.heures_compl_fi + frs.heures_compl_fc + frs.heures_compl_fa + frs.heures_compl_fc_majorees heures_a_payer,
count(*) OVER(PARTITION BY frs.id) heures_a_payer_pond, COUNT(*) OVER(PARTITION BY frs.id) heures_a_payer_pond,
NVL(mep.heures,0) heures_demandees, COALESCE(mep.heures,0) heures_demandees,
CASE WHEN mep.periode_paiement_id IS NULL THEN 0 ELSE mep.heures END heures_payees, CASE WHEN mep.periode_paiement_id IS NULL THEN 0 ELSE mep.heures END heures_payees,
pea.pourc_exercice_aa pourc_exercice_aa, pea.pourc_exercice_aa pourc_exercice_aa,
1 - pea.pourc_exercice_aa pourc_exercice_ac SUM(COALESCE(mep.heures,0)) OVER (partition BY frs.id) total_heures,
SUM(COALESCE(mep.heures,0)) OVER (partition BY frs.id) * pea.pourc_exercice_aa total_heures_aa,
SUM(COALESCE(mep.heures,0)) OVER (partition BY frs.id ORDER BY mep.id) cumul_heures,
CASE WHEN p2.valeur = ''prorata'' THEN mep.heures * pea.pourc_exercice_aa ELSE ose_divers.CALC_HEURES_AA(
COALESCE(mep.heures,0), -- heures
pea.pourc_exercice_aa, -- pourc_exercice_aa
SUM(COALESCE(mep.heures,0)) OVER (partition BY frs.id), -- total_heures
SUM(COALESCE(mep.heures,0)) OVER (partition BY frs.id ORDER BY mep.id) -- cumul_heures
) END heures_aa
FROM FROM
formule_resultat_service frs formule_resultat_service frs
JOIN type_volume_horaire tvh ON tvh.code = ''REALISE'' JOIN type_volume_horaire tvh ON tvh.code = ''REALISE''
JOIN etat_volume_horaire evh ON evh.code = ''valide'' JOIN etat_volume_horaire evh ON evh.code = ''valide''
JOIN parametre p ON p.nom = ''domaine_fonctionnel_ens_ext'' JOIN parametre p ON p.nom = ''domaine_fonctionnel_ens_ext''
JOIN parametre p2 ON p2.nom = ''regle_repartition_annee_civile''
JOIN formule_resultat fr ON fr.id = frs.formule_resultat_id JOIN formule_resultat fr ON fr.id = frs.formule_resultat_id
AND fr.type_volume_horaire_id = tvh.id AND fr.type_volume_horaire_id = tvh.id
AND fr.etat_volume_horaire_id = evh.id AND fr.etat_volume_horaire_id = evh.id
...@@ -1226,9 +1256,9 @@ CREATE OR REPLACE PACKAGE BODY "UNICAEN_TBL" AS ...@@ -1226,9 +1256,9 @@ CREATE OR REPLACE PACKAGE BODY "UNICAEN_TBL" AS
SELECT SELECT
i.annee_id annee_id, i.annee_id annee_id,
null service_id, NULL service_id,
frs.service_referentiel_id service_referentiel_id, frs.service_referentiel_id service_referentiel_id,
null formule_res_service_id, NULL formule_res_service_id,
frs.id formule_res_service_ref_id, frs.id formule_res_service_ref_id,
i.id intervenant_id, i.id intervenant_id,
sr.structure_id structure_id, sr.structure_id structure_id,
...@@ -1236,15 +1266,24 @@ CREATE OR REPLACE PACKAGE BODY "UNICAEN_TBL" AS ...@@ -1236,15 +1266,24 @@ CREATE OR REPLACE PACKAGE BODY "UNICAEN_TBL" AS
mep.periode_paiement_id periode_paiement_id, mep.periode_paiement_id periode_paiement_id,
COALESCE(mep.domaine_fonctionnel_id, fncr.domaine_fonctionnel_id) domaine_fonctionnel_id, COALESCE(mep.domaine_fonctionnel_id, fncr.domaine_fonctionnel_id) domaine_fonctionnel_id,
frs.heures_compl_referentiel heures_a_payer, frs.heures_compl_referentiel heures_a_payer,
count(*) OVER(PARTITION BY frs.id) heures_a_payer_pond, COUNT(*) OVER(PARTITION BY frs.id) heures_a_payer_pond,
NVL(mep.heures,0) heures_demandees, COALESCE(mep.heures,0) heures_demandees,
CASE WHEN mep.periode_paiement_id IS NULL THEN 0 ELSE mep.heures END heures_payees, CASE WHEN mep.periode_paiement_id IS NULL THEN 0 ELSE mep.heures END heures_payees,
pea.pourc_exercice_aa pourc_exercice_aa, pea.pourc_exercice_aa pourc_exercice_aa,
1 - pea.pourc_exercice_aa pourc_exercice_ac SUM(COALESCE(mep.heures,0)) OVER (partition BY frs.id) total_heures,
SUM(COALESCE(mep.heures,0)) OVER (partition BY frs.id) * pea.pourc_exercice_aa total_heures_aa,
SUM(COALESCE(mep.heures,0)) OVER (partition BY frs.id ORDER BY mep.id) cumul_heures,
CASE WHEN p2.valeur = ''prorata'' THEN mep.heures * pea.pourc_exercice_aa ELSE ose_divers.CALC_HEURES_AA(
COALESCE(mep.heures,0), -- heures
pea.pourc_exercice_aa, -- pourc_exercice_aa
SUM(COALESCE(mep.heures,0)) OVER (partition BY frs.id), -- total_heures
SUM(COALESCE(mep.heures,0)) OVER (partition BY frs.id ORDER BY mep.id) -- cumul_heures
) END heures_aa
FROM FROM
formule_resultat_service_ref frs formule_resultat_service_ref frs
JOIN type_volume_horaire tvh ON tvh.code = ''REALISE'' JOIN type_volume_horaire tvh ON tvh.code = ''REALISE''
JOIN etat_volume_horaire evh ON evh.code = ''valide'' JOIN etat_volume_horaire evh ON evh.code = ''valide''
JOIN parametre p2 ON p2.nom = ''regle_repartition_annee_civile''
JOIN formule_resultat fr ON fr.id = frs.formule_resultat_id JOIN formule_resultat fr ON fr.id = frs.formule_resultat_id
AND fr.type_volume_horaire_id = tvh.id AND fr.type_volume_horaire_id = tvh.id
AND fr.etat_volume_horaire_id = evh.id AND fr.etat_volume_horaire_id = evh.id
...@@ -1271,7 +1310,8 @@ CREATE OR REPLACE PACKAGE BODY "UNICAEN_TBL" AS ...@@ -1271,7 +1310,8 @@ CREATE OR REPLACE PACKAGE BODY "UNICAEN_TBL" AS
) pea ON pea.formule_resultat_id = fr.id AND pea.service_referentiel_id = sr.id ) pea ON pea.formule_resultat_id = fr.id AND pea.service_referentiel_id = sr.id
JOIN fonction_referentiel fncr ON fncr.id = sr.fonction_id JOIN fonction_referentiel fncr ON fncr.id = sr.fonction_id
LEFT JOIN mise_en_paiement mep ON mep.formule_res_service_ref_id = frs.id LEFT JOIN mise_en_paiement mep ON mep.formule_res_service_ref_id = frs.id
AND mep.histo_destruction IS NULL'; AND mep.histo_destruction IS NULL
) t';
IF param IS NULL THEN IF param IS NULL THEN
filter := '1=1'; filter := '1=1';
...@@ -1300,6 +1340,8 @@ CREATE OR REPLACE PACKAGE BODY "UNICAEN_TBL" AS ...@@ -1300,6 +1340,8 @@ CREATE OR REPLACE PACKAGE BODY "UNICAEN_TBL" AS
AND t.HEURES_PAYEES = v.HEURES_PAYEES AND t.HEURES_PAYEES = v.HEURES_PAYEES
AND t.POURC_EXERCICE_AA = v.POURC_EXERCICE_AA AND t.POURC_EXERCICE_AA = v.POURC_EXERCICE_AA
AND t.POURC_EXERCICE_AC = v.POURC_EXERCICE_AC AND t.POURC_EXERCICE_AC = v.POURC_EXERCICE_AC
AND t.HEURES_AA = v.HEURES_AA
AND t.HEURES_AC = v.HEURES_AC
THEN -1 ELSE t.ID END ID, THEN -1 ELSE t.ID END ID,
v.ANNEE_ID, v.ANNEE_ID,
v.SERVICE_ID, v.SERVICE_ID,
...@@ -1316,7 +1358,9 @@ CREATE OR REPLACE PACKAGE BODY "UNICAEN_TBL" AS ...@@ -1316,7 +1358,9 @@ CREATE OR REPLACE PACKAGE BODY "UNICAEN_TBL" AS
v.HEURES_DEMANDEES, v.HEURES_DEMANDEES,
v.HEURES_PAYEES, v.HEURES_PAYEES,
v.POURC_EXERCICE_AA, v.POURC_EXERCICE_AA,
v.POURC_EXERCICE_AC v.POURC_EXERCICE_AC,
v.HEURES_AA,
v.HEURES_AC
FROM FROM
(' || QUERY_APPLY_PARAM(viewQuery,param,value) || ') v (' || QUERY_APPLY_PARAM(viewQuery,param,value) || ') v
FULL JOIN TBL_PAIEMENT t ON FULL JOIN TBL_PAIEMENT t ON
......
...@@ -57,6 +57,30 @@ return [ ...@@ -57,6 +57,30 @@ return [
'position' => 6, 'position' => 6,
'commentaire' => NULL, 'commentaire' => NULL,
], ],
'HEURES_AA' => [
'name' => 'HEURES_AA',
'type' => 'float',
'bdd-type' => 'FLOAT',
'length' => 0,
'scale' => NULL,
'precision' => 126,
'nullable' => FALSE,
'default' => '0',
'position' => 18,
'commentaire' => NULL,
],
'HEURES_AC' => [
'name' => 'HEURES_AC',
'type' => 'float',
'bdd-type' => 'FLOAT',
'length' => 0,
'scale' => NULL,
'precision' => 126,
'nullable' => FALSE,
'default' => '0',
'position' => 19,
'commentaire' => NULL,
],
'HEURES_A_PAYER' => [ 'HEURES_A_PAYER' => [
'name' => 'HEURES_A_PAYER', 'name' => 'HEURES_A_PAYER',
'type' => 'float', 'type' => 'float',
......
...@@ -106,8 +106,8 @@ SELECT ...@@ -106,8 +106,8 @@ SELECT
df.libelle domaine_fonctionnel_libelle, df.libelle domaine_fonctionnel_libelle,
CASE WHEN th.code = 'fc_majorees' THEN 0 ELSE mep.heures END hetd, CASE WHEN th.code = 'fc_majorees' THEN 0 ELSE mep.heures END hetd,
CASE WHEN th.code = 'fc_majorees' THEN mep.heures ELSE 0 END fc_majorees, CASE WHEN th.code = 'fc_majorees' THEN mep.heures ELSE 0 END fc_majorees,
mep.heures * mis.pourc_exercice_aa exercice_aa, mis.heures_aa exercice_aa,
mep.heures * mis.pourc_exercice_ac exercice_ac, mis.heures_ac exercice_ac,
--CASE WHEN th.code = 'fc_majorees' THEN 0 ELSE mep.heures END * 4 / 10 exercice_aa, --CASE WHEN th.code = 'fc_majorees' THEN 0 ELSE mep.heures END * 4 / 10 exercice_aa,
--CASE WHEN th.code = 'fc_majorees' THEN 0 ELSE mep.heures END * 6 / 10 exercice_ac, --CASE WHEN th.code = 'fc_majorees' THEN 0 ELSE mep.heures END * 6 / 10 exercice_ac,
OSE_FORMULE.GET_TAUX_HORAIRE_HETD( NVL(mep.date_mise_en_paiement,SYSDATE) ) taux_horaire OSE_FORMULE.GET_TAUX_HORAIRE_HETD( NVL(mep.date_mise_en_paiement,SYSDATE) ) taux_horaire
......
...@@ -55,8 +55,8 @@ FROM ( ...@@ -55,8 +55,8 @@ FROM (
mep.heures, mep.heures,
cc.unite_budgetaire, cc.unite_budgetaire,
mep.date_mise_en_paiement, mep.date_mise_en_paiement,
mis.pourc_exercice_aa, mis.heures_aa,
mis.pourc_exercice_ac mis.heures_ac
FROM FROM
tbl_paiement mis tbl_paiement mis
JOIN mise_en_paiement mep ON mep.id = mis.mise_en_paiement_id AND mep.histo_destruction IS NULL JOIN mise_en_paiement mep ON mep.id = mis.mise_en_paiement_id AND mep.histo_destruction IS NULL
...@@ -73,13 +73,13 @@ FROM ( ...@@ -73,13 +73,13 @@ FROM (
mep.periode_paiement_id, mep.periode_paiement_id,
mep.intervenant_id, mep.intervenant_id,
2 code_origine, 2 code_origine,
mep.heures * mep.pourc_exercice_aa nbu, mep.heures_aa nbu,
mep.unite_budgetaire, mep.unite_budgetaire,
mep.date_mise_en_paiement mep.date_mise_en_paiement
FROM FROM
mep mep
WHERE WHERE
mep.heures * mep.pourc_exercice_aa > 0 mep.heures_aa > 0
UNION ALL UNION ALL
...@@ -89,13 +89,13 @@ FROM ( ...@@ -89,13 +89,13 @@ FROM (
mep.periode_paiement_id, mep.periode_paiement_id,
mep.intervenant_id, mep.intervenant_id,
1 code_origine, 1 code_origine,
mep.heures * mep.pourc_exercice_ac nbu, mep.heures_ac nbu,
mep.unite_budgetaire, mep.unite_budgetaire,
mep.date_mise_en_paiement mep.date_mise_en_paiement
FROM FROM
mep mep
WHERE WHERE
mep.heures * mep.pourc_exercice_ac > 0 mep.heures_ac > 0
) t1 ) t1
GROUP BY GROUP BY
structure_id, structure_id,
......
CREATE OR REPLACE FORCE VIEW V_TBL_PAIEMENT AS CREATE OR REPLACE FORCE VIEW V_TBL_PAIEMENT AS
SELECT
annee_id,
service_id,
service_referentiel_id,
formule_res_service_id,
formule_res_service_ref_id,
intervenant_id,
structure_id,
mise_en_paiement_id,
periode_paiement_id,
domaine_fonctionnel_id,
heures_a_payer,
heures_a_payer_pond,
heures_demandees,
heures_payees,
ROUND(pourc_exercice_aa,2) pourc_exercice_aa,
1 - ROUND(pourc_exercice_aa,2) pourc_exercice_ac,
ROUND(heures_aa,2) heures_aa,
heures_demandees - ROUND(heures_aa,2) heures_ac
FROM
(
SELECT SELECT
i.annee_id annee_id, i.annee_id annee_id,
frs.service_id service_id, frs.service_id service_id,
null service_referentiel_id, NULL service_referentiel_id,
frs.id formule_res_service_id, frs.id formule_res_service_id,
null formule_res_service_ref_id, NULL formule_res_service_ref_id,
i.id intervenant_id, i.id intervenant_id,
COALESCE( ep.structure_id, i.structure_id ) structure_id, COALESCE( ep.structure_id, i.structure_id ) structure_id,
mep.id mise_en_paiement_id, mep.id mise_en_paiement_id,
mep.periode_paiement_id periode_paiement_id, mep.periode_paiement_id periode_paiement_id,
COALESCE(mep.domaine_fonctionnel_id, e.domaine_fonctionnel_id, to_number(p.valeur)) domaine_fonctionnel_id, COALESCE(mep.domaine_fonctionnel_id, e.domaine_fonctionnel_id, to_number(p.valeur)) domaine_fonctionnel_id,
frs.heures_compl_fi + frs.heures_compl_fc + frs.heures_compl_fa + frs.heures_compl_fc_majorees heures_a_payer, frs.heures_compl_fi + frs.heures_compl_fc + frs.heures_compl_fa + frs.heures_compl_fc_majorees heures_a_payer,
count(*) OVER(PARTITION BY frs.id) heures_a_payer_pond, COUNT(*) OVER(PARTITION BY frs.id) heures_a_payer_pond,
NVL(mep.heures,0) heures_demandees, COALESCE(mep.heures,0) heures_demandees,
CASE WHEN mep.periode_paiement_id IS NULL THEN 0 ELSE mep.heures END heures_payees, CASE WHEN mep.periode_paiement_id IS NULL THEN 0 ELSE mep.heures END heures_payees,
pea.pourc_exercice_aa pourc_exercice_aa, pea.pourc_exercice_aa pourc_exercice_aa,
1 - pea.pourc_exercice_aa pourc_exercice_ac SUM(COALESCE(mep.heures,0)) OVER (partition BY frs.id) total_heures,
SUM(COALESCE(mep.heures,0)) OVER (partition BY frs.id) * pea.pourc_exercice_aa total_heures_aa,
SUM(COALESCE(mep.heures,0)) OVER (partition BY frs.id ORDER BY mep.id) cumul_heures,
CASE WHEN p2.valeur = 'prorata' THEN COALESCE(mep.heures,0) * pea.pourc_exercice_aa ELSE ose_divers.CALC_HEURES_AA(
COALESCE(mep.heures,0), -- heures
pea.pourc_exercice_aa, -- pourc_exercice_aa
SUM(COALESCE(mep.heures,0)) OVER (partition BY frs.id), -- total_heures
SUM(COALESCE(mep.heures,0)) OVER (partition BY frs.id ORDER BY mep.id) -- cumul_heures
) END heures_aa
FROM FROM
formule_resultat_service frs formule_resultat_service frs
JOIN type_volume_horaire tvh ON tvh.code = 'REALISE' JOIN type_volume_horaire tvh ON tvh.code = 'REALISE'
JOIN etat_volume_horaire evh ON evh.code = 'valide' JOIN etat_volume_horaire evh ON evh.code = 'valide'
JOIN parametre p ON p.nom = 'domaine_fonctionnel_ens_ext' JOIN parametre p ON p.nom = 'domaine_fonctionnel_ens_ext'
JOIN parametre p2 ON p2.nom = 'regle_repartition_annee_civile'
JOIN formule_resultat fr ON fr.id = frs.formule_resultat_id JOIN formule_resultat fr ON fr.id = frs.formule_resultat_id
AND fr.type_volume_horaire_id = tvh.id AND fr.type_volume_horaire_id = tvh.id
AND fr.etat_volume_horaire_id = evh.id AND fr.etat_volume_horaire_id = evh.id
...@@ -54,9 +84,9 @@ UNION ALL ...@@ -54,9 +84,9 @@ UNION ALL
SELECT SELECT
i.annee_id annee_id, i.annee_id annee_id,
null service_id, NULL service_id,
frs.service_referentiel_id service_referentiel_id, frs.service_referentiel_id service_referentiel_id,
null formule_res_service_id, NULL formule_res_service_id,
frs.id formule_res_service_ref_id, frs.id formule_res_service_ref_id,
i.id intervenant_id, i.id intervenant_id,
sr.structure_id structure_id, sr.structure_id structure_id,
...@@ -64,15 +94,24 @@ SELECT ...@@ -64,15 +94,24 @@ SELECT
mep.periode_paiement_id periode_paiement_id, mep.periode_paiement_id periode_paiement_id,
COALESCE(mep.domaine_fonctionnel_id, fncr.domaine_fonctionnel_id) domaine_fonctionnel_id, COALESCE(mep.domaine_fonctionnel_id, fncr.domaine_fonctionnel_id) domaine_fonctionnel_id,
frs.heures_compl_referentiel heures_a_payer, frs.heures_compl_referentiel heures_a_payer,
count(*) OVER(PARTITION BY frs.id) heures_a_payer_pond, COUNT(*) OVER(PARTITION BY frs.id) heures_a_payer_pond,
NVL(mep.heures,0) heures_demandees, COALESCE(mep.heures,0) heures_demandees,
CASE WHEN mep.periode_paiement_id IS NULL THEN 0 ELSE mep.heures END heures_payees, CASE WHEN mep.periode_paiement_id IS NULL THEN 0 ELSE mep.heures END heures_payees,
pea.pourc_exercice_aa pourc_exercice_aa, pea.pourc_exercice_aa pourc_exercice_aa,
1 - pea.pourc_exercice_aa pourc_exercice_ac SUM(COALESCE(mep.heures,0)) OVER (partition BY frs.id) total_heures,
SUM(COALESCE(mep.heures,0)) OVER (partition BY frs.id) * pea.pourc_exercice_aa total_heures_aa,
SUM(COALESCE(mep.heures,0)) OVER (partition BY frs.id ORDER BY mep.id) cumul_heures,
CASE WHEN p2.valeur = 'prorata' THEN COALESCE(mep.heures,0) * pea.pourc_exercice_aa ELSE ose_divers.CALC_HEURES_AA(
COALESCE(mep.heures,0), -- heures
pea.pourc_exercice_aa, -- pourc_exercice_aa
SUM(COALESCE(mep.heures,0)) OVER (partition BY frs.id), -- total_heures
SUM(COALESCE(mep.heures,0)) OVER (partition BY frs.id ORDER BY mep.id) -- cumul_heures
) END heures_aa
FROM FROM
formule_resultat_service_ref frs formule_resultat_service_ref frs
JOIN type_volume_horaire tvh ON tvh.code = 'REALISE' JOIN type_volume_horaire tvh ON tvh.code = 'REALISE'
JOIN etat_volume_horaire evh ON evh.code = 'valide' JOIN etat_volume_horaire evh ON evh.code = 'valide'
JOIN parametre p2 ON p2.nom = 'regle_repartition_annee_civile'
JOIN formule_resultat fr ON fr.id = frs.formule_resultat_id JOIN formule_resultat fr ON fr.id = frs.formule_resultat_id
AND fr.type_volume_horaire_id = tvh.id AND fr.type_volume_horaire_id = tvh.id
AND fr.etat_volume_horaire_id = evh.id AND fr.etat_volume_horaire_id = evh.id
...@@ -100,3 +139,4 @@ FROM ...@@ -100,3 +139,4 @@ FROM
JOIN fonction_referentiel fncr ON fncr.id = sr.fonction_id JOIN fonction_referentiel fncr ON fncr.id = sr.fonction_id
LEFT JOIN mise_en_paiement mep ON mep.formule_res_service_ref_id = frs.id LEFT JOIN mise_en_paiement mep ON mep.formule_res_service_ref_id = frs.id
AND mep.histo_destruction IS NULL AND mep.histo_destruction IS NULL
) t
\ No newline at end of file
...@@ -1420,6 +1420,8 @@ return [ ...@@ -1420,6 +1420,8 @@ return [
'HEURES_PAYEES', 'HEURES_PAYEES',
'POURC_EXERCICE_AA', 'POURC_EXERCICE_AA',
'POURC_EXERCICE_AC', 'POURC_EXERCICE_AC',
'HEURES_AA',
'HEURES_AC',
], ],
'TBL_PIECE_JOINTE' => [ 'TBL_PIECE_JOINTE' => [
'ID', 'ID',
......
...@@ -96,6 +96,10 @@ return [ ...@@ -96,6 +96,10 @@ return [
"VALEUR" => "4-6sur10", "VALEUR" => "4-6sur10",
"DESCRIPTION" => "Règle de répartition années civiles antérieure / en cours pour les paiements", "DESCRIPTION" => "Règle de répartition années civiles antérieure / en cours pour les paiements",
], ],
"regle_repartition_annee_civile" => [
"VALEUR" => "prorata",
"DESCRIPTION" => "Ventilation des heures AA/AC",
],
"pourc_s1_pour_annee_civile" => [ "pourc_s1_pour_annee_civile" => [
"VALEUR" => "0.67", "VALEUR" => "0.67",
"DESCRIPTION" => "Taux de répartition en année civile pour les heures du premire semestre", "DESCRIPTION" => "Taux de répartition en année civile pour les heures du premire semestre",
......
...@@ -192,6 +192,22 @@ class ParametresForm extends AbstractForm ...@@ -192,6 +192,22 @@ class ParametresForm extends AbstractForm
], ],
]); ]);
$this->add([
'type' => 'Select',
'name' => 'regle_repartition_annee_civile',
'options' => [
'label' => 'Répartition des heures AC/AA dans les mises en paiement',
'value_options' => [
'prorata' => 'Chaque mise en paiement est répartie selon le prorata AA/AC',
'ordre-saisie' => 'Les premières mises en paiement sont considérées en AA, puis ce qui dépasse est en AC',
],
],
'attributes' => [
'class' => 'selectpicker',
'data-size' => 20,
],
]);
$this->add([ $this->add([
'name' => 'pourc_s1_pour_annee_civile', 'name' => 'pourc_s1_pour_annee_civile',
'options' => [ 'options' => [
......
...@@ -174,6 +174,11 @@ ...@@ -174,6 +174,11 @@
<div class="col-md-6"> <div class="col-md-6">
<?= $this->formControlGroup($form->get('regle_paiement_annee_civile')); ?> <?= $this->formControlGroup($form->get('regle_paiement_annee_civile')); ?>
</div> </div>
<div class="col-md-6">
<?= $this->formControlGroup($form->get('regle_repartition_annee_civile')); ?>
</div>
</div>
<div class="row">
<div class="col-md-6"> <div class="col-md-6">
<?= $this->formControlGroup($form->get('pourc_s1_pour_annee_civile')); ?> <?= $this->formControlGroup($form->get('pourc_s1_pour_annee_civile')); ?>
</div> </div>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment