?? GreyFile — Mystic File Browser

Current path: home/webdevt/cryptoimpot.fr/module/Application/view/layout/



?? Go up: /home/webdevt/cryptoimpot.fr/module/Application/view

?? Viewing: rapport-debug-test.phtml

<?= $this->doctype() ?>

<html lang="en">

<body>


    <h1>Annexe principale</h1>

    <table style="font-size: medium">
        <?php $totalPlusOuMoinsValue = 0;
        $totalPrixCession = 0;
        ?>
        <?php echo $this->partial('partial/report/table-header-annexe-V'); ?>
        <?php $numCession = 1 ?>
        <?php $arrayCession = [];

        // test total colonne cession
        $sommeCessionBrut = 0;
        $sommeFraisCession = 0;
        $sommePrixCession = 0;
        $sommePrixCessionEtSoults = 0;
        $sommePrixAcquites = 0;
        $sommeFractionsInitialesCapital = 0;
        $sommePrixTotalAcquisition = 0;
        $sommeValeurPortefeuille = 0;
        $sommePlusOuMoinsValue = 0;

        $sommeSecondtermePV = 0;
        // test

        $arrayDateCession = [];
        $nbLigneTableauPrincipal = 0;
        $detailTableauSup20Lignes = '';
        ?>
        <tbody>
        <?php foreach ($this->lignesRapport as $ligneRapport) : ?>
        <?php // si nb cession < 19 ?>
        <?php if ($nbLigneTableauPrincipal < 19) : ?>

        <tr>
            <td style="text-align: center; border: 1px solid #000"><?= $numCession++ ?></td>
            <td style="text-align: center; border: 1px solid #000"><?= $ligneRapport->getDateCession()->format('d-m-Y') // Date de la cession fiat                     ?></td>
            <td style="text-align: center; border: 1px solid #000"><?= $ligneRapport->getDateCession()->format('H:i:s') // Heure de la cession fiat                     ?></td>
            <td style="text-align: right; border: 1px solid #000"><?= number_format($ligneRapport->getValeurPortefeuille(), 0); // 212 Valeur du portefeuille au moment de la cession                   ?></td>
            <td style="text-align: right; border: 1px solid #000"><?= number_format($ligneRapport->getPrixCessionBrut(), 0) // 213 Prix de cession                   ?></td>
            <td style="text-align: right; border: 1px solid #000"><?= number_format($ligneRapport->getFraisCession(), 0) // 214 Frais de cession                   ?></td>
            <td style="text-align: right; border: 1px solid #000"><?= number_format($ligneRapport->getPrixCession(), 0) // 215 Prix de cession net des frais                   ?></td>
            <td style="text-align: right; border: 1px solid #000"><?php // 216 Soulte reçue ou versée lors de la cession ?></td>
            <td style="text-align: right; border: 1px solid #000"><?= number_format($ligneRapport->getPrixCessionBrut(), 0) // 217  (213 – 216) ou (213 + 216) Prix de cession net des soultes                   ?></td>
            <td style="text-align: right; border: 1px solid #000"><?= number_format($ligneRapport->getPrixCession(), 0) // 218  (213 – 214 – 216) ou  (213 – 214 + 216) Prix de cession net des frais et soults                   ?></td>
            <td style="text-align: right; border: 1px solid #000"><?= number_format($ligneRapport->getSommePrixAcquites(), 0) // 220 Prix total d'acquisition (Acquisition fiat depuis c-1                   ?></td>
            <td style="text-align: right; border: 1px solid #000"><?= number_format($ligneRapport->getSommeFractionsInitialesCapital(), 0) // 221 Fractions de capital initial contenues dans le prix total d'acquisition                   ?></td>
            <td style="text-align: right; border: 1px solid #000"><?= number_format($ligneRapport->getPrixTotalAcquisition(), 0) // 223 (220 – 221 – 222) Prix total d'acquisition net                   ?></td>
            <td style="text-align: right; border: 1px solid #000"><?= ($ligneRapport->getPlusOuMoinsValue() > 0) ? '+' : '' ?><?= number_format($ligneRapport->getPlusOuMoinsValue(), 0); // ligne 218 – [(ligne 223) x (ligne 217) / (ligne 212)] Plus ou moins value cession                   ?></td>
            <?php //$totalPlusOuMoinsValue += $ligneRapport->getPlusOuMoinsValue(); ?>
            <?php //$totalPrixCession += $ligneRapport->getPrixCession(); ?>
            <?php //$sommeSecondtermePV += ($ligneRapport->getPrixTotalAcquisition() * $ligneRapport->getPrixCessionBrut() / $ligneRapport->getValeurPortefeuille()); ?>
            <?php //$arrayDateCession[] = $ligneRapport->getDateCession()->format('d-m-Y H:i:s') ?>
        </tr>
        <?php // si nb cession >= 19 ?>
        <?php else : ?>
            <?php
            $detailTableauSup20Lignes .= '<tr>';
            $detailTableauSup20Lignes .= '<td style="text-align: center; border: 1px solid #000">' . $numCession++ . '</td>';
            $detailTableauSup20Lignes .= '<td style="text-align: center; border: 1px solid #000">' . $ligneRapport->getDateCession()->format('d-m-Y') . '</td>';
            $detailTableauSup20Lignes .= '<td style="text-align: center; border: 1px solid #000">' . ($ligneRapport->getDateCession()->format('H:i:s')) . '</td>';
            $detailTableauSup20Lignes .= '<td style="text-align: right; border: 1px solid #000">' . number_format($ligneRapport->getValeurPortefeuille(), 0) . '</td>';
            $detailTableauSup20Lignes .= '<td style="text-align: right; border: 1px solid #000">' . number_format($ligneRapport->getPrixCessionBrut(), 0) . '</td>';
            $detailTableauSup20Lignes .= '<td style="text-align: right; border: 1px solid #000">' . number_format($ligneRapport->getFraisCession(), 0) . '</td>';
            $detailTableauSup20Lignes .= '<td style="text-align: right; border: 1px solid #000">' . number_format($ligneRapport->getPrixCession(), 0) . '</td>';

            $detailTableauSup20Lignes .= '<td style="text-align: right; border: 1px solid #000"></td>';
            $detailTableauSup20Lignes .= '<td style="text-align: right; border: 1px solid #000">' . number_format($ligneRapport->getPrixCessionBrut(), 0) . '</td>';
            $detailTableauSup20Lignes .= '<td style="text-align: right; border: 1px solid #000">' . number_format($ligneRapport->getPrixCession(), 0) . '</td>';
            $detailTableauSup20Lignes .= '<td style="text-align: right; border: 1px solid #000">' . number_format($ligneRapport->getSommePrixAcquites(), 0) . '</td>';
            $detailTableauSup20Lignes .= '<td style="text-align: right; border: 1px solid #000000">' . number_format($ligneRapport->getSommeFractionsInitialesCapital(), 0) . '</td>';
            $detailTableauSup20Lignes .= '<td style="text-align: right; border: 1px solid #000">' . number_format($ligneRapport->getPrixTotalAcquisition(), 0) . '</td>';
            $detailTableauSup20Lignes .= '<td style="text-align: right; border: 1px solid #000">' . (($ligneRapport->getPlusOuMoinsValue() > 0) ? '+' : '') . number_format($ligneRapport->getPlusOuMoinsValue(), 0) . '</td>';

            $detailTableauSup20Lignes .= '</tr>';

            $sommeCessionBrut += $ligneRapport->getPrixCessionBrut();
            $sommeFraisCession += $ligneRapport->getFraisCession();
            $sommePrixCession += $ligneRapport->getPrixCession();
            $sommePrixCessionEtSoults += $ligneRapport->getPrixCessionBrut();
            $sommePrixAcquites += $ligneRapport->getSommePrixAcquites();
            $sommeFractionsInitialesCapital += $ligneRapport->getSommeFractionsInitialesCapital();
            $sommePrixTotalAcquisition += $ligneRapport->getPrixTotalAcquisition();
            $sommeValeurPortefeuille += $ligneRapport->getValeurPortefeuille();
            $sommePlusOuMoinsValue += $ligneRapport->getPlusOuMoinsValue();

            ?>
        <?php endif ?>
        <?php // fin else cession >= 19 ?>
        <?php $nbLigneTableauPrincipal++; ?>
        <?php $totalPlusOuMoinsValue += $ligneRapport->getPlusOuMoinsValue(); ?>
        <?php $totalPrixCession += $ligneRapport->getPrixCession(); ?>
        <?php $sommeSecondtermePV += ($ligneRapport->getPrixTotalAcquisition() * $ligneRapport->getPrixCessionBrut() / $ligneRapport->getValeurPortefeuille()); ?>
        <?php $arrayDateCession[] = $ligneRapport->getDateCession()->format('d-m-Y H:i:s') ?>


        <?php endforeach; ?>

