?? 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.phtml

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

<html lang="en">

<body>


<h1>Tableau du formulaire n° 2086 (chiffres à reporter dans votre déclaration en ligne dans les délais)</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 Evolution du prix d'acquisition< 19 ?>
        <?php if ($nbLigneTableauPrincipal < ($this->typeFusion - 1)) : ?>

            <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"><?= $this->amount($ligneRapport->getValeurPortefeuille(), 'fiat-no-cents'); // 212 Valeur du portefeuille au moment de la cession                        ?></td>
                <td style="text-align: right; border: 1px solid #000"><?= $this->amount($ligneRapport->getPrixCessionBrut(), 'fiat-no-cents') // 213 Prix de cession                        ?></td>
                <td style="text-align: right; border: 1px solid #000"><?= $this->amount($ligneRapport->getFraisCession(), 'fiat-no-cents') // 214 Frais de cession                        ?></td>
                <td style="text-align: right; border: 1px solid #000"><?= $this->amount($ligneRapport->getPrixCession(), 'fiat-no-cents')// 215 Prix de cession net des frais                        ?></td>
<!--                <td style="text-align: right; border: 1px solid #000">--><?//= intval(str_replace(' ', '', $this->amount($ligneRapport->getPrixCessionBrut(), 'fiat-no-cents'))) - intval(str_replace(' ', '', $this->amount($ligneRapport->getFraisCession(), 'fiat-no-cents')))  // 215 Prix de cession net des frais                        ?><!--</td>-->
                <td style="text-align: right; border: 1px solid #000">
                    0<?php // 216 Soulte reçue ou versée lors de la cession ?></td>
                <td style="text-align: right; border: 1px solid #000">
                    0<?php // 222 Soultes reçues en cas d’échanges antérieurs à la cession ?></td>
                <td style="text-align: right; border: 1px solid #000"><?= $this->amount($ligneRapport->getPrixCessionBrut(), 'fiat-no-cents') // 217  (213 – 216) ou (213 + 216) Prix de cession net des soultes                        ?></td>
                <td style="text-align: right; border: 1px solid #000"><?= $this->amount($ligneRapport->getPrixCession(), 'fiat-no-cents') // 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">--><?//= intval(str_replace(' ', '', $this->amount($ligneRapport->getPrixCessionBrut(), 'fiat-no-cents'))) - intval(str_replace(' ', '', $this->amount($ligneRapport->getFraisCession(), 'fiat-no-cents'))) // 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"><?= $this->amount($ligneRapport->getSommePrixAcquites(), 'fiat-no-cents') // 220 Prix total d'acquisition (Acquisition fiat depuis c-1                        ?></td>
                <td style="text-align: right; border: 1px solid #000"><?= $this->amount($ligneRapport->getSommeFractionsInitialesCapital(), 'fiat-no-cents') // 221 Fractions de capital initial contenues dans le prix total d'acquisition                        ?></td>
                <td style="text-align: right; border: 1px solid #000"><?= $this->amount($ligneRapport->getPrixTotalAcquisition(), 'fiat-no-cents') // 223 (220 – 221 – 222) Prix total d'acquisition net                        ?></td>
                <td style="text-align: right; border: 1px solid #000"><?= ($ligneRapport->getPlusOuMoinsValue() > 0) ? '+' : '' ?><?= $this->amount($ligneRapport->getPlusOuMoinsValue(), 'fiat-no-cents'); // 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
        $lastDateCession20LignesPlus = $ligneRapport->getDateCession();
            $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">' . $this->amount($ligneRapport->getValeurPortefeuille(), 'fiat-no-cents') . '</td>';
            $detailTableauSup20Lignes .= '<td style="text-align: right; border: 1px solid #000">' . $this->amount($ligneRapport->getPrixCessionBrut(), 'fiat-no-cents') . '</td>';
            $detailTableauSup20Lignes .= '<td style="text-align: right; border: 1px solid #000">' . $this->amount($ligneRapport->getFraisCession(), 'fiat-no-cents') . '</td>';
            $detailTableauSup20Lignes .= '<td style="text-align: right; border: 1px solid #000">' . $this->amount($ligneRapport->getPrixCession(), 'fiat-no-cents') . '</td>';

            $detailTableauSup20Lignes .= '<td style="text-align: right; border: 1px solid #000">0</td>';
            $detailTableauSup20Lignes .= '<td style="text-align: right; border: 1px solid #000">0</td>';
            $detailTableauSup20Lignes .= '<td style="text-align: right; border: 1px solid #000">' . $this->amount($ligneRapport->getPrixCessionBrut(), 'fiat-no-cents') . '</td>';
            $detailTableauSup20Lignes .= '<td style="text-align: right; border: 1px solid #000">' . $this->amount($ligneRapport->getPrixCession(), 'fiat-no-cents') . '</td>';
            $detailTableauSup20Lignes .= '<td style="text-align: right; border: 1px solid #000">' . $this->amount($ligneRapport->getSommePrixAcquites(), 'fiat-no-cents') . '</td>';
            $detailTableauSup20Lignes .= '<td style="text-align: right; border: 1px solid #000000">' . $this->amount($ligneRapport->getSommeFractionsInitialesCapital(), 'fiat-no-cents') . '</td>';
            $detailTableauSup20Lignes .= '<td style="text-align: right; border: 1px solid #000">' . $this->amount($ligneRapport->getPrixTotalAcquisition(), 'fiat-no-cents') . '</td>';
            $detailTableauSup20Lignes .= '<td style="text-align: right; border: 1px solid #000">' . (($ligneRapport->getPlusOuMoinsValue() > 0) ? '+' : '') . $this->amount($ligneRapport->getPlusOuMoinsValue(), 'fiat-no-cents') . '</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="">
            <td style="text-align: center; border: 1px solid #000"><?= $this->typeFusion ?><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"><?= $lastDateCession20LignesPlus->format('d-m-Y') ?></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* */ ?><?= $this->amount(${212}, 'fiat-no-cents'); // Valeur du portefeuille juste avant c                           ?></td>
            <td style="text-align: right; border: 1px solid #000"><?php /*213* */ ?><?= $this->amount($sommeCessionBrut, 'fiat-no-cents') // Prix de cession brut                           ?></td>
            <td style="text-align: right; border: 1px solid #000"><?php /*214* */ ?><?= $this->amount($sommeFraisCession, 'fiat-no-cents') //Frais de cession                           ?></td>
            <td style="text-align: right; border: 1px solid #000"><?php /*215* */ ?><?= $this->amount($sommePrixCession, 'fiat-no-cents') //Prix d'acquisition c-1                           ?></td>
            <td style="text-align: right; border: 1px solid #000">0<?php /*216* */ ?></td>
            <td style="text-align: right; border: 1px solid #000">
                0<?php // 222 Soultes reçues en cas d’échanges antérieurs à la cession ?></td>
            <td style="text-align: right; border: 1px solid #000"><? /*217* */ ?><?= $this->amount($sommePrixCessionEtSoults, 'fiat-no-cents') ?></td>
            <td style="text-align: right; border: 1px solid #000"><?php /* 218* */ ?><?= $this->amount($sommePrixCession, 'fiat-no-cents') //Prix d'acquisition c-1                           ?></td>
            <td style="text-align: right; border: 1px solid #000"><?php /* 220*/ ?><?= $this->amount($sommePrixAcquites / ($nbLigneTableauPrincipal - 19), 'fiat-no-cents') // Acquisition fiat depuis c-1                           ?></td>
            <td style="text-align: right; border: 1px solid #000"><?php /* 221*/ ?><?= $this->amount($sommeFractionsInitialesCapital / ($nbLigneTableauPrincipal - 19), 'fiat-no-cents') // Valeur nominale c-1                           ?></td>
            <td style="text-align: right; border: 1px solid #000"><?php /* 223*/ ?><?= $this->amount($sommePrixTotalAcquisition / ($nbLigneTableauPrincipal - 19), 'fiat-no-cents') // Valeur nominale c-1                           ?></td>
            <td style="text-align: right; border: 1px solid #000"><?= (($sommePlusOuMoinsValue > 0) ? '+' : '') . $this->amount($sommePlusOuMoinsValue, 'fiat-no-cents'); //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=""><?= ($totalPlusOuMoinsValue > 0) ? '+' : '' ?><?= $this->amount($totalPlusOuMoinsValue, 'fiat-no-cents') ?></b>
            </td>
        </tr>
    </tfooter>
