<%@ page language="C#" autoeventwireup="true" inherits="ReportBuilder, App_Web_reportbuilder.aspx.fe996db7" enableeventvalidation="false" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<%@ Register Src="~/UserControls/iERPPrintBar.ascx" TagName="iERPPrintBar" TagPrefix="dsip" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
<head id="Head1" runat="server">
    <title>..:: ICDAS 2.1 ::..</title>
    <meta http-equiv="X-UA-Compatible" content="IE=9" />
   
    <script type="text/javascript" language="javascript" src="../App_Include/JavaScript/js_functions.js"> </script>
    
    <script type="text/javascript" language="javascript" src="../App_Include/JavaScript/ScreenSaverStar.js"> </script>

    <script type="text/javascript" language="javascript">
        function resizeObject() {
            var w = getBrowserWindowSize().width;
            var h = getBrowserWindowSize().height - 5;
            //window.resizeTo(w, h);
            var cObj = document.getElementById("divChildBody");
            if (cObj != null) {
                //cObj.style.height = parseInt((h*79)/100) +"px";
                cObj.style.height = (parseInt(h) - 10) + "px";
                //cObj.style.width = parseInt(w) +"px";
            }

            var cObj = document.getElementById("TabContainerReport");
            if (cObj != null) {
                cObj.style.height = (parseInt(h) - 125) + "px";
            }
            var cObj = document.getElementById("<%#TabBooks.ClientID%>");
            if (cObj != null) {
                cObj.style.height = (parseInt(h) - 150) + "px";
            }

            hideWait();

        }


        function validateRecord() {
            var doc = document.forms[0];

            if (doc.cmbReports.selectedIndex <= 0) {
                alert("Please Select Format One...");
                document.forms[0].cmbReports.focus()
                return false;
            }
            var date1=document.getElementById("<%#txtFromDate.ClientID%>");
            var date2=document.getElementById("<%#txtToDate.ClientID%>");
            
            if (date1 !=null)
            {
                var theDate1=new Date(Date.parse(date1.value));
            }
            else
            {
             return false;
            }
            
            if(date2 !=null)
            {
                var theDate2=new Date(Date.parse(date2.value));
            }           
            else
            {
            return false;
            }
            
            var calDiff=0;
            if (theDate1%4==0 || theDate2%4==0)
            {
            calDiff =366;
            }
            else
            {
            calDiff =365;
            }
            
            var diff=dayDiff(theDate1,theDate2);
            if (parseInt(diff) >calDiff) 
            {
                alert("Invalid Date  Range! Please select date with in range of 1 year.");
                date1.focus();
                return false;
            }
            
            return true;
        }

            function dayDiff(date1,date2)
                {
                    var one_day=1000*60*60*24;

                    var date1_ms=date1.getTime();

                    var date2_ms=date2.getTime();
                    var difference_ms=date2_ms -date1_ms;
                    return Math.round(difference_ms/one_day);
                    }

        function accountdata() {
            return true;
        }

        function checkFAperiod(obj) {
            var lflg = true;
            var FAyearlock = '<%#Session["FAYEARLOCK"]%>';
            var FAyearfrom = '<%#Session["FAYEARFROM"]%>';
            var FAyearto = '<%#Session["FAYEARTO"]%>';
            var InPutDate = obj.value;  //document.forms[0].txtDocumentDate.value;
            var b, e, c;

            b = new Date(FAyearfrom.substr(7, 4) + '  ' + FAyearfrom.substr(3, 3) + '  ' + FAyearfrom.substr(0, 2));
            e = new Date(FAyearto.substr(7, 4) + '  ' + FAyearto.substr(3, 3) + '  ' + FAyearto.substr(0, 2));
            c = new Date(InPutDate.substr(7, 4) + '  ' + InPutDate.substr(3, 3) + '  ' + InPutDate.substr(0, 2));
            if ((c <= e && c >= b)) {
                if (FAyearlock == 1) {
                    alert("Year Locked...");
                    return false;
                }
            }
            else {
                alert("Invalid Date, Date Should Be Between Financial Year...");
                return false;
            }

            return lflg;
        }
        function unloadpage() {
            var cObj = document.getElementById("btnUnload");
            if (cObj != null) {
                cObj.click();
            }
        }
        
    </script>
    
      <script type="text/javascript">
                function checkDate(sender, args) {
            if (sender._selectedDate > new Date()) {
                alert("You cannot select a Future date than today!");
                sender._selectedDate = new Date();
                // set the date back to the current date
                sender._textbox.set_Value(sender._selectedDate.format(sender._format))
                        }

        }
    </script>

