private void PuSl_PDF(int dCode) { // Variables Warning[] warnings; string[] streamIds; string mimeType = string.Empty; string encoding = string.Empty; string extension = string.Empty; string fileName = "PUSL"; string rPath = Server.MapPath("~/Report/DigiclayBillGST.rdlc"); ReportViewer viewer = new ReportViewer(); viewer.ProcessingMode = ProcessingMode.Local; viewer.LocalReport.ReportPath = Server.MapPath("~/Report/DigiclayBillGST.rdlc"); viewer.LocalReport.ReportEmbeddedResource = rPath; viewer.LocalReport.DataSources.Clear(); clsSubmitModel oSubmit = new clsSubmitModel(); DataSet ds = oSubmit.GetDataSet("sp_GetSalesBill @mstcode=" + dCode + ",@compcode=" + Convert.ToInt32(Request.QueryString["comp"]) + ",@msttype=" + Convert.ToInt32(Request.QueryString["msttype"]), true); ReportDataSource datasource = new ReportDataSource("DataSet1", SetRows(ds.Tables[0], 14)); viewer.LocalReport.DataSources.Add(datasource); datasource = new ReportDataSource("DataSet2", ds.Tables[1]); viewer.LocalReport.DataSources.Add(datasource); datasource = new ReportDataSource("DataSet3", ds.Tables[2]); viewer.LocalReport.DataSources.Add(datasource); datasource = new ReportDataSource("DataSet4", ds.Tables[3]); viewer.LocalReport.DataSources.Add(datasource); viewer.LocalReport.EnableExternalImages = true; string imagePath = ""; //if (Convert.ToInt32(Request.QueryString["comp"]) == 60) imagePath = "~/img/digi-logo.png"; else imagePath = "~/img/digi-logo.png"; imagePath = "~/img/" + SessionMaster.CompCode + ".png"; imagePath = new Uri(Server.MapPath(imagePath)).AbsoluteUri; ReportParameter p32 = new ReportParameter("ImgPath", imagePath); viewer.LocalReport.SetParameters(new ReportParameter[] { p32 }); viewer.LocalReport.EnableHyperlinks = true; viewer.LocalReport.Refresh(); byte[] bytes = viewer.LocalReport.Render("PDF", null, out mimeType, out encoding, out extension, out streamIds, out warnings); // Now that you have all the bytes representing the PDF report, buffer it and send it to the client. Response.Buffer = true; Response.Clear(); Response.ContentType = mimeType; Response.AddHeader("content-disposition", "inline; filename=" + fileName + "." + extension); Response.BinaryWrite(bytes); // create the file Response.Flush(); // send it to the client to download }
private void GSTR3B() { // Variables Warning[] warnings; string[] streamIds; string mimeType = string.Empty; string encoding = string.Empty; string extension = string.Empty; string fileName = "GSTR_3B"; string rPath = Server.MapPath("~/Report/GSTR_3B.rdlc"); //SessionManager.CompanyId // Setup the report viewer object and get the array of bytes ReportViewer viewer = new ReportViewer(); viewer.ProcessingMode = ProcessingMode.Local; viewer.LocalReport.ReportPath = Server.MapPath("~/Report/GSTR_3B.rdlc"); viewer.LocalReport.ReportEmbeddedResource = rPath; viewer.LocalReport.DataSources.Clear(); clsSubmitModel oSubmit = new clsSubmitModel(); DataSet ds = oSubmit.GetDataSet("exec sp_fillform3b @pCompCode =" + SessionMaster.CompCode + ", @pItemComp =" + SessionMaster.CompCode + ",@pAcctComp =" + SessionMaster.CompCode + ", @pFromDate='" + oSubmit.GetDateFormat(Request.QueryString["sFrom"]) + "' , @pUptoDate = '" + oSubmit.GetDateFormat(Request.QueryString["sTO"]) + "'", true); ReportDataSource datasource = new ReportDataSource("DataSet1", ds.Tables[0]); viewer.LocalReport.DataSources.Add(datasource); datasource = new ReportDataSource("DataSet2", ds.Tables[1]); viewer.LocalReport.DataSources.Add(datasource); datasource = new ReportDataSource("DataSet3", ds.Tables[2]); viewer.LocalReport.DataSources.Add(datasource); datasource = new ReportDataSource("DataSet4", ds.Tables[3]); viewer.LocalReport.DataSources.Add(datasource); datasource = new ReportDataSource("DataSet5", ds.Tables[4]); viewer.LocalReport.DataSources.Add(datasource); datasource = new ReportDataSource("DataSet6", ds.Tables[5]); viewer.LocalReport.DataSources.Add(datasource); viewer.LocalReport.EnableExternalImages = true; //ReportParameter pFrom = new ReportParameter("Month", Request.QueryString["sFrom"]); //ReportParameter pTo = new ReportParameter("Year", Request.QueryString["sTO"]); //viewer.LocalReport.SetParameters(new ReportParameter[] { pFrom, pTo }); viewer.LocalReport.EnableHyperlinks = true; viewer.LocalReport.Refresh(); byte[] bytes = viewer.LocalReport.Render("PDF", null, out mimeType, out encoding, out extension, out streamIds, out warnings); // Now that you have all the bytes representing the PDF report, buffer it and send it to the client. Response.Buffer = true; Response.Clear(); Response.ContentType = mimeType; Response.AddHeader("content-disposition", "inline; filename=" + fileName + "." + extension); Response.BinaryWrite(bytes); // create the file Response.Flush(); // send it to the client to download }
private void Order_PDF(int TypeId, int dCode, int compcode) { // Variables Warning[] warnings; string[] streamIds; string mimeType = string.Empty; string encoding = string.Empty; string extension = string.Empty; string fileName = "Order"; string rPath = Server.MapPath("~/Report/Order.rdlc"); ReportViewer viewer = new ReportViewer(); viewer.ProcessingMode = ProcessingMode.Local; viewer.LocalReport.ReportPath = Server.MapPath("~/Report/Order.rdlc"); viewer.LocalReport.ReportEmbeddedResource = rPath; viewer.LocalReport.DataSources.Clear(); clsSubmitModel oSubmit = new clsSubmitModel(); DataSet ds = oSubmit.GetDataSet("sp_GetOrderBill @mstcode=" + dCode + ",@compcode=" + compcode + ",@msttype=" + TypeId, true); ReportDataSource datasource = new ReportDataSource("DataSet1", SetRows(ds.Tables[0], 14)); viewer.LocalReport.DataSources.Add(datasource); datasource = new ReportDataSource("DataSet2", ds.Tables[1]); viewer.LocalReport.DataSources.Add(datasource); datasource = new ReportDataSource("DataSet3", ds.Tables[2]); viewer.LocalReport.DataSources.Add(datasource); datasource = new ReportDataSource("DataSet4", ds.Tables[3]); viewer.LocalReport.DataSources.Add(datasource); viewer.LocalReport.EnableExternalImages = true; string imagePath = ""; imagePath = "~/img/" + SessionMaster.CompCode + ".png"; imagePath = new Uri(Server.MapPath(imagePath)).AbsoluteUri; ReportParameter p32 = new ReportParameter("ImgPath", imagePath); viewer.LocalReport.SetParameters(new ReportParameter[] { p32 }); viewer.LocalReport.EnableHyperlinks = true; viewer.LocalReport.Refresh(); byte[] bytes = viewer.LocalReport.Render("PDF", null, out mimeType, out encoding, out extension, out streamIds, out warnings); Response.Buffer = true; Response.Clear(); Response.ContentType = mimeType; Response.AddHeader("content-disposition", "inline; filename=" + fileName + "." + extension); Response.BinaryWrite(bytes); // create the file Response.Flush(); // send it to the client to download }
private void CreatePDFForInvoice(int dCode) { // Variables Warning[] warnings; string[] streamIds; string mimeType = string.Empty; string encoding = string.Empty; string extension = string.Empty; string fileName = "Quotation"; string rPath = Server.MapPath("~/Report/Quotation.rdlc"); //SessionManager.CompanyId // Setup the report viewer object and get the array of bytes ReportViewer viewer = new ReportViewer(); viewer.ProcessingMode = ProcessingMode.Local; viewer.LocalReport.ReportPath = Server.MapPath("~/Report/Quotation.rdlc"); viewer.LocalReport.ReportEmbeddedResource = rPath; viewer.LocalReport.DataSources.Clear(); clsSubmitModel oSubmit = new clsSubmitModel(); DataSet ds = oSubmit.GetDataSet("GetQuotPrint @MstCode=" + dCode, true); ReportDataSource datasource = new ReportDataSource("DataSet1", ds.Tables[0]); viewer.LocalReport.DataSources.Add(datasource); datasource = new ReportDataSource("DataSet2", ds.Tables[1]); viewer.LocalReport.DataSources.Add(datasource); datasource = new ReportDataSource("DataSet3", ds.Tables[2]); viewer.LocalReport.DataSources.Add(datasource); viewer.LocalReport.EnableExternalImages = true; viewer.LocalReport.EnableHyperlinks = true; viewer.LocalReport.Refresh(); byte[] bytes = viewer.LocalReport.Render("PDF", null, out mimeType, out encoding, out extension, out streamIds, out warnings); // Now that you have all the bytes representing the PDF report, buffer it and send it to the client. Response.Buffer = true; Response.Clear(); Response.ContentType = mimeType; Response.AddHeader("content-disposition", "inline; filename=" + fileName + "." + extension); Response.BinaryWrite(bytes); // create the file Response.Flush(); // send it to the client to download }