<%@ Page Title="Export CSV" Language="C#" MasterPageFile="~/setting/Setting.Master" AutoEventWireup="true" CodeBehind="rptInspectionItemsCSV_filter.aspx.cs" Inherits="CheckSheet.setting.rptInspectionItemsCSV_filter" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajax" %> 
<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
    <script type="text/javascript">


        $(document).ready(function () {

            let str_para = getUrlVars()["para"];
            let Base64 = { _keyStr: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=", encode: function (e) { var t = ""; var n, r, i, s, o, u, a; var f = 0; e = Base64._utf8_encode(e); while (f < e.length) { n = e.charCodeAt(f++); r = e.charCodeAt(f++); i = e.charCodeAt(f++); s = n >> 2; o = (n & 3) << 4 | r >> 4; u = (r & 15) << 2 | i >> 6; a = i & 63; if (isNaN(r)) { u = a = 64 } else if (isNaN(i)) { a = 64 } t = t + this._keyStr.charAt(s) + this._keyStr.charAt(o) + this._keyStr.charAt(u) + this._keyStr.charAt(a) } return t }, decode: function (e) { var t = ""; var n, r, i; var s, o, u, a; var f = 0; e = e.replace(/[^A-Za-z0-9+/=]/g, ""); while (f < e.length) { s = this._keyStr.indexOf(e.charAt(f++)); o = this._keyStr.indexOf(e.charAt(f++)); u = this._keyStr.indexOf(e.charAt(f++)); a = this._keyStr.indexOf(e.charAt(f++)); n = s << 2 | o >> 4; r = (o & 15) << 4 | u >> 2; i = (u & 3) << 6 | a; t = t + String.fromCharCode(n); if (u != 64) { t = t + String.fromCharCode(r) } if (a != 64) { t = t + String.fromCharCode(i) } } t = Base64._utf8_decode(t); return t }, _utf8_encode: function (e) { e = e.replace(/rn/g, "n"); var t = ""; for (var n = 0; n < e.length; n++) { var r = e.charCodeAt(n); if (r < 128) { t += String.fromCharCode(r) } else if (r > 127 && r < 2048) { t += String.fromCharCode(r >> 6 | 192); t += String.fromCharCode(r & 63 | 128) } else { t += String.fromCharCode(r >> 12 | 224); t += String.fromCharCode(r >> 6 & 63 | 128); t += String.fromCharCode(r & 63 | 128) } } return t }, _utf8_decode: function (e) { var t = ""; var n = 0; var r = c1 = c2 = 0; while (n < e.length) { r = e.charCodeAt(n); if (r < 128) { t += String.fromCharCode(r); n++ } else if (r > 191 && r < 224) { c2 = e.charCodeAt(n + 1); t += String.fromCharCode((r & 31) << 6 | c2 & 63); n += 2 } else { c2 = e.charCodeAt(n + 1); c3 = e.charCodeAt(n + 2); t += String.fromCharCode((r & 15) << 12 | (c2 & 63) << 6 | c3 & 63); n += 3 } } return t } }
            let de_para = Base64.decode(str_para);
            if (de_para.indexOf("|") != -1) {
                let arr_para = de_para.split('|');

                let linegroup = arr_para[0];
                let linename = arr_para[1];
                let partnumber = arr_para[2];
     

                $("#MainContent_txt_linegroup").val(linegroup);
                $("#MainContent_txt_linename").val(linename);
                $("#MainContent_txt_partnumber").val(partnumber);


                $("#MainContent_btnshow").click();
            }


            

        });



        function printpdf(ctl) {


            let filter = "";
  


            let linegroupid = $("#MainContent_txt_linegroup").val();
            let linegroupname = $("#MainContent_txt_linename").val();
            let partnumber = $("#MainContent_txt_partnumber").val();
     

           

          
            if (linegroupid.length > 0) {
                filter = filter + " and b.linegroupid='" + linegroupid + "'";
            }
            if (partnumber.length > 0) {
                filter = filter + " and b.partnumber='" + partnumber + "'";

            }
         


            $('#iframe').attr('src', 'rptInspectionItemsCSV?filter=' + filter + '&item=' + linegroupid + '|' + partnumber + '|');



        }








 </script>


<asp:Panel ID="Panel1" runat="server" style="overflow:no-display;" Width="100%" Height="600px"> 


        <div id="g1" class="grouplist">

            
             <div class="form-row">
                <div class="frmrow">
                     <span class="sp1">
                    <label>
                    <asp:Label ID="lblPageName" runat="server"  CssClass="frmheader"  Text="Export data"  width="120px"></asp:Label>
                   
                    </label>
                    </span>
                   
                </div>
            </div>

            <div class="form-row">
                <div class="frmrow">
                   
                    <span class="sp1">
                    <label>
                    <asp:Label ID="lbl_linegroup" runat="server" CssClass="fontlabel"   Text="Line group :" width="150px"></asp:Label>
                     <asp:TextBox ID="txt_linegroup"  runat="server" Width="250" CssClass="ctlsearchinput">
                    </asp:TextBox>
                    <asp:Button ID="btnfil_linegroup" runat="server" Text="&nbsp;" CssClass="ctlsearchbutton"  OnClientClick="JavaScript:filterpopup('MainContent_txt_linegroup','MainContent_txt_linename','linegroupid','linename','LineGroupMaster','');return false;"  />

                    </label>
                    </span>
                </div>
            </div>
             <div class="form-row">
                <div class="frmrow">
                   
                    <span class="sp1">
                    <label>
                    <asp:Label ID="lbl_linename" runat="server" CssClass="fontlabel"   Text="Line name :" width="150px"></asp:Label>
                     <asp:TextBox ID="txt_linename"  runat="server" Width="250" CssClass="ctlsearchinput">
                    </asp:TextBox>
                    <asp:Button ID="btnfil_linename" runat="server" Text="&nbsp;" CssClass="ctlsearchbutton"  OnClientClick="JavaScript:filterpopup('MainContent_txt_linegroup','MainContent_txt_linename','linegroupid','linename','LineGroupMaster','');return false;"  />

                    </label>
                    </span>
                </div>
            </div>
            <div class="form-row">
                <div class="frmrow">
                   
                    <span class="sp1">
                    <label>
                    <asp:Label ID="lbl_partnumber" runat="server" CssClass="fontlabel"   Text="Part number :" width="150px"></asp:Label>
                     <asp:TextBox ID="txt_partnumber"  runat="server" Width="250" CssClass="ctlsearchinput">
                    </asp:TextBox>
                    <asp:Button ID="btnfil_partnumber" runat="server" Text="&nbsp;" CssClass="ctlsearchbutton"  OnClientClick="JavaScript:filterpopup('MainContent_txt_partnumber','MainContent_txt_partnumber','partnumber','partnumber','EquipmentList','');return false;"  />


                    </label>
                    </span>
                </div>
            </div>
          
<br />
       </div>

      <asp:Button ID="btnshow" CssClass="buttonmsg" runat="server" Text="View" OnClientClick="JavaScript:printpdf(this);return false;" />
     <asp:Button ID="btnreload" CssClass="buttonmsg" runat="server" Text="Cancel" OnClientClick="JavaScript:location.reload();" />

    <br />
    <iframe id="iframe" name="myIframe" width="95%" height="500"></iframe>

    </asp:Panel>

</asp:Content>





