<%@ Page Language="vb" AutoEventWireup="false" MasterPageFile="~/Admin.Master" CodeBehind="NonRGBCCustomerDetails.aspx.vb" Inherits="Superbowl.NonRGBCCustomerDetails" 
    title="Untitled Page" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">

  <script language="javascript" type="text/javascript">
<!--
	function FormValidate()
	{
		msg = ""
		f = document.aspnetForm;
		
		if(f.ctl00$body$txtCustomerNo.value == "")
			msg += "- Customer Number\n";
		if(f.ctl00$body$strCustomerName.value == "")
			msg += "- Customer Name\n";
		if(f.ctl00$body$ddlBranch.value == 0)
			msg += "- Branch\n";
		if(f.ctl00$body$ddlRep.value == "0")
			msg += "- Sales Rep\n";
		if(msg.length > 0){
			alert("Please enter the following values:\n" + msg);
			return false;
		}
		else
		{
			return true;
		}
	}
-->
</script>
	<style type="text/css">
		.cssTxt1
		{
			width: 60px;
		}
		.cssDDL1
		{
			width: 160px;
		}
		.cssDDL2
		{
			width: 240px;
		}
		.cssDDL3
		{
			width:300px;
		}
   </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="body" runat="server">
  <table width="100%" border="0" >
 <tr>
     <td align="center" class="headings" colspan="3">Non RGBC Customer Details</td>
 </tr>
 <tr valign="top" >         
   <td align="left" valign="top">
        <table  cellpadding="2" width="100%" border="0">
				<tr 'null tr, controls the width'><td width="40%"></td><td></td></tr> 
				<tr >
					<td align="right">Customer Number:</td>
					<td align="left" ><asp:TextBox ID="txtCustomerNo" runat="server" MaxLength="7" 
							AutoPostBack="True"></asp:TextBox><X>*</X></td></tr>
				<tr>
				  <td align="right" >Customer Name:</td>
				  <td align="left" >
					  <asp:TextBox ID="strCustomerName" runat="server" 
						  CssClass="cssDDL2" MaxLength="80"></asp:TextBox><X>*</X></td></tr>
				<tr>		 	
					<td align="right" >Branch:</td>
					<td align="left" ><asp:DropDownList ID="ddlBranch" runat="server" 
							DataSourceID="sdsBranch" CssClass="cssDDL2"
							DataTextField="strBranch" DataValueField="BranchID"></asp:DropDownList><X>*</X></td></tr>		  
				<tr>
					<td align="right">Rep:</td>
					<td align="left" >
						<asp:DropDownList ID="ddlRep" runat="server"	 CssClass="cssDDL2" AutoPostBack="True"
							DataSourceID="sdsRep" DataTextField="strRep" DataValueField="RepID" /><x>*</x></td></tr>
				<tr>
					<td align="right">Rep Segment:</td>
					<td align="left" ><asp:Label ID="lblSegment" runat="server" Text=""></asp:Label></td></tr>
				<tr>
				  <td align="right" >Channel:</td>
				  <td align="left" >
            <asp:DropDownList ID="ddlChannelSegment" runat="server" CssClass="cssDDL3" 
						  DataSourceID="sdsChannel" DataTextField="strChannelSegment" 
              DataValueField="ChannelSegmentID">
					  </asp:DropDownList></td></tr>
				</table></td>																		   
    <td align="left" valign="top" width="35%">
        <table cellpadding="2" width="100%" border="0">
				<tr 'null tr, controls the width'><td width="40%"></td><td></td></tr>
				<tr>
				  <td align="right">Type 1:</td>
				  <td align="left" ><asp:DropDownList ID="ddlType1" runat="server" 
              DataSourceID="sdsType1" CssClass="cssDDL1" DataTextField="strType1" 
              DataValueField="Type1ID" ></asp:DropDownList></td></tr>
				<tr>
				  <td align="right">Type 2:</td>
				  <td align="left" ><asp:DropDownList ID="ddlType2" runat="server" 
              DataSourceID="sdsType2" CssClass="cssDDL1" DataTextField="strType2" 
              DataValueField="Type2ID" ></asp:DropDownList></td></tr>
				<tr>
				  <td align="right">Snell Area:</td>
				  <td align="left" >
					  
					  <asp:TextBox ID="strSnellArea" runat="server" CssClass="cssTxt1" MaxLength="3"></asp:TextBox>
					  
					</td></tr>				
				<tr>
				  <td align="right" >Active:</td>
				  <td valign="top"><asp:CheckBox ID="chkActive" runat="server" Checked="True" /></td></tr>
			</table>
	</td>
    <td align="left" width="10%">&nbsp;</td>
 </tr>
 <tr>
     <td align="center" colspan="3">
		   &nbsp;</td>
 </tr>
 <tr>
     <td align="center" colspan="3">
		  <asp:Label ID="lblMessage" runat="server" Font-Italic="True" Font-Bold="True" 
			  CssClass="red" Width="60%"></asp:Label>&nbsp;</td>
 </tr>
 <tr>
   <td align="center" colspan="3"><asp:Button ID="btnSave" runat="server" Text="Save" OnClientClick="return FormValidate()" />&nbsp;<asp:Button ID="btnClose" runat="server" Text="Cancel" /></td>
 </tr>
 <tr>
   <td align="center" colspan="3">&nbsp;</td>
 </tr>
 <tr>
   <td align="center" colspan="3">Last Edit: <asp:Label ID="lblLastEdit" runat="server" Text="New" Font-Italic="True"></asp:Label></td>
 </tr>
