Commit 11f4970c authored by Laurent Lecluse's avatar Laurent Lecluse
Browse files

tentative backport correction bug paiement

parent 30d90b91
Loading
Loading
Loading
Loading
Loading
+29 −4
Original line number Diff line number Diff line
@@ -3,6 +3,7 @@
namespace Paiement\Tbl\Process;


use Application\Service\Traits\AnneeServiceAwareTrait;
use Application\Service\Traits\ParametresServiceAwareTrait;
use Paiement\Service\TauxRemuServiceAwareTrait;
use Paiement\Tbl\Process\Sub\Consolidateur;
@@ -13,6 +14,7 @@ use Paiement\Tbl\Process\Sub\Rapprocheur;
use Paiement\Tbl\Process\Sub\Repartiteur;
use Paiement\Tbl\Process\Sub\ServiceAPayer;
use Unicaen\BddAdmin\BddAwareTrait;
use UnicaenTbl\Event;
use UnicaenTbl\Process\ProcessInterface;
use UnicaenTbl\Service\BddServiceAwareTrait;
use UnicaenTbl\TableauBord;
@@ -28,6 +30,7 @@ class PaiementProcess implements ProcessInterface
    use ParametresServiceAwareTrait;
    use TauxRemuServiceAwareTrait;
    use BddAwareTrait;
    use AnneeServiceAwareTrait;

    /** @var array|ServiceAPayer[] */
    protected array $services = [];
@@ -37,6 +40,7 @@ class PaiementProcess implements ProcessInterface
    protected Rapprocheur   $rapprocheur;
    protected Consolidateur $consolidateur;
    protected Exporteur     $exporteur;
    protected TableauBord   $tableauBord;



@@ -74,11 +78,23 @@ class PaiementProcess implements ProcessInterface

    public function run(TableauBord $tableauBord, array $params = []): void
    {
        $this->tableauBord = $tableauBord;

        if (empty($params)) {
            $annees = $this->getServiceAnnee()->getActives();
            foreach ($annees as $annee) {
                $this->run($tableauBord, ['ANNEE_ID' => $annee->getId()]);
            }
        } else {
            $this->init();
            $tableauBord->onAction(Event::GET);
            $this->loadAPayer($params);
            $tableauBord->onAction(Event::PROCESS, 0, count($this->tblData));
            $this->traitement();
            $tableauBord->onAction(Event::SET, 0, count($this->tblData));
            $this->enregistrement($tableauBord, $params);
        }
    }



