<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/Admin.Master" CodeBehind="Planning.aspx.vb" Inherits="RGBC_Promotions.Planning" EnableEventValidation="false" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <style type="text/css">
      .style1
      {
         height: 27px;
      }
       .auto-style1 {
           height: 25px;
       }
       .auto-style3 {
           height: 27px;
           width: 25%;
       }
       .auto-style4 {
           width: 25%;
       }
       .auto-style5 {
           height: 25px;
           width: 25%;
       }
   </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <fieldset>
  <legend>Promotions</legend>
    <table style="width:1000px;" class="" border="0">
      <tr>
        
        <td align="left" valign="top" width="20%">
          <table style="width:100%;" class="" border="0" cellpadding="2">
            <tr>
              <td width=""></td>
            </tr>
            <tr>
              <td>&nbsp;</td>
            </tr>
          </table>          
        </td comment=col1>
        
        <td align="left" valign="top" width="70%">
          <table style="width:100%;" class="" border="0" cellpadding="2">
            <tr>
              <td align="right" class="auto-style4"></td>
              <td width="30%"></td>
              <td width=""></td>
            </tr>
            <tr>
              <td align="right" class="auto-style4">Year: </td>
              <td nowrap="nowrap">
                 <asp:DropDownList ID="ddlYear" runat="server" AppendDataBoundItems="True" 
                    DataSourceID="sdsYear" DataTextField="DataValueField" 
                    DataValueField="DataTextField">
                    <asp:ListItem Value="0">- Select -</asp:ListItem>
                 </asp:DropDownList>
                 <b>*</b></td>
              <td>
                 <asp:RequiredFieldValidator  ID="valYear" runat="server" 
                  ErrorMessage="Please select a Financial Year. " CssClass="textError boxError" 
                  ControlToValidate="ddlYear" SetFocusOnError="True" Display="Dynamic" 
                  ForeColor="" Type="Integer" InitialValue="0" BorderColor="#7F0206" 
                  BorderStyle="Solid" BorderWidth="1px"></asp:RequiredFieldValidator >
              </td>
            </tr>
            <tr>
              <td align="right" class="auto-style4">Brand: </td>
              <td nowrap="nowrap" align="left">
                 
                 <asp:DropDownList ID="ddlBrand" runat="server" AppendDataBoundItems="True" 
                    DataSourceID="sdsBrand" DataTextField="strBrand" DataValueField="BrandID">
                    <asp:ListItem Value="0">- Select -</asp:ListItem>
                 </asp:DropDownList>
                 <b>*</b>
               </td>
               <td>
                <asp:RequiredFieldValidator  ID="valBrand" runat="server" 
                  ErrorMessage="Please select a Brand. " CssClass="textError boxError" 
                  ControlToValidate="ddlBrand" SetFocusOnError="True" Display="Dynamic" 
                  ForeColor="" Type="Integer" InitialValue="0" BorderColor="#7F0206" BorderStyle="Solid" BorderWidth="1px"></asp:RequiredFieldValidator >
              </td>
            </tr>
            <tr>
              <td align="right" class="auto-style4">Channel: </td>
              <td align="left" >
                
                 <asp:DropDownList ID="ddlChannel" runat="server" AppendDataBoundItems="True" 
                    DataSourceID="sdsChannel" DataTextField="strSegmentL2" 
                    DataValueField="strSegmentL2">
                    <asp:ListItem Value="">- Select -</asp:ListItem>
                 </asp:DropDownList>
                 <b>*</b></td>
              <td >
                <asp:RequiredFieldValidator  ID="valChannel" runat="server" 
                  ErrorMessage="Please select a Channel. " CssClass="textError boxError" 
                  ControlToValidate="ddlChannel" SetFocusOnError="True" Display="Dynamic" 
                  ForeColor="" Type="Integer" BorderColor="#7F0206" 
                    BorderStyle="Solid" BorderWidth="1px"></asp:RequiredFieldValidator >
               </td>
            </tr>
            <tr>
              <td align="right" class="auto-style3">Activity Type:</td>
              <td nowrap="nowrap" class="style1">                
                 <asp:DropDownList ID="ddlActivityType" runat="server" AppendDataBoundItems="True" DataSourceID="sdsActivityType" DataTextField="strActivityType" DataValueField="strActivityType">
                    <asp:ListItem Value="">- Select -</asp:ListItem>
                 </asp:DropDownList>
                 <b>*</b></td>
              <td class="style1">
                <asp:RequiredFieldValidator  ID="valActivityType" runat="server" ErrorMessage="Please select an Activity Type. " CssClass="textError boxError" 
                  ControlToValidate="ddlActivityType" SetFocusOnError="True" Display="Dynamic" 
                  ForeColor="" Type="Integer" BorderColor="#7F0206" 
                    BorderStyle="Solid" BorderWidth="1px"></asp:RequiredFieldValidator >
              </td>
            </tr>
            <tr>
              <td align="right" class="auto-style3">Activity Name:</td>
              <td nowrap="nowrap" class="style1">                
                 <asp:DropDownList ID="ddlActivityName" runat="server" 
                    AppendDataBoundItems="True" DataSourceID="sdsActivityName" 
                    DataTextField="strActivityName" DataValueField="strActivityName">
                    <asp:ListItem Value="">- Select -</asp:ListItem>
                 </asp:DropDownList><b>*</b>
               </td>
              <td class="style1">
                <asp:RequiredFieldValidator  ID="valActivityName" runat="server" 
                  ErrorMessage="Please select an Activity. " CssClass="textError boxError" 
                  ControlToValidate="ddlActivityName" SetFocusOnError="True" Display="Dynamic" 
                  ForeColor="" Type="Integer" BorderColor="#7F0206" 
                    BorderStyle="Solid" BorderWidth="1px"></asp:RequiredFieldValidator >
              </td>
            </tr>
            <tr>
              <td align="right" class="auto-style3">New Activity:</td>
              <td nowrap="nowrap" class="style1">                
                 <asp:TextBox ID="txtActivityName" runat="server" Width="90%"></asp:TextBox>
               </td>
              <td class="style1">
                 <asp:LinkButton ID="lbtnAddActivity" runat="server" CausesValidation="False">Add New Activity</asp:LinkButton>
              </td>
            </tr>
            <tr>
              <td colspan=2 align="right">
                  &nbsp;</td>
            </tr>
          </table comment="col2">
        </td comment="col2">        
        
      </tr>      
      <tr>
        <td></td>
        <td align="right">
          &nbsp;<asp:Button ID="btnExport" runat="server" Text="Export" Enabled="False" OnClientClick=""/>&nbsp;
            <asp:Button ID="btnLoad" runat="server" Text="Load" OnClientClick="jsShowLoading(1);" />&nbsp;
            <asp:Button ID="btnSave" runat="server" Text="Save" OnClientClick="jsShowLoading(1);" Enabled="false"/>&nbsp;

        </td>
        <td>
        </td>
      </tr>
    </table>
    </fieldset>
  
   <fieldset>
  <legend>Campaign Duration</legend>
    <table style="width:1000px;" class="" border="0">
      <tr>
        
        <td align="left" valign="top" width="20%">
          <table style="width:100%;" class="" border="0" cellpadding="2">
            <tr>
              <td width=""></td>
            </tr>
            <tr>
              <td>&nbsp;</td>
            </tr>
          </table>          
        </td comment=col1>
        
        <td align="left" valign="top" width="70%">
          <table style="width:100%;" class="" border="0" cellpadding="2">
            <tr>
              <td align="right" class="auto-style4"></td>
              <td width="30%"></td>
              <td width=""></td>
            </tr>
            <tr>
              <td align="right" class="auto-style4">Current Campaign Duration: </td>
              <td nowrap="nowrap">                 
                 <asp:Label ID="txtCurrentCD" runat="server" Text=""></asp:Label>
                </td>
              <td>                  
               </td>
            </tr>
            <tr>
              <td align="right" class="auto-style5">New Campaign Duration: </td>
              <td nowrap="nowrap" align="left" class="auto-style1">
                 
                 <asp:TextBox ID="txtNewCD" runat="server" Width="90%"></asp:TextBox>
               </td>
               <td class="auto-style1">
            <asp:Button ID="btnSetCampaignDuration" runat="server" Text="Set Campaign Duration" OnClientClick="jsShowLoading(1);"/>
              </td>
            </tr>
            </table comment="col2">
        </td comment="col2">        
        
      </tr>      
      </table>
    </fieldset><br /><br />
    <asp:Label ID="lblMessage" runat="server" CssClass="boxError"></asp:Label>
    <br />
    <br />
   <asp:GridView ID="gvPlanning" runat="server" AutoGenerateColumns="False" 
      BorderColor="Black" BorderStyle="Solid" BorderWidth="1px" Caption="Planning" 
      CellPadding="4" DataSourceID="sdsPlanningBlank" Visible="False" 
      DataMember="DefaultView">
      <Columns>
         <asp:BoundField DataField="#" HeaderText="#" ReadOnly="True" 
            SortExpression="#" />
         <asp:BoundField DataField="Region" HeaderText="Region" ReadOnly="True" 
            SortExpression="Region" />
         <asp:TemplateField HeaderText="Jan" SortExpression="Jan">
            <ItemTemplate>
               <asp:TextBox ID="txt1" runat="server"  CssClass="controlTextbox" Text='<%# Bind("Jan") %>'></asp:TextBox>
            </ItemTemplate>
         </asp:TemplateField>
         <asp:TemplateField HeaderText="Feb" SortExpression="Feb">
            <ItemTemplate>
               <asp:TextBox ID="txt2" runat="server"  CssClass="controlTextbox" Text='<%# Bind("Feb") %>'></asp:TextBox>
            </ItemTemplate>
         </asp:TemplateField>
         <asp:TemplateField HeaderText="Mar" SortExpression="Mar">
            <ItemTemplate>
               <asp:TextBox ID="txt3" runat="server"  CssClass="controlTextbox" Text='<%# Bind("Mar") %>'></asp:TextBox>
            </ItemTemplate>
         </asp:TemplateField>
         <asp:TemplateField HeaderText="Apr" SortExpression="Apr">
            <ItemTemplate>
               <asp:TextBox ID="txt4" runat="server"  CssClass="controlTextbox" Text='<%# Bind("Apr") %>'></asp:TextBox>
            </ItemTemplate>
         </asp:TemplateField>
         <asp:TemplateField HeaderText="May" SortExpression="May">
            <ItemTemplate>
               <asp:TextBox ID="txt5" runat="server"  CssClass="controlTextbox" Text='<%# Bind("May") %>'></asp:TextBox>
            </ItemTemplate>
         </asp:TemplateField>
         <asp:TemplateField HeaderText="Jun" SortExpression="Jun">
            <ItemTemplate>
               <asp:TextBox ID="txt6" runat="server"  CssClass="controlTextbox" Text='<%# Bind("Jun") %>'></asp:TextBox>
            </ItemTemplate>
         </asp:TemplateField>
         <asp:TemplateField HeaderText="Jul" SortExpression="Jul">
            <ItemTemplate>
               <asp:TextBox ID="txt7" runat="server"  CssClass="controlTextbox" Text='<%# Bind("Jul") %>'></asp:TextBox>
            </ItemTemplate>
         </asp:TemplateField>
         <asp:TemplateField HeaderText="Aug" SortExpression="Aug">
            <ItemTemplate>
               <asp:TextBox ID="txt8" runat="server"  CssClass="controlTextbox" Text='<%# Bind("Aug") %>'></asp:TextBox>
            </ItemTemplate>
         </asp:TemplateField>
         <asp:TemplateField HeaderText="Sep" SortExpression="Sep">
            <ItemTemplate>
               <asp:TextBox ID="txt9" runat="server"  CssClass="controlTextbox" Text='<%# Bind("Sep") %>'></asp:TextBox>
            </ItemTemplate>
         </asp:TemplateField>
         <asp:TemplateField HeaderText="Oct" SortExpression="Oct">
            <ItemTemplate>
               <asp:TextBox ID="txt10" runat="server"  CssClass="controlTextbox" Text='<%# Bind("Oct") %>'></asp:TextBox>
            </ItemTemplate>
         </asp:TemplateField>
         <asp:TemplateField HeaderText="Nov" SortExpression="Nov">
            <ItemTemplate>
               <asp:TextBox ID="txt11" runat="server"  CssClass="controlTextbox" Text='<%# Bind("Nov") %>'></asp:TextBox>
            </ItemTemplate>
         </asp:TemplateField>
         <asp:TemplateField HeaderText="Dec" SortExpression="Dec">
            <ItemTemplate>
               <asp:TextBox ID="txt12" runat="server"  CssClass="controlTextbox" Text='<%# Bind("Dec") %>'></asp:TextBox>
            </ItemTemplate>
         </asp:TemplateField>
         <asp:BoundField DataField="Total" HeaderText="Total" ReadOnly="True" SortExpression="Total" />
      </Columns>
   </asp:GridView>

    