</head>
<body bottommargin="0" leftmargin="0" topmargin="0" rightmargin="0" onload="resizeObject(); resizeHolder(); init(); initScreenSaver('1',<%=Session["AutoLogOutTime"]%>);"
    onunload="unloadpage();">
    <form id="Form1" runat="server" class="formbg" target="_blank">
    <asp:ToolkitScriptManager runat="Server" EnablePartialRendering="true" AsyncPostBackTimeout="0"
        ID="ToolkitScriptManager1" />
    <table width="100%" border="0" cellspacing="0" cellpadding="0" align="left" class="formbg">
        <tr>
            <td valign="top" align="left">
                <div id="divMainBody" align="center" runat="server" width="100%" height="100%">
                    <div id="divHeader" runat="server" style="border-style: none; height: 26px; width: 100%;
                        position: absolute; left: 1px; top: 8px;" align="center">
                        <dsip:iERPPrintBar ID="iERPPrintBar1" runat="server" Caption="Report Builder" PageAccess="11111" />
                    </div>
                    <asp:UpdatePanel ID="uplChildBody" runat="server" UpdateMode="Always">
                        <ContentTemplate>
                            <asp:HiddenField ID="hdnRecordKeyId" runat="server" Value="0" />
                            <asp:HiddenField ID="hdnRecordIds" runat="server" Value="" />
                            <asp:HiddenField ID="hdnUserId" runat="server" Value="" />
                            <asp:HiddenField ID="hdnBusinessUnitId" runat="server" Value="" />
                            <asp:HiddenField ID="hdnBranchId" runat="server" Value="" />
                            <asp:HiddenField ID="hdnFixedCode" runat="server" Value="0" />
                            <asp:HiddenField ID="hdnIsLocked" runat="server" Value="0" />
                            <asp:HiddenField ID="hdnRecordKey" runat="server" Value="0" />
                            <asp:HiddenField ID="hdnReportFrom" runat="server" Value="" />
                            <asp:HiddenField ID="hdnReportCode" runat="server" Value="" />
                            <asp:HiddenField ID="hdnReportQuery" runat="server" Value="" />
                            <asp:HiddenField ID="hdnReportPara" runat="server" Value="" />
                            <asp:HiddenField ID="hdnBusinessUnitIds" runat="server" Value="" />
                            <asp:HiddenField ID="hdnBranchIds" runat="server" Value="" />
                            <asp:HiddenField ID="hdnBookIds" runat="server" Value="" />
                            <asp:HiddenField ID="hdnBusinessUnitName" runat="server" Value="" />
                            <asp:HiddenField ID="hdnBranchName" runat="server" Value="" />
                            <asp:HiddenField ID="hdnBookName" runat="server" Value="" />
                            <asp:HiddenField ID="hdnReportAddonFields" runat="server" Value="" />
                            <asp:HiddenField ID="hdnReportFields" runat="server" Value="" />
                            <asp:HiddenField ID="hdnVoucherModeIds" runat="server" Value="" />
                            <asp:HiddenField ID="hdnVoucherReferenceIds" runat="server" Value="" />
                            <asp:HiddenField ID="hdnDocumentNo" runat="server" Value="" />
                            <asp:HiddenField ID="hdnRefNo" runat="server" Value="" />
                            <asp:HiddenField ID="hdnVoucherNo" runat="server" Value="" />
                            <asp:HiddenField ID="hdnVoucherStatus" runat="server" Value="-1" />
                            <div id="divChildBody" runat="server" style="overflow: auto; width: 99%;">
                                <table width="100%" align="left" cellpadding="1" cellspacing="0" class="tablefont">
                                    <tr height="62px">
                                        <td colspan="5">
                                            &nbsp;
                                        </td>
                                    </tr>
                                    <tr align="left">
                                        <td width="10%" valign="top">
                                            &nbsp;Formats
                                        </td>
                                        <td width="90%" colspan="3">
                                            <asp:DropDownList ID="cmbReports" runat="server" Width="94%" AutoPostBack="true"
                                                OnSelectedIndexChanged="cmbReports_SelectedIndexChanged">
                                            </asp:DropDownList>
                                            <asp:Button ID="btnUnload" runat="server" OnClick="btnUnload_Click" Style="display: none;" />
                                        </td>
                                    </tr>
                                    <tr align="left">
                                        <td width="10%" valign="top">
                                            &nbsp;Report
                                        </td>
                                        <td width="40%">
                                            Size :
                                            <asp:Label ID="lblReportSize" runat="server" Text="" CssClass="blink-text" Width="30%"></asp:Label>
                                            &nbsp;
                                        </td>
                                        <td width="40%" colspan="2">
                                            Orientation :
                                            <asp:Label ID="lblReportOrientation" runat="server" Text="" CssClass="blink-text"
                                                Width="30%"></asp:Label>
                                        </td>
                                    </tr>
                                    <tr align="left" style="display: none;">
                                        <td width="10%">
                                            &nbsp;Print Output
                                        </td>
                                        <td width="40%">
                                            <asp:RadioButton ID="rbtPDF" runat="server" GroupName="PrintOutput" Text="Adobe(PDF)"
                                                Checked="True" />
                                            <asp:RadioButton ID="rbtRPT" runat="server" GroupName="PrintOutput" Text="Crystal(RPT)" />
                                            <asp:RadioButton ID="rbtXLS" runat="server" GroupName="PrintOutput" Text="Excel(XLS)" />
                                            <asp:RadioButton ID="rbtDOC" runat="server" GroupName="PrintOutput" Text="Word(DOC)" />
                                        </td>
                                        <td width="40%" colspan="2">
                                            <asp:CheckBox ID="chkRepeatHeader" runat="server" Text="Repeat Header On Each Page"
                                                Checked="true" Visible="false"></asp:CheckBox>
                                        </td>
                                    </tr>
                                    <tr align="left">
                                        <td colspan="4" align="left">
                                            <div id="divReportOption" runat="server" style="overflow: auto; width: 100%;">
                                                <table width="100%" align="left" cellpadding="1" cellspacing="1">
                                                    <tr>
                                                        <td>
                                                            <asp:TabContainer ID="TabContainerReport" runat="server" ActiveTabIndex="0" Width="100%"
                                                                ScrollBars="Auto" CssClass="tabCont">
                                                                <asp:TabPanel ID="TabBooks" runat="server" TabIndex="0">
                                                                    <HeaderTemplate>
                                                                        Report Filters
                                                                    </HeaderTemplate>
                                                                    <ContentTemplate>
                                                                        <table class="tablefont" cellspacing="0" cellpadding="0" width="100%" align="left"
                                                                            border="0">
                                                                            <tr height="5px">
                                                                                <td colspan="5">
                                                                                    &nbsp;
                                                                                </td>
                                                                            </tr>
                                                                            <tr>
                                                                                <td width="10%" align="left">
                                                                                    From Date
                                                                                </td>
                                                                                <td width="40%" align="left">
                                                                                    <asp:TextBox ID="txtFromDate" runat="server" CssClass="dateInput" MaxLength="20"
                                                                                        onBlur="GetDateField(this);" onFocus="SetDateField(this);" ToolTip="Format : [ddmmyyyy], [d] or [dd], [ddm] or [ddmm], [ ]"
                                                                                        Width="25%"></asp:TextBox>
                                                                                    <img id="imgCal1" style="cursor: pointer;" runat="server" alt="Click to Show Calendar"
                                                                                        align="middle" src="../Images/date.gif" />
                                                                                    <asp:CalendarExtender ID="cal1" runat="server" PopupButtonID="imgCal1" TargetControlID="txtFromDate"
                                                                                        Format="dd-MMM-yyyy" CssClass="zcCalendar" Enabled="True">
                                                                                    </asp:CalendarExtender>
                                                                                </td>
                                                                                <td width="0%" align="left">
                                                                                </td>
                                                                                <td width="10%" align="left">
                                                                                    To Date
                                                                                </td>
                                                                                <td width="40%" align="left">
                                                                                    <asp:TextBox ID="txtToDate" runat="server" CssClass="dateInput" MaxLength="20" onBlur="GetDateField(this);"
                                                                                        onFocus="SetDateField(this);" ToolTip="Format : [ddmmyyyy], [d] or [dd], [ddm] or [ddmm], [ ]"
                                                                                        Width="25%"></asp:TextBox>
                                                                                    <img id="imgCal2" style="cursor: pointer;" runat="server" alt="Click to Show Calendar"
                                                                                        align="middle" src="../Images/date.gif" />
                                                                                    <asp:CalendarExtender ID="cal2" runat="server" PopupButtonID="imgCal2" TargetControlID="txtToDate"
                                                                                        Format="dd-MMM-yyyy" CssClass="zcCalendar" Enabled="True" OnClientDateSelectionChanged="checkDate">
                                                                                    </asp:CalendarExtender>
                                                                                </td>
                                                                            </tr>
                                                                            <tr>
                                                                                <td colspan="5" height="5px">
                                                                                </td>
                                                                            </tr>
                                                                            <tr>
                                                                                <td width="10%" align="left">
                                                                                    From Time
                                                                                </td>
                                                                                <td width="40%" align="left">
                                                                                    <asp:DropDownList ID="cmbFromHours" runat="server">
                                                                                        <asp:ListItem Value="00" Selected="True">00</asp:ListItem>
                                                                                        <asp:ListItem Value="01">01</asp:ListItem>
                                                                                        <asp:ListItem Value="02">02</asp:ListItem>
                                                                                        <asp:ListItem Value="03">03</asp:ListItem>
                                                                                        <asp:ListItem Value="04">04</asp:ListItem>
                                                                                        <asp:ListItem Value="05">05</asp:ListItem>
                                                                                        <asp:ListItem Value="06">06</asp:ListItem>
                                                                                        <asp:ListItem Value="07">07</asp:ListItem>
                                                                                        <asp:ListItem Value="08">08</asp:ListItem>
                                                                                        <asp:ListItem Value="09">09</asp:ListItem>
                                                                                        <asp:ListItem Value="10">10</asp:ListItem>
                                                                                        <asp:ListItem Value="11">11</asp:ListItem>
                                                                                        <asp:ListItem Value="12">12</asp:ListItem>
                                                                                        <asp:ListItem Value="13">13</asp:ListItem>
                                                                                        <asp:ListItem Value="14">14</asp:ListItem>
                                                                                        <asp:ListItem Value="15">15</asp:ListItem>
                                                                                        <asp:ListItem Value="16">16</asp:ListItem>
                                                                                        <asp:ListItem Value="17">17</asp:ListItem>
                                                                                        <asp:ListItem Value="18">18</asp:ListItem>
                                                                                        <asp:ListItem Value="19">19</asp:ListItem>
                                                                                        <asp:ListItem Value="20">20</asp:ListItem>
                                                                                        <asp:ListItem Value="21">21</asp:ListItem>
                                                                                        <asp:ListItem Value="22">22</asp:ListItem>
                                                                                        <asp:ListItem Value="23">23</asp:ListItem>
                                                                                    </asp:DropDownList>
                                                                                    :
                                                                                    <asp:DropDownList ID="cmbFromMins" runat="server">
                                                                                        <asp:ListItem Value="00" Selected="True">00</asp:ListItem>
                                                                                        <asp:ListItem Value="01">01</asp:ListItem>
                                                                                        <asp:ListItem Value="02">02</asp:ListItem>
                                                                                        <asp:ListItem Value="03">03</asp:ListItem>
                                                                                        <asp:ListItem Value="04">04</asp:ListItem>
                                                                                        <asp:ListItem Value="05">05</asp:ListItem>
                                                                                        <asp:ListItem Value="06">06</asp:ListItem>
                                                                                        <asp:ListItem Value="07">07</asp:ListItem>
                                                                                        <asp:ListItem Value="08">08</asp:ListItem>
                                                                                        <asp:ListItem Value="09">09</asp:ListItem>
                                                                                        <asp:ListItem Value="10">10</asp:ListItem>
                                                                                        <asp:ListItem Value="11">11</asp:ListItem>
                                                                                        <asp:ListItem Value="12">12</asp:ListItem>
                                                                                        <asp:ListItem Value="13">13</asp:ListItem>
                                                                                        <asp:ListItem Value="14">14</asp:ListItem>
                                                                                        <asp:ListItem Value="15">15</asp:ListItem>
                                                                                        <asp:ListItem Value="16">16</asp:ListItem>
                                                                                        <asp:ListItem Value="17">17</asp:ListItem>
                                                                                        <asp:ListItem Value="18">18</asp:ListItem>
                                                                                        <asp:ListItem Value="19">19</asp:ListItem>
                                                                                        <asp:ListItem Value="20">20</asp:ListItem>
                                                                                        <asp:ListItem Value="21">21</asp:ListItem>
                                                                                        <asp:ListItem Value="22">22</asp:ListItem>
                                                                                        <asp:ListItem Value="23">23</asp:ListItem>
                                                                                        <asp:ListItem Value="24">24</asp:ListItem>
                                                                                        <asp:ListItem Value="25">25</asp:ListItem>
                                                                                        <asp:ListItem Value="26">26</asp:ListItem>
                                                                                        <asp:ListItem Value="27">27</asp:ListItem>
                                                                                        <asp:ListItem Value="28">28</asp:ListItem>
                                                                                        <asp:ListItem Value="29">29</asp:ListItem>
                                                                                        <asp:ListItem Value="30">30</asp:ListItem>
                                                                                        <asp:ListItem Value="31">31</asp:ListItem>
                                                                                        <asp:ListItem Value="32">32</asp:ListItem>
                                                                                        <asp:ListItem Value="33">33</asp:ListItem>
                                                                                        <asp:ListItem Value="34">34</asp:ListItem>
                                                                                        <asp:ListItem Value="35">35</asp:ListItem>
                                                                                        <asp:ListItem Value="36">36</asp:ListItem>
                                                                                        <asp:ListItem Value="37">37</asp:ListItem>
                                                                                        <asp:ListItem Value="38">38</asp:ListItem>
                                                                                        <asp:ListItem Value="39">39</asp:ListItem>
                                                                                        <asp:ListItem Value="40">40</asp:ListItem>
                                                                                        <asp:ListItem Value="41">41</asp:ListItem>
                                                                                        <asp:ListItem Value="42">42</asp:ListItem>
                                                                                        <asp:ListItem Value="43">43</asp:ListItem>
                                                                                        <asp:ListItem Value="44">44</asp:ListItem>
                                                                                        <asp:ListItem Value="45">45</asp:ListItem>
                                                                                        <asp:ListItem Value="46">46</asp:ListItem>
                                                                                        <asp:ListItem Value="47">47</asp:ListItem>
                                                                                        <asp:ListItem Value="48">48</asp:ListItem>
                                                                                        <asp:ListItem Value="49">49</asp:ListItem>
                                                                                        <asp:ListItem Value="50">50</asp:ListItem>
                                                                                        <asp:ListItem Value="51">51</asp:ListItem>
                                                                                        <asp:ListItem Value="52">52</asp:ListItem>
                                                                                        <asp:ListItem Value="53">53</asp:ListItem>
                                                                                        <asp:ListItem Value="54">54</asp:ListItem>
                                                                                        <asp:ListItem Value="55">55</asp:ListItem>
                                                                                        <asp:ListItem Value="56">56</asp:ListItem>
                                                                                        <asp:ListItem Value="57">57</asp:ListItem>
                                                                                        <asp:ListItem Value="58">58</asp:ListItem>
                                                                                        <asp:ListItem Value="59">59</asp:ListItem>
                                                                                    </asp:DropDownList>
                                                                                </td>
                                                                                <td width="0%" align="left">
                                                                                </td>
                                                                                <td width="10%" align="left">
                                                                                    To Time
                                                                                </td>
                                                                                <td width="40%" align="left">
                                                                                    <asp:DropDownList ID="cmbToHours" runat="server">
                                                                                        <asp:ListItem Value="00">00</asp:ListItem>
                                                                                        <asp:ListItem Value="01">01</asp:ListItem>
                                                                                        <asp:ListItem Value="02">02</asp:ListItem>
                                                                                        <asp:ListItem Value="03">03</asp:ListItem>
                                                                                        <asp:ListItem Value="04">04</asp:ListItem>
                                                                                        <asp:ListItem Value="05">05</asp:ListItem>
                                                                                        <asp:ListItem Value="06">06</asp:ListItem>
                                                                                        <asp:ListItem Value="07">07</asp:ListItem>
                                                                                        <asp:ListItem Value="08">08</asp:ListItem>
                                                                                        <asp:ListItem Value="09">09</asp:ListItem>
                                                                                        <asp:ListItem Value="10">10</asp:ListItem>
                                                                                        <asp:ListItem Value="11">11</asp:ListItem>
                                                                                        <asp:ListItem Value="12">12</asp:ListItem>
                                                                                        <asp:ListItem Value="13">13</asp:ListItem>
                                                                                        <asp:ListItem Value="14">14</asp:ListItem>
                                                                                        <asp:ListItem Value="15">15</asp:ListItem>
                                                                                        <asp:ListItem Value="16">16</asp:ListItem>
                                                                                        <asp:ListItem Value="17">17</asp:ListItem>
                                                                                        <asp:ListItem Value="18">18</asp:ListItem>
                                                                                        <asp:ListItem Value="19">19</asp:ListItem>
                                                                                        <asp:ListItem Value="20">20</asp:ListItem>
                                                                                        <asp:ListItem Value="21">21</asp:ListItem>
                                                                                        <asp:ListItem Value="22">22</asp:ListItem>
                                                                                        <asp:ListItem Value="23" Selected="True">23</asp:ListItem>
                                                                                    </asp:DropDownList>
                                                                                    :
                                                                                    <asp:DropDownList ID="cmbToMins" runat="server">
                                                                                        <asp:ListItem Value="00">00</asp:ListItem>
                                                                                        <asp:ListItem Value="01">01</asp:ListItem>
                                                                                        <asp:ListItem Value="02">02</asp:ListItem>
                                                                                        <asp:ListItem Value="03">03</asp:ListItem>
                                                                                        <asp:ListItem Value="04">04</asp:ListItem>
                                                                                        <asp:ListItem Value="05">05</asp:ListItem>
                                                                                        <asp:ListItem Value="06">06</asp:ListItem>
                                                                                        <asp:ListItem Value="07">07</asp:ListItem>
                                                                                        <asp:ListItem Value="08">08</asp:ListItem>
                                                                                        <asp:ListItem Value="09">09</asp:ListItem>
                                                                                        <asp:ListItem Value="10">10</asp:ListItem>
                                                                                        <asp:ListItem Value="11">11</asp:ListItem>
                                                                                        <asp:ListItem Value="12">12</asp:ListItem>
                                                                                        <asp:ListItem Value="13">13</asp:ListItem>
                                                                                        <asp:ListItem Value="14">14</asp:ListItem>
                                                                                        <asp:ListItem Value="15">15</asp:ListItem>
                                                                                        <asp:ListItem Value="16">16</asp:ListItem>
                                                                                        <asp:ListItem Value="17">17</asp:ListItem>
                                                                                        <asp:ListItem Value="18">18</asp:ListItem>
                                                                                        <asp:ListItem Value="19">19</asp:ListItem>
                                                                                        <asp:ListItem Value="20">20</asp:ListItem>
                                                                                        <asp:ListItem Value="21">21</asp:ListItem>
                                                                                        <asp:ListItem Value="22">22</asp:ListItem>
                                                                                        <asp:ListItem Value="23">23</asp:ListItem>
                                                                                        <asp:ListItem Value="24">24</asp:ListItem>
                                                                                        <asp:ListItem Value="25">25</asp:ListItem>
                                                                                        <asp:ListItem Value="26">26</asp:ListItem>
                                                                                        <asp:ListItem Value="27">27</asp:ListItem>
                                                                                        <asp:ListItem Value="28">28</asp:ListItem>
                                                                                        <asp:ListItem Value="29">29</asp:ListItem>
                                                                                        <asp:ListItem Value="30">30</asp:ListItem>
                                                                                        <asp:ListItem Value="31">31</asp:ListItem>
                                                                                        <asp:ListItem Value="32">32</asp:ListItem>
                                                                                        <asp:ListItem Value="33">33</asp:ListItem>
                                                                                        <asp:ListItem Value="34">34</asp:ListItem>
                                                                                        <asp:ListItem Value="35">35</asp:ListItem>
                                                                                        <asp:ListItem Value="36">36</asp:ListItem>
                                                                                        <asp:ListItem Value="37">37</asp:ListItem>
                                                                                        <asp:ListItem Value="38">38</asp:ListItem>
                                                                                        <asp:ListItem Value="39">39</asp:ListItem>
                                                                                        <asp:ListItem Value="40">40</asp:ListItem>
                                                                                        <asp:ListItem Value="41">41</asp:ListItem>
                                                                                        <asp:ListItem Value="42">42</asp:ListItem>
                                                                                        <asp:ListItem Value="43">43</asp:ListItem>
                                                                                        <asp:ListItem Value="44">44</asp:ListItem>
                                                                                        <asp:ListItem Value="45">45</asp:ListItem>
                                                                                        <asp:ListItem Value="46">46</asp:ListItem>
                                                                                        <asp:ListItem Value="47">47</asp:ListItem>
                                                                                        <asp:ListItem Value="48">48</asp:ListItem>
                                                                                        <asp:ListItem Value="49">49</asp:ListItem>
                                                                                        <asp:ListItem Value="50">50</asp:ListItem>
                                                                                        <asp:ListItem Value="51">51</asp:ListItem>
                                                                                        <asp:ListItem Value="52">52</asp:ListItem>
                                                                                        <asp:ListItem Value="53">53</asp:ListItem>
                                                                                        <asp:ListItem Value="54">54</asp:ListItem>
                                                                                        <asp:ListItem Value="55">55</asp:ListItem>
                                                                                        <asp:ListItem Value="56">56</asp:ListItem>
                                                                                        <asp:ListItem Value="57">57</asp:ListItem>
                                                                                        <asp:ListItem Value="58">58</asp:ListItem>
                                                                                        <asp:ListItem Value="59" Selected="True">59</asp:ListItem>
                                                                                    </asp:DropDownList>
                                                                                </td>
                                                                            </tr>
                                                                            <tr>
                                                                                <td colspan="5" height="5px">
                                                                                </td>
                                                                            </tr>
                                                                            <tr>
                                                                                <td width="10%" align="left" valign="top">
                                                                                    <asp:Label ID="lblUser" runat="server" Text="User List"></asp:Label>
                                                                                </td>
                                                                                <td width="40%">
                                                                                    <table class="tablefont" cellspacing="0" cellpadding="0" width="100%" align="left"
                                                                                        border="0">
                                                                                        <tr>
                                                                                            <td valign="top">
                                                                                                <asp:ListBox ID="lstLoginName" runat="server" Width="50%" Height="150px" SelectionMode="Multiple">
                                                                                                </asp:ListBox>
                                                                                            </td>
                                                                                            <td>
                                                                                            </td>
                                                                                        </tr>
                                                                                    </table>
                                                                                </td>
                                                                                <td width="0%" align="left">
                                                                                </td>
                                                                                <td width="50%" align="left" valign="top" colspan="2">
                                                                                    <asp:Panel ID="pnlEquipment" runat="server" Visible="False">
                                                                                        <table class="tablefont" cellspacing="0" cellpadding="0" width="100%" align="left"
                                                                                            border="0">
                                                                                            <tr>
                                                                                                <td width="20%" align="left" valign="top">
                                                                                                    Equipment List
                                                                                                </td>
                                                                                                <td width="80%" align="left" valign="top">
                                                                                                    <asp:ListBox ID="lstEquipmentName" runat="server" Width="50%" Height="150px" SelectionMode="Multiple">
                                                                                                    </asp:ListBox>
                                                                                                </td>
                                                                                                <td>
                                                                                                </td>
                                                                                            </tr>
                                                                                        </table>
                                                                                    </asp:Panel>
                                                                                </td>
                                                                            </tr>
                                                                            <tr>
                                                                                <td colspan="2" height="5px">
                                                                                </td>
                                                                            </tr>
                                                                            <asp:Panel ID="pnlReviewApprove" runat="server" Visible="False">
                                                                                <tr>
                                                                                    <td width="10%" align="left">
                                                                                        Status
                                                                                    </td>
                                                                                    <td width="40%" align="left" colspan="4">
                                                                                        <asp:RadioButtonList ID="rdReviewedApproved" runat="server" CellPadding="3" CellSpacing="0"
                                                                                            RepeatDirection="Horizontal" CssClass="small">
                                                                                            <asp:ListItem Value="R" Selected="True"> Reviewed</asp:ListItem>
                                                                                            <asp:ListItem Value="A"> Approved</asp:ListItem>
                                                                                        </asp:RadioButtonList>
                                                                                    </td>
                                                                                </tr>
                                                                            </asp:Panel>
                                                                            <asp:Panel ID="pnlEmailStatus" runat="server" Visible="False">
                                                                                <tr>
                                                                                    <td width="10%" align="left">
                                                                                        Email Status
                                                                                    </td>
                                                                                    <td width="40%" align="left" colspan="4" valign="middle">
                                                                                        <asp:RadioButtonList ID="rdEmailStatus" runat="server" CellPadding="3" CellSpacing="0"
                                                                                            RepeatDirection="Horizontal" CssClass="small">
                                                                                            <asp:ListItem Value="-1" Selected="True"> All</asp:ListItem>
                                                                                            <asp:ListItem Value="0"> Pending</asp:ListItem>
                                                                                            <asp:ListItem Value="1"> Sent</asp:ListItem>
                                                                                            <asp:ListItem Value="2"> Failed</asp:ListItem>
                                                                                        </asp:RadioButtonList>
                                                                                    </td>
                                                                                </tr>
                                                                            </asp:Panel>
                                                                            <asp:Panel ID="pnlSMSStatus" runat="server" Visible="False">
                                                                                <tr>
                                                                                    <td width="10%" align="left">
                                                                                        SMS Status
                                                                                    </td>
                                                                                    <td width="40%" align="left" colspan="4" valign="middle">
                                                                                        <asp:RadioButtonList ID="rdSMSStatus" runat="server" CellPadding="3" CellSpacing="0"
                                                                                            RepeatDirection="Horizontal" CssClass="small">
                                                                                            <asp:ListItem Value="-1" Selected="True"> All</asp:ListItem>
                                                                                            <asp:ListItem Value="0"> Pending</asp:ListItem>
                                                                                            <asp:ListItem Value="1"> Sent</asp:ListItem>
                                                                                            <asp:ListItem Value="2"> Failed</asp:ListItem>
                                                                                        </asp:RadioButtonList>
                                                                                    </td>
                                                                                </tr>
                                                                            </asp:Panel>
                                                                            <asp:Panel ID="pnlFilterParameter" runat="server">
                                                                                <tr>
                                                                                    <td width="10%" align="left">
                                                                                        <asp:Label ID="lblFilterParameter" runat="server" Text="Event Name"></asp:Label>
                                                                                    </td>
                                                                                    <td width="40%" align="left" colspan="4">
                                                                                        <asp:TextBox ID="txtFilterParameter" runat="server" Width="40%" MaxLength="30"></asp:TextBox>
                                                                                    </td>
                                                                                </tr>
                                                                            </asp:Panel>
                                                                            <tr>
                                                                                <td colspan="2" height="5px">
                                                                                </td>
                                                                            </tr>
                                                                            <asp:Panel ID="PnlFilterSubject" runat="server">
                                                                                <tr>
                                                                                    <td width="10%" align="left">
                                                                                        <asp:Label ID="lblFilterSubject" runat="server" Text="Email Subject"></asp:Label>
                                                                                    </td>
                                                                                    <td width="40%" align="left" colspan="4">
                                                                                        <asp:TextBox ID="txtFilterSubject" runat="server" Width="40%" MaxLength="30"></asp:TextBox>
                                                                                    </td>
                                                                                </tr>
                                                                            </asp:Panel>
                                                                            <tr>
                                                                                <td colspan="2" height="5px">
                                                                                </td>
                                                                            </tr>
                                                                            <asp:Panel ID="PnlFilterToAddress" runat="server">
                                                                                <tr>
                                                                                    <td width="10%" align="left">
                                                                                        <asp:Label ID="lblFilterToAddress" runat="server" Text="To Address"></asp:Label>
                                                                                    </td>
                                                                                    <td width="40%" align="left" colspan="4">
                                                                                        <asp:TextBox ID="txtFilterToAddress" runat="server" Width="40%" MaxLength="30"></asp:TextBox>
                                                                                    </td>
                                                                                </tr>
                                                                            </asp:Panel>
                                                                            <asp:Panel ID="pnlReportOrder" runat="server">
                                                                                <tr>
                                                                                    <td width="10%" align="left">
                                                                                        <asp:Label ID="lblOrderby" runat="server" Text="Order By"></asp:Label>
                                                                                    </td>
                                                                                    <td width="40%" align="left" colspan="4">
                                                                                        <asp:RadioButtonList ID="rbOrderBy" runat="server" CellPadding="3" CellSpacing="0"
                                                                                            RepeatDirection="Horizontal" CssClass="small">
                                                                                            <asp:ListItem Value="0" Selected="True"> Log Date</asp:ListItem>
                                                                                            <asp:ListItem Value="1"> Unsorted</asp:ListItem>
                                                                                        </asp:RadioButtonList>
                                                                                    </td>
                                                                                </tr>
                                                                            </asp:Panel>
                                                                        </table>
                                                                    </ContentTemplate>
                                                                </asp:TabPanel>
                                                            </asp:TabContainer>
                                                        </td>
                                                    </tr>
                                                </table>
                                            </div>
                                        </td>
                                    </tr>
                                </table>
                            </div>
                            <%--</asp:Panel>--%>
                        </ContentTemplate>
                        <Triggers>
                        </Triggers>
                    </asp:UpdatePanel>
                </div>
            </td>
        </tr>
    </table>
    </form>
