protected void btnSubmit_Click(object sender, EventArgs e)
    {
        if (ddltype.SelectedValue == "3")
        {
            try
            {
                string redirectURL = "FrmRView.aspx?&UserName="******"UserName"].ToString() + "&rptname=RptUserMaster.rdlc";
                ScriptManager.RegisterStartupScript(Page, Page.GetType(), "popup", "window.open('" + redirectURL + "','_blank')", true);
            }
            catch (Exception Ex)
            {
                ExceptionLogging.SendErrorToText(Ex);
            }
        }
        else if (ddltype.SelectedValue == "4")
        {
            try
            {
                string    BName  = "";
                string    BRName = "";
                DataTable DT     = new DataTable();
                DT = LG.GetBankName(Session["BRCD"].ToString());
                if (DT.Rows.Count > 0)
                {
                    BName  = DT.Rows[0]["BankName"].ToString();
                    BRName = DT.Rows[0]["BranchName"].ToString();
                }

                List <object> lst = new List <object>();
                lst.Add(BName);
                lst.Add(BRName);
                lst.Add("ALL OK REPORT");
                lst.Add(Session["USERNAME"].ToString());



                AllOKText AK = new AllOKText();
                AK.RInit(lst);
                AK.Start();
                WebMsgBox.Show("Report Generated Succesfully!!!....", this.Page);
            }
            catch (Exception Ex)
            {
                ExceptionLogging.SendErrorToText(Ex);
            }
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            RptName = Request.QueryString["rptname"].ToString();
            #region Report name Conditions

            if (RptName == "RptDemandSummary.rdlc")
            {
                if (Request.QueryString["FL"] != null)
                {
                    FL = Request.QueryString["FL"].ToString().Replace("%27", "");
                }
                if (Request.QueryString["FBRCD"] != null)
                {
                    FBRCD = Request.QueryString["FBRCD"].ToString().Replace("%27", "");
                }
                if (Request.QueryString["TBRCD"] != null)
                {
                    TBRCD = Request.QueryString["TBRCD"].ToString().Replace("%27", "");
                }
                if (Request.QueryString["ASONDATE"] != null)
                {
                    ASONDT = Request.QueryString["ASONDATE"].ToString().Replace("%27", "");
                }
                if (Request.QueryString["MM"] != null)
                {
                    MM = Request.QueryString["MM"].ToString().Replace("%27", "");
                }
                if (Request.QueryString["YY"] != null)
                {
                    YY = Request.QueryString["YY"].ToString().Replace("%27", "");
                }
            }
            if (RptName == "RptRecoveryStatement_Total.rdlc")
            {
                if (Request.QueryString["BRCD"] != null)
                {
                    BRCD = Request.QueryString["BRCD"].ToString().Replace("%27", "");
                }
                if (Request.QueryString["UID"] != null)
                {
                    UID = Request.QueryString["UID"].ToString().Replace("%27", "");
                }
                if (Request.QueryString["ASONDATE"] != null)
                {
                    ASONDT = Request.QueryString["ASONDATE"].ToString().Replace("%27", "");
                }
                if (Request.QueryString["RECDIV"] != null)
                {
                    RECDIV = Request.QueryString["RECDIV"].ToString().Replace("%27", "");
                }
                if (Request.QueryString["RECCODE"] != null)
                {
                    RECCODE = Request.QueryString["RECCODE"].ToString().Replace("%27", "");
                }
                if (Request.QueryString["MM"] != null)
                {
                    MM = Request.QueryString["MM"].ToString().Replace("%27", "");
                }
                if (Request.QueryString["YY"] != null)
                {
                    YY = Request.QueryString["YY"].ToString().Replace("%27", "");
                }
            }
            if (RptName == "RptDemandDetails.rdlc")
            {
                if (Request.QueryString["FL"] != null)
                {
                    FL = Request.QueryString["FL"].ToString().Replace("%27", "");
                }
                if (Request.QueryString["FBRCD"] != null)
                {
                    FBRCD = Request.QueryString["FBRCD"].ToString().Replace("%27", "");
                }
                if (Request.QueryString["TBRCD"] != null)
                {
                    TBRCD = Request.QueryString["TBRCD"].ToString().Replace("%27", "");
                }
                if (Request.QueryString["ASONDATE"] != null)
                {
                    ASONDT = Request.QueryString["ASONDATE"].ToString().Replace("%27", "");
                }
                if (Request.QueryString["MM"] != null)
                {
                    MM = Request.QueryString["MM"].ToString().Replace("%27", "");
                }
                if (Request.QueryString["YY"] != null)
                {
                    YY = Request.QueryString["YY"].ToString().Replace("%27", "");
                }
            }

            if (RptName == "RptLrAndNr.rdlc")
            {
                if (Request.QueryString["FL"] != null)
                {
                    FL = Request.QueryString["FL"].ToString().Replace("%27", "");
                }
                if (Request.QueryString["BRCD"] != null)
                {
                    BRCD = Request.QueryString["BRCD"].ToString().Replace("%27", "");
                }
                if (Request.QueryString["ASONDATE"] != null)
                {
                    ASONDT = Request.QueryString["ASONDATE"].ToString().Replace("%27", "");
                }
                if (Request.QueryString["RECDIV"] != null)
                {
                    RECDIV = Request.QueryString["RECDIV"].ToString().Replace("%27", "");
                }
                if (Request.QueryString["RECCODE"] != null)
                {
                    RECCODE = Request.QueryString["RECCODE"].ToString().Replace("%27", "");
                }
                if (Request.QueryString["MM"] != null)
                {
                    MM = Request.QueryString["MM"].ToString().Replace("%27", "");
                }
                if (Request.QueryString["YY"] != null)
                {
                    YY = Request.QueryString["YY"].ToString().Replace("%27", "");
                }
                if (Request.QueryString["RECFOR"] != null)
                {
                    RECFOR = Request.QueryString["RECFOR"].ToString().Replace("%27", "");
                }
            }
            if (RptName == "RptRecoveryStatement.rdlc" || RptName == "RptRecoveryStatement_1009.rdlc" || RptName == "RptRecoveryStatement_1010.rdlc" || RptName == "RptRecoveryStatement_ALL.rdlc")
            {
                if (Request.QueryString["FL"] != null)
                {
                    FL = Request.QueryString["FL"].ToString().Replace("%27", "");
                }
                if (Request.QueryString["BRCD"] != null)
                {
                    BRCD = Request.QueryString["BRCD"].ToString().Replace("%27", "");
                }
                if (Request.QueryString["UID"] != null)
                {
                    UID = Request.QueryString["UID"].ToString().Replace("%27", "");
                }
                if (Request.QueryString["ASONDATE"] != null)
                {
                    ASONDT = Request.QueryString["ASONDATE"].ToString().Replace("%27", "");
                }
                if (Request.QueryString["RECDIV"] != null)
                {
                    RECDIV = Request.QueryString["RECDIV"].ToString().Replace("%27", "");
                }
                if (Request.QueryString["RECCODE"] != null)
                {
                    RECCODE = Request.QueryString["RECCODE"].ToString().Replace("%27", "");
                }
                if (Request.QueryString["MM"] != null)
                {
                    MM = Request.QueryString["MM"].ToString().Replace("%27", "");
                }
                if (Request.QueryString["YY"] != null)
                {
                    YY = Request.QueryString["YY"].ToString().Replace("%27", "");
                }
                if (Request.QueryString["RECFOR"] != null)
                {
                    RECFOR = Request.QueryString["RECFOR"].ToString().Replace("%27", "");
                }
            }

            if (RptName == "RptExRecBeforePost.rdlc")
            {
                if (Request.QueryString["REPTYPE"] != null)
                {
                    REPTYPE = Request.QueryString["REPTYPE"].ToString().Replace("%27", "");
                }
                if (Request.QueryString["BKCD"] != null)
                {
                    BKCD = Request.QueryString["BKCD"].ToString().Replace("%27", "");
                }
                if (Request.QueryString["FL"] != null)
                {
                    FL = Request.QueryString["FL"].ToString().Replace("%27", "");
                }
                if (Request.QueryString["SFL"] != null)
                {
                    SFL = Request.QueryString["SFL"].ToString().Replace("%27", "");
                }
                if (Request.QueryString["BRCD"] != null)
                {
                    BRCD = Request.QueryString["BRCD"].ToString().Replace("%27", "");
                }
                if (Request.QueryString["UID"] != null)
                {
                    UID = Request.QueryString["UID"].ToString().Replace("%27", "");
                }
                if (Request.QueryString["ASONDATE"] != null)
                {
                    ASONDT = Request.QueryString["ASONDATE"].ToString().Replace("%27", "");
                }
                if (Request.QueryString["RECDIV"] != null)
                {
                    RECDIV = Request.QueryString["RECDIV"].ToString().Replace("%27", "");
                }
                if (Request.QueryString["RECCODE"] != null)
                {
                    RECCODE = Request.QueryString["RECCODE"].ToString().Replace("%27", "");
                }
                if (Request.QueryString["MM"] != null)
                {
                    MM = Request.QueryString["MM"].ToString().Replace("%27", "");
                }
                if (Request.QueryString["YY"] != null)
                {
                    YY = Request.QueryString["YY"].ToString().Replace("%27", "");
                }
                if (Request.QueryString["RECFOR"] != null)
                {
                    RECFOR = Request.QueryString["RECFOR"].ToString().Replace("%27", "");
                }
            }


            if (RptName == "RptRecoveryAfterPost.rdlc")
            {
                if (Request.QueryString["FL"] != null)
                {
                    FL = Request.QueryString["FL"].ToString().Replace("%27", "");
                }
                if (Request.QueryString["BRCD"] != null)
                {
                    BRCD = Request.QueryString["BRCD"].ToString().Replace("%27", "");
                }
                if (Request.QueryString["UID"] != null)
                {
                    UID = Request.QueryString["UID"].ToString().Replace("%27", "");
                }
                if (Request.QueryString["ASONDATE"] != null)
                {
                    ASONDT = Request.QueryString["ASONDATE"].ToString().Replace("%27", "");
                }
                if (Request.QueryString["RECDIV"] != null)
                {
                    RECDIV = Request.QueryString["RECDIV"].ToString().Replace("%27", "");
                }
                if (Request.QueryString["RECCODE"] != null)
                {
                    RECCODE = Request.QueryString["RECCODE"].ToString().Replace("%27", "");
                }
                if (Request.QueryString["MM"] != null)
                {
                    MM = Request.QueryString["MM"].ToString().Replace("%27", "");
                }
                if (Request.QueryString["YY"] != null)
                {
                    YY = Request.QueryString["YY"].ToString().Replace("%27", "");
                }
                if (Request.QueryString["RECFOR"] != null)
                {
                    RECFOR = Request.QueryString["RECFOR"].ToString().Replace("%27", "");
                }
            }
            if (RptName == "RptPTRegister.rdlc")
            {
                if (Request.QueryString["FL"] != null)
                {
                    FL = Request.QueryString["FL"].ToString().Replace("%27", "");
                }
                if (Request.QueryString["BRCD"] != null)
                {
                    BRCD = Request.QueryString["BRCD"].ToString().Replace("%27", "");
                }
                if (Request.QueryString["UID"] != null)
                {
                    UID = Request.QueryString["UID"].ToString().Replace("%27", "");
                }
                if (Request.QueryString["MM"] != null)
                {
                    MM = Request.QueryString["MM"].ToString().Replace("%27", "");
                }
                if (Request.QueryString["ASONDATE"] != null)
                {
                    ASONDT = Request.QueryString["ASONDATE"].ToString().Replace("%27", "");
                }
                if (Request.QueryString["YY"] != null)
                {
                    YY = Request.QueryString["YY"].ToString().Replace("%27", "");
                }
                if (Request.QueryString["BANKCD"] != null)
                {
                    BKCD = Request.QueryString["BANKCD"].ToString().Replace("%27", "");
                }
                if (Request.QueryString["Div"] != null)
                {
                    Div = Request.QueryString["Div"].ToString().Replace("%27", "");
                }
                if (Request.QueryString["Dep"] != null)
                {
                    Dep = Request.QueryString["Dep"].ToString().Replace("%27", "");
                }
            }


            #endregion

            #region Calling Function
            DataSet thisDataSet  = new DataSet();
            DataSet thisDataSet1 = new DataSet();

            if (RptName == "RptDemandSummary.rdlc")
            {
                thisDataSet = GetDemandRep(FL, FBRCD, TBRCD, MM, YY);
                if (thisDataSet == null || thisDataSet.Tables[0].Rows.Count == 0)
                {
                    WebMsgBox.Show("Sorry No Record found......!!", this.Page);
                    ClientScript.RegisterStartupScript(typeof(Page), "closePage", "window.close();", true);
                    return;
                }
            }
            if (RptName == "RptDemandDetails.rdlc")
            {
                thisDataSet = GetDemandRep(FL, FBRCD, TBRCD, MM, YY);
                if (thisDataSet == null || thisDataSet.Tables[0].Rows.Count == 0)
                {
                    WebMsgBox.Show("Sorry No Record found......!!", this.Page);
                    ClientScript.RegisterStartupScript(typeof(Page), "closePage", "window.close();", true);
                    return;
                }
            }
            if (RptName == "RptLrAndNr.rdlc")
            {
                thisDataSet = GetLrAndNr(BRCD, RECDIV, RECCODE, MM, YY);
                if (thisDataSet == null || thisDataSet.Tables[0].Rows.Count == 0)
                {
                    WebMsgBox.Show("Sorry No Record found......!!", this.Page);
                    ClientScript.RegisterStartupScript(typeof(Page), "closePage", "window.close();", true);
                    return;
                }
            }
            // RptRecoveryStatement
            if (RptName == "RptRecoveryStatement.rdlc")
            {
                thisDataSet = GetRecoveryStatRep(BRCD, RECDIV, RECCODE, MM, YY);
                if (thisDataSet == null || thisDataSet.Tables[0].Rows.Count == 0)
                {
                    WebMsgBox.Show("Sorry No Record found......!!", this.Page);
                    ClientScript.RegisterStartupScript(typeof(Page), "closePage", "window.close();", true);
                    return;
                }
            }
            if (RptName == "RptRecoveryStatement_1010.rdlc")
            {
                thisDataSet = GetRecoveryStatRep(BRCD, RECDIV, RECCODE, MM, YY);
                if (thisDataSet == null || thisDataSet.Tables[0].Rows.Count == 0)
                {
                    WebMsgBox.Show("Sorry No Record found......!!", this.Page);
                    ClientScript.RegisterStartupScript(typeof(Page), "closePage", "window.close();", true);
                    return;
                }
            }

            if (RptName == "RptExRecBeforePost.rdlc")
            {
                thisDataSet = GetRecoveryExRep(FL, SFL, BRCD, RECDIV, RECCODE, MM, YY);
                if (thisDataSet == null || thisDataSet.Tables[0].Rows.Count == 0)
                {
                    WebMsgBox.Show("Sorry No Record found......!!", this.Page);
                    ClientScript.RegisterStartupScript(typeof(Page), "closePage", "window.close();", true);
                    return;
                }
            }


            if (RptName == "RptRecoveryStatement_1009.rdlc" || RptName == "RptRecoveryStatement_ALL.rdlc")
            {
                thisDataSet = GetRecoveryStatRep_1009(BRCD, RECDIV, RECCODE, MM, YY);
                if (thisDataSet == null || thisDataSet.Tables[0].Rows.Count == 0)
                {
                    WebMsgBox.Show("Sorry No Record found......!!", this.Page);
                    ClientScript.RegisterStartupScript(typeof(Page), "closePage", "window.close();", true);
                    return;
                }
            }

            // RptRecoveryStatement
            if (RptName == "RptRecoveryAfterPost.rdlc")
            {
                thisDataSet = GetRecoveryAftrePost(BRCD, RECDIV, RECCODE, MM, YY);
                if (thisDataSet == null || thisDataSet.Tables[0].Rows.Count == 0)
                {
                    WebMsgBox.Show("Sorry No Record found......!!", this.Page);
                    ClientScript.RegisterStartupScript(typeof(Page), "closePage", "window.close();", true);
                    return;
                }
            }

            if (RptName == "RptRecoveryStatement_Total.rdlc")
            {
                thisDataSet = PT.GetRecoveryStatement_Total(ASONDT, BRCD, MM, YY, BKCD, Div, Dep);
                if (thisDataSet == null || thisDataSet.Tables[0].Rows.Count == 0)
                {
                    WebMsgBox.Show("Sorry There Is No Record...!!", this.Page);
                    ClientScript.RegisterStartupScript(typeof(Page), "closePage", "window.close();", true);
                    return;
                }
            }

            if (RptName == "RptPTRegister.rdlc")
            {
                thisDataSet1 = PT.GetPtRegister(FL, ASONDT, BRCD, MM, YY, BKCD, Div, Dep);
                if (thisDataSet1 == null || thisDataSet1.Tables[0].Rows.Count == 0)
                {
                    WebMsgBox.Show("Sorry There Is No Record...!!", this.Page);
                    ClientScript.RegisterStartupScript(typeof(Page), "closePage", "window.close();", true);
                    return;
                }
            }

            #endregion


            #region Report Parameter
            ReportDataSource DataSource  = new ReportDataSource("ReportDS", thisDataSet.Tables["Table1"]);
            ReportDataSource DataSource1 = new ReportDataSource("ReportDS1", thisDataSet1.Tables["Table1"]);

            RdlcPrint.LocalReport.ReportPath = Server.MapPath("~/" + RptName + "");
            RdlcPrint.LocalReport.DataSources.Clear();
            RdlcPrint.LocalReport.DataSources.Add(DataSource);

            if (RptName == "RptBalanceS.rdlc")
            {
                RdlcPrint.LocalReport.DataSources.Add(DataSource);
                RdlcPrint.LocalReport.DataSources.Add(DataSource1);
            }
            if (RptName == "RptDlyCshPosWDenom.rdlc")
            {
                RdlcPrint.LocalReport.DataSources.Add(DataSource);
                RdlcPrint.LocalReport.DataSources.Add(DataSource1);
            }
            RdlcPrint.LocalReport.Refresh();


            DataTable DT = new DataTable();

            DT = LG.GetBankName(Session["BRCD"].ToString());
            if (DT.Rows.Count > 0)
            {
                BkName = DT.Rows[0]["BankName"].ToString();
                BrName = DT.Rows[0]["BranchName"].ToString();
            }
            if (RptName == "RptDemandSummary.rdlc")
            {
                RptName = "Recovery DemandSummary";
                ReportParameter rp1 = new ReportParameter("BANK_NAME", BkName.ToString());
                ReportParameter rp2 = new ReportParameter("BRANCH_NAME", BrName.ToString());
                ReportParameter rp3 = new ReportParameter("USER_NAME", Session["LOGINCODE"].ToString());
                ReportParameter rp6 = new ReportParameter("YYYY", YY.ToString());
                ReportParameter rp7 = new ReportParameter("MM", MM.ToString());

                RdlcPrint.LocalReport.SetParameters(new ReportParameter[] { rp1, rp2, rp3, rp6, rp7 });
            }
            if (RptName == "RptDemandDetails.rdlc")
            {
                RptName = "Recovery DemandDetails";
                ReportParameter rp1 = new ReportParameter("BANK_NAME", BkName.ToString());
                ReportParameter rp2 = new ReportParameter("BRANCH_NAME", BrName.ToString());
                ReportParameter rp3 = new ReportParameter("USER_NAME", Session["LOGINCODE"].ToString());
                ReportParameter rp6 = new ReportParameter("YYYY", YY.ToString());
                ReportParameter rp7 = new ReportParameter("MM", MM.ToString());

                RdlcPrint.LocalReport.SetParameters(new ReportParameter[] { rp1, rp2, rp3, rp6, rp7 });
            }

            if (RptName == "RptLrAndNr.rdlc")
            {
                RptName = "Recovery Lr and Nr";
                ReportParameter rp1 = new ReportParameter("BANK_NAME", BkName.ToString());
                ReportParameter rp2 = new ReportParameter("BRANCH_NAME", BrName.ToString());
                ReportParameter rp3 = new ReportParameter("USER_NAME", Session["LOGINCODE"].ToString());
                ReportParameter rp4 = new ReportParameter("AS_ON_DATE", ASONDT.ToString());
                ReportParameter rp5 = new ReportParameter("REC_FOR", RECFOR.ToString());
                ReportParameter rp6 = new ReportParameter("YYYY", YY.ToString());
                ReportParameter rp7 = new ReportParameter("MM", MM.ToString());

                RdlcPrint.LocalReport.SetParameters(new ReportParameter[] { rp1, rp2, rp3, rp5, rp4, rp6, rp7 });
            }

            if (RptName == "RptRecoveryStatement_Total.rdlc")
            {
                fileName = "Recovery Statement";
                if (RptName == "RptRecoveryStatement_Total.rdlc")
                {
                    RptName = "Recovery Statement";
                    ReportParameter rp1 = new ReportParameter("BANK_NAME", BkName.ToString());
                    ReportParameter rp2 = new ReportParameter("BRANCH_NAME", BrName.ToString());
                    ReportParameter rp3 = new ReportParameter("USER_NAME", UID.ToString());
                    ReportParameter rp4 = new ReportParameter("AS_ON_DATE", ASONDT.ToString());
                    ReportParameter rp5 = new ReportParameter("YYYY", YY.ToString());
                    ReportParameter rp6 = new ReportParameter("MM", MM.ToString());

                    RdlcPrint.LocalReport.SetParameters(new ReportParameter[] { rp1, rp2, rp3, rp4, rp5, rp6 });
                }
            }

            if (RptName == "RptRecoveryAfterPost.rdlc")
            {
                fileName = "Recovery After Post";
                if (RptName == "RptRecoveryAfterPost.rdlc")
                {
                    RptName = "Recovery Statement";
                    ReportParameter rp1 = new ReportParameter("BANK_NAME", BkName.ToString());
                    ReportParameter rp2 = new ReportParameter("BRANCH_NAME", BrName.ToString());
                    ReportParameter rp3 = new ReportParameter("USER_NAME", UID.ToString());
                    ReportParameter rp4 = new ReportParameter("AS_ON_DATE", ASONDT.ToString());
                    ReportParameter rp5 = new ReportParameter("REC_FOR", RECFOR.ToString());
                    ReportParameter rp6 = new ReportParameter("YYYY", YY.ToString());
                    ReportParameter rp7 = new ReportParameter("MM", MM.ToString());
                    ReportParameter rp8 = new ReportParameter("REPORT_NAME", FL.ToString());

                    RdlcPrint.LocalReport.SetParameters(new ReportParameter[] { rp1, rp2, rp3, rp4, rp5, rp6, rp7, rp8 });
                }
            }

            if (RptName == "RptRecoveryStatement.rdlc")
            {
                fileName = "Recovery Statement";
                if (RptName == "RptRecoveryStatement.rdlc")
                {
                    RptName = "Recovery Statement";
                    ReportParameter rp1 = new ReportParameter("BANK_NAME", BkName.ToString());
                    ReportParameter rp2 = new ReportParameter("BRANCH_NAME", BrName.ToString());
                    ReportParameter rp3 = new ReportParameter("USER_NAME", UID.ToString());
                    ReportParameter rp4 = new ReportParameter("AS_ON_DATE", ASONDT.ToString());
                    ReportParameter rp5 = new ReportParameter("REC_FOR", RECFOR.ToString());
                    ReportParameter rp6 = new ReportParameter("YYYY", YY.ToString());
                    ReportParameter rp7 = new ReportParameter("MM", MM.ToString());
                    ReportParameter rp8 = new ReportParameter("REPORT_NAME", FL.ToString());

                    RdlcPrint.LocalReport.SetParameters(new ReportParameter[] { rp1, rp2, rp3, rp4, rp5, rp6, rp7, rp8 });
                }
            }
            if (RptName == "RptRecoveryStatement_1010.rdlc")
            {
                fileName = "Recovery Statement";
                if (RptName == "RptRecoveryStatement_1010.rdlc")
                {
                    RptName = "Recovery Statement";
                    ReportParameter rp1 = new ReportParameter("BANK_NAME", BkName.ToString());
                    ReportParameter rp2 = new ReportParameter("BRANCH_NAME", BrName.ToString());
                    ReportParameter rp3 = new ReportParameter("USER_NAME", UID.ToString());
                    ReportParameter rp4 = new ReportParameter("AS_ON_DATE", ASONDT.ToString());
                    ReportParameter rp5 = new ReportParameter("REC_FOR", RECFOR.ToString());
                    ReportParameter rp6 = new ReportParameter("YYYY", YY.ToString());
                    ReportParameter rp7 = new ReportParameter("MM", MM.ToString());
                    ReportParameter rp8 = new ReportParameter("REPORT_NAME", FL.ToString());

                    RdlcPrint.LocalReport.SetParameters(new ReportParameter[] { rp1, rp2, rp3, rp4, rp5, rp6, rp7, rp8 });
                }
            }
            if (RptName == "RptRecoveryStatement_1009.rdlc" || RptName == "RptRecoveryStatement_ALL.rdlc")
            {
                fileName = "Recovery Statement";
                if (RptName == "RptRecoveryStatement_1009.rdlc" || RptName == "RptRecoveryStatement_ALL.rdlc")
                {
                    RptName = "Recovery Statement";
                    ReportParameter rp1 = new ReportParameter("BANK_NAME", BkName.ToString());
                    ReportParameter rp2 = new ReportParameter("BRANCH_NAME", BrName.ToString());
                    ReportParameter rp3 = new ReportParameter("USER_NAME", UID.ToString());
                    ReportParameter rp4 = new ReportParameter("AS_ON_DATE", ASONDT.ToString());
                    ReportParameter rp5 = new ReportParameter("REC_FOR", RECFOR.ToString());
                    ReportParameter rp6 = new ReportParameter("YYYY", YY.ToString());
                    ReportParameter rp7 = new ReportParameter("MM", MM.ToString());
                    ReportParameter rp8 = new ReportParameter("REPORT_NAME", FL.ToString());

                    RdlcPrint.LocalReport.SetParameters(new ReportParameter[] { rp1, rp2, rp3, rp4, rp5, rp6, rp7, rp8 });
                }
            }
            if (RptName == "RptExRecBeforePost.rdlc")
            {
                fileName = "Recovery Statemen tEx Report";
                if (RptName == "RptExRecBeforePost.rdlc")
                {
                    RptName = "Recovery Statement";
                    ReportParameter rp1 = new ReportParameter("BANK_NAME", BkName.ToString());
                    ReportParameter rp2 = new ReportParameter("BRANCH_NAME", BrName.ToString());
                    ReportParameter rp3 = new ReportParameter("UserId", UID.ToString());
                    ReportParameter rp4 = new ReportParameter("AS_ON_DATE", ASONDT.ToString());
                    ReportParameter rp5 = new ReportParameter("REC_FOR", RECFOR.ToString());
                    ReportParameter rp6 = new ReportParameter("YYYY", YY.ToString());
                    ReportParameter rp7 = new ReportParameter("MM", MM.ToString());
                    ReportParameter rp8 = new ReportParameter("REPORT_NAME", "Excess Recovery Report Before Posting");

                    RdlcPrint.LocalReport.SetParameters(new ReportParameter[] { rp1, rp2, rp3, rp4, rp5, rp6, rp7, rp8 });
                }
            }

            if (RptName == "RptPTRegister.rdlc")
            {
                fileName = "P.T Register";
                ReportParameter rp1 = new ReportParameter("BANK_NAME", BkName.ToString());
                ReportParameter rp2 = new ReportParameter("BRANCH_NAME", BrName.ToString());
                ReportParameter rp3 = new ReportParameter("USER_NAME", UID.ToString());
                RdlcPrint.LocalReport.SetParameters(new ReportParameter[] { rp1, rp2, rp3 });
            }
        }
    }
