<?php
use home\assets\MainAsset;
use yii\helpers\Url;
use yii\helpers\Html;
use yii\widgets\Menu;
use yii\helpers\ArrayHelper;
use home\modules\reimbursement\models\reimbursement;
use yii\widgets\ActiveForm;
use yii\helpers\StringHelper;

/* @var $this \yii\web\View */
/* @var $form yii\bootstrap\ActiveForm */
/* @var $model \home\modules\reimbursement\models\Reimbursement */
MainAsset::register($this);

$this->title = '报销列表';
?>

<?php $this->beginPage() ?>
<!DOCTYPE html>
<html lang="<?= Yii::$app->language ?>">
    <head>
        <meta charset="<?= Yii::$app->charset ?>"/>
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <meta name="description" content="">
        <meta name="author" content="">
        <?= Html::csrfMetaTags() ?>
        <title><?= Html::encode($this->title) ?></title>
        <?php $this->head() ?>
        <script>
            var GV = {
                announceAjaxUrl:"<?= Url::to(['/announcement/ajax']) ?>"
            };
            var categoryId = "<?= Yii::$app->cache->get('categoryId') ?>";
            window.onload = (function() {
                top.$('.month').attr('href',top.monthUrl + '&id=' + categoryId);
                top.$('.week').attr('href',top.weekUrl + '&id=' + categoryId);
                top.$('.reim').attr('href',top.reimUrl + '&id=' + categoryId);
                top.$('.verify').attr('href',top.verifyUrl + '&id=' + categoryId);
            });
        </script>
    </head>
    <body style="background: white;">
        <?php $this->beginBody() ?>
        <table class="table task-table">
                <tr>
                    <th width="20%">报销类别</th>
                    <th width="10%">报销数量</th>
                    <th width="15%">总金额</th>
                    <th width="10%">总张数</th>
                    <th width="10%">未审核</th>
                    <th width="10%">通过</th>
                    <th width="10%">否决</th>
                    <!-- <th width="10%">操作</th> -->
                </tr>
                <?php if (empty($categorys)) : ?>
                    <tr><td colspan="5" class="tac red">还没有任何数据...</td></tr>
                <?php else : ?>
                    <?php $allCount = $allMoney = $allBill = $allWait = $allEnable = $allDisable = 0; ?>
                    <?php foreach ($categorys as $key =>$category) : ?>
                        <?php 
                            $allCount += $category['count'];
                            $allMoney += $category['money'];
                            $allBill += $category['bill'];
                            $allWait += $category['wait'];
                            $allEnable += $category['enable'];
                            $allDisable += $category['disable'];
                        ?>
                        <tr>
                            <td class='theleft-min'><?= $category['name'] ?></td>
                            <td><?= $category['count'] ?></td>
                            <td class='theright-min'><?= number_format($category['money'], 2 , '.' , ' ,') ?></td>
                            <td><?= $category['bill'] ?></td>
                            <td><?= $category['wait'] ?></td>
                            <td><?= $category['enable'] ?></td>
                            <td><?= $category['disable'] ?></td>
                            <!-- <td><a href="javascript:;">展开</a></td> -->
                        </tr>
                    <?php endforeach; ?>
                <?php endif; ?>

                <tr>
                    <td class='theleft-min'>总计</td>
                    <td><?= $allCount ?></td>
                    <td class='theright-min'><?= number_format($allMoney, 2 , '.' , ' ,') ?></td>
                    <td><?= $allBill ?></td>
                    <td><?= $allWait ?></td>
                    <td><?= $allEnable ?></td>
                    <td><?= $allDisable ?></td>
                </tr>
            </table>
        <?php $this->endBody() ?>
    </body>
</html>
<?php $this->endPage() ?>
        

            
