<table border="0" align="center" cellpadding="0" cellspacing="0" id="mian" ms-controller="PurchaseOrder">
    <tbody>
        <tr>
            <td width="198" height="450" valign="top" id="tdleft">
                <!--leftNav-->
                <div id="left" ms-widget="leftMenu">
                </div>
                <!--End leftNav-->
            </td>
            <td valign="top" id="right">
                <div class="top10">
                    <table border="0" align="center" cellpadding="0" cellspacing="0" class="seacrhTable" style="background: none; width: 100%;">
                        <tbody>
                            <tr>
                                <td width="460" class="searchico">
                                    <div class="input-append" style="margin-bottom: 10px;">
                                        <input id="keyInput" type="text" class="span4" ms-duplex="queryData.keyword.val" placeholder="请输入供应商名称或采购单号" ms-keyup="onEnter">
                                        <button class="add-on ibtsearch" type="button" style="height: 28px; font-size: 12px; padding: 3px 12px;" ms-click="doSearch">搜索</button>
                                        <button class="add-on ibtsearch clearall" type="button" style="height: 28px; font-size: 12px; padding: 3px 12px;" ms-click="clearQuery">显示全部</button>
                                    </div>
                                </td>
                                <td class="fgray">{{lang.SearchHistory}}
                                   <span class="bindSearchHistory" ms-repeat-h='queryHistory'>
                                       <a href="javascript:void(0)" ms-click='addQuery(h.name,h.val,h.label)' ms-title='h.label'>{{h.label|truncate(10)}}</a>
                                   </span>
                                </td>
                            </tr>
                        </tbody>
                    </table>
                    <table border="0" align="center" cellpadding="0" cellspacing="0" class="seacrhField" style="width: 100%;">
                        <tbody>
                            <tr class="quickword">
                                <td colspan="2"><span>{{queryData.state.label}}</span>
                                    <div ms-each-r='queryData.state.items'>
                                        <a href="javascript:void(0)" ms-click='addQuery("state",r.val)' ms-class-1="selected:r.curr" ms-html='r.label'></a>
                                    </div>
                                </td>
                            </tr>
                            <tr class="quickword">
                                <td colspan="2"><span>{{queryData.dateTimes.label}}</span>
                                    <div ms-each-r='queryData.dateTimes.items'>
                                        <a href="javascript:void(0)" ms-click='addQuery("dateTimes",r.val)' ms-class-1="selected:r.curr" ms-html='r.label'></a>
                                    </div>
                                    <div ms-visible="queryData.dateTimes.val=='2'">
                                        <input type="text" style="width: 80px; height: 15px; margin-left: 10px;" ms-duplex="queryData.begindate.val" readonly="readonly" ms-widget="date,begindateid,begindateopts" id="txtbegindate" />
                                        <label style="margin-left: -15px;">至</label>
                                        <input type="text" style="width: 80px; height: 15px;" readonly="readonly" ms-duplex="queryData.enddate.val" ms-widget="date,enddateid,enddateopts" id="txtenddate" />

                                    </div>
                                </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>
                </div>
                <table width="100%" border="0" cellspacing="1" cellpadding="0" class="tableList" id="tableList" style="margin-bottom: 10px;">
                    <tr class="dobtn">
                        <td colspan="9">
                            <a ms-if="ADD" class="doadd" href="javascript:void(0)" data-permission="ADD" ms-click="doadd">{{lang.AddBtn}}</a>
                            <a ms-if="DELETE" data-permission="DELETE" href="javascript:void(0)" class="doalldel" ms-click="doRemoveAll" ms-attr-title="{{lang.BtachDelBtn}}">{{lang.BtachDelBtn}}</a>
                        </td>
                    </tr>
                    <tr class="head" style="background-color: rgba(0, 0, 0, 0);">
                        <td width="2%" align="center">
                            <input type="checkbox" ms-duplex-radio="grid1.checkall">
                        </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>
                        <td width="10%" align="center">已付金额</td>
                        <td width="10%" align="center">状态</td>
                        <td width="8%" align="center">操作</td>
                    </tr>
                    <tr ms-repeat-item="grid1.list" ms-class-old="$index % 2" ms-class-even="!($index % 2)" ms-hover="hover">
                        <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.BillNo}}</a>
                        </td>
                        <td align="left"><a href="javascript:void(0);" ms-click="doview(item.Id)">{{item.PurchaseOrderTag|truncate(30)}}</a>
                        </td>
                        <td align="center">{{item.ActionTime}}
                        </td>
                        <td align="left"><a href='javascript:void(0)' ms-live-click="doviews" ms-attr-path="'/Customer/DetailCustomer/'+item.SupplyId">{{item.SupplyName}}</a>
                        </td>
                        <td align="center">{{item.PayMoney}}
                        </td>
                        <td align="center">{{item.CurPayMoney}}
                        </td>
                        <td align="center">
                            <span ms-if="item.State==0">未付款</span>
                            <span ms-if="item.State==1">付款中</span>
                            <span ms-if="item.State==2">付款完毕</span>
                            <span ms-if="item.State==3">入库中</span>
                            <span ms-if="item.State==4">入库完毕</span>
                        </td>
                        <td align="center">
                            <a href="javascript:void(0);" class="dodetail" title="入库明细" ms-click="doputview(item.BillNo)"></a>
                            <a href="javascript:void(0);" class="doview" title="详细" ms-click="doview(item.Id)"></a>
                            <a href="javascript:void(0);" ms-if="item.EDIT" class="doedit" title="编辑" ms-click="doedit(item.Id)"></a>
                            <a href="javascript:void(0);" ms-if="!item.EDIT" title="非常抱歉，您没有编辑的权限" class="noedit"></a>
                            <a ms-if="item.DELETE" href="javascript:void(0)" class="dodel" ms-click="dodel(item)" ms-title="lang.DelBtn"></a>
                        </td>
                    </tr>
                    <tr>
                        <td colspan="9" ms-widget='paging,PurchaseOrderPage,pagingops'></td>
                    </tr>
                </table>
            </td>
        </tr>
    </tbody>