</table>

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


<?php /*<h3 style="font-size: large">Prix total d'acquisition au 1er janvier <?= $this->annee ?>
        : <?= $this->amount($this->totalAcquisitionDebutAnnee, 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>
        : <?= $this->amount($totalPrixCession, 'fiat-no-cents') ?></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) ? '+' : '' ?><?= $this->amount($totalPlusOuMoinsValue, 'fiat-no-cents') ?>
    </p>
    <?php if ($totalPrixCession <= 305) : ?>
        <p style="font-size: large; font-weight:bold">Le montant total des prix de cessions étant inférieur ou égal à
            305 € il y a exonération</p>
    <?php else : ?>
        <?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 ?>
    <?php endif ?>
</div>
<br pagebreak="true"/>
<?php if ($nombreCession > $this->typeFusion): ?>
    <h3 style="font-size: large">(*) Détail des cessions <?= $this->typeFusion ?> à <?= $nombreCession ?> reportées dans la ligne <?= $this->typeFusion ?></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><?= $this->typeFusion ?> (fusion des cessions <?= $this->typeFusion ?> à <?= $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"><?= $this->amount(${212}, 'fiat-no-cents'); ?> <sup>(3)</sup>
            </td>
            <td style="text-align: right; border: 1px solid #000"><?php // 213 ?><?= $this->amount($sommeCessionBrut, 'fiat-no-cents'); ?>
                <sup>(1)</sup></td>
            <td style="text-align: right; border: 1px solid #000"><?php // 214 ?><?= $this->amount($sommeFraisCession, 'fiat-no-cents') ?>
                <sup>(1)</sup></td>
            <td style="text-align: right; border: 1px solid #000"><?php // 215 ?><?= $this->amount($sommePrixCession, 'fiat-no-cents') ?>
                <sup>(1)</sup></td>
            <td style="text-align: right; border: 1px solid #000">
                0<?php // 216 Soulte reçue ou versée lors de la cession l20 ?>
            </td>
            <td style="text-align: right; border: 1px solid #000">
                0<?php // 222 Soultes reçues en cas d’échanges antérieurs à la cession l20 ?>
            </td>
            <td style="text-align: right; border: 1px solid #000"><?php // 217 ?><?= $this->amount($sommePrixCessionEtSoults, 'fiat-no-cents') ?>
                <sup>(1)</sup></td>
            <?php //${'217b'} = $sommePrixCessionEtSoults ?>
            <td style="text-align: right; border: 1px solid #000;"><?php // 218 ?><?= $this->amount($sommePrixCession, 'fiat-no-cents') ?>
                <sup>(1)</sup></td>
            <?php //${'218b'} = $sommePrixCession ?>
            <td style="text-align: right; border: 1px solid #000;"><?php // 220 ?><?= $this->amount($sommePrixAcquites / ($nbLigneTableauPrincipal - 19), 'fiat-no-cents') ?>
                <sup>(2)</sup></td>
            <td style="text-align: right; border: 1px solid #000;"><?php // 221 ?><?= $this->amount($sommeFractionsInitialesCapital / ($nbLigneTableauPrincipal - 19), 'fiat-no-cents') ?>
                <sup>(2)</sup></td>
            <td style="text-align: right; border: 1px solid #000"><?php // 223 ?><?= $this->amount($sommePrixTotalAcquisition / ($nbLigneTableauPrincipal - 19), 'fiat-no-cents') ?>
                <sup>(2)</sup></td>
            <td style="text-align: right; border: 1px solid #000"><?= $this->amount($sommePlusOuMoinsValue, 'fiat-no-cents'); ?>
                <sup>(1)</sup></td>
        </tr>
    </table>


    <p><sup>(1)</sup> Somme des cessions <?= $this->typeFusion ?> à <?= $nombreCession ?></p>
    <p><sup>(2)</sup> Moyenne des cessions <?= $this->typeFusion ?> à <?= $nombreCession ?></p>
    <h3><sup>(3)</sup> Calcul de la valeur du portefeuille moyen corrigé (212) des cessions <?= $this->typeFusion ?> à <?= $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>
        = <?= $this->amount(${223} * ${217} / (${218} - $PV), 'fiat-no-cents') ?></p>
    <?php ${212} = ${223} * ${217} / (${218} - $PV) ?>

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










<?php $t = 1; ?>
<?php $tt = 1; ?>
<?php // Début Détermination des valeurs globales du portefeuille au moment des cessions (212) ?>
<h1><?= $t ?>) Détermination des valeurs globales du portefeuille au moment des cessions (212)
    en <?= $this->annee ?></h1>


<h2><?= $t ?>.<?= $tt ?>) Evolution du portefeuille dans le temps</h2>

<?php $ttt = 1 ?>
<?php foreach ($this->arrayExplicationWalletApres2019 as $cryptoCode => $arrayInfosWallet) : ?>
    <div style="page-break-inside: avoid">
        <h3><?= $t ?>.<?= $tt ?>.<?= $ttt++ ?>) Evolution de la quantité de <?= $cryptoCode ?> détenue dans le
            portefeuille</h3>
        <table style="border: 1px solid #000; font-size: large">
            <thead>
            <tr>
                <td style="text-align: center; border: 1px solid #000">
                    Date
                </td>
                <td style="text-align: center; border: 1px solid #000">
                    Qté entrée
                </td>
                <td style="text-align: center; border: 1px solid #000">
                    Qté sortie
                </td>
                <td style="text-align: center; border: 1px solid #000">
                    Cumul avant transaction
                </td>
                <td style="text-align: center; border: 1px solid #000">
                    Cumul après transaction
                </td>
            </tr>
            </thead>
            <tbody>
            <?php foreach ($arrayInfosWallet as $indexInfos => $infoCumul) : ?>
                <tr>
                    <td style="text-align: center; border: 1px solid #000">
                        <?= $infoCumul['dateTime']->format('d-m-Y H:i:s') ?>
                    </td>
                    <td style="text-align: right; border: 1px solid #000">
                        <?= isset($infoCumul['qteIn']) ? $this->amount($infoCumul['qteIn'], 'fiat') : '-' ?>
                    </td>
                    <td style="text-align: right; border: 1px solid #000">
                        <?= isset($infoCumul['qteOut']) ? $this->amount($infoCumul['qteOut'], 'fiat') : '-' ?>
                    </td>
                    <td style="text-align: right; border: 1px solid #000">
                        <?= $this->amount($infoCumul['cumulAvantTransaction'], 'fiat') ?>
                    </td>
                    <td style="text-align: right; border: 1px solid #000">
                        <?= $this->amount($infoCumul['cumulApresTransaction'], 'fiat') ?>
                    </td>
                </tr>
            <?php endforeach ?>
            </tbody>
        </table>
    </div>
<?php endforeach ?>

<br pagebreak="true"/>


<?php $tt++; ?>
<?php $ttt = 1 ?>
<?php $indexEvolutionCryptoPortefeuille = 1 ?>
<h2><?= $t ?>.<?= $tt ?>) Calcul de la valeur globale du portefeuille à chaque cession imposable</h2>
<?php foreach ($this->arrayValuesWalletEUR as $cessionIndex => $arrayCessionWalletDetail) : ?>
    <?php if ($arrayCessionWalletDetail['datetime']->format('Y') === $this->annee): ?>
        <div style="page-break-inside: avoid">
            <h3><?= $t ?>.<?= $tt ?>.<?= $ttt++ ?>) Calcul de la valeur globale du portefeuille de la cession <?= $indexEvolutionCryptoPortefeuille ?> du <?= $arrayCessionWalletDetail['datetime']->format('d-m-Y H:i:s') ?></h3>
            <table style="font-size: large">
                <?php $totalWalletCession = 0; ?>
                <thead>
                <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>
                </thead>
                <!--                    <td style="text-align: center; border: 1px solid #000">-->
                <!--                        Total-->
                <!--                    </td>-->
                <!--                    <td style="text-align: center; border: 1px solid #000">-->
                <!--                        Total Reel-->
                <!--                    </td>-->
                <?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">
                            <?= $this->amount($wallet['qty'], 'crypto') ?>
                        </td>
                        <td style="text-align: right; border: 1px solid #000">
                            <?= $this->amount($wallet['unitPrice'], 'crypto') ?>
                        </td>
                        <!--                        <td style="text-align: right; border: 1px solid #000">-->
                        <!--                            --><? //= !empty($wallet['totalReel']) ? $this->amount($wallet['totalReel'], 'crypto') : $this->amount($wallet['total'], 'crypto') ?>
                        <!--                        </td>-->
                        <td style="text-align: right; border: 1px solid #000">
                            <?= !empty($wallet['total']) ? $this->amount($wallet['total'], 'crypto') : 0 ?>
                        </td>
                        <!--                    <td style="text-align: right; border: 1px solid #000">-->
                        <!--                        --><? //= !empty($wallet['totalReel']) ? $this->amount($wallet['totalReel'], 'crypto') : 0 ?>
                        <!--                    </td>-->

                        <?php //$totalWalletCession += !empty($wallet['totalReel']) ? $wallet['totalReel'] : $wallet['total'] ?>
                        <?php $totalWalletCession += !empty($wallet['total']) ? $wallet['total'] : 0 ?>
                    </tr>
                <?php endforeach; ?>
                <tr>
                    <td colspan="4">
                    </td>
                </tr>
                <tr>
                    <td>

                    </td>
                    <td>

                    </td>
                    <td style="text-align: right; border: 1px solid #000">
                        Total
                    </td>
                    <td style="text-align: right; border: 1px solid #000">
                        <?= $this->amount($totalWalletCession, 'crypto') ?>
                    </td>

                </tr>
                <tr>
                    <td>

                    </td>
                    <td>

                    </td>
                    <td style="text-align: right; border: 3px solid #000">

                        <b style="font-size: 10px">case 212 - cession <?= $indexEvolutionCryptoPortefeuille ?></b>
                    </td>
                    <td style="text-align: right; border: 3px solid #000">

                        <b style="font-size: 10px"><?= $this->amount($totalWalletCession, 'fiat-no-cents') ?></b>
                    </td>

                </tr>
            </table>
        </div>
    <?php $indexEvolutionCryptoPortefeuille++ ?>
    <?php endif ?>
<?php endforeach; ?>

<?php // Fin Détermination des valeurs globales du portefeuille au moment des cessions (212) ?>





<?php // Début Détermination des prix de cession (213), des frais de cession (214) et des prix de cession net des frais (215) ?>
<?php $t++; ?>
<?php $tt = 1 ?>
<?php $ttt = 1 ?>
<h1><?= $t ?>) Détermination des prix de cession (213), des frais de cession (214) et des prix de cession net des frais
    (215)</h1>
<h2><?= $t ?>.<?= $tt ?>) Détail des cessions composées de plusieurs transactions</h2>
<?php foreach ($this->arrayDetailFusionLigneMemeDateMemeAsset as $key => $arrayMultiline) : ?>
    <?php if (!empty($arrayMultiline)) : ?>
        <div style="page-break-inside: avoid">
            <?php $cessionIndex = $key + 1 ?>
            <h3><?= $t ?>.<?= $tt ?>.<?= $ttt++ ?>) Détail cession <?= $cessionIndex ?></h3>
            <table style="padding: 2px">
                <tr>
                    <td style="text-align: center; border: 1px solid #000; padding: 2px">
                        #
                    </td>
                    <td style="text-align: center; border: 1px solid #000; padding: 2px;">
                        Date
                    </td>
                    <td style="text-align: center; border: 1px solid #000; padding: 2px;">
                        Echange
                    </td>
                    <td style="text-align: center; border: 1px solid #000; padding: 2px;">
                        Montant échangé
                    </td>
                    <td style="text-align: center; border: 1px solid #000; padding: 2px;">
                        Monnaie échangée
                    </td>
                    <td style="text-align: center; border: 1px solid #000; padding: 2px;">
                        Montant reçu
                    </td>
                    <td style="text-align: center; border: 1px solid #000">
                        Monnaie reçue
                    </td>
                    <td style="text-align: center; border: 1px solid #000">
                        Montant reçu EUR
                    </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>
                    <td style="text-align: center; border: 1px solid #000">
                        Soulte reçue ou versée
                    </td>
                </tr>

                <?php $totalFeesAmount = 0; ?>
                <?php $totalFeesEUR = 0; ?>
                <?php $totalTradedAmount = 0; ?>
                <?php $totalReceivedAmount = 0; ?>
                <?php $totalReceivedAmountInEUR = 0; ?>
                <?php foreach ($arrayMultiline as $index => $arrayTransaction) : ?>
                    <?php $totalFeesAmount += $arrayTransaction->feesAmount; ?>
                    <?php $totalTradedAmount += $arrayTransaction->tradedAmount; ?>
                    <?php $totalReceivedAmount += $arrayTransaction->receivedAmount; ?>
                    <?php $totalReceivedAmountInEUR += $arrayTransaction->receivedAmountInEUR; ?>
                    <?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; font-size: 6px">
                            <?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: right; border: 1px solid #000">
                            <?= $this->amount($arrayTransaction->tradedAmount, 5) ?>
                        </td>
                        <td style="text-align: center; border: 1px solid #000">
                            <?= $arrayTransaction->tradedCurrency == 'FRAISANNUEL' ? 'Frais annuels de transaction' : $arrayTransaction->tradedCurrency ?>
                        </td>
                        <td style="text-align: right; border: 1px solid #000">
                            <?= $this->amount($arrayTransaction->receivedAmount, 'fiat') ?>
                        </td>
                        <td style="text-align: center; border: 1px solid #000">
                            <?= $arrayTransaction->receivedCurrency ?>
                        </td>
                        <td style="text-align: center; border: 1px solid #000">
                            <?= $this->amount($arrayTransaction->receivedAmountInEUR, 'fiat') ?>
                        </td>
                        <td style="text-align: right; border: 1px solid #000">
                            <?= $this->amount($arrayTransaction->feesAmount, 'fiat') ?>
                        </td>
                        <td style="text-align: center; border: 1px solid #000">
                            <?= $arrayTransaction->feesCurrency ?>
                        </td>
                        <td style="text-align: right; border: 1px solid #000">
                            <?= $this->amount($arrayTransaction->feesEUR, 'fiat') ?>
                        </td>
                        <td style="text-align: right; border: 1px solid #000">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; font-size: 6px">
                        <?php if ($arrayTransaction->type == 'FRAIS_DE_SERVICE'): ?>
                            <?php $datetimeTransaction = new \Datetime($this->annee . '-12-31 23:59:59'); ?>
                            <?= $datetimeTransaction->format('d-m-Y H:i:s') ?>
                        <?php else : ?>
                        <?php $datetimeTransaction = new \Datetime($arrayTransaction->datetimeTransaction->date); ?>
                        <?= $datetimeTransaction->format('d-m-Y H:i:s') ?>
                        <?php endif ?>
                    </td>
                    <td style="text-align: center; border: 1px solid #000">
                        <?php if ($arrayTransaction->type == 'FRAIS_DE_SERVICE'): ?>
                            -
                        <?php else : ?>
                        <?= $arrayTransaction->exchange->name ?>
                        <?php endif ?>
                    </td>
                    <td style="text-align: right; border: 1px solid #000">
                        <?php if ($arrayTransaction->type == 'FRAIS_DE_SERVICE'): ?>
                            -
                        <?php else : ?>
                            <?= $this->amount($totalTradedAmount, 'crypto') ?>
                        <?php endif ?>

                    </td>
                    <td style="text-align: center; border: 1px solid #000">
                        <?php if ($arrayTransaction->type == 'FRAIS_DE_SERVICE'): ?>
                            FRAIS DE CHANGE EN CRYPTO
                        <?php else : ?>
                            <?= $arrayTransaction->tradedCurrency ?>
                        <?php endif ?>

                    </td>
                    <td style="text-align: right; border: 1px solid #000">
                        <?= $this->amount($totalReceivedAmount, 'fiat') ?>
                    </td>
                    <td style="text-align: center; border: 1px solid #000">
                        <?= $arrayTransaction->receivedCurrency ?>
                    </td>
                    <td style="text-align: center; border: 1px solid #000">
                        <?= $this->amount($totalReceivedAmountInEUR, 'fiat') ?>
                    </td>
                    <td style="text-align: right; border: 1px solid #000">
                        <?= $this->amount($totalFeesAmount, 'fiat') ?>
                    </td>
                    <td style="text-align: center; border: 1px solid #000">
                        <?= $arrayTransaction->feesCurrency ?>
                    </td>
                    <td style="text-align: right; border: 1px solid #000">
                        <?= $this->amount($totalFeesEUR, 'fiat') ?>
                    </td>
                    <td style="text-align: right; border: 1px solid #000"> <?= $this->amount(0, 'fiat') ?></td>
                </tr>
                <tr>
                    <td colspan="12"></td>
                </tr>
                <tr>
                    <td colspan="7"></td>

                    <td style="text-align: center; border: 3px solid #000">
                        <b style="font-size: 10px">case 213 - cession <?= $cessionIndex ?></b>
                    </td>
                    <td colspan="2" style="text-align: center;">
                    </td>
                    <td style="text-align: center; border: 3px solid #000">
                        <b style="font-size: 10px">case 214 - cession <?= $cessionIndex ?></b>
                    </td>
                    <td style="text-align: center; border: 3px solid #000">
                        <b style="font-size: 10px">case 216 - cession <?= $cessionIndex ?></b>
                    </td>
                </tr>
                <tr>
                    <td colspan="7"></td>
                    <td style="text-align: right; border: 3px solid #000">
                        <b style="font-size: 10px"><?= $this->amount($totalReceivedAmountInEUR, 'fiat-no-cents') ?></b>
                    </td>
                    <td colspan="2" style="text-align: right;">

                    </td>
                    <td style="text-align: right; border: 3px solid #000">
                        <b style="font-size: 10px"><?= $this->amount(round($totalFeesEUR), 'fiat-no-cents') ?></b>
                    </td>
                    <td style="text-align: right; border: 3px solid #000"><b
                                style="font-size: 10px"><?= $this->amount(0) ?></b></td>
                </tr>

                <tr>
                    <td colspan="12"></td>
                </tr>
                <tr>
                    <td colspan="10" style="text-align: right;">

                    </td>
                    <td style="text-align: center; border: 3px solid #000">
                        <b style="font-size: 10px">case 215 (213-214) - cession <?= $cessionIndex ?></b>
                    </td>
                    <td style="text-align: center; border: 3px solid #000">
                        <b style="font-size: 10px">case 217 (213 +/- 216) - cession <?= $cessionIndex ?></b>
                    </td>
                </tr>
                <tr>
                    <td colspan="10" style="text-align: right;">

                    </td>
                    <td style="text-align: right; border: 3px solid #000">
                        <b style="font-size: 10px"><?= $this->amount((round($totalReceivedAmountInEUR) - round($totalFeesEUR)), 'fiat-no-cents') ?></b>
                    </td>
                    <td style="text-align: right; border: 3px solid #000">
                        <b style="font-size: 10px"><?= $this->amount((round($totalReceivedAmountInEUR) - round($totalFeesEUR)), 'fiat-no-cents') ?></b>
                    </td>
                </tr>

                <tr>
                    <td colspan="12"></td>
                </tr>

                <tr>
                    <td colspan="12"></td>
                </tr>
                <tr>
                    <td colspan="11" style="text-align: right;">

                    </td>
                    <td style="text-align: center; border: 3px solid #000">
                        <b style="font-size: 10px">case 218 (213 - 214 +/- 216) - cession <?= $cessionIndex ?></b>
                    </td>
                </tr>
                <tr>
                    <td colspan="11" style="text-align: right;">

                    </td>
                    <td style="text-align: right; border: 3px solid #000">
                        <b style="font-size: 10px"><?= $this->amount((round($totalReceivedAmountInEUR) - round($totalFeesEUR)), 'fiat-no-cents') ?></b>
                    </td>
                </tr>


            </table>
        </div>
    <?php endif ?>
<?php endforeach ?>
<br pagebreak="true"/>
<?php // Fin Détermination des prix de cession (213), des frais de cession (214) et des prix de cession net des frais (215) ?>













<?php //preparation des tableaux acquisition
$str = '';
$str3 = ''; //echo $this->partial('partial/report/table-header-annexe-V');
$str3 .= '<tr><td style="text-align: center; border: 1px solid #000">Monnaie</td><td style="text-align: center; border: 1px solid #000">Quantité</td><td style="text-align: center; border: 1px solid #000">Prix d\'acquisition EUR</td></tr>';

$strDebug = '';
?>

<?php $valueTotaleEurFinale = 0; ?>
<?php foreach ($this->arrayAcquisitionBefore2019 as $code => $walletDevise) : ?>

    <?php
    $qtyTmp = 0;
    $valueTotaleEurTmp = 0;

    $strDebug .= "<h3>Détail des prix d'acquisition pour $code</h3>";
    $strDebug .= '<table style="border: 1px solid #000; font-size: large">';
    $strDebug .= '<tr><td style="text-align: center; border: 1px solid #000">Date</td><td style="text-align: center; border: 1px solid #000">Monnaie</td><td style="text-align: center; border: 1px solid #000">Quantité</td><td style="text-align: center; border: 1px solid #000">Prix d\'acquisition EUR</td></tr>';

    ?>
    <?php foreach ($walletDevise as $walletDeviseLine) : ?>
        <?php

        $strDebug .= '<tr><td style="text-align: center; border: 1px solid #000">' . $walletDeviseLine['dateTime']->format('d-m-Y H:i:s') . '</td><td style="text-align: center; border: 1px solid #000">' . $code . '</td><td style="text-align: right; border: 1px solid #000">' . $this->amount($walletDeviseLine['qte'], 'crypto') . '</td><td style="text-align: right; border: 1px solid #000">' . $this->amount($walletDeviseLine['prixEuro'], 'fiat') . '</td></tr>';


        $qtyTmp = $qtyTmp + $walletDeviseLine['qte'];
        $valueTotaleEurTmp = $valueTotaleEurTmp + $walletDeviseLine['prixEuro'];


//                $this->totalPrixAcquisitionBefore2019 += $valueTotaleEurTmp;
        ?>

    <?php endforeach; ?>
    <?php $strDebug .= '<tr><td style="text-align: right; border: 1px solid #000" colspan="2">Total :</td><td style="text-align: right; border: 1px solid #000"><b>' . $this->amount($qtyTmp, 'crypto') . '</b></td><td style="text-align: right; border: 1px solid #000"><b>' . $this->amount($valueTotaleEurTmp, 'fiat') . '</b></td></tr>'; ?>

    <?php $strDebug .= '</table>'; ?>
    <?php $valueTotaleEurFinale += $valueTotaleEurTmp; ?>

    <?php $str .= '<tr><td style="text-align: center; border: 1px solid #000">' . $code . '</td><td style="text-align: right; border: 1px solid #000">' . $this->amount($qtyTmp, 'crypto') . '</td></tr>'; ?>

    <?php $str3 .= '<tr><td style="text-align: center; border: 1px solid #000">' . $code . '</td><td style="text-align: right; border: 1px solid #000">' . $this->amount($qtyTmp, 'crypto') . '</td><td style="text-align: right; border: 1px solid #000">' . $this->amount($valueTotaleEurTmp, 'fiat') . '</td></tr>'; ?>
    <?php //$strDebug .= '<tr><td>--------------------------------------</td></tr>';?>
<?php endforeach; ?>
<?php $str3 .= '<tr><td style="text-align: center; border: 1px solid #000" colspan="3"></td></tr>'; ?>
<?php $str3 .= '<tr><td colspan="2" style="text-align: right; border: 1px solid #000"><b>Total : </b></td><td style="text-align: right; border: 1px solid #000"><b>' . $this->amount($valueTotaleEurFinale, 'fiat') . '</b></td></tr>'; ?>



<?php // Détermination du prix total d'acquisition 220 ?>
<?php //sommePrixAcquites = totalPrixAcquisitionBefore2019

?>
<?php $t++; ?>
<?php $tt = 1 ?>
<?php $ttt = 1 ?>
<h1><?= $t ?>) Détermination du prix total d'acquisition 220</h1>

<?php /* <h1>Cadrage du prix d'acquisition dans le temps</h1> */ ?>
<?php $indiceTitre = 1; ?>
<!--$html .= '<tcpdf method="AddPage" /><h2>Graphic Functions</h2>';-->