<?php // debut ligne fusion cession si nb cession > 20 ?>
        <?php if ($nbLigneTableauPrincipal >= 19) :?>
        <?php ${217} = $sommePrixCessionEtSoults ?>
        <?php //${'217b'} = $sommePrixCessionEtSoults ?>
        <?php ${218} = $sommePrixCession ?>
        <?php //${'218b'} = $sommePrixCession ?>
        <?php ${223} = $sommePrixTotalAcquisition / ($nbLigneTableauPrincipal - 19); ?>
        <!--    --><?php //$PVm = $sommePlusOuMoinsValue / ($nbLigneTableauPrincipal - 19); ?>
        <?php $PV = $sommePlusOuMoinsValue; ?>


        <?php ${212} = ${223} * ${217} / (${218} - $PV) ?>
        <tr style="font-style: italic;">
            <td style="text-align: center; border: 1px solid #000">20<sup>(*)</sup></td>
            <td style="text-align: center; border: 1px solid #000">31-12-<?= $this->annee ?></td>
            <td style="text-align: center; border: 1px solid #000">23:59:59</td>
            <td style="text-align: right; border: 1px solid #000"><?php /*212* */ ?><?= number_format(${212}, 0); // Valeur du portefeuille juste avant c                      ?></td>
            <td style="text-align: right; border: 1px solid #000"><?php /*213* */ ?><?= number_format($sommeCessionBrut, 0) // Prix de cession brut                      ?></td>
            <td style="text-align: right; border: 1px solid #000"><?php /*214* */ ?><?= number_format($sommeFraisCession, 0) //Frais de cession                      ?></td>
            <td style="text-align: right; border: 1px solid #000"><?php /*215* */ ?><?= number_format($sommePrixCession, 0) //Prix d'acquisition c-1                      ?></td>
            <td style="text-align: right; border: 1px solid #000"><?php /*216* */ ?></td>
            <td style="text-align: right; border: 1px solid #000"><? /*217* */ ?><?= $sommePrixCessionEtSoults ?></td>
            <td style="text-align: right; border: 1px solid #000"><?php /* 218* */ ?><?= number_format($sommePrixCession, 0) //Prix d'acquisition c-1                      ?></td>
            <td style="text-align: right; border: 1px solid #000"><?php /* 220*/ ?><?= number_format($sommePrixAcquites / ($nbLigneTableauPrincipal - 19), 0) // Acquisition fiat depuis c-1                      ?></td>
            <td style="text-align: right; border: 1px solid #000"><?php /* 221*/ ?><?= number_format($sommeFractionsInitialesCapital / ($nbLigneTableauPrincipal - 19), 0) // Valeur nominale c-1                      ?></td>
            <td style="text-align: right; border: 1px solid #000"><?php /* 223*/ ?><?= number_format($sommePrixTotalAcquisition / ($nbLigneTableauPrincipal - 19), 0) // Valeur nominale c-1                      ?></td>
            <td style="text-align: right; border: 1px solid #000"><?= (($sommePlusOuMoinsValue > 0) ? '+' : '') . number_format($sommePlusOuMoinsValue, 0); //Plus ou moins value                      ?></td>
        </tr>
        <?php endif ?>
        <?php // fin ligne fusion cession si nb cession > 20 ?>
        </tbody>
        <tfooter>
            <tr>
                <td style="text-align: right" colspan="12"></td>
                <td style="text-align: right; border: 1px solid #000;">Plus-value ou moins-value globale <sup>224</sup>
                    :
                </td>
                <td style="text-align: right; border: 1px solid #000;">
                    <b style="font-size: 12px"><?= ($totalPlusOuMoinsValue > 0) ? '+' : '' ?><?= number_format($totalPlusOuMoinsValue, 0) ?></b>
                </td>
            </tr>
        </tfooter>
    </table>

    <?php $nombreCession = $numCession - 1 ?>


    <table style="font-size: medium">
        <?php $totalPlusOuMoinsValue = 0;
        $totalPrixCession = 0;
        ?>
        <?php echo $this->partial('partial/report/table-header-annexe-V'); ?>
        <?php $numCession2 = 1 ?>
        <?php
