Commit 6d18258f authored by Antony Le Courtes's avatar Antony Le Courtes
Browse files

Optimisation pour les imputations budgétaires

parent f29d5493
Loading
Loading
Loading
Loading
+2 −10
Changes for data/ddl/view/V_IMPUTATION_BUDGETAIRE_SIHAM.sql: 2 added lines, 10 removed lines.
Original line number Diff line number Diff line
@@ -12,18 +12,10 @@ SELECT
	fonds,
	poste_reservation_credit,
	--On impact le potentiel écart de pourcentage détecté pour s'assurer que la somme des pourcentages fasse 100%
 	to_char((CASE
                WHEN pourc_ecart >= 0 THEN
                    CASE
                        WHEN rank() OVER (PARTITION BY periode_id, intervenant_id   ORDER BY operation,centre_cout, pourcentage) = 1
                        THEN pourcentage - pourc_ecart
                        ELSE pourcentage END
                ELSE
 	CASE
	    WHEN rank() OVER (PARTITION BY periode_id, intervenant_id   ORDER BY operation,centre_cout, pourcentage) = 1
	    THEN pourcentage + pourc_ecart
                        ELSE pourcentage END
       END))	pourcentage,
	    ELSE pourcentage END    	                                                                                          pourcentage,
     nombres_heures,
     flmodi,
     numord,
@@ -52,7 +44,7 @@ FROM (
	       NULL                                                                               										fonds,
	       NULL                                                                               										poste_reservation_credit,
	       CASE WHEN montant_hetd > 0
	       	    THEN ROUND(montant_hetd / SUM(montant_hetd) OVER( PARTITION BY periode_id,intervenant_id),2)*100
	       	    THEN ROUND(montant_hetd / SUM(montant_hetd) OVER( PARTITION BY periode_id,intervenant_id)*100,2)
	       	    ELSE 0  END																											pourcentage,
	       CASE WHEN hetd >= 100 THEN FLOOR(hetd) || ':' || lpad(FLOOR((hetd - FLOOR(hetd)) * 60), 2, 0)
	       ELSE (lpad(FLOOR(hetd), 2, '0')) || ':' || lpad(FLOOR((hetd - FLOOR(hetd)) * 60), 2, 0) END         						nombres_heures,
+3 −11
Changes for data/ddl/view/V_IMPUTATION_BUDGETAIRE_SIHAM_ETUDIANT.sql: 3 added lines, 11 removed lines.
Original line number Diff line number Diff line
@@ -26,18 +26,10 @@ SELECT
	fonds,
	poste_reservation_credit,
	--On impact le potentiel écart de pourcentage détecté pour s'assurer que la somme des pourcentages fasse 100%
 	to_char((CASE
                WHEN pourc_ecart >= 0 THEN
                    CASE
                        WHEN rank() OVER (PARTITION BY periode_id, intervenant_id   ORDER BY operation,centre_cout, pourcentage) = 1
                        THEN pourcentage - pourc_ecart
                        ELSE pourcentage END
                ELSE
    CASE
        WHEN rank() OVER (PARTITION BY periode_id, intervenant_id   ORDER BY operation,centre_cout, pourcentage) = 1
        THEN pourcentage + pourc_ecart
                        ELSE pourcentage END
       END))	pourcentage,
        ELSE pourcentage END                                                                                        pourcentage,
     nombres_heures,
     flmodi,
     numord,
@@ -66,7 +58,7 @@ FROM (
	       NULL                                                                               										fonds,
	       NULL                                                                               										poste_reservation_credit,
	       CASE WHEN montant_hetd > 0
	       	    THEN ROUND(montant_hetd / SUM(montant_hetd) OVER( PARTITION BY periode_id,intervenant_id),2)*100
	       	    THEN ROUND(montant_hetd / SUM(montant_hetd) OVER( PARTITION BY periode_id,intervenant_id)*100,2)
	       	    ELSE 0  END																											pourcentage,
	       CASE WHEN hetd >= 100 THEN FLOOR(hetd) || ':' || lpad(FLOOR((hetd - FLOOR(hetd)) * 60), 2, 0)
	       ELSE (lpad(FLOOR(hetd), 2, '0')) || ':' || lpad(FLOOR((hetd - FLOOR(hetd)) * 60), 2, 0) END         						nombres_heures,
@@ -146,7 +138,7 @@ SELECT
	null 																					      destination,
	null 																						  fonds,
	null 																					      poste_reservation_credit,
	'100'																						  pourcentage,
	100																						  pourcentage,
	null 																						  nombres_heures,
    null 																						  flmodi,
    null 																						  numord,