Your IP : 216.73.216.86


Current Path : /var/www/homesaver/www/bitrix/modules/fermaofd.ferma/components/
Upload File :
Current File : /var/www/homesaver/www/bitrix/modules/fermaofd.ferma/components/order-receipts.php

<?php

function ofdferma_orderReceipts($orderId, $balance, $receipts)
{
    $receiptTypes = CAllOfdFermaReceipt::$receiptTypes;

    ?>
    <table class="ofd-order-receipts-table adm-detail-content-table edit-table" style="min-width: auto;">
        <tbody>
        <tr class="divider">
            <td colspan="4">&nbsp;</td>
        </tr>
        <tr class="heading">
            <td colspan="4"><?= GetMessage('FERMAOFD_ALL_RECEIPTS_N') ?><?= $orderId ?></td>
        </tr>

        <?php
        foreach ($receipts as $receipt) {

            $receiptUrl = null;

            if ($receipt['FN'] && $receipt['FDN'] && $receipt['FPD']) {
                switch ($receipt['ENV']) {
                    case 'prod':
                        $receiptUrl = sprintf('https://ofd.ru/rec/%s/%s/%s', $receipt['FN'], $receipt['FDN'], $receipt['FPD']);
                        break;
                    case 'demo':
                        $receiptUrl = sprintf('https://demo.ofd.ru/rec/%s/%s/%s', $receipt['FN'], $receipt['FDN'], $receipt['FPD']);
                        break;
                }
            }

            ?>
            <tr>
                <td class="ofd-order-receipts-table__number">
                    <?php
                    if ($receiptUrl) {
                        echo "<a href=\"$receiptUrl\" target=\"_blank\">{$receipt['FPD']}</a>";
                    } else {
                        echo $receipt['FPD'];
                    }
                    ?>
                </td>
                <td class="ofd-order-receipts-table__type"><?= isset($receiptTypes[$receipt['TYPE']]) ? $receiptTypes[$receipt['TYPE']] : '' ?></td>
                <td class="ofd-order-receipts-table__price"><?= CAllOfdFermaReceipt::receiptPriceFormat($receipt['TOTAL_PRICE']) ?></td>
                <td class="ofd-order-receipts-table__date"><?= $receipt['DATE_CREATE'] ?></td>
            </tr>
            <?php
        }
        ?>

        </tbody>
        <tfoot>
        <tr>
            <td></td>
            <td class="ofd-order-receipts-table__price-summary-label"><?= GetMessage('FERMAOFD_REMAINDER') ?>:</td>
            <td class="ofd-order-receipts-table__price"><?= CAllOfdFermaReceipt::receiptPriceFormat($balance) ?></td>
            <td></td>
        </tr>
        </tfoot>
    </table>
    <?php
}