<%@ page language="C#" masterpagefile="~/System Settings/SystemSettings.master" autoeventwireup="true" inherits="System_Settings_ExportDataForORCL, App_Web_51vefqsl" title="Untitled Page" %>

<asp:Content ID="Content1" ContentPlaceHolderID="Cp_System" runat="Server">

    <script language="javascript" type="text/javascript">
    var SelectanyoneOptiontomove ="Select any one Option to move";
    var SelectCompany = "Select Company";
    var SelectDuration = "Select Duration";
    var SureToExportData = "Are you sure to Export Data?";
    function SetAlertMessages(selectanyoneOptiontomove,selectCompany,selectDuration,sureToExportData)
    {
        SelectanyoneOptiontomove = selectanyoneOptiontomove;
        SelectCompany = selectCompany;
        SelectDuration = selectDuration;
        SureToExportData = sureToExportData;
    }    
    function IsCompanyAndDurationSelected()
    {
        if(document.getElementById('<%=ddlCompany.ClientID%>').selectedIndex==0)
        {
            document.getElementById('<%=ddlCompany.ClientID%>').focus();
            alert(SelectCompany);
            return false;
        }
        else if(document.getElementById('<%=ddlDuration.ClientID%>').selectedIndex==0)
        {
            document.getElementById('<%=ddlDuration.ClientID%>').focus();
            alert(SelectDuration);
            return false;
        }
        else
        {
            return confirm(SureToExportData);
        }
    }
    function OpenCustomLabelWindow()
    {
        var SelectedOption;
        SelectedOption = document.getElementById("ctl00_BodyContentPH_hdnSelectedOption").value;
        var SelectedData;
        SelectedData = document.getElementById("ctl00_BodyContentPH_hdnSelectedDataType").value;
        window.open('ExportData_FieldNameForORCL.aspx?Option=' + SelectedOption +'&DailyOrSummarizedData='+ SelectedData +'','','left=250px, top=245px, width=500px, height=480px, scrollbars=no, status=no, resizable=no');
        return false;
    }    
    function OpenFTPConfigurationWindow()
    {
        window.open('ExportData_FTPConfigurationForORCL.aspx','','left=250px, top=245px, width=520px, height=250px, scrollbars=no, status=no, resizable=no');
        return false;
    }
    function moveUpList() 
    {
        var listField = document.getElementById('ctl00_BodyContentPH_lst_PayrollSelectedFieldList');    
        if ( listField.length == -1) 
        {  
            alert("There are no values which can be moved!");
            return false;
        } 
        else 
        {
            var selected = listField.selectedIndex;
            if (selected == -1) 
            {
                alert("You must select an entry to be moved!");
                return false;
            } 
            else 
            {  
                if ( listField.length == 0 ) 
                {  
                    alert("There is only one entry!\nThe one entry will remain in place.");
                    return false;
                }
                else 
                {  
                    if ( selected == 0 ) 
                    {
                        alert("The first entry in the list cannot be moved up.");
                        return false;
                    } 
                    else 
                    {
                        // Get the text/value of the one directly above the hightlighted entry as
                        // well as the highlighted entry; then flip them
                        var moveText1 = listField[selected-1].text;
                        var moveText2 = listField[selected].text;
                        var moveValue1 = listField[selected-1].value;
                        var moveValue2 = listField[selected].value;
                        listField[selected].text = moveText1;
                        listField[selected].value = moveValue1;
                        listField[selected-1].text = moveText2;
                        listField[selected-1].value = moveValue2;
                        listField.selectedIndex = selected-1; // Select the one that was selected before
                        FillHiddenField();
                       return false;
                    }  // Ends the check for selecting one which can be moved
                }  // Ends the check for there only being one in the list to begin with
            }  // Ends the check for there being something selected
        }  // Ends the check for there being none in the list
    }
    function moveDownList() 
    {
        var listField = document.getElementById('ctl00_BodyContentPH_lst_PayrollSelectedFieldList');
        if ( listField.length == -1) 
        {  // If the list is empty
            alert("There are no values which can be moved!");
            return false;
        } 
        else 
        {
            var selected = listField.selectedIndex;
            if (selected == -1) 
            {
                alert("You must select an entry to be moved!");
                return false;
            } 
            else 
            {  // Something is selected
                if ( listField.length == 0 ) 
                {  // If there's only one in the list
                    alert("There is only one entry!\nThe one entry will remain in place.");
                    return false;
                } 
                else 
                {  
                    // There's more than one in the list, rearrange the list order
                    if ( selected == listField.length-1 ) 
                    {
                        alert("The last entry in the list cannot be moved down.");
                        return false;
                    } 
                    else 
                    {
                        // Get the text/value of the one directly below the hightlighted entry as
                        // well as the highlighted entry; then flip them
                        var moveText1 = listField[selected+1].text;
                        var moveText2 = listField[selected].text;
                        var moveValue1 = listField[selected+1].value;
                        var moveValue2 = listField[selected].value;
                        listField[selected].text = moveText1;
                        listField[selected].value = moveValue1;
                        listField[selected+1].text = moveText2;
                        listField[selected+1].value = moveValue2;
                        listField.selectedIndex = selected+1; // Select the one that was selected before
                        FillHiddenField();
                        return false ;
                    }  // Ends the check for selecting one which can be moved
                }  // Ends the check for there only being one in the list to begin with
            }  // Ends the check for there being something selected
        }  // Ends the check for there being none in the list
    }
    </script>

    <table border="0" cellspacing="0" cellpadding="0" width="600">
        <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">
                &nbsp;</td>
            <td valign="top" bgcolor="#EAEAEA">
                <table border="0" align="center" cellpadding="3" cellspacing="1" width="600">
                </table>
                <table border="0" align="center" cellpadding="3" cellspacing="2" width="600">
                    <tr>
                        <td valign="top" colspan="4" class="ModuleTitle">
                            <asp:Label ID="lblHeader_ExportData" runat="server"></asp:Label></td>
                    </tr>
                    <tr>
                        <td bgcolor="#ff0066" class="td" colspan="4" valign="top">
                            <span style="color: #ff0033">*</span>
                            <asp:Label ID="lbl_IndicatesMandatoryFields" runat="server" ForeColor="Red"></asp:Label></td>
                    </tr>
                    <tr style="display: none">
                        <td class="td" colspan="4">
                            &nbsp;
                            <asp:Label ID="lbl_Error" runat="server" ForeColor="Red"></asp:Label></td>
                    </tr>
                    <tr>
                        <td class="td" valign="top">
                            <asp:Label ID="lblCompany" runat="server"></asp:Label>
                            <span style="color: red">*</span>
                        </td>
                        <td class="td" valign="top" colspan="3">
                            <asp:DropDownList ID="ddlCompany" runat="server" AppendDataBoundItems="true" CssClass="dlist"
                                OnSelectedIndexChanged="ddlCompany_SelectedIndexChanged" AutoPostBack="true">
                                <asp:ListItem Value="-Select-" Text="-Select-"></asp:ListItem>
                            </asp:DropDownList><asp:RequiredFieldValidator Visible="false" ID="RequiredFieldValidator2"
                                runat="server" ErrorMessage="Select Company" ControlToValidate="ddlCompany" InitialValue="-Select-"
                                SetFocusOnError="True">*</asp:RequiredFieldValidator>
                        </td>
                    </tr>
                    <tr>
                        <td class="td">
                            <asp:Label ID="lblDuration" runat="server" Text="Duration"></asp:Label>
                            <span style="color: red">*</span>
                        </td>
                        <td class="td" colspan="3">
                            <asp:DropDownList ID="ddlDuration" runat="server" CssClass="textbox_4">
                                <asp:ListItem Value="-Select-" Text="-Select-"></asp:ListItem>
                            </asp:DropDownList>
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator8" Visible="false" runat="server"
                                ControlToValidate="ddlDuration" InitialValue="-Select-" SetFocusOnError="True"
                                ErrorMessage="Select Duration">*</asp:RequiredFieldValidator>
                        </td>
                    </tr>
                    <tr>
                        <td class="td" style="width: 38%">
                            <asp:Label ID="lblOption" Text="Option" runat="server"></asp:Label>
                        </td>
                        <td class="td" colspan="3">
                            <asp:RadioButtonList CssClass="td" ID="rbOption" runat="server" AutoPostBack="True"
                                RepeatDirection="Horizontal" OnSelectedIndexChanged="rbOption_SelectedIndexChanged">
                                <asp:ListItem Selected="True" Text="All" Value="All"></asp:ListItem>
                                <asp:ListItem Value="OT" Text="OT Data"></asp:ListItem>
                                <asp:ListItem Value="Attendance" Text="Attendance Data"></asp:ListItem>
                                <asp:ListItem Value="Leave" Text="Leave"></asp:ListItem>
                            </asp:RadioButtonList>
                            <asp:HiddenField ID="hdnSelectedOption" runat="server" />
                        </td>
                    </tr>
                    <tr>
                        <td class="td" style="width: 38%">
                            <asp:Label ID="lblDataType" Text="Data Type" runat="server"></asp:Label>
                        </td>
                        <td class="td" colspan="3">
                            <asp:RadioButtonList CssClass="td" ID="rblMonthDateWise" runat="server" AutoPostBack="True"
                                RepeatDirection="Horizontal" OnSelectedIndexChanged="rblMonthDateWise_SelectedIndexChanged">
                                <asp:ListItem Selected="True" Text="Summarized Data" Value="SummarizedData"></asp:ListItem>
                                <asp:ListItem Value="DailyData" Text="Daily Data"></asp:ListItem>
                            </asp:RadioButtonList>
                            <asp:HiddenField ID="hdnSelectedDataType" runat="server" />
                        </td>
                    </tr>
                    <tr>
                        <td class="td" style="width: 38%">
                            <asp:Label ID="lblConfiguration" Text="Configuration" runat="server"></asp:Label>
                        </td>
                        <td class="td" colspan="2">
                            <asp:LinkButton ID="lnkCustomFields" OnClientClick="return OpenCustomLabelWindow();"
                                runat="server" Text="Custom Fields">
                            </asp:LinkButton>
                        </td>
                        <td class="td">
                        </td>
                    </tr>
                    <tr>
                        <td class="td" colspan="4" valign="top">
                            <asp:Label ID="lbl_FieldList" runat="server"></asp:Label>
                            &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;
                            &nbsp; &nbsp;&nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp;&nbsp;
                            &nbsp; &nbsp;&nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
                            &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
                            &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;
                            &nbsp;&nbsp; &nbsp;<asp:Label ID="lbl_SelectedFieldList" runat="server"></asp:Label></td>
                    </tr>
                    <tr>
                        <td class="td" colspan="1" style="width: 40%; height: 158px" valign="top">
                            <asp:ListBox ID="lst_PayrollFieldList" runat="server" Width="80%" Height="100%"></asp:ListBox></td>
                        <td class="td" colspan="2" style="width: 20%; height: 158px" valign="top">
                            &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;
                            <asp:Button ID="btn_RemoveAll" CssClass="but" runat="server" Height="25px" Text="<<"
                                Width="30px" OnClientClick="return FieldListRemoveAll();" /><br />
                            <br />
                            &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;
                            <asp:Button ID="btn_Remove" CssClass="but" runat="server" Height="25px" Text="<"
                                Width="30px" OnClientClick="return FieldListRemove(SelectanyoneOptiontomove);" /><br />
                            <br />
                            &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;
                            <asp:Button ID="btn_Add" CssClass="but" runat="server" Height="25px" Text=">" Width="31px"
                                OnClientClick="return FieldListAdd(SelectanyoneOptiontomove);" /><br />
                            <br />
                            &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;
                            <asp:Button ID="btn_AddAll" CssClass="but" runat="server" Height="25px" Text=">>"
                                Width="31px" OnClientClick="return FieldListAddAll();" /></td>
                        <td class="td" colspan="1" style="width: 40%; height: 158px" valign="top">
                            <asp:ListBox ID="lst_PayrollSelectedFieldList" runat="server" Width="80%" Height="100%">
                            </asp:ListBox></td>
                        <td class="td" colspan="1" style="width: 20%; height: 100px; display: none;" valign="middle">
                            <asp:Button ID="btnMoveUp" CssClass="but" runat="server" Height="25px" Text="^" Width="30px"
                                OnClientClick="return moveUpList();" /><br />
                            <asp:Button ID="btnMoveDown" CssClass="Transform" runat="server" Height="25px" Text="^"
                                Width="30px" OnClientClick="return moveDownList();" /><br />
                        </td>
                    </tr>
                    <tr>
                        <td class="td" colspan="4" style="height: 25px" valign="top" align="center">
                            <input id="hdn_SelectedFieldNames" type="hidden" value="" runat="server" />
                            <asp:RadioButton ID="rbExportToXLS" Checked="true" runat="server" Text="Export to XLS (Max limit is 65536 rows)"
                                GroupName="Filetype" />
                            <asp:RadioButton ID="rbExportToCSV" runat="server" Text="Export to CSV" GroupName="Filetype" />
                            <asp:RadioButton ID="rbExportToXML" runat="server" Text="Export to XML" GroupName="Filetype" />
                        </td>
                    </tr>
                    <tr>
                        <td class="td">
                            <asp:Label ID="lblFTPUpload" runat="server" Text="FTP Upload"></asp:Label>
                        </td>
                        <td colspan="2" class="td" valign="top" style="height: 25px" align="center">
                            <asp:RadioButton ID="rbFTPYes" runat="server" Text="Yes" GroupName="FTP" />
                            <asp:RadioButton ID="rbFTPNo" runat="server" Text="No" Checked="true" GroupName="FTP" />
                        </td>
                        <td class="td">
                            <asp:LinkButton ID="LinkButton1" Text="FTP Configuration" runat="server" OnClientClick="return OpenFTPConfigurationWindow();"></asp:LinkButton>
                        </td>
                    </tr>
                    <tr>
                        <td colspan="4">
                            <table border="0" align="center" cellpadding="5" cellspacing="0">
                                <tr>
                                    <td align="right" valign="middle" style="height: 29px; width: 82px;">
                                        <asp:Button ID="btn_Export" CssClass="but" runat="server" OnClientClick="return IsCompanyAndDurationSelected();"
                                            OnClick="btn_Export_Click" />
                                    </td>
                                </tr>
                            </table>
                            <asp:ValidationSummary ID="ValidationSummary1" runat="server" ShowMessageBox="True"
                                ShowSummary="False" />
                        </td>
                    </tr>
                </table>
            </td>
            <td background="../Images/line1<%=Session["Direction"] %>.gif">
                &nbsp;</td>
        </tr>
        <tr>
            <td valign="bottom">
                <img src="../Images/corner3<%=Session["Direction"] %>.gif" width="15" height="16" /></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="16" /></td>
        </tr>
    </table>
</asp:Content>