Пример #3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            RptName = Request.QueryString["rptname"].ToString();

            if (RptName == "RptEmiChart.rdlc")
            {
                if (Request.QueryString["BRCD"] != null)
                {
                    BRCD = Request.QueryString["BRCD"].ToString().Replace("%27", "");
                }
            }

            DataSet thisDataSet1 = new DataSet();
            DataSet thisDataSet2 = new DataSet();
            DataSet thisDataSet3 = new DataSet();
            DataSet thisDataSet4 = new DataSet();

            //  Added By amol Scrutiny Sheet Report
            if (RptName == "RptEmiChart.rdlc")
            {
                //thisDataSet1 = EE.GetLoanEnquiryReport(Convert.ToDouble(LAMT), Convert.ToDouble(RATE), Convert.ToDouble(PERIOD), STARTDATE, PERIODTYPE);
                if (thisDataSet1 == null || thisDataSet1.Tables[0].Rows.Count == 0)
                {
                    WebMsgBox.Show("Sorry There Is No Record...!!", this.Page);
                    ClientScript.RegisterStartupScript(typeof(Page), "closePage", "window.close();", true);
                    return;
                }
            }


            ReportDataSource DataSource1 = new ReportDataSource("DataSet1", thisDataSet1.Tables["Table1"]);
            ReportDataSource DataSource2 = new ReportDataSource("DataSet2", thisDataSet2.Tables["Table1"]);
            ReportDataSource DataSource3 = new ReportDataSource("DataSet3", thisDataSet3.Tables["Table1"]);
            ReportDataSource DataSource4 = new ReportDataSource("DataSet4", thisDataSet4.Tables["Table1"]);

            RdlcPrint.LocalReport.ReportPath = Server.MapPath("~/" + RptName + "");
            RdlcPrint.LocalReport.DataSources.Clear();
            RdlcPrint.LocalReport.DataSources.Add(DataSource1);


            RdlcPrint.LocalReport.Refresh();
            string fileName = "";
            RdlcPrint.Visible = true;

            DataTable DT = new DataTable();
            DT = LG.GetBankName(Session["BRCD"].ToString());
            if (DT.Rows.Count > 0)
            {
                BankName   = DT.Rows[0]["BankName"].ToString();
                BranchName = DT.Rows[0]["BranchName"].ToString();
            }

            if (RptName == "RptEmiChart.rdlc")
            {
                fileName = "";
                ReportParameter rp1 = new ReportParameter("BANK_NAME", BankName.ToString());
                ReportParameter rp2 = new ReportParameter("BRANCH_NAME", BranchName.ToString());
                ReportParameter rp3 = new ReportParameter("USER_NAME", Session["UserName"].ToString());
                RdlcPrint.LocalReport.SetParameters(new ReportParameter[] { rp1, rp2, rp3 });
            }

            RdlcPrint.LocalReport.DataSources.Clear();
            RdlcPrint.LocalReport.DataSources.Add(DataSource1);
            RdlcPrint.LocalReport.DataSources.Add(DataSource2);
            RdlcPrint.LocalReport.DataSources.Add(DataSource3);
            RdlcPrint.LocalReport.DataSources.Add(DataSource4);
            RdlcPrint.LocalReport.Refresh();
        }
    }
    protected void Submit_Click(object sender, EventArgs e)
    {
        try
        {
            FL = "Insert";//ankita 15/09/2017
            string Res = CLM.LOGDETAILS(FL, Session["BRCD"].ToString(), Session["MID"].ToString(), "AllOk_Rpt" + "_" + Session["LOGINCODE"].ToString() + "", "00", Session["MID"].ToString());

            if (ddlExport.SelectedValue == "1")
            {
                try
                {
                    string redirectURL = "FrmRView.aspx?AsOnDate=" + TxtAsonDate.Text + "&UserName="******"UserName"].ToString() + "&rptname=RptAllOK.rdlc" + "&EXPF=" + ddlExport.SelectedItem.Text + "";
                    ScriptManager.RegisterStartupScript(Page, Page.GetType(), "popup", "window.open('" + redirectURL + "','_blank')", true);
                }
                catch (Exception Ex)
                {
                    ExceptionLogging.SendErrorToText(Ex);
                }
            }
            else if (ddlExport.SelectedValue == "2")
            {
                BindGrid();
            }
            else if (ddlExport.SelectedValue == "3")
            {
                try
                {
                    string redirectURL = "FrmRView.aspx?AsOnDate=" + TxtAsonDate.Text + "&UserName="******"UserName"].ToString() + "&rptname=RptAllOK.rdlc";
                    ScriptManager.RegisterStartupScript(Page, Page.GetType(), "popup", "window.open('" + redirectURL + "','_blank')", true);
                }
                catch (Exception Ex)
                {
                    ExceptionLogging.SendErrorToText(Ex);
                }
            }
            else if (ddlExport.SelectedValue == "4")
            {
                try
                {
                    string    BName  = "";
                    string    BRName = "";
                    DataTable DT     = new DataTable();
                    DT = LG.GetBankName(Session["BRCD"].ToString());
                    if (DT.Rows.Count > 0)
                    {
                        BName  = DT.Rows[0]["BankName"].ToString();
                        BRName = DT.Rows[0]["BranchName"].ToString();
                    }

                    List <object> lst = new List <object>();
                    lst.Add(BName);
                    lst.Add(BRName);
                    lst.Add("ALL OK REPORT");
                    lst.Add(Session["USERNAME"].ToString());
                    lst.Add(Session["BRCD"].ToString());
                    lst.Add(Session["EntryDate"].ToString());
                    lst.Add(TxtAsonDate.Text);

                    AllOKText AK = new AllOKText();
                    AK.RInit(lst);
                    AK.Start();
                    WebMsgBox.Show("Report Generated Succesfully!!!....", this.Page);
                    TxtAsonDate.Focus();
                }
                catch (Exception Ex)
                {
                    ExceptionLogging.SendErrorToText(Ex);
                }
            }
        }


        catch (Exception Ex)
        {
            ExceptionLogging.SendErrorToText(Ex);
        }
    }