<%@ Page Title="" Language="C#" MasterPageFile="~/BackStage/HelperMaster.Master" AutoEventWireup="true" CodeBehind="Frm_AddCusBaiFangNew.aspx.cs" Inherits="AndroidSevice.Web.BackStage.XDGL.Frm_AddCusBaiFangNew" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <script type="text/javascript">
        function sAlert(info) {
            var message = info;
            layer.alert(message, { closeBtn: 0
            }, function () {
                parent.location.reload(); //刷新父页面
            });
        }
        function sAlertO(info) {
            var message = info;
            layer.alert(message, 8); //风格一，layer弹出层特效
        }
        function sAlertOut(info) {
            layer.alert(info, { closeBtn: 0
            }, function () {
                window.location.href = '../../default.aspx'; //刷新父页面
            });
        }
        function ShowDataHelp(_url, _title, _handler) {
            var etypeid = $('#sdl option:selected').val(); //选中的值
            var name = $('#sdl option:selected').text(); //选中的文本
            var date = document.getElementById("date").value;
            if (name == "") {
                alert("请选择业务员");
                return;
            }
            _url = _url + "id=" + etypeid + "&name=" + name + "&date=" + date;
            layer.open({
                type: 2,
                area: ['800px', '600px'],
                fix: false, //不固定
                maxmin: true,
                content: _url
            });
        }
    </script>
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <div class="container-fluid">
				<div class="row-fluid">
					<div class="span12">
						<div class="widget-box">
							<div class="widget-title">
								<span class="icon">
									<i class="icon-th-list"></i>
								</span>
								<h5>新增拜访</h5>
                                <div class="buttons">
                                <a href="#"><button type="submit" value="save" name="save" class="btn" >保存</button></a>
                                </div>
                            </div>
							<div class="widget-content">
                             <table id="query" class="table table-bordered table-striped table-hover">
                                    <tbody>
                                    <tr>
										<td>
                                        <span>业务员：
                                        <select class="selectstyle" name="sdl" id="sdl">
                                        <option value=""></option>
                                        <%if (dtUser != null && dtUser.Rows.Count > 0)
                                          {
                                              for (int i = 0; i < dtUser.Rows.Count; i++)
                                              {
                                             %>
				                                <option <%=dtUser.Rows[i]["TypeID_"].ToString()==_empory?"selected":"" %>  value=<%=dtUser.Rows[i]["TypeID_"].ToString() %>><%=dtUser.Rows[i]["FullName"].ToString()%></option>
                                        <%  }
                                          } %>
				                        </select>
                                        </span>
                                        </td>
                                        <td><span>拜访日期：</span><span>
                                        <input type="text" class="inputwidth" onFocus="WdatePicker({isShowClear:false,readOnly:true})" name="date" id="date" value="<%=_Date %>"/></span>
                                        </td>
                                        <td>
                                            <a href="#"><button type="button" onclick=ShowDataHelp('Frm_AddOptCusLode.aspx?','','') class="btn" ><i class="icon-plus"></i>新增拜访客户</button></a>
                                        &nbsp;&nbsp;
                                            <button type="submit" name="sub" value="sub" class="btn" >查询</button>
                                        </td>
									</tr>
                                    </tbody>
							 </table>
                             <table id="wew" class="table table-bordered table-striped table-hover">
                                    <thead>
										<tr>
                                            <th style=" width:30px">序号</th>
											<th>日期</th>
											<th>客户名称</th>
                                            <th>客户类型</th>
                                            <th>地区</th>
                                            <th>地址</th>
                                            <th>操作</th>
										</tr>
									</thead>
                                    <tbody>
                                    <%
                                        if (dtList != null && dtList.Rows.Count != 0)
                                        {
                                            for (int i = 0; i < dtList.Rows.Count; i++)
                                            {
                                        %>
                                    <tr>
                                            <td style=" width:30px"><%=dtList.Rows[i]["sort"].ToString()%></td>
											<td><%=dtList.Rows[i]["BillDate"].ToString()%></td>
                                            <td><%=dtList.Rows[i]["CustomerName"].ToString()%></td>
                                            <td><%=dtList.Rows[i]["typename"].ToString()%></td>
                                            <td><%=dtList.Rows[i]["area"].ToString()%></td>
                                            <td><%=dtList.Rows[i]["Address"].ToString()%></td>
                                            <td>
                                                   <% if (i !=0)
                                                {%>
                                                    <button type="button" onclick="window.location.href='Frm_AddCusBaiFangNew.aspx?type=up&cid=<%=dtList.Rows[i]["CustomerId"].ToString() %>&sort=<%=dtList.Rows[i]["Sort"].ToString() %>&other=<%=dtList.Rows[i-1]["CustomerId"].ToString() %>'" class="btn btn-mini" >上移</button>
                                                <%} %>
                                                 <% if (i != dtList.Rows.Count-1)
                                                {%>
                                                    <button type="button" onclick="window.location.href='Frm_AddCusBaiFangNew.aspx?type=down&cid=<%=dtList.Rows[i]["CustomerId"].ToString() %>&sort=<%=dtList.Rows[i]["Sort"].ToString() %>&other=<%=dtList.Rows[i+1]["CustomerId"].ToString() %>'" class="btn btn-mini" >下移</button>
                                                <%} %>
                                                <button type="button" onclick="javaScript:if(confirm('您确定要删除吗？')) window.location.href='Frm_AddCusBaiFangNew.aspx?del=del&sdl=<%=_empory %>&date=<%=_Date %>&bid=<%=dtList.Rows[i]["BillId"].ToString()%>&cid=<%=dtList.Rows[i]["CustomerId"].ToString() %>&num=<%=dtList.Rows[i]["num"].ToString() %>'" class="btn btn-mini">删除</button>
                                            </td>
									</tr>
                                     <%
                                            }
                                        }
                                         %>
                                    </tbody>
							</table>
						</div>
					</div>
				</div>
			</div>
    </div>
</asp:Content>

