protected void btnShow_Click(object sender, EventArgs e) { SysFunction sysFunc = new SysFunction(); Data.DSReports data = new Data.DSReports(); ReportDocument RD = new ReportDocument(); SqlParameter[] param = { new SqlParameter("@DealerCode", SqlDbType.Char), //0 new SqlParameter("@TicketNo", SqlDbType.Char), //0 }; param[0].Value = Session["DealerCode"].ToString(); param[1].Value = txtTicketNo.Text; SqlDataReader rder = null; // Store Procedure check and load if (sysFunc.ExecuteSP("SP_Report_Complaint", param, ref rder)) //Database SP { data.EnforceConstraints = false; data.SP_Report_Complaint.Load(rder); // DataSet SP } // Load in crystal report //RD.Load(Server.MapPath("../PurchaseSaleReturnReport.rpt")); RD.Load(Server.MapPath("/Reports/rptComplaint.rpt")); RD.DataDefinition.FormulaFields["DealerName"].Text = "'" + Session["DealerDesc"].ToString() + "'"; RD.DataDefinition.FormulaFields["DealerAdress"].Text = "'" + Session["DealerAddress"].ToString() + "'"; //RD.DataDefinition.FormulaFields["DealerPhone"].Text = "'" + Session["DealerPhone"].ToString() + "'"; // RD.DataDefinition.FormulaFields["DealerEmail"].Text = "'" + Session["DealerEmail"].ToString() + "'"; RD.DataDefinition.FormulaFields["ReportTitle"].Text = "'Complain'"; RD.DataDefinition.FormulaFields["Terminal"].Text = "'" + Request.ServerVariables["REMOTE_ADDR"].ToString() + "'"; RD.DataDefinition.FormulaFields["UserId"].Text = "'" + Session["UserName"].ToString() + "'"; RD.DataDefinition.FormulaFields["NTN"].Text = "'N.T.N # " + Session["DealerNTN"].ToString() + "'"; // RD.DataDefinition.FormulaFields["SalesTaxNo"].Text = "'Sales Tax No. " + Session["DealerSaleTaxNo"].ToString() + " '"; //rpt.DataDefinition.FormulaFields["UserCell"].Text = "'" + GetStringValuesAgainstCodes("CusCode", , "CellNo", "Customer") + "'"; RD.DataDefinition.FormulaFields["CompanyName"].Text = "'" + Session["DealerDesc"].ToString() + "'"; //RD.DataDefinition.FormulaFields["Pic"].Text = "'C:\\Users\\u_ahm\\OneDrive\\Documents\\Visual Studio 2010\\Projects\\WebApplication1\\WebApplication1\\" + Session["Logo"] + "'"; RD.DataDefinition.FormulaFields["Pic"].Text = "'" + Server.MapPath("~") + Session["Logo"] + "'"; // RD.DataDefinition.FormulaFields["ComplaintTypeCode"] = "'"+txtTicketNo.Text+"'"; // mention paper size //RD.PrintOptions.PaperSize = PaperSize.PaperA4; RD.Database.Tables[0].SetDataSource(data); string FilePath = Server.MapPath("~/Download/"); string FileName = "CounterSalesDetail" + Session["DealerCode"].ToString() + DateTime.Now.ToString("ddMMyyyy") + ".pdf"; string File = FilePath + FileName; Session["RD"] = RD; string URL; URL = "../../../Download/rptViewerService.aspx?FileName=" + FileName; string fullURL = "window.open('" + URL + "', '_blank', 'height=800,width=1000,status=no,toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=yes,titlebar=no');"; ScriptManager.RegisterStartupScript(this, typeof(string), "OPEN_WINDOW", fullURL, true); }
protected void btnPrint_Click(object sender, EventArgs e) { Data.DSReports data = new Data.DSReports(); ReportDocument RD = new ReportDocument(); SqlParameter[] param = { new SqlParameter("@DealerCode", SqlDbType.Char), //0 new SqlParameter("@PPRCOde", SqlDbType.Char), //1 }; param[0].Value = Session["DealerCode"].ToString(); param[1].Value = ddlPRNo.SelectedValue; SqlDataReader rder = null; SysFunction sysFunc = new SysFunction(); if (sysFunc.ExecuteSP("SP_PPR_Report", param, ref rder)) { data.SP_PPR_Report.Load(rder); } RD.Load(Server.MapPath("~\\Modules\\Service\\ServiceReports\\TRReport.rpt")); RD.DataDefinition.FormulaFields["DealerDesc"].Text = "'" + Session["DealerDesc"].ToString() + "'"; RD.DataDefinition.FormulaFields["DealerAddress"].Text = "'" + Session["DealerAddress"].ToString() + "'"; RD.DataDefinition.FormulaFields["DealerPhone"].Text = "'" + Session["DealerPhone"].ToString() + "'"; RD.DataDefinition.FormulaFields["DealerEmail"].Text = "'" + Session["DealerEmail"].ToString() + "'"; RD.DataDefinition.FormulaFields["DealerFax"].Text = "'" + Session["DealerFax"].ToString() + "'"; RD.DataDefinition.FormulaFields["ReportTitle"].Text = "'Warranty Report'"; RD.DataDefinition.FormulaFields["UserId"].Text = "'" + Session["UserName"].ToString() + "'"; RD.DataDefinition.FormulaFields["Terminal"].Text = "'" + Request.ServerVariables["REMOTE_ADDR"].ToString() + "'"; //RD.DataDefinition.FormulaFields["NTN"].Text = "'N.T.N # " + Session["DealerNTN"].ToString() + "'"; //RD.DataDefinition.FormulaFields["SalesTaxNo"].Text = "'Sales Tax No. " + Session["DealerSaleTaxNo"].ToString() + " '"; RD.DataDefinition.FormulaFields["CompanyName"].Text = "'" + Session["DealerDesc"].ToString() + "'"; //RD.DataDefinition.FormulaFields["DealershipName"].Text = "'Authorised " + Session["ParentDesc"].ToString() + " Dealership'"; //RD.DataDefinition.FormulaFields["Pic"].Text = "'C:\\Users\\u_ahm\\OneDrive\\Documents\\Visual Studio 2010\\Projects\\WebApplication1\\WebApplication1\\" + Session["Logo"] + "'"; RD.DataDefinition.FormulaFields["Pic"].Text = "'" + Server.MapPath("~") + Session["Logo"] + "'"; RD.Database.Tables[0].SetDataSource(data); // convert and show string FilePath = Server.MapPath("~") + "\\Download\\"; string FileName = "TRReport" + this.Session["DealerCode"].ToString() + DateTime.Now.ToString("ddMMyyyy") + ".pdf"; string File = FilePath + FileName; Session["RD"] = RD; //RD.ExportToDisk(ExportFormatType.PortableDocFormat, File); string URL; URL = "../../../Download/rptViewerService.aspx?FileName=" + FileName; string fullURL = "window.open('" + URL + "', '_blank', 'height=800,width=1000,status=no,toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=yes,titlebar=no');"; ScriptManager.RegisterStartupScript(this, typeof(string), "OPEN_WINDOW", fullURL, true); }
protected void Print(object sender, EventArgs e) { if (!sec.UserRight("2575", "006")) { Response.Redirect("~/Test.aspx"); } Data.DSReports data = new Data.DSReports(); ReportDocument RD = new ReportDocument(); SqlDataReader rder = null; DateTime fromDate = DateTime.ParseExact(txtFromDate.Text, "dd-MM-yyyy", null); DateTime toDate = DateTime.ParseExact(txtToDate.Text, "dd-MM-yyyy", null); if (ddlType.SelectedValue == "Cus") { SqlParameter[] param = { new SqlParameter("@DealerCode", SqlDbType.Char, 5), //0 new SqlParameter("@FromDate", SqlDbType.DateTime), //1 new SqlParameter("@ToDate", SqlDbType.DateTime), //2 new SqlParameter("@CusCode", SqlDbType.VarChar) }; param[0].Value = Session["DealerCode"].ToString(); param[1].Value = sysFunc.SaveDate(txtFromDate.Text); param[2].Value = sysFunc.SaveDate(txtToDate.Text); if (txtCusCode.Text == "") { param[3].Value = ""; } else { param[3].Value = txtCusCode.Text; } string sql = "exec SP_PartyLedger_Report '" + Session["DealerCode"].ToString() + "','" + sysFunc.SaveDate(txtFromDate.Text) + "','" + sysFunc.SaveDate(txtToDate.Text) + "','" + param[3].Value + "'"; dt = sysFunc.GetData(sql); RD.Load(Server.MapPath("../partyLedgerReport.rpt")); } else { SqlParameter[] param = { new SqlParameter("@DealerCode", SqlDbType.Char, 5), //0 new SqlParameter("@FromDate", SqlDbType.DateTime), //1 new SqlParameter("@ToDate", SqlDbType.DateTime), //2 new SqlParameter("@InsCompCode", SqlDbType.VarChar), new SqlParameter("@InsBrCode", SqlDbType.VarChar) }; param[0].Value = Session["DealerCode"].ToString(); param[1].Value = sysFunc.SaveDate(txtFromDate.Text); param[2].Value = sysFunc.SaveDate(txtToDate.Text); param[3].Value = txtInsCompCode.Text; param[4].Value = txtInsBrCode.Text; string sql = "exec SP_PartyLedger_ReportIns '" + Session["DealerCode"].ToString() + "','" + sysFunc.SaveDate(txtFromDate.Text) + "','" + sysFunc.SaveDate(txtToDate.Text) + "','" + param[3].Value + "','" + param[4].Value + "'"; dt = sysFunc.GetData(sql); RD.Load(Server.MapPath("../partyLedgerReportIns.rpt")); } //if (sysFunc.ExecuteSP("SP_PartyLedger_Report", param, ref rder)) //{ // data.SP_PartyLedger_Report.Load(rder); //} //rder.Close(); RD.DataDefinition.FormulaFields["FromDate"].Text = "'" + sysFunc.SaveDate(txtFromDate.Text) + "'"; RD.DataDefinition.FormulaFields["ToDate"].Text = "'" + sysFunc.SaveDate(txtToDate.Text) + "'"; RD.DataDefinition.FormulaFields["DealerDesc"].Text = "'" + Session["DealerDesc"].ToString() + "'"; RD.DataDefinition.FormulaFields["DealerAddress"].Text = "'" + Session["DealerAddress"].ToString() + "'"; RD.DataDefinition.FormulaFields["DealerPhone"].Text = "'" + Session["DealerPhone"].ToString() + "'"; RD.DataDefinition.FormulaFields["DealerEmail"].Text = "'" + Session["DealerEmail"].ToString() + "'"; RD.DataDefinition.FormulaFields["DealerFax"].Text = "'" + Session["DealerFax"].ToString() + "'"; RD.DataDefinition.FormulaFields["ReportTitle"].Text = "'Party Ledger'"; RD.DataDefinition.FormulaFields["UserID"].Text = "'" + Session["UserName"].ToString() + "'"; RD.DataDefinition.FormulaFields["Terminal"].Text = "'" + Request.ServerVariables["REMOTE_ADDR"].ToString() + "'"; RD.DataDefinition.FormulaFields["CompanyName"].Text = "'" + Session["DealerDesc"].ToString() + "'"; //RD.DataDefinition.FormulaFields["DealershipName"].Text = "'Authorised " + Session["ParentDesc"].ToString() + " Dealership'"; //RD.DataDefinition.FormulaFields["Pic"].Text = "'C:\\Users\\u_ahm\\OneDrive\\Documents\\Visual Studio 2010\\Projects\\WebApplication1\\WebApplication1\\" + Session["Logo"] + "'"; RD.DataDefinition.FormulaFields["Pic"].Text = "'" + Server.MapPath("~") + Session["Logo"] + "'"; RD.SetDataSource(dt); string FilePath = Server.MapPath("~") + "\\Download\\"; string FileName = "Report.pdf"; string File = FilePath + FileName; PdfDocument outputDocument = new PdfDocument(); Stream stream = RD.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat); stream.Seek(0, SeekOrigin.Begin); DirectoryInfo info = new DirectoryInfo(FilePath); if (!info.Exists) { info.Create(); } string path = Path.Combine(FilePath, FileName); using (FileStream outputFileStream = new FileStream(path, FileMode.Create)) { stream.CopyTo(outputFileStream); } stream.Dispose(); stream.Close(); string URL = "../../../../Download/PrintReport.aspx"; string fullURL = "window.open('" + URL + "', '_blank', 'height=800,width=1500,status=no,toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=yes,titlebar=no');"; ScriptManager.RegisterStartupScript(this, typeof(string), "OPEN_WINDOW", fullURL, true); //// convert and show //string FilePath = Server.MapPath("~") + "\\Download\\"; //string FileName = "crtPartyLedger" + this.Session["DealerCode"].ToString() + DateTime.Now.ToString("ddMMyyyy") + ".pdf"; //string File = FilePath + FileName; //Session["RD"] = RD; ////RD.ExportToDisk(ExportFormatType.PortableDocFormat, File); //string URL; //URL = "../../../../Download/rptViewerService.aspx?FileName=" + FileName; //string fullURL = "window.open('" + URL + "', '_blank', 'height=800,width=1200,status=no,toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=yes,titlebar=no');"; //ScriptManager.RegisterStartupScript(this, typeof(string), "OPEN_WINDOW", fullURL, true); }
protected void btnPrint_Click(object sender, EventArgs e) { SysFunction SysFunc = new SysFunction(); string FDate = SysFunc.SaveDate(txtFromDate.Text).ToString(); string TDate = SysFunc.SaveDate(txtToDate.Text).ToString(); PdfDocument outputDocument = new PdfDocument(); string desktopPath = Environment.GetFolderPath(Environment.SpecialFolder.Desktop); string extension = "FileName.pdf"; desktopPath += @"\" + extension; SqlDataReader rder; ReportDocument RD = new ReportDocument(); DataTable dt = new DataTable(); string sql; DataSet dsRpt = new DataSet(); DXBMS.Data.DSReports objDsReports = new Data.DSReports(); if (ViewState["SparePart"].ToString() == "PTV") { if (!sec.UserRight("2568", "006")) { Response.Redirect("~/Test.aspx"); } sql = "exec SP_PaymenttoVendor_Select '" + Session["DealerCode"].ToString() + "','" + FDate + "','" + TDate + "'"; RD.Load(Server.MapPath("~/Modules/SpareParts/SpareReports/PaymentToVendorDetailReport.rpt")); RD.DataDefinition.FormulaFields["ReportTitle"].Text = "\"" + "PAYMENT TO VENDOR DETAIL" + "\""; } else if (ViewState["SparePart"].ToString() == "SA") { if (!sec.UserRight("2569", "006")) { Response.Redirect("~/Test.aspx"); } sql = "exec SP_StockAdjustment_DetailReport '" + Session["DealerCode"].ToString() + "','" + FDate + "','" + TDate + "'"; RD.Load(Server.MapPath("~/Modules/SpareParts/SpareReports/crtStockAdjustment.rpt")); RD.DataDefinition.FormulaFields["ReportTitle"].Text = "\"" + "Stock Adjustment Detail Report" + "\""; } else if (ViewState["SparePart"].ToString() == "IL") { if (!sec.UserRight("2571", "006")) { Response.Redirect("~/Test.aspx"); } sql = "exec sp2W_Spare_InvoiceDetail '" + Session["DealerCode"].ToString() + "','" + FDate + "','" + TDate + "'"; RD.Load(Server.MapPath("../rptInvoices.rpt")); RD.DataDefinition.FormulaFields["ReportTitle"].Text = "\"" + "Invoices Detail Report" + "\""; } else if (ViewState["SparePart"].ToString() == "IR") { if (!sec.UserRight("2590", "006")) { Response.Redirect("~/Test.aspx"); } sql = "exec sp2W_Revenue_InvoiceDetail '" + Session["DealerCode"].ToString() + "','" + FDate + "','" + TDate + "'"; RD.Load(Server.MapPath("../rptInvoiceRevenue.rpt")); RD.DataDefinition.FormulaFields["ReportTitle"].Text = "\"" + "Invoices Revenue Detail Report" + "\""; } else if (ViewState["SparePart"].ToString() == "DS") { if (!sec.UserRight("2572", "006")) { Response.Redirect("~/Test.aspx"); } string cond = ""; sql = "Sp_2W_CounterSaleDetail_rpt '" + Session["DealerCode"].ToString() + "','" + FDate + "','" + TDate + "'" + cond; RD.Load(Server.MapPath("../rptCounterSaleDetail.rpt")); RD.DataDefinition.FormulaFields["FromCode"].Text = "\"" + Convert.ToDateTime(FDate.ToString()).ToString("dd/MM/yyyy") + "\""; RD.DataDefinition.FormulaFields["ToCode"].Text = "\"" + Convert.ToDateTime(TDate.ToString()).ToString("dd/MM/yyyy") + "\""; RD.DataDefinition.FormulaFields["ReportTitle"].Text = "\"" + "Direct Sale Detail Report" + "\""; } else if (ViewState["SparePart"].ToString() == "GRN") { if (!sec.UserRight("2573", "006")) { Response.Redirect("~/Test.aspx"); } sql = "exec sp_GRNDetailList '" + Session["DealerCode"].ToString() + "','" + FDate + "','" + TDate + "'"; RD.Load(Server.MapPath("../rptPartsReceivedDetail.rpt")); RD.DataDefinition.FormulaFields["ReportTitle"].Text = "\"" + "GRN DETAIL REPORT" + "\""; RD.DataDefinition.FormulaFields["FromCode"].Text = "'" + FDate + "'"; RD.DataDefinition.FormulaFields["ToCode"].Text = "'" + TDate + "'"; } else { if (!sec.UserRight("2570", "006")) { Response.Redirect("~/Test.aspx"); } sql = "exec sp_2W_Spares_Aging'" + Session["DealerCode"].ToString() + "','" + FDate + "','" + TDate + "' ,'" + txtCustomer.Text + "'"; RD.Load(Server.MapPath("../rptCustomerWiseOutstandingSummary.rpt")); RD.DataDefinition.FormulaFields["ReportTitle"].Text = "\"" + "Customer Wise OutStanding Summary Report" + "\""; } dt = SysFunc.GetData(sql); RD.PrintOptions.PaperSize = PaperSize.PaperA4; RD.DataDefinition.FormulaFields["DealerPhone"].Text = "'" + Session["DealerPhone"].ToString() + "'"; RD.DataDefinition.FormulaFields["DealerEmail"].Text = "'" + Session["DealerEmail"].ToString() + "'"; RD.DataDefinition.FormulaFields["DealerDesc"].Text = "'" + Session["DealerDesc"].ToString() + "'"; RD.DataDefinition.FormulaFields["DealerAddress"].Text = "'" + Session["DealerAddress"].ToString() + "'"; RD.DataDefinition.FormulaFields["UserID"].Text = "'" + Session["UserID"].ToString() + "'"; //RD.DataDefinition.FormulaFields["FromCode"].Text = "'" + FDate + "'"; //RD.DataDefinition.FormulaFields["ToCode"].Text = "'" + TDate + "'"; RD.DataDefinition.FormulaFields["Terminal"].Text = "'" + Environment.MachineName + "'"; RD.DataDefinition.FormulaFields["CompanyName"].Text = "'" + Session["DealerDesc"].ToString() + "'"; //RD.DataDefinition.FormulaFields["Pic"].Text = "'C:\\Users\\u_ahm\\OneDrive\\Documents\\Visual Studio 2010\\Projects\\WebApplication1\\WebApplication1\\" + Session["Logo"] + "'"; RD.DataDefinition.FormulaFields["Pic"].Text = "'" + Server.MapPath("~") + Session["Logo"] + "'"; //RD.DataDefinition.FormulaFields["DealershipName"].Text = "'Authorised " + Session["ParentDesc"].ToString() + " Dealership'"; RD.Database.Tables[0].SetDataSource(dt); string FilePath = Server.MapPath("~") + "\\Download\\"; string FileName = "Report.pdf"; string File = FilePath + FileName; Stream stream = RD.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat); stream.Seek(0, SeekOrigin.Begin); DirectoryInfo info = new DirectoryInfo(FilePath); if (!info.Exists) { info.Create(); } string path = Path.Combine(FilePath, FileName); using (FileStream outputFileStream = new FileStream(path, FileMode.Create)) { stream.CopyTo(outputFileStream); } stream.Dispose(); stream.Close(); string URL = "../../../../Download/PrintReport.aspx"; string fullURL = "window.open('" + URL + "', '_blank', 'height=800,width=1000,status=no,toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=yes,titlebar=no');"; ScriptManager.RegisterStartupScript(this, typeof(string), "OPEN_WINDOW", fullURL, true); //RD.ExportToDisk(ExportFormatType.PortableDocFormat, File); //string URL; //URL = Page.ResolveUrl("~/Download/rptViewerService.aspx?FileName=") + FileName; //string fullURL = "window.open('" + URL + "', '_blank', 'height=800,width=1000,status=no,toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=yes,titlebar=no');"; //ScriptManager.RegisterStartupScript(this, typeof(string), "OPEN_WINDOW", fullURL, true); //string URL = "../Criteria/POView.aspx?CusWise=" + "&ReportID=" + RptName.ToString() + "&fromDate=" + FromDate + "&ToDate=" + ToDate; //string fullURL = "window.open('" + URL + "', '_blank', 'height=800,width=1000,status=no,toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=yes,titlebar=no');"; //ScriptManager.RegisterStartupScript(this, typeof(string), "OPEN_WINDOW", fullURL, true); }
//protected void btnPrint_Click(object sender, EventArgs e) //{ // ScriptManager.RegisterStartupScript(this, GetType(), "Print", "Print()", true); //} protected void btnPrint_Click(object sender, EventArgs e) { ReportDocument RD = new ReportDocument(); string FDate = SysFunc.SaveDate(txtFromDate.Text).ToString(); string TDate = SysFunc.SaveDate(txtToDate.Text).ToString(); DataSet dsRpt = new DataSet(); DXBMS.Data.DSReports objDsReports = new Data.DSReports(); DataTable dt = new DataTable(); string sql; if (ViewState["Name"].ToString() == "DCR") { if (!sec.UserRight("2561", "006")) { Response.Redirect("~/Test.aspx"); } sql = "exec sp_DailyCollectionSP '" + Session["DealerCode"].ToString() + "','" + FDate + "','" + TDate + "'"; RD.Load(Server.MapPath("../../ServiceReports/ptIncommingPaymentDetail2.rpt")); RD.DataDefinition.FormulaFields["ReportTitle"].Text = "\"" + "INCOMING PAYMENTS DETAIL" + "\""; } else if (ViewState["Name"].ToString() == "ASI") { if (!sec.UserRight("2563", "006")) { Response.Redirect("~/Test.aspx"); } sql = "exec SP_vw_AfterSaleInvoiceDetail_New '" + Session["DealerCode"].ToString() + "','" + FDate + "','" + TDate + "' , '" + txtCusCode.Text + "'"; RD.Load(Server.MapPath("../../ServiceReports/rptAfterSaleInvoice.rpt")); RD.DataDefinition.FormulaFields["ReportTitle"].Text = "\"" + "AFTER SALE INVOICE DETAIL" + "\""; } else { if (!sec.UserRight("2562", "006")) { Response.Redirect("~/Test.aspx"); } sql = "exec SP_Aging_Select '" + Session["DealerCode"].ToString() + "','" + FDate + "','" + TDate + "', '" + txtCusCode.Text + "'"; RD.Load(Server.MapPath("../../ServiceReports/rptAging.rpt")); RD.DataDefinition.FormulaFields["ReportTitle"].Text = "\"" + "AGING DETAIL" + "\""; } dt = SysFunc.GetData(sql); RD.PrintOptions.PaperSize = CrystalDecisions.Shared.PaperSize.PaperA4; RD.DataDefinition.FormulaFields["DealerPhone"].Text = "'" + Session["DealerPhone"].ToString() + "'"; RD.DataDefinition.FormulaFields["DealerEmail"].Text = "'" + Session["DealerEmail"].ToString() + "'"; RD.DataDefinition.FormulaFields["DealerFax"].Text = "'" + Session["DealerFax"].ToString() + "'"; RD.DataDefinition.FormulaFields["DealerDesc"].Text = "'" + Session["DealerDesc"].ToString() + "'"; RD.DataDefinition.FormulaFields["DealerAddress"].Text = "'" + Session["DealerAddress"].ToString() + "'"; RD.DataDefinition.FormulaFields["UserID"].Text = "'" + Session["UserID"].ToString() + "'"; RD.DataDefinition.FormulaFields["Terminal"].Text = "'" + Environment.MachineName + "'"; RD.DataDefinition.FormulaFields["CompanyName"].Text = "'" + Session["DealerDesc"].ToString() + "'"; RD.DataDefinition.FormulaFields["Pic"].Text = "'" + Server.MapPath("~") + Session["Logo"] + "'"; //RD.DataDefinition.FormulaFields["Pic"].Text = "'C:\\Users\\u_ahm\\OneDrive\\Documents\\Visual Studio 2010\\Projects\\WebApplication1\\WebApplication1\\Images\\havoline.png'"; //RD.DataDefinition.FormulaFields["DealershipName"].Text = "'Authorised " + Session["ParentDesc"].ToString() + " Dealership'"; RD.Database.Tables[0].SetDataSource(dt); string FilePath = Server.MapPath("~") + "\\Download\\"; string FileName = "Report.pdf"; string File = FilePath + FileName; PdfDocument outputDocument = new PdfDocument(); Stream stream = RD.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat); stream.Seek(0, SeekOrigin.Begin); DirectoryInfo info = new DirectoryInfo(FilePath); if (!info.Exists) { info.Create(); } string path = Path.Combine(FilePath, FileName); using (FileStream outputFileStream = new FileStream(path, FileMode.Create)) { stream.CopyTo(outputFileStream); } stream.Dispose(); stream.Close(); stream = null; string URL = "../../../../Download/PrintReport.aspx"; string fullURL = "window.open('" + URL + "', '_blank', 'height=800,width=1000,status=no,toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=yes,titlebar=no');"; ScriptManager.RegisterStartupScript(this, typeof(string), "OPEN_WINDOW", fullURL, true); Session["RD"] = RD; //crviewer.ReportSource = RD; //convert and show //string FilePath = Server.MapPath("~") + "\\Download\\"; //string FileName = "JobCardDetail" + this.Session["DealerCode"].ToString() + DateTime.Now.ToString("ddMMyyyy") + ".pdf"; //string File = FilePath + FileName; //Session["RD"] = RD; //string URL = "../../../../Download/rptViewerService.aspx?ReportID=StockBalance"; //string fullURL = "window.open('" + URL + "', '_blank', 'height=800,width=10200,status=no,toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=yes,titlebar=no');"; //ScriptManager.RegisterStartupScript(this, typeof(string), "OPEN_WINDOW", fullURL, true); }
protected void btnReorderRpt(object sender, EventArgs e) { if (!sec.UserRight("2581", "006")) { Response.Redirect("~/Test.aspx"); } SysFunction SysFunc = new SysFunction(); ReportDocument RD = new ReportDocument(); DataTable dt = new DataTable(); string sql; DataSet dsRpt = new DataSet(); DXBMS.Data.DSReports objDsReports = new Data.DSReports(); sql = "exec SP_MinimumLevelReport '" + Session["DealerCode"].ToString() + "','" + txtMLItemCode.Text + "'"; RD.Load(Server.MapPath("../MinLevelRpt.rpt")); RD.DataDefinition.FormulaFields["ReportTitle"].Text = "\"" + "Minimum Level Report" + "\""; dt = SysFunc.GetData(sql); RD.PrintOptions.PaperSize = PaperSize.PaperA4; RD.DataDefinition.FormulaFields["DealerPhone"].Text = "'" + Session["DealerPhone"].ToString() + "'"; RD.DataDefinition.FormulaFields["DealerEmail"].Text = "'" + Session["DealerEmail"].ToString() + "'"; RD.DataDefinition.FormulaFields["DealerDesc"].Text = "'" + Session["DealerDesc"].ToString() + "'"; RD.DataDefinition.FormulaFields["DealerAddress"].Text = "'" + Session["DealerAddress"].ToString() + "'"; RD.DataDefinition.FormulaFields["UserID"].Text = "'" + Session["UserID"].ToString() + "'"; //RD.DataDefinition.FormulaFields["FromCode"].Text = "'" + FDate + "'"; //RD.DataDefinition.FormulaFields["ToCode"].Text = "'" + TDate + "'"; RD.DataDefinition.FormulaFields["Terminal"].Text = "'" + Environment.MachineName + "'"; RD.DataDefinition.FormulaFields["CompanyName"].Text = "'" + Session["DealerDesc"].ToString() + "'"; //RD.DataDefinition.FormulaFields["Pic"].Text = "'C:\\Users\\u_ahm\\OneDrive\\Documents\\Visual Studio 2010\\Projects\\WebApplication1\\WebApplication1\\" + Session["Logo"] + "'"; RD.DataDefinition.FormulaFields["Pic"].Text = "'" + Server.MapPath("~") + Session["Logo"] + "'"; //RD.DataDefinition.FormulaFields["DealershipName"].Text = "'Authorised " + Session["ParentDesc"].ToString() + " Dealership'"; RD.Database.Tables[0].SetDataSource(dt); //CrystalReportViewer1.ReportSource = RD; string FilePath = Server.MapPath("~") + "\\Download\\"; string FileName = "Report.pdf"; string File = FilePath + FileName; PdfDocument outputDocument = new PdfDocument(); Stream stream = RD.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat); stream.Seek(0, SeekOrigin.Begin); DirectoryInfo info = new DirectoryInfo(FilePath); if (!info.Exists) { info.Create(); } string path = Path.Combine(FilePath, FileName); using (FileStream outputFileStream = new FileStream(path, FileMode.Create)) { stream.CopyTo(outputFileStream); } stream.Dispose(); stream.Close(); string URL = "../../../../Download/PrintReport.aspx"; string fullURL = "window.open('" + URL + "', '_blank', 'height=800,width=1000,status=no,toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=yes,titlebar=no');"; ScriptManager.RegisterStartupScript(this, typeof(string), "OPEN_WINDOW", fullURL, true); // convert and show //string FilePath = Server.MapPath("~") + "\\Download\\"; //string FileName = "MinimumLevel" + this.Session["DealerCode"].ToString() + DateTime.Now.ToString("ddMMyyyy") + ".pdf"; //string File = FilePath + FileName; //Session["RD"] = RD; //string URL; //URL = Page.ResolveUrl("~/Download/rptViewerService.aspx?FileName=") + FileName; //string fullURL = "window.open('" + URL + "', '_blank', 'height=800,width=1000,status=no,toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=yes,titlebar=no');"; //ScriptManager.RegisterStartupScript(this, typeof(string), "OPEN_WINDOW", fullURL, true); }
protected void Page_Load(object sender, EventArgs e) { if (this.Session["UserName"] == null) { Response.Redirect("~/Main/login.aspx"); } rpt = new ReportDocument(); String StrReportID, Type; Type = Request.QueryString["Type"]; StrReportID = Request.QueryString["ReportID"]; if (StrReportID == "PaymentReceiptReport") { rpt.Load(Server.MapPath("rptPaymentReceiptPrint.rpt")); strCriteria = "{PaymentReceiptMaster.ReceiptNo}='" + Request.QueryString["ReceiptNo"] + "' " + "AND {PaymentReceiptMaster.DealerCode}='" + Session["DealerCode"].ToString() + "' " + "AND {PaymentReceiptMaster.DelFlag} = 'N' "; //rpt.RecordSelectionFormula = strCriteria; rpt.DataDefinition.FormulaFields["DealerDesc"].Text = "'" + Session["DealerDesc"].ToString() + "'"; rpt.DataDefinition.FormulaFields["DealerAddress"].Text = "'" + Session["DealerAddress"].ToString() + "'"; rpt.DataDefinition.FormulaFields["ReportTitle"].Text = "'Payment Receipt'"; rpt.DataDefinition.FormulaFields["Terminal"].Text = "'" + Environment.MachineName + "'"; rpt.DataDefinition.FormulaFields["UserId"].Text = "'" + Session["UserName"].ToString() + "'"; rpt.DataDefinition.FormulaFields["SalesTaxNo"].Text = "'" + Session["DealerSaleTaxNo"].ToString() + "'"; rpt.DataDefinition.FormulaFields["NTN"].Text = "'" + Session["DealerNTN"].ToString() + "'"; //rpt.DataDefinition.FormulaFields["UserCell"].Text = "'" + grl.GetStringValuesAgainstCodes("CusCode", SessionInformation.LoginID, "CellNo", "Customer") + "'"; // CrystalReportViewer1.ReportSource = rpt; } if (StrReportID == "CustomerEstimate") { //ReportDocument RD; //string strCriteria, rptTitle; //DateTime FromDate, ToDate; //SqlDataReader rder; //CustEstimateCode SysFunctions myFunc = new SysFunctions(); Data.DSReports DsRpt = new Data.DSReports(); //DataSet1 dsRpt1 = new DataSet1(); SqlDataReader rder = null; rpt = new ReportDocument(); string CCon = CConnection.GetConnectionString(); DataSet ds = new DataSet(); SqlParameter[] param = { new SqlParameter("@DealerCode", SqlDbType.Char), //0 new SqlParameter("@CustomerEstimateCode", SqlDbType.Char), //1 }; param[0].Value = Session["DealerCode"].ToString(); param[1].Value = Request.QueryString["CustEstimateCode"].ToString(); DsRpt.EnforceConstraints = false; ds = SqlHelper.ExecuteDataset(CCon, CommandType.Text, "sp_CustomerEstimateMaster_Print '" + this.Session["DealerCode"].ToString() + "','" + Request.QueryString["CustEstimateCode"].ToString() + "'"); DsRpt.sp_CustomerEstimateMaster_Print.Load(ds.CreateDataReader()); DsRpt.EnforceConstraints = false; ds = SqlHelper.ExecuteDataset(CCon, CommandType.Text, "sp_CustomerEstimateDetail_Print '" + this.Session["DealerCode"].ToString() + "','" + Request.QueryString["CustEstimateCode"].ToString() + "'"); DsRpt.sp_CustomerEstimateDetail_Print.Load(ds.CreateDataReader()); DsRpt.EnforceConstraints = false; ds = SqlHelper.ExecuteDataset(CCon, CommandType.Text, "sp_CustomerEstimateDetailSup_Print '" + this.Session["DealerCode"].ToString() + "','" + Request.QueryString["CustEstimateCode"].ToString() + "'"); DsRpt.sp_CustomerEstimateDetailSup_Print.Load(ds.CreateDataReader()); DsRpt.EnforceConstraints = false; ds = SqlHelper.ExecuteDataset(CCon, CommandType.Text, "sp_CustomerEstimateLubricates_Print '" + this.Session["DealerCode"].ToString() + "','" + Request.QueryString["CustEstimateCode"].ToString() + "'"); DsRpt.sp_CustomerEstimateLubricates_Print.Load(ds.CreateDataReader()); DsRpt.EnforceConstraints = false; ds = SqlHelper.ExecuteDataset(CCon, CommandType.Text, "sp_CustomerEstimateLubricatesSup_Print '" + this.Session["DealerCode"].ToString() + "','" + Request.QueryString["CustEstimateCode"].ToString() + "'"); DsRpt.sp_CustomerEstimateLubricatesSup_Print.Load(ds.CreateDataReader()); DsRpt.EnforceConstraints = false; ds = SqlHelper.ExecuteDataset(CCon, CommandType.Text, "sp_CustomerEstimateParts_Print '" + this.Session["DealerCode"].ToString() + "','" + Request.QueryString["CustEstimateCode"].ToString() + "'"); DsRpt.sp_CustomerEstimateParts_Print.Load(ds.CreateDataReader()); DsRpt.EnforceConstraints = false; ds = SqlHelper.ExecuteDataset(CCon, CommandType.Text, "sp_CustomerEstimatePartsSup_Print '" + this.Session["DealerCode"].ToString() + "','" + Request.QueryString["CustEstimateCode"].ToString() + "'"); DsRpt.sp_CustomerEstimatePartsSup_Print.Load(ds.CreateDataReader()); DsRpt.EnforceConstraints = false; myFunc.ExecuteSP("sp_CustomerEstimateBoutParts_Print", param, ref rder); DsRpt.sp_CustomerEstimateBoutParts_Print.Load(rder); DsRpt.EnforceConstraints = false; myFunc.ExecuteSP("sp_EstimateSubletDetail_Print", param, ref rder); DsRpt.sp_JobCardSubletDetail_Print.Load(rder); rpt.Load(Server.MapPath("~/Modules/Service/ServiceReports/rptCustomerEstimatePrint.rpt")); rpt.DataDefinition.FormulaFields["DealerName"].Text = "'" + Session["DealerDesc"].ToString() + "'"; rpt.DataDefinition.FormulaFields["DealerAddress"].Text = "'" + Session["DealerAddress"].ToString() + "'"; rpt.DataDefinition.FormulaFields["DealerPhone"].Text = "'" + Session["DealerPhone"].ToString() + "'"; rpt.DataDefinition.FormulaFields["DealerEmail"].Text = "'" + Session["DealerEmail"].ToString() + "'"; if (Type == "Insurance") { rpt.DataDefinition.FormulaFields["ReportTitle"].Text = "'Insurance Estimate'"; } else { rpt.DataDefinition.FormulaFields["ReportTitle"].Text = "'Customer Estimate'"; } rpt.DataDefinition.FormulaFields["Terminal"].Text = "'" + Request.ServerVariables["REMOTE_ADDR"].ToString() + "'"; rpt.DataDefinition.FormulaFields["UserId"].Text = "'" + Session["UserName"].ToString() + "'"; rpt.DataDefinition.FormulaFields["NTN"].Text = "'N.T.N # " + Session["DealerNTN"].ToString() + "'"; rpt.DataDefinition.FormulaFields["SalesTaxNo"].Text = "'Sales Tax No. " + Session["DealerSaleTaxNo"].ToString() + " '"; //rpt.DataDefinition.FormulaFields["UserCell"].Text = "'" + GetStringValuesAgainstCodes("CusCode", , "CellNo", "Customer") + "'"; rpt.DataDefinition.FormulaFields["Pic"].Text = "'" + Server.MapPath("~") + Session["Logo"] + "'"; rpt.Database.Tables[0].SetDataSource(DsRpt); //CrystalReportViewer1.ReportSource = rpt; // rpt.SetDataSource(DsRpt.sp_CustomerEstimateMaster_Print.DataSet); Session["RDService"] = rpt; } else { rpt = (ReportDocument)Session["RD"]; } //var connectionInfo = new ConnectionInfo(); //connectionInfo.ServerName = "localhost"; //connectionInfo.DatabaseName = "BMS"; //connectionInfo.Password = "******"; //connectionInfo.UserID = "sa"; //connectionInfo.Type = ConnectionInfoType.SQL; //connectionInfo.IntegratedSecurity = false; //for (int i = 0; i < CrystalReportViewer1.LogOnInfo.Count; i++) //{ // CrystalReportViewer1.LogOnInfo[i].ConnectionInfo = connectionInfo; //} //if (Environment.MachineName == "AZHARDELL") //{ // rpt.SetDatabaseLogon("sa", "100372", "localhost", "BMS"); //} //else //{ // rpt.SetDatabaseLogon("sa", "tiger", "akramali-pc", "BMS"); //} string FilePath = Server.MapPath("~") + "\\Download\\"; string FileName = "Report.pdf"; string File = FilePath + FileName; PdfDocument outputDocument = new PdfDocument(); Stream stream = rpt.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat); stream.Seek(0, SeekOrigin.Begin); DirectoryInfo info = new DirectoryInfo(FilePath); if (!info.Exists) { info.Create(); } string path = Path.Combine(FilePath, FileName); using (FileStream outputFileStream = new FileStream(path, FileMode.Create)) { stream.CopyTo(outputFileStream); } stream.Dispose(); stream.Close(); rpt.Dispose(); rpt.Close(); Session["RDService"] = rpt; string embed = "<object data=\"{0}\" type=\"application/pdf\" width=\"1000px\" height=\"800px\">"; embed += "If you are unable to view file, you can download from <a href = \"{0}\">here</a>"; embed += " or download <a target = \"_blank\" href = \"http://get.adobe.com/reader/\">Adobe PDF Reader</a> to view the file."; embed += "</object>"; ltEmbed.Text = string.Format(embed, ResolveUrl("~/Download/Report.pdf")); //CrystalReportViewer1.ReportSource = rpt; //CrystalReportViewer1.ToolPanelView = CrystalDecisions.Web.ToolPanelViewType.None; }
protected void btnPrintJC_Click(object sender, EventArgs e) { Data.DSReports data = new Data.DSReports(); ReportDocument RD = new ReportDocument(); SqlParameter[] param = { new SqlParameter("@DealerCode", SqlDbType.Char), //0 new SqlParameter("@FIRCode", SqlDbType.VarChar) //1 }; param[0].Value = Session["DealerCode"].ToString(); if (ddlDRNo.SelectedIndex == 0) { lblMsg.Text = "Please Select DRN No. first"; return; } else { param[1].Value = ddlDRNo.SelectedValue.ToString().Trim(); } SqlDataReader rder = null; DataTable dt = new DataTable(); if (sysfunc.ExecuteSP("sp_FIR_Reports", param, ref rder)) { data.sp_GetFIRMaster.Load(rder); dt = data.sp_GetFIRMaster; } RD.Load(Server.MapPath("~/Modules/Service/ServiceReports/rptDTR.rpt")); RD.DataDefinition.FormulaFields["DealerName"].Text = "'" + Session["DealerDesc"].ToString() + "'"; RD.DataDefinition.FormulaFields["DealerAddress"].Text = "'" + Session["DealerAddress"].ToString() + "'"; RD.DataDefinition.FormulaFields["DealerPhone"].Text = "'" + Session["DealerPhone"].ToString() + "'"; RD.DataDefinition.FormulaFields["DealerEmail"].Text = "'" + Session["DealerEmail"].ToString() + "'"; RD.DataDefinition.FormulaFields["ReportTitle"].Text = "'Dealer Technical Report'"; RD.DataDefinition.FormulaFields["Terminal"].Text = "'" + Request.ServerVariables["REMOTE_ADDR"].ToString() + "'"; RD.DataDefinition.FormulaFields["UserId"].Text = "'" + Session["UserName"].ToString() + "'"; //RD.DataDefinition.FormulaFields["NTN"].Text = "'N.T.N # " + Session["DealerNTN"].ToString() + "'"; //RD.DataDefinition.FormulaFields["SalesTaxNo"].Text = "'Sales Tax No. " + Session["DealerSaleTaxNo"].ToString() + " '"; //rpt.DataDefinition.FormulaFields["UserCell"].Text = "'" + GetStringValuesAgainstCodes("CusCode", , "CellNo", "Customer") + "'"; RD.DataDefinition.FormulaFields["CompanyName"].Text = "'" + Session["DealerDesc"].ToString() + "'"; //RD.DataDefinition.FormulaFields["DealershipName"].Text = "'Authorised " + Session["ParentDesc"].ToString() + " Dealership'"; //RD.DataDefinition.FormulaFields["Pic"].Text = "'C:\\Users\\u_ahm\\OneDrive\\Documents\\Visual Studio 2010\\Projects\\WebApplication1\\WebApplication1\\" + Session["Logo"] + "'"; RD.DataDefinition.FormulaFields["Pic"].Text = "'" + Server.MapPath("~") + Session["Logo"] + "'"; RD.DataDefinition.FormulaFields["Pic1"].Text = "'" + Server.MapPath("~") + dt.Rows[0]["item"].ToString() + "'"; RD.Database.Tables[0].SetDataSource(data); // convert and show string FilePath = Server.MapPath("~") + "\\Download\\"; string FileName = "BillingReport" + this.Session["DealerCode"].ToString() + DateTime.Now.ToString("ddMMyyyy") + ".pdf"; string File = FilePath + FileName; Session["RD"] = RD; //RD.ExportToDisk(ExportFormatType.PortableDocFormat, File); string URL; URL = "../../../../Download/rptViewerService.aspx?FileName=" + FileName; string fullURL = "window.open('" + URL + "', '_blank', 'height=800,width=1000,status=no,toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=yes,titlebar=no');"; ScriptManager.RegisterStartupScript(this, typeof(string), "OPEN_WINDOW", fullURL, true); }
protected void btnBillReport_Click(object sender, EventArgs e) { if (!sec.UserRight("2583", "006")) { Response.Redirect("~/Test.aspx"); } Data.DSReports data = new Data.DSReports(); ReportDocument RD = new ReportDocument(); SqlParameter[] param = { new SqlParameter("@DealerCode", SqlDbType.Char), //0 new SqlParameter("@BillingNo", SqlDbType.VarChar) //1 }; param[0].Value = Session["DealerCode"].ToString(); if (ddlBillingNo.SelectedIndex == 0) { lblMessage.Text = "Please Select Billing No. first"; return; } else { param[1].Value = ddlBillingNo.SelectedValue.ToString().Trim(); } SqlDataReader rder = null; if (sysFunc.ExecuteSP("Sp_JENBillingRpt", param, ref rder)) { data.EnforceConstraints = false; data.Sp_JENBillingRpt.Load(rder); } RD.Load(Server.MapPath("~/Modules/Service/ServiceReports/rptClaimMemo.rpt")); RD.DataDefinition.FormulaFields["DealerDesc"].Text = "'" + Session["DealerDesc"].ToString() + "'"; RD.DataDefinition.FormulaFields["DealerAddress"].Text = "'" + Session["DealerAddress"].ToString() + "'"; RD.DataDefinition.FormulaFields["DealerPhone"].Text = "'" + Session["DealerPhone"].ToString() + "'"; RD.DataDefinition.FormulaFields["DealerEmail"].Text = "'" + Session["DealerEmail"].ToString() + "'"; RD.DataDefinition.FormulaFields["DealerFax"].Text = "'" + Session["DealerFax"].ToString() + "'"; RD.DataDefinition.FormulaFields["ReportTitle"].Text = "'Warranty Claim Memo'"; RD.DataDefinition.FormulaFields["UserId"].Text = "'" + Session["UserName"].ToString() + "'"; RD.DataDefinition.FormulaFields["Terminal"].Text = "'" + Request.ServerVariables["REMOTE_ADDR"].ToString() + "'"; RD.DataDefinition.FormulaFields["CompanyName"].Text = "'" + Session["DealerDesc"].ToString() + "'"; //RD.DataDefinition.FormulaFields["DealershipName"].Text = "'Authorised " + Session["ParentDesc"].ToString() + " Dealership'"; //RD.DataDefinition.FormulaFields["Pic"].Text = "'C:\\Users\\u_ahm\\OneDrive\\Documents\\Visual Studio 2010\\Projects\\WebApplication1\\WebApplication1\\" + Session["Logo"] + "'"; RD.DataDefinition.FormulaFields["Pic"].Text = "'" + Server.MapPath("~") + Session["Logo"] + "'"; RD.Database.Tables[0].SetDataSource(data); // convert and show string FilePath = Server.MapPath("~") + "\\Download\\"; string FileName = "BillingReport" + this.Session["DealerCode"].ToString() + DateTime.Now.ToString("ddMMyyyy") + ".pdf"; string File = FilePath + FileName; Session["RD"] = RD; //RD.ExportToDisk(ExportFormatType.PortableDocFormat, File); string URL; URL = "../../../../Download/rptViewerService.aspx?FileName=" + FileName; string fullURL = "window.open('" + URL + "', '_blank', 'height=800,width=1000,status=no,toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=yes,titlebar=no');"; ScriptManager.RegisterStartupScript(this, typeof(string), "OPEN_WINDOW", fullURL, true); }
protected void btnShowReport_Click(object sender, EventArgs e) { if (!sec.UserRight("2586", "006")) { Response.Redirect("~/Test.aspx"); } if (dtFrom.Text == "" || dtTo.Text == "") { MessageBox.Show("Please select dates", "Message"); return; } Data.DSReports data = new Data.DSReports(); SqlDataReader rder = null; DataTable dt = new DataTable(); ReportDocument RD = new ReportDocument(); DateTime FromDate; DateTime ToDate; string FDate = myFunc.SaveDate(dtFrom.Text).ToString(); string TDate = myFunc.SaveDate(dtTo.Text).ToString(); FromDate = Convert.ToDateTime(FDate); ToDate = Convert.ToDateTime(TDate); //ReportDocument RD = new ReportDocument(); //DataSet dsRpt = new DataSet(); DXBMS.Data.DataSet1 objDsReports = new Data.DataSet1(); SqlParameter[] param = { new SqlParameter("@DealerCode", SqlDbType.Char), // new SqlParameter("@FromDate", SqlDbType.VarChar), //1 new SqlParameter("@ToDate", SqlDbType.VarChar), //2 new SqlParameter("@VehicleCategory", SqlDbType.VarChar), new SqlParameter("@ChassisNo", SqlDbType.VarChar), //2 new SqlParameter("@EngineNo", SqlDbType.VarChar), new SqlParameter("@RegNo", SqlDbType.VarChar), new SqlParameter("@RptType", SqlDbType.VarChar), }; param[0].Value = Session["DealerCode"].ToString(); param[1].Value = FromDate; param[2].Value = ToDate; param[3].Value = rbStatus.SelectedItem.Value.ToString(); param[4].Value = ""; param[5].Value = ""; param[6].Value = ""; param[7].Value = "Warranty"; if (sysfunc.ExecuteSP("SP_PPR_Detail_Report", param, ref rder)) { //data.SP_selectjobcategorydetail.Load(rder); data.EnforceConstraints = false; data.SP_PPR_Detail_Report.Load(rder); } RD.Load(Server.MapPath("~/Modules/Service/ServiceReports/rptWarrantyDetailHCV.rpt")); // RD.DataDefinition.FormulaFields["DealerName"].Text = "'" + Session["DealerDesc"].ToString() + "'"; RD.DataDefinition.FormulaFields["DealerAddress"].Text = "'" + Session["DealerAddress"].ToString() + "'"; RD.DataDefinition.FormulaFields["DealerPhone"].Text = "'" + Session["DealerPhone"].ToString() + "'"; // RD.DataDefinition.FormulaFields["DealerEmail"].Text = "'" + Session["DealerEmail"].ToString() + "'"; RD.DataDefinition.FormulaFields["ReportTitle"].Text = "'Warranty Claim Report'"; RD.DataDefinition.FormulaFields["Terminal"].Text = "'" + Request.ServerVariables["REMOTE_ADDR"].ToString() + "'"; RD.DataDefinition.FormulaFields["UserId"].Text = "'" + Session["UserName"].ToString() + "'"; //RD.DataDefinition.FormulaFields["NTN"].Text = "'N.T.N # " + Session["DealerNTN"].ToString() + "'"; //RD.DataDefinition.FormulaFields["SalesTaxNo"].Text = "'Sales Tax No. " + Session["DealerSaleTaxNo"].ToString() + " '"; //rpt.DataDefinition.FormulaFields["UserCell"].Text = "'" + GetStringValuesAgainstCodes("CusCode", , "CellNo", "Customer") + "'"; RD.DataDefinition.FormulaFields["CompanyName"].Text = "'" + Session["DealerDesc"].ToString() + "'"; //RD.DataDefinition.FormulaFields["DealershipName"].Text = "'Authorised " + Session["ParentDesc"].ToString() + " Dealership'"; //RD.DataDefinition.FormulaFields["Pic"].Text = "'C:\\Users\\u_ahm\\OneDrive\\Documents\\Visual Studio 2010\\Projects\\WebApplication1\\WebApplication1\\" + Session["Logo"] + "'"; RD.DataDefinition.FormulaFields["Pic"].Text = "'" + Server.MapPath("~") + Session["Logo"] + "'"; //RD.DataDefinition.FormulaFields["Pic1"].Text = "'" + Server.MapPath("~") + dt.Rows[0]["item"].ToString() + "'"; RD.Database.Tables[0].SetDataSource(data); string FilePath = Server.MapPath("~") + "\\Download\\"; string FileName = "Report.pdf"; string File = FilePath + FileName; PdfDocument outputDocument = new PdfDocument(); Stream stream = RD.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat); stream.Seek(0, SeekOrigin.Begin); DirectoryInfo info = new DirectoryInfo(FilePath); if (!info.Exists) { info.Create(); } string path = Path.Combine(FilePath, FileName); using (FileStream outputFileStream = new FileStream(path, FileMode.Create)) { stream.CopyTo(outputFileStream); } stream.Dispose(); stream.Close(); string URL = "../../../../Download/PrintReport.aspx"; string fullURL = "window.open('" + URL + "', '_blank', 'height=800,width=1000,status=no,toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=yes,titlebar=no');"; ScriptManager.RegisterStartupScript(this, typeof(string), "OPEN_WINDOW", fullURL, true); //convert and show //string FilePath = Server.MapPath("~") + "\\Download\\"; //string FileName = "BillingReport" + this.Session["DealerCode"].ToString() + DateTime.Now.ToString("ddMMyyyy") + ".pdf"; //string File = FilePath + FileName; //Session["RD"] = RD; //string URL; //URL = "../../../../Download/rptViewerService.aspx?FileName=" + FileName; //string fullURL = "window.open('" + URL + "', '_blank', 'height=800,width=1000,status=no,toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=yes,titlebar=no');"; //ScriptManager.RegisterStartupScript(this, typeof(string), "OPEN_WINDOW", fullURL, true); }
protected void btn_print_Click(object sender, EventArgs e) { ReportDocument RD = new ReportDocument(); DXBMS.Data.DSReports objDsReports = new Data.DSReports(); DataTable dt = new DataTable(); if (txtRefundCode.Text == "") { SysFuncs.UserMsg(success_add_item, Color.Red, "Please select Receipt No."); return; } string sql = "exec sp_PaymentRefund_Print '" + Session["DealerCode"].ToString() + "','" + txtRefundCode.Text + "'"; dt = SysFuncs.GetData(sql); objDsReports.sp_PaymentRefund_Print.Load(dt.CreateDataReader()); RD.Load(Server.MapPath("~/Modules/SpareParts/SpareReports/rptPaymentRefund.rpt")); RD.DataDefinition.FormulaFields["DealerPhone"].Text = "'" + Session["DealerPhone"].ToString() + "'"; RD.DataDefinition.FormulaFields["DealerEmail"].Text = "'" + Session["DealerEmail"].ToString() + "'"; RD.DataDefinition.FormulaFields["DealerFax"].Text = "'" + Session["DealerFax"].ToString() + "'"; RD.DataDefinition.FormulaFields["DealerDesc"].Text = "'" + Session["DealerDesc"].ToString() + "'"; RD.DataDefinition.FormulaFields["DealerAddress"].Text = "'" + Session["DealerAddress"].ToString() + "'"; RD.DataDefinition.FormulaFields["UserID"].Text = "'" + Session["UserID"].ToString() + "'"; RD.DataDefinition.FormulaFields["Terminal"].Text = "'" + Environment.MachineName + "'"; RD.DataDefinition.FormulaFields["CompanyName"].Text = "'" + Session["DealerDesc"].ToString() + "'"; //RD.DataDefinition.FormulaFields["DealershipName"].Text = "'Authorised " + Session["ParentDesc"].ToString() + " Dealership'"; //RD.DataDefinition.FormulaFields["Pic"].Text = "'C:\\Users\\u_ahm\\OneDrive\\Documents\\Visual Studio 2010\\Projects\\WebApplication1\\WebApplication1\\" + Session["Logo"] + "'"; RD.DataDefinition.FormulaFields["Pic"].Text = "'" + Server.MapPath("~") + Session["Logo"] + "'"; string FilePath = Server.MapPath("~") + "\\Download\\"; string FileName = "Report.pdf"; string File = FilePath + FileName; RD.SetDataSource(objDsReports); PdfDocument outputDocument = new PdfDocument(); Stream stream = RD.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat); stream.Seek(0, SeekOrigin.Begin); DirectoryInfo info = new DirectoryInfo(FilePath); if (!info.Exists) { info.Create(); } string path = Path.Combine(FilePath, FileName); using (FileStream outputFileStream = new FileStream(path, FileMode.Create)) { stream.CopyTo(outputFileStream); } RD.Dispose(); RD.Close(); string URL = "../../../Download/PrintReport.aspx"; string fullURL = "window.open('" + URL + "', '_blank', 'height=800,width=1000,status=no,toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=yes,titlebar=no');"; ScriptManager.RegisterStartupScript(this, typeof(string), "OPEN_WINDOW", fullURL, true); // convert and show Session["RD"] = RD; }
protected void btnPrint_Click(object sender, EventArgs e) { if (!sec.UserRight("2590", "006")) { Response.Redirect("~/Test.aspx"); } ReportDocument rpt, crReportDocument, RD; PdfDocument outputDocument = new PdfDocument(); string strCriteria, rptTitle; DateTime FromDate, ToDate; SqlDataReader rder; SysFunctions myFunc = new SysFunctions(); Data.DSReports DSReports = new Data.DSReports(); RD = new ReportDocument(); string CCon = CConnection.GetConnectionString(); // PartItemLedger.sp_ItemStockLedger_select.Load(ds.CreateDataReader()); DataSet ds = new DataSet(); //if (txtTransCode.Text.Trim() != "") //{ // ds = SqlHelper.ExecuteDataset(CCon, CommandType.Text, "sp_GatePassMaster_Print '" + this.Session["DealerCode"].ToString() + "','" + txtGatePassCode.Text + "'"); //} //else //{ // ds = SqlHelper.ExecuteDataset(CCon, CommandType.Text, "sp_W2_GatePass_VehicleDetail_Select '" + this.Session["DealerCode"].ToString() + "','" + txtGatePassCode.Text + "'"); //} // QRCodeEncoder encoder = new QRCodeEncoder(); // Bitmap bi = encoder.Encode(ds.Tables[0].Rows[0]["DealerCode"].ToString() + "" + ds.Tables[0].Rows[0]["JobCardCode"].ToString()); // bi.SetPixel(10, 10, Color.Red); // bi.Save(Server.MapPath("~/Images/QrCode.jpg"), System.Drawing.Imaging.ImageFormat.Jpeg); ds = SqlHelper.ExecuteDataset(CCon, CommandType.Text, "_sp_GatePassTempForm '" + this.Session["DealerCode"].ToString() + "','" + txtGatePassCode.Text + "'"); DSReports.EnforceConstraints = false; DSReports._sp_GatePassTempForm.Load(ds.CreateDataReader()); string FileRptPath = Server.MapPath("~/Modules/Service/ServiceReports/"); RD.Load(Server.MapPath("~/Modules/Service/ServiceReports/rptGatePassForm.rpt")); RD.DataDefinition.FormulaFields["DealerName"].Text = "'" + Session["DealerDesc"].ToString() + "'"; RD.DataDefinition.FormulaFields["DealerAddress"].Text = "'" + Session["DealerAddress"].ToString() + "'"; RD.DataDefinition.FormulaFields["DealerPhone"].Text = "'" + Session["DealerPhone"].ToString() + "'"; RD.DataDefinition.FormulaFields["DealerEmail"].Text = "'" + Session["DealerEmail"].ToString() + "'"; RD.DataDefinition.FormulaFields["ReportTitle"].Text = "'Gate Pass'"; RD.DataDefinition.FormulaFields["Terminal"].Text = "'" + Request.ServerVariables["REMOTE_ADDR"].ToString() + "'"; RD.DataDefinition.FormulaFields["UserId"].Text = "'" + Session["UserName"].ToString() + "'"; RD.DataDefinition.FormulaFields["NTN"].Text = "'N.T.N # " + Session["DealerNTN"].ToString() + "'"; RD.DataDefinition.FormulaFields["SalesTaxNo"].Text = "'Sales Tax No. " + Session["DealerSaleTaxNo"].ToString() + " '"; //rpt.DataDefinition.FormulaFields["UserCell"].Text = "'" + GetStringValuesAgainstCodes("CusCode", , "CellNo", "Customer") + "'"; RD.DataDefinition.FormulaFields["CompanyName"].Text = "'" + Session["DealerDesc"].ToString() + "'"; //RD.DataDefinition.FormulaFields["Pic"].Text = "'C:\\Users\\u_ahm\\OneDrive\\Documents\\Visual Studio 2010\\Projects\\WebApplication1\\WebApplication1\\" + Session["Logo"] + "'"; RD.DataDefinition.FormulaFields["Pic"].Text = "'" + Server.MapPath("~") + Session["Logo"] + "'"; RD.DataDefinition.FormulaFields["QRCode"].Text = "'" + Server.MapPath("~") + "/Images/QrCode.jpg'"; //DataTable dt = new DataTable(); //string sql = "Select Logo from Dealer where DealerCode = '" + Session["DealerCode"].ToString() + "'"; //dt = myFunc.GetData(sql); //RD.DataDefinition.FormulaFields["Logo"].Text = "'"+dt.Rows[0]["Logo"].ToString()+"'"; //RD.DataDefinition.FormulaFields["DealershipName"].Text = "'Authorised " + Session["ParentDesc"].ToString() + " Dealership'"; // CrystalReportViewer1.ReportSource = rpt; RD.SetDataSource(DSReports.sp_JobCardMaster_Print.DataSet); string FilePath = Server.MapPath("~") + "\\Download\\"; string FileName = "Report.pdf"; string File = FilePath + FileName; Stream stream = RD.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat); stream.Seek(0, SeekOrigin.Begin); DirectoryInfo info = new DirectoryInfo(FilePath); if (!info.Exists) { info.Create(); } string path = Path.Combine(FilePath, FileName); using (FileStream outputFileStream = new FileStream(path, FileMode.Create)) { stream.CopyTo(outputFileStream); } stream.Dispose(); stream.Close(); string URL = "../../../Download/PrintReport.aspx"; string fullURL = "window.open('" + URL + "', '_blank', 'height=800,width=1000,status=no,toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=yes,titlebar=no');"; ScriptManager.RegisterStartupScript(this, typeof(string), "OPEN_WINDOW", fullURL, true); }
protected void Print(object sender, EventArgs e) { Data.DSReports data = new Data.DSReports(); ReportDocument RD = new ReportDocument(); SysFunction sysFunc = new SysFunction(); DateTime fromDate = DateTime.ParseExact(txtFromDate.Text, "yyyy-MM-dd", null); DateTime toDate = DateTime.ParseExact(txtToDate.Text, "yyyy-MM-dd", null); //string FDate = sysFunc.SaveDate(txtFromDate.Text).ToString(); //string TDate = sysFunc.SaveDate(txtToDate.Text).ToString(); SqlParameter[] param = { new SqlParameter("@DealerCode", SqlDbType.Char), //0 new SqlParameter("@FromDate", SqlDbType.VarChar), //1 new SqlParameter("@ToDate", SqlDbType.VarChar), //2 new SqlParameter("@Satisfied", SqlDbType.Char) }; param[0].Value = Session["DealerCode"].ToString(); param[1].Value = fromDate; param[2].Value = toDate; param[3].Value = ddlStatus.SelectedValue.ToString().Trim(); SqlDataReader rder = null; if (sysFunc.ExecuteSP("sp_PostServiceFollowup_Rpt", param, ref rder)) { data.sp_PostServiceFollowup_Rpt.Load(rder); } RD.Load(Server.MapPath("../PSFReport.rpt")); RD.DataDefinition.FormulaFields["DealerPhone"].Text = "'" + Session["DealerPhone"].ToString() + "'"; RD.DataDefinition.FormulaFields["DealerEmail"].Text = "'" + Session["DealerEmail"].ToString() + "'"; RD.DataDefinition.FormulaFields["DealerFax"].Text = "'" + Session["DealerFax"].ToString() + "'"; RD.DataDefinition.FormulaFields["DealerDesc"].Text = "'" + Session["DealerDesc"].ToString() + "'"; RD.DataDefinition.FormulaFields["DealerAddress"].Text = "'" + Session["DealerAddress"].ToString() + "'"; RD.DataDefinition.FormulaFields["UserId"].Text = "'" + Session["UserID"].ToString() + "'"; RD.DataDefinition.FormulaFields["Terminal"].Text = "'" + Environment.MachineName + "'"; RD.DataDefinition.FormulaFields["ReportTitle"].Text = "\"" + " POST SERVICE FOLLOWUP SUMMARY" + "\""; RD.DataDefinition.FormulaFields["CompanyName"].Text = "'" + Session["DealerDesc"].ToString() + "'"; RD.DataDefinition.FormulaFields["Pic"].Text = "'" + Server.MapPath("~") + Session["Logo"] + "'"; //RD.DataDefinition.FormulaFields["Pic"].Text = "'C:\\Users\\u_ahm\\OneDrive\\Documents\\Visual Studio 2010\\Projects\\WebApplication1\\WebApplication1\\" + Session["Logo"] + "'"; //RD.DataDefinition.FormulaFields["Pic"].Text = "'C:\\Users\\u_ahm\\OneDrive\\Documents\\Visual Studio 2010\\Projects\\WebApplication1\\WebApplication1\\Images\\havoline.png'"; //RD.DataDefinition.FormulaFields["DealershipName"].Text = "'Authorised " + Session["ParentDesc"].ToString() + " Dealership'"; RD.Database.Tables[0].SetDataSource(data); // convert and show string FilePath = Server.MapPath("~") + "\\Download\\"; string FileName = "crtPSF" + this.Session["DealerCode"].ToString() + DateTime.Now.ToString("ddMMyyyy") + ".pdf"; string File = FilePath + FileName; Session["RD"] = RD; //RD.ExportToDisk(ExportFormatType.PortableDocFormat, File); string URL; URL = "../../../../Download/rptViewerService.aspx?FileName=" + FileName; string fullURL = "window.open('" + URL + "', '_blank', 'height=800,width=1200,status=no,toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=yes,titlebar=no');"; ScriptManager.RegisterStartupScript(this, typeof(string), "OPEN_WINDOW", fullURL, true); }
protected void BtnPrint_Click(object sender, EventArgs e) { if (!sec.UserRight("2550", "006")) { Response.Redirect("~/Test.aspx"); } if (ddlSRNO.SelectedIndex == 0) { SysFunc.UserMsg(LbErr, Color.Red, "Select Sales Return number first "); return; } else { LbErr.Text = ""; } ReportDocument RD; Data.DSReports dsRpt1 = new Data.DSReports(); RD = new ReportDocument(); DataSet ds = new DataSet(); ds = SqlHelper.ExecuteDataset(CConnection.GetConnectionString(), CommandType.Text, "sp_SaleReturn_Report '" + Session["DealerCode"].ToString() + "', '" + ddlSRNO.SelectedValue.ToString().Trim() + "'"); dsRpt1.sp_SaleReturn_Report.Load(ds.CreateDataReader()); RD.Load(Server.MapPath("../SpareReports/rptSaleReturnReport.rpt")); RD.DataDefinition.FormulaFields["DealerName"].Text = "'" + Session["DealerDesc"].ToString() + "'"; RD.DataDefinition.FormulaFields["DealerAddress"].Text = "'" + Session["DealerAddress"].ToString() + "'"; RD.DataDefinition.FormulaFields["DealerPhone"].Text = "'" + Session["DealerPhone"].ToString() + "'"; RD.DataDefinition.FormulaFields["DealerEmail"].Text = "'" + Session["DealerEmail"].ToString() + "'"; RD.DataDefinition.FormulaFields["UserID"].Text = "'" + Session["UserName"].ToString() + "'"; //RD.DataDefinition.FormulaFields["FromCode"].Text = "\"" + Convert.ToDateTime(FromDate).ToString("dd/MM/yyyy") + "\""; //RD.DataDefinition.FormulaFields["ToCode"].Text = "\"" + Convert.ToDateTime(ToDate).ToString("dd/MM/yyyy") + "\""; RD.DataDefinition.FormulaFields["NTN"].Text = "'N.T.N # " + Session["DealerNTN"].ToString() + "'"; RD.DataDefinition.FormulaFields["SalesTaxNo"].Text = "'Sales Tax No. " + Session["DealerSaleTaxNo"].ToString() + " '"; RD.DataDefinition.FormulaFields["Terminal"].Text = "'" + Request.ServerVariables["REMOTE_ADDR"].ToString() + "'"; RD.DataDefinition.FormulaFields["ReportTitle"].Text = "\"" + "SALES RETURN" + "\""; RD.DataDefinition.FormulaFields["CompanyName"].Text = "'" + Session["DealerDesc"].ToString() + "'"; //RD.DataDefinition.FormulaFields["Pic"].Text = "'C:\\Users\\u_ahm\\OneDrive\\Documents\\Visual Studio 2010\\Projects\\WebApplication1\\WebApplication1\\" + Session["Logo"] + "'"; RD.DataDefinition.FormulaFields["Pic"].Text = "'" + Server.MapPath("~") + Session["Logo"] + "'"; //RD.DataDefinition.FormulaFields["DealershipName"].Text = "'Authorised " + Session["ParentDesc"].ToString() + " Dealership'"; //RD.SetDataSource(dsrpt.sp_tempItemStockLedger_Select.DataSet); RD.SetDataSource(dsRpt1); string FilePath = Server.MapPath("~") + "\\Download\\"; string FileName = "Report.pdf"; string File = FilePath + FileName; PdfDocument outputDocument = new PdfDocument(); Stream stream = RD.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat); stream.Seek(0, SeekOrigin.Begin); DirectoryInfo info = new DirectoryInfo(FilePath); if (!info.Exists) { info.Create(); } string path = Path.Combine(FilePath, FileName); using (FileStream outputFileStream = new FileStream(path, FileMode.Create)) { stream.CopyTo(outputFileStream); } stream.Dispose(); stream.Close(); RD.Dispose(); RD.Close(); string URL = "../../../Download/PrintReport.aspx"; string fullURL = "window.open('" + URL + "', '_blank', 'height=800,width=1000,status=no,toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=yes,titlebar=no');"; ScriptManager.RegisterStartupScript(this, typeof(string), "OPEN_WINDOW", fullURL, true); //CrystalReportViewer1.ReportSource = RD; //Session["RDSpare"] = RD; //RD.Database.Tables[0].SetDataSource(objDsReports); // crReportDocument = new ReportDocument(); // crReportDocument = RD; // (ReportDocument)Session["RDSpare"]; //string FilePath = Server.MapPath("~") + "\\Download\\"; //string FileName = "SalesReturn" + this.Session["DealerCode"].ToString() + DateTime.Now.ToString("ddMMyyyy") + ".pdf"; //string File = FilePath + FileName; //Session["RD"] = RD; //string URL; //URL = "../../../../Download/rptViewerService.aspx?FileName=" + FileName; ////URL = FilePath + "OpenPdf.aspx?FileName=" + FileName; ////txtPartItemDesc.Text = URL; //string fullURL = "window.open('" + URL + "', '_blank', 'height=800,width=1000,status=no,toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=yes,titlebar=no');"; //ScriptManager.RegisterStartupScript(this, typeof(string), "OPEN_WINDOW", fullURL, true); }
protected void BtnPrint_Click(object sender, EventArgs e) { Data.DSReports data = new Data.DSReports(); ReportDocument RD = new ReportDocument(); SqlParameter[] param = { new SqlParameter("@DealerCode", SqlDbType.Char, 5), //0 new SqlParameter("@FeedBackCode", SqlDbType.Char, 8), //1 }; param[0].Value = Session["DealerCode"].ToString(); param[1].Value = ddlfeedbackNo.SelectedValue.Trim(); SqlDataReader rder = null; // Stored Procedure check and load if (sysFunc.ExecuteSP("SP_FeedBackMaster_Print", param, ref rder)) //Database SP { data.SP_FeedBackMaster_Print.Load(rder); // DataSet SP } // Load in crystal report //RD.Load(Server.MapPath("../PurchaseSaleReturnReport.rpt")); //RD.Load(Server.MapPath("../crtStockAdjustment.rpt")); RD.Load(Server.MapPath("Reports/FeedBackReport.rpt")); // mention paper size RD.PrintOptions.PaperSize = PaperSize.PaperA4; ////RD.Load(Server.MapPath("../../SpareReports/rptInvoices.rpt")); //// RD.Load(Server.MapPath("../rptJobHistory.rpt")); ////RD.DataDefinition.FormulaFields["DealerPhone"].Text = "'" + sysFunc.GetStringValuesAgainstCodes("DealerCode", Session["DealerCode"].ToString(), "Phone1", "Dealer") + "'"; //// RD.DataDefinition.FormulaFields["DealerEmail"].Text = "'" + sysFunc.GetStringValuesAgainstCodes("DealerCode", Session["DealerCode"].ToString(), "Email", "Dealer") + "'"; //RD.DataDefinition.FormulaFields["DealerName"].Text = "'" + sysFunc.GetStringValuesAgainstCodes("DealerCode", Session["DealerCode"].ToString(), "DealerDesc", "Dealer") + "'"; //RD.DataDefinition.FormulaFields["DealerAddress"].Text = "'" + sysFunc.GetStringValuesAgainstCodes("DealerCode", Session["DealerCode"].ToString(), "Address1", "Dealer") + "" + // sysFunc.GetStringValuesAgainstCodes("DealerCode", Session["DealerCode"].ToString(), "Address2", "Dealer") + "" + // sysFunc.GetStringValuesAgainstCodes("DealerCode", Session["DealerCode"].ToString(), "Address3", "Dealer") + " (" + // sysFunc.GetStringValuesAgainstCodes("DealerCode", Session["DealerCode"].ToString(), "Phone1", "Dealer") + ") '"; //RD.DataDefinition.FormulaFields["SalesTaxNo"].Text = "'" + sysFunc.GetStringValuesAgainstCodes("DealerCode", Session["DealerCode"].ToString(), "SaleTaxNo", "Dealer") + "'"; //RD.DataDefinition.FormulaFields["NTN"].Text = "'" + sysFunc.GetStringValuesAgainstCodes("DealerCode", Session["DealerCode"].ToString(), "NTN", "Dealer") + "'"; ////RD.DataDefinition.FormulaFields["UserID"].Text = "'" + Session["UserID"].ToString() + "'"; ////RD.DataDefinition.FormulaFields["FromCode"].Text = "'" + FDate + "'"; ////RD.DataDefinition.FormulaFields["ToCode"].Text = "'" + TDate + "'"; //RD.DataDefinition.FormulaFields["Terminal"].Text = "'" + Environment.MachineName + "'"; //RD.DataDefinition.FormulaFields["ReportTitle"].Text = "\"" + "STOCK ADJUSTMENT REPORT" + "\""; ////RD.DataDefinition.FormulaFields["CompanyName"].Text = "'" + Session["DealerDesc"].ToString() + "'"; ////RD.DataDefinition.FormulaFields["DealershipName"].Text = "'Authorised " + Session["ParentDesc"].ToString() + " Dealership'"; //// RD.DataDefinition.FormulaFields["Pic"].Text = "'C:\\Users\\u_ahm\\OneDrive\\Documents\\Visual Studio 2010\\Projects\\WebApplication1\\WebApplication1\\" + Session["Logo"] + "'"; RD.Database.Tables[0].SetDataSource(data); // convert and show string FilePath = Server.MapPath("~") + "\\Download\\"; string FileName = "FeedBackQuestions" + this.Session["DealerCode"].ToString() + DateTime.Now.ToString("ddMMyyyy") + ".pdf"; string File = FilePath + FileName; RD.ExportToDisk(ExportFormatType.PortableDocFormat, File); string URL; URL = "../../Download/OpenPDF.aspx?FileName=" + FileName; string fullURL = "window.open('" + URL + "', '_blank', 'height=800,width=1000,status=no,toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=yes,titlebar=no');"; ScriptManager.RegisterStartupScript(this, typeof(string), "OPEN_WINDOW", fullURL, true); }