<div ms-controller="ARAPPay">
    <table border="0" align="center" cellpadding="0" cellspacing="0" id="mian">
        <tbody>
            <tr>
                <td width="198" height="450" valign="top" id="tdleft">
                    <!--leftNav-->
                    <div id="left" ms-widget="leftMenu,ARAPMenu">
                    </div>
                    <!--End leftNav-->
                </td>
                <td valign="top" id="right" class="addrightbg">
                    <div style="margin-bottom: 10px;">
                        <div class="boxtip" id="boxtip">
                            <h1>{{lang.ARAP}}</h1>
                            <p>{{lang.ARAPDesc}}</p>
                            <!--<a href="javascript:history.go(-1)" class="btn_back"></a>-->
                        </div>
                        <table width="98%" border="0" align="center" cellpadding="0" cellspacing="0" class="seacrhTable">
                            <tbody>
                                <tr>
                                    <td width="460" class="searchico">
                                        <div class="input-append" style="margin-bottom: 10px;">
                                            <input type="text" class="span4" ms-duplex="queryData.key.val" ms-attr-placeholder="输入客户名称或项目名称" ms-enter="addQuery('key',queryData.key.val,queryData.key.val)">
                                            <button class="add-on ibtsearch" type="button" id="btnsel" ms-click="addQuery('key',queryData.key.val,queryData.key.val)" style="height: 28px; font-size: 12px; padding: 3px 12px;">
                                                {{lang.SearchBtn}}
                                            </button>
                                            <button class="add-on ibtsearch clearall" type="button" ms-click="clearQuery" style="height: 28px; font-size: 12px; padding: 3px 12px;">
                                                {{lang.ShowAllBtn}}</button>
                                        </div>
                                    </td>
                                    <td class="fgray"></td>
                                </tr>
                            </tbody>
                        </table>
                        <table width="98%" border="0" align="center" cellpadding="0" cellspacing="0" class="seacrhField">
                            <tbody>
                                <tr ms-repeat="queryData" ms-class="quickword {{$val.hide?'hide':''}}" ms-if-loop="$val.items && !$val.jump">
                                    <td ms-attr-colspan="$val.next?1:2" ms-width="$val.next?'50%':'100%'">
                                        <span>{{$val.label}}</span>
                                        <div style="display: inline;" ms-each-r='$val.items'>
                                            <a href="javascript:void(0)" ms-if="!r.type" ms-click='addQuery($key, r.val, r.label)' ms-class-selected="r.curr" ms-html='r.label'></a>
                                            <a href="javascript:void(0)" ms-if="r.type=='selectUser'" ms-click="selectUser($key,r)" ms-class-selected="r.curr" ms-html='r.label'></a>
                                            <a href="javascript:void(0)" ms-if="r.type=='date'" ms-click='addQuery($key, r.val, r.label)' ms-class-selected="r.curr" ms-html='r.label'></a>
                                            <div ms-if="r.type=='date'" ms-visible="queryData[$key].val==r.val">
                                                <input type="text" ms-duplex="queryData[r.d1].val" ms-widget="date" ms-attr-data-format="r.format" style="width: 80px; height: 15px; margin-left: 10px;" readonly="readonly" />
                                                <label ms-if="r.d2" style="margin-left: -15px;">至</label>
                                                <input ms-if="r.d2" type="text" ms-duplex="queryData[r.d2].val" ms-widget="date" ms-attr-data-format="r.format" style="width: 80px; height: 15px;" readonly="readonly" />
                                            </div>
                                        </div>
                                    </td>
                                    <td ms-if="$val.next" width="50%">
                                        <span>{{queryData[$val.next].label}}</span>
                                        <div style="display: inline;">
                                            <a ms-repeat-r="queryData[$val.next].items" href="javascript:void(0)" ms-click='addQuery($val.next, r.val, r.label)' ms-class-selected="r.curr" ms-html='r.label'></a>
                                        </div>
                                    </td>
                                </tr>
                                <tr ms-if="queryMore">
                                    <td colspan="2">
                                        <ul class="quickwordul">
                                            <li>
                                                <div class="quickwordmore" isshow="flase" onclick="quickwordShow()">更多选项<span class="quickdown"></span></div>
                                            </li>
                                        </ul>
                                    </td>
                                </tr>
                                <tr>
                                    <td colspan="2" class="seabox">
                                        <span class="first" ms-html='lang.CurrSearchCondition'></span>
                                        <div style="display: inline; float: left;" ms-repeat="queryData">
                                            <span class="searchItem" ms-if-loop='$val.valLabel'>{{$val.valLabel}}
                                        <i><a href="javascript:void(0)" ms-click='removeQuery($key)'></a></i>
                                            </span>
                                        </div>
                                        <span class="last" ms-visible='hasQuery' ms-click='clearQuery'><a href="javascript:void(0)" ms-html='lang.ClearAll'></a></span>
                                    </td>
                                </tr>
                            </tbody>
                        </table>
                        <table width="100%" border="0" cellspacing="1" cellpadding="0" class="tableList" id="tableList">
                            <thead>
                                <tr class="dobtn" style="background-color: rgba(0, 0, 0, 0);">
                                    <td colspan="13" bgcolor="#FFFFFF">
                                        <a ms-if="ADD" href="javascript:void(0)" class="doadd" ms-click="doadd">{{lang.AddBtn}}</a>
                                        <a ms-if="DELETE" href="javascript:void(0)" class="doalldel" ms-click="grid1.removeChecked()">{{lang.BtachDelBtn}}</a>
                                    </td>
                                </tr>
                                <tr class="head" style="background-color: rgba(0, 0, 0, 0);">
                                    <td width="3%" align="center">
                                        <input type="checkbox" ms-duplex-radio="grid1.checkall"/>
                                    </td>
                                    <td ms-html="'单据编号'" width="6%" align="center"></td>
                                    <td ms-html="'计划日期'" width="6%" align="center"></td>
                                    <td ms-html="'客户名称'" width="20%" align="center"></td>
                                    <td ms-html="'合同订单'" width="6%" align="center"></td>
                                    <td ms-html="'款项期次'" width="6%" align="center"></td>
                                    <td ms-html="'应付金额'" width="6%" align="center"></td>
                                    <td ms-html="'已付'" width="6%" align="center"></td>
                                    <td ms-html="'未付'" width="6%" align="center"></td>
                                    <td ms-html="'业务员'" width="6%" align="center"></td>
                                    <td ms-html="'负责人'" width="6%" align="center"></td>
                                    <td ms-html="'状态'" width="6%" align="center"></td>
                                    <td ms-html="'操作'" width="6%" align="center"></td>
                                </tr>
                            </thead>
                            <tbody ms-each-item="grid1.list">
                                <tr style="background: #FFF;">
                                    <td align="center">
                                        <input type="checkbox" ms-duplex-radio="item.checked" />
                                    </td>
                                    <td align="center"><a href="javascript:void(0)" ms-click="doview(item.Id,item.Contract.Id)" data-permission="VIEW">{{item.SN}}</a></td>
                                    <td align="center">{{item.PlanDate|truncate(10,'')}}</td>
                                    <td align="center"><a href="javascript:void(0)" ms-click="gotoview(item.CustomerId)">{{item.CustomerName}}</a></td>
                                    <td align="center"><a href="javascript:void(0)" ms-click="gotoview(item.Contract.Id,'contract')">{{item.Contract.ContractNum}}</a></td>
                                    <td align="center">{{item.Batch}}</td>
                                    <td align="right">{{item.Money|currency}}</td>
                                    <td align="center">{{item.SettleMoney|currency}}</td>
                                    <td align="right">{{item.NotSettleMoney|currency}}</td>
                                    <td align="center">{{item.SalesmanName}}</td>
                                    <td align="center">{{item.DutyPersonName}}</td>
                                    <td align="center">{{item.NotSettleMoney==0?'已完成':'未完成'}}</td>
                                    <td align="right">
                                      <a ms-if='item.EDIT' ms-click="addAccountBook(item)" ms-visible="item.NotSettleMoney!=0" class="dowriteoff" title="记账"></a>
                                      <a ms-if='item.VIEW' ms-click="doview(item.Contract.Id,item.Id)" class="doview" title="查看" data-permission="VIEW"></a>
                                      <a ms-if='item.EDIT' ms-click="doedit(item.Id,item.Contract.Id)" class="doedit" title="编辑" data-permission="EDIT"></a>
                                      <a ms-if='!item.EDIT' href='javascript:void(0)' class='noedit' ms-title='lang.NotEdit'></a>
                                      <a ms-if='item.DELETE' href="javascript:void(0)" class="dodel" title="删除" ms-click="doremove(item,$index)"></a>
                                      <a ms-if='!item.DELETE' href='javascript:void(0)' class='nodel' ms-title='lang.NotDelete'></a>
                                    </td>
                                </tr>
                            </tbody>
                            <tfoot>
                                <tr ms-if="grid1.gridmsg">
                                    <td colspan="13" class="gridmsg">{{grid1.gridmsg|html}}</td>
                                </tr>
                                <tr>
                                    <td colspan="13" ms-widget='paging' data-gridid="grid1"></td>
                                </tr>
                            </tfoot>
                        </table>
                    </div>
                </td>
            </tr>
        </tbody>
    </table>
</div>