<h2><?= $t ?>.<?= $tt ?>) Calcul du prix d'acquisition au 1er janvier 2019 (application du paragraphe 130 du
    BOI-RPPM-PVBMC-30-20 du 2
    Septembre 2019)</h2>


<?php // détermination de la composition du portefeuille global au 1er janvier 2019?>
<?php $ttt = 1 ?>

<?php /* <h2><?= $t ?>.<?= $tt ?>.<?= $ttt ?>) Etapes permettant de déterminer le prix total d'acquisition au 1er janvier
    2019</h2>*/ ?>
<h3 style="font-size: large"><?= $t ?>.<?= $tt ?>.<?= $ttt++ ?>) Détails des prix d'acquisition au 1er janvier 2019</h3>
<?php echo $strDebug ?>

<h3 style="font-size: large"><?= $t ?>.<?= $tt ?>.<?= $ttt++ ?>) Composition du portefeuille global et prix total d'acquisition au 1er janvier 2019</h3>
<table style="border: 1px solid #000; font-size: large">
    <?php echo $str3 ?>
</table>


<?php /*
<h3 style="font-size: large"><?= $t ?>.<?= $tt ?>.<?= $ttt++ ?>) Composition du portefeuille global et prix total d'acquisition au 1er janvier 2019 </h3>

<table style="border: 1px solid #000; font-size: large">
    <tr>
        <td style="text-align: center; border: 1px solid #000">
            Monnaie
        </td>
        <td style="text-align: center; border: 1px solid #000">
            Quantité
        </td>
    </tr>
    <?php echo $str ?>
</table>

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

*/?>





