?? 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-v2test.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 < 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"><?= $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">
                    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"><?= $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
            $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"></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="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* */ ?><?= $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* */ ?><?= $sommePrixCessionEtSoults ?></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="font-size: 12px"><?= ($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 > 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"><?= $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"><?php // 216 ?></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 20 à <?= $nombreCession ?></p>
    <p><sup>(2)</sup> Moyenne des cessions 20 à <?= $nombreCession ?></p>
    <h3><sup>(3)</sup> Calcul de la valeur du portefeuille 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>
        = <?= $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 <?= ($cessionIndex + 1) ?>
                du <?= $arrayCessionWalletDetail['datetime']->format('d-m-Y H:i:s') ?></h3>

            <table style="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">
                            <?= $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>

                        <?php $totalWalletCession += !empty($wallet['totalReel']) ? $wallet['totalReel'] : $wallet['total'] ?>
                    </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 <?= $cessionIndex + 1 ?></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 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="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>
                    <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 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; font-size: 9px">
                            <?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 ?>
                        </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: 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">
                        <?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($totalTradedAmount, 'crypto') ?>
                    </td>
                    <td style="text-align: center; border: 1px solid #000">
                        <?= $arrayTransaction->tradedCurrency ?>
                    </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: 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="11"></td>
                </tr>
                <tr>
                    <td colspan="5"></td>

                    <td style="text-align: center; border: 3px solid #000">
                        <b style="font-size: 10px">case 213 - cession <?= $cessionIndex ?></b>
                    </td>
                    <td colspan="3" 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="4"></td>
                    <td style="text-align: right;">

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

                    </td>
                    <td style="text-align: right; border: 3px solid #000">
                        <b style="font-size: 10px"><?= $this->amount($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="10"></td>
                </tr>
                <tr>
                    <td colspan="9" 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="9" style="text-align: right;">

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

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

                <tr>
                    <td colspan="10"></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 218 (213 - 214 +/- 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(($totalReceivedAmount - $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');
$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">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">' . $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">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">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 $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; ?>
<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 //$tt++ ?>
<?php $ttt = 1 ?>
<h2><?= $t ?>.<?= $tt ?>.<?= $ttt ?>) Evolution des prix d'acquisitions avant le 1er janvier 2019</h2>
<?php if (!empty($this->explicationAcquisitionAvant2019)) : ?>

    <?php $numTab = 1 ?>
    <?php foreach ($this->explicationAcquisitionAvant2019 as $crypto => $arrayCrypto) : ?>
        <div style="page-break-inside: avoid">
            <h3><?= $t ?>.<?= $tt ?>.<?= $ttt ?>.<?= $numTab++ ?>) Evolution des prix d'acquisition
                de <?php echo $crypto ?> avant le 1er janvier 2019</h3>
            <?php /* <p>Si sortie de crypto on applique la méthode FIFO pour recalculer le nouveau prix d'acquisition</p>
    <p>Prix Eur final = Prix Eur avant echange - Ratio prix à déduire</p> */ ?>
            <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">Monnaie</td>
                    <td style="text-align: center; border: 1px solid #000">Qte avant echange</td>
                    <td style="text-align: center; border: 1px solid #000">Qte sortie</td>
                    <td style="text-align: center; border: 1px solid #000">Qte entrée</td>
                    <td style="text-align: center; border: 1px solid #000">Qté finale</td>
                    <td style="text-align: center; border: 1px solid #000">Prix unitaire entrée</td>


                    <td style="text-align: center; border: 1px solid #000">Prix Unitaire en EUR de la crypto entrée</td>
                    <td style="text-align: center; border: 1px solid #000">Montant en EUR de la crypto entrée</td>
                    <td style="text-align: center; border: 1px solid #000">Prix Unitaire en EUR de la crypto sortie</td>
                    <td style="text-align: center; border: 1px solid #000">Montant en EUR de la crypto sortie</td>


                    <td style="text-align: center; border: 1px solid #000">Prix Eur avant echange</td>
                    <td style="text-align: center; border: 1px solid #000">Qte (FIFO) avant echange pour calcul ratio
                    </td>
                    <td style="text-align: center; border: 1px solid #000">Ratio prix à déduire</td>
                    <td style="text-align: center; border: 1px solid #000">Nouveau prix en EUR</td>
                    <td style="text-align: center; border: 1px solid #000">Total acquisition EUR de la crypto avant
                        échange
                    </td>
                    <td style="text-align: center; border: 1px solid #000">Total acquisition EUR acquisition de la
                        crypto après échange
                    </td>

                </tr>
                </thead>
                <tbody>
                <?php foreach ($arrayCrypto as $dateTime => $arrayInfo) : ?>
                    <?php foreach ($arrayInfo as $rowInfo) : ?>

                        <tr>
                            <td style="text-align: center; border: 1px solid #000"><?= $dateTime ?></td><?php // Date ?>
                            <td style="text-align: center; border: 1px solid #000"><?= $crypto ?></td><?php // Monnaie ?>
                            <td style="text-align: right; border: 1px solid #000"><?= $this->amount($rowInfo['oldQte'], 'crypto') ?></td><?php // Qte avant echange ?>
                            <td style="text-align: right; border: 1px solid #000"><?= $this->amount($rowInfo['qtyOutTmp'], 'crypto') ?></td><?php // Qte sortie ?>
                            <td style="text-align: right; border: 1px solid #000"><?= $this->amount($rowInfo['qtyIn'], 'crypto') ?></td><?php // Qte entrée ?>
                            <td style="text-align: right; border: 1px solid #000"><?= $this->amount($rowInfo['newQte'], 'crypto') ?></td><?php // Qte finale ?>
                            <td style="text-align: right; border: 1px solid #000"><?= $this->amount($rowInfo['prixUnitaireIn'], 'fiat') ?></td><?php // Prix unitaire crypto entrée ?>
                            <td style="text-align: right; border: 1px solid #000"><?= isset($rowInfo['unitInPriceCryptoToEur']) ? $this->amount($rowInfo['unitInPriceCryptoToEur'], 'fiat') : '' ?></td><?php // Prix unitaire en EUR de la crypto entrée ?>
                            <td style="text-align: right; border: 1px solid #000"><?= isset($rowInfo['inPriceCryptoToEur']) ? $this->amount($rowInfo['inPriceCryptoToEur'], 'fiat') : '' ?></td><?php // Montant en EUR de la crypto entrée ?>

                            <td style="text-align: right; border: 1px solid #000"><?= isset($rowInfo['unitOutPriceCryptoToEur']) ? $this->amount($rowInfo['unitOutPriceCryptoToEur'], 'fiat') : '' ?></td><?php // Prix unitaire en EUR de la crypto sortie ?>
                            <td style="text-align: right; border: 1px solid #000"><?= isset($rowInfo['outPriceCryptoToEur']) ? $this->amount($rowInfo['outPriceCryptoToEur'], 'fiat') : '' ?></td><?php // Montant en EUR de la crypto sortie ?>


                            <td style="text-align: right; border: 1px solid #000"><?= $this->amount($rowInfo['oldPrixEuro'], 'fiat') ?></td><?php // Prix EUR avant échange ?>
                            <td style="text-align: right; border: 1px solid #000"><?= isset($rowInfo['oldQtePourCalculRatio']) ? $this->amount($rowInfo['oldQtePourCalculRatio'], 'crypto') : '-' ?></td><?php // Qte (FIFO) avant echange pour calcul ratio ?>
                            <td style="text-align: right; border: 1px solid #000"><?= $this->amount($rowInfo['ratioPrixEuro'], 'fiat') ?></td><?php // Ratio prix à déduire ?>
                            <td style="text-align: right; border: 1px solid #000"><?= $this->amount($rowInfo['newPrixEuro'], 'fiat') ?></td>
                            <td style="text-align: right; border: 1px solid #000"><?= isset($rowInfo['cumulAcquisitionParCryptoEURAvantEchange']) ? $this->amount($rowInfo['cumulAcquisitionParCryptoEURAvantEchange'], 'fiat') : '-' ?></td>
                            <td style="text-align: right; border: 1px solid #000"><?= isset($rowInfo['cumulAcquisitionParCryptoEUR']) ? $this->amount($rowInfo['cumulAcquisitionParCryptoEUR'], 'fiat') : '-' ?></td>

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



<?php if (!empty($this->explicationValeurEchangeAvant2019)) : ?>
    <h2><?= $t ?>.<?= $tt ?>.<?= $ttt ?>) Calcul de la valeur en EUR de l'acquisition des échanges crypto-crypto </h2>
    <?php $numTab = 1 ?>
    <?php foreach ($this->explicationValeurEchangeAvant2019 as $crypto => $arrayEchange) : ?>
        <h3><?= $t ?>.<?= $tt ?>.<?= $ttt ?>.<?= $numTab++ ?>) Calcul de la valeur de l'acquisition
            de <?php echo $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">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>
                <td style="text-align: center; border: 1px solid #000">Prix unitaire entrée EUR</td>
                <td style="text-align: center; border: 1px solid #000">Valeur total Eur</td>

            </tr>
            <?php foreach ($arrayEchange as $dateTime => $arrayInfo) : ?>
                <?php foreach ($arrayInfo as $rowInfo) : ?>

                    <tr>
                        <td style="text-align: center; border: 1px solid #000"><?= $dateTime ?></td>
                        <td style="text-align: right; border: 1px solid #000"><?= $this->amount($rowInfo['qtyIn'], 'crypto') ?></td>
                        <td style="text-align: right; border: 1px solid #000"><?= $rowInfo['deviseIn'] ?></td>
                        <td style="text-align: right; border: 1px solid #000"><?= $this->amount($rowInfo['qtyOut'], 'crypto') ?></td>
                        <td style="text-align: right; border: 1px solid #000"><?= $rowInfo['deviseOut'] ?></td>
                        <td style="text-align: right; border: 1px solid #000"><?= $this->amount($rowInfo['prixUnitaireIn'], 'fiat') ?></td>
                        <td style="text-align: right; border: 1px solid #000"><?= $this->amount($rowInfo['newPrixEuro'], 'fiat') ?></td>

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


<?php $tttt = 1 ?>
<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 ?>.<?= $tttt++ ?>) Etape 1 : Détermination de la composition
    du portefeuille global 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"><?= $t ?>.<?= $tt ?>.<?= $ttt ?>.<?= $tttt++ ?>) Etape 2 : Détail des prix d'acquisition au
    1er janvier 2019</h3>