<asp:SqlDataSource ID="sdsYear" runat="server" ConnectionString="<%$ ConnectionStrings:SuperbowlConnectionString %>"    
   SelectCommand="SELECT mstPeriod.intFiscalYear AS DataValueField, mstPeriod.intFiscalYear AS DataTextField FROM mstPeriod WHERE (mstPeriod.intFiscalYear &gt; 2011) GROUP BY mstPeriod.intFiscalYear ORDER BY DataTextField DESC">
</asp:SqlDataSource>

<asp:SqlDataSource ID="sdsBrand" runat="server" ConnectionString="<%$ ConnectionStrings:SuperbowlConnectionString %>"    
   
      SelectCommand="SELECT mstBrand.BrandID, mstBrand.strBrand FROM mstUserBrand INNER JOIN mstBrand ON mstUserBrand.refBrandID = mstBrand.BrandID WHERE (mstBrand.blnActive = 1) AND (mstUserBrand.refUserID = @UserID) GROUP BY mstBrand.BrandID, mstBrand.strBrand ORDER BY mstBrand.strBrand">
   <SelectParameters>
      <asp:SessionParameter DbType="Int32" DefaultValue="26" Name="UserID" SessionField="USERID" />
   </SelectParameters>
</asp:SqlDataSource>

<asp:SqlDataSource ID="sdsChannel" runat="server" ConnectionString="<%$ ConnectionStrings:SuperbowlConnectionString %>" 
   
      
      SelectCommand="SELECT strSegmentPrimary + N'\' + strSegment AS strSegmentL2 FROM mstChannelSegment GROUP BY strSegmentPrimary, strSegment HAVING (NOT (strSegmentPrimary IN (N'Export', N'House', N'Not Allocated', N'Unknown','- Old -'))) ORDER BY strSegmentL2">