<?php $tt++ ?>
<br pagebreak="true"/>


<?php if ($this->annee - 1 != 2019) : ?>
    <?php $arrayRange = [2019, $this->annee - 1] ?>
<?php else : ?>
    <?php $arrayRange = [2019]; ?>
<?php endif ?>





<?php if ($this->annee > 2019): ?>
<h2><?= $t ?>.<?= $tt ?>) Calcul du prix d'acquisition au 1er janvier <?= $this->annee ?></h2>
    <?php $ttt = 1 ?>




    <h3><?= $t ?>.<?= $tt ?>.<?= $ttt ?>) Calculs intermédiaires des fractions de capital jusqu'au 31 décembre <?= $this->annee - 1 ?></h3>

    <table style="font-size: large">
        <tr>
            <td style="text-align: center; border: 1px solid #000">
                Date
            </td>
            <td style="text-align: center; border: 1px solid #000">
                Prix de cession
            </td>
            <td style="text-align: center; border: 1px solid #000">
                Prix total d'acquisition
            </td>
            <td style="text-align: center; border: 1px solid #000">
                Montant reçu en EUR
            </td>
            <td style="text-align: center; border: 1px solid #000">
                Valeur du protefeuille
            </td>
            <td style="text-align: center; border: 1px solid #000">
                Calculs intermédiaires
            </td>
        </tr>

        <?php foreach ($this->explanationPlusOuMoinsValue as $explanationPlusOuMoinsValue) : ?>

            <?php if ($explanationPlusOuMoinsValue['dateTime'] >= new DateTime('2019-01-01 00:00:00') && $explanationPlusOuMoinsValue['dateTime'] < new DateTime($this->annee . '-01-01 00:00:00')) : ?>
                <tr>
                    <td style="text-align: center; border: 1px solid #000">
                        <?= $explanationPlusOuMoinsValue['dateTime']->format('d-m-Y H:i:s') ?>
                    </td>
                    <td style="text-align: right; border: 1px solid #000">
                        <?= $this->amount($explanationPlusOuMoinsValue['prixCession'], 'fiat') ?>
                    </td>
                    <td style="text-align: right; border: 1px solid #000">
                        <?= $this->amount($explanationPlusOuMoinsValue['prixTotalAcquisition'], 'fiat') ?>
                    </td>
                    <td style="text-align: right; border: 1px solid #000">
                        <?= $this->amount($explanationPlusOuMoinsValue['qtyReceivedInEUR'], 'fiat') ?>
                    </td>
                    <td style="text-align: right; border: 1px solid #000">
                        <?= $this->amount($explanationPlusOuMoinsValue['valeurWallet'], 'fiat') ?>
                    </td>
                    <td style="text-align: right; border: 1px solid #000">
                        <?= $this->amount($explanationPlusOuMoinsValue['plusOuMoinsValue'], 'fiat') ?>
                    </td>
                </tr>

            <?php endif ?>
        <?php endforeach; ?>
    </table>

    <?php $ttt++ ?>
    <h3><?= $t ?>.<?= $tt ?>.<?= $ttt ?>) Calcul des fractions initiales de capital jusqu'au 31 décembre <?= $this->annee - 1 ?></h3>

    <table style="font-size: large">
        <tr>
            <td style="text-align: center; border: 1px solid #000">
                Date
            </td>
            <td style="text-align: center; border: 1px solid #000">
                Prix de cession
            </td>
            <td style="text-align: center; border: 1px solid #000">
               Calculs intermédiaires
            </td>
            <td style="text-align: center; border: 1px solid #000">
                Somme des fractions initiales de capital <?php /* ($sommeFractionsInitialesCapital)  */ ?>
            </td>
            <td style="text-align: center; border: 1px solid #000">
                Calcul de la somme des fractions initiales de capital de la prochaine cession<?php /* ($sommeFractionsInitialesCapital)  */ ?>
            </td>
        </tr>

        <?php foreach ($this->explanationPrixTotalAcquisition as $explanationPrixTotalAcquisitionRow) : ?>

            <?php if ($explanationPrixTotalAcquisitionRow['dateTime'] >= new DateTime('2019-01-01 00:00:00') && $explanationPrixTotalAcquisitionRow['dateTime'] < new DateTime($this->annee . '-01-01 00:00:00')) : ?>
                <tr>
                    <td style="text-align: center; border: 1px solid #000">
                        <?= $explanationPrixTotalAcquisitionRow['dateTime']->format('d-m-Y H:i:s') ?>
                    </td>
                    <td style="text-align: right; border: 1px solid #000">
                        <?= $this->amount($explanationPrixTotalAcquisitionRow['prixCession'], 'fiat') ?>
                    </td>
                    <td style="text-align: right; border: 1px solid #000">
                        <?= $this->amount($explanationPrixTotalAcquisitionRow['plusOuMoinsValue'], 'fiat') ?>
                    </td>
                    <td style="text-align: right; border: 1px solid #000">
                        <?= $this->amount($explanationPrixTotalAcquisitionRow['sommeFractionsInitialesCapital'], 'fiat') ?>
                    </td>
                    <td style="text-align: right; border: 1px solid #000">
                        <?php $newSommeFractionsInitialesCapital = $explanationPrixTotalAcquisitionRow['sommeFractionsInitialesCapital'] + $explanationPrixTotalAcquisitionRow['prixCession'] - $explanationPrixTotalAcquisitionRow['plusOuMoinsValue']; ?>
                        <?= isset($newSommeFractionsInitialesCapital) ? $this->amount($newSommeFractionsInitialesCapital, 'fiat') : '-' ?>
                    </td>

                </tr>

            <?php endif ?>
        <?php endforeach; ?>
    </table>








    <?php $lastDateCessionAnneDerniere = ''?>

    <?php $ttt++ ?>