@@ -131,7 +147,13 @@ class PaiementProcess implements ProcessInterface

    protected function traitement(bool $export = true, bool $consolidation = true)
    {
        $index      = 0;
        $count      = count($this->services);

        foreach ($this->services as $sid => $serviceAPayer) {
            $index++;
            $this->tableauBord->onAction(Event::PROGRESS, $index, $count);

            $this->repartiteur->repartir($serviceAPayer);
            $this->rapprocheur->rapprocher($serviceAPayer);
            if ($consolidation) {
@@ -176,7 +198,10 @@ class PaiementProcess implements ProcessInterface
            . $this->getServiceBdd()->makeWhere($params);

        $aPayerStmt = $conn->executeQuery($sql);
        $index = 0;
        while ($lap = $aPayerStmt->fetchAssociative()) {
            $index++;
            $this->tableauBord->onAction(Event::PROGRESS, $index, 0);
            $this->loadLigneAPayer($lap);
        }

+23 −23
Original line number Diff line number Diff line
@@ -47,13 +47,13 @@ class Exporteur
            ];
            $foundLine = $this->createKey($ldata);
            if (array_key_exists($foundLine,$destination)) {
                var_dump($ldata['intervenant_id'].' ');
                $destination[$foundLine]['heures_a_payer_aa']   = round($destination[$foundLine]['heures_a_payer_aa'] + $ldata['heures_a_payer_aa'], 2);
                $destination[$foundLine]['heures_a_payer_ac']   = round($destination[$foundLine]['heures_a_payer_ac'] + $ldata['heures_a_payer_ac'], 2);
                $destination[$foundLine]['heures_demandees_aa'] = round($destination[$foundLine]['heures_demandees_aa'] + $ldata['heures_demandees_aa'], 2);
                $destination[$foundLine]['heures_demandees_ac'] = round($destination[$foundLine]['heures_demandees_ac'] + $ldata['heures_demandees_ac'], 2);
                $destination[$foundLine]['heures_payees_aa']    = round($destination[$foundLine]['heures_payees_aa'] + $ldata['heures_payees_aa'], 2);
                $destination[$foundLine]['heures_payees_ac']    = round($destination[$foundLine]['heures_payees_ac'] + $ldata['heures_payees_ac'], 2);
                var_dump($ldata['INTERVENANT_ID'].' ');
                $destination[$foundLine]['HEURES_A_PAYER_AA']   = round($destination[$foundLine]['HEURES_A_PAYER_AA'] + $ldata['HEURES_A_PAYER_AA'], 2);
                $destination[$foundLine]['HEURES_A_PAYER_AC']   = round($destination[$foundLine]['HEURES_A_PAYER_AC'] + $ldata['HEURES_A_PAYER_AC'], 2);
                $destination[$foundLine]['HEURES_DEMANDEES_AA'] = round($destination[$foundLine]['HEURES_DEMANDEES_AA'] + $ldata['HEURES_DEMANDEES_AA'], 2);
                $destination[$foundLine]['HEURES_DEMANDEES_AC'] = round($destination[$foundLine]['HEURES_DEMANDEES_AC'] + $ldata['HEURES_DEMANDEES_AC'], 2);
                $destination[$foundLine]['HEURES_PAYEES_AA']    = round($destination[$foundLine]['HEURES_PAYEES_AA'] + $ldata['HEURES_PAYEES_AA'], 2);
                $destination[$foundLine]['HEURES_PAYEES_AC']    = round($destination[$foundLine]['HEURES_PAYEES_AC'] + $ldata['HEURES_PAYEES_AC'], 2);
            } else {
                $destination[$foundLine] = $ldata;
            }
@@ -65,22 +65,22 @@ class Exporteur

    protected function createKey(array $line): string
    {
        $keyData = $line['annee_id']
            . '|' . $line['service_id']
            . '|' . $line['service_referentiel_id']
            . '|' . $line['mission_id']
            . '|' . $line['type_intervenant_id']
            . '|' . $line['intervenant_id']
            . '|' . $line['structure_id']
            . '|' . $line['type_heures_id']
            . '|' . $line['periode_ens_id']
            . '|' . $line['mise_en_paiement_id']
            . '|' . $line['periode_paiement_id']
            . '|' . $line['centre_cout_id']
            . '|' . $line['domaine_fonctionnel_id']
            . '|' . $line['taux_remu_id']
            . '|' . $line['taux_horaire']
            . '|' . $line['taux_conges_payes'];
        $keyData = $line['ANNEE_ID']
            . '|' . $line['SERVICE_ID']
            . '|' . $line['SERVICE_REFERENTIEL_ID']
            . '|' . $line['MISSION_ID']
            . '|' . $line['TYPE_INTERVENANT_ID']
            . '|' . $line['INTERVENANT_ID']
            . '|' . $line['STRUCTURE_ID']
            . '|' . $line['TYPE_HEURES_ID']
            . '|' . $line['PERIODE_ENS_ID']
            . '|' . $line['MISE_EN_PAIEMENT_ID']
            . '|' . $line['PERIODE_PAIEMENT_ID']
            . '|' . $line['CENTRE_COUT_ID']
            . '|' . $line['DOMAINE_FONCTIONNEL_ID']
            . '|' . $line['TAUX_REMU_ID']
            . '|' . $line['TAUX_HORAIRE']
            . '|' . $line['TAUX_CONGES_PAYES'];
        return $keyData;
    }