<?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(){
        $("#search-btn").click(function(){
            $('#page').val(0);
            var params = $('#searchForm').serialize();
            window.location.href = "/finance/ems-list?" + params;
        });
        $("#save-btn").click(function(){
            if(confirm('是否确认提交?')) {
                var params = $("#listForm").serialize();
                $.post('/finance/ems-list-save',params,function(obj){
                    alert(obj.msg);
                    window.location.reload();
                },'json');
            }
        });
        $("#export-btn").click(function(){
            $('#page').val(0);
            var params = $('#searchForm').serialize();
            window.location.href = "/finance/ems-export?" + params;
        });
    });
</script>
<table width="98%" border="0" align="center" cellpadding="2" cellspacing="1" class="table">
    <form id="searchForm">
        <tr>
            <td class="td_bg">
                月份：<input name="year" id="year" type="text" value="<?=$year?>" style="width:100px;">年<select name="month" id="month">
                    <option value="01" <?=$month=='01'?'selected':''?>>01</option>
                    <option value="02" <?=$month=='02'?'selected':''?>>02</option>
                    <option value="03" <?=$month=='03'?'selected':''?>>03</option>
                    <option value="04" <?=$month=='04'?'selected':''?>>04</option>
                    <option value="05" <?=$month=='05'?'selected':''?>>05</option>
                    <option value="06" <?=$month=='06'?'selected':''?>>06</option>
                    <option value="07" <?=$month=='07'?'selected':''?>>07</option>
                    <option value="08" <?=$month=='08'?'selected':''?>>08</option>
                    <option value="09" <?=$month=='09'?'selected':''?>>09</option>
                    <option value="10" <?=$month=='10'?'selected':''?>>10</option>
                    <option value="11" <?=$month=='11'?'selected':''?>>11</option>
                    <option value="12" <?=$month=='12'?'selected':''?>>12</option>
                </select>
                <input type="button" class="act_btn" id="search-btn" name="search-btn" value="搜索">
                <input type="button" class="act_btn" id="save-btn" name="save-btn" value="保存价格">
                <input type="button" class="act_btn" id="export-btn" name="export-btn" value="导出文件">
            </td>
        </tr>
    </form>
</table>
<table width="98%" border="0" align="center" cellpadding="2" cellspacing="1" class="table">
    <tr>
        <td width="50" align="center" class="bg_tr">序号</td>
        <td width="120" align="center" class="bg_tr">快递公司</td>
        <td width="100" align="center" class="bg_tr">快递单号</td>
        <td width="100" align="center" class="bg_tr">快递电话</td>
        <td width="100" align="center" class="bg_tr">价格</td>
        <td width="120" align="center" class="bg_tr">车牌号</td>
        <td width="30%" align="center" class="bg_tr">备注</td>
        <td width="120" align="center" class="bg_tr">发送时间</td>
        <td width="120" align="center" class="bg_tr">业务员</td>
    </tr>
    <form id="listForm">
    <?php
    foreach($items as $index => $item) {
        $start_index = ($page - 1) * 20 + $index;
        ?>
        <tr onMouseOver=overColor(this) onMouseOut=outColor(this)>
            <td align="center" class="td_bg"nowrap ><?=$start_index+1?></td>
            <td class="td_bg" nowrap><?=$item->ems_company?></td>
            <td class="td_bg" nowrap><?=$item->ems_no?></td>
            <td class="td_bg" nowrap><?=$item->ems_phone?></td>
            <td class="td_bg" nowrap><input type="text" style="width:100px;" name="prices[<?=$item->id?>]" value="<?=$item->ems_price?>"></td>
            <td class="td_bg" nowrap><?=$item->car->car_no?></td>
            <td class="td_bg" nowrap><?=$item->ems_remark?></td>
            <td class="td_bg" nowrap><?=$item->created_at?></td>
            <td class="td_bg" nowrap><?=$item->user->getShowName()?></td>
        </tr>
        <?php
    }
    ?>
    </form>
    <tr >
        <td height="25" colspan="9" align="center" class="td_bg"><?=$page_info?></td>
    </tr>
</table>
