<%@ page language="C#" masterpagefile="~/MasterFile/TimeCheck.master" autoeventwireup="true" inherits="Transactions_TA_UI_Transactions_LeaveApplicationAdmin, App_Web_cqjeffom" title="Leave Application Search" %>
<asp:Content ID="conLeaveApplicationAdmin" ContentPlaceHolderID="BodyContentPH" Runat="Server">
<script type="text/javascript">

    function WeekdayValidation()
    {      
       var EmpId = document.getElementById('ctl00_BodyContentPH_txtEmployeeId');
       var EmpName = document.getElementById('ctl00_BodyContentPH_txt_EmpName');
       var weekDay = document.getElementById('ctl00_BodyContentPH_txtLeaveStartDate');
       var weekDay2 = document.getElementById('ctl00_BodyContentPH_txtLeaveEndDate');
       
       swipCard = document.getElementById('ctl00_BodyContentPH_txtSwipeCard');
      
        if(swipCard!=null)
        {
            if (EmpName.value == '' && EmpId.value == '' && weekDay.value == '' && weekDay2.value == '' && swipCard.value=='')
            {
              alert("Please enter any of the above details");
              return false;
            }
            
        }
        else
        {
            if (weekDay.value == '' && weekDay2.value == '')
            {
                alert("Please enter the search filters");
                return false;
            }
        }
        if((weekDay.value == '' && weekDay2.value != '') || (weekDay.value != '' && weekDay2.value == ''))
        {
          alert("Please enter both the From and To Date");
          return false;
        }
        else
        {
          // Nothing
        }
       
        var DateFormat = document.getElementById('ctl00_BodyContentPH_Hidden1').value;
       
        if(weekDay.value!='')
           {
               if(checkDate(weekDay,DateFormat))
               {       
                   if(weekDay2.value!='')
                   {
                        if(checkDate(weekDay2,DateFormat))
                        {      
                        }
                        else
                        {
                            return false;
                        }
                   }
                   else
                   {
                     document.getElementById('ctl00_BodyContentPH_txtLeaveEndDate').focus();
                     return false;
                   }
               }
               else
               {           
                 return false;
               }
          }
     }

    </script>

    <table border="0" cellspacing="0" cellpadding="0" width="720px">
        <tr>
            <td valign="top">
                <img src="../Images/corner1<%=Session["Direction"] %>.gif" width="15" height="15" /></td>
            <td valign="top" background="../Images/sideline.gif" bgcolor="#eaeaea">
                <img src="../Images/spacer.gif" width="1" height="1" /></td>
            <td valign="top">
                <img src="../Images/corner2<%=Session["Direction"] %>.gif" width="15" height="15" /></td>
        </tr>
        <tr>
            <td background="../Images/line<%=Session["Direction"] %>.gif">
            </td>
            <td valign="top" bgcolor="#eaeaea">
                <table border="0" align="center" cellpadding="2" cellspacing="1" width="720px">
                    <tr>
                        <td valign="top" colspan="5" class="ModuleTitle" style="height: 26px">
                            <asp:Label ID="lbl_Header" runat="server"></asp:Label>
                            <%--<input id="Hidden1" type="hidden" value='<% Response.Write(Convert.ToString(Session["IDateFormat"])); %>' />--%>
                            <asp:HiddenField ID="Hidden1" runat="server" />
                        </td>
                    </tr>
                    <tr id="trSwipeCardNo" runat="server">
                        <td class="td" width="20%" colspan="2">
                            <asp:Label ID="lblEmpSwipe" runat="server"></asp:Label>
                        </td>
                        <td class="td" width="32%">
                            <asp:TextBox onpaste="return true"     ID="txtSwipeCard" MaxLength="20" runat="server" CssClass="textbox_3"></asp:TextBox>
                        </td>
                        <td class="td" width="13%">
                        </td>
                        <td class="td" width="35%">
                        </td>
                    </tr>
                    <tr id="trEmployeeDetails" runat="server">
                        <td class="td" width="20%" colspan="2">
                            <asp:Label ID="lbl_EmployeeName" runat="server"></asp:Label>
                        </td>
                        <td class="td" width="32%">
                            <asp:TextBox onpaste="return true"     ID="txt_EmpName" runat="server" CssClass="textbox_3" MaxLength="50"
                                onkeypress="return chkMaxLen(event,this,50);"></asp:TextBox>
                        </td>
                        <td class="td" width="13%">
                            <asp:Label ID="lbl_EmployeeId" runat="server"></asp:Label>
                        </td>
                        <td class="td" width="35%">
                            <asp:TextBox onpaste="return true"     ID="txtEmployeeId" runat="server" CssClass="textbox_3" MaxLength="15"
                                onkeypress="return chkMaxLen(event,this,15);"></asp:TextBox>
                        </td>
                    </tr>
                    <tr>
                        <td class="td" width="12%">
                            <asp:Label ID="lblTimePeriod" runat="server"></asp:Label>
                        </td>
                        <td class="td" width="8%">
                            <asp:Label ID="lblLeaveStartDate" runat="server"></asp:Label>
                        </td>
                        <td class="td" width="32%">
                            <table>
                                <tr>
                                    <td>
                                        <asp:TextBox onpaste="return true"     ID="txtLeaveStartDate" runat="server" BorderStyle="None" CssClass="textbox_3"
                                            EnableViewState="False" onCut="return false" onDrop="return false" 
                                            TabIndex="1"></asp:TextBox>
                                    </td>
                                    <td class="datepicker">
                                        <input id="btn_LeaveStartDate" src="../Images/dateicon.gif" type="image" tabindex="2"
                                            runat="server" />
                                    </td>
                                </tr>
                            </table>

                            <script type="text/javascript">
                                Calendar.setup({
                                inputField     :    "ctl00_BodyContentPH_txtLeaveStartDate",      // id of the input field
                                ifFormat       :   document.getElementById('ctl00_BodyContentPH_Hidden1').value,       // format of the input field
                                showsTime      :    true,            // will display a time selector
                                button         :    "ctl00_BodyContentPH_btn_LeaveStartDate",   // trigger for the calendar (button ID)
                                singleClick    :    true,           // double-click mode
                                step           :    1                // show all years in drop-down boxes (instead of every other year as default)
                                });
                            </script>

                        </td>
                        <td class="td" width="8%">
                            <asp:Label ID="lblLeaveEndDate" runat="server"></asp:Label>
                        </td>
                        <td class="td" width="35%">
                            <table>
                                <tr>
                                    <td>
                                        <asp:TextBox onpaste="return true"     ID="txtLeaveEndDate" runat="server" BorderStyle="None" CssClass="textbox_3"
                                            EnableViewState="False" onCut="return false" onDrop="return false" 
                                            TabIndex="1"></asp:TextBox>
                                    </td>
                                    <td class="datepicker">
                                        <input id="btn_LeaveEndDate" src="../Images/dateicon.gif" type="image" tabindex="2"
                                            runat="server" />
                                    </td>
                                </tr>
                            </table>

                            <script type="text/javascript">
                                Calendar.setup({
                                inputField     :    "ctl00_BodyContentPH_txtLeaveEndDate",      // id of the input field
                                ifFormat       :   document.getElementById('ctl00_BodyContentPH_Hidden1').value,       // format of the input field
                                showsTime      :    true,            // will display a time selector
                                button         :    "ctl00_BodyContentPH_btn_LeaveEndDate",   // trigger for the calendar (button ID)
                                singleClick    :    true,           // double-click mode
                                step           :    1                // show all years in drop-down boxes (instead of every other year as default)
                                });
                            </script>

                        </td>
                    </tr>
                    <tr>
                        <td class="td" colspan="5">
                            <table>
                                <tr>
                                    <td class="td" colspan="2" style="width: 60%">
                                        <asp:Label ID="lbl_Error" runat="server" ForeColor="Red"></asp:Label>
                                    </td>
                                    <td class="td" align="right">
                                        <asp:Button ID="btn_Search" CssClass="but" runat="server" OnClick="btn_Search_Click"
                                            OnClientClick="javascript:return WeekdayValidation()" /></td>
                                    <td class="td" align="left">
                                        <asp:Button ID="btn_Clear" CssClass="but" runat="server" OnClick="btn_Clear_Click" /></td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                    <tr>
                        <td align="center" colspan="5">
                            <table border="0" align="center" cellpadding="5" cellspacing="0" width="720px">
                                <tr>
                                    <td colspan="2" class="td">
                                        <asp:GridView ID="grv_LeaveApplication" runat="server" CssClass="td" AutoGenerateColumns="False"
                                            AllowPaging="True" Width="690px" AllowSorting="True" BorderColor="white" BorderWidth="1px"
                                            PageSize="10" CellPadding="4" OnRowDataBound="grv_LeaveApplication_RowDataBound">
                                            <Columns>
                                                <asp:TemplateField HeaderStyle-BorderStyle="Solid" HeaderStyle-BorderWidth="1px"
                                                    HeaderStyle-BorderColor="#FFFFFF" ItemStyle-BorderStyle="Solid" ItemStyle-BorderColor="#FFFFFF"
                                                    ItemStyle-BorderWidth="1px" HeaderText="Leave Application ID" Visible="false">
                                                    <ItemTemplate>
                                                        <asp:Label ID="AppDate" Text='<%# Eval("LeaveApplication_Id") %>' runat="server"></asp:Label>
                                                    </ItemTemplate>
                                                </asp:TemplateField>
                                                <asp:TemplateField HeaderStyle-BorderStyle="Solid" HeaderStyle-BorderWidth="1px"
                                                    HeaderStyle-BorderColor="#FFFFFF" ItemStyle-BorderStyle="Solid" ItemStyle-BorderColor="#FFFFFF"
                                                    ItemStyle-BorderWidth="1px" HeaderText="Application Date" SortExpression="Leave_ApplicationDate">
                                                    <ItemTemplate>
                                                        <a href="TA_UI_Transactions_MultipleLeaveApplicationModifyAdmin.aspx?leaveApplicationId=<%# Eval("LeaveApplication_Id") %>">
                                                            <asp:Label ID="AppDate1" Text='<%# Eval("Leave_ApplicationDate") %>' runat="server"></asp:Label>
                                                    </ItemTemplate>
                                                </asp:TemplateField>
                                                <asp:TemplateField HeaderStyle-BorderStyle="Solid" HeaderStyle-BorderWidth="1px"
                                                    HeaderStyle-BorderColor="#FFFFFF" ItemStyle-BorderStyle="Solid" ItemStyle-BorderColor="#FFFFFF"
                                                    ItemStyle-BorderWidth="1px" HeaderText="Employee Name" SortExpression="Employee_FirstName">
                                                    <EditItemTemplate>
                                                        <asp:TextBox onpaste="return true"     ID="TextBox1" runat="server" Text='<%# Bind("Employee_FirstName") %>'></asp:TextBox>
                                                    </EditItemTemplate>
                                                    <ItemTemplate>
                                                        <asp:Label ID="Label1" runat="server" Text='<%# Bind("Employee_FirstName") %>'></asp:Label>
                                                    </ItemTemplate>
                                                </asp:TemplateField>
                                                <asp:TemplateField HeaderStyle-BorderStyle="Solid" HeaderStyle-BorderWidth="1px"
                                                    HeaderStyle-BorderColor="#FFFFFF" ItemStyle-BorderStyle="Solid" ItemStyle-BorderColor="#FFFFFF"
                                                    ItemStyle-BorderWidth="1px" HeaderText="Level Name" SortExpression="name">
                                                    <EditItemTemplate>
                                                        <asp:TextBox onpaste="return true"     ID="TextBox2" runat="server" Text='<%# Bind("name") %>'></asp:TextBox>
                                                    </EditItemTemplate>
                                                    <ItemTemplate>
                                                        <asp:Label ID="Label2" runat="server" Text='<%# Bind("name") %>'></asp:Label>
                                                    </ItemTemplate>
                                                </asp:TemplateField>
                                                <asp:TemplateField HeaderStyle-BorderStyle="Solid" HeaderStyle-BorderWidth="1px"
                                                    HeaderStyle-BorderColor="#FFFFFF" ItemStyle-BorderStyle="Solid" ItemStyle-BorderColor="#FFFFFF"
                                                    ItemStyle-BorderWidth="1px" HeaderText="Duration" SortExpression="Duration" ControlStyle-Width="150px">
                                                    <ItemTemplate>
                                                        <asp:Label ID="lbl_Duration" Text='<%# Eval("Duration") %>' runat="server"></asp:Label>
                                                    </ItemTemplate>
                                                </asp:TemplateField>
                                                <asp:TemplateField HeaderStyle-BorderStyle="Solid" HeaderStyle-BorderWidth="1px"
                                                    HeaderStyle-BorderColor="#FFFFFF" ItemStyle-BorderStyle="Solid" ItemStyle-BorderColor="#FFFFFF"
                                                    ItemStyle-BorderWidth="1px" HeaderText="Total Days" SortExpression="Duration"
                                                    ControlStyle-Width="70px">
                                                    <ItemTemplate>
                                                        <asp:Label ID="lbl_TotDays" Text='<%# Eval("numberofdays") %>' runat="server"></asp:Label>
                                                    </ItemTemplate>
                                                </asp:TemplateField>
                                                <asp:TemplateField HeaderStyle-BorderStyle="Solid" HeaderStyle-BorderWidth="1px"
                                                    HeaderStyle-BorderColor="#FFFFFF" ItemStyle-BorderStyle="Solid" ItemStyle-BorderColor="#FFFFFF"
                                                    ItemStyle-BorderWidth="1px" HeaderText="Type Of Leave" SortExpression="LeaveType"
                                                    Visible="False">
                                                    <ItemTemplate>
                                                        <asp:Label ID="lbl_LeaveType" Text='<%# Eval("LeaveType") %>' runat="server"></asp:Label>
                                                    </ItemTemplate>
                                                </asp:TemplateField>
                                                <asp:TemplateField HeaderStyle-BorderStyle="Solid" HeaderStyle-BorderWidth="1px"
                                                    HeaderStyle-BorderColor="#FFFFFF" ItemStyle-BorderStyle="Solid" ItemStyle-BorderColor="#FFFFFF"
                                                    ItemStyle-BorderWidth="1px" HeaderText="Status" SortExpression="Status">
                                                    <ItemTemplate>
                                                        <asp:Label ID="lbl_Status" Text='<%# Eval("Status") %>' runat="server"></asp:Label>
                                                    </ItemTemplate>
                                                    <ItemStyle Width="100px" />
                                                </asp:TemplateField>
                                                <asp:TemplateField HeaderStyle-BorderStyle="Solid" HeaderStyle-BorderWidth="1px"
                                                    HeaderStyle-BorderColor="#FFFFFF" ItemStyle-BorderStyle="Solid" ItemStyle-BorderColor="#FFFFFF"
                                                    ItemStyle-BorderWidth="1px" HeaderText="Reason" SortExpression="Reason" ControlStyle-Width="200px">
                                                    <ItemTemplate>
                                                        <asp:Label ID="lbl_Reason" Text='<%# Eval("Reason") %>' runat="server"></asp:Label>
                                                    </ItemTemplate>
                                                    <ItemStyle HorizontalAlign="Left" />
                                                </asp:TemplateField>
                                                <asp:TemplateField HeaderStyle-BorderStyle="Solid" HeaderStyle-BorderWidth="1px"
                                                    HeaderStyle-BorderColor="#FFFFFF" ItemStyle-BorderStyle="Solid" ItemStyle-BorderColor="#FFFFFF"
                                                    ItemStyle-BorderWidth="1px" HeaderText="Remarks" SortExpression="Remarks" Visible="False">
                                                    <ItemTemplate>
                                                        <asp:Label ID="lbl_Remarks" Text='<%# Eval("Remarks") %>' runat="server"></asp:Label>
                                                    </ItemTemplate>
                                                    <ItemStyle HorizontalAlign="Left" />
                                                </asp:TemplateField>
                                            </Columns>
                                            <EmptyDataTemplate>
                                                No Records Found
                                            </EmptyDataTemplate>
                                            <RowStyle Height="30px" />
                                            <PagerStyle VerticalAlign="Bottom" HorizontalAlign="Right" Font-Overline="False"
                                                Font-Size="Smaller" />
                                            <PagerSettings Mode="NumericFirstLast" FirstPageText="First" LastPageText="Last"
                                                NextPageText="Next" PreviousPageText="&lt;" />
                                        </asp:GridView>
                                        &nbsp;
                                    </td>
                                </tr>
                                <tr>
                                    <td valign="middle" align="center" style="height: 29px;display:none;">
                                        &nbsp;<asp:Button ID="btn_Add" CssClass="but" runat="server" OnClick="btn_Add_Click" />
                                        <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" SelectMethod="SelectLeaveApplicationDetails"
                                            TypeName="LeaveApplicationEventData">
                                            <SelectParameters>
                                                <asp:SessionParameter Name="Employee_Id" SessionField="EmpAutoId" Type="Int32" />
                                                <asp:SessionParameter Name="GradeLevel" SessionField="GradeLevel" Type="String" />
                                                <asp:SessionParameter Name="LevelRights" SessionField="LevelRights" Type="String" />
                                                <asp:ControlParameter ControlID="txtLeaveStartDate" DefaultValue="01/01/1900" Type="DateTime"
                                                    Name="LeaveStartDate" />
                                                <asp:ControlParameter ControlID="txtLeaveEndDate" DefaultValue="01/01/1900" Type="DateTime"
                                                    Name="LeaveEndDate" />
                                            </SelectParameters>
                                        </asp:ObjectDataSource>
                                        <asp:ObjectDataSource ID="ObjectDataSource2" runat="server" SelectMethod="SelectLeaveApplicationDetailsSuperAdmin"
                                            TypeName="LeaveApplicationEventData">
                                            <SelectParameters>
                                                <asp:SessionParameter Name="LevelRights" SessionField="LevelRights" Type="String" />
                                                <asp:ControlParameter ControlID="txt_EmpName" Type="string" Name="EmpFirstName" PropertyName="Text" />
                                                <asp:ControlParameter ControlID="txtEmployeeId" Type="string" Name="EmpCodeId" PropertyName="Text" />
                                                <asp:ControlParameter ControlID="txtLeaveStartDate" DefaultValue="01/01/1900" Type="DateTime"
                                                    Name="LeaveStartDate" />
                                                <asp:ControlParameter ControlID="txtLeaveEndDate" DefaultValue="01/01/1900" Type="DateTime"
                                                    Name="LeaveEndDate" />
                                                <asp:ControlParameter ControlID="txtSwipeCard" Type="string" Name="strSwipeCard"
                                                    PropertyName="Text" />
                                            </SelectParameters>
                                        </asp:ObjectDataSource>
                                    </td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                </table>
            </td>
            <td background="../Images/line1<%=Session["Direction"] %>.gif">
            </td>
        </tr>
        <tr>
            <td valign="bottom">
                <img src="../Images/corner3<%=Session["Direction"] %>.gif" width="15" height="15" /></td>
            <td valign="bottom" background="../Images/sideline1.gif" bgcolor="#eaeaea">
                <img src="../Images/spacer.gif" width="1" height="1" /></td>
            <td valign="bottom">
                <img src="../Images/corner4<%=Session["Direction"] %>.gif" width="15" height="15" /></td>
        </tr>
    </table>
</asp:Content>

