<table border="0" align="center" cellpadding="0" cellspacing="0" id="mian" ms-controller="BooksBorrow">
    <tbody>
        <tr>
            <!--leftNav-->
            <td width="198" height="450" valign="top" id="tdleft">
                <div id="left">
                    <h2>物品资产
                    </h2>
                    <ul> 
                        <li><b></b><a  href="#/Office/GoodsAssets/" class="wdgk_ico">我的概况</a></li>
                        <li><b></b><a  ms-click ="onSubNav('goods')" href="javascript:void(0);" class="ypgl_ico">用品管理</a></li>
                        <div ms-visible="showSubNav == 'goods'" class="subbox">
                            <ul>
                                <li><a href="#/Office/GoodsList">物品维护</a></li>
                                <li><a href="#/Office/GoodsInventory">库存盘点</a></li>
                                <li><a href="#/Office/GoodsPurchase">采购历史</a></li>
                                <li><a href="#/Office/GoodsStorage">采购入库</a></li>
                                <li><a href="#/Office/GoodsUses">领用历史</a></li>
                                <li><a href="#/Office/GoodsMyUses">我的领用</a></li>
                            </ul>
                        </div> 
                        <li><b></b><a  ms-click ="onSubNav('books')" href="javascript:void(0);" class="tsgl_ico">图书管理</a></li>
                        <div ms-visible="showSubNav == 'books'" class="subbox">
                            <ul>
                                <li><a href="#/Office/BooksBorrow">借阅管理</a></li>
                                <li><a href="#/Office/BooksReturn/0/" >归还管理</a></li>
                                <li><a href="#/Office/Books/" >书籍管理</a></li>
                            </ul>
                        </div> 
                        <li><b></b><a ms-click ="onSubNav('cars')" href="javascript:void(0);" class="clgl_ico">车辆管理</a></li>
                        <div ms-visible="showSubNav == 'cars'" class="subbox">
                            <ul>
                                <li><a href="#/Office/CarApply">用车申请</a></li>
                                <li><a href="#/Office/CarAppoint">派车管理</a></li>
                                <li><a href="#/Office/CarUsesInfo">车辆使用信息</a></li>
                                <li><a href="#/Office/CarUseSearch">用车查询</a></li>
                                <li><a href="#/Office/CarInsure">车辆保险</a></li>
                                <li><a href="#/Office/CarService">车辆维修保养</a></li>
                                <li><a href="#/Office/Car">车辆档案</a></li>
                            </ul>
                        </div>
                        <li class="last"><b></b><a  ms-click ="onSubNav('assets')" href="javascript:void(0);" class="zcgl_ico">资产管理</a></li> 
                        <div ms-visible="showSubNav == 'assets'" class="subbox">
                            <ul>
                                <li><a href="#/Office/FixedAssetsMy">我的资产</a></li>
                                <li><a href="#/Office/FixedAssets" >资产登记</a></li>
                                <li><a href="#/Office/FixedAssetsUses" >资产领用</a></li>
                                <li><a href="#/Office/FixedAssetsReturn" >资产归还</a></li>
                                <li><a href="#/Office/FixedAssetsRepairs" >资产报修</a></li>
                                <li><a href="#/Office/FixedAssetsRepairsConfirm" >维修确认</a></li>
                                <li><a href="#/Office/FixedAssetsScrap" >资产报废</a></li>
                                <li><a href="#/Office/FixedAssetsReport" >资产报表</a></li>
                                <li><a href="#/Office/FixedAssetsSet" >后台设置</a></li>
                    </ul>
                </div>
                    </ul>
                </div>
                <!--End leftNav-->
            </td>
            <td valign="top" id="right" class="addrightbg">
                <div>  
                <div class="boxtip" id="boxtip">
                    <h1>借阅管理</h1>
                    <p> 借阅管理</p>
                    <a href="javascript:history.go(-1)" class="btn_back"></a>
                </div> 
                  <table width="100%" border="0" cellspacing="0" cellpadding="0" class="seacrhTable" id="seacrhTable">
                    <tbody>
                        <tr>
                            <td width="440" class="searchico">
                                <div class="input-append" style="margin-bottom: 0px;">
                                    <input type="text" class="span4" ms-duplex='key' placeholder="请输入借阅单号或者借阅人姓名查询" ms-keypress='toEnter'>
                                    <button class="add-on ibtsearch" style="height: 28px; font-size: 12px; padding: 3px 12px;" ms-click='toSearch' ms-html='lang.SearchBtn'></button>
                                    <button class="add-on ibtsearch" style="height: 28px; font-size: 12px; padding: 3px 12px;" ms-click="clearSearchItem" ms-html='lang.ShowAllBtn'></button>
                                </div>
                            </td>
                            <td class="fgray">{{lang.SearchHistory}}
                                <span class="bindSearchHistory" ms-each-h='searchHistory'>
                                    <a href="javascript:void(0)" ms-title='h' ms-live-click="findByHistoryKey">{{h|truncate(10)}}</a>
                                </span>
                            </td>
                        </tr>
                    </tbody>
                </table>
                <table width="100%" border="0" cellspacing="0" cellpadding="0" class="seacrhField" style="margin-left:5px;">
                    <tbody>
                        <tr class="bindQuick">
                            <td width="50%"><span ms-html="borrowCount.label"></span>
                                <div style="display: inline;">
                                    <a href="javascript:void(0)" ms-repeat-f="borrowCount.items" ms-live-click='setCondition($index,borrowCount.items,"borrowCount")' ms-class-selected="f.curr" ms-html='f.label' data-key='borrowCount'></a>
                                </div>
                            </td>
                            <td><span ms-html="borrowMoney.label"></span>
                                <div style="display: inline;">
                                    <a href="javascript:void(0)" ms-repeat-t='returnTime.items' ms-live-click='setCondition($index,returnTime.items,"returnTime")' ms-class-selected="t.curr" ms-html='t.label' data-key='returnTime'></a>
                                </div>
                            </td>
                        </tr>
                        <tr class="bindQuick">
                            <td><span ms-html="borrowMoney.label"></span>
                                <div style="display: inline;">
                                    <a href="javascript:void(0)" ms-repeat-s='borrowMoney.items' ms-live-click='setCondition($index,borrowMoney.items,"borrowMoney")' ms-class-selected="s.curr" ms-html='s.label' data-key='borrowMoney'></a>
                                </div>
                            </td>
                            <td ><span ms-html="state.label"></span>
                                <div style="display: inline;">
                                    <a href="javascript:void(0)" ms-repeat-t='state.items' ms-live-click='setCondition($index,state.items,"state")' ms-class-selected="t.curr" ms-html='t.label' data-key='state'></a>
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td colspan="2" class="seabox">
                                <span class="first" ms-html='lang.CurrSearchCondition'></span>
                                <div style="display: inline;" ms-with='currConditions'>
                                    <span class="searchItem" ms-if='$val'>{{$val}}
                                        <i><a href="javascript:void(0)" ms-click='removeItem'></a></i>
                                    </span>
                                </div>
                                <span class="last" ms-visible='hasCondition' ms-live-click='clearAllItem'><a href="javascript:void(0)" ms-html='lang.ClearAll'></a></span>
                            </td>
                        </tr>
                    </tbody>
                </table>
                <div class="boxTitlenob">
                    <h2>借阅列表</h2>
                </div>
                <table width="100%" border="0" cellspacing="1" cellpadding="0" class="tableList bottom10" id="tableList">
                    <thead>
                        <tr class="dobtn" style="background-color: rgb(255, 255, 255);">
                            <td colspan="9">
                                <a ms-if="ADD"  href="javascript:void(0)" class="doadd" ms-click="showAdd" >{{lang.AddBtn}}</a> 
                                <a ms-if="DELETE" href="javascript:void(0)" class="doalldel" ms-click="doRemoveAll">{{lang.BtachDelBtn}}</a>
                                <!--<div class="btn-group">
                                    <button type="button" class="btn btn-primary dropdown-toggle">
                                        Action<span class="caret"></span>
                                    </button>
                                    <ul class="dropdown-menu" role="menu">
                                        <li><a href="javascript:void(0);">Act1</a></li>
                                        <li><a href="javascript:void(0);">Act1</a></li>
                                        <li><a href="javascript:void(0);">Act1</a></li>
                                        <li class="divider"></li>
                                        <li><a href="javascript:void(0);">Act1</a></li>
                                    </ul>
                                </div>-->
                            </td>
                        </tr>
                        <tr class="head" style="background-color: rgb(250, 250, 250);">
                            <td width="3%" align="center">
                                 <input type="checkbox" class="checkAll">
                            </td>
                            <td width="15%" align="center">借阅单号
                            </td>
                            <td width="15%" align="center">借阅人
                            </td>
                            <td width="15%" align="center">借出时间
                            </td>
                            <td width="10%" align="center">借出册数
                            </td>
                            <td width="10%" align="center">借出经手人
                            </td>
                            <td width="20%" align="center">计划归还时间
                            </td>
                            <td width="5%" align="center">状态
                            </td>
                            <td width="10%" align="center">操作
                            </td>
                        </tr>
                    </thead>
                    <tbody> 
                        <tr ms-repeat-item="list" style="background-color: rgb(255, 255, 255);">
                            <td align="center">
                                 <input type="checkbox" name="checkbox" ms-value="item.Id">
                             </td>
                            <td align="left"><a href="javascript:void(0)" ms-click="showView(item)">{{item.BillNo}}</a>
                            </td>
                            <td align="left">
                                {{item.BorrowBy.FullName}}
                            </td>
                            <td align="center">
                                {{item.BorrowTime|truncate(10,'')}}
                            </td>
                            <td align="center">
                                {{item.BorrowTotalCount}}
                            </td>
                            <td align="center">
                                {{item.AddBy.FullName}}
                            </td>
                            <td align="center">
                                {{item.PlanReturnTime|truncate(10,'')}}
                            </td>
                            <td align="center">
                                <span ms-if="item.State==0" class="stNam" title="未还"></span>
                                <span ms-if="item.State==1" class="stNo" title="已还部分"></span>
                                <span ms-if="item.State==2" class="stCom" title="已还清"></span>
                                <span ms-if="item.State==3" class="stErr" title="坏单"></span>
                            </td>
                            <td align="right">
                                <a ms-if="RETURN && item.State<2" ms-href="'#/Office/BooksReturn/'+item.BillNo+'/add/'" class="doneck" title="归还"></a>
                                <a href="javascript:void(0)" class="doview" ms-click="showView(item)" ms-value="item.Id" ms-title="lang.ViewBtn"></a>
                                <a ms-if="item.EDIT" href="javascript:void(0)" class="doedit" ms-click="showEdit(item)" ms-value="item.Id" ms-title="lang.EditBtn"></a>
                                <a ms-if="!item.EDIT" href="javascript:void(0)" class="noedit"  ms-title="lang.EditBtn"></a>
                                <a ms-if="item.DELETE" href="javascript:void(0)" class="dodel" ms-click="doRemove(item)" ms-attr-index="$index" ms-value="item.Id" ms-title="lang.DelBtn"></a>
                                <a ms-if="!item.DELETE" href="javascript:void(0)" class="nodel"  ms-title="lang.DelBtn"></a>
                            </td>
                        </tr> 
                    </tbody>
                    <tfoot>
                       <tr>
                           <td colspan="9" ms-widget='paging,listPage,listOpts'>
                           </td>
                        </tr>
                    </tfoot>
                </table>
                    </div>
            </td>
        </tr>
    </tbody>
