?? 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-save22-05-2020.phtml

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

<html lang="en">

<body>


<h1>Annexe principale</h1>

<table>
    <?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 = '';
    ?>
    <?php foreach ($this->lignesRapport as $ligneRapport) : ?>
        <?php if ($nbLigneTableauPrincipal < 19) : ?>
            <tr>
                <td style="text-align: center; border: 1px solid #000"><?= $numCession++ ?></td>
                <td style="text-align: center; border: 1px solid #000"><?= $ligneRapport->getDateCession()->format('d-m-Y') // Date de la cession fiat          ?></td>
                <td style="text-align: center; border: 1px solid #000"><?= $ligneRapport->getDateCession()->format('H:i:s') // Heure de la cession fiat          ?></td>
                <td style="text-align: right; border: 1px solid #000"><?= number_format($ligneRapport->getValeurPortefeuille(), 2); // 212 Valeur du portefeuille au moment de la cession        ?></td>
                <td style="text-align: right; border: 1px solid #000"><?= number_format($ligneRapport->getPrixCessionBrut(), 2) // 213 Prix de cession        ?></td>
                <td style="text-align: right; border: 1px solid #000"><?= number_format($ligneRapport->getFraisCession(), 2) // 214 Frais de cession        ?></td>
                <td style="text-align: right; border: 1px solid #000"><?= number_format($ligneRapport->getPrixCession(), 2) // 215 Prix de cession net des frais        ?></td>
                <td style="text-align: right; border: 1px solid #000"><?php // 216 Soulte reçue ou versée lors de la cession ?></td>
                <td style="text-align: right; border: 1px solid #000"><?= number_format($ligneRapport->getPrixCessionBrut(), 2) // 217  (213 – 216) ou (213 + 216) Prix de cession net des soultes        ?></td>
                <td style="text-align: right; border: 1px solid #000"><?= number_format($ligneRapport->getPrixCession(), 2) // 218  (213 – 214 – 216) ou  (213 – 214 + 216) Prix de cession net des frais et soults        ?></td>
                <td style="text-align: right; border: 1px solid #000"><?= number_format($ligneRapport->getSommePrixAcquites(), 2) // 220 Prix total d'acquisition (Acquisition fiat depuis c-1        ?></td>
                <td style="text-align: right; border: 1px solid #000"><?= number_format($ligneRapport->getSommeFractionsInitialesCapital(), 2) // 221 Fractions de capital initial contenues dans le prix total d'acquisition        ?></td>
                <td style="text-align: right; border: 1px solid #000"><?= number_format($ligneRapport->getPrixTotalAcquisition(), 2) // 223 (220 – 221 – 222) Prix total d'acquisition net        ?></td>
                <td style="text-align: right; border: 1px solid #000"><?= ($ligneRapport->getPlusOuMoinsValue() > 0) ? '+' : '' ?><?= number_format($ligneRapport->getPlusOuMoinsValue(), 2); // 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 else : ?>
            <?php
            $detailTableauSup20Lignes .= '<tr>';
            $detailTableauSup20Lignes .= '<td style="text-align: center; border: 1px solid #000">' . $numCession++ . '</td>';
            $detailTableauSup20Lignes .= '<td style="text-align: center; border: 1px solid #000">' . $ligneRapport->getDateCession()->format('d-m-Y') . '</td>';
            $detailTableauSup20Lignes .= '<td style="text-align: center; border: 1px solid #000">' . ($ligneRapport->getDateCession()->format('H:i:s')) . '</td>';
            $detailTableauSup20Lignes .= '<td style="text-align: right; border: 1px solid #000">' . number_format($ligneRapport->getValeurPortefeuille(), 2) . '</td>';
            $detailTableauSup20Lignes .= '<td style="text-align: right; border: 1px solid #000">' . number_format($ligneRapport->getPrixCessionBrut(), 2) . '</td>';
            $detailTableauSup20Lignes .= '<td style="text-align: right; border: 1px solid #000">' . number_format($ligneRapport->getFraisCession(), 2) . '</td>';
            $detailTableauSup20Lignes .= '<td style="text-align: right; border: 1px solid #000">' . number_format($ligneRapport->getPrixCession(), 2) . '</td>';

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

    <tr>
        <td style="text-align: center; border: 1px solid #000"><?= 'fusion cessions' ?></td>
        <td style="text-align: center; border: 1px solid #000">31-12-<?php $this->annee ?></td>
        <td style="text-align: center; border: 1px solid #000">23:59:59</td>
        <td style="text-align: right; border: 1px solid #000"><?= number_format($sommeValeurPortefeuille, 2); // Valeur du portefeuille juste avant c           ?></td>
        <td style="text-align: right; border: 1px solid #000"><?= number_format($sommeCessionBrut, 2) // Prix de cession brut           ?></td>
        <td style="text-align: right; border: 1px solid #000"><?= number_format($sommeFraisCession, 2) //Frais de cession           ?></td>
        <td style="text-align: right; border: 1px solid #000"><?= number_format($sommePrixCession, 2) //Prix d'acquisition c-1           ?></td>
        <td style="text-align: right; border: 1px solid #000"></td>
        <td style="text-align: right; border: 1px solid #000"><?= $sommePrixCessionEtSoults ?></td>
        <td style="text-align: right; border: 1px solid #000"><?= number_format($sommePrixCession, 2) //Prix d'acquisition c-1           ?></td>

        <td style="text-align: right; border: 1px solid #000"><?= number_format($sommePrixAcquites, 2) // Acquisition fiat depuis c-1           ?></td>
        <td style="text-align: right; border: 1px solid #000"><?= number_format($sommeFractionsInitialesCapital, 2) // Valeur nominale c-1           ?></td>
        <td style="text-align: right; border: 1px solid #000"><?= number_format($sommePrixTotalAcquisition, 2) // Valeur nominale c-1           ?></td>
        <td style="text-align: right; border: 1px solid #000"><?= number_format($sommePlusOuMoinsValue, 2); //Plus ou moins value           ?></td>

    </tr>
    <tr>
        <td style="text-align: right" colspan="13">Plus-value ou moins-value globale (224) :
        </td>

        <td style="text-align: right; border: 1px solid #000"><b
                    style="font-size: 12px"><?= ($totalPlusOuMoinsValue > 0) ? '+' : '' ?><?= number_format($totalPlusOuMoinsValue, 2) ?></b>
        </td>
    </tr>

