Commit b62a8980 authored by Stephane Bouvry's avatar Stephane Bouvry
Browse files

Nom de fichier PCRU modifié

Synthèse Engagement/Effectué en cours
parent dbc841f3
Loading
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -49,13 +49,14 @@ return array(

            // Paramètres de la POOL d'envoi PCRU
            'files_path' => __DIR__.'/../../tmp',       // Dossier où seront gérés les fichiers à envoyer
            'filename_contrats' => 'contrat.csv',       // Nom du fichier CSV (contrats)
            'filename_partenaires' => 'partenaire.csv', // Nom du fichier (Partenaires)
            'filename_contrats' => 'SitePMA_UniCaen.csv',       // Nom du fichier CSV (contrats)
            'filename_partenaires' => 'SitePMA_UniCaen.PARTENAIRES.csv', // Nom du fichier (Partenaires)
            'pool_current' => 'waiting',                // Nom du dossier où sont stoqués les fichiers avant envoi
            'pool_effective' => 'uploaded',                // Nom du dossier où sont stoqués les fichiers avant envoi
            'pool_history' => 'send-%s',                // Nom des dossiers archivés
            'pool_log' => 'pcru.log',                   // Nom du fichier de log
            'pool_lock' => 'PCRU.LOCK'                  // Nom du fichier de verrouillage
            'pool_lock' => 'PCRU.LOCK',                  // Nom du fichier de verrouillage
            'filename_errors' => 'DEPOT-CSV.ERRORS.json', // Nom du fichier d'erreur PCRU
        ],

        'htmltopdfrenderer' => [
+6 −0
Original line number Diff line number Diff line
@@ -20,6 +20,9 @@ use Zend\Permissions\Acl\Resource\ResourceInterface;
 */
class SpentLine
{
    const BTART_ENGAGE = '0100';
    const BTART_EFFECTUE = '0250';

    /**
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="AUTO")
@@ -647,6 +650,9 @@ class SpentLine

            // Infos
            'montant' => $this->getMontant(),
            'montant_engage' => $this->getBtart() == self::BTART_ENGAGE ? $this->getMontant() : 0.0,
            'montant_effectue' => $this->getBtart() == self::BTART_EFFECTUE ? $this->getMontant() : 0.0,
            'montant' => $this->getMontant(),
            'compteBudgetaire' => $this->getCompteBudgetaire(),
            'centreProfit' => $this->getCentreDeProfit(),
            'compteGeneral' => $this->getCompteGeneral(),
+2 −2
Original line number Diff line number Diff line
@@ -260,9 +260,9 @@ class PCRUService implements UseLoggerService, UseOscarConfigurationService, Use
        if ($zip->open($ziptmp, \ZipArchive::CREATE) !== true) {
            throw new OscarPCRUException("Impossible de créer l'archive");
        }
        $zip->addFile($csvtmp, 'contrats.csv');
        $zip->addFile($csvtmp, $this->getOscarConfigurationService()->getPcruContratFile(false));
        if (file_exists($orgtmp)) {
            $zip->addFile($orgtmp, 'partenaires.csv');
            $zip->addFile($orgtmp, $this->getOscarConfigurationService()->getPcruPartenaireFile(false));
        }
        $zip->addFile($pdftmp, $num . '.pdf');
        $zip->close();
+54 −0
Original line number Diff line number Diff line
@@ -1273,29 +1273,59 @@ class SpentService implements UseLoggerService, UseOscarConfigurationService, Us
            '1' => [
                'label' => "Recettes",
                'total' => 0.0,
                'total_engage' => 0.0,
                'total_effectue' => 0.0,
                'nbr_engage' => 0,
                'nbr_effectue' => 0,
                'nbr' => 0
            ],
            '0' => [
                'label' => "Ignorés",
                'total' => 0.0,
                'total_engage' => 0.0,
                'total_effectue' => 0.0,
                'nbr_engage' => 0,
                'nbr_effectue' => 0,
                'nbr' => 0
            ],
            'N.B' => [
                'label' => "Hors-Masse",
                'total' => 0.0,
                'total_engage' => 0.0,
                'total_effectue' => 0.0,
                'nbr_engage' => 0,
                'nbr_effectue' => 0,
                'nbr' => 0
            ],
            'totaux' => [
                'engage' => 0.0,
                'effectue' => 0.0,
            ]
        ];

        $massesKeys = array_keys($this->getOscarConfigurationService()->getMasses());

        foreach ($this->getOscarConfigurationService()->getMasses() as $masseKey => $masseLabel) {
            $synthesis[$masseKey] = [
                'label' => $masseLabel,
                'total' => 0.0,
                'total_engage' => 0.0,
                'total_effectue' => 0.0,
                'nbr_engage' => 0,
                'nbr_effectue' => 0,
                'nbr' => 0
            ];
        }


        $numSifacDone = [];
        /** @var SpentLine $spent */
        foreach ($spents as $spent) {
            if($spent->getBtart() == SpentLine::BTART_EFFECTUE && !in_array($spent->getNumSifac(), $numSifacDone)){
                $numSifacDone[] = $spent->getNumSifac();
            }
        }

        /** @var SpentLine $spent */
        foreach ($spents as $spent) {
            $compte = $this->getCompte($spent->getCompteGeneral());
@@ -1303,11 +1333,35 @@ class SpentService implements UseLoggerService, UseOscarConfigurationService, Us
            if( !array_key_exists($masse, $synthesis) ){
                $masse = 'N.B';
            }

            $totalEffectue = 0.0;
            $totalEngage = 0.0;

            if( $spent->getBtart() == SpentLine::BTART_ENGAGE ){
                $synthesis[$masse]['nbr_engage']++;
                if( !in_array($spent->getNumSifac(), $numSifacDone) ){
                    $totalEngage = $spent->getMontant();
                }
            }

            if( $spent->getBtart() == SpentLine::BTART_EFFECTUE ){
                $synthesis[$masse]['nbr_effectue']++;
                $totalEffectue = $spent->getMontant();
            }

            $synthesis[$masse]['total'] += $spent->getMontant();
            $synthesis[$masse]['total_effectue'] += $totalEffectue;
            $synthesis[$masse]['total_engage'] += $totalEngage;
            
            if( in_array($masse, $massesKeys) ){
                $synthesis['totaux']['effectue'] += $totalEffectue;
                $synthesis['totaux']['engage'] += $totalEngage;
            }
            $synthesis[$masse]['nbr']++;

        }


        return $synthesis;
    }

+46 −17
Original line number Diff line number Diff line
@@ -47,9 +47,11 @@
                    <thead>
                    <tr>
                        <th>ID</th>
                        <th>N°SIFAC</th>
                        <th>Btart</th>
                        <th>Description</th>
                        <th>Montant</th>
                        <th>Montant engagé</th>
                        <th>Montant effectué</th>
                        <th>Compte Budgetaire</th>
                        <th>Centre de profit</th>
                        <th>Compte général</th>
@@ -62,9 +64,11 @@
                    <tbody>
                    <tr class="text-small" v-for="d in details.details">
                        <td>{{ d.syncid }}</td>
                        <td>{{ d.numSifac }}</td>
                        <td>{{ d.btart }}</td>
                        <td>{{ d.texteFacture|d.designation }}</td>
                        <td style="text-align: right">{{ $filters.money(d.montant) }}</td>
                        <td style="text-align: right">{{ $filters.money(d.montant_engage) }}</td>
                        <td style="text-align: right">{{ $filters.money(d.montant_effectue) }}</td>
                        <td>{{ d.compteBudgetaire }}</td>
                        <td>{{ d.centreFinancier }}</td>
                        <td><strong>{{ d.compteGeneral }}</strong> : {{ d.type }}</td>
@@ -81,7 +85,7 @@
        <div class="container-fluid">

            <div class="row">
                <div class="col-md-2">
                <div class="col-md-3">
                    <h3>
                        <i class="icon-help-circled"></i>
                        Informations
@@ -138,28 +142,41 @@

                    <h3><i class="icon-calculator"></i>Dépenses</h3>
                    <table class="table table-condensed card synthesis" v-if="spentlines">
                        <thead>
                        <tr>
                          <th>Masse</th>
                          <th style="text-align: right">Engagé</th>
                          <th style="text-align: right">Effectué</th>
                        </tr>
                        </thead>

                        <tbody>
                        <tr v-for="dt,key in spentlines.masses">
                            <th>
                                <small>{{ dt }}</small>
                                <a class="label label-info xs" :href="'#repport-' + key">{{ spentlines.synthesis[key].nbr}}</a>
                                <a class="label label-info xs" :href="'#repport-' + key">{{ spentlines.synthesis[key].nbr_effectue }} / {{ spentlines.synthesis[key].nbr_engage }}</a>
                            </th>
                            <td style="text-align: right">{{ $filters.money(spentlines.synthesis[key].total) }}</td>
                            <td style="text-align: right">{{ $filters.money(spentlines.synthesis[key].total_engage) }}</td>
                            <td style="text-align: right">{{ $filters.money(spentlines.synthesis[key].total_effectue) }}</td>
                        </tr>
                        </tbody>
                        <tbody>
                        <tr class="total">
                            <th>Total</th>
                            <td style="text-align: right">{{ $filters.money(spentlines.synthesis.totaux.engage) }}</td>
                            <td style="text-align: right">{{ $filters.money(spentlines.synthesis.totaux.effectue) }}</td>
                        </tr>
                        </tbody>
                        <tbody>
                        <tr v-if="spentlines.synthesis['N.B'].total != 0">
                          <th>
                            <small><i class="icon-attention"></i> Hors-masse</small>
                            <a href="#repport-nb" class="label label-info">{{ spentlines.synthesis['N.B'].nbr}}</a>
                          </th>
                            <td style="text-align: right">{{ $filters.money(spentlines.synthesis['N.B'].total) }}</td>
                          <td style="text-align: right">{{ $filters.money(spentlines.synthesis['N.B'].total_engage) }}</td>
                          <td style="text-align: right">{{ $filters.money(spentlines.synthesis['N.B'].total_effectue) }}</td>
                        </tr>
                        </tbody>
                        <tfoot>
                        <tr class="total">
                            <th>Total</th>
                            <td style="text-align: right">{{ $filters.money(totalDepenses) }}</td>
                        </tr>
                        </tfoot>
                    </table>

                    <div v-if="manageRecettes">
@@ -193,7 +210,7 @@
                        </table>
                    </div>
                </div>
                <div class="col-md-10" style="height: 80vh; overflow-y: scroll">
                <div class="col-md-9" style="height: 80vh; overflow-y: scroll">

                    <div v-if="spentlines != null">
                        <div v-for="m, k in masses">
@@ -249,7 +266,6 @@
    export default {
        props: [
            'url',
            'masses',
            'urlSpentAffectation',
            'urlActivity',
            'urlSync',
@@ -268,6 +284,7 @@
                error: null,
                pendingMsg: "",
                spentlines: null,
                masses: {},
                details: null,
                displayIgnored: false,
                editCompte: null,
@@ -307,6 +324,7 @@

                if( this.spentlines ) {
                    for (let s in this.spentlines.spents) {

                        let line = this.spentlines.spents[s];
                        let masse = line.masse;
                        let btart = line.btart;
@@ -323,9 +341,12 @@
                            out.datas[masse][numPiece] = {
                                'ids': [],
                                'numpiece': numPiece,
                                'numSifac': [],
                                'text': [],
                                'types': [],
                                'montant': 0.0,
                                'montant_engage': 0.0,
                                'montant_effectue': 0.0,
                                'btart': btart,
                                'compteBudgetaires': [],
                                'comptes': [],
@@ -345,7 +366,14 @@
                        let compte = line.compteGeneral;
                        let compteBudgetaire = line.compteBudgetaire;

                        if( out.datas[masse][numPiece].numSifac.indexOf(line.numSifac) == -1 ){
                          out.datas[masse][numPiece].numSifac.push(line.numSifac);
                        }

                        out.datas[masse][numPiece].montant += line.montant;
                        out.datas[masse][numPiece].montant_effectue += line.montant_effectue;
                        out.datas[masse][numPiece].montant_engage += line.montant_engage;


                        if( text && out.datas[masse][numPiece].text.indexOf(text) < 0 ){
                            out.datas[masse][numPiece].text.push(text);
@@ -425,6 +453,7 @@

                axios.get(this.url).then(
                    success => {
                        this.masses = success.data.spents.masses;
                        this.spentlines = success.data.spents;
                        this.informations = success.data.spents.informations;
                    },
Loading