</table>

<!--新增-->
<noscript type="text/avalon" id="BooksBorrowformTemplate">
    <div>
        <ul class="tabWarp">
            <li ms-class-1="hover:tab=='tab1'" ms-class-2="normal:tab!='tab1'" val="tab1" ms-click="tabChange">基本信息</li>
            <li ms-class-1="hover:tab=='tab2'" ms-class-2="normal:tab!='tab2'" val="tab2" ms-click="tabChange">借阅图书清单</li>
        </ul>
    </div>

    <div id="tab1" ms-visible="tab=='tab1'" ms-css-width="tabWidth" ms-css-height="tabHeight">
        <table cellspacing="0" cellpadding="0" border="0" class="commontable tabtable shortSelect">
            <tbody>
                <tr>
                    <th style="width:70px;">借阅单号：</th>
                    <td>
                        <input type="text" ms-duplex="entity.BillNo" placeholder="自动生成" readonly="readonly"  />
                    </td>
                    <th style="width:90px;">&nbsp;</th>
                    <td>
                        &nbsp;
                    </td>
                </tr>
                <tr>
                    <th>借阅人：</th>
                    <td> 
                        <input style="width:130px;" type="text" ms-duplex="entity.BorrowBy.FullName"  readonly="readonly" />
                        <button type="button" class="myfbt" ms-widget="dropDownGroupPostUserTree,booksBorrowUserTree,userTreeOpts"><i class="customer"></i></button>
                    </td>
                    <th>借出经手人：</th>
                    <td>
                        <input type="text" ms-duplex="entity.AddBy.FullName" readonly="readonly"  />
                    </td>
                </tr>
                <tr>
                    <th>借出时间：</th>
                    <td> 
                        <input type="text" style="width:90px;" ms-duplex="entity.BorrowTime" ms-widget='date,date1,dateOpts' readonly="readonly" />
                    </td>
                    <th>计划归还时间：</th>
                    <td>
                        <input type="text" style="width:90px;" ms-duplex="entity.PlanReturnTime" ms-widget='date,date2,dateOpts2' readonly="readonly" />
                    </td>
                </tr>
                <tr>
                    <th>备注：</th>
                    <td colspan="3">
                        <textarea rows="2" cols="20" style="height:80px;width:530px;" ms-duplex="entity.Remark"></textarea>
                    </td>
                </tr>
             </tbody>
        </table>
    </div>

    <div id="tab2" ms-visible="tab=='tab2'" ms-css-width="tabWidth" ms-css-height="tabHeight" style="padding:5px;">

                                                                <div class="boxTitlenob">
                                                                    <h2>
                                                                        <button ms-if="!entity.Id" class="btn btn-mini btn-primary" type="button" ms-click="addBooksList">+ 添加</button>借阅图书列表
                                                                    </h2>
                                                                </div>
                                                                <table width="100%" border="0" cellspacing="1" cellpadding="0" class="tableList">
                                                                    <thead>
                                                                        <tr class="minhead" align="center">
                                                                            <td width="25%" align="center">图书编号</td>
                                                                            <td width="35%" align="center">图书名称</td>
                                                                            <td width="10%" align="center">数量</td>
                                                                            <td width="10%" align="center">价格</td>
                                                                            <td width="10%" align="center">小计</td>
                                                                            <td width="10%" align="center">操作</td>
                                                                        </tr>
                                                                    </thead>
                                                                    <tbody>
                                                                        <tr ms-repeat-item="booksList">
                                                                            <td align="center">
                                                                                <input ms-if="!item.Id && !item.BooksName" type="text" style="width:140px;" ms-duplex="item.BookNo" ms-keyup="getBookInfo($event,item)" placeholder="输入编号或书名后按回车">
                                                                                <span ms-if="item.Id || item.BooksName">{{item.BookNo}}</span>
                                                                            </td>
                                                                            <td align="left">{{item.BooksName}}</td>
                                                                            <td align="center">
                                                                                <input ms-if="!item.Id" type="text" style="width:40px;" ms-duplex="item.Number">
                                                                                <span ms-if="item.Id">{{item.Number}}</span>
                                                                            </td>
                                                                            <td align="center">{{item.Price}}</td>
                                                                            <td align="center">{{item.TotalMoney}}</td>
                                                                            <td align="center">
                                                                                <a ms-if="!item.Id" href="javascript:void(0)" class="dodel" ms-click="delBooksList(item)" ms-title="lang.DelBtn"></a>
                                                                            </td>
                                                                        </tr>
                                                                    </tbody>
                                                                </table>
        <div style="text-align:right; padding:5px;">图书数量合计：{{entity.BorrowTotalCount}}册，金额合计：{{entity.BorrowTotalMoney}}元</div>
    </div>
