Commit d3591f1f authored by Laurent Lecluse's avatar Laurent Lecluse
Browse files

Affichage des taux dans les tableaux de mise en paiement

On masque mes MAJFc si on a aucun résultat
parent 842aa6d4
Loading
Loading
Loading
Loading
+40 −33
Changes for data/ddl/view/V_ETAT_PAIEMENT.sql: 40 added lines, 33 removed lines.
Original line number Diff line number Diff line
@@ -34,7 +34,9 @@ SELECT
  exercice_aa,
  exercice_aa_montant,
  exercice_ac,
  exercice_ac_montant
  exercice_ac_montant,
  taux_remu,
  taux_horaire
FROM
  (
  SELECT
@@ -72,9 +74,40 @@ FROM
      exercice_ac,
      ROUND( exercice_ac * taux_horaire, 2 ) exercice_ac_montant,
      (CASE WHEN hetd > 0 THEN hetd / SUM( hetd ) OVER( PARTITION BY periode_id, intervenant_id, etat, structure_id) ELSE 0 END)
      - ROUND( CASE WHEN hetd > 0 THEN hetd / SUM( hetd ) OVER( PARTITION BY periode_id, intervenant_id, etat, structure_id) ELSE 0 END, 3 ) pourc_diff
      - ROUND( CASE WHEN hetd > 0 THEN hetd / SUM( hetd ) OVER( PARTITION BY periode_id, intervenant_id, etat, structure_id) ELSE 0 END, 3 ) pourc_diff,
        taux_remu,
        taux_horaire
    FROM (
      WITH dep AS ( -- détails par état de paiement
      SELECT
        periode_id,
        structure_id,
        type_intervenant_id,
        statut_id,
        intervenant_id,
        annee_id,
        centre_cout_id,
        domaine_fonctionnel_id,
        etat,
        periode,
        composante,
        date_mise_en_paiement,
        statut,
        statut_libelle,
        intervenant_code,
        intervenant_nom,
        intervenant_numero_insee,
        centre_cout_code,
        centre_cout_libelle,
        domaine_fonctionnel_code,
        domaine_fonctionnel_libelle,
        SUM( hetd ) hetd,
        SUM( fc_majorees ) fc_majorees,
        SUM( exercice_aa ) exercice_aa,
        SUM( exercice_ac ) exercice_ac,
        taux_remu,
        taux_horaire
      FROM
        (
        SELECT
          CASE WHEN th.code = 'fc_majorees' THEN 1 ELSE 0 END                 is_fc_majoree,
          p.id                                                                periode_id,
@@ -105,6 +138,7 @@ FROM
          CASE WHEN th.code = 'fc_majorees' THEN mep.heures ELSE 0 END        fc_majorees,
          mis.heures_aa                                                       exercice_aa,
          mis.heures_ac                                                       exercice_ac,
          tr.libelle taux_remu,
          mis.taux_horaire
        FROM
                    tbl_paiement mis
@@ -121,36 +155,8 @@ FROM
          LEFT JOIN periode                   p ON p.id = mep.periode_paiement_id
          LEFT JOIN service                  se ON mis.service_id = se.id
          LEFT JOIN element_pedagogique      ep ON ep.id = se.element_pedagogique_id
       )
      SELECT
        periode_id,
        structure_id,
        type_intervenant_id,
        statut_id,
        intervenant_id,
        annee_id,
        centre_cout_id,
        domaine_fonctionnel_id,
        etat,
        periode,
        composante,
        date_mise_en_paiement,
        statut,
        statut_libelle,
        intervenant_code,
        intervenant_nom,
        intervenant_numero_insee,
        centre_cout_code,
        centre_cout_libelle,
        domaine_fonctionnel_code,
        domaine_fonctionnel_libelle,
        SUM( hetd ) hetd,
        SUM( fc_majorees ) fc_majorees,
        SUM( exercice_aa ) exercice_aa,
        SUM( exercice_ac ) exercice_ac,
        taux_horaire
      FROM
        dep
          LEFT JOIN taux_remu                tr ON tr.id = mis.taux_remu_id
       ) dep
      GROUP BY
        periode_id,
        structure_id,
@@ -173,6 +179,7 @@ FROM
        centre_cout_libelle,
        domaine_fonctionnel_code,
        domaine_fonctionnel_libelle,
        taux_remu,
        taux_horaire,
        is_fc_majoree
      ) dep2
+0 −170
Changes for data/ddl/view/V_EXP_HETD_CENTRE_COUT.sql: 0 added lines, 170 removed lines.
Original line number Diff line number Diff line
CREATE OR REPLACE FORCE VIEW V_EXP_HETD_CENTRE_COUT AS
WITH t AS (
  SELECT
    tvh.id                              type_volume_horaire_id,
    evh.id                              etat_volume_horaire_id,
    a.id                                annee_id,
    i.id                                intervenant_id,
    si.id                               statut_id,
    ti.id                               type_intervenant_id,
    g.id                                grade_id,
    str.id                              structure_id,
    gtf.id                              groupe_type_formation_id,
    tf.id                               type_formation_id,
    e.id                                etape_id,

    tvh.code                            type_volume_horaire,
    evh.code                            etat_volume_horaire,
    a.libelle                           annee,
    i.code                              code_intervenant,
    i.nom_usuel || ' ' || i.prenom      intervenant,
    si.libelle                          statut_intervenant,
    ti.libelle                          type_intervenant,
    g.libelle_long                      grade,
    str.libelle_court                   structure_enseignement,
    gtf.libelle_long                    groupe_type_formation,
    tf.libelle_long                     type_formation,
    e.source_code                       code_formation,

    CASE WHEN mep.id IS NULL THEN frs.total ELSE mep.heures END
                                        total_hetd,

    cc.source_code || ' ' || cc.libelle centre_couts,
    a.taux_hetd * CASE WHEN mep.id IS NULL THEN frs.total ELSE mep.heures END
                                        total_euros
  FROM
              formule_resultat_service  frs
         JOIN formule_resultat           fr ON fr.id = frs.formule_resultat_id
         JOIN etat_volume_horaire       evh ON evh.id = fr.etat_volume_horaire_id
         JOIN type_volume_horaire       tvh ON tvh.id = fr.type_volume_horaire_id
         JOIN intervenant                 i ON i.id = fr.intervenant_id
         JOIN annee                       a ON a.id = i.annee_id
         JOIN statut                     si ON si.id = i.statut_id
         JOIN type_intervenant           ti ON ti.id = si.type_intervenant_id
         JOIN service                     s ON s.id = frs.service_id
    LEFT JOIN grade                       g ON g.id = i.grade_id
    LEFT JOIN element_pedagogique        ep ON ep.id = s.element_pedagogique_id
         JOIN structure                 str ON str.id = NVL(ep.structure_id, i.structure_id)
    LEFT JOIN etape                       e ON e.id = ep.etape_id
    LEFT JOIN type_formation             tf ON tf.id = e.type_formation_id
    LEFT JOIN groupe_type_formation     gtf ON gtf.id = tf.groupe_id
    LEFT JOIN mise_en_paiement          mep ON mep.formule_res_service_id = frs.id
                                           AND mep.histo_destruction IS NULL

    LEFT JOIN centre_cout                cc ON cc.id = MEP.CENTRE_COUT_ID

  UNION ALL

  SELECT
    type_volume_horaire_id, etat_volume_horaire_id, annee_id, intervenant_id, statut_id, type_intervenant_id,
    grade_id, structure_id, groupe_type_formation_id, type_formation_id, etape_id,

    type_volume_horaire, etat_volume_horaire, annee, code_intervenant, intervenant, statut_intervenant,
    type_intervenant, grade, structure_enseignement, groupe_type_formation, type_formation,
    code_formation, total_hetd, centre_couts,
    (select taux_hetd from annee ann where ann.id = annee_id) * total_hetd total_euros
  FROM (
  SELECT
    tvh.id                              type_volume_horaire_id,
    evh.id                              etat_volume_horaire_id,
    a.id                                annee_id,
    i.id                                intervenant_id,
    si.id                               statut_id,
    ti.id                               type_intervenant_id,
    g.id                                grade_id,
    str.id                              structure_id,
    gtf.id                              groupe_type_formation_id,
    tf.id                               type_formation_id,
    e.id                                etape_id,

    tvh.code                            type_volume_horaire,
    evh.code                            etat_volume_horaire,
    a.libelle                           annee,
    i.code                              code_intervenant,
    i.nom_usuel || ' ' || i.prenom      intervenant,
    si.libelle                          statut_intervenant,
    ti.libelle                          type_intervenant,
    g.libelle_long                      grade,
    str.libelle_court                   structure_enseignement,
    gtf.libelle_long                    groupe_type_formation,
    tf.libelle_long                     type_formation,
    e.source_code                       code_formation,
    frs.total - SUM(mep.heures) OVER (PARTITION BY frs.id) total_hetd,
    RANK() OVER ( PARTITION BY frs.id ORDER BY mep.id) ordre,
    null centre_couts
  FROM
              formule_resultat_service  frs
         JOIN formule_resultat           fr ON fr.id = frs.formule_resultat_id
         JOIN etat_volume_horaire       evh ON evh.id = fr.etat_volume_horaire_id
         JOIN type_volume_horaire       tvh ON tvh.id = fr.type_volume_horaire_id
         JOIN intervenant                 i ON i.id = fr.intervenant_id
         JOIN annee                       a ON a.id = i.annee_id
         JOIN statut                     si ON si.id = i.statut_id
         JOIN type_intervenant           ti ON ti.id = si.type_intervenant_id
         JOIN service                     s ON s.id = frs.service_id
    LEFT JOIN grade                       g ON g.id = i.grade_id
    LEFT JOIN element_pedagogique        ep ON ep.id = s.element_pedagogique_id
         JOIN structure                 str ON str.id = NVL(ep.structure_id, i.structure_id)
    LEFT JOIN etape                       e ON e.id = ep.etape_id
    LEFT JOIN type_formation             tf ON tf.id = e.type_formation_id
    LEFT JOIN groupe_type_formation     gtf ON gtf.id = tf.groupe_id
    LEFT JOIN mise_en_paiement          mep ON mep.formule_res_service_id = frs.id
                                           AND mep.histo_destruction IS NULL
  ) t WHERE ordre = 1 AND total_hetd > 0
)
SELECT
  type_volume_horaire_id,
  etat_volume_horaire_id,
  annee_id,
  intervenant_id,
  statut_id,
  type_intervenant_id,
  grade_id,
  structure_id,
  groupe_type_formation_id,
  type_formation_id,
  etape_id,

  type_volume_horaire,
  etat_volume_horaire,
  annee,
  code_intervenant,
  intervenant,
  statut_intervenant,
  type_intervenant,
  grade,
  structure_enseignement,
  groupe_type_formation,
  type_formation,
  code_formation,
  SUM(total_hetd) total_hetd,
  centre_couts,
  SUM(total_euros) total_euros
FROM
  t
GROUP BY
  type_volume_horaire_id,
  etat_volume_horaire_id,
  annee_id,
  intervenant_id,
  statut_id,
  type_intervenant_id,
  grade_id,
  structure_id,
  groupe_type_formation_id,
  type_formation_id,
  etape_id,

  type_volume_horaire,
  etat_volume_horaire,
  annee,
  code_intervenant,
  intervenant,
  statut_intervenant,
  type_intervenant,
  grade,
  structure_enseignement,
  groupe_type_formation,
  type_formation,
  code_formation,
  centre_couts
 No newline at end of file
+3 −0
Changes for module/Paiement/src/Service/MiseEnPaiementService.php: 3 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -200,6 +200,9 @@ class MiseEnPaiementService extends AbstractEntityService
                'centre-cout-code'            => $d['CENTRE_COUT_CODE'],
                'domaine-fonctionnel-libelle' => $d['DOMAINE_FONCTIONNEL_LIBELLE'],

                'taux-remu'           => $d['TAUX_REMU'],
                'taux-horaire'        => (float)$d['TAUX_HORAIRE'],

                'hetd'                => (float)$d['HETD'],
                'hetd-pourc'          => (float)$d['HETD_POURC'],
                'hetd-montant'        => (float)$d['HETD_MONTANT'],
+17 −8
Changes for module/Paiement/view/paiement/paiement/etat-paiement-tableau.phtml: 17 added lines, 8 removed lines.
Original line number Diff line number Diff line
@@ -3,20 +3,24 @@
/* @var $etatPaiement array */
/* @var $hasFoot boolean */

$majFc = $etatPaiement['total']['rem-fc-d714'] > 0;

?>
<table class="table table-sm table-bordered etat-paiement">
<thead>
    <tr>
        <th rowspan="2">Identité</th>
        <th rowspan="2">N° INSEE</th>
        <th rowspan="2">Centre de coûts / EOTP</th>
        <th rowspan="2">Domaine fonctionnel</th>
        <th colspan="2" rowspan="2">HETD</th>
        <th colspan="2">Taux</th>
        <th rowspan="2">Montant</th>
        <th rowspan="2">Rém. FC D714.60</th>
        <?php if ($majFc): ?><th rowspan="2">Rém. FC D714.60</th><?php endif; ?>
        <th colspan="2">Exercice</th>
    </tr>
    <tr>
        <th>Libellé</th>
        <th>Valeur</th>
        <th>AA</th>
        <th>AC</th>
    </tr>
@@ -29,13 +33,14 @@
    <?php if ($iEP !== 'total'): ?>
    <tr>
        <td><?= $ep['intervenant-nom'] ?></td>
        <td style="white-space: nowrap"><?= $ep['intervenant-numero-insee'] ?></td>
        <td><?= $ep['centre-cout-code'] ?></td>
        <td><?= $ep['domaine-fonctionnel-libelle'] ?></td>
        <td class="nombre"><?= $hetdRem == 'hetd' ? \UnicaenApp\Util::formattedNumber($ep['hetd']) : '' ?></td>
        <td class="nombre"><?= $hetdRem == 'hetd' ? \UnicaenApp\Util::formattedPourcentage($ep['hetd-pourc']) : '' ?></td>
        <td><?= $ep['taux-remu'] ?></td>
        <td class="nombre"><?= $hetdRem == 'hetd' ? \UnicaenApp\Util::formattedNumber($ep['taux-horaire']) : '' ?>
        <td class="nombre"><?= $hetdRem == 'hetd' ? \UnicaenApp\Util::formattedEuros($ep['hetd-montant']) : '' ?></td>
        <td class="nombre"><?= $hetdRem == 'hetd' ? '' : \UnicaenApp\Util::formattedEuros($ep['rem-fc-d714']) ?></td>
        <?php if ($majFc): ?><td class="nombre"><?= $hetdRem == 'hetd' ? '' : \UnicaenApp\Util::formattedEuros($ep['rem-fc-d714']) ?></td><?php endif; ?>
        <td class="nombre"><?= $hetdRem == 'hetd' ? \UnicaenApp\Util::formattedNumber($ep['exercice-aa']) : '' ?></td>
        <td class="nombre"><?= $hetdRem == 'hetd' ? \UnicaenApp\Util::formattedNumber($ep['exercice-ac']) : '' ?></td>
    </tr>
@@ -43,11 +48,13 @@
    <?php endforeach; ?>
    <?php if (count($lep) > 1 ): ?>
    <tr>
        <th colspan="4" style="text-align: right">Sous-total <?= $hetdRem == 'hetd' ? 'HC' : 'rém. FC D714.60' ?></th>
        <th colspan="3" style="text-align: right">Sous-total <?= $hetdRem == 'hetd' ? 'HC' : 'rém. FC D714.60' ?></th>
        <th class="nombre"><?= $hetdRem == 'hetd' ? \UnicaenApp\Util::formattedNumber($lep['total']['hetd']) : '' ?></th>
        <th class="nombre"><?= $hetdRem == 'hetd' ? \UnicaenApp\Util::formattedPourcentage($lep['total']['hetd-pourc']) : '' ?></th>
        <th>&nbsp;</th>
        <th>&nbsp;</th>
        <th class="nombre"><?= $hetdRem == 'hetd' ? \UnicaenApp\Util::formattedEuros($lep['total']['hetd-montant']) : '' ?></th>
        <th class="nombre"><?= $hetdRem == 'hetd' ? '' : \UnicaenApp\Util::formattedEuros($lep['total']['rem-fc-d714']) ?></th>
        <?php if ($majFc): ?><th class="nombre"><?= $hetdRem == 'hetd' ? '' : \UnicaenApp\Util::formattedEuros($lep['total']['rem-fc-d714']) ?></th><?php endif; ?>
        <th class="nombre"><?= $hetdRem == 'hetd' ? \UnicaenApp\Util::formattedNumber($lep['total']['exercice-aa']) : \UnicaenApp\Util::formattedEuros($lep['total']['exercice-aa-montant']) ?></th>
        <th class="nombre"><?= $hetdRem == 'hetd' ? \UnicaenApp\Util::formattedNumber($lep['total']['exercice-ac']) : \UnicaenApp\Util::formattedEuros($lep['total']['exercice-ac-montant']) ?></th>
    </tr>
@@ -58,11 +65,13 @@
<?php if ($hasFoot): ?>
<tfoot class="tfoot bg-info">
    <tr>
        <td colspan="4"><?= (count($etatPaiement)-1) ?> intervenant(s)</td>
        <td colspan="3"><?= (count($etatPaiement)-1) ?> intervenant(s)</td>
        <td class="nombre"><?= \UnicaenApp\Util::formattedNumber($etatPaiement['total']['hetd']) ?></td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td class="nombre"><?= \UnicaenApp\Util::formattedEuros($etatPaiement['total']['hetd-montant']) ?></td>
        <td class="nombre"><?= \UnicaenApp\Util::formattedEuros($etatPaiement['total']['rem-fc-d714']) ?></td>
        <?php if ($majFc): ?><td class="nombre"><?= \UnicaenApp\Util::formattedEuros($etatPaiement['total']['rem-fc-d714']) ?></td><?php endif; ?>
        <td class="nombre"><?= \UnicaenApp\Util::formattedEuros($etatPaiement['total']['exercice-aa-montant']) ?></td>
        <td class="nombre"><?= \UnicaenApp\Util::formattedEuros($etatPaiement['total']['exercice-ac-montant']) ?></td>
    </tr>