//        $arrayCession = [];

        // test total colonne cession
//        $sommeCessionBrut = 0;
//        $sommeFraisCession = 0;
//        $sommePrixCession = 0;
//        $sommePrixCessionEtSoults = 0;
//        $sommePrixAcquites = 0;
//        $sommeFractionsInitialesCapital = 0;
//        $sommePrixTotalAcquisition = 0;
//        $sommeValeurPortefeuille = 0;
//        $sommePlusOuMoinsValue = 0;
//
//        $sommeSecondtermePV = 0;
        ?>
        <tbody>
<?php //var_dump($this->lignesRapportEntre2019etJanvierAnneeImposition); exit;?>
        <?php foreach ($this->lignesRapportEntre2019etJanvierAnneeImposition as $ligneRapportEntre2019etJanvierAnneeImposition) : ?>
    <?php // si nb cession < 19 ?>
    <tr>
        <td style="text-align: center; border: 1px solid #000"><?= $numCession2++ ?></td>
        <td style="text-align: center; border: 1px solid #000"><?= $ligneRapportEntre2019etJanvierAnneeImposition->getDateCession()->format('d-m-Y') // Date de la cession fiat                     ?></td>
        <td style="text-align: center; border: 1px solid #000"><?= $ligneRapportEntre2019etJanvierAnneeImposition->getDateCession()->format('H:i:s') // Heure de la cession fiat                     ?></td>
        <td style="text-align: right; border: 1px solid #000"><?= number_format($ligneRapportEntre2019etJanvierAnneeImposition->getValeurPortefeuille(), 0); // 212 Valeur du portefeuille au moment de la cession                   ?></td>
        <td style="text-align: right; border: 1px solid #000"><?= number_format($ligneRapportEntre2019etJanvierAnneeImposition->getPrixCessionBrut(), 0) // 213 Prix de cession                   ?></td>
        <td style="text-align: right; border: 1px solid #000"><?= number_format($ligneRapportEntre2019etJanvierAnneeImposition->getFraisCession(), 0) // 214 Frais de cession                   ?></td>
        <td style="text-align: right; border: 1px solid #000"><?= number_format($ligneRapportEntre2019etJanvierAnneeImposition->getPrixCession(), 0) // 215 Prix de cession net des frais                   ?></td>
        <td style="text-align: right; border: 1px solid #000"><?php // 216 Soulte reçue ou versée lors de la cession ?></td>
        <td style="text-align: right; border: 1px solid #000"><?= number_format($ligneRapportEntre2019etJanvierAnneeImposition->getPrixCessionBrut(), 0) // 217  (213 – 216) ou (213 + 216) Prix de cession net des soultes                   ?></td>
        <td style="text-align: right; border: 1px solid #000"><?= number_format($ligneRapportEntre2019etJanvierAnneeImposition->getPrixCession(), 0) // 218  (213 – 214 – 216) ou  (213 – 214 + 216) Prix de cession net des frais et soults                   ?></td>
        <td style="text-align: right; border: 1px solid #000"><?= number_format($ligneRapportEntre2019etJanvierAnneeImposition->getSommePrixAcquites(), 0) // 220 Prix total d'acquisition (Acquisition fiat depuis c-1                   ?></td>
        <td style="text-align: right; border: 1px solid #000"><?= number_format($ligneRapportEntre2019etJanvierAnneeImposition->getSommeFractionsInitialesCapital(), 0) // 221 Fractions de capital initial contenues dans le prix total d'acquisition                   ?></td>
        <td style="text-align: right; border: 1px solid #000"><?= number_format($ligneRapportEntre2019etJanvierAnneeImposition->getPrixTotalAcquisition(), 0) // 223 (220 – 221 – 222) Prix total d'acquisition net                   ?></td>
        <td style="text-align: right; border: 1px solid #000"><?= ($ligneRapportEntre2019etJanvierAnneeImposition->getPlusOuMoinsValue() > 0) ? '+' : '' ?><?= number_format($ligneRapportEntre2019etJanvierAnneeImposition->getPlusOuMoinsValue(), 0); // ligne 218 – [(ligne 223) x (ligne 217) / (ligne 212)] Plus ou moins value cession                   ?></td>
        <?php //$totalPlusOuMoinsValue += $ligneRapport->getPlusOuMoinsValue(); ?>
        <?php //$totalPrixCession += $ligneRapport->getPrixCession(); ?>
        <?php //$sommeSecondtermePV += ($ligneRapport->getPrixTotalAcquisition() * $ligneRapport->getPrixCessionBrut() / $ligneRapport->getValeurPortefeuille()); ?>
        <?php //$arrayDateCession[] = $ligneRapport->getDateCession()->format('d-m-Y H:i:s') ?>
    </tr>
    </tbody>
    <?php endforeach; ?>
    </table>






    <h3 style="font-size: large">Prix total d'acquisition au 1er janvier 2019
        : <?= number_format($this->totalAcquisitionDebutAnnee, 0) ?> €</h3>

    <h3 style="font-size: large">Prix total d'acquisition au 1er janvier <?= $this->annee ?>
        : <?= number_format($this->totalPrixAcquisitionPremierJanvierAnneeImposition, 0) ?> €</h3>
        : <?= number_format($this->sommePrixAcquitesEntre2019EtJanvierImposition, 0) ?> €</h3>




    <div style="page-break-inside: avoid">
        <h3 style="font-size: large">RECAPITULATIF AU NIVEAU DU FOYER FISCAL (cadre 5)</h3>
        <p style="font-size: large">Total des prix de cession réalisés au niveau du foyer fiscal <sup>51</sup>
            : <?= number_format($totalPrixCession, 0) ?></p>
        <p style="font-size: large">Total des plus-values et moins-values réalisées au niveau du foyer fiscal
            <sup>52</sup>
            : <?= ($totalPlusOuMoinsValue > 0) ? '+' : '' ?><?= number_format($totalPlusOuMoinsValue, 0) ?></p>
        <?php if ($totalPlusOuMoinsValue > 0) : ?>
            <p style="font-size: large">Ce montant est à reporter ligne 3AN de la 2042 C</p>
        <?php elseif ($totalPlusOuMoinsValue < 0): ?>
            <p style="font-size: large">Ce montant est à reporter ligne 3BN de la 2042 C</p>
        <?php endif ?>
    </div>
    <br pagebreak="true"/>
    <?php if ($nombreCession>20): ?>
    <h3 style="font-size: large">(*) Détail des cessions 20 à <?= $nombreCession ?> reportées dans la ligne 20</h3>

    <table style="font-size: medium">
        <?php echo $this->partial('partial/report/table-header-annexe-V'); ?>

        <?= $detailTableauSup20Lignes ?>
        <tr style="font-style: italic; font-weight: bold">
            <td style="text-align: center; border: 1px solid #000"><b>20 (fusion des cessions 20 à <?= $nombreCession ?>
                    )</b></td>
            <td style="text-align: center; border: 1px solid #000">31-12-<?= $this->annee ?></td>
            <td style="text-align: center; border: 1px solid #000">23:59:59</td>

            <td style="text-align: right; border: 1px solid #000"><?= number_format(${212}, 0); ?> <sup>(3)</sup></td>
            <td style="text-align: right; border: 1px solid #000"><?php // 213 ?><?= number_format($sommeCessionBrut, 0); ?>
                <sup>(1)</sup></td>
            <td style="text-align: right; border: 1px solid #000"><?php // 214 ?><?= number_format($sommeFraisCession, 0) ?>
                <sup>(1)</sup></td>
            <td style="text-align: right; border: 1px solid #000"><?php // 215 ?><?= number_format($sommePrixCession, 0) ?>
                <sup>(1)</sup></td>
            <td style="text-align: right; border: 1px solid #000"><?php // 216 ?></td>
            <td style="text-align: right; border: 1px solid #000"><?php // 217 ?><?= number_format($sommePrixCessionEtSoults, 0) ?>
                <sup>(1)</sup></td>
            <?php //${'217b'} = $sommePrixCessionEtSoults ?>
            <td style="text-align: right; border: 1px solid #000;"><?php // 218 ?><?= number_format($sommePrixCession, 0) ?>
                <sup>(1)</sup></td>
            <?php //${'218b'} = $sommePrixCession ?>
            <td style="text-align: right; border: 1px solid #000;"><?php // 220 ?><?= number_format($sommePrixAcquites / ($nbLigneTableauPrincipal - 19), 0) ?>
                <sup>(2)</sup></td>
            <td style="text-align: right; border: 1px solid #000;"><?php // 221 ?><?= number_format($sommeFractionsInitialesCapital / ($nbLigneTableauPrincipal - 19), 0) ?>
                <sup>(2)</sup></td>
            <td style="text-align: right; border: 1px solid #000"><?php // 223 ?><?= number_format($sommePrixTotalAcquisition / ($nbLigneTableauPrincipal - 19), 0) ?>
                <sup>(2)</sup></td>
            <td style="text-align: right; border: 1px solid #000"><?= number_format($sommePlusOuMoinsValue, 0); ?>
                <sup>(1)</sup></td>
        </tr>
    </table>


    <p><sup>(1)</sup> Somme des cessions 20 à <?= $nombreCession ?></p>
    <p><sup>(2)</sup> Moyenne des cessions 20 à <?= $nombreCession ?></p>
    <h3><sup>(3)</sup> Calcul de la valeur du porte feuille moyen corrigé (212) des cessions 20 à <?= $nombreCession ?>
    </h3>

    <p>Plue-value = case
        <inf>218</inf>
        - (case
        <inf>223</inf>
        X case
        <inf>217</inf>
        / case
        <inf>212</inf>
        )
    </p>
    <p>case
        <inf>212</inf>
        = case
        <inf>223</inf>
        X case
        <inf>217</inf>
        / (case
        <inf>218</inf>
        - Plue-value)
    </p>
    <p>case
        <inf>212</inf>
        = <?= ${223} ?> x <?= ${217} ?> / ( <?= ${218} ?> - <?= $PV ?> )
    </p>
    <p>case
        <inf>212</inf>
        = <?= number_format(${223} * ${217} / (${218} - $PV), 0) ?></p>
    <?php ${212} = ${223} * ${217} / (${218} - $PV) ?>

    <br pagebreak="true"/>
    <?php endif ?>

    <h3 style="font-size: large">Total de fiat investit dans la crypto entre deux cessions de crypto</h3>
    <table style="border: 1px solid #000; font-size: large">
        <tr>
            <td style="text-align: center; border: 1px solid #000">Date</td>
            <td style="text-align: center; border: 1px solid #000">Investissement total cumulé en EUR entre 2 cessions
            </td>

        </tr>

        <?php foreach ($this->arrayAcquisitionFiatAvantDateCession as $date => $infosAcquisition) : ?>
            <?php foreach ($infosAcquisition as $key => $arrayInfos) : ?>
                <tr>
                    <td style="text-align: center; border: 1px solid #000"><?= $arrayInfos['datetime']->format('d-m-Y H:i:s') ?></td>
                    <td style="text-align: center; border: 1px solid #000"><?= number_format($arrayInfos['totalEUR'], 0) ?></td>
                </tr>
            <?php endforeach ?>
        <?php endforeach ?>
    </table>


    <h3 style="font-size: large">Total de fiat investit dans la crypto entre deux cessions de crypto avant l'année d'imposition</h3>
    <table style="border: 1px solid #000; font-size: large">
        <tr>
            <td style="text-align: center; border: 1px solid #000">Date</td>
            <td style="text-align: center; border: 1px solid #000">Investissement total cumulé en EUR entre 2 cessions
            </td>

        </tr>

        <?php foreach ($this->arrayAcquisitionFiatAvantDateCessionEntre2019etJanvierAnneeImposition as $date => $infosAcquisition) : ?>
            <?php foreach ($infosAcquisition as $key => $arrayInfos) : ?>
                <tr>
                    <td style="text-align: center; border: 1px solid #000"><?= $arrayInfos['datetime']->format('d-m-Y H:i:s') ?></td>
                    <td style="text-align: center; border: 1px solid #000"><?= number_format($arrayInfos['totalEUR'], 0) ?></td>
                </tr>
            <?php endforeach ?>
        <?php endforeach ?>
    </table>

    <h3 style="font-size: large">Détail fiat investit dans la crypto entre deux cessions de crypto</h3>
    <?php $tmpInvestFiatAfter2019Detail = $this->investFiatAfter2019Detail; ?>
    <?php $lastDateCession = new \Datetime($this->annee . '-01-01 00:00:00') ?>
    <?php foreach ($this->arrayAcquisitionFiatAvantDateCession as $date => $infosAcquisition) : ?>
        <?php foreach ($infosAcquisition as $key => $arrayInfos) : ?>
            <?php //$currentDateCession= array_shift($arrayDateCession);?>
            <?php $currentDateCession = $arrayInfos['datetime']; ?>
            <div style="page-break-inside: avoid">
                <h4 style="font-size: large">Acquisition cumulée en EUR
                    entre <?= $lastDateCession->format('d-m-Y H:i:s') ?>
                    et <?= $arrayInfos['datetime']->format('d-m-Y H:i:s') . ' : ' . number_format($arrayInfos['totalEUR'], 0) . ' EUR' ?></h4>
                <?php $lastDateCession = $currentDateCession; ?>
                <table style="border: 1px solid #000; font-size: large">
                    <tr>
                        <td style="text-align: center; border: 1px solid #000">Date</td>
                        <td style="text-align: center; border: 1px solid #000">Investissement Fiat</td>
                        <td style="text-align: center; border: 1px solid #000">Conversion EUR</td>
                        <td style="text-align: center; border: 1px solid #000">Total cumulé EUR entre 2 cessions</td>
                    </tr>
                    <?php $totalEURCumuleDeuxCessions = 0; ?>
                    <?php foreach ($tmpInvestFiatAfter2019Detail as $key => $infos) : ?>
                        <?php if ($infos['datetime'] <= $arrayInfos['datetime']) : ?>

                            <?php $totalEURCumuleDeuxCessions += $infos['qteEUR']; ?>

                            <tr>
                                <td style="text-align: center; border: 1px solid #000"><?php echo $infos['datetime']->format('d-m-Y H:i:s') ?></td>
                                <td style="text-align: center; border: 1px solid #000"><?= number_format($infos['qte'], 0) . ' ' . $infos['code'] ?></td>
                                <td style="text-align: center; border: 1px solid #000"><?= number_format($infos['qteEUR'], 0) ?></td>
                                <td style="text-align: center; border: 1px solid #000"><?= number_format($totalEURCumuleDeuxCessions, 0) ?></td>
                            </tr>
                            <?php unset($tmpInvestFiatAfter2019Detail[$key]) ?>

                        <?php else : ?>
                            <?php break; ?>
                        <?php endif ?>
                    <?php endforeach ?>
                </table>
            </div>
        <?php endforeach ?>
    <?php endforeach ?>


    <h2 style="font-size: large">Valeur du portefeuille lors des cessions en <?= $this->annee ?></h2>
    <?php foreach ($this->arrayValuesWalletEUR as $cessionIndex => $arrayCessionWalletDetail) : ?>

        <div style="page-break-inside: avoid">
            <h4 style="font-size: large">Valeur du portefeuille de la cession <?= ($cessionIndex + 1) ?>
                du <?= $arrayCessionWalletDetail['datetime']->format('d-m-Y H:i:s') ?></h4>

            <table style="border: 1px solid #000; font-size: large">
                <?php $totalWalletCession = 0; ?>
                <tr>
                    <td style="text-align: center; border: 1px solid #000">
                        Devise
                    </td>
                    <td style="text-align: center; border: 1px solid #000">
                        Qté
                    </td>
                    <td style="text-align: center; border: 1px solid #000">
                        Prix unitaire
                    </td>
                    <td style="text-align: center; border: 1px solid #000">
                        Total
                    </td>
                </tr>
                <?php foreach ($arrayCessionWalletDetail['wallet'] as $wallet) : ?>
                    <tr>
                        <td style="text-align: center; border: 1px solid #000">
                            <?= $wallet['devise'] ?>
                        </td>
                        <td style="text-align: right; border: 1px solid #000">
                            <?= $wallet['qty'] ?>
                        </td>
                        <td style="text-align: right; border: 1px solid #000">
                            <?= number_format($wallet['unitPrice'], 2) ?>
                        </td>
                        <td style="text-align: right; border: 1px solid #000">
                            <?= number_format($wallet['total'], 2) ?>
                        </td>
                        <?php $totalWalletCession += $wallet['total'] ?>
                    </tr>
                <?php endforeach; ?>
                <tr>
                    <td>

                    </td>
                    <td>

                    </td>
                    <td>

                    </td>
                    <td style="text-align: right; border: 1px solid #000">
                        <b style="font-size: 10px"><?= number_format($totalWalletCession, 2) ?></b>
                    </td>

                </tr>
            </table>
        </div>
    <?php endforeach; ?>

    <div style="page-break-inside: avoid">
    <h3>Détail des cessions en fiat</h3>
    <table style="border: 1px solid #000; font-size: large">
        <tr>
            <td style="text-align: center; border: 1px solid #000">
                #
            </td>
            <td style="text-align: center; border: 1px solid #000">
                Date
            </td>
            <td style="text-align: center; border: 1px solid #000">
                Echange
            </td>
            <td style="text-align: center; border: 1px solid #000">
                Montant échangé
            </td>
            <td style="text-align: center; border: 1px solid #000">
                Asset échangé
            </td>
            <td style="text-align: center; border: 1px solid #000">
                Montant reçu
            </td>
            <td style="text-align: center; border: 1px solid #000">
                Asset reçu
            </td>
        </tr>
        <?php $lignecessionannee = 1; ?>
        <?php foreach ($this->arrayTransactionsCessionFiatAnneeImposition as $key => $arrayTransaction) : ?>
        <?php $startAnneeRapport = new DateTime($this->annee . '-01-01 00:00:00');
        $endAnneeRapport = new DateTime($this->annee . '-12-31 23:59:59'); ?>

        <?php if ($arrayTransaction['datetime'] >= $startAnneeRapport && $arrayTransaction['datetime'] <= $endAnneeRapport) : ?>
            <tr>
                <td style="text-align: center; border: 1px solid #000">
                    <?= $lignecessionannee++ ?>
                </td>
                <td style="text-align: center; border: 1px solid #000">
                    <?= $arrayTransaction['datetime']->format('d-m-Y H:i:s') ?>
                </td>
                <td style="text-align: center; border: 1px solid #000">
                    <?= $arrayTransaction['exchangeName'] ?>
                </td>
                <td style="text-align: center; border: 1px solid #000">
                    <?= $arrayTransaction['qtyOut'] ?>
                </td>
                <td style="text-align: center; border: 1px solid #000">
                    <?= $arrayTransaction['deviseOut']->getCode() ?>
                </td>
                <td style="text-align: center; border: 1px solid #000">
                    <?= $arrayTransaction['qtyIn'] ?>
                </td>
                <td style="text-align: center; border: 1px solid #000">
                    <?= $arrayTransaction['deviseIn']->getCode() ?>
                </td>
            </tr>
        <?php endif ?>
        <?php endforeach ?>
    </table>
    </div>


    <h3>Détail des cessions composées de plusieurs transactions importées</h3>
    <?php foreach ($this->arrayDetailFusionLigneMemeDateMemeAsset as $key => $arrayMultiline) : ?>
        <?php if (!empty($arrayMultiline)) : ?>
            <div style="page-break-inside: avoid">
                <h3>Détail cession <?= $key + 1 ?></h3>
                <table style="border: 1px solid #000; font-size: large">
                    <tr>
                        <td style="text-align: center; border: 1px solid #000">
                            #
                        </td>
                        <td style="text-align: center; border: 1px solid #000">
                            Date
                        </td>
                        <td style="text-align: center; border: 1px solid #000">
                            Echange
                        </td>
                        <td style="text-align: center; border: 1px solid #000">
                            Montant échangé
                        </td>
                        <td style="text-align: center; border: 1px solid #000">
                            Asset échangé
                        </td>
                        <td style="text-align: center; border: 1px solid #000">
                            Montant reçu
                        </td>
                        <td style="text-align: center; border: 1px solid #000">
                            Asset reçu
                        </td>
                        <td style="text-align: center; border: 1px solid #000">
                            Montant frais
                        </td>
                        <td style="text-align: center; border: 1px solid #000">
                            Asset frais
                        </td>
                        <td style="text-align: center; border: 1px solid #000">
                            Montant frais EUR
                        </td>
                    </tr>

                    <?php $totalFeesAmount=0; ?>
                    <?php $totalFeesEUR=0; ?>
                    <?php $totalTradedAmount=0; ?>
                    <?php $totalReceivedAmount=0; ?>
                    <?php foreach ($arrayMultiline as $index => $arrayTransaction) : ?>
                    <?php $totalFeesAmount += $arrayTransaction->feesAmount; ?>
                    <?php $totalTradedAmount += $arrayTransaction->tradedAmount; ?>
                    <?php $totalReceivedAmount += $arrayTransaction->receivedAmount; ?>
                    <?php $totalFeesEUR += $arrayTransaction->feesEUR; ?>
                        <tr>
                            <td style="text-align: center; border: 1px solid #000">
                                <?= $index + 1 ?>
                            </td>
                            <td style="text-align: center; border: 1px solid #000">
                                <?php $datetimeTransaction = new \Datetime($arrayTransaction->datetimeTransaction->date); ?>
                                <?= $datetimeTransaction->format('d-m-Y H:i:s') ?>
                            </td>
                            <td style="text-align: center; border: 1px solid #000">
                                <?= $arrayTransaction->exchange->name ?>
                            </td>
                            <td style="text-align: center; border: 1px solid #000">
                                <?= $arrayTransaction->tradedAmount ?>
                            </td>
                            <td style="text-align: center; border: 1px solid #000">
                                <?= $arrayTransaction->tradedCurrency ?>
                            </td>
                            <td style="text-align: center; border: 1px solid #000">
                                <?= $arrayTransaction->receivedAmount ?>
                            </td>
                            <td style="text-align: center; border: 1px solid #000">
                                <?= $arrayTransaction->receivedCurrency ?>
                            </td>
                            <td style="text-align: center; border: 1px solid #000">
                                <?= $arrayTransaction->feesAmount ?>
                            </td>
                            <td style="text-align: center; border: 1px solid #000">
                                <?= $arrayTransaction->feesCurrency ?>
                            </td>
                            <td style="text-align: center; border: 1px solid #000">
                                <?= number_format($arrayTransaction->feesEUR, 0) ?>
                            </td>
                        </tr>
                    <?php endforeach ?>
                    <tr>
                        <td style="text-align: center; border: 1px solid #000">
                            Total
                        </td>
                        <td style="text-align: center; border: 1px solid #000">
                            <?php $datetimeTransaction = new \Datetime($arrayTransaction->datetimeTransaction->date); ?>
                            <?= $datetimeTransaction->format('d-m-Y H:i:s') ?>
                        </td>
                        <td style="text-align: center; border: 1px solid #000">
                            <?= $arrayTransaction->exchange->name ?>
                        </td>
                        <td style="text-align: center; border: 1px solid #000">
                            <?= $totalTradedAmount ?>
                        </td>
                        <td style="text-align: center; border: 1px solid #000">
                            <?= $arrayTransaction->tradedCurrency ?>
                        </td>
                        <td style="text-align: center; border: 1px solid #000">
                            <?= $totalReceivedAmount ?>
                        </td>
                        <td style="text-align: center; border: 1px solid #000">
                            <?= $arrayTransaction->receivedCurrency ?>
                        </td>
                        <td style="text-align: center; border: 1px solid #000">
                            <?= $totalFeesAmount ?>
                        </td>
                        <td style="text-align: center; border: 1px solid #000">
                            <?= $arrayTransaction->feesCurrency ?>
                        </td>
                        <td style="text-align: center; border: 1px solid #000">
                            <?= number_format($totalFeesEUR, 0) ?>
                        </td>
                    </tr>
                </table>
            </div>
        <?php endif ?>
    <?php endforeach ?>
    <br pagebreak="true"/>
    <h1>Sources utilisées</h1>
    <?php foreach ($this->arrayImport as $import) : ?>
        <?php
        $contentFile = file_get_contents($import->getPath());
        //var_dump($content);
        $linesArray = explode("\n", $contentFile); ?>
        <table>
            <?php foreach ($linesArray as $index => $row) : ?>
                <?php $arrayLine = str_getcsv($row); ?>
                <?php if (count($arrayLine) > 1): ?>
                    <?php if ($index == 0) : ?>
                    <thead>
                    <tr>
                        <?php foreach ($arrayLine as $field) : ?>
                            <td style="text-align: center; border: 1px solid #000000"><?= $field ?></td>
                        <?php endforeach ?>
                    </tr>
                    </thead>
                    <?php else : ?>
                    <?php $linehtml = '<tr>'; ?>

                            <?php foreach ($arrayLine as $indexfield => $field) : ?>
<?php if ($indexfield == 0) { $dateLine = new DateTime($field); } ?>
                            <?php $linehtml .= '<td style="text-align: center; border: 1px solid #000000">' . $field . '</td>'; ?>
                            <?php endforeach ?>
                        <?php $linehtml .= '</tr>'; ?>

                    <?php if($dateLine <= $endAnneeRapport) { echo $linehtml; } ?>
                    <?php endif ?>
                <?php endif ?>
            <?php endforeach ?>
        </table>
    <?php endforeach; ?>


    </body>
</html>


??

??