<?php
use \common\libs\MyLib;
?>
<script type="text/javascript" language="javascript" src="/js/jquery.min.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(){
        $("#search-btn").click(function(){
            $('#page').val(0);
            var params = $('#searchForm').serialize();
            window.location.href = "/finance/fee-list?" + params;
        });
        $('#upload-btn').click(function(){
            var params = $('#searchForm').serialize();
            window.open('/finance/fee-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="printdate_begin" type="text" value="<?=$printdate_begin?>" onclick="WdatePicker()" style="width:100px;"> 到 <input name="printdate_end" type="text" value="<?=$printdate_end?>" onclick="WdatePicker()" style="width:100px;">
                回款状态：<select name="return_flag">
                    <option value="0" <?=$return_flag==0?'selected':''?>>全部</option>
                    <option value="1" <?=$return_flag==1?'selected':''?>>已回款</option>
                    <option value="2" <?=$return_flag==2?'selected':''?>>未回款</option>
                </select>
                保险公司：<select name="company_id">
                    <option value="0">全部</option>
                    <?php
                    foreach($company_items as $item) {
                        ?>
                        <option value="<?=$item->id?>" <?=$item->id==$company_id?'selected':''?>><?=$item->name?></option>
                        <?php
                    }
                    ?>
                </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="2" cellspacing="1" class="table">
    <tr>
        <td width="50" align="center" class="bg_tr" nowrap>排序</td>
        <td width="60" align="center" class="bg_tr" nowrap>业务员</td>
        <td width="60" align="center" class="bg_tr" nowrap>保单号</td>
        <td width="60" align="center" class="bg_tr" nowrap>被保险人</td>
        <td width="80" align="center" class="bg_tr" nowrap>车牌号</td>
        <td width="60" align="center" class="bg_tr" nowrap>车型</td>
        <td width="60" align="center" class="bg_tr" nowrap>实收保费</td>
        <td width="60" align="center" class="bg_tr" nowrap>费用比例</td>
        <td width="60" align="center" class="bg_tr" nowrap>净手续费</td>
        <td width="80" align="center" class="bg_tr" nowrap>税额手续费</td>
        <td width="80" align="center" class="bg_tr" nowrap>已回手续费</td>
        <td width="60" align="center" class="bg_tr" nowrap>回款时间</td>
        <td width="60" align="center" class="bg_tr" nowrap>差额</td>
    </tr>
    <?php
    $index = 0;
    foreach($items as $index => $item) {
        $index++;
        $receive_total = $item->getReceiveTotal();
        ?>
        <tr onMouseOver=overColor(this) onMouseOut=outColor(this)>
            <td align="center" class="td_bg" nowrap><?=$index?></td>
            <td class="td_bg" nowrap><?=$item->user->getShowName()?></td>
            <td class="td_bg" nowrap><?=$item->insurer_no?></td>
            <td class="td_bg" nowrap><?=MyLib::substr_cut($item->id_man,15)?></td>
            <td class="td_bg" nowrap><?=$item->car_no?></td>
            <td class="td_bg" nowrap><?=MyLib::substr_cut($item->factory_model,15)?></td>
            <td class="td_bg" align="center" nowrap><?=$item->total?></td>
            <td class="td_bg" align="center" nowrap><?=$item->total_rate.'%'?></td>
            <td class="td_bg" align="center" nowrap><?=$item->total_clear_real?></td>
            <td class="td_bg" align="center" nowrap><?=$item->total_tax_real?></td>
            <td class="td_bg" align="center" nowrap><?=$receive_total?></td>
            <td class="td_bg" nowrap><?=$item->process_date?></td>
            <td class="td_bg" align="center" nowrap><?=round($item->total_clear_real - $receive_total,2)?></td>
        </tr>
        <?php
    }
    ?>
    <tr>
        <td align="center" class="bg_tr" nowrap></td>
        <td align="center" class="bg_tr" nowrap></td>
        <td align="center" class="bg_tr" nowrap></td>
        <td align="center" class="bg_tr" nowrap></td>
        <td align="center" class="bg_tr" nowrap></td>
        <td align="center" class="bg_tr" nowrap></td>
        <td align="center" class="bg_tr" nowrap><?=number_format($price_totals['total'],2)?></td>
        <td align="center" class="bg_tr" nowrap></td>
        <td align="center" class="bg_tr" nowrap><?=number_format($price_totals['price3'],2)?></td>
        <td align="center" class="bg_tr" nowrap><?=number_format($price_totals['price4'],2)?></td>
        <td align="center" class="bg_tr" nowrap><?=number_format($price_totals['price5'],2)?></td>
        <td align="center" class="bg_tr" nowrap></td>
        <td align="center" class="bg_tr" nowrap><?=number_format($price_totals['price3'] - $price_totals['price5'],2)?></td>
    </tr>
    <tr>
        <td height="25" colspan="14" align="center" class="td_bg"><?=$page_info?></td>
    </tr>
</table>