<h3><?= $t ?>.<?= $tt ?>.<?= $ttt ?>) Suivi du prix d'acquisition jusqu'au 31 décembre <?= $this->annee - 1 ?></h3>

<table style="font-size: large">
    <tr>
        <td style="text-align: center; border: 1px solid #000">
            Date
        </td>
        <?php /* <td style="text-align: center; border: 1px solid #000">
            Prix d'acquisition avant cession
        </td> */ ?>
        <?php /* (somme prix acquites avant la cession) ($sommePrixAcquites(c-1)) */ ?>
        <td style="text-align: center; border: 1px solid #000">
            Montant acquis en EUR depuis la dernière
            cession <?php /* $acquisitionFiatDepuisDerniereCession) voir detailArrayAcquisitionFiatDepuisDerniereCession */ ?>
        </td>
        <td style="text-align: center; border: 1px solid #000">
            Somme des prix acquités de la cession <?php /* ($sommePrixAcquites) */ ?>
        </td>
        <td style="text-align: center; border: 1px solid #000">
            Somme des fractions initiales de capital <?php /* ($sommeFractionsInitialesCapital)  */ ?>
        </td>
        <td style="text-align: center; border: 1px solid #000">
            Prix total d'acquisition net <?php /*($prixTotalAcquisition) */ ?>
        </td>
    </tr>
    <?php $numCession = 1 ?>
    <?php foreach ($this->explanationPrixTotalAcquisition as $explanationPrixTotalAcquisitionRow) : ?>
        <?php if ($numCession === 1 && false) : ?>
            <tr>
                <td style="text-align: center; border: 1px solid #000">
                    01-01-<?= $this->annee ?> 00:00:00
                </td>
                <td style="text-align: right; border: 1px solid #000">
                    -
                </td>
                <td style="text-align: right; border: 1px solid #000">
                    -
                </td>
                <td style="text-align: right; border: 1px solid #000">
                    -
                </td>
                <td style="text-align: right; border: 1px solid #000">

                </td>
                <td style="text-align: right; border: 1px solid #000">
                    <?= isset($lastPrixAcquisition) ? $this->amount($lastPrixAcquisition, 'fiat') : '-' ?>
                </td>

            </tr>
        <?php endif ?>
        <?php if ($explanationPrixTotalAcquisitionRow['dateTime'] >= new DateTime('2019-01-01 00:00:00') && $explanationPrixTotalAcquisitionRow['dateTime'] < new DateTime($this->annee . '-01-01 00:00:00')) : ?>
            <tr>
                <td style="text-align: center; border: 1px solid #000">
                    <?= $explanationPrixTotalAcquisitionRow['dateTime']->format('d-m-Y H:i:s') ?>
                </td>
                <?php /* <td style="text-align: right; border: 1px solid #000">
                    <?= $this->amount($explanationPrixTotalAcquisitionRow['oldSommePrixAcquites'],'fiat') ?>
                </td> */ ?>
                <td style="text-align: right; border: 1px solid #000">
                    <?= $this->amount($explanationPrixTotalAcquisitionRow['acquisitionFiatDepuisDerniereCession'], 'fiat') ?>
                </td>
                <td style="text-align: right; border: 1px solid #000">
                    <?= $this->amount($explanationPrixTotalAcquisitionRow['sommePrixAcquites'], 'fiat') ?>
                    <?php //$prixAcquisitionPremierJanvierAnneeImpot = $explanationPrixTotalAcquisitionRow['sommePrixAcquites']; ?>
                </td>
                <td style="text-align: right; border: 1px solid #000">
                    <?php //$this->amount($explanationPrixTotalAcquisitionRow['sommeFractionsInitialesCapital'],'fiat') ?>
                    <?= $this->amount($explanationPrixTotalAcquisitionRow['sommeFractionsInitialesCapital'], 'fiat') ?>
                    <?php //$explanationPrixTotalAcquisitionRow['sommeFractionsInitialesCapital'] ?>
                    <?php //$explanationPrixTotalAcquisitionRow['plusOuMoinsValue'] ?>
                    <?php //$explanationPrixTotalAcquisitionRow['prixCession'] ?>
                </td>
                <td style="text-align: right; border: 1px solid #000">
                    <?= isset($explanationPrixTotalAcquisitionRow['prixTotalAcquisition']) ? $this->amount($explanationPrixTotalAcquisitionRow['prixTotalAcquisition'], 'fiat') : '-' ?>
                </td>

            </tr>
            <?php $lastDateCessionAnneDerniere = $explanationPrixTotalAcquisitionRow['dateTime'] ?>
            <?php $numCession++ ?>
        <?php endif ?>
    <?php endforeach; ?>
