protected void ShowReport_Click(object sender, EventArgs e) { string branch = string.Empty; if (drpBranch.SelectedItem.Text == "--ALL--") { branch = "%"; } else { branch = drpBranch.SelectedValue; } string subgroup = string.Empty; if (DropSubGroup.SelectedItem.Text == "--ALL--") { subgroup = "%"; } else { subgroup = DropSubGroup.SelectedValue; } LoanProcessingData oLoanProcessingData = new LoanProcessingData(); GroupWiseLoanStatusAprovedTableAdapter oGroupWiseLoanStatusAprovedTableAdapter = new GroupWiseLoanStatusAprovedTableAdapter(); oGroupWiseLoanStatusAprovedTableAdapter.Fill(oLoanProcessingData.GroupWiseLoanStatusAproved, branch, drpGroup.SelectedValue, subgroup); //return oHeadOfficeGLPLSource; ReportDocument myReportDocument = new ReportDocument(); myReportDocument.Load(Server.MapPath("~/Report/rptGroupWiseLoanStatus.rpt")); myReportDocument.SetDataSource(oLoanProcessingData); myReportDocument.SetParameterValue("BrName", drpBranch.SelectedItem.Text); myReportDocument.SetParameterValue("GroupName", drpGroup.SelectedItem.Text); MemoryStream oStream = (MemoryStream)myReportDocument.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat); Response.Clear(); Response.Buffer = true; Response.ContentType = "application/pdf"; Response.AddHeader("Content-Disposition", "attachment; filename='Group Wise Approved Loan Status.pdf'"); Response.BinaryWrite(oStream.ToArray()); Response.End(); }
protected void ShowReport_Click(object sender, EventArgs e) { string branch = string.Empty; if (drpBranch.SelectedItem.Text == "--ALL--") { branch = "%"; } else { branch = drpBranch.SelectedValue; } string Nature = string.Empty; if (DropNature.SelectedItem.Text == "--ALL--") { Nature = "%"; } else { Nature = DropNature.SelectedValue; } string Type = string.Empty; if (DrpType.SelectedItem.Text == "--ALL--") { Type = "%"; } else { Type = DrpType.SelectedValue; } string FromDate; string ToDate; if (YrChkBox.Checked == true) { //FromDate = DateTime.ParseExact(txtProposedDate.Text.Trim(), "dd/MM/yyyy", new CultureInfo("fr-FR", true).ToString("MM/dd/yyyy")); FromDate = (DateTime.ParseExact("01/01/1982", "dd/MM/yyyy", new CultureInfo("fr-FR", true))).ToString("yyyy-MM-dd"); ToDate = (DateTime.ParseExact(DateTime.Now.ToString("dd/MM/yyyy"), "dd/MM/yyyy", new CultureInfo("fr-FR", true))).ToString("yyyy-MM-dd"); } else { FromDate = (DateTime.ParseExact(txtFromDate.Text.Trim(), "dd/MM/yyyy", new CultureInfo("fr-FR", true))).ToString("yyyy-MM-dd"); ToDate = (DateTime.ParseExact(txtToDate.Text.Trim(), "dd/MM/yyyy", new CultureInfo("fr-FR", true))).ToString("yyyy-MM-dd"); //txtvalidityDate.Text.Trim() } LoanProcessingData oLoanProcessingData = new LoanProcessingData(); BranchWiseLoanStatusDeclineTableAdapter oBranchWiseLoanStatusDeclineTableAdapter = new BranchWiseLoanStatusDeclineTableAdapter(); oBranchWiseLoanStatusDeclineTableAdapter.Fill(oLoanProcessingData.BranchWiseLoanStatusDecline, branch, Nature, Convert.ToDateTime(FromDate), Convert.ToDateTime(ToDate), Type); //return oHeadOfficeGLPLSource; ReportDocument myReportDocument = new ReportDocument(); myReportDocument.Load(Server.MapPath("~/Report/rptBranchWiseLoanStatusDecline.rpt")); myReportDocument.SetDataSource(oLoanProcessingData); myReportDocument.SetParameterValue("BrName", drpBranch.SelectedItem.Text); myReportDocument.SetParameterValue("Type", DrpType.SelectedItem.Text); MemoryStream oStream = (MemoryStream)myReportDocument.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat); Response.Clear(); Response.Buffer = true; Response.ContentType = "application/pdf"; Response.AddHeader("Content-Disposition", "attachment; filename='Branch Wise Loan Status Decline.pdf'"); Response.BinaryWrite(oStream.ToArray()); Response.End(); }