protected void BtnSave_Click(object sender, EventArgs e) { try { //string type = RadioButtonList1.SelectedValue; //Hashtable ht = new Hashtable(); //ht.Add("Source", "CENTRAL"); //ht.Add("Type", RadioButtonList1.SelectedValue); //ht.Add("ProductGroupId", ddlItemGroup.SelectedValue); //ht.Add("ProductId", ddlItemName.SelectedValue); //ht.Add("QtyLessThen", txtQtyless.Text); //DataTable dt = new DataTable(); //dt = rpt.GetStockReportData(ht); //BindReport(dt, type); List <productsDetails> Details = new List <productsDetails>(); if (rdbFullStock.Checked) { if (ddlStoreName.SelectedItem.Text != "---Select---" && txtFrom.Text == "" && txtTo.Text == "") // store wise stock { Details = rpt.Rpt_GetStockBy_Store(ddlStoreName.SelectedValue.ToString()); if (Details.Count > 0) { ReportViewer1.LocalReport.DataSources.Clear(); ReportDataSource reportDataset = new ReportDataSource("AllStockReport_RPT_DS", Details); ReportViewer1.LocalReport.DataSources.Add(reportDataset); ReportViewer1.LocalReport.ReportPath = Server.MapPath("Reports/RPT_AllCentralStockReportBy_Store.rdlc"); ReportViewer1.LocalReport.Refresh(); } else { ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('No data found!')", true); //ReportViewer1.LocalReport.DataSources.Clear(); ReportViewer1.Reset(); ReportViewer1.LocalReport.Refresh(); } } else if (ddlStoreName.SelectedItem.Text != "---Select---" && txtFrom.Text != "" && txtTo.Text != "") // store & date wise stock { string OCode = (((SessionUser)Session["SessionUser"]).OCode); Details = rpt.Rpt_GetFullStockDetailsByDate_WithStore(ddlStoreName.SelectedValue.ToString(), txtFrom.Text, txtTo.Text, OCode); if (Details.Count > 0) { ReportViewer1.LocalReport.DataSources.Clear(); ReportDataSource reportDataset = new ReportDataSource("AllStockReport_RPT_DS", Details); ReportViewer1.LocalReport.DataSources.Add(reportDataset); ReportViewer1.LocalReport.ReportPath = Server.MapPath("Reports/RPT_AllCentralStockReportDateWise_WithStore.rdlc"); ReportViewer1.LocalReport.Refresh(); } else { ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('No data found!')", true); //ReportViewer1.LocalReport.DataSources.Clear(); ReportViewer1.Reset(); ReportViewer1.LocalReport.Refresh(); } } else { if (txtFrom.Text != "" && txtTo.Text != "" && ddlStoreName.SelectedItem.Text == "---Select---") // date wise stock { string OCode = (((SessionUser)Session["SessionUser"]).OCode); Details = rpt.Rpt_GetFullStockDetailsByDate(txtFrom.Text, txtTo.Text, OCode); if (Details.Count > 0) { ReportViewer1.LocalReport.DataSources.Clear(); ReportDataSource reportDataset = new ReportDataSource("AllStockReport_RPT_DS", Details); ReportViewer1.LocalReport.DataSources.Add(reportDataset); ReportViewer1.LocalReport.ReportPath = Server.MapPath("Reports/RPT_AllCentralStockReportDateWise.rdlc"); ReportViewer1.LocalReport.Refresh(); } else { ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('No data found!')", true); //ReportViewer1.LocalReport.DataSources.Clear(); ReportViewer1.Reset(); ReportViewer1.LocalReport.Refresh(); } } else { Details = rpt.Rpt_GetFullStock(); // without date stock if (Details.Count > 0) { ReportViewer1.LocalReport.DataSources.Clear(); ReportDataSource reportDataset = new ReportDataSource("AllStockReport_RPT_DS", Details); ReportViewer1.LocalReport.DataSources.Add(reportDataset); ReportViewer1.LocalReport.ReportPath = Server.MapPath("Reports/RPT_AllCentralStockReport.rdlc"); ReportViewer1.LocalReport.Refresh(); } else { ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('No data found!')", true); //ReportViewer1.LocalReport.DataSources.Clear(); ReportViewer1.Reset(); ReportViewer1.LocalReport.Refresh(); } } } } else if (rdbBySpecificItemGroup.Checked) { if (ddlStoreName.SelectedItem.Text != "---Select---" && ddlItemGroup.SelectedItem.Text != "---Select---" && ddlItemName.SelectedItem.Text == "---Select---" && txtFrom.Text == "" && txtTo.Text == "") { Details = rpt.Rpt_GetStockBy_Store_ProductGroup(ddlStoreName.SelectedValue.ToString(), ddlItemGroup.SelectedValue.ToString()); if (Details.Count > 0) { ReportViewer1.LocalReport.DataSources.Clear(); ReportDataSource reportDataset = new ReportDataSource("AllStockReport_RPT_DS", Details); ReportViewer1.LocalReport.DataSources.Add(reportDataset); ReportViewer1.LocalReport.ReportPath = Server.MapPath("Reports/RPT_AllCentralStockReportBy_Store_ProductGroup.rdlc"); ReportViewer1.LocalReport.Refresh(); } else { ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('No data found!')", true); //ReportViewer1.LocalReport.DataSources.Clear(); ReportViewer1.Reset(); ReportViewer1.LocalReport.Refresh();; } } else if (ddlStoreName.SelectedItem.Text != "---Select---" && ddlItemGroup.SelectedItem.Text != "---Select---" && ddlItemName.SelectedItem.Text == "---Select---" && txtFrom.Text != "" && txtTo.Text != "") { string OCode = (((SessionUser)Session["SessionUser"]).OCode); Details = rpt.Rpt_GetFullStockDetailsByDate_Group_WithStore(ddlStoreName.SelectedValue.ToString(), txtFrom.Text, txtTo.Text, OCode, ddlItemGroup.SelectedValue.ToString()); if (Details.Count > 0) { ReportViewer1.LocalReport.DataSources.Clear(); ReportDataSource reportDataset = new ReportDataSource("AllStockReport_RPT_DS", Details); ReportViewer1.LocalReport.DataSources.Add(reportDataset); ReportViewer1.LocalReport.ReportPath = Server.MapPath("Reports/RPT_AllCentralStockReportDateWise_Group_WithStore.rdlc"); ReportViewer1.LocalReport.Refresh(); } else { ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('No data found!')", true); //ReportViewer1.LocalReport.DataSources.Clear(); ReportViewer1.Reset(); ReportViewer1.LocalReport.Refresh();; } } else if (ddlItemGroup.SelectedItem.Text != "---Select---" && ddlItemName.SelectedItem.Text == "---Select---" && txtFrom.Text != "" && txtTo.Text != "") { string OCode = (((SessionUser)Session["SessionUser"]).OCode); Details = rpt.Rpt_GetFullStockDetailsByDate_Group(txtFrom.Text, txtTo.Text, OCode, ddlItemGroup.SelectedValue.ToString()); if (Details.Count > 0) { ReportViewer1.LocalReport.DataSources.Clear(); ReportDataSource reportDataset = new ReportDataSource("AllStockReport_RPT_DS", Details); ReportViewer1.LocalReport.DataSources.Add(reportDataset); ReportViewer1.LocalReport.ReportPath = Server.MapPath("Reports/RPT_AllCentralStockReportDateWise_Group.rdlc"); ReportViewer1.LocalReport.Refresh(); } else { ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('No data found!')", true); //ReportViewer1.LocalReport.DataSources.Clear(); ReportViewer1.Reset(); ReportViewer1.LocalReport.Refresh();; } } } else if (rdbBySpecificItem.Checked) { if (ddlStoreName.SelectedItem.Text != "---Select---" && ddlItemGroup.SelectedItem.Text != "---Select---" && ddlItemName.SelectedItem.Text != "---Select---" && txtFrom.Text == "" && txtTo.Text == "") { Details = rpt.Rpt_GetStockBy_Store_Product(ddlStoreName.SelectedValue.ToString(), ddlItemGroup.SelectedValue.ToString(), ddlItemName.SelectedValue.ToString()); if (Details.Count > 0) { ReportViewer1.LocalReport.DataSources.Clear(); ReportDataSource reportDataset = new ReportDataSource("AllStockReport_RPT_DS", Details); ReportViewer1.LocalReport.DataSources.Add(reportDataset); ReportViewer1.LocalReport.ReportPath = Server.MapPath("Reports/RPT_AllCentralStockReportBy_Store_Product.rdlc"); ReportViewer1.LocalReport.Refresh(); } else { ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('No data found!')", true); //ReportViewer1.LocalReport.DataSources.Clear(); ReportViewer1.Reset(); ReportViewer1.LocalReport.Refresh(); } } else if (ddlStoreName.SelectedItem.Text != "---Select---" && ddlItemGroup.SelectedItem.Text != "---Select---" && ddlItemName.SelectedItem.Text != "---Select---" && txtFrom.Text != "" && txtTo.Text != "") { string OCode = (((SessionUser)Session["SessionUser"]).OCode); Details = rpt.Rpt_GetFullStockDetailsByDate_Product_WithStore(txtFrom.Text, txtTo.Text, OCode, ddlItemGroup.SelectedValue.ToString(), ddlItemName.SelectedValue.ToString(), ddlStoreName.SelectedValue.ToString()); if (Details.Count > 0) { ReportViewer1.LocalReport.DataSources.Clear(); ReportDataSource reportDataset = new ReportDataSource("AllStockReport_RPT_DS", Details); ReportViewer1.LocalReport.DataSources.Add(reportDataset); ReportViewer1.LocalReport.ReportPath = Server.MapPath("Reports/RPT_AllCentralStockReportDateWise_Product_WithStore.rdlc"); ReportViewer1.LocalReport.Refresh(); } else { ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('No data found!')", true); //ReportViewer1.LocalReport.DataSources.Clear(); ReportViewer1.Reset(); ReportViewer1.LocalReport.Refresh(); } } else if (ddlStoreName.SelectedItem.Text == "---Select---" && ddlItemGroup.SelectedItem.Text != "---Select---" && ddlItemName.SelectedItem.Text != "---Select---" && txtFrom.Text != "" && txtTo.Text != "") { string OCode = (((SessionUser)Session["SessionUser"]).OCode); Details = rpt.Rpt_GetFullStockDetailsByDate_Product(txtFrom.Text, txtTo.Text, OCode, ddlItemGroup.SelectedValue.ToString(), ddlItemName.SelectedValue.ToString()); if (Details.Count > 0) { ReportViewer1.LocalReport.DataSources.Clear(); ReportDataSource reportDataset = new ReportDataSource("AllStockReport_RPT_DS", Details); ReportViewer1.LocalReport.DataSources.Add(reportDataset); ReportViewer1.LocalReport.ReportPath = Server.MapPath("Reports/RPT_AllCentralStockReportDateWise_Product.rdlc"); ReportViewer1.LocalReport.Refresh(); } else { ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('No data found!')", true); //ReportViewer1.LocalReport.DataSources.Clear(); ReportViewer1.Reset(); ReportViewer1.LocalReport.Refresh(); } } } else if (rdbItemDetailByDate.Checked == true) { if (ddlStoreName.SelectedItem.Text != "---Select---" && ddlItemGroup.SelectedItem.Text != "---Select---" && ddlItemName.SelectedItem.Text != "---Select---" && txtFrom.Text != "" && txtTo.Text != "") { string OCode = (((SessionUser)Session["SessionUser"]).OCode); Guid userId = (((SessionUser)Session["SessionUser"]).UserId); Details = rpt.Rpt_GetFullStockDetailsByDate_Product_Store(txtFrom.Text, txtTo.Text, OCode, ddlItemGroup.SelectedValue.ToString(), ddlItemName.SelectedValue.ToString(), ddlStoreName.SelectedValue.ToString(), userId); if (Details.Count > 0) { ReportViewer1.LocalReport.DataSources.Clear(); ReportDataSource reportDataset = new ReportDataSource("AllStockReport_RPT_DS", Details); ReportViewer1.LocalReport.DataSources.Add(reportDataset); ReportViewer1.LocalReport.ReportPath = Server.MapPath("Reports/RPT_AllCentralStockReportDateWise_Product_Store.rdlc"); ReportViewer1.LocalReport.Refresh(); } else { ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('No data found!')", true); //ReportViewer1.LocalReport.DataSources.Clear(); ReportViewer1.Reset(); ReportViewer1.LocalReport.Refresh(); } } else { ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Select information for search!')", true); } } else if (btnByQtyLessThan.Checked) { if (ddlStoreName.SelectedItem.Text != "---Select---" && txtQtyless.Text != "") { Details = rpt.Rpt_GetStockBy_Store_LessThanQty(ddlStoreName.SelectedValue.ToString(), Convert.ToInt32(txtQtyless.Text)); if (Details.Count > 0) { ReportViewer1.LocalReport.DataSources.Clear(); ReportDataSource reportDataset = new ReportDataSource("AllStockReport_RPT_DS", Details); ReportViewer1.LocalReport.DataSources.Add(reportDataset); ReportViewer1.LocalReport.ReportPath = Server.MapPath("Reports/RPT_AllCentralStockReportBy_Store_LessThenQty.rdlc"); ReportViewer1.LocalReport.Refresh(); } else { ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('No data found!')", true); // ReportViewer1.LocalReport.DataSources.Clear(); ReportViewer1.Reset(); ReportViewer1.LocalReport.Refresh(); } } else { ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Search The Operation !')", true); } } else if (btnLessThenReOrder.Checked) { if (ddlStoreName.SelectedItem.Text != "---Select---") { Details = rpt.Rpt_GetStockBy_Store_ReOrderQty(ddlStoreName.SelectedValue.ToString()); if (Details.Count > 0) { ReportViewer1.LocalReport.DataSources.Clear(); ReportDataSource reportDataset = new ReportDataSource("AllStockReport_RPT_DS", Details); ReportViewer1.LocalReport.DataSources.Add(reportDataset); ReportViewer1.LocalReport.ReportPath = Server.MapPath("Reports/RPT_AllCentralStockReportBy_Store_LessThenQty.rdlc"); ReportViewer1.LocalReport.Refresh(); } else { ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('No data found!')", true); ReportViewer1.Reset(); ReportViewer1.LocalReport.Refresh(); } } else { ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('Search The Operation !')", true); } } } catch (Exception ex) { ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('" + ex.Message + "')", true); } }