</table>

<!--新增-->
<noscript id="formTemplate">
    <table width="100%" border="0" cellspacing="0" cellpadding="0" class="commontable shortSelect">
        <tbody>
            <tr>
                <th align="right" style="width: 100px;">标题：
                </th>
                <td style="width: 200px;">
                    <input type="hidden" ms-duplex="entity.Id" />
                    <input ms-duplex='entity.PurchaseOrderTag' style="width: 150px;" type="text">
                    <span class="must">*</span>
                </td>
                <th align="right" style="width: 100px;">订单号：</th>
                <td>
                    <input ms-duplex='entity.BillNo' style="width: 150px;" readonly="readonly" type="text">
                </td>
                <th align="right" style="width: 100px;">采购时间：</th>
                <td>
                    <input type="text" style="width: 150px;" ms-duplex="entity.ActionTime" ms-widget="date,actionTimeid,actionTimeopts" />
                </td>
            </tr>
            <tr>
                <th align="right" style="width: 100px;">供应商：</th>
                <td align="left" style="width: 200px;">
                    <input type="hidden" ms-duplex="entity.SupplyId" />
                    <input ms-duplex='entity.SupplyName' type="text" style="width: 150px;">
                    <button type="button" class="myfbt" ms-click="selectSuplier()"><i class="customer"></i></button>
                </td>
                <th align="right" style="width: 100px;">联系人：</th>
                <td style="width: 200px;" align="left">
                    <input type="hidden" ms-duplex="entity.ContactsId" />
                    <input ms-duplex='entity.ContactsName' style="width: 60px;" type="text">
                    <select style="width: 90px;" ms-change="contactChange">
                        <option value="">选择联系人</option>
                        <option ms-repeat-con="CustomerContactData" ms-value="con.Id" ms-attr-title="con.MobileNumber1">{{con.Name}}</option>
                    </select>
                </td>
                <th align="right" style="width: 100px;">到货时间：</th>
                <td style="width: 200px;" align="left">
                    <input type="text" style="width: 150px;" ms-duplex="entity.DeliveryTime" ms-widget="date,deliveryTimeid,deliveryTimeopts" /></td>
            </tr>
            <tr>
                <th colspan="6">
                    <table width="98%" border="0" cellspacing="1" cellpadding="0" align="center" class="tableList hasOfferPanel">
                        <tr class="minhead">
                            <td align="center" width="10%">商品名称
                            </td>
                            <td align="center" width="10%">规格/型号
                            </td>
                            <td align="center" width="10%">单位
                            </td>
                            <td align="center" width="10%">数量
                            </td>
                            <td align="center" width="10%">单价
                            </td>
                            <td align="center" width="10%">折扣率(%)
                            </td>
                            <td align="center" width="10%">折扣额
                            </td>
                            <td align="center" width="10%">金额
                            </td>
                            <td align="center" width="10%">税率(%)
                            </td>
                            <td align="center" width="10%">税额
                            </td>
                            <td align="center" width="10%">价税合计
                            </td>
                            <td align="center" width="3%">操作
                            </td>
                        </tr>
                        <tr ms-repeat-con="entity.ProductList" align="center" style="background-color: rgb(255, 255, 255);">
                            <td align="center">
                                <input type="hidden" ms-duplex="con.Id" />
                                <input type="hidden" ms-duplex="con.ProductCategory" />
                                <input type="hidden" ms-duplex="con.ProductNo" />
                                <input type="text" style="width: 90px;" ms-duplex="con.ProductName">
                            </td>
                            <td align="center">
                                <input type="text" style="width: 90px;" ms-duplex="con.Standard">
                            </td>
                            <td align="center">
                                <select style="width: 60px; height: 28px; margin-top: 1px;" ms-duplex="con.Units" ms-each-item="units">
                                    <option ms-value="item.Id">{{item.Data}}</option>
                                </select>
                            </td>
                            <td align="center">
                                <input type="text" style="width: 60px;" ms-duplex="con.Number">
                            </td>
                            <td align="center">
                                <input type="text" style="width: 60px;" ms-duplex="con.Price">
                            </td>
                            <td align="center">
                                <input type="text" style="width: 40px;" ms-duplex="con.DiscountRate">
                            </td>
                            <td align="center">
                                <input type="text" style="width: 60px;" ms-duplex="con.DiscountMoney">
                            </td>
                            <td align="center">
                                <input type="text" style="width: 80px;" ms-duplex="con.Money">
                            </td>
                            <td align="center">
                                <input type="text" style="width: 40px;" ms-duplex="con.TaxRate">
                            </td>
                            <td align="center">
                                <input type="text" style="width: 60px;" ms-duplex="con.TaxMoney">
                            </td>
                            <td align="center">
                                <input type="text" style="width: 80px;" ms-duplex="con.TotalMony">
                            </td>

                            <td align="center">
                                <a href="javascript:void(0)" class="dodel" ms-attr-index="$index" ms-click="productsDel" title="删除"></a>
                            </td>
                        </tr>
                        <tr>
                            <td>&nbsp;  <a href="javascript:void(0);" ms-click="selectProduct">+&nbsp;选择产品</a>
                            </td>
                            <th colspan="2" align="right">合计&nbsp;
                            </th>
                            <th colspan="2" align="center"></th>
                            <th colspan="2" style="padding-right: 15px; font-size: 14px;" align="right">&nbsp;{{DiscountMoneyTotal}}元
                            </th>
                            <th align="right" style="padding-right: 15px; font-size: 14px; color: blue;">&nbsp;{{MoneyTotal}}元
                            </th>
                            <th colspan="2" style="padding-right: 15px; font-size: 14px; color: red;" align="right">&nbsp;{{TaxMoneyTotal}}元
                            </th>
                            <th align="right" style="padding-right: 15px; font-size: 14px; color: green;">&nbsp;{{TotalMonyTotal}}元
                            </th>
                            <th></th>
                        </tr>
                    </table>
                </th>
            </tr>
            <tr style="height: 10px;">
                <th colspan="6" style="height: 10px;"></th>
            </tr>
            <tr>
                <th align="right" style="width: 100px;">收货仓库：</th>
                <td style="width: 200px;">
                    <select ms-duplex-text="entity.StorageId" style="width: 150px;" ms-change="contactChange">
                        <option value="0">请选择</option>
                        <option ms-repeat-r="storageList" ms-value="r.Id" ms-text="r.Name"></option>
                    </select>
                </td>
                <th align="right" style="width: 100px;">应付金额：</th>
                <td>
                    <input ms-duplex='entity.PayMoney' style="width: 150px;" type="text">
                </td>
                <th align="right" style="width: 100px;">已付金额：</th>
                <td>
                    <input ms-duplex='entity.CurPayMoney' readonly="readonly" style="width: 150px;" type="text">
                </td>
            </tr>
            <tr>
                <th align="right" style="width: 100px;">备注说明：
                </th>
                <td colspan="5">
                    <textarea style="width: 820px; height: 80px;" ms-duplex="entity.Remarks"></textarea>
                </td>
            </tr>
        </tbody>
    </table>