</body>
</html>

<script language="javascript">
    function OnTreeClick(evt) {
        var src = window.event != window.undefined ? window.event.srcElement : evt.target;
        var isChkBoxClick = (src.tagName.toLowerCase() == "input" && src.type == "checkbox");
        if (isChkBoxClick) {
            var parentTable = GetParentByTagName("table", src);
            var nxtSibling = parentTable.nextSibling;
            //check if nxt sibling is not null & is an element node 
            if (nxtSibling && nxtSibling.nodeType == 1) {
                if (nxtSibling.tagName.toLowerCase() == "div") //if node has children 
                {
                    //check or uncheck children at all levels 
                    CheckUncheckChildren(parentTable.nextSibling, src.checked);
                }
            }
            //check or uncheck parents at all levels 
            CheckUncheckParents(src, src.checked);
        }
    }

    function CheckUncheckChildren(childContainer, check) {
        var childChkBoxes = childContainer.getElementsByTagName("input");
        var childChkBoxCount = childChkBoxes.length;
        for (var i = 0; i < childChkBoxCount; i++) {
            childChkBoxes[i].checked = check;
        }
    }
    function CheckUncheckParents(srcChild, check) {
        var parentDiv = GetParentByTagName("div", srcChild);
        var parentNodeTable = parentDiv.previousSibling;
        if (parentNodeTable) {
            var checkUncheckSwitch;
            if (check) //checkbox checked 
            {
                var isAllSiblingsChecked = AreAllSiblingsChecked(srcChild);
                if (isAllSiblingsChecked)
                    checkUncheckSwitch = true;
                else
                    return; //do not need to check parent if any(one or more) child not checked 
            }
            else //checkbox unchecked 
            {
                checkUncheckSwitch = false;
            }

            var inpElemsInParentTable = parentNodeTable.getElementsByTagName("input");
            if (inpElemsInParentTable.length > 0) {
                var parentNodeChkBox = inpElemsInParentTable[0];
                parentNodeChkBox.checked = checkUncheckSwitch;
                //do the same recursively 
                CheckUncheckParents(parentNodeChkBox, checkUncheckSwitch);
            }
        }
    }

    function AreAllSiblingsChecked(chkBox) {
        var parentDiv = GetParentByTagName("div", chkBox);
        var childCount = parentDiv.childNodes.length;
        for (var i = 0; i < childCount; i++) {
            if (parentDiv.childNodes[i].nodeType == 1) {
                //check if the child node is an element node 
                if (parentDiv.childNodes[i].tagName.toLowerCase() == "table") {
                    var prevChkBox = parentDiv.childNodes[i].getElementsByTagName("input")[0];
                    //if any of sibling nodes are not checked, return false 
                    if (!prevChkBox.checked) {
                        return false;
                    }
                }
            }
        }
        return true;
    }

    //utility function to get the container of an element by tagname 
    function GetParentByTagName(parentTagName, childElementObj) {
        var parent = childElementObj.parentNode;
        while (parent.tagName.toLowerCase() != parentTagName.toLowerCase()) {
            parent = parent.parentNode;
        }
        return parent;
    }
</script>

