<?php
use \common\libs\MyLib;
?>
<script type="text/javascript" language="javascript" src="/js/jquery-1.8.3.js"></script>
<script type="text/javascript" language="javascript" src="/js/ajax.js"></script>
<script type="text/javascript" language="javascript" src="/js/func.js"></script>
<script type="text/javascript" language="javascript">
    $(function(){
        $('#input-btn').click(function(){
            window.location.href = '/gift2/add';
        });
        $('#output-btn').click(function(){
            window.location.href = '/gift2/output';
        });
    });
</script>
<table width="98%" border="0" align="center" cellpadding="2" cellspacing="1" class="table">
    <tr>
        <td class="td_bg">
            礼券统计
        </td>
    </tr>
</table>
<table width="98%" border="0" align="center" cellpadding="2" cellspacing="1" class="table">
    <tr>
        <td width="50" align="center" align="center" class="bg_tr" nowrap>序号</td>
        <td width="50%" align="center" align="center" class="bg_tr">礼券名称</td>
        <td width="50" align="center" align="center" class="bg_tr" nowrap>总数量</td>
        <td width="50" align="center" align="center" class="bg_tr">未出库</td>
        <td width="50" align="center" align="center" class="bg_tr" nowrap>已出库</td>
    </tr>
    <?php
    foreach($gift_type_items as $index => $gift_type_info) {
        $total = $gift_type_info->getTickets()->count();
        $use_total = $gift_type_info->getTickets()->where('status>0')->count();
        ?>
        <tr onMouseOver=overColor(this) onMouseOut=outColor(this)>
            <td align="center" class="td_bg" nowrap ><?=$index+1?></td>
            <td align="left" class="td_bg" nowrap ><?=$gift_type_info->name?></td>
            <td align="left" class="td_bg" nowrap ><?=$total?></td>
            <td align="left" class="td_bg" nowrap ><?=$total-$use_total?></td>
            <td align="left" class="td_bg" nowrap ><?=$use_total?></td>
        </tr>
        <?php
    }
    ?>
</table>
<table width="98%" border="0" align="center" cellpadding="2" cellspacing="1" class="table">
    <tr>
        <td class="td_bg">
            礼券统计
        </td>
    </tr>
</table>
<table width="98%" border="0" align="center" cellpadding="2" cellspacing="1" class="table">
    <tr>
        <td width="50" align="center" align="center" class="bg_tr" nowrap>序号</td>
        <td width="150" align="center" align="center" class="bg_tr">礼品名称</td>
        <td width="50" align="center" align="center" class="bg_tr">价格</td>
        <td width="50%" align="center" align="center" class="bg_tr">描述</td>
        <td width="50" align="center" align="center" class="bg_tr" nowrap>当前库存</td>
    </tr>
    <?php
    foreach($gift_items as $index => $gift_info) {
        ?>
        <tr onMouseOver=overColor(this) onMouseOut=outColor(this)>
            <td align="center" class="td_bg" nowrap ><?=$index+1?></td>
            <td align="left" class="td_bg" nowrap ><?=$gift_info->name?></td>
            <td align="left" class="td_bg" nowrap ><?=$gift_info->price?></td>
            <td align="left" class="td_bg" nowrap ><?=$gift_info->remark?></td>
            <td align="left" class="td_bg" nowrap ><?=$gift_info->total?></td>
        </tr>
        <?php
    }
    ?>
</table>