</table>

<asp:SqlDataSource ID="sdsBranch" runat="server" 
		ConnectionString="<%$ ConnectionStrings:csStockControl %>" 		
		SelectCommand="SELECT 0 AS BranchID, '- Select -' AS strBranch
													UNION SELECT BranchID, strBranch +' '+ strCode + CASE WHEN [strBranch] = [strSalesOffice] THEN '' ELSE ' : ' + [strSalesOffice] END AS strBranch FROM mstBranch 
													ORDER BY strBranch">
	</asp:SqlDataSource>
	
	<asp:SqlDataSource ID="sdsRep" runat="server" 
		ConnectionString="<%$ ConnectionStrings:csStockControl %>" 
		SelectCommand="SELECT '0' AS RepID, '- Select -' AS strRep
													UNION SELECT RepID, strRepName + ' - ' + RepID AS strRep FROM mstRep LEFT JOIN mstSegment ON SegmentID = refSegmentID
													ORDER BY strRep">
	</asp:SqlDataSource>
	
  <asp:SqlDataSource ID="sdsChannel" runat="server" 
  ConnectionString="<%$ ConnectionStrings:csStockControl %>" 

  SelectCommand="SELECT 0 AS ChannelSegmentID, '- Select -' AS strChannelSegment UNION SELECT ChannelSegmentID, strSegmentPrimary + ' &gt; ' + strSegment + ' &gt; ' + strChannelPrimary + ' &gt; ' + strChannel AS strChannelSegment FROM mstChannelSegment WHERE ChannelSegmentID > 0 ORDER BY strChannelSegment">
  </asp:SqlDataSource>
  <asp:SqlDataSource ID="sdsType1" runat="server" 
    ConnectionString="<%$ ConnectionStrings:csStockControl %>" 
    SelectCommand="SELECT 0 as Type1ID, '- None -' AS strType1 UNION SELECT Type1ID, strType1 FROM mstType1 ORDER BY strType1">
  </asp:SqlDataSource>
  <asp:SqlDataSource ID="sdsType2" runat="server" 
    ConnectionString="<%$ ConnectionStrings:csStockControl %>" 
    SelectCommand="SELECT 0 as Type2ID, '- None -' AS strType2 UNION SELECT Type2ID, strType2 FROM mstType2 ORDER BY strType2">
  </asp:SqlDataSource>
	
	</asp:Content>

