<div ms-controller="marketingcontract">
    <table border="0" align="center" cellpadding="0" cellspacing="0" width="100%" id="mian">
        <tbody>
            <tr>
                <td ms-visible="!showOnlyList" width="198" height="450" valign="top" id="tdleft">
                    <!--leftNav-->
                    <div id="left" ms-widget="leftMenu">
                    </div>
                    <!--End leftNav-->
                </td>
                <td valign="top" width="100%" ms-attr-id="(showOnlyList && action!='add' && action!='edit')?'noright':'right'" ms-class-addrightbg="!showOnlyList || action=='add' || action=='edit'">
                    <!--list-->
                    <div ms-visible="action=='list'" style="margin-bottom: 10px;">
                        <div ms-visible="!showOnlyList">
                            <div class="boxtip" id="boxtip">
                                <h1>{{lang.Contract}}</h1>
                                <p>{{lang.ContractDescribe}}</p>
                            </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-enter="mgrid.doSearch" ms-attr-placeholder="lang.SearchKeyWordForContract">
                                                <button class="add-on ibtsearch" type="button" id="Button2" ms-click="mgrid.doSearch" 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">&nbsp;
                                        </td>
                                    </tr>
                                </tbody>
                            </table>
                            <table width="98%" border="0" align="center" cellpadding="0" cellspacing="0" class="seacrhField">
                                <tbody>
                                    <tr ms-class="quickword {{$val.hide?'hide':''}}" ms-repeat="queryData" 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;">
                                                <a ms-repeat-r='$val.items' href="javascript:void(0)" ms-click='addQuery($key, r.val, r.label)' ms-class-selected="r.curr" ms-html='r.label'></a>
                                            </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>
                        </div>
                        <div ms-if="!showOnlyList">
                            <ul class="tabWarp tlist" style="margin-top: 10px; margin-bottom: -1px;">
                                <li ms-repeat-r="listTabs" ms-class-1="{{listtab==r.val?'hover':'normal'}}" ms-click="listtabChange(r.val)">{{r.label}}</li>
                            </ul>
                        </div>
                        <table ms-if="!showOnlyList" width="100%" border="0" cellspacing="1" cellpadding="0" class="tableList" id="tableList">

                            <tr class="dobtn" style="background-color: rgba(0, 0, 0, 0);">
                                <td colspan="10" bgcolor="#FFFFFF">
                                    <div style="float: left;">
                                        <a ms-if="ADD" href="javascript:void(0)" class="doadd" ms-click="doadd(false)">{{lang.AddFullBtn}}</a>
                                        <a ms-if="ADD" href="javascript:void(0)" class="doadd" ms-click="doadd(true)">{{lang.AddSimpleBtn}}</a>
                                        <a ms-if="DELETE" href="javascript:void(0)" class="doalldel" ms-click="mgrid.removeAll">{{lang.BtachDelBtn}}</a>
                                    </div>
                                    <div style="float: right;padding:5px;">
                                        <button class="btnsimple" ms-class-1="active:queryData.issample.val==''" ms-click="addQuery('issample','')">不限格式</button>
                                        <button class="btnsimple" ms-class-1="active:queryData.issample.val=='2'" ms-click="addQuery('issample','2','完整格式')">完整格式</button>
                                        <button class="btnsimple" ms-class-1="active:queryData.issample.val=='1'" ms-click="addQuery('issample','1','简易格式')">简易格式</button>
                                    </div>

                                </td>
                            </tr>
                            <tr class="head" style="background-color: rgba(0, 0, 0, 0);">
                                <td width="4%" align="center">
                                    <input type="checkbox" id="cbo_tableList" ms-duplex-radio="mgrid.checkall">
                                </td>
                                <td width="10%" align="center">{{lang.Number}}
                                </td>
                                <td width="20%" align="center">{{lang.ContractName}}
                                </td>
                                <td width="20%" align="center">{{lang.CustomName}}
                                </td>
                                <td width="8%" align="center">{{lang.SignPersion}}
                                </td>
                                <td width="10%" align="center">{{lang.Type}}
                                </td>
                                <td width="10%" align="center">{{lang.State}}
                                </td>
                                <!--        <td width="10%" align="center">{{lang.Amount}}
                                </td>
                                <td width="10%" align="center">{{lang.SignDate}}
                                </td>-->
                                <td width="10%" align="center" title="点击按此列排序" class="colsort" ms-click="dautosort('Amount')">{{lang.Amount}}
                                      <span ms-class-colsortdown="sort=='Amount' && sortValue==0" ms-class-colsortup="sort=='Amount' && sortValue==1"></span>
                                </td>
                                <td width="10%" align="center" title="点击按此列排序" class="colsort" ms-click="dautosort('SignAContractDate')">{{lang.SignDate}}
                                      <span ms-class-colsortdown="sort=='SignAContractDate' && sortValue==0" ms-class-colsortup="sort=='SignAContractDate' && sortValue==1"></span>
                                </td>
                                <td width="6%" align="center">{{lang.Opts}}
                                </td>
                            </tr>
                            <tbody ms-each-item="mgrid.list">
                                <tr style="background-color: rgb(255, 255, 255);">
                                    <td align="center">
                                        <input type="checkbox" ms-duplex-radio="item.checked">
                                    </td>
                                    <td align="center">{{item.ContractNum}}
                                    </td>
                                    <td align="left">
                                        <span ms-if="item.Iscontract==true">
                                            <a ms-if="showindex == $index" href="javascript:void(0);" class="notexpand" title="展开更多信息" ms-click="showmore($index,item.Id)">&nbsp;</a>
                                            <a ms-if="showindex != $index" href="javascript:void(0);" class="expand" ms-click="showmore($index,item.Id)"></a>

                                            <a href="javascript:void(0)" ms-click="doview(item.Id)">{{item.ContractName}}</a>
                                        </span>
                                        <span ms-if="item.Iscontract==false" style="margin-left: 20px;">
                                            <a href="javascript:void(0)" ms-click="doview(item.Id)">{{item.ContractName}}</a>
                                        </span>
                                    </td>
                                    <td align="left">
                                        <a href='javascript:void(0)' ms-live-click="viewCustomer" ms-title='item.CustomerDisplay'>{{item.CustomerDisplay}}
                                        </a>
                                    </td>
                                    <td align="center">
                                        <a href="javascript:void(0);" ms-text="item.MySignPersionDisplay" ms-widget='userCard' ms-data-userid="item.MySignPersion"></a>
                                    </td>
                                    <td align="center">{{item.ContractTypeDisplay}}
                                    </td>
                                    <td align="center">{{item.StateDisplay}}
                                    </td>
                                    <td align="center">{{item.Amount}}
                                    </td>
                                    <td align="center">{{item.SignAContractDate | truncate(10,'')}}
                                    </td>
                                    <td align="center">
                                        <a href="javascript:void(0)" class="doview" ms-click="doview(item.Id)" ms-title="lang.ViewBtn"></a>
                                        <a ms-if="item.EDIT" href="javascript:void(0)" class="doedit" ms-click="doedit(item.Id)" 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="dodel(item.Id)" ms-value="item.Id" ms-attr-index="$index" ms-title="lang.DelBtn"></a>
                                        <a ms-if="!item.DELETE" href="javascript:void(0)" class="nodel" ms-title="lang.DelBtn"></a>
                                    </td>
                                </tr>
                                <tr ms-if="showindex == $index" style="background: #FFF;">
                                    <td colspan="14">
                                        <table cellspacing="1" cellpadding="0" width="93%" border="0" class="tableList" style="margin: 10px 10px 10px 50px; background: #E3E3E3;">
                                            <tr style="background-color: #f5f5f5;">
                                                <td width="30%" style="padding-left: 5px;">{{lang.ProductOrServerName}}
                                                </td>
                                                <td width="15%">别称
                                                </td>
                                                <td width="15%">规格/型号/摘要
                                                </td>
                                                <td width="10%" align="center">产品单价
                                                </td>
                                                <td width="10%" align="center">{{lang.Price}}
                                                </td>
                                                <td width="10%" align="center">{{lang.Quantity}}
                                                </td>
                                                <td width="10%" align="center">成交金额
                                                </td>
                                            </tr>
                                            <tbody>
                                                <tr ms-repeat-item="getcontractlist">
                                                    <td style="padding-left: 5px;">
                                                        <a href='javascript:void(0);' ms-click="gotoview(item.Id,'productlist')" ms-click="viewProduct(item.Product)">{{item.ProductName|truncate(20)}}</a>
                                                            &nbsp;
                                                        <a ms-if="item.Product" ms-click="viewProduct(item.Product)" href="javascript:void(0);" class="productbtn" title="查看产品"></a>
                                                    </td>
                                                    <td>{{item.ProductAlias}}</td>
                                                    <td>{{item.Standard| truncate(20,'')}}
                                                    </td>
                                                    <td align="right">{{item.StandardPrice}}
                                                    <td align="right">{{item.Price}}
                                                    </td>
                                                    <td align="center">{{item.Num}}
                                                    </td>
                                                    <td align="right">{{item.Money}}
                                                    </td>
                                                </tr>
                                            </tbody>
                                        </table>
                                    </td>
                                </tr>
                            </tbody>
                            <tr ms-if="mgrid.gridmsg">
                                <td colspan="10" align="center" class="gridmsg">{{mgrid.gridmsg|html}}</td>
                            </tr>
                            <tr ms-if="mgrid.list.length>0">
                                <td colspan="7" align="right">合计：</td>
                                <td align="right">{{sumAmount}}</td>
                                <td>&nbsp;</td>
                                <td>&nbsp;</td>
                            </tr>
                            <tr style="background-color: rgba(0, 0, 0, 0);">
                                <td colspan="10" ms-widget='paging' data-gridid="mgrid"></td>
                            </tr>
                        </table>
                        <table ms-if="showOnlyList" width="100%" border="0" cellspacing="1" cellpadding="0" class="tableList" id="table1">
                            <tr class="dobtn" style="background-color: rgba(0, 0, 0, 0);">
                                <td colspan="9" bgcolor="#FFFFFF">
                                    <div style="float: left;">
                                        <a ms-if="ADD" href="javascript:void(0)" class="doadd" ms-click="doadd(false)">{{lang.AddFullBtn}}</a>
                                        <a ms-if="ADD" href="javascript:void(0)" class="doadd" ms-click="doadd(true)">{{lang.AddSimpleBtn}}</a>
                                        <a ms-if="DELETE" href="javascript:void(0)" class="doalldel" ms-click="mgrid.removeAll">{{lang.BtachDelBtn}}</a>
                                    </div>
                                    <div style="float: right;padding:5px;">
                                        <button class="btnsimple" ms-class-1="active:queryData.issample.val=='0'" ms-click="addQuery('issample','0')">不限格式</button>
                                        <button class="btnsimple" ms-class-1="active:queryData.issample.val=='2'" ms-click="addQuery('issample','2')">完整格式</button>
                                        <button class="btnsimple" ms-class-1="active:queryData.issample.val=='1'" ms-click="addQuery('issample','1')">简易格式</button>
                                    </div>
                                </td>
                            </tr>
                            <tr class="head" style="background-color: rgba(0, 0, 0, 0);">
                                <td width="4%" align="center">
                                    <input type="checkbox" id="Checkbox1" ms-duplex-radio="mgrid.checkall">
                                </td>
                                <td width="10%" align="center">{{lang.Number}}
                                </td>
                                <td width="30%" align="center">{{lang.ContractName}}
                                </td>
                                <td width="10%" align="center">{{lang.Type}}
                                </td>
                                <td width="5%" align="center">{{lang.SignPersion}}
                                </td>
                                <td width="10%" align="center">{{lang.State}}
                                </td>
                                <td width="10%" align="center">{{lang.Amount}}
                                </td>
                                <td width="10%" align="center">{{lang.SignDate}}
                                </td>
                                <td width="6%" align="center">{{lang.Opts}}
                                </td>
                            </tr>
                            <tbody ms-each-item="mgrid.list">
                                <tr style="background-color: rgb(255, 255, 255);">
                                    <td align="center">
                                        <input type="checkbox" name="checkbox" ms-duplex-radio="item.checked">
                                    </td>
                                    <td align="center">{{item.ContractNum}}
                                    </td>
                                    <td align="left">
                                        <span ms-if="item.Iscontract==true">
                                            <a ms-if="showindex == $index" href="javascript:void(0);" class="notexpand" title="展开更多信息" ms-click="showmore($index,item.Id)">&nbsp;</a>
                                            <a ms-if="showindex != $index" href="javascript:void(0);" class="expand" ms-click="showmore($index,item.Id)"></a>
                                            <a href="javascript:void(0)" ms-click="doview(item.Id)">{{item.ContractName}}</a>
                                        </span>
                                        <span ms-if="item.Iscontract==false" style="margin-left: 20px;">
                                            <a href="javascript:void(0)" ms-click="doview(item.Id)">{{item.ContractName}}</a>
                                        </span>
                                    </td>
                                    <td align="center">{{item.ContractTypeDisplay}}
                                    </td>
                                    <td align="left">{{item.MySignPersionDisplay}}
                                    </td>
                                    <td align="center">{{item.StateDisplay}}
                                    </td>
                                    <td align="center">{{item.Amount}}
                                    </td>
                                    <td align="center">{{item.SignAContractDate | truncate(10,'')}}
                                    </td>
                                    <td align="center">
                                        <a href="javascript:void(0)" class="doview" ms-click="doview(item.Id)" ms-value="item.Id" ms-title="lang.ViewBtn"></a>
                                        <a ms-if="item.EDIT" href="javascript:void(0)" class="doedit" ms-click="doedit(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="dodel(item.Id)" ms-value="item.Id" ms-attr-index="$index" ms-title="lang.DelBtn"></a>
                                        <a ms-if="!item.DELETE" href="javascript:void(0)" class="nodel" ms-title="lang.DelBtn"></a>
                                    </td>
                                </tr>
                                <tr ms-if="showindex == $index" style="background: #FFF;">
                                    <td colspan="14">
                                        <table cellspacing="1" cellpadding="0" width="93%" border="0" class="tableList" style="margin: 10px 10px 10px 50px; background: #E3E3E3;">
                                            <tr style="background-color: #f5f5f5;">
                                                <td width="30%" style="padding-left: 5px;">{{lang.ProductOrServerName}}
                                                </td>
                                                <td width="15%">别称
                                                </td>
                                                <td width="15%">规格/型号/摘要
                                                </td>
                                                <td width="10%" align="center">产品单价
                                                </td>
                                                <td width="10%" align="center">{{lang.Price}}
                                                </td>
                                                <td width="10%" align="center">{{lang.Quantity}}
                                                </td>
                                                <td width="10%" align="center">成交金额
                                                </td>
                                            </tr>
                                            <tbody>
                                                <tr ms-repeat-item="getcontractlist">
                                                    <td style="padding-left: 5px;">
                                                        <a href='javascript:void(0);' ms-click="gotoview(item.Id,'productlist')" ms-click="viewProduct(item.Product)">{{item.ProductName|truncate(20)}}</a>
                                                            &nbsp;
                                                        <a ms-if="item.Product" ms-click="viewProduct(item.Product)" href="javascript:void(0);" class="productbtn" title="查看产品"></a>
                                                    </td>
                                                    <td>{{item.ProductAlias}}</td>
                                                    <td>{{item.Standard| truncate(20,'')}}
                                                    </td>
                                                    <td align="right">{{item.StandardPrice}}
                                                    <td align="right">{{item.Price}}
                                                    </td>
                                                    <td align="center">{{item.Num}}
                                                    </td>
                                                    <td align="right">{{item.Money}}
                                                    </td>
                                                </tr>
                                            </tbody>
                                        </table>
                                    </td>
                                </tr>
                            </tbody>
                            <tr ms-if="mgrid.gridmsg">
                                <td colspan="9" align="center" class="gridmsg">{{mgrid.gridmsg|html}}</td>
                            </tr>
                            <tr style="background-color: rgba(0, 0, 0, 0);">
                                <td colspan="9" ms-widget="paging" data-gridid="mgrid"></td>
                            </tr>
                        </table>
                    </div>
                </td>
            </tr>
        </tbody>
    </table>
    <!-- 选择产品 -->
    <noscript type="text/avalon" id="ProductListTemp">
        <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
            <tr>
                <td width="203" height="390" valign="top">
                    <table width="96%" border="0" cellpadding="0" cellspacing="0" class="seacrhTable" style="background: none;">
                        <tr>
                            <td valign="top">
                                <div class="boxTitle" style="overflow-y: auto; height: 420px;">
                                    <h2>产品分类</h2>
                                    <ul class='ztree' ms-widget="productCategoryTree,pctree,pCategoryTreeOpts"></ul>
                                </div>
                            </td>
                        </tr>
                    </table>
                </td>
                <td valign="top" style="padding-left: 3px; width: 800px;">
                    <div class="boxTitlenob">
                        <h2>产品列表<span class="rseachbox">
                            <input ms-duplex="productKey" placeholder="输入产品关键字" type="text" style="margin-bottom: 0px; font-size: 9px; color: #989898;" />
                            <button class="inputbt" type="button" ms-click="onSearchProduct">
                            </button>
                        </span>
                        </h2>
                    </div>
                    <table width="" border="0" cellspacing="1" cellpadding="0" class="tableList productlist" style="width: 100%;">
                        <thead>
                            <tr class="head">
                                <td width="3%" align="center">选择
                                </td>
                                <td width="20%" align="center">产品名称
                                </td>
                                <td width="8%" align="center">规格/型号
                                </td>
                                <td width="10%" align="center">品 牌
                                </td>
                                <td width="5%" align="center">库存量
                                </td>
                                <td width="8%" align="center">标准价
                                </td>
                                <td ms-if="entity.Customer">特供价
                                </td>
                                <td ms-if="CustomerMemberGradeDisplay">{{CustomerMemberGradeDisplay}}价
                                </td>
                            </tr>
                        </thead>
                        <tbody>
                            <tr ms-repeat-item="productList" ms-title="formatPriceList(item)" ms-click="onSetProductIndex" ms-dblclick="selectedProduct(item)"  ms-class-1="productdown:item.State==2" style="cursor: pointer;">
                                <td align="center">
                                    <input type="radio" name="rdoproduct" ms-disabled="item.State==2" />
                                </td>
                                <td align="center">{{item.Name|truncate(20,'...')}}
                                </td>
                                <td align="center">{{item.Standard}}
                                </td>
                                <td align="center">{{item.Brand.Name}}
                                </td>
                                <td align="center">{{item.CurrentStockNum}}
                                </td>
                                <td align="center">{{item.GeneralCustomerPrice}}
                                </td>
                                <td ms-if="entity.Customer">{{item.SpecialPrice}}
                                </td>
                                <td ms-if="CustomerMemberGradeDisplay">{{item.GradePrice}}
                                </td>
                            </tr>
                        </tbody>
                        <tfoot>
                            <tr>
                                <td ms-attr-colspan="entity.Customer?8:6" ms-widget='paging,productupaing,productpaing'></td>
                            </tr>
                        </tfoot>
                    </table>
                </td>
            </tr>
        </table>
    </noscript>

    <!--- 新增编辑---->

    <noscript type="text/avalon" id="InputContractFastTemp">
        
    </noscript>

</div>