</table>

<?php endif ?>







<?php $ttt++; ?>
<h3 style="font-size: large"><?= $t ?>.<?= $tt ?>.<?= $ttt ?>) Détail fiat investit dans la crypto avant le 1er janvier <?= $this->annee ?></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 Fiat</td>
        <td style="text-align: center; border: 1px solid #000">Taux de change</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 $investFiatAvantAnnee = 0; ?>
    <?php foreach ($this->investFiatAfter2019Detail as $key => $infos) : ?>
        <?php if($infos['datetime']->format('Y') < $this->annee) : ?>
            <?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"><?= $this->amount($infos['qte'], 'fiat') . ' ' . $infos['code'] ?></td>
                <td style="text-align: center; border: 1px solid #000"><?= $infos['code'] != 'EUR' ? $this->amount($infos['unitPriceInEUR'], 'crypto') : '-' ?></td>
                <td style="text-align: center; border: 1px solid #000"><?= $this->amount($infos['qteEUR'], 'fiat') ?></td>
                <td style="text-align: center; border: 1px solid #000"><?= $this->amount($totalEURCumuleDeuxCessions, 'fiat') ?></td>
            </tr>
        <?php endif ?>
    <?php if (!empty($lastDateCessionAnneDerniere) && $infos['datetime'] > $lastDateCessionAnneDerniere && $infos['datetime']->format('Y') < $this->annee) : ?>
        <?php $investFiatAvantAnnee += $infos['qteEUR']; ?>
    <?php endif ?>

    <?php endforeach ?>
</table>
<?php $prixAcquisitionPremierJanvierAnneeImpot = !empty($totalEURCumuleDeuxCessions) ? $totalEURCumuleDeuxCessions : 0; ?>


<?php /*  $tt++; ?>
<h3 style="font-size: large"><?= $t ?>.<?= $tt ?>.<?= $ttt ?>) 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 $tttt = 1 ?>
<?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">--><?//= $t ?><!--.--><?//= $tt ?><!--.--><?//= $ttt ?><!--.--><?//= $tttt++ ?><!--) Acquisition cumulée en EUR-->
<!--                entre --><?php // $lastDateCession->format('d-m-Y H:i:s') ?>
<!--                et --><?//= $arrayInfos['datetime']->format('d-m-Y H:i:s') . ' : ' . $this->amount($arrayInfos['totalEUR'], 'fiat-no-cents') . ' 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">Taux de change</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"><?= $this->amount($infos['qte'], 'fiat-no-cents') . ' ' . $infos['code'] ?></td>
                            <td style="text-align: center; border: 1px solid #000"><?= $infos['code'] != 'EUR' ? $this->amount($infos['unitPriceInEUR'], 'fiat') : '-' ?></td>
                            <td style="text-align: center; border: 1px solid #000"><?= $this->amount($infos['qteEUR'], 'fiat-no-cents') ?></td>
                            <td style="text-align: center; border: 1px solid #000"><?= $this->amount($totalEURCumuleDeuxCessions, 'fiat-no-cents') ?></td>
                        </tr>
                        <?php unset($tmpInvestFiatAfter2019Detail[$key]) ?>

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





<?php $tt++; ?>

<h2><?= $t ?>.<?= $tt ?>) Suivi du prix d'acquisition du 1er janvier <?= $this->annee ?> au 31 décembre <?= $this->annee ?></h2>
<?php $ttt = 1 ?>
<h3 style="font-size: large"><?= $t ?>.<?= $tt ?>.<?= $ttt ?>) Prix total d'acquisition au 1er janvier <?= $this->annee ?> : <?= $this->amount($prixAcquisitionPremierJanvierAnneeImpot, 'fiat') ?></h3>


<?php $ttt++ ?>
<div style="page-break-inside: avoid">
    <h3><?= $t ?>.<?= $tt ?>.<?= $ttt ?>) 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">
                Monnaie échangée
            </td>
            <td style="text-align: center; border: 1px solid #000">
                Montant reçu
            </td>
            <td style="text-align: center; border: 1px solid #000">
                Monnaie reçue
            </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: right; border: 1px solid #000">
                        <?= $this->amount($arrayTransaction['qtyOut'], 'crypto') ?>
                    </td>
                    <td style="text-align: center; border: 1px solid #000">
                        <?= $arrayTransaction['deviseOut']->getCode() ?>
                    </td>
                    <td style="text-align: right; border: 1px solid #000">
                        <?= $this->amount($arrayTransaction['qtyIn'], 'fiat') ?>
                    </td>
                    <td style="text-align: center; border: 1px solid #000">
                        <?= $arrayTransaction['deviseIn']->getCode() ?>
                    </td>
                </tr>
            <?php endif ?>
        <?php endforeach ?>
    </table>
</div>


<?php $ttt++ ?>
<div style="page-break-inside: avoid">
    <h3 style="font-size: large"><?= $t ?>.<?= $tt ?>.<?= $ttt ?>) Total de fiat investit dans la crypto entre deux cessions de crypto en <?= $this->annee ?></h3>
    <table style="border: 1px solid #000; font-size: large">
        <thead>
        <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>
            <td style="text-align: center; border: 1px solid #000">Investissement total cumulé en EUR</td>
        </tr>
        </thead>
        <?php $cumulInvestFiat = $prixAcquisitionPremierJanvierAnneeImpot ?>
        <?php $nbLigne = 1 ?>
        <?php foreach ($this->arrayAcquisitionFiatAvantDateCession as $date => $infosAcquisition) : ?>
            <?php foreach ($infosAcquisition as $key => $arrayInfos) : ?>

                <?php if ($arrayInfos['datetime']->format('Y') == $this->annee) : ?>

                    <tr>
                        <td style="text-align: center; border: 1px solid #000"><?= $arrayInfos['datetime']->format('d-m-Y H:i:s') ?></td>
                        <?php if ($nbLigne++ == 1) : ?>
                        <?php //var_dump($arrayInfos['totalEUR']) ?>
                        <?php //var_dump($investFiatAvantAnnee) ?>
                        <?php if ($this->amount($arrayInfos['totalEUR']) > 0) : ?>
                                <td style="text-align: center; border: 1px solid #000"><?= $this->amount($arrayInfos['totalEUR'] - $prixAcquisitionPremierJanvierAnneeImpot - $investFiatAvantAnnee, 'fiat') ?></td>
                                <?php $cumulInvestFiat += ($arrayInfos['totalEUR'] - $prixAcquisitionPremierJanvierAnneeImpot - $investFiatAvantAnnee) ?>
                            <?php else :?>
                            <td style="text-align: center; border: 1px solid #000"><?= $this->amount($arrayInfos['totalEUR'], 'fiat') ?></td>
                            <?php $cumulInvestFiat += ($arrayInfos['totalEUR']) ?>
                        <?php endif ?>
                            <?php else : ?>
                            <td style="text-align: center; border: 1px solid #000"><?= $this->amount($arrayInfos['totalEUR'], 'fiat') ?></td>
                            <?php $cumulInvestFiat += $arrayInfos['totalEUR'] ?>
                        <?php endif ?>

                        <td style="text-align: center; border: 1px solid #000"><?= $this->amount($cumulInvestFiat, 'fiat') ?></td>
                    </tr>
                <?php endif ?>
            <?php endforeach ?>
        <?php endforeach ?>
    </table>
</div>

<?php $ttt++ ?>
<h3 style="font-size: large"><?= $t ?>.<?= $tt ?>.<?= $ttt ?>) Evolution du prix d'acquisition en <?= $this->annee ?></h3>

<?php /*<p>$sommePrixAcquites = $sommePrixAcquites(c-1) + $acquisitionFiatDepuisDerniereCession</p>
<p>$prixTotalAcquisition = $sommePrixAcquites - $sommeFractionsInitialesCapital</p>

<p>sommeFractionsInitialesCapital = oldsommeFractionsInitialesCapital + prixPrixCession + plusoumoinsvalue</p>
 */ ?>
