<div ms-controller="PurchasePutStorage">
    <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">
                    </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.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="7">
                                <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="doalldel" 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="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="center"><a href="javascript:void(0);" ms-click="doFrom(item)">{{item.FromNo}}</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.TotalMoney}}
                            </td>
                            <td align="center">
                                <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="7" ms-widget='paging,PurchasePutStoragePage,pagingops'></td>
                        </tr>
                    </table>
                </td>
            </tr>
        </tbody>
    </table>

    <!-- 新增或编辑采购入库 -->
    <noscript id="formTemplate">
        <div style="width: 1024px;">
            <table cellspacing="3" cellpadding="0" border="0" class="commontable" style="border: none; width: 1000px;">
                <tbody>
                    <tr>
                        <th style="width: 80px;">订单编号：
                        </th>
                        <td style="width: 200px;">
                            <input ms-duplex='entity.FromNo' style="width: 150px;" type="text">
                            <button type="button" class="myfbt" ms-click="selectContract"><i class="customer"></i></button>
                        </td>
                        <th style="width: 80px;">入库单号：
                        </th>
                        <td style="width: 200px;">
                            <input ms-duplex='entity.BillNo' readonly="readonly" style="width: 180px;" type="text">
                        </td>
                        <th style="width: 80px;">填单时间：
                        </th>
                        <td>
                            <input type="text" style="width: 180px;" ms-duplex="entity.ActionTime" readonly="readonly" ms-widget="date,actionTimevm,actionTimeOpts" data-format='%Y-%m-%d' />
                        </td>
                    </tr>
                    <tr>
                        <th>供应商：
                        </th>
                        <td>
                            <input ms-duplex='entity.SupplyName' type="text" style="width: 150px;" readonly="true">
                        </td>
                        <th>经办人：
                        </th>
                        <td>
                            <input ms-duplex='entity.ActionBy.FullName' readonly="readonly" style="width: 100px;" type="text">
                            <button type="button" class="myfbt" ms-click="selectActionBy()"><i class="iadduser"></i></button>
                        </td>
                        <th>部门：
                        </th>
                        <td>
                            <input ms-duplex='entity.ActionByGroup' readonly="readonly" style="width: 180px;" type="text">
                        </td>
                    </tr>
                    <tr>
                        <th>备注：
                        </th>
                        <td colspan="5">
                            <textarea style="width: 850px; height: 50px;" ms-duplex="entity.Summary"></textarea>
                        </td>
                    </tr>
                    <tr>
                        <th>合计金额：</th>
                        <td colspan="5">{{entity.TotalMoney}}
                        </td>
                    </tr>
                </tbody>
            </table>
            <div style="height: auto; overflow: auto; width: 1024px">
                <table width="1024px;" border="0" cellspacing="1" cellpadding="0" class="tableList" id="table2" style="margin-bottom: 1px;">
                    <tr>
                        <td colspan="19" align="left" bgcolor="#FFFFFF">选择仓库：
                            <select style="width: 90px;" ms-duplex-text="storages" ms-change="selectStorage()">
                                <option value="0">请选择</option>
                                <option ms-repeat-r="storageAllList" ms-value="r.Id" ms-text="r.Name"></option>
                            </select>
                            &nbsp; 
                            <label>
                                <input type="checkbox" ms-duplex-radio="hSN" />&nbsp;自动生成产品序列号 &nbsp;</label>&nbsp;
                            <label>
                                <input type="checkbox" ms-duplex-radio="bNumber" />&nbsp;自动生成批次号&nbsp;</label>
                        </td>
                    </tr>
                    <tr class="head">
                        <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="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>
                    </tr>
                    <tbody ms-each-r="PurchasePutStorageList">
                        <tr>
                            <td align="center" bgcolor="#FFFFFF">
                                <select ms-duplex-text="r.StorageId" style="width: 80px;">
                                    <option value="0">请选择</option>
                                    <option ms-repeat-r="storageList" ms-value="r.Id" ms-text="r.Name"></option>
                                </select>
                            </td>
                            <td align="center" bgcolor="#FFFFFF">
                                <select ms-duplex="r.SpaceId" style="width: 80px;">
                                    <option value="0">请选择</option>
                                    <option ms-repeat-s="r.spaceList" ms-value="s.Id" ms-text="s.Name"></option>
                                </select>
                            </td>
                            <td width="5%" align="center" bgcolor="#FFFFFF">{{r.ProductNo}}
                            </td>
                            <td width="15%" align="center" bgcolor="#FFFFFF">{{r.ProductName}}
                            </td>
                            <td align="center" bgcolor="#FFFFFF">{{r.Standard}}
                            </td>
                            <td align="center" bgcolor="#FFFFFF">{{r.Units}}
                            </td>
                            <td align="center" bgcolor="#FFFFFF">
                                <input type="text" ms-duplex="r.Number" style="width: 50px;" />
                            </td>
                            <td align="center" bgcolor="#FFFFFF">{{r.Price}}
                            
                            </td>
                            <td align="center" bgcolor="#FFFFFF">{{r.DiscountRate}}
                          
                            </td>
                            <td align="center" bgcolor="#FFFFFF">{{r.DiscountMoney}}
                            </td>
                            <td align="center" bgcolor="#FFFFFF">{{r.Money}}
                            </td>
                            <td align="center" bgcolor="#FFFFFF">{{r.TaxRate}}
                            </td>
                            <td align="center" bgcolor="#FFFFFF">{{r.TaxMoney}}
                            </td>
                            <td align="center" bgcolor="#FFFFFF">{{r.TotalMony}}
                            </td>
                            <td align="center" bgcolor="#FFFFFF">
                                <input type="text" ms-duplex="r.BatchNumber" style="width: 120px;" />
                            </td>
                            <td bgcolor="#FFFFFF" style="text-align: center;">
                                <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>
                                <a title="删除" href="javascript:void(0)" ms-click="remove($index,r)" class="dodel"></a>
                            </td>
                        </tr>
                        <tr ms-if="showindex == $index">
                            <td colspan="19" align="left" bgcolor="#FFFFFF">
                                <label>
                                    <input type="checkbox" ms-duplex-radio="r.HasServiceTimeLimit" />&nbsp;服务期限</label>
                                <span ms-if="r.HasServiceTimeLimit">
                                    <input type="text" ms-duplex="r.ProductionTime" style="width: 80px; height: 14px;" readonly="readonly" ms-widget="date,serverstardateid,serverstardateOpts" />
                                    至
                                <input ms-duplex="r.ValidDate" type="text" style="width: 80px; height: 14px;" readonly="readonly" ms-widget="date,serverenddateid,serverenddateOpts" />
                                </span>
                                &nbsp;
                                     <label>
                                         <input type="checkbox" ms-duplex-radio="r.HasSN" />&nbsp;产品序列号</label>
                                <input type="text" ms-duplex="r.SN" ms-if="r.HasSN" style="width: 120px; height: 14px;" />
                                &nbsp;
                                     <label>
                                         <input type="checkbox" ms-duplex-radio="r.HasAccountPwd" />&nbsp;账号密码</label>
                                <span ms-if="r.HasAccountPwd">账号<input type="text" ms-duplex="r.UserName" style="width: 40px; height: 14px;" />
                                    密码<input type="text" ms-duplex="r.PassWord" style="width: 60px; height: 14px;" />
                                </span>
                                &nbsp;
                                     <label>
                                         <input type="checkbox" ms-duplex-radio="r.IsUseLimit" />&nbsp;用户数限制</label>
                                <input ms-duplex="r.UseLimitOfNum" ms-if="r.IsUseLimit" type="text" style="width: 50px; height: 14px;" />
                            </td>
                        </tr>
                    </tbody>
                </table>
            </div>
        </div>
    </noscript>

    <!---选择采购订单--->
    <noscript id="ContractListTemplate">
        <div>
            <table border="0" cellspacing="0" cellpadding="0" style="width: 100%;">
                <tr>
                    <td style="width: 300px; vertical-align: top;">
                        <div class="boxTitlenob">
                            <h2>采购订单
                                <span class="rseachbox">
                                    <input ms-duplex="contractKey" placeholder="输入采购名称/订单编号快速检索" type="text" style="margin-bottom: 3px; font-size: 9px; color: #989898; width: 180px;" />
                                    <button class="inputbt" type="button" ms-click="searchContract">
                                    </button>
                                </span>
                            </h2>
                        </div>
                        <table border="0" cellspacing="1" cellpadding="0" class="tableList productlist" style="width: 100%;">
                            <tr class="minhead" align="center">
                                <td width="3%">选择</td>
                                <td width="10%" align="center">采购编号/名称</td>
                                <td width="8%" align="center">金额</td>
                                <td width="8%" align="center">日期</td>
                                <!--<td width="15%" align="center">合同期限范围</td>-->
                            </tr>
                            <tr ms-repeat-item="cgrid.list">
                                <td align="center">
                                    <input type="radio" ms-duplex="item.checked"></td>
                                <td align="center">({{item.BillNo}})<br />
                                    {{item.PurchaseOrderTag|truncate(18)}}</td>
                                <td align="center">{{item.PayMoney?item.PayMoney:0}}</td>
                                <td align="center">{{item.ActionTime|truncate(10,'')}}</td>
                            </tr>
                            <tr style="background: #F5F5F7;" ms-if="cgrid.total==0">
                                <td colspan="6">抱歉！暂无采购信息</td>
                            </tr>
                        </table>
                    </td>
                    <td style="width: 10px;">&nbsp;</td>
                    <td style="vertical-align: top;">
                        <div class="boxTitlenob" ms-css-width="rWidth-330">
                            <h2>采购明细</h2>
                        </div>
                        <div style="overflow: auto;" ms-css-width="rWidth-330">
                            <table style="width: 100%; margin: 0 auto;" border="0" cellspacing="1" cellpadding="0" class="tableList hasOfferPanel">
                                <tr class="minhead" align="center">
                                    <td width="18%">产品名称
                                    </td>
                                    <td width="10%">规格/型号/摘要
                                    </td>
                                    <td width="10%">数量
                                    </td>
                                    <td width="10%">已入库数量
                                    </td>
                                    <td width="6%">单价
                                    </td>
                                    <td width="6%">金额
                                    </td>
                                    <td width="6%">价税金额
                                    </td>
                                </tr>
                                <tbody ms-each-item="contractdetailslist">
                                    <tr align="center" style="background-color: rgb(255, 255, 255);">
                                        <td>{{item.ProductName|truncate(20,"...")}}
                                        </td>
                                        <td>{{item.Standard}}
                                        </td>
                                        <td>{{item.Number}}
                                        </td>
                                        <td>{{item.PutStorageNumber}}
                                        </td>
                                        <td>{{item.Price}}
                                        </td>
                                        <td>{{item.Money}}
                                        </td>
                                        <td>{{item.TotalMony}}
                                        </td>
                                    </tr>
                                </tbody>
                            </table>
                        </div>
                    </td>
                </tr>
            </table>
        </div>
    </noscript>


    <!--查看-->
    <noscript id="viewTemplates">
        <table width="1024px" border="0" cellspacing="1" cellpadding="0" class="tablecInfo" id="info">
            <tbody>
                <tr>
                    <td style="width: 80px;" align="right">订单编号：
                    </td>
                    <td style="width: 150px;">{{entity.FromNo}}
                    </td>
                    <td style="width: 80px;" align="right">入库单号：
                    </td>
                    <td style="width: 150px;">{{entity.BillNo}}
                    </td>
                    <td style="width: 80px;" align="right">填单时间：
                    </td>
                    <td style="width: 150px;">{{entity.ActionTime}}
                    </td>
                </tr>
                <tr>
                    <td style="width: 80px;" align="right">供应商：
                    </td>
                    <td style="width: 150px;">{{entity.SupplyName}}
                    </td>
                    <td style="width: 80px;" align="right">经手人：
                    </td>
                    <td style="width: 150px;">{{entity.ActionBy.FullName}}
                    </td>
                    <td style="width: 80px;" align="right">部门：
                    </td>
                    <td style="width: 150px;">{{entity.ActionByGroup}}
                    </td>
                </tr>
                <tr>
                    <td style="width: 80px;" align="right">备注：
                    </td>
                    <td colspan="5">{{entity.Summary}}
                    </td>
                </tr>
                <tr>
                    <td style="width: 80px;" align="right">金额：
                    </td>
                    <td colspan="5">{{entity.TotalMoney}}
                    </td>
                </tr>

            </tbody>
        </table>
        <table width="1024px" border="0" cellspacing="1" cellpadding="0" class="tableList">
            <tr class="minhead">
                <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="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.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="16" 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>


</div>
