<%@ Page Title="" Language="C#" MasterPageFile="~/VEtterem.Master" AutoEventWireup="true"
    CodeBehind="Sales.aspx.cs" Inherits="VEtterem.Pultos.Sales" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <style type="text/css">
        .style4
        {
            width: 120px;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="CPHMain" runat="server">
    <div align="left">
        <asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
        </asp:ToolkitScriptManager>
        
        <asp:Panel ID="PanelGrids" runat="server" CssClass="panel">
            &nbsp;<asp:SqlDataSource ID="SqlDataSourcePA" runat="server" 
                ConnectionString="<%$ ConnectionStrings:VCS %>"                 
                ProviderName="<%$ ConnectionStrings:VCS.ProviderName %>" 
                SelectCommand="SELECT Akcio.Akcioid, ETLAP.ENEV, AKCIO.KEDVEZMENY, AKCIO.LEIRAS, AKCIO.KEZDET, AKCIO.VEG FROM AKCIO INNER JOIN PILLANATNYI_AKCIO ON AKCIO.AKCIOID = PILLANATNYI_AKCIO.AKCIO INNER JOIN ETLAP ON PILLANATNYI_AKCIO.CIKK = ETLAP.ETLAPID WHERE veg >= sysdate">                
            </asp:SqlDataSource>
            <asp:GridView ID="GridViewPA" runat="server" DataSourceID="SqlDataSourcePA" AutoGenerateColumns="False"
                Width="100%" CssClass="gw" Caption="Pillanatnyi akciók" 
                Font-Underline="False">   
                <FooterStyle CssClass="gwFooter" />
                <EmptyDataTemplate>
                    Jelenleg nincs ilyen akció!
                </EmptyDataTemplate>             
                <RowStyle CssClass="gwRStyle" />
                <Columns>                
                    <asp:TemplateField>                        
                        <ItemTemplate>
                            <asp:Label ID="AkcioID" runat="server" 
                                Text='<%# DataBinder.Eval(Container.DataItem, "AkcioID") %>' Visible="false" />
                            <asp:CheckBox ID="CheckBoxPATorles" runat="server" />
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:BoundField DataField="ENEV" HeaderText="Fogás" ReadOnly="True" 
                        SortExpression="ENEV" />
                    <asp:BoundField DataField="KEDVEZMENY" HeaderText="Kedvezmény" ReadOnly="True" 
                        SortExpression="KEDVEZMENY" />
                    <asp:BoundField DataField="LEIRAS" HeaderText="Leírás" ReadOnly="True" 
                        SortExpression="LEIRAS" />
                    <asp:BoundField DataField="KEZDET" HeaderText="Kezdete" ReadOnly="True" 
                        SortExpression="KEZDET" />
                    <asp:BoundField DataField="VEG" HeaderText="Vége" ReadOnly="True" 
                        SortExpression="VEG" />
                </Columns>
                <HeaderStyle CssClass="gwHeader" />
                <AlternatingRowStyle CssClass="gwAltRStyle" />
            </asp:GridView>
            <asp:Button ID="ButtonTorlesPA" runat="server" CommandName="TorlesPA" 
                OnCommand="ButtonTorles_Click" Text="Kijelöltek törlése!" />
            <div style="border-style: solid; border-width: 1px">
            </div>
            <asp:SqlDataSource ID="SqlDataSourceETA" runat="server" ConnectionString="<%$ ConnectionStrings:VCS %>"
                ProviderName="<%$ ConnectionStrings:VCS.ProviderName %>" SelectCommand="SELECT Akcio.Akcioid, ETEL_TIPUS.ETNEV, AKCIO.KEDVEZMENY, AKCIO.LEIRAS, AKCIO.KEZDET, AKCIO.VEG FROM AKCIO INNER JOIN TIPUS_AKCIO ON AKCIO.AKCIOID = TIPUS_AKCIO.AKCIO INNER JOIN ETEL_TIPUS ON TIPUS_AKCIO.ETIPUS = ETEL_TIPUS.ETID WHERE veg >= sysdate"
                >                
            </asp:SqlDataSource>
            <asp:GridView ID="AkciokGridViewETA" runat="server" AutoGenerateColumns="False" 
                DataKeyNames="AkcioId" DataSourceID="SqlDataSourceETA" Width="100%" 
                CssClass="gw" Caption="Étel típus akciók">
                <FooterStyle CssClass="gwFooter" />
                <EmptyDataTemplate>
                    Jelenleg nincs ilyen akció!
                </EmptyDataTemplate>   
                <RowStyle CssClass="gwRStyle" />
                <Columns>                
                    <asp:TemplateField>                        
                        <ItemTemplate>
                            <asp:Label ID="AkcioID" runat="server" 
                                Text='<%# DataBinder.Eval(Container.DataItem, "AkcioID") %>' Visible="false" />
                            <asp:CheckBox ID="CheckBoxETATorles" runat="server" />
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:BoundField DataField="ETNEV" HeaderText="Fogás" ReadOnly="True" 
                        SortExpression="ETNEV" />
                    <asp:BoundField DataField="KEDVEZMENY" HeaderText="Kedvezmény" ReadOnly="True" 
                        SortExpression="KEDVEZMENY" />
                    <asp:BoundField DataField="LEIRAS" HeaderText="Leírás" ReadOnly="True" 
                        SortExpression="LEIRAS" />
                    <asp:BoundField DataField="KEZDET" HeaderText="Kezdete" ReadOnly="True" 
                        SortExpression="KEZDET" />
                    <asp:BoundField DataField="VEG" HeaderText="Vége" ReadOnly="True" 
                        SortExpression="VEG" />
                </Columns>     
                <HeaderStyle CssClass="gwHeader" />
                <AlternatingRowStyle CssClass="gwAltRStyle" />           
            </asp:GridView>
            <asp:Button ID="ButtonTorlesETA" runat="server" OnCommand="ButtonTorles_Click" 
                Text="Kijelöltek törlése!" CommandName="TorlesETA" />
            <div style="border-style: solid; border-width: 1px">
            </div>
            <asp:SqlDataSource ID="SqlDataSourceIA" runat="server" ConnectionString="<%$ ConnectionStrings:VCS %>"
                ProviderName="<%$ ConnectionStrings:VCS.ProviderName %>" SelectCommand="SELECT Akcio.Akcioid, IDOSZAKOS_AKCIO.KEZDOORA, IDOSZAKOS_AKCIO.VEGORA, AKCIO.KEDVEZMENY, AKCIO.LEIRAS, AKCIO.KEZDET, AKCIO.VEG FROM AKCIO INNER JOIN IDOSZAKOS_AKCIO ON AKCIO.AKCIOID = IDOSZAKOS_AKCIO.AKCIO WHERE veg >= sysdate">
            </asp:SqlDataSource>
            <asp:GridView ID="AkciokGridViewIA" runat="server" AutoGenerateColumns="False" 
                DataSourceID="SqlDataSourceIA" Width="100%" CssClass="gw" 
                Caption="Időszakos akciók">
                <FooterStyle CssClass="gwFooter" />
                <EmptyDataTemplate>
                    Jelenleg nincs ilyen akció!
                </EmptyDataTemplate> 
                <RowStyle CssClass="gwRStyle" />  
                <Columns>
                    <asp:TemplateField>                        
                        <ItemTemplate>
                            <asp:Label ID="AkcioID" runat="server" 
                                Text='<%# DataBinder.Eval(Container.DataItem, "AkcioID") %>' Visible="false" />
                            <asp:CheckBox ID="CheckBoxIATorles" runat="server" />
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:BoundField DataField="KEZDOORA" HeaderText="Kezdőóra" ReadOnly="True" 
                        SortExpression="KEZDOORA" />
                    <asp:BoundField DataField="VEGORA" HeaderText="Végóra" ReadOnly="True" 
                        SortExpression="VEGORA" />
                    <asp:BoundField DataField="KEDVEZMENY" HeaderText="Kedvezmény" ReadOnly="True" 
                        SortExpression="KEDVEZMENY" />
                    <asp:BoundField DataField="LEIRAS" HeaderText="Leírás" ReadOnly="True" 
                        SortExpression="LEIRAS" />
                    <asp:BoundField DataField="KEZDET" HeaderText="Kezdete" ReadOnly="True" 
                        SortExpression="KEZDET" />
                    <asp:BoundField DataField="VEG" HeaderText="Vége" ReadOnly="True" 
                        SortExpression="VEG" />
                </Columns>
                <HeaderStyle CssClass="gwHeader" />
                <AlternatingRowStyle CssClass="gwAltRStyle" />      
            </asp:GridView>
            <asp:Button ID="ButtonTorlesIA" runat="server" OnCommand="ButtonTorles_Click" 
                Text="Kijelöltek törlése!" CommandName="TorlesIA" />
        </asp:Panel>
        <br />
        <asp:Panel ID="PanelUjButton" runat="server" CssClass="panel">
            <asp:Button ID="UjAkcioButton" runat="server" OnClick="UjAkcioButton_Click" Text="Új akció felvitele" />
        </asp:Panel>
        <asp:Panel ID="PanelMilyen" runat="server" Visible="False" CssClass="panel" Enabled="True">
            <div align="left">
                <asp:Label ID="LabelMilyen" runat="server" Text="Milyen típusú akciót szeretne felvinni?"></asp:Label>
                <asp:RadioButtonList ID="MilyenRadioButtonList" runat="server" AutoPostBack="True"
                    OnSelectedIndexChanged="MilyenRadioButtonList_SelectedIndexChanged">
                    <asp:ListItem Selected="True" Text="Ételtípus akciók" Value="Tipus_akcio"></asp:ListItem>
                    <asp:ListItem Text="Időszakos akciók" Value="Idoszakos_akcio"></asp:ListItem>
                    <asp:ListItem Text="Pillanatnyi akciók" Value="Pillanatnyi_akcio"></asp:ListItem>
                </asp:RadioButtonList>
                <asp:Panel ID="PanelAkciok" runat="server" Visible="False">
                    <table style="width: 100%;">
                        <tr>
                            <td>
                                <asp:Panel ID="Panel1" runat="server" CssClass="panel">
                                
                                <asp:Calendar ID="CalendarEttol" runat="server" BackColor="White" BorderColor="#3366CC"
                                    BorderWidth="1px" Caption="Ettől:" CellPadding="1" DayNameFormat="Shortest" Font-Names="Verdana"
                                    Font-Size="8pt" ForeColor="#003399" Height="200px" Width="220px">
                                    <DayHeaderStyle BackColor="#33CC33" ForeColor="#336666" Height="1px" />
                                    <NextPrevStyle Font-Size="8pt" ForeColor="#CCCCFF" />
                                    <OtherMonthDayStyle ForeColor="#999999" />
                                    <SelectedDayStyle BackColor="#003300" Font-Bold="True" ForeColor="#CCFF99" />
                                    <SelectorStyle BackColor="#99CCCC" ForeColor="#336666" />
                                    <TitleStyle BackColor="#485C18" BorderColor="#3366CC" BorderWidth="1px" Font-Bold="True"
                                        Font-Size="10pt" ForeColor="#CCCCFF" Height="25px" />
                                    <TodayDayStyle BackColor="#99CCCC" ForeColor="White" />
                                    <WeekendDayStyle BackColor="#CCCCFF" />
                                </asp:Calendar>
                                </asp:Panel>
                            </td>
                            <td>
                            <asp:Panel ID="Panel2" runat="server" CssClass="panel">
                                <asp:Calendar ID="CalendarEddig" runat="server" BackColor="White" BorderColor="#3366CC"
                                    BorderWidth="1px" Caption="Eddig:" CellPadding="1" DayNameFormat="Shortest" Font-Names="Verdana"
                                    Font-Size="8pt" ForeColor="#003399" Height="200px" Width="220px">
                                    <DayHeaderStyle BackColor="#33CC33" ForeColor="#336666" Height="1px" />
                                    <NextPrevStyle Font-Size="8pt" ForeColor="#CCCCFF" />
                                    <OtherMonthDayStyle ForeColor="#999999" />
                                    <SelectedDayStyle BackColor="#003300" Font-Bold="True" ForeColor="#CCFF99" />
                                    <SelectorStyle BackColor="#99CCCC" ForeColor="#336666" />
                                    <TitleStyle BackColor="#485C18" BorderColor="#3366CC" BorderWidth="1px" Font-Bold="True"
                                        Font-Size="10pt" ForeColor="#CCCCFF" Height="25px" />
                                    <TodayDayStyle BackColor="#99CCCC" ForeColor="White" />
                                    <WeekendDayStyle BackColor="#CCCCFF" />
                                </asp:Calendar>
                                </asp:Panel>
                            </td>
                        </tr>
                        <tr>
                            <td>
                            <asp:Panel ID="Panel3" runat="server" CssClass="panel">
                                <asp:TextBox ID="TextBoxLeiras" runat="server" Height="200px" TextMode="MultiLine"
                                    Width="200px" BorderStyle="Solid" BorderWidth="1px" 
                                    CssClass="textBoxLogin"></asp:TextBox>
                                <asp:TextBoxWatermarkExtender ID="TextBoxLeiras_TextBoxWatermarkExtender" runat="server"
                                    Enabled="True" TargetControlID="TextBoxLeiras" WatermarkText="Ide írja az akció leírását!">
                                </asp:TextBoxWatermarkExtender>
                                </asp:Panel>
                            </td>
                            <td>
                            <asp:Panel ID="Panel4" runat="server" CssClass="panel">
                                <table style="width: 100%;">
                                    <tr>
                                        <td colspan="3">
                                            <asp:Label ID="Labelszoveg" runat="server" Text="A kijelölt Dátumintervallumban minden nap az akció"
                                                Visible="False"></asp:Label>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td class="style4">
                                            <asp:Label ID="LabelKezdoOra" runat="server" Text="Kezdőórája:" Visible="False"></asp:Label>
                                            <asp:DropDownList ID="DDLKOra" runat="server" ValidationGroup="vgr" Visible="False"
                                                Width="50px">
                                                <asp:ListItem>00</asp:ListItem>
                                                <asp:ListItem>01</asp:ListItem>
                                                <asp:ListItem>02</asp:ListItem>
                                                <asp:ListItem>03</asp:ListItem>
                                                <asp:ListItem>04</asp:ListItem>
                                                <asp:ListItem>05</asp:ListItem>
                                                <asp:ListItem>06</asp:ListItem>
                                                <asp:ListItem>07</asp:ListItem>
                                                <asp:ListItem>08</asp:ListItem>
                                                <asp:ListItem>09</asp:ListItem>
                                                <asp:ListItem>10</asp:ListItem>
                                                <asp:ListItem>11</asp:ListItem>
                                                <asp:ListItem>12</asp:ListItem>
                                                <asp:ListItem>13</asp:ListItem>
                                                <asp:ListItem>14</asp:ListItem>
                                                <asp:ListItem>15</asp:ListItem>
                                                <asp:ListItem>16</asp:ListItem>
                                                <asp:ListItem>17</asp:ListItem>
                                                <asp:ListItem>18</asp:ListItem>
                                                <asp:ListItem>19</asp:ListItem>
                                                <asp:ListItem>20</asp:ListItem>
                                                <asp:ListItem>21</asp:ListItem>
                                                <asp:ListItem>22</asp:ListItem>
                                                <asp:ListItem>23</asp:ListItem>
                                                <asp:ListItem>24</asp:ListItem>
                                            </asp:DropDownList>
                                        </td>
                                        <td>
                                            <asp:Label ID="LabelVegOra" runat="server" Text="Végórája:" Visible="False"></asp:Label>
                                            <asp:DropDownList ID="DDLVOra" runat="server" ValidationGroup="vgr" Visible="False"
                                                Width="50px">
                                                <asp:ListItem>00</asp:ListItem>
                                                <asp:ListItem>01</asp:ListItem>
                                                <asp:ListItem>02</asp:ListItem>
                                                <asp:ListItem>03</asp:ListItem>
                                                <asp:ListItem>04</asp:ListItem>
                                                <asp:ListItem>05</asp:ListItem>
                                                <asp:ListItem>06</asp:ListItem>
                                                <asp:ListItem>07</asp:ListItem>
                                                <asp:ListItem>08</asp:ListItem>
                                                <asp:ListItem>09</asp:ListItem>
                                                <asp:ListItem>10</asp:ListItem>
                                                <asp:ListItem>11</asp:ListItem>
                                                <asp:ListItem>12</asp:ListItem>
                                                <asp:ListItem>13</asp:ListItem>
                                                <asp:ListItem>14</asp:ListItem>
                                                <asp:ListItem>15</asp:ListItem>
                                                <asp:ListItem>16</asp:ListItem>
                                                <asp:ListItem>17</asp:ListItem>
                                                <asp:ListItem>18</asp:ListItem>
                                                <asp:ListItem>19</asp:ListItem>
                                                <asp:ListItem>20</asp:ListItem>
                                                <asp:ListItem>21</asp:ListItem>
                                                <asp:ListItem>22</asp:ListItem>
                                                <asp:ListItem>23</asp:ListItem>
                                                <asp:ListItem>24</asp:ListItem>
                                            </asp:DropDownList>
                                        </td>
                                        <td>
                                            &nbsp;
                                        </td>
                                    </tr>
                                    <tr>
                                        <td class="style4">
                                            <asp:DropDownList ID="ETDropDownList" runat="server" DataSourceID="ETDDLSqlDataSource"
                                                DataTextField="ETNEV" DataValueField="ETID" Width="150px">
                                            </asp:DropDownList>
                                            <asp:DropDownList ID="DropDownListPillA" runat="server" DataSourceID="SqlDataSourcePillA"
                                                DataTextField="ENEV" DataValueField="EtlapID" Visible="False" 
                                                Width="150px">
                                            </asp:DropDownList>
                                        </td>
                                        <td>
                                            <asp:Label ID="LabelKedvezmeny" runat="server" Text="Kedvezmény:"></asp:Label>
                                            <asp:TextBox ID="TextBoxSzazalek" runat="server" MaxLength="2" ValidationGroup="gr"
                                                Width="18px"></asp:TextBox>
                                            <asp:TextBoxWatermarkExtender ID="TextBoxSzazalek_TextBoxWatermarkExtender" runat="server"
                                                Enabled="True" TargetControlID="TextBoxSzazalek" WatermarkText="%">
                                            </asp:TextBoxWatermarkExtender>
                                        </td>
                                        <td>
                                            &nbsp;
                                        </td>
                                    </tr>
                                </table>
                                <br />
                                </asp:Panel>
                            </td>
                        </tr>
                        <tr>
                            <td colspan="2">
                                <asp:CompareValidator ID="CompareValidator1" runat="server" ControlToCompare="DDLKOra"
                                    ControlToValidate="DDLVOra" Display="None" Enabled="False" ErrorMessage="A kezdőórának kisebbnek kell lennie, mint a végórának!"
                                    Operator="GreaterThan" ValidationGroup="vgr"></asp:CompareValidator>
                                <asp:ValidatorCalloutExtender ID="CompareValidator1_ValidatorCalloutExtender" runat="server"
                                    Enabled="True" TargetControlID="CompareValidator1">
                                </asp:ValidatorCalloutExtender>
                                <asp:RangeValidator ID="RangeValidatorSzazalek" runat="server" ControlToValidate="TextBoxSzazalek"
                                    Display="None" ErrorMessage="Hibás adat!" MaximumValue="99" MinimumValue="0"
                                    ValidationGroup="gr"></asp:RangeValidator>
                                <asp:ValidatorCalloutExtender ID="RangeValidatorSzazalek_ValidatorCalloutExtender"
                                    runat="server" Enabled="True" PopupPosition="Left" TargetControlID="RangeValidatorSzazalek">
                                </asp:ValidatorCalloutExtender>
                                <asp:RequiredFieldValidator ID="RequiredFieldValidatorSzazalek" runat="server" ControlToValidate="TextBoxSzazalek"
                                    Display="None" ErrorMessage="Hiányzik a kedvezmény!" ValidationGroup="gr"></asp:RequiredFieldValidator>
                                <asp:Label ID="LabelInfo" runat="server" ForeColor="Red"></asp:Label>
                                <asp:ValidatorCalloutExtender ID="RequiredFieldValidatorSzazalek_ValidatorCalloutExtender"
                                    runat="server" Enabled="True" PopupPosition="Left" TargetControlID="RequiredFieldValidatorSzazalek">
                                </asp:ValidatorCalloutExtender>
                                <asp:SqlDataSource ID="ETDDLSqlDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:VCS %>"
                                    ProviderName="<%$ ConnectionStrings:VCS.ProviderName %>" SelectCommand="SELECT [ETNEV], [ETID] FROM [ETEL_TIPUS]">
                                </asp:SqlDataSource>
                                <asp:SqlDataSource ID="SqlDataSourcePillA" runat="server" ConnectionString="<%$ ConnectionStrings:VCS %>"
                                    ProviderName="<%$ ConnectionStrings:VCS.ProviderName %>" SelectCommand="SELECT ENEV, EtlapID FROM ETLAP ORDER BY ENEV, ETIPUS">
                                </asp:SqlDataSource>
                                <div align="right">
                                    <asp:Button ID="ButtonMegsem" runat="server" OnClick="ButtonMegsem_Click" Text="Mégsem" />
                                    <asp:Button ID="ButtonRogzites" runat="server" Text="Rögzítés" OnClick="ButtonRogzites_Click" />
                                </div>
                            </td>
                        </tr>
                    </table>
                </asp:Panel>
            </div>
        </asp:Panel>
        <br />
        <br />
    </div>
</asp:Content>