<table style="font-size: large">
    <tr>
        <td style="text-align: center; border: 1px solid #000">
            Cession
        </td>
        <td style="text-align: center; border: 1px solid #000">
            Date
        </td>
        <?php /* <td style="text-align: center; border: 1px solid #000">
            Prix d'acquisition avant cession
        </td> */ ?>
        <?php /* (somme prix acquites avant la cession) ($sommePrixAcquites(c-1)) */ ?>
        <td style="text-align: center; border: 1px solid #000">
            Acquisitions en euros depuis la dernière cession <?php /* $acquisitionFiatDepuisDerniereCession) voir detailArrayAcquisitionFiatDepuisDerniereCession */ ?>
        </td>
        <td style="text-align: center; border: 1px solid #000">
            Prix total d'acquisition <?php /* ($sommePrixAcquites) */ ?>
        </td>
        <td style="text-align: center; border: 1px solid #000">
            Fractions de capital initial contenues dans le prix total d'acquisition <?php /* ($sommeFractionsInitialesCapital)  */ ?>
        </td>
        <td style="text-align: center; border: 1px solid #000">
            Prix total d'acquisition net <?php /*($prixTotalAcquisition) */ ?>
        </td>
    </tr>
    <?php $numCession = 1 ?>
    <?php foreach ($this->explanationPrixTotalAcquisition as $explanationPrixTotalAcquisitionRow) : ?>
        <?php if ($numCession === 1 && false) : ?>
            <tr>
                <td style="text-align: center; border: 1px solid #000">
                    <?= $numCession++ ?>
                </td>
                <td style="text-align: center; border: 1px solid #000">
                    01-01-<?= $this->annee ?> 00:00:00
                </td>
                <td style="text-align: right; border: 1px solid #000">
                    -
                </td>
                <td style="text-align: right; border: 1px solid #000">
                    -
                </td>
                <td style="text-align: right; border: 1px solid #000">
                    -
                </td>
                <td style="text-align: right; border: 1px solid #000">

                </td>
                <td style="text-align: right; border: 1px solid #000">
                    <?= isset($lastPrixAcquisition) ? $this->amount($lastPrixAcquisition, 'fiat') : '-' ?>
                </td>

            </tr>
        <?php endif ?>
        <?php if ($explanationPrixTotalAcquisitionRow['dateTime']->format('Y') == $this->annee) : ?>
            <tr>
                <td style="text-align: center; border: 1px solid #000">
                    <?= $numCession ?>
                </td>
                <td style="text-align: center; border: 1px solid #000">
                    <?= $explanationPrixTotalAcquisitionRow['dateTime']->format('d-m-Y H:i:s') ?>
                </td>
                <?php /* <td style="text-align: right; border: 1px solid #000">
                    <?= $this->amount($explanationPrixTotalAcquisitionRow['oldSommePrixAcquites'],'fiat') ?>
                </td> */ ?>
                <?php if ($numCession == 1) : ?>
                <td style="text-align: right; border: 1px solid #000">
                    <?= $this->amount($explanationPrixTotalAcquisitionRow['acquisitionFiatDepuisDerniereCession']-$investFiatAvantAnnee, 'fiat') ?>
                </td>
                <?php else : ?>
                    <td style="text-align: right; border: 1px solid #000">
                        <?= $this->amount($explanationPrixTotalAcquisitionRow['acquisitionFiatDepuisDerniereCession'], 'fiat') ?>
                    </td>
                <?php endif ?>
                <td style="text-align: right; border: 1px solid #000">
                    <?= $this->amount($explanationPrixTotalAcquisitionRow['sommePrixAcquites'], 'fiat') ?>
                </td>
                <td style="text-align: right; border: 1px solid #000">
                    <?php //$this->amount($explanationPrixTotalAcquisitionRow['sommeFractionsInitialesCapital'],'fiat') ?>
                    <?= $this->amount($explanationPrixTotalAcquisitionRow['sommeFractionsInitialesCapital'], 'fiat') ?>
                    <?php //$explanationPrixTotalAcquisitionRow['sommeFractionsInitialesCapital'] ?>
                    <?php //$explanationPrixTotalAcquisitionRow['plusOuMoinsValue'] ?>
                    <?php //$explanationPrixTotalAcquisitionRow['prixCession'] ?>
                </td>
                <td style="text-align: right; border: 1px solid #000">
                    <?= isset($explanationPrixTotalAcquisitionRow['prixTotalAcquisition']) ? $this->amount($explanationPrixTotalAcquisitionRow['prixTotalAcquisition'], 'fiat') : '-' ?>
                </td>

            </tr>
            <tr>
                <td colspan="3" style="text-align: right;">

                </td>
                <td style="text-align: center; border: 3px solid #000">case 220 - cession <?= $numCession ?></td>
                <td style="text-align: center; border: 3px solid #000">case 221 - cession <?= $numCession ?></td>
                <td style="text-align: center; border: 3px solid #000">case 223 - cession <?= $numCession ?></td>
            </tr>
            <tr>
                <td colspan="3" style="text-align: right;">

                </td>
                <td style="text-align: right; border: 3px solid #000"><?= $this->amount($explanationPrixTotalAcquisitionRow['sommePrixAcquites'], 'fiat-no-cents') ?></td>
                <td style="text-align: right; border: 3px solid #000"><?= $this->amount($explanationPrixTotalAcquisitionRow['sommeFractionsInitialesCapital'], 'fiat-no-cents') ?></td>
                <td style="text-align: right; border: 3px solid #000"><?= $this->amount($explanationPrixTotalAcquisitionRow['prixTotalAcquisition'], 'fiat-no-cents') ?></td>
            </tr>
            <?php $numCession++ ?>
        <?php endif ?>
    <?php endforeach; ?>