<?php echo $strDebug ?>


<h3 style="font-size: large"><?= $t ?>.<?= $tt ?>.<?= $ttt ?>.<?= $tttt++ ?>) Etape 3 : Détermination du prix
    d'acquisition au 1er janvier 2019</h3>

<h3 style="font-size: large"><?= $t ?>.<?= $tt ?>.<?= $ttt ?>.<?= $tttt++ ?>) <b>Prix total d'acquisition au 1er janvier
        2019</b>
    : <?= $this->amount($this->totalAcquisitionDebutAnnee, 'fiat') ?> €</h3>
<table style="border: 1px solid #000; font-size: large">
    <?php echo $str3 ?>
</table>
<?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 ?>) Suivi du prix d'acquisition du 1er janvier 2019 au 31
        décembre <?= ($this->annee - 1) ?></h2>

    <?php $ttt = 1 ?>
    <?php foreach ($arrayRange as $anneeSuivi) : ?>
        <?php if (($this->annee - 1) != 2019) : ?>
            <h2><?= $t ?>.<?= $tt ?>.<?= $ttt++ ?>)Suivi du prix d'acquisition au cours de <?= $anneeSuivi ?></h2>
            <?php /*<p>Formule : $diminutionPrixAcquisition = $oldPrix * $prixEuro / $totalValueCrypto; </p> */ ?>
        <?php endif; ?>

        <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">
                    Cash In
                </td>
                <td style="text-align: center; border: 1px solid #000">
                    Cession imposable
                </td>
                <td style="text-align: center; border: 1px solid #000">
                    Prix d'acquisition
                </td>
                <td style="text-align: center; border: 1px solid #000">
                    Prix d'acquisition précédent
                </td>
                <td style="text-align: center; border: 1px solid #000">
                    Prix de cession en EUR
                </td>
                <td style="text-align: center; border: 1px solid #000">
                    Valeur totale du portefeuille
                </td>
            </tr>
            <?php foreach ($this->arrayExplicationAcquisitionEUR as $index => $row) : ?>
                <?php if ($row['dateTime']->format('Y') == $anneeSuivi) : ?>
                    <tr>
                        <td style="text-align: center; border: 1px solid #000">
                            <?= !empty($row['dateTime']) ? $row['dateTime']->format('d-m-Y H:i:s') : '' ?>
                        </td>
                        <td style="text-align: right; border: 1px solid #000">
                            <?= $this->amount($row['augmentationPrixAcquisition'], 'fiat') ?>
                        </td>
                        <td style="text-align: right; border: 1px solid #000">
                            <?= $this->amount($row['diminutionPrixAcquisition'], 'fiat') ?>
                        </td>
                        <td style="text-align: right; border: 1px solid #000">
                            <?= $this->amount($row['prixAcquisitionTotal'], 'fiat') ?>
                            <?php $lastPrixAcquisition = $row['prixAcquisitionTotal']; ?>
                        </td>


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


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


            <?php $tableDisplay = false ?>

            <?php foreach ($arrayCessionWalletDetail['wallet'] as $arrayCessionWalletDetailRow) : ?>
                <?php $numLigneDetail = 0; ?>
                <?php if ($arrayCessionWalletDetailRow['datetime']->format('Y') == $anneeSuivi) : ?>
                    <?php if ($numLigneDetail++ == 0) : ?>
                        <h2>Suivi de la valeur du portefeuille au cours de <?= $anneeSuivi ?></h2>

                        <?php $tableDisplay = true ?>
                        <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">
                                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 endif ?>

                    <tr>
                        <td style="text-align: center; border: 1px solid #000">
                            <?= $arrayCessionWalletDetailRow['datetime']->format('d-m-Y H:i:s') ?>
                        </td>
                        <td style="text-align: center; border: 1px solid #000"><?= $arrayCessionWalletDetailRow['devise'] ?></td>
                        <td style="text-align: center; border: 1px solid #000"><?= $this->amount($arrayCessionWalletDetailRow['qty'], 'crypto') ?></td>
                        <td style="text-align: center; border: 1px solid #000"><?= $this->amount($arrayCessionWalletDetailRow['unitPrice'], 'fiat') ?></td>
                        <td style="text-align: center; border: 1px solid #000"><?= $this->amount($arrayCessionWalletDetailRow['total'], 'fiat') ?></td>
                    </tr>
                    <?php if ($tableDisplay) : ?>
                        </table>
                    <?php endif ?>
                <?php endif ?>

            <?php endforeach ?>


        <?php endforeach ?>
    <?php endforeach ?>

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


<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 ?>) 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">
            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">
                    <?= $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> */ ?>
                <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') ?>
                </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 $ttt++ ?>


<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 <?= $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">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"><?= $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 $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'], 'crypto') ?>
                    </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</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"><?= $this->amount($arrayInfos['totalEUR'], 'fiat-no-cents') ?></td>
                </tr>
            <?php endforeach ?>
        <?php endforeach ?>
    </table>
</div>


<?php /*
<h3 style="font-size: large">Calcul du prix d'acquisition à chaque cession au cours de <?= ($this->annee - 1) ?></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">
            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) : ?>

            <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">
                    <?= $this->amount($row['fiat'],'fiat') ?>
                </td>

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


<br pagebreak="true"/>


<h1>Historique des transactions</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; ?>


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


??

??