@model string
<div class="current-location">
    <ul>
        <li class="left"><i class="glyphicon glyphicon-home"></i><a href="javascript:void(0)" onclick="location.href=location.href">发票申请管理</a></li>
        <li class="right"><a href="javascript:void(0)" onclick="LoadData()" title="刷新"><span class="glyphicon glyphicon-refresh"></span></a></li>
    </ul>
</div>
<div class="head-tab head-tab_hasa">
    <ul>
        <li class="tabhead" num="0"><a href="@Url.Action("Index","Invoice")?num=0">所有发票</a></li>
        <li class="tabhead" num="1"><a href="@Url.Action("Index","Invoice")?num=1&state=0">提交中</a></li>
        <li class="tabhead" num="2"><a href="@Url.Action("Index","Invoice")?num=2&state=1">已确定</a></li>
        <li class="tabhead" num="3"><a href="@Url.Action("Index","Invoice")?num=3&state=2">已寄出</a></li>
        <li class="tabhead" num="4"><a href="@Url.Action("Index","Invoice")?num=4&state=3">已经收到</a></li>
        <li class="tabhead" num="5"><a href="@Url.Action("Index","Invoice")?num=5&state=-1">已经退回</a></li>
    </ul>
</div>
<div class="main no-top-border">
    <table class="tb-head" cellpadding="0" cellspacing="0" border="0">
        <tr class="clearfix">
            <td class="btn-group left">
                <button type="button" class="btn btn-default btn-sm ui-selectInvert">反选</button>
                <div class="btn-group btn-group-sm">
                    <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
                        菜单<span class="caret"></span>
                    </button>
                    <ul class="dropdown-menu" role="menu">
                        <li><a href="javascript:void(0)" class="ui-dialog" data-custom-params="title:'添加',url:'@Url.Action("Add")',width:'700px',height:'90%'">添加</a></li>
                        <li class="divider"></li>
                        <li><a href="javascript:void(0)" class="ui-deleteMultiple" data-custom-params="url:'@Url.Action("Delete")'">删除</a></li>
                    </ul>
                </div>
            </td>
            <td class="form-inline form-group-sm right controls">
                <select id="order" class="form-control ui-queryString option_jj">
                    <option value="">选择排序方式</option>
                    <option value="thedate desc">按时间↓</option>
                    <option value="thedate asc">按时间↑</option>
                </select>
                <input type="text" id="thedate" name="thedate" maxlength="30" style="width:105px" placeholder="开始日期" onclick="laydate({istime:true,format:'YYYY-MM-DD'})" class="laydate-icon form-control ui-queryString">
                <input type="text" id="thedate" name="thedate" maxlength="30" style="width:105px" placeholder="结束日期" onclick="laydate({istime:true,format:'YYYY-MM-DD'})" class="laydate-icon form-control ui-queryString">
                <select id="field" class="form-control ui-queryString ui-setName">
                    <option value="reveiver_name">收件人</option>
                    <option value="invoice_number">发票号</option>
                </select>
                <input type="text" id="keyword" placeholder="请输入关键词" value="" maxlength="30" style="width:100px" class="form-control ui-queryString ui-keyword">
                <button type="button" class="btn btn-default btn-sm ui-queryString-search">确定</button>
            </td>
        </tr>
    </table>
    <table border=0 cellpadding=0 cellspacing=0 width=100% class="table table-bordered" id="tb_list">
        <thead><tr>
            <td align="center"  style="width:40px"><input type="checkbox" title="选择" class="ui-selectInvert" data-custom-params="isReverse:false"></td>
            <td align="center" width="9%">收件公司</td>
            <td align="center">收件人</td>
            <td align="center" width="12%">收件地址</td>
            <td align="center">邮编号码</td>
            <td align="center">联系电话</td>
            <td align="center">发票类型</td>
            <td align="center" width="9%">发票抬头</td>
            <td align="center" width="15%">备注</td>
            <td align="center">发件方式</td>
            <td align="center">发票状态</td>
            <td align="center" width="20%">操作</td>
        </tr>
        <tr class="item" id="item_{id}">
            <td align="center"><input type="checkbox" id="id" name="id" value="{id}"></td>
            <td align=left>{reveiver_company}</td>
            <td align="center">{reveiver_name}</td>
            <td align=left>{reveiver_address}</td>
            <td align="center">{reveiver_postcode}</td>
            <td align=left>{reveiver_phone}</td>
            <td align="center" class="thetype">{thetype}</td>
            <td align=left>{header}</td>
            <td align="center">{remark}</td>
            <td align="center" class="send_way">{send_way}</td>
            <td align="center" class="state">{state}</td>
            <td align="center">
                <div class="btn-group btn-group-sm">
                    <a href="javascript:void(0)" class="btn btn-default btn-sm ui-dialog" data-custom-params="title:'{reveiver_company}-修改',url:'@Url.Action("Edit")?id={id}',width:'700px',height:'90%'">修改</a>
                    <a href="javascript:void(0)" class="btn btn-default btn-sm ui-deleteSingle" data-custom-params="url:'@Url.Action("Delete")',id:'{id}'">删除</a>
                </div>
            </td>
        </tr>
    </table>
</div>
<script type="text/javascript">
    document.write('<' + 'script type="text/javascript" src="' + baseUrl + '/js/list.js"></' + 'script>');
    function LoadData()
    {
        var url = "@Url.Action("PageListData")?state=" + Request("state");
        $("#tb_list").ListBind(url, {callBack: "LoadedInit" });
        $(".tabhead").eq(parseInt(Request("num"))).addClass("current").siblings().removeClass("current");
        Replace(".thetype", "普通发票", "增值税发票");//obj对象名 text1替换文本1 text2替换文本2
        Replace(".send_way", "快递", "自己取件");
        ReplaceState();
    }
    LoadData();
    function ReplaceState() {          
        $(".state").each(function () {
            if ($(this).text() == "0") {
                $(this).text("提交中")
            } else if ($(this).text() == "1") {
                $(this).text("已确定")
            } else if ($(this).text() == "2") {
                $(this).text("已寄出")
            } else if ($(this).text() == "3") {
                $(this).text("已收到")
            } else if ($(this).text() == "-1") {
                $(this).text("已退回")
            }
        })
    }
</script>