</asp:SqlDataSource>

   <asp:SqlDataSource ID="sdsActivityName" runat="server" 
      ConnectionString="<%$ ConnectionStrings:SuperbowlConnectionString %>" 
      
      SelectCommand="SELECT DISTINCT [strActivityName] FROM [dwfPromo] ORDER BY [strActivityName]">
   </asp:SqlDataSource>

   <asp:SqlDataSource ID="sdsPlanningBlank" runat="server" 
      ConnectionString="<%$ ConnectionStrings:SuperbowlConnectionString %>" 
      SelectCommand="SELECT strRegionOrder AS '#', strRegionDesc2 AS Region, 0 AS Jan, 0 AS Feb, 0 AS Mar, 0 AS Apr, 0 AS May, 0 AS Jun, 0 AS Jul, 0 AS Aug, 0 AS Sep, 0 AS Oct, 0 AS Nov, 0 AS Dec, 0 AS Total FROM mstBranch WHERE strRegion = 'Domestic' AND strRegionOrder &lt;&gt; '0' GROUP BY strRegionOrder, strRegionDesc2 
         UNION ALL 
         SELECT 99 AS '#', 'Total' AS Region, 0 AS Jan, 0 AS Feb, 0 AS Mar, 0 AS Apr, 0 AS May, 0 AS Jun, 0 AS Jul, 0 AS Aug, 0 AS Sep, 0 AS Oct, 0 AS Nov, 0 AS Dec, 0 AS Total ORDER BY '#', Region">
   </asp:SqlDataSource>

<asp:SqlDataSource ID="sdsActivityType" runat="server" 
   ConnectionString="<%$ ConnectionStrings:SuperbowlConnectionString %>" 
   SelectCommand="SELECT [ActivityTypeID], [strActivityType] FROM [promoActivityType] ORDER BY [strActivityType]">
</asp:SqlDataSource>

</asp:Content>