</table>



<h4>Prix total d'acquisition au 1er janvier <?= $this->annee ?>: <?= $this->totalAcquisitionDebutAnnee ?> €</h4>

<h3>Détail des lignes fusionnées dans la ligne 20</h3>

<table>
    <?= $detailTableauSup20Lignes ?>
</table>


<h3>Calcul du correctif pour les termes de PV</h3>



<p>SOMME(PV) = SOMME(i218) - SOMME(i223 x i217 / i212)</p>

<?php echo $sommePlusOuMoinsValue . '=' . $sommePrixCession . '-' . $sommeSecondtermePV; ?>

<p>SOMME(i223 x i217 / i212) x C = SOMME(i223) x SOMME(i217) / SOMME(i212))</p>

<p>C
    = <?php echo '(' . $sommePrixTotalAcquisition . ' x ' . $sommePrixCessionEtSoults . ' / ' . $sommeValeurPortefeuille . ') / ' . $sommeSecondtermePV ?> </p>
<?php $correction = (($sommePrixTotalAcquisition * $sommePrixCessionEtSoults / $sommeValeurPortefeuille) / $sommeSecondtermePV) ?>
<p>C = <?= $correction ?></p>

<p>Correction des 223, 217 et 212 : </p>
<p>223Corrigé = SOMME(223) / racinecarre(C) </p>
<?php $sommePrixTotalAcquisitionCorrige = ($sommePrixTotalAcquisition / pow($correction, 1 / 2)) ?>
<p>223Corrigé = <?php echo $sommePrixTotalAcquisitionCorrige ?></p>
<p>217Corrigé = SOMME(217) / racinecarre(C) </p>
<?php $sommePrixCessionEtSoultsCorrige = ($sommePrixCessionEtSoults / pow($correction, 1 / 2)) ?>
<p>217Corrigé = <?= $sommePrixCessionEtSoultsCorrige ?></p>
<p>212Corrigé = SOMME(212) </p>


<p>Calcul PV avec correction des termes</p>
<?php // ligne 218 – [(ligne 223) x (ligne 217) / (ligne 212)]  ?>
PV = <?= $sommePrixCession ?>
- <?= '(' . $sommePrixTotalAcquisitionCorrige . ' x ' . $sommePrixCessionEtSoultsCorrige . ' / ' . $sommeValeurPortefeuille . ')' ?>
<?php $newPV = $sommePrixCession - ($sommePrixTotalAcquisitionCorrige * $sommePrixCessionEtSoultsCorrige / $sommeValeurPortefeuille) ?>
PV = <?= $newPV ?>


<h3>RECAPITULATIF AU NIVEAU DU FOYER FISCAL (cadre 5)</h3>
<p>Total des prix de cession réalisés au niveau du foyer fiscal (51) : <?= $totalPrixCession ?></p>
<p>Total des plus-values et moins-values réalisées au niveau du foyer fiscal (52)
    : <?= ($totalPlusOuMoinsValue > 0) ? '+' : '' ?><?= number_format($totalPlusOuMoinsValue, 2) ?></p>
<?php if ($totalPlusOuMoinsValue > 0) : ?>
    <p>Ce montant est à reporter ligne 3AN de la 2042 C</p>
<?php elseif ($totalPlusOuMoinsValue < 0): ?>
    <p>Ce montant est à reporter ligne 3BN de la 2042 C</p>
<?php endif ?>

<br pagebreak="true"/>
<h1>Total de fiat investit dans la crypto entre deux cessions de crypto</h1>
<table style="border: 1px solid #000">
    <tr>
        <!--        <td>#</td>-->
        <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 $numCession = 1 ?>


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

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

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

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

                <?php else : ?>
                    <?php break; ?>
                <?php endif ?>
            <?php endforeach ?>


        </table>

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


<h1>Valeur du portefeuille</h1>
<?php //var_dump($this->arrayValuesWalletEUR); exit; ?>
<?php foreach ($this->arrayValuesWalletEUR as $date => $walletArray) : ?>
    <h3><?= $date ?></h3>

    <table style="border: 1px solid #000">
        <?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 ($walletArray as $wallet) : ?>
            <tr>
                <td style="text-align: center; border: 1px solid #000">
                    <?= $wallet['devise'] ?>
                </td>
                <td style="text-align: right; border: 1px solid #000">
                    <?= $wallet['qty'] ?>
                </td>
                <td style="text-align: right; border: 1px solid #000">
                    <?= number_format($wallet['unitPrice'], 2) ?>
                </td>
                <td style="text-align: right; border: 1px solid #000">
                    <?= number_format($wallet['total'], 2) ?>
                </td>
                <?php $totalWalletCession += $wallet['total'] ?>
            </tr>
        <?php endforeach; ?>
        <tr>
            <td>

            </td>
            <td>

            </td>
            <td>

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

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


</body>
</html>


??

??