<?php
use \common\libs\MyLib;
?>
<link rel="stylesheet" href="/js/fileupload/css/jquery.fileupload.css">
<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="insurer_no" type="text" value="<?=$insurer_no?>">
                车牌：<input name="car_no" type="text" value="<?=$car_no?>">
                <!--日期-->
                提单日期：
                <input type="Text" class="Wdate" name="begin_date" onclick="WdatePicker()" value="<?= $begin_date ?>" />
                --
                <input type="Text" class="Wdate" name="end_date" onclick="WdatePicker()" value="<?= $end_date ?>" />
                出单日期：
                <input type="Text" class="Wdate" name="r_begin_date" onclick="WdatePicker()" value="<?= $p_begin_date ?>" />
                --
                <input type="Text" class="Wdate" name="r_end_date" onclick="WdatePicker()" value="<?= $p_end_date ?>" />
                <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="24" align="center" class="bg_tr">序号</td>
        <td align="center" class="bg_tr">车牌号</td>
        <td align="center" class="bg_tr">保险公司</td>
        <td align="center" class="bg_tr">保单号</td>
        <td align="center" class="bg_tr">提单日期</td>
        <td align="center" class="bg_tr">出单日期</td>
        <td align="center" class="bg_tr">商业总保费</td>
        <td align="center" class="bg_tr">商业净保费</td>
        <td align="center" class="bg_tr">手续费比例</td>
        <td align="center" class="bg_tr">补点比例</td>
        <td align="center" class="bg_tr">退保保费</td>
        <td align="center" class="bg_tr">退保手续费比例</td>
        <td align="center" class="bg_tr">退保手续费金额</td>
        <td align="center" class="bg_tr">退保日期</td>
        <td align="center" class="bg_tr">差额</td>
        <td align="center" class="bg_tr">新保</td>
        <td align="center" class="bg_tr">续保</td>
    </tr>
    <?php
    foreach($items as $index => $item) {
        $start_index = ($page-1)*20+$index;
        $order = $item->order;
        $car = $order->car;
        if($item->business_back_money > 0) {
            ?>
            <tr style="height:24px;" onMouseOver="overColor(this)" onMouseOut="outColor(this)">
                <td align="center" class="td_bg" nowrap><?=$start_index+1?></td>
                <td align="center" class="td_bg" nowrap><?=$order ? $order->car_no : ''?></td>
                <td align="center" class="td_bg" nowrap><?=($order && $order->company) ? $order->company->name : ''?></td>
                <td align="center" class="td_bg" nowrap><?=$order ? $order->insurer1_no : ''?></td>
                <td align="center" class="td_bg" nowrap><?=$order ? $order->submit_date : ''?></td>
                <td align="center" class="td_bg" nowrap><?=$order ? $order->print_date : ''?></td>
                <td align="center" class="td_bg" nowrap><?=$order ? $order->total1 : ''?></td>
                <td align="center" class="td_bg" nowrap><?=$order ? $order->total1_clear : ''?></td>
                <td align="center" class="td_bg" nowrap><?=$order ? $order->total1_rate : ''?></td>
                <td align="center" class="td_bg" nowrap><?=$item->budian_rate?></td>
                <td align="center" class="td_bg" nowrap><?=$item->business_back_money?></td>
                <td align="center" class="td_bg" nowrap><?=$item->business_back_rate?></td>
                <td align="center" class="td_bg" nowrap><?=$item->business_back_routine?></td>
                <td align="center" class="td_bg" nowrap><?=$item->business_back_date?></td>
                <td align="center" class="td_bg" nowrap><?=$order ? round($order->total1_clear * ($order->total1_rate + $item->budian_rate)/100,2):''?></td>
                <td align="center" class="td_bg" nowrap><?=$car->op_user1?></td>
                <td align="center" class="td_bg" nowrap><?=$car->op_user3?></td>
            </tr>
            <?php
        }
        if($item->force_back_money > 0) {
            ?>
            <tr style="height:24px;" onMouseOver="overColor(this)" onMouseOut="outColor(this)">
                <td align="center" class="td_bg" nowrap><?=$start_index+1?></td>
                <td align="center" class="td_bg" nowrap><?=$order ? $order->car_no : ''?></td>
                <td align="center" class="td_bg" nowrap><?=($order && $order->company) ? $order->company->name : ''?></td>
                <td align="center" class="td_bg" nowrap><?=$order ? $order->insurer2_no : ''?></td>
                <td align="center" class="td_bg" nowrap><?=$order ? $order->submit_date : ''?></td>
                <td align="center" class="td_bg" nowrap><?=$order ? $order->print_date : ''?></td>
                <td align="center" class="td_bg" nowrap><?=$order ? $order->total2 : ''?></td>
                <td align="center" class="td_bg" nowrap><?=$order ? $order->total2_clear : ''?></td>
                <td align="center" class="td_bg" nowrap><?=$order ? $order->total2_rate : ''?></td>
                <td align="center" class="td_bg" nowrap></td>
                <td align="center" class="td_bg" nowrap><?=$item->force_back_money?></td>
                <td align="center" class="td_bg" nowrap><?=$item->force_back_rate?></td>
                <td align="center" class="td_bg" nowrap><?=$item->force_back_routine?></td>
                <td align="center" class="td_bg" nowrap><?=$item->force_back_date?></td>
                <td align="center" class="td_bg" nowrap><?=$order ? round($order->total2_clear * ($order->total2_rate)/100,2):''?></td>
                <td align="center" class="td_bg" nowrap><?=$car->op_user1?></td>
                <td align="center" class="td_bg" nowrap><?=$car->op_user3?></td>
            </tr>
            <?php
        }
        ?>
        <?php
    }
    ?>
    <tr>
        <td align="center" class="td_bg" nowrap></td>
        <td align="center" class="td_bg" nowrap></td>
        <td align="center" class="td_bg" nowrap></td>
        <td align="center" class="td_bg" nowrap></td>
        <td align="center" class="td_bg" nowrap></td>
        <td align="center" class="td_bg" nowrap></td>
        <td align="center" class="td_bg" nowrap></td>
        <td align="center" class="td_bg" nowrap></td>
        <td align="center" class="td_bg" nowrap></td>
        <td align="center" class="td_bg" nowrap></td>
        <td align="center" class="td_bg" nowrap></td>
        <td align="center" class="td_bg" nowrap></td>
        <td align="center" class="td_bg" nowrap></td>
        <td align="center" class="td_bg" nowrap></td>
        <td align="center" class="td_bg" nowrap></td>
        <td align="center" class="td_bg" nowrap></td>
        <td align="center" class="td_bg" nowrap></td>
    </tr>
    <tr >
        <td height="25" colspan="17" align="center" class="td_bg"><?=$page_info?></td>
    </tr>
</table>
<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/fileupload/js/vendor/jquery.ui.widget.js"></script>
<script type="text/javascript" language="javascript" src="/js/fileupload/js/jquery.iframe-transport.js"></script>
<script type="text/javascript" language="javascript" src="/js/fileupload/js/jquery.fileupload.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/return-insurer?" + params;
        });
    })
</script>