</noscript>
<!--查看-->
<noscript id="viewTemplate">
    <table width="1000px" border="0" cellspacing="1" cellpadding="0" class="tablecInfo" id="info">
        <tbody>
            <tr>
                <td style="width: 80px;" align="right">标题：
                </td>
                <td style="width: 195px;">{{entity.PurchaseOrderTag}}
                </td>
                <td style="width: 80px;" align="right">订单号：
                </td>
                <td style="width: 140px;">{{entity.BillNo}}
                </td>
            </tr>
            <tr>
                <td style="width: 80px;" align="right">供应商：
                </td>
                <td style="width: 195px;">{{entity.SupplyName}}
                </td>
                <td style="width: 80px;" align="right">联系人：
                </td>
                <td style="width: 140px;">{{entity.ContactsName}}
                </td>
            </tr>
            <tr>
                <td colspan="4" style="padding-left: 0px;">
                    <table width="1000px" border="0" cellspacing="1" cellpadding="0" class="tableList1">
                        <tr class="minhead">
                            <th align="center" width="13%">商品名称
                            </th>
                            <th align="center" width="10%">规格/型号
                            </th>
                            <th align="center" width="5%">单位
                            </th>
                            <th align="center" width="8%">数量
                            </th>
                            <th align="center" width="8%">已入库数量
                            </th>
                            <th align="center" width="9%">单价
                            </th>
                            <th align="center" width="8%">折扣率(%)
                            </th>
                            <th align="center" width="8%">折扣额
                            </th>
                            <th align="center" width="8%">金额
                            </th>
                            <th align="center" width="8%">税率(%)
                            </th>
                            <th align="center" width="8%">税额
                            </th>
                            <th align="center" width="11%">价税合计
                            </th>
                        </tr>
                        <tr ms-repeat-con="entity.ProductList" align="center" style="background-color: rgb(255, 255, 255);">
                            <th align="center" style="font-weight: 100;">{{con.ProductName}}
                            </th>
                            <th align="center" style="font-weight: 100;">{{con.Standard}}
                            </th>
                            <th align="center" style="font-weight: 100;">{{con.Units}}
                            </th>
                            <th align="center" style="font-weight: 100;">{{con.Number}}
                            </th>
                            <th align="center" style="font-weight: 100;">{{con.PutStorageNumber}}
                            </th>
                            <th align="center" style="font-weight: 100;">{{con.Price}}
                            </th>
                            <th align="center" style="font-weight: 100;">{{con.DiscountRate}}
                            </th>
                            <th align="center" style="font-weight: 100;">{{con.DiscountMoney}}
                            </th>
                            <th align="center" style="font-weight: 100;">{{con.Money}}
                            </th>
                            <th align="center" style="font-weight: 100;">{{con.TaxRate}}
                            </th>
                            <th align="center" style="font-weight: 100;">{{con.TaxMoney}}
                            </th>
                            <th align="center" style="font-weight: 100;">{{con.TotalMony}}
                            </th>
                        </tr>
                        <tr style="background-color: rgb(255, 255, 255);">
                            <th align="right">合计&nbsp;
                            </th>
                            <th colspan="5" align="center"></th>
                            <th colspan="2" style="padding-right: 25px; font-weight: 100;" align="right">&nbsp;{{DiscountMoneyTotal}}(元)
                            </th>
                            <th align="right" style="padding-right: 15px; font-weight: 100; color: blue;">&nbsp;{{MoneyTotal}}(元)
                            </th>
                            <th colspan="2" style="padding-right: 15px; font-weight: 100; color: red;" align="right">&nbsp;{{TaxMoneyTotal}}(元)
                            </th>
                            <th align="right" style="padding-right: 15px; font-weight: 100; color: green">&nbsp;{{TotalMonyTotal}}(元)
                            </th>
                        </tr>
                    </table>
                </td>
            </tr>
            <tr>
                <td style="width: 80px;" align="right">订单日期：
                </td>
                <td>{{entity.ActionTime}}
                </td>
                <td style="width: 80px;" align="right">应付金额：
                </td>
                <td><a href="javascript:void(0)" style="font-size: 16px; color: black;">{{entity.PayMoney}}</a>(元)
                </td>
            </tr>
            <tr>
                <td style="width: 80px;" align="right">交货日期：
                </td>
                <td>{{entity.DeliveryTime}}
                </td>
                <td style="width: 80px;" align="right">已付金额：
                </td>
                <td><a href="javascript:void(0)" style="font-size: 16px; color: black;">{{entity.CurPayMoney}}</a>(元)
                </td>
            </tr>
            <tr>
                <td style="width: 80px;" align="right">收货仓库：
                </td>
                <td>{{entity.StorageName}}
                </td>
                <td style="width: 80px;" align="right">订单状态：
                </td>
                <td>
                    <span ms-if="entity.State==0">未付款</span>
                    <span ms-if="entity.State==1">付款中</span>
                    <span ms-if="entity.State==2">付款完毕</span>
                    <span ms-if="entity.State==3">入库中</span>
                    <span ms-if="entity.State==4">入库完毕</span>
                </td>
            </tr>
            <tr>
                <td style="width: 80px;" align="right">备注：
                </td>
                <td colspan="5">{{entity.Remarks}}
                </td>
            </tr>
        </tbody>
    </table>