</noscript>

<!--查看-->
<noscript type="text/avalon" id="BooksBorrowviewTemplate"> 
      <div>
        <ul class="tabWarp">
            <li ms-class-1="hover:tab=='tab1'" ms-class-2="normal:tab!='tab1'" val="tab1" ms-click="tabChange">基本信息</li>
            <li ms-class-1="hover:tab=='tab2'" ms-class-2="normal:tab!='tab2'" val="tab2" ms-click="tabChange">借阅图书清单</li>
            <li ms-class-1="hover:tab=='tab3'" ms-class-2="normal:tab!='tab3'" val="tab3" ms-click="tabChange">归还记录</li>
        </ul>
    </div>

    <div id="tab3" ms-visible="tab=='tab1'" ms-css-width="tabWidth" ms-css-height="tabHeight">
        <div style="position:relative;">
        <div ms-class-1="borrowstate0:entity.State==0" ms-class-2="borrowstate1:entity.State==1" ms-class-3="borrowstate2:entity.State==2" ms-class-4="borrowstate3:entity.State==3"></div>
        <table cellspacing="1" cellpadding="0" width="98%" align="center" border="0" class="tablecInfo">
            <tbody>
                <tr>
                    <td style="width:70px;">借阅单号：</td>
                    <td>
                        {{entity.BillNo}}
                    </td>
                    <td style="width:90px;">&nbsp;</td>
                    <td>
                        &nbsp;
                    </td>
                </tr>
                <tr>
                    <td>借阅人：</td>
                    <td> 
                        {{entity.BorrowBy.FullName}}
                    </td>
                    <td>借出经手人：</td>
                    <td>
                        {{entity.AddBy.FullName}}
                    </td>
                </tr>
                <tr>
                    <td>借出时间：</td>
                    <td> 
                        {{entity.BorrowTime|truncate(10,'')}}
                    </td>
                    <td>计划归还时间：</td>
                    <td>
                        {{entity.PlanReturnTime|truncate(10,'')}}
                    </td>
                </tr>
                <tr>
                    <td>备注：</td>
                    <td colspan="3">
                        {{entity.Remark}}
                    </td>
                </tr>
             </tbody>
        </table>
        </div>
    </div>

    <div id="tab4" ms-visible="tab=='tab2'" ms-css-width="tabWidth" ms-css-height="tabHeight" style="padding:5px;">

                                                                <div class="boxTitlenob">
                                                                    <h2>
                                                                        借阅图书列表
                                                                    </h2>
                                                                </div>
                                                                <table width="100%" border="0" cellspacing="1" cellpadding="0" class="tableList">
                                                                    <thead>
                                                                        <tr class="minhead" align="center">
                                                                            <td width="20%" align="center">图书编号</td>
                                                                            <td width="30%" align="center">图书名称</td>
                                                                            <td width="10%" align="center">数量</td>
                                                                            <td width="10%" align="center">价格</td>
                                                                            <td width="10%" align="center">小计</td>
                                                                            <td width="10%" align="center">已还数量</td>
                                                                            <td width="10%" align="center">待还数量</td>
                                                                        </tr>
                                                                    </thead>
                                                                    <tbody>
                                                                        <tr ms-repeat-item="booksList">
                                                                            <td align="center">
                                                                                <span>{{item.BookNo}}</span>
                                                                            </td>
                                                                            <td align="left">{{item.BooksName}}</td>
                                                                            <td align="center">{{item.Number}}</td>
                                                                            <td align="center">{{item.Price}}</td>
                                                                            <td align="center">{{item.TotalMoney}}</td>
                                                                            <td align="center">{{item.ReturnNumber}}</td>
                                                                            <td align="center">{{item.NotReturnNumber}}</td>
                                                                        </tr>
                                                                    </tbody>
                                                                </table>
        <div style="text-align:right; padding:5px;">图书借出数量合计：{{entity.BorrowTotalCount}}册，金额合计：{{entity.BorrowTotalMoney}}元</div>
    </div>
    <div id="tab4" ms-visible="tab=='tab3'" ms-css-width="tabWidth" ms-css-height="tabHeight" style="padding:5px;">

                                                                <div class="boxTitlenob">
                                                                    <h2>
                                                                        归还记录
                                                                    </h2>
                                                                </div>
                                                                <table width="100%" border="0" cellspacing="1" cellpadding="0" class="tableList">
                                                                    <thead>
                                                                        <tr class="minhead" align="center">
                                                                            <td width="25%" align="center">归还单号</td>
                                                                            <td width="35%" align="center">归还人</td>
                                                                            <td width="10%" align="center">归还时间</td>
                                                                            <td width="10%" align="center">归还册数合计</td>
                                                                            <td width="10%" align="center">操作</td>
                                                                        </tr>
                                                                    </thead>
                                                                    <tbody>
                                                                        <tr ms-repeat-item="returnList">
                                                                            <td align="center">
                                                                                <span>{{item.BillNo}}</span>
                                                                            </td>
                                                                            <td align="left">{{item.ReturnBy.FullName}}</td>
                                                                            <td align="center">
                                                                                <span>{{item.ReturnTime|truncate(10,'')}}</span>
                                                                            </td>
                                                                            <td align="center">{{item.ReturnCount}}</td>
                                                                            <td align="center">
                                                                                <a ms-href="'#/Office/BooksReturn/'+item.Id+'/read/'" class="doview" ms-title="查看归还详情"></a>
                                                                            </td>
                                                                        </tr>
                                                                    </tbody>
                                                                </table>
        <div style="text-align:right; padding:5px;">归还图书量合计：{{entity.BorrowTotalCount-entity.NotReturnCount}}册，金额合计：{{entity.BorrowTotalMoney-entity.NotReturnMoney}}元</div>
        <div style="text-align:right; padding:5px;color:#f00;">欠还图书量合计：{{entity.NotReturnCount}}册，金额合计：{{entity.NotReturnMoney}}元</div>
    </div>
</noscript>
<style type="text/css">
    .tabtable tr th {height:45px;}
    .tabtable tr td {height:45px;}
    .borrowstate0 {
        position:absolute; width:105px; height:110px; right:5px; background:url(/Content/Themes/Base/Images/ico/borrow_state.png) no-repeat 0px 0px;
    }
    .borrowstate1 {
        position:absolute; width:105px; height:110px; right:5px; background:url(/Content/Themes/Base/Images/ico/borrow_state.png) no-repeat -110px 0px;
    }
    .borrowstate2 {
        position:absolute; width:105px; height:110px; right:5px; background:url(/Content/Themes/Base/Images/ico/borrow_state.png) no-repeat -220px 0px;
    }
    .borrowstate3 {
        position:absolute; width:105px; height:110px; right:5px; background:url(/Content/Themes/Base/Images/ico/borrow_state.png) no-repeat -330px 0px;
    }
</style>