<%@ Page Title="" Language="C#" MasterPageFile="~/BackStage/HelperMaster.Master" AutoEventWireup="true" CodeBehind="Frm_AddPtypePeiHuo.aspx.cs" Inherits="AndroidSevice.Web.XDGL.Frm_AddPtypePeiHuo" %>
<%@ Register assembly="AspNetPager" namespace="Wuqi.Webdiyer" tagprefix="webdiyer" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <script type="text/javascript">
        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 sAlert(info) {
            layer.alert(info, { closeBtn: 0
            }, function () {
                parent.location.reload(); //刷新父页面
            });
        }
         function ShowDataHelpPtype(_url, _title, _handler) {
            var title = document.getElementById("<%=xyName.ClientID%>").value;
            var customid = document.getElementById("<%=hidcustomerId.ClientID%>").value;
            var strdate = document.getElementById("strdate").value;
            var enddate = document.getElementById("endate").value;
            if (_title == "1") {
                if (title == "") {
                    alert("请输入协议名称");
                    return;
                }
            }
            layer.open({
                type: 2,
                area: ['80%', '80%'],
                fix: false, //不固定
                maxmin: true,
                content: _url + "?httpname=" + title + "&customid=" + customid + "&strdate=" + strdate + "&enddate=" + enddate
            });
        }
        function ShowDataHelp(_url, _title, _handler) {
            var title = document.getElementById("<%=xyName.ClientID%>").value;
            if (_title == "1") {
                if (title == "") {
                    alert("请输入协议名称");
                    return;
                }
            }
            layer.open({
                type: 2,
                area: ['80%', '80%'],
                fix: false, //不固定
                maxmin: true,
                content: _url
            });
        } 
        function ShowDataHelpSet(_url, _title, _handler) {
            var title = document.getElementById("<%=xyName.ClientID%>").value;
            var name = document.getElementById("<%=customerName.ClientID%>").value;
            if (title == "") {
                alert("请输入协议名称");
                return;
            }
            if (name == "") {
                alert("请选择客户");
                return;
            }
            if (_title == "") {
                alert("请先选择商品");
                return;
            }
            layer.open({
                type: 2,
                area: ['450px', '300px'],
                fix: false, //不固定
                maxmin: true,
                content: _url + "&check=" + _title
            });
        }
        //一键导入
        function ShowDataHelpExpote(_url, _title, _handler) {
            var title = document.getElementById("<%=xyName.ClientID%>").value;
            var name = document.getElementById("<%=customerName.ClientID%>").value;
            if (_title != "2") {
                if (title == "") {
                    alert("请输入协议名称");
                    return;
                }
                if (name == "") {
                    alert("请选择客户");
                    return;
                } 
            }
            layer.open({
                type: 2,
                area: ['450px', '300px'],
                fix: false, //不固定
                maxmin: true,
                content: _url + "check=" + _title
            });
        }
    </script>
<style type="text/css">
    .style1
    {
        width: 30px;
        height: 27px;
    }
    .style2
    {
        height: 27px;
    }
</style>
</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>
							<div class="widget-content2">
                             <table id="query" class="table table-bordered table-striped table-hover">
                                    <tbody>
                                    <tr>
										<td>
                                            <span>协议名称：</span>
                                             <asp:TextBox ID="xyName" runat="server"></asp:TextBox>
                                             <asp:HiddenField ID="hidxyName" runat="server" />
                                        </td>
                                         <td>
                                            <span>客户名称：
                                                <asp:TextBox ID="customerName" runat="server" Enabled="false"></asp:TextBox>
                                                <asp:HiddenField ID="hidcustomerId" runat="server" />
                                                </span>
                                                <a title="" onclick=ShowDataHelp('../BBCX/Frm_CustomerEdit.aspx?','','') class="btn btn-mini" href="#"><i class="icon-plus"></i></a>                             
                                        </td>
                                    </tr>
                                    <tr>
                                        <td colspan="2">
                                            <span>生效时间：</span>
                                                <input type="text" class="inputwidth" style=" width:90px" onFocus="WdatePicker({isShowClear:false,readOnly:true})" name="strdate" id="strdate" value="<%=_strDate %>"/>
                                            <span>失效时间：</span>
                                                <input type="text" class="inputwidth" style=" width:90px"  onFocus="WdatePicker({isShowClear:false,readOnly:true})"  name="endate" id="endate" value="<%=_endDate %>"/>
                                        </td>
                                       
									</tr>
                                    </tbody>
							 </table>
                             <table id="wew" class="table table-bordered table-striped table-hover">
                                    <thead>
										<tr>
                                            <th class="style1">序号</th>
											<th class="style2">商品编号</th>
											<th class="style2">商品名称</th>
                                            <th class="style2">协议单价</th>
                                            <th class="style2">协议数量</th>
                                            <th class="style2">备注</th>
                                            <th class="style2">操作</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"><%=i+1 %></td>
											<td><%=dtList.Rows[i]["usercode"].ToString()%></td>
                                            <td><%=dtList.Rows[i]["fullname"].ToString()%></td>
                                            <td><%=dtList.Rows[i]["price"].ToString()%></td>
                                            <td><%=dtList.Rows[i]["count"].ToString()%></td>
                                            <td><%=dtList.Rows[i]["comment"].ToString()%></td>
                                            <td>
                                             <a href="#"><button type="button" onclick=ShowDataHelpSet('Frm_PeiHuoSet.aspx?ptypeid=<%=dtList.Rows[i]["ptypeid"].ToString()%>','2','') class="btn" >设置</button></a>
                                            <button type="button" onclick="javaScript:if(confirm('您确定要删除吗？')) window.location.href='Frm_AddPtypePeiHuo.aspx?del=del&bid=<%=dtList.Rows[i]["ptypeid"].ToString()%>&xyname=<%=_Name %>&xycname=<%=_customerId %>&check=<%=_check %>&billid=<%=(string)Session["HttpBillindexId"] %>'" class="btn">删除</button>
                                            </td>
									</tr>
                                     <%
                                            }
                                        }
                                         %>
                                    </tbody>
							</table>
                            <div class="pager">
                            <webdiyer:AspNetPager ID="AspNetPager1" runat="server" FirstPageText="首页" LastPageText="尾页"
                                    PrevPageText="上一页" NextPageText="下一页" OnPageChanging="AspNetPager1_PageChanging"
                                    PageSize="10" AlwaysShow="True" />
                            </div>
						</div>
                            <div class="form-actions" style="text-align:center ">
                            <a href="#"><button type="button" onclick=ShowDataHelpPtype('Frm_SelectData.aspx','1','') class="btn" >选择商品</button></a>
                            <a href="#"><button type="button" onclick=ShowDataHelpSet('Frm_AllSETPtypeAgreement.aspx?strdate=<%=_strDate %>&enddate=<%=_endDate %>','<%=_check %>','') class="btn" >批量设置</button></a>
                            <button type="submit" name="save" value="save" class="btn" >保存协议</button>
                            <a href="#"><button type="button" onclick=ShowDataHelpExpote('Frm_setDate.aspx','','') class="btn" >一键导入</button></a>
                            </div>
				</div>
			</div>
    </div>
    </div>
</asp:Content>


