<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" class="addrightbg">
                 <div class="boxtip" id="boxtip">
                    <h1>设置销售目标</h1>
                    <p>对销售中的回款额、签约额、发展客户量等指标制定明确的目标方向。建议您采用由上而下的逐级分解进行目标的设置。</p>
                    <a href="javascript:history.go(-1)" class="btn_back"></a>
                </div>
                <table width="100%" border="0" cellspacing="0" cellpadding="0" class="titbox">
        <tr>
            <td width="210" height="30" class="tit">
                第1步：设置销售目标的时间段
            </td>
            <td>
                &nbsp;
            </td>
        </tr>
    </table>
     <table width="100%" border="0" cellspacing="0" cellpadding="0" class="formTable">
                    <tr ms-controller="search">
                        <td width="70">时间范围：
                        </td>
                        <td colspan="3">从
                <input type="text" name="StartDate" id="StartDate" ms-duplex="startDate"
                    style="width: 110px" ms-widget="date,startDateId,startDateOPts" data-id="startDate" />
                            至
                <input type="text" name="EndDate" id="EndDate" ms-duplex="endDate" style="width: 110px"
                    ms-widget="date,endDateId,endDateOPts" data-startfrom="#StartDate" data-id="endDate" />
                            <input ms-click="doShow" type="button" value="显示" class="btn btn-primary" style="margin-left: 10px;" />
                        </td>
                    </tr>
                </table>
    <table width="100%" border="0" cellspacing="0" cellpadding="0" class="titbox">
        <tr>
            <td width="150" height="30" class="tit">
                第2步：设置目标值
            </td>
            <td>
                &nbsp;
            </td>
        </tr>
    </table>
    <div class="tip" title="温馨小提示" style="font-size: 13px; color: #959595; line-height: 13px;
        display: block;">
        温馨小提示：下属的分目标之和应等于或大于上级目标，这样销售目标才有意义，本系统会自动对上级目标与下级目标总和进行对比，如不相等会显示：<span class="sale_warn"></span>警告
    </div>
    <p style="margin-top: 25px;">
        金额单位：<span class="hl_units">万元</span>，精度：<span class="hl_units">0.1 万元</span>；客户数单位：<span
            class="hl_units">个</span>；签单数单位：<span class="hl_units">单</span>。鼠标移至“<span class="sale_warn"></span>”上，可查看警示内容。
    </p>
    <table width="100%" border="0" cellspacing="0" cellpadding="0" class="taret_total">
        <tr ms-controller="market.targets">
            <td width="205">
                <div class="exmployee_tree">
                    <table border="0" cellpadding="0" cellspacing="0" width="100%">
                        <thead>
                            <tr>
                                <td class="blur_head">
                                    用户
                                </td>
                            </tr>
                        </thead>
                        <tbody>                            
                            <tr ms-repeat-item="users" ms-if-loop="item.show">
                                <td ms-class-root="item.Id === 0" ms-css-text-indent="item.Depth * 18+'px'">
                                    <span style="padding-left: 5px;" ms-title="item.Post || ''">
                                    <img ms-if="item.IsGroup" ms-on-click="expandRow" src="/Content/Themes/Base/Images/desktop/selldesktop/expand.jpg"
                                        alt="展开部门" ms-visible="!item.showDetails" style="cursor: pointer;vertical-align: middle" />
                                    <img ms-if="item.IsGroup" ms-on-click="expandRow" src="/Content/Themes/Base/Images/desktop/selldesktop/noexpand.jpg"
                                        alt="收起部门" ms-visible="item.showDetails" style="cursor: pointer;vertical-align: middle" />
                                    {{item.FullName || item.UserName || item.Name}}</span>
                                    <span class="helptip" ms-if="item.IsGroup"><a href="javascript:void(0)" data-toggle="tooltip" data-placement="top" title="公司/部门目标=所辖人员目标之和">&nbsp;&nbsp; </a></span>
                                    <img title="设置部门" ms-if="item.Depth === 0" ms-controller="doption"
                                    src="/Content/Themes/Base/Images/ico/sys_ico.png" alt="设置部门" 
                                    style="cursor:pointer; vertical-align:middle;" class="setdepartment"   ms-widget="dropDownGroupPostUserTree,settagertdepartid,treeopts"
                                    data-width="300" data-treeheight="280" data-permission="SETTING"  />
                                </td>
                            </tr>
                        </tbody>
                        <tfoot>
                            <tr>
                                <td>操作</td>
                            </tr>
                        </tfoot>
                    </table>
                </div>
            </td>
            <td align="left">
                <div class="exmployee_saletarget">
                    <table border="0" cellpadding="0" cellspacing="0" width="100%">
                        <thead>
                            <tr ms-each-item="dates">
                                <td colspan="4" class="date" ms-if="item.show">{{item.date}}</td>
                            </tr>
                            <tr ms-each-item="columns">
                                <td ms-if="item.show" width="80px" nowrap>签约额</td>
                                <td ms-if="item.show" width="80px" nowrap>回款额</td>
                                <td ms-if="item.show" width="60px" nowrap>客户数</td>
                                <td ms-if="item.show" width="60px" nowrap>签单数</td>
                            </tr>
                        </thead>
                        <tbody ms-each-user="users">
                            <tr ms-each-target="user.Targets" ms-if="user.show">
                                <td ms-if="target.show"><input class="toEdit" ms-change="checkNum" ms-if="target.toEdit" type="text" ms-duplex="target.SignAContractMoney" /><span ms-if="!target.toEdit"><span ms-if="target.SignAContractMoneyNotEq" class="sale_warn" title="上级目标与下级目标总和不相等"></span>{{target.SignAContractMoney}}</span></td>
                                <td ms-if="target.show"><input class="toEdit" ms-change="checkNum" ms-if="target.toEdit" type="text" ms-duplex="target.ReturnedMoney" /><span ms-if="!target.toEdit"><span ms-if="target.ReturnedMoneyNotEq" class="sale_warn" title="上级目标与下级目标总和不相等"></span>{{target.ReturnedMoney}}</span></td>
                                <td ms-if="target.show"><input class="toEdit" ms-change="checkNum" ms-if="target.toEdit" type="text" ms-duplex="target.CustomerNum" /><span ms-if="!target.toEdit"><span ms-if="target.CustomerNumNotEq" class="sale_warn" title="上级目标与下级目标总和不相等"></span>{{target.CustomerNum}}</span></td>
                                <td ms-if="target.show"><input class="toEdit" ms-change="checkNum" ms-if="target.toEdit" type="text" ms-duplex="target.SignAContract" /><span ms-if="!target.toEdit"><span ms-if="target.SignAContractNotEq" class="sale_warn" title="上级目标与下级目标总和不相等"></span>{{target.SignAContract}}</span></td>
                            </tr>                          
                        </tbody>
                        <tfoot>
                            <tr ms-each-item="btns">
                                <td colspan="4" ms-if="item.show">
                                    <a ms-visible="item.editing" ms-live-click="doEdit" title="编辑目标" href="javascript:void(0)" class="doedit">编辑</a>
                                    &nbsp; 
                                     <input ms-live-click="doSave" ms-visible="item.canSave" type="button" value="保存" class="btn btn-primary" /> 
                                     &nbsp;&nbsp;
                                     <a ms-live-click="doCancel" ms-visible="item.canCancel" href="javascript:void(0)">取消</a>
                                   
                                </td>
                            </tr>
                        </tfoot>
                    </table>
                </div>
            </td>
            <td width="184">
                <div class="exmployee_total">
                    <table border="0" cellpadding="0" cellspacing="0" width="100%">
                        <thead>
                            <tr>
                                <td colspan="4" class="total">合计</td>
                            </tr>
                            <tr>
                                <td nowrap>签约额</td>
                                <td nowrap>回款额</td>
                                <td nowrap>客户数</td>
                                <td nowrap>签单数</td>
                            </tr>
                        </thead>
                        <tbody ms-each-user="users">
                            <tr ms-if="user.show">
                                <td>{{user.SignAContractMoneyTotal}}</td>
                                <td>{{user.ReturnedMoneyTotal}}</td>
                                <td>{{user.CustomerNumTotal}}</td>
                                <td>{{user.SignAContractTotal}}</td>
                            </tr>                            
                        </tbody>
                        <tfoot>
                           <tr>
                             <td colspan="4">
                                &nbsp;
                             </td>
                           </tr>
                        </tfoot>
                    </table>
                </div>
            </td>
        </tr>
    </table>
    <br />
            </td>
        </tr>
    </tbody>
</table>