</noscript>

<!--查看-->
<noscript id="PutviewTemplate">
    <table width="1000px" border="0" cellspacing="1" cellpadding="0" class="tableList">
        <tr class="minhead">
            <td width="10%" align="center" bgcolor="#FFFFFF">订单号
            </td>
            <td width="5%" align="center" bgcolor="#FFFFFF">存放仓库
            </td>
            <td width="5%" align="center" bgcolor="#FFFFFF">仓位
            </td>
            <td width="5%" align="center" bgcolor="#FFFFFF">产品编号
            </td>
            <td width="10%" align="center" bgcolor="#FFFFFF">名称
            </td>
            <td width="10%" align="center" bgcolor="#FFFFFF">型号
            </td>
            <td width="5%" align="center" bgcolor="#FFFFFF">单位
            </td>
            <td width="10%" align="center" bgcolor="#FFFFFF">数量
            </td>

            <td width="10%" align="center" bgcolor="#FFFFFF">单价
            </td>
            <td width="10%" align="center" bgcolor="#FFFFFF">折扣率(%)
            </td>
            <td width="10%" align="center" bgcolor="#FFFFFF">折扣额
            </td>
            <td width="10%" align="center" bgcolor="#FFFFFF">金额
            </td>
            <td width="10%" align="center" bgcolor="#FFFFFF">税率(%)
            </td>
            <td width="10%" align="center" bgcolor="#FFFFFF">税额
            </td>
            <td width="10%" align="center" bgcolor="#FFFFFF">价税合计
            </td>
            <td width="10%" align="center" bgcolor="#FFFFFF">批号
            </td>
            <td width="5%" align="center" bgcolor="#FFFFFF">展开
            </td>
        </tr>
        <tbody ms-repeat-con="PurchasePutStorageList">
            <tr style="background-color: rgb(255, 255, 255);">
                <td align="center" style="font-weight: 100;">{{con.FromNo}}
                </td>
                <td align="center" style="font-weight: 100;">{{con.StorageId}}
                </td>
                <td align="center" style="font-weight: 100;">{{con.SpaceId}}
                </td>
                <td align="center" style="font-weight: 100;">{{con.ProductNo}}
                </td>
                <td align="center" style="font-weight: 100;">{{con.ProductName}}
                </td>
                <td align="center" style="font-weight: 100;">{{con.Standard}}
                </td>
                <td align="center" style="font-weight: 100;">{{con.Units}}
                </td>
                <td align="center" style="font-weight: 100;">{{con.Number}}
                </td>

                <td align="center" style="font-weight: 100;">{{con.Price}}
                </td>
                <td align="center" style="font-weight: 100;">{{con.DiscountRate}}
                </td>
                <td align="center" style="font-weight: 100;">{{con.DiscountMoney}}
                </td>
                <td align="center" style="font-weight: 100;">{{con.Money}}
                </td>
                <td align="center" style="font-weight: 100;">{{con.TaxRate}}
                </td>
                <td align="center" style="font-weight: 100;">{{con.TaxMoney}}
                </td>
                <td align="center" style="font-weight: 100;">{{con.TotalMony}}
                </td>
                <td align="center" style="font-weight: 100;">{{con.BatchNumber}}
                </td>
                <td>
                    <a ms-if="showindex == $index" href="javascript:void(0);" class="notexpand" title="" ms-click="showmore($index)">&nbsp;</a>
                    <a ms-if="showindex != $index" href="javascript:void(0);" class="expand" title="展开更多信息" ms-click="showmore($index)"></a>

                </td>
            </tr>
            <tr ms-if="showindex == $index">
                <td colspan="18" align="left" bgcolor="#FFFFFF"><span ms-if="con.HasServiceTimeLimit">服务期限：{{con.ProductionTime}}
                                    至  {{con.ValidDate}}
                </span>
                    <span ms-if="con.HasSN">&nbsp;&nbsp; &nbsp;&nbsp;产品序列号：{{con.SN}}</span>
                    <span ms-if="con.HasAccountPwd">&nbsp;&nbsp;&nbsp;&nbsp;账号密码：&nbsp;&nbsp;账号：{{con.UserName}}
                                           &nbsp;&nbsp; 密码：{{con.PassWord}}
                    </span>
                </td>
            </tr>
        </tbody>
    </table>
</noscript>
