<?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/datepicker/WdatePicker.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 edit(id) {
        var params = $('#searchForm').serialize();
        window.location.href = '/finance/pay3-info?id=' + id + '&pay_date=<?=$pay_date?>' + '&back_params=' + encodeURIComponent(params);
    }

    $(function(){
        $("#search-btn").click(function(){
            $('#page').val(0);
            var params = $('#searchForm').serialize();
            window.location.href = "/finance/pay3-list?" + params;
        });
    });


</script>
<table width="98%" border="0" align="center" cellpadding="3" cellspacing="1" class="table">
    <form id="searchForm">
        <input type="hidden" id="page" name="page" value="<?=$page?>">
        <tr>
            <td class="td_bg">
                工号：<input name="username" type="text" value="<?=$username?>">
                真实姓名：<input name="name" type="text" value="<?=$name?>">
                工资月份：<input name="pay_date" id="pay_date" class="Wdate" type="text" value="<?=$pay_date?>" onClick="WdatePicker({dateFmt:'yyyy-MM'})">
                分组：<select name="group_id">
                    <option value="0">全部</option>
                    <?php
                    foreach($group_items as $group) {
                        echo '<option value="'.$group->id.'"';
                        if($group->id == $group_id)
                            echo ' selected ';
                        echo '>'.$group->name.'</option>';
                    }
                    ?>
                </select>
                <input type="button" class="act_btn" id="search-btn" name="search-btn" value="搜索">
            </td>
        </tr>
    </form>
</table>
<table width="98%" border="0" align="center" cellpadding="3" cellspacing="1" class="table">
    <tr>
        <td width="100" align="center" align="center" class="bg_tr">工号</td>
        <td align="center" class="bg_tr">真实姓名</td>
        <td width="100" align="center" class="bg_tr">工资月份</td>
        <td align="center" class="bg_tr">所属岗位</td>
        <td width="60" align="center" class="bg_tr">角色</td>
        <td width="60" align="center" class="bg_tr">工资</td>
        <td width="30" align="center" class="bg_tr">操作</td>
    </tr>
    <form id="delFrm">
        <?php
        foreach($items as $index => $item) {
            $pay_info = $item->getPay($pay_date);
            $real_pay = 0;
            if($pay_info)
                $real_pay = $pay_info->real_pay;
            ?>
            <tr onMouseOver=overColor(this) onMouseOut=outColor(this)>
                <td align="left" class="td_bg" nowrap ><?=$item->username?></td>
                <td class="td_bg" nowrap><?=$item->name?></td>
                <td class="td_bg" nowrap><?=$pay_date?></td>
                <td align="left" class="td_bg" nowrap><?=$item->group?$item->group->getPath():''?></td>
                <td class="td_bg" nowrap><?=$item->role?$item->role->name:''?></td>
                <td align="center" class="td_bg" nowrap data="<?=$item->id?>">
                    <?=number_format($real_pay,2)?>元
                </td>
                <td align="center" class="td_bg" nowrap>
                    [<a href="javascript:void(0);" onclick="edit(<?=$item->id?>)">详情</a>]
                </td>
            </tr>
            <?php
        }
        ?>
    </form>
    <tr >
        <td height="25" colspan="11" align="center" class="td_bg"><?=$page_info?></td>
    </tr>
</table>