</table>





<?php //$dateProchaineCession = array_shift($this->arrayDateCession); ?>
<?php $ttt++; ?>
<h3 style="font-size: large"><?= $t ?>.<?= $tt ?>.<?= $ttt ?>) Détail fiat investit dans la crypto au cours de <?= $this->annee ?></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 Fiat</td>
        <td style="text-align: center; border: 1px solid #000">Taux de change</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 $investFiatAvantAnnee = 0; ?>
    <?php foreach ($this->investFiatAfter2019Detail as $key => $infos) : ?>
        <?php if($infos['datetime']->format('Y') == $this->annee) : ?>

        <?php //if ($infos['datetime'] < $dateProchaineCession) :?>

            <?php //$totalEURCumuleDeuxCessions += $infos['qteEUR']; ?>
            <?php //else : ?>
                <?php //$dateProchaineCession = array_shift($this->arrayDateCession); ?>
        <?php //endif ?>

            <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"><?= $this->amount($infos['qte'], 'fiat') . ' ' . $infos['code'] ?></td>
                <td style="text-align: center; border: 1px solid #000"><?= $infos['code'] != 'EUR' ? $this->amount($infos['unitPriceInEUR'], 'crypto') : '-' ?></td>
                <td style="text-align: center; border: 1px solid #000"><?= $this->amount($infos['qteEUR'], 'fiat') ?></td>
<!--                <td style="text-align: center; border: 1px solid #000">--><?php //= $this->amount($totalEURCumuleDeuxCessions, 'fiat') ?><!--</td>-->
            </tr>
        <?php endif ?>
        <?php if (!empty($lastDateCessionAnneDerniere) && $infos['datetime'] > $lastDateCessionAnneDerniere && $infos['datetime']->format('Y') < $this->annee) : ?>
            <?php $investFiatAvantAnnee += $infos['qteEUR']; ?>
        <?php endif ?>

    <?php endforeach ?>
</table>


<br pagebreak="true"/>



<?php /* c'est faux
<h3 style="font-size: large">Calcul du prix d'acquisition à chaque cession au cours de <?= ($this->annee) ?></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">
            Code
        </td>
        <td style="text-align: center; border: 1px solid #000">
            Qte
        </td>
        <td style="text-align: center; border: 1px solid #000">
            Prix unitaire
        </td>
        <td style="text-align: center; border: 1px solid #000">
            Valeur FIAT
        </td>
        <td style="text-align: center; border: 1px solid #000">
            cumulFiat
        </td>

    </tr>
    <?php $numCession = 1 ?>
    <?php foreach ($this->detailArrayAcquisitionFiatDepuisDerniereCession as $index => $arrayRow) : ?>
        <?php foreach ($arrayRow as $index => $row) : ?>
<?php if ($row['dateTime'] >= new DateTime($this->annee . '-01-01 00:00:00') && $row['dateTime'] <= new DateTime($this->annee . '-12-31 23:59:59')) : ?>
            <tr>
                <td style="text-align: center; border: 1px solid #000">
                    <?= $row['dateTime']->format('d-m-Y H:i:s') ?>
                </td>
                <td style="text-align: center; border: 1px solid #000">
                    <?= $row['code'] ?>
                </td>
                <td style="text-align: center; border: 1px solid #000">
                    <?= $row['qte'] ?>
                </td>
                <td style="text-align: center; border: 1px solid #000">
                    <?= !empty($row['price']) ? $row['price'] : '-' ?>
                </td>

                <td style="text-align: center; border: 1px solid #000">
                    <?= $this->amount($row['fiat'],'fiat') ?>
                </td>

                <td style="text-align: center; border: 1px solid #000">
                    <?= $this->amount($row['cumulFiat'],'fiat') ?>
                </td>
            </tr>
    <?php endif ?>
        <?php endforeach; ?>
    <?php endforeach; ?>
</table>

*/ ?>

<br pagebreak="true"/>


<?php if (count($this->detailFraisServiceAnneeImposition) > 0) : ?>
    <?php $t++ ?>


    <h3 style="font-size: large"><?= $t ?>) Détail des frais de cession en crypto-monnaies imposables <?= $this->annee ?><br>Application de la remarque n°1 du paragraphe 70 du BOI-RPPM-PVBMC-30-10 du 2 septembre 2019</h3>

<table style="font-size: large">
    <tr>
        <td style="text-align: center; border: 1px solid #000">
            Date
        </td>
        <td style="text-align: center; border: 1px solid #000">
            Montant frais
        </td>
        <td style="text-align: center; border: 1px solid #000">
            Monnaie frais
        </td>
        <td style="text-align: center; border: 1px solid #000">
            Montant frais EUR
        </td>
    </tr>

    <?php foreach ($this->detailFraisServiceAnneeImposition as $indexDetail => $detailFraisServiceAnneeImpositionArray) : ?>

    <tr>
        <td style="text-align: center; border: 1px solid #000">
            <?= $detailFraisServiceAnneeImpositionArray['dateTime']->format('d-m-Y H:i:s') ?>
        </td>
        <td style="text-align: center; border: 1px solid #000">
            <?= $this->amount($detailFraisServiceAnneeImpositionArray['fraisMontant'], 'crypto') ?>
        </td>
        <td style="text-align: right; border: 1px solid #000">
            <?= $detailFraisServiceAnneeImpositionArray['fraisDevise']->getCode() ?>
        </td>
        <td style="text-align: right; border: 1px solid #000">
            <?= $this->amount($detailFraisServiceAnneeImpositionArray['fraisCessionEUR'], 'fiat') ?>
        </td>
    </tr>

    <?php endforeach ?>
    <tr>
        <td style="text-align: right; border: 1px solid #000" colspan="3">
            Total
        </td>
        <td style="text-align: right; border: 1px solid #000">
            <?= $this->amount($this->totalEURFraisServiceAnneeImposition, 'fiat') ?>
        </td>
    </tr>
</table>
<?php endif ?>




<br pagebreak="true"/>


<h1>Historique des transactions</h1>
<?php foreach ($this->arrayImport as $indexImport => $import) : ?>
    <?php
    $contentFile = file_get_contents($import->getPath());
    //var_dump($content);
    $linesArray = explode("\n", $contentFile); ?>
<h3>Fichier <?= ++$indexImport ?></h3>
    <table>
        <?php foreach ($linesArray as $index => $row) : ?>
            <?php $arrayLine = str_getcsv($row); ?>
            <?php if (count($arrayLine) > 1): ?>
                <?php if ($index == 0) : ?>
                    <thead>
                    <?php $arrayIndexUpperCase = []; ?>
                    <?php $arrayIndexAmountCrypto = []; ?>
                    <tr>
                        <?php foreach ($arrayLine as $key => $field) : ?>
                        <?php if($field == 'Date (UTC)') {
                            $indexDate = $key;
                        } else if($field == 'Exchange' || $field == 'Monnaie tradée' || $field == 'Monnaie reçue' || $field == 'Monnaie frais') {
                            $arrayIndexUpperCase[] = $key;
                            } else if($field == 'Montant tradé' || $field == 'Montant reçu' || $field == 'Montant frais') {
                                $arrayIndexAmountCrypto[] = $key;
                            } ?>
                            <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 == $indexDate) {
                            $dateLine = new DateTime($field);
                            $linehtml .= '<td style="text-align: center; border: 1px solid #000000">' . $dateLine->format('d-m-Y H:i:s') . '</td>';
                            //$linehtml .= '<td style="text-align: center; border: 1px solid #000000">' . $indexfield . '</td>';
                        } elseif(in_array($indexfield,$arrayIndexAmountCrypto)) {
                            $linehtml .= '<td style="text-align: center; border: 1px solid #000000">' .$this->amount($field,'crypto') . '</td>';
                        } elseif(in_array($indexfield,$arrayIndexUpperCase)) {
                            $linehtml .= '<td style="text-align: center; border: 1px solid #000000">' . strtoupper($field) . '</td>';
                        } else {
                            $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; ?>


<?php /* foreach ($this->arrayExplicationLedgio as $arrayExplicationLineLedgio) : ?>
<?php foreach ($arrayExplicationLineLedgio as $key => $val) : ?>
<p><?= $key?> : <?= print_r($val, true) ?></p>
<?php endforeach ?>
<?php endforeach */ ?>

</body>
</html>


??

??