public void save() { SqlCommand cmd = new SqlCommand(); DataSet dsReport = new ChallanDataSet(); DataSet ds = new DataSet(); cmd = new SqlCommand(); cmd.CommandText = "sp_ChallanInwardSummary"; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("BranchId", Globals.BranchID); dsReport = PrjClass.GetData(cmd); ds = PrjClass.GetData(cmd); grdTmp.DataSource = ds; grdTmp.DataBind(); if (dsReport.Tables[0].Rows.Count > 0) { ReportViewer1.Visible = true; } ReportViewer1.LocalReport.ReportPath = "RDLC/ChallanInward.rdlc"; ReportDataSource rds = new ReportDataSource(); rds.Name = "ChallanInwardDataSet"; ReportParameter[] parameters = new ReportParameter[2]; //parameters[0] = new ReportParameter("FDate", Request.QueryString["Date"].ToString()); //parameters[1] = new ReportParameter("UDate", Request.QueryString["Date1"].ToString()); parameters[0] = new ReportParameter("details", lblStoreName.Text); parameters[1] = new ReportParameter("Quantity", lblQuantity.Text); ReportViewer1.LocalReport.SetParameters(parameters); rds.Value = dsReport.Tables[0]; ReportViewer1.LocalReport.DataSources.Clear(); ReportViewer1.LocalReport.DataSources.Add(rds); ReportViewer1.LocalReport.Refresh(); }
protected void Page_Load(object sender, EventArgs e) { if (Page.IsPostBack) { return; } var forEdit = (Request.QueryString["ForInput"] ?? "").ToString(); var rateListName = (Request.QueryString["RateListName"] ?? "Default").ToString(); lblRateListName.Text = rateListName + " Rate List"; if (forEdit == string.Empty || forEdit == "false") { hdnForEdit.Value = ""; btnSave.Visible = false; btnExport.Visible = true; } else if (forEdit == "true") { hdnForEdit.Value = "true"; btnExport.Visible = false; } var rateListId = (Request.QueryString["RateListId"] ?? "0").ToString(); var ds = new DataSet(); var cmd = new SqlCommand(); DataSet dsReport = new ChallanDataSet(); cmd = new SqlCommand(); cmd.CommandText = "sp_ItemWiseRate"; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@BranchId", Globals.BranchID); cmd.Parameters.AddWithValue("@RateListId", rateListId); dsReport = PrjClass.GetData(cmd); // ds = PrjClass.GetData(cmd); ds = dsReport; grdDetails.DataSource = dsReport; grdDetails.DataBind(); SetTheProcesses(); status = BAL.BALFactory.Instance.BAL_Profession.SetButtonAccordingMenuRights(Globals.BranchID, SpecialAccessRightName.PrintRateList, Session["UserType"].ToString()); if (status == "True") { btnExport.Visible = true; } else { btnExport.Visible = false; } }
public DataSet GetDataForExcel() { var rateListId1 = (Request.QueryString["RateListId"] ?? "0").ToString(); var ds = new DataSet(); var cmd = new SqlCommand(); DataSet dsReport = new ChallanDataSet(); cmd = new SqlCommand(); cmd.CommandText = "sp_ItemWiseRate_new"; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@BranchId", Globals.BranchID); cmd.Parameters.AddWithValue("@RateListId", rateListId1); dsReport = PrjClass.GetData(cmd); return(dsReport); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Request.QueryString["Challan"] == null || Request.QueryString["Challan"] == "") { Response.Redirect(FormsAuthentication.DefaultUrl, false); } DataSet ds = new DataSet(); SqlCommand cmd = new SqlCommand(); DataSet dsReport = new ChallanDataSet(); cmd = new SqlCommand(); cmd.CommandText = "sp_FactoryChallanSummary"; cmd.CommandType = CommandType.StoredProcedure; string st1 = Request.QueryString["Challan"].ToString(); string st2 = Request.QueryString["Branch"].ToString(); cmd.Parameters.AddWithValue("ChallanNo", Request.QueryString["Challan"].ToString()); cmd.Parameters.AddWithValue("BranchId", Request.QueryString["Branch"].ToString()); dsReport = PrjClass.GetData(cmd); ds = PrjClass.GetData(cmd); ReportViewer1.LocalReport.ReportPath = "RDLC/ChallanSFReport.rdlc"; ReportDataSource rds = new ReportDataSource(); rds.Name = "ChallanDataSet_sp_Challan"; ReportParameter[] parameters = new ReportParameter[2]; if (ds.Tables[1].Rows.Count > 0) { for (int i = 0; i < ds.Tables[1].Rows.Count; i++) { lblStoreName.Text += ds.Tables[1].Rows[i]["Item"].ToString(); } lblQuantity.Text += ds.Tables[2].Rows[0]["QTY"].ToString(); } parameters[0] = new ReportParameter("details", lblStoreName.Text); parameters[1] = new ReportParameter("Qty", lblQuantity.Text); ReportViewer1.LocalReport.SetParameters(parameters); rds.Value = dsReport.Tables[0]; ReportViewer1.LocalReport.DataSources.Clear(); ReportViewer1.LocalReport.DataSources.Add(rds); ReportViewer1.LocalReport.Refresh(); } }
protected void Page_Load(object sender, EventArgs e) { hdnPrintValue.Value = BAL.BALFactory.Instance.BAL_New_Bookings.FindDefaultPrinter(Globals.BranchID); if (!IsPostBack) { if (Request.QueryString["Date"] == null || Request.QueryString["Date"] == "" || Request.QueryString["Date1"] == null || Request.QueryString["Date1"] == "" || Request.QueryString["Challan"] == null || Request.QueryString["Challan"] == "") { Response.Redirect(FormsAuthentication.DefaultUrl, false); } if (Request.QueryString["DirectPrint"] != null && Request.QueryString["DirectPrint"].ToString() == "true") { hdnDirectPrint.Value = "true"; } if (Request.QueryString["CloseWindow"] != null && Request.QueryString["CloseWindow"].ToString() == "true") { hdnCloseWindow.Value = "true"; } if (Request.QueryString["RedirectBack"] != null && Request.QueryString["RedirectBack"].ToString() != string.Empty) { hdnRedirectBack.Value = Request.QueryString["RedirectBack"].ToString(); } DataSet ds = new DataSet(); SqlCommand cmd = new SqlCommand(); DataSet dsReport = new ChallanDataSet(); cmd = new SqlCommand(); cmd.CommandText = "sp_ChallanSummary"; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("ChallanNo", Request.QueryString["Challan"].ToString()); cmd.Parameters.AddWithValue("BranchId", Globals.BranchID); dsReport = PrjClass.GetData(cmd); ds = PrjClass.GetData(cmd); string FactoryName = string.Empty, Factory = string.Empty; FactoryName = BAL.BALFactory.Instance.BL_Branch.GetWorkShopName(Globals.BranchID, Request.QueryString["Challan"].ToString()); if (FactoryName == "") { Factory = ""; } else { Factory = "WorkShop"; } ReportViewer1.LocalReport.ReportPath = "RDLC/ChallanSReport.rdlc"; ReportDataSource rds = new ReportDataSource(); rds.Name = "ChallanDataSet_sp_Challan"; ReportParameter[] parameters = new ReportParameter[6]; parameters[0] = new ReportParameter("FDate", Request.QueryString["Date"].ToString()); parameters[1] = new ReportParameter("UDate", Request.QueryString["Date1"].ToString()); if (ds.Tables[1].Rows.Count > 0) { for (int i = 0; i < ds.Tables[1].Rows.Count; i++) { lblStoreName.Text += ds.Tables[1].Rows[i]["Item"].ToString(); } lblQuantity.Text += ds.Tables[2].Rows[0]["QTY"].ToString(); } parameters[2] = new ReportParameter("details", lblStoreName.Text); parameters[3] = new ReportParameter("Qty", lblQuantity.Text); parameters[4] = new ReportParameter("FactoryName", FactoryName); parameters[5] = new ReportParameter("Factory", Factory); ReportViewer1.LocalReport.SetParameters(parameters); rds.Value = dsReport.Tables[0]; ReportViewer1.LocalReport.DataSources.Clear(); ReportViewer1.LocalReport.DataSources.Add(rds); ReportViewer1.LocalReport.Refresh(); string reportType = "PDF"; string mimeType; string encoding; string fileNameExtension; string deviceInfo = "<DeviceInfo>" + " <OutputFormat>PDF</OutputFormat>" + " <PageWidth>8.5in</PageWidth>" + " <PageHeight>11in</PageHeight>" + " <MarginTop>0.2in</MarginTop>" + " <MarginLeft>0.2in</MarginLeft>" + " <MarginRight>0.5in</MarginRight>" + " <MarginBottom>0.2in</MarginBottom>" + "</DeviceInfo>"; Warning[] warnings; string[] streams; byte[] renderedBytes; renderedBytes = ReportViewer1.LocalReport.Render( reportType, deviceInfo, out mimeType, out encoding, out fileNameExtension, out streams, out warnings); Response.Clear(); Response.ContentType = mimeType; Response.BinaryWrite(renderedBytes); // probably won't work if (Request.QueryString["DirectPrint"] != null && Request.QueryString["DirectPrint"].ToString() == "true") { var redirectURL = Request.QueryString["RedirectBack"] as string; if (redirectURL != null) { OpenNewWindow(redirectURL); } } Response.End(); if (Request.QueryString["DirectPrint"] != null && Request.QueryString["DirectPrint"].ToString() == "true") { hdnDirectPrint.Value = "true"; ImgPrintButton_Click(null, EventArgs.Empty); } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { CheckReport = "2"; DataSet ds = new DataSet(); SqlCommand cmd = new SqlCommand(); DataSet dsReport = new ChallanDataSet(); cmd = new SqlCommand(); cmd.CommandText = "Sp_InvoiceWithItemDetails"; cmd.CommandType = CommandType.StoredProcedure; if (Request.QueryString["Bookings"] != null) { if (!string.IsNullOrEmpty(Request.QueryString["Bookings"].ToString())) { cmd.Parameters.AddWithValue("@Bookings", Request.QueryString["Bookings"].ToString()); cmd.Parameters.AddWithValue("@BranchId", Globals.BranchID); cmd.Parameters.AddWithValue("@Flag", 2); } } else { if (Request.QueryString["Date"] == null || Request.QueryString["Date"] == "" || Request.QueryString["Date1"] == null || Request.QueryString["Date1"] == "" || Request.QueryString["Challan"] == null || Request.QueryString["Challan"] == "") { Response.Redirect(FormsAuthentication.DefaultUrl, false); } if (Request.QueryString["Date"] == null || Request.QueryString["Date"] == "" || Request.QueryString["Date1"] == null || Request.QueryString["Date1"] == "" || Request.QueryString["Challan"] == null || Request.QueryString["Challan"] == "") { Response.Redirect(FormsAuthentication.DefaultUrl, false); } if (Request.QueryString["DirectPrint"] != null && Request.QueryString["DirectPrint"].ToString() == "true") { hdnDirectPrint.Value = "true"; } if (Request.QueryString["CloseWindow"] != null && Request.QueryString["CloseWindow"].ToString() == "true") { hdnCloseWindow.Value = "true"; } if (Request.QueryString["RedirectBack"] != null && Request.QueryString["RedirectBack"].ToString() != string.Empty) { hdnRedirectBack.Value = Request.QueryString["RedirectBack"].ToString(); } cmd.Parameters.AddWithValue("@ChallanNo", Request.QueryString["Challan"].ToString()); cmd.Parameters.AddWithValue("@BranchId", Globals.BranchID); } //hdnPrinterName.Value = BAL.BALFactory.Instance.BAL_New_Bookings.FindDefaultPrinter(Globals.BranchID); dsReport = PrjClass.GetData(cmd); ds = PrjClass.GetData(cmd); string FactoryName = string.Empty, Factory = string.Empty; if (Request.QueryString["Challan"] != null) { CheckReport = "1"; FactoryName = BAL.BALFactory.Instance.BL_Branch.GetWorkShopName(Globals.BranchID, Request.QueryString["Challan"].ToString()); if (FactoryName == "") { Factory = ""; } } else { Factory = "WorkShop"; } if (CheckReport != "2") { ReportViewer1.LocalReport.ReportPath = "RDLC/InvoicewithItemDetail.rdlc"; } else { ReportViewer1.LocalReport.ReportPath = "RDLC/BookingWithItemDetails.rdlc"; } ReportDataSource rds = new ReportDataSource(); rds.Name = "DataSet1"; bool rights = AppClass.GetShowFooterRightsUser(); string rvalue = string.Empty; if (rights == true) { rvalue = "1"; } else { rvalue = "0"; } ReportParameter[] parameters = new ReportParameter[9]; parameters[0] = new ReportParameter("FDate", (Request.QueryString["Date"] ?? "").ToString()); parameters[1] = new ReportParameter("UDate", (Request.QueryString["Date1"] ?? "").ToString()); if (ds.Tables[1].Rows.Count > 0) { for (int i = 0; i < ds.Tables[1].Rows.Count; i++) { lblStoreName.Text += ds.Tables[1].Rows[i]["Item"].ToString(); } lblQuantity.Text += ds.Tables[2].Rows[0]["QTY"].ToString(); } string res = BAL.BALFactory.Instance.BAL_RemoveReason.GetDateTime(Globals.BranchID); parameters[2] = new ReportParameter("details", lblStoreName.Text); parameters[3] = new ReportParameter("Qty", lblQuantity.Text); parameters[4] = new ReportParameter("Factoryname", FactoryName); parameters[5] = new ReportParameter("Factory", Factory); parameters[6] = new ReportParameter("UserName", Globals.UserName); parameters[7] = new ReportParameter("GeneratedDate", "@" + " " + DateTime.Today.ToString("dd MMM yyyy") + " " + res); parameters[8] = new ReportParameter("TotalFooter", rvalue); ReportViewer1.LocalReport.SetParameters(parameters); rds.Value = dsReport.Tables[0]; ReportViewer1.LocalReport.DataSources.Clear(); ReportViewer1.LocalReport.DataSources.Add(rds); ReportViewer1.LocalReport.Refresh(); string reportType = "PDF"; string mimeType; string encoding; string fileNameExtension; string deviceInfo = "<DeviceInfo>" + " <OutputFormat>PDF</OutputFormat>" + " <PageWidth>9.0in</PageWidth>" + " <PageHeight>11in</PageHeight>" + " <MarginTop>0.3in</MarginTop>" + " <MarginLeft>0.5in</MarginLeft>" + " <MarginRight>0.4in</MarginRight>" + " <MarginBottom>0.2in</MarginBottom>" + "</DeviceInfo>"; Warning[] warnings; string[] streams; byte[] renderedBytes; renderedBytes = ReportViewer1.LocalReport.Render( reportType, deviceInfo, out mimeType, out encoding, out fileNameExtension, out streams, out warnings); Response.Clear(); Response.ContentType = mimeType; Response.BinaryWrite(renderedBytes); if (Request.QueryString["DirectPrint"] != null && Request.QueryString["DirectPrint"].ToString() == "true") { var redirectURL = Request.QueryString["RedirectBack"] as string; if (redirectURL != null) { OpenNewWindow(redirectURL); } } Response.End(); if (Request.QueryString["DirectPrint"] != null && Request.QueryString["DirectPrint"].ToString() == "true") { hdnDirectPrint.Value = "true"; ImgPrintButton_Click(null, EventArgs.Empty); } } }