public void ReportGrid(string RepCondition) { try { DS = Obj_PR.GetPriority(RepCondition, out StrError); if (DS.Tables.Count > 0 && DS.Tables[0].Rows.Count > 0) { GrdReport.DataSource = DS.Tables[0]; GrdReport.DataBind(); } else { GrdReport.DataSource = null; GrdReport.DataBind(); } Obj_PR = null; DS = null; } catch (Exception ex) { throw new Exception(ex.Message); } }
private void ReportGrid(string RepCondition) { try { DS = Obj_PM.GetProjectTypeList(RepCondition, out StrError); if (DS.Tables.Count > 0 && DS.Tables[0].Rows.Count > 0) { GrdReport.DataSource = DS; GrdReport.DataBind(); } else { GrdReport.DataSource = null; GrdReport.DataBind(); } //Obj_PM = null; DS = null; } catch (Exception ex) { throw new Exception(ex.Message); } }
public void ReportGrid(string RepCondition) { try { DS = Obj_IS.GetSubCategory(RepCondition, out StrError); if (DS.Tables.Count > 0 && DS.Tables[0].Rows.Count > 0) { GrdReport.DataSource = DS.Tables[0]; GrdReport.DataBind(); } else { GrdReport.DataSource = null; GrdReport.DataBind(); } if (DS.Tables.Count > 0 && DS.Tables[1].Rows.Count > 0) { ddlCategory.DataSource = DS.Tables[1]; ddlCategory.DataValueField = "CategoryId"; ddlCategory.DataTextField = "CategoryName"; ddlCategory.DataBind(); } else { ddlCategory.DataSource = null; ddlCategory.DataBind(); } ddlCategory.SelectedIndex = 0; Obj_IS = null; DS = null; } catch (Exception ex) { StrError = ex.Message; } }
protected void GrdReport_PageIndexChanging(object sender, GridViewPageEventArgs e) { try { this.GrdReport.PageIndex = e.NewPageIndex; DataSet DS = new DataSet(); StrCondition = string.Empty; string FromDate = string.Empty; string ToDate = string.Empty; if (ChkFrmDate.Checked == true) { FromDate = Convert.ToDateTime(txtFromDate.Text).ToString("MM-dd-yyyy"); ToDate = Convert.ToDateTime(txtToDate.Text).ToString("MM-dd-yyyy"); } else { FromDate = Convert.ToDateTime("01-01-1975").ToString("MM-dd-yyyy"); ToDate = DateTime.Now.ToString("MM-dd-yyyy"); } if (Convert.ToInt32(ddlCategory.SelectedValue) > 0) { StrCondition = StrCondition + " and IC.CategoryId=" + Convert.ToInt32(ddlCategory.SelectedValue); } if (Convert.ToInt32(ddlItemName.SelectedValue) > 0) { StrCondition = StrCondition + " and IM.ItemId=" + Convert.ToInt32(ddlItemName.SelectedValue); } if (Convert.ToInt32(ddlLocation.SelectedValue) > 0) { StrCondition = StrCondition + " and SL.StockLocationID=" + Convert.ToInt32(ddlLocation.SelectedValue); } if (Convert.ToInt32(ddlUnit.SelectedValue) > 0) { StrCondition = StrCondition + " and UM.UnitId=" + Convert.ToInt32(ddlUnit.SelectedValue); } if (RDO_FromTo.Checked == true) { //StrCondition = StrCondition + " and (SD.ProductMRP >=" + Convert.ToDecimal(txtFromRate.Text); //StrCondition = StrCondition + " and SD.ProductMRP >=" + Convert.ToDecimal(txtToRate.Text) + ") "; StrCondition = StrCondition + StrRateCondition; } if (RDO_GreaterThenEqualTo.Checked == true) { //StrCondition = StrCondition + " and SD.ProductMRP >=" + Convert.ToDecimal(txtGreaterRate.Text); StrCondition = StrCondition + StrRateCondition; } if (RDO_LessThenEqualTo.Checked == true) { //StrCondition = StrCondition + " and SD.ProductMRP <=" + Convert.ToDecimal(txtLessRate.Text); StrCondition = StrCondition + StrRateCondition; } if (RDO_EqualTo.Checked == true) { //StrCondition = StrCondition + " and SD.ProductMRP =" + Convert.ToDecimal(txtEqualRate.Text); StrCondition = StrCondition + StrRateCondition; } DsGrd = Obj_Reports.ConsumptionReport(FromDate, ToDate, StrCondition, out StrError); if (DsGrd.Tables.Count > 0 && DsGrd.Tables[0].Rows.Count > 0) { GrdReport.DataSource = DsGrd.Tables[0]; GrdReport.DataBind(); lblCount.Text = DsGrd.Tables[0].Rows.Count + " Records Found"; lblCount.Visible = true; } else { GrdReport.DataSource = null; GrdReport.DataBind(); lblCount.Text = DsGrd.Tables[0].Rows.Count + " Records Found"; lblCount.Visible = true; SetInitialRow(); } } catch (Exception ex) { throw new Exception(ex.Message); } }
protected void GrdReport_PageIndexChanging(object sender, GridViewPageEventArgs e) { try { this.GrdReport.PageIndex = e.NewPageIndex; DataSet DS = new DataSet(); StrCondition = string.Empty; if (ChkFrmDate.Checked == true) { StrCondition = StrCondition + " and PO.PODate between'" + Convert.ToDateTime(txtFromDate.Text).ToString("MM-dd-yyyy") + "'And'" + Convert.ToDateTime(txtToDate.Text).ToString("MM-dd-yyyy") + "'"; } else { StrCondition = StrCondition + "and PO.PODate between '01-01-1975' AND '" + DateTime.Now.ToString("MM-dd-yyyy") + "'"; } if (Convert.ToInt32(ddlPurchaseNo.SelectedValue) > 0) { StrCondition = StrCondition + " and PO.POId=" + Convert.ToInt32(ddlPurchaseNo.SelectedValue); } if (Convert.ToInt32(ddlInwardNo.SelectedValue) > 0) { StrCondition = StrCondition + " and IR.InwardId=" + Convert.ToInt32(ddlInwardNo.SelectedValue); } #region [LOCATION] if (Convert.ToInt32(ddlSite.SelectedValue) > 0) { StrCondition = StrCondition + " and SL.StockLocationID=" + Convert.ToInt32(ddlSite.SelectedValue); } else { for (int i = 1; i < ddlSite.Items.Count; i++) { if (i == 1) { if (Convert.ToInt32(ddlSite.Items[i].Value) != 0) { StrCondition += " and (SL.StockLocationID = " + Convert.ToInt32(ddlSite.Items[i].Value); } } else { if (Convert.ToInt32(ddlSite.Items[i].Value) != 0) { StrCondition += " or SL.StockLocationID = " + Convert.ToInt32(ddlSite.Items[i].Value); } } if (i == ddlSite.Items.Count - 1) { if (Convert.ToInt32(ddlSite.Items[i].Value) != 0) { StrCondition += " )"; } } } } //} #endregion DsGrd = Obj_PO.GetPOForDetailReport(StrCondition, out StrError); if (DsGrd.Tables.Count > 0 && DsGrd.Tables[0].Rows.Count > 0) { ImgBtnPrint.Visible = true; ImgBtnExport.Visible = true; GrdReport.DataSource = DsGrd.Tables[0]; GrdReport.DataBind(); lblCount.Text = DsGrd.Tables[0].Rows.Count + " Records Found"; lblCount.Visible = true; } else { GrdReport.DataSource = null; GrdReport.DataBind(); lblCount.Text = DsGrd.Tables[0].Rows.Count + " Records Found"; lblCount.Visible = true; SetInitialRow(); } } catch (Exception ex) { throw new Exception(ex.Message); } }
private void ReportGrid(string StrCondition) { try { if (rdoPOSTATUSWISE.SelectedValue == "0") { DsGrd = Obj_PO.GetPOForStatusReport(StrCondition, out StrError); if (DsGrd.Tables.Count > 0 && DsGrd.Tables[0].Rows.Count > 0) { if (!FlagPrint) { ImgBtnPrint.Visible = true; } if (!FlagPrint) { ImgBtnExport.Visible = true; } GrdReport.DataSource = DsGrd.Tables[0]; GrdReport.DataBind(); lblCount.Text = DsGrd.Tables[0].Rows.Count + " Records Found"; lblCount.Visible = true; } else { GrdReport.DataSource = null; GrdReport.DataBind(); lblCount.Text = DsGrd.Tables[0].Rows.Count + " Records Found"; lblCount.Visible = true; SetInitialRow(); } } else { DsGrd = Obj_PO.GetPOForStatusReportOS(StrCondition, out StrError); if (DsGrd.Tables.Count > 0 && DsGrd.Tables[0].Rows.Count > 0) { if (!FlagPrint) { ImgBtnPrint.Visible = true; } if (!FlagPrint) { ImgBtnExport.Visible = true; } GRDOUTSTANDINGPO.DataSource = DsGrd.Tables[0]; GRDOUTSTANDINGPO.DataBind(); lblCount.Text = DsGrd.Tables[0].Rows.Count + " Records Found"; lblCount.Visible = true; } else { GRDOUTSTANDINGPO.DataSource = null; GRDOUTSTANDINGPO.DataBind(); lblCount.Text = DsGrd.Tables[0].Rows.Count + " Records Found"; lblCount.Visible = true; SetInitialRowGRDOUTSTANDINGPO(); } } } catch (Exception ex) { throw new Exception(ex.Message); } }
private void ReportGrid() { try { DataSet DsGrid = new DataSet(); StrCondition = string.Empty; string FromDate = string.Empty; string ToDate = string.Empty; string FromDateCheck = string.Empty; string ToDateCheck = string.Empty; if (CheckValidation() == true) { if (ChkFrmDate.Checked == true) { FromDate = Convert.ToDateTime(txtFromDate.Text).ToString("MM-dd-yyyy"); ToDate = Convert.ToDateTime(txtToDate.Text).ToString("MM-dd-yyyy"); FromDateCheck = Convert.ToDateTime(txtFromDate.Text).ToString("dd-MM-yyyy"); ToDateCheck = Convert.ToDateTime(txtToDate.Text).ToString("dd-MM-yyyy"); } else { FromDate = Convert.ToDateTime("01-01-1975").ToString("MM-dd-yyyy"); ToDate = DateTime.Now.ToString("MM-dd-yyyy"); FromDateCheck = Convert.ToDateTime("01-01-1975").ToString("dd-MM-yyyy"); ToDateCheck = DateTime.Now.ToString("dd-MM-yyyy"); } if (DateTime.Compare(Convert.ToDateTime(FromDateCheck), Convert.ToDateTime(ToDateCheck)) <= 0) { if (Convert.ToInt32(ddlCategory.SelectedValue) > 0) { StrCondition = StrCondition + " and IC.CategoryId=" + Convert.ToInt32(ddlCategory.SelectedValue); } if (Convert.ToInt32(ddlItemName.SelectedValue) > 0) { StrCondition = StrCondition + " and IM.ItemId=" + Convert.ToInt32(ddlItemName.SelectedValue); } if (Convert.ToInt32(ddlSubCategory.SelectedValue) > 0) { StrCondition = StrCondition + " and IM.SubCategoryId=" + Convert.ToInt32(ddlSubCategory.SelectedValue); } #region [LOCATION] if (Convert.ToInt32(ddlLocation.SelectedValue) > 0) { StrCondition = StrCondition + " and SL.StockLocationID=" + Convert.ToInt32(ddlLocation.SelectedValue); } else { for (int i = 1; i < ddlLocation.Items.Count; i++) { if (i == 1) { if (Convert.ToInt32(ddlLocation.Items[i].Value) != 0) { StrCondition += " and (SL.StockLocationID = " + Convert.ToInt32(ddlLocation.Items[i].Value); } } else { if (Convert.ToInt32(ddlLocation.Items[i].Value) != 0) { StrCondition += " or SL.StockLocationID = " + Convert.ToInt32(ddlLocation.Items[i].Value); } } if (i == ddlLocation.Items.Count - 1) { if (Convert.ToInt32(ddlLocation.Items[i].Value) != 0) { StrCondition += " )"; } } } } #endregion if (Convert.ToInt32(ddlUnit.SelectedValue) > 0) { StrCondition = StrCondition + " and UM.UnitId=" + Convert.ToInt32(ddlUnit.SelectedValue); } //--------- For Display Stock In Hand ----------- if (CHKNORATE.Checked == true) { DsGrd = Obj_Reports.StockInHand(FromDate, ToDate, StrCondition, 1, out StrError); } else { DsGrd = Obj_Reports.StockInHand(FromDate, ToDate, StrCondition, 0, out StrError); } if (DsGrd.Tables.Count > 0 && DsGrd.Tables[0].Rows.Count > 0) { if (!FlagPrint) { ImgBtnPrint.Visible = true; } if (!FlagPrint) { ImgBtnExport.Visible = true; } GrdReport.DataSource = DsGrd.Tables[0]; GrdReport.DataBind(); dt = (DataTable)GrdReport.DataSource; Session["StockData"] = dt; lblCount.Text = DsGrd.Tables[0].Rows.Count + " Records Found"; lblCount.Visible = true; } else { GrdReport.DataSource = null; GrdReport.DataBind(); dt = (DataTable)GrdReport.DataSource; Session["StockData"] = dt; lblCount.Text = DsGrd.Tables[0].Rows.Count + " Records Found"; lblCount.Visible = true; SetInitialRow(); } //--------- For Display Stock In Hand ----------- } else { Obj_Comm.ShowPopUpMsg("From Date should be less or equal to ToDate..!", this.Page); } } else { Obj_Comm.ShowPopUpMsg("No Data Found To Export..!", this.Page); } } catch (Exception ex) { StrError = ex.Message; Obj_Comm.ShowPopUpMsg(StrError, this.Page); } }
protected void ImgBtnExport_Click(object sender, ImageClickEventArgs e) { DataSet DsGrd = new DataSet(); StrCondition = string.Empty; try { if (TR0.Visible) { if (ChkDate.Checked == true) { ToDate = Convert.ToDateTime(txtToDate.Text).ToString("MM-dd-yyyy"); FromDate = Convert.ToDateTime(txtFromDate.Text).ToString("MM-dd-yyyy"); StrCondition = StrCondition + " AND VoucherDate<='" + Convert.ToDateTime(txtToDate.Text).ToString("MM-dd-yyyy") + "'"; } else { ToDate = Convert.ToDateTime(txtToDate.Text).ToString("01-01-1975"); FromDate = Convert.ToDateTime(txtFromDate.Text).ToString("01-01-1975"); if (DateTime.Now > Convert.ToDateTime("03/31/" + DateTime.Now.ToString("yyyy"))) { StrCondition = StrCondition + " AND VoucherDate<= '03/31/" + DateTime.Now.AddYears(1).ToString("yyyy") + "'"; } else { StrCondition = StrCondition + " AND VoucherDate<= '04/01" + DateTime.Now.ToString() + "'"; } } //DsGrd = Obj_Call.Getdetails("25", StrCondition, out StrError); if (DsGrd.Tables[0].Rows.Count > 0) { //========Call Register GridView GridExp = new GridView(); DsGrd.Tables[0].Columns.Remove("Closing"); DsGrd.Tables[0].Columns.Remove("#"); DsGrd.Tables[0].Columns.Remove("LedgerID"); GridExp.DataSource = DsGrd.Tables[0]; GridExp.DataBind(); obj_Comman.Export("ListOfSundryCreditors.xls", GridExp); } else { obj_Comman.ShowPopUpMsg("No Data Found To Export..!", this.Page); DsGrd.Dispose(); GrdReport.DataSource = null; GrdReport.DataBind(); } } else if (TR1.Visible) { DataTable dtLedgerDetail = (DataTable)ViewState["LedgerSummary"]; if (dtLedgerDetail.Rows.Count > 0) { //========Call Register GridView GridExp = new GridView(); dtLedgerDetail.Columns.Remove("Closing1"); dtLedgerDetail.Columns.Remove("#"); dtLedgerDetail.Columns.Remove("LedgerID"); GridExp.DataSource = dtLedgerDetail; GridExp.DataBind(); obj_Comman.Export("ListOfSundryCreditorsLedgerDetail.xls", GridExp); } else { obj_Comman.ShowPopUpMsg("No Data Found To Export..!", this.Page); DsGrd.Dispose(); GrdLedgersummary.DataSource = null; GrdLedgersummary.DataBind(); } } else if (TR2.Visible) { DataTable dtLedgerVoucher = (DataTable)ViewState["LedgerVoucher"]; if (dtLedgerVoucher.Rows.Count > 0) { //========Call Register GridView GridExp = new GridView(); GridExp.DataSource = dtLedgerVoucher; GridExp.DataBind(); obj_Comman.Export("ListOfSundryCreditorsLedgerVoucher.xls", GridExp); } else { obj_Comman.ShowPopUpMsg("No Data Found To Export..!", this.Page); DsGrd.Dispose(); GrdLedgersummary.DataSource = null; GrdLedgersummary.DataBind(); } } } catch (ThreadAbortException ex) { } catch (Exception ex) { } }
private void ReportGrid() { try { StrCondition = string.Empty; StrConditionFilters = string.Empty; if (ChkDate.Checked == true) { ToDate = Convert.ToDateTime(txtToDate.Text).ToString("MM-dd-yyyy"); FromDate = Convert.ToDateTime(txtFromDate.Text).ToString("MM-dd-yyyy"); StrCondition = StrCondition + " AND (CAST(FLOOR(CAST(VoucherDate as FLOAT)) AS DateTime))<='" + Convert.ToDateTime(txtToDate.Text).ToString("MM-dd-yyyy") + "'"; Session["LedgerDate"] = Convert.ToDateTime(txtFromDate.Text).ToString("dd-MM-yyyy") + "*" + Convert.ToDateTime(txtToDate.Text).ToString("dd-MM-yyyy"); StrConditionFilters = "FromDate : " + txtFromDate.Text + " ToDate : " + txtToDate.Text + ""; } else { ToDate = Convert.ToDateTime(Session["FinEndDate"].ToString()).ToString("dd-MM-yyyy"); FromDate = Convert.ToDateTime(Session["FinStartDate"].ToString()).ToString("dd-MM-yyyy"); if (DateTime.Now > Convert.ToDateTime("03/31/" + DateTime.Now.ToString("yyyy"))) { StrCondition = StrCondition + " AND (CAST(FLOOR(CAST(VoucherDate as FLOAT)) AS DateTime))<= '03-31-" + DateTime.Now.AddYears(1).ToString("yyyy") + "'"; } else { StrCondition = StrCondition + " AND (CAST(FLOOR(CAST(VoucherDate as FLOAT)) AS DateTime))<= '04-01-" + DateTime.Now.ToString() + "'"; } Session["LedgerDate"] = Convert.ToDateTime(Session["FinStartDate"].ToString()).ToString("dd-MM-yyyy") + "*" + Convert.ToDateTime(Session["FinEndDate"].ToString()).ToString("dd-MM-yyyy"); } ViewState["Condition"] = StrCondition; ViewState["ConditionFilter"] = StrConditionFilters; LedgerId = 25; ViewState["LedgerId"] = LedgerId; DS = obj_Ledger.Getdetails("25", StrCondition, out StrError); if (DS.Tables.Count > 0 && DS.Tables[0].Rows.Count > 0) { GrdReport.DataSource = DS.Tables[0]; GrdReport.DataBind(); ViewState["GridView"] = DS.Tables[0]; if (!FlagPrint) { BtnPrintGroupSummary.Visible = true; BtnPrint.Visible = true; BtnExport.Visible = true; } LblRecordCount.Visible = true; LblRecordCount.Text = DS.Tables[0].Rows.Count + " Record(s) Found!!"; Label1.Visible = true; Label1.Text = "KARIA " + Convert.ToDateTime(txtFromDate.Text).ToString("yyyy") + " - " + Convert.ToDateTime(txtToDate.Text).ToString("yyyy"); TR1.Visible = TR2.Visible = false; LblFrmDate.Visible = LblToDate.Visible = TO.Visible = true; LblFrmDate.Text = Convert.ToDateTime(txtFromDate.Text).ToString("dd-MM-yyyy"); LblToDate.Text = Convert.ToDateTime(txtToDate.Text).ToString("dd-MM-yyyy"); Label3.Text = "Group Summary"; Label2.Text = ""; } else { GrdReport.DataSource = null; GrdReport.DataBind(); MakeFormEmpty(); LblRecordCount.Text = "No Record Found!!"; LblRecordCount.Visible = true; TR1.Visible = TR2.Visible = false; } } catch (Exception ex) { throw new Exception(ex.Message); } }
protected void BtnCancel_Click(object sender, EventArgs e) { MakeEmptyForm(); GrdReport.DataSource = null; GrdReport.DataBind(); }
public void getReportData(string spprid = "", string sminid = "") { if (Request.QueryString["gVrTqMn"] == null && Request.QueryString["gVrTqMinID"] == null) { DisplayMisReportData(); if (GrdReport.Rows.Count < 1) { btnExportExcel.Visible = false; } } else if (Request.QueryString["gVrTqMn"] != null) { PPRDataBL obj = new PPRDataBL(); DataTable dt = new DataTable(); dt = obj.GetMisReportDataBL(Request.QueryString["gVrTqMn"] != null ? Request.QueryString["gVrTqMn"].ToString() : "", Session["UserId"] != null ? Session["UserId"].ToString() : "", Session["ministry"] != null ? Session["ministry"].ToString() : "", Session["Rolls"] != null ? Session["Rolls"].ToString() : "", spprid, sminid); hdnFlag.Value = Request.QueryString["gVrTqMn"] != null ? Request.QueryString["gVrTqMn"].ToString() : ""; GrdReport.DataSource = dt; ViewState["DataList"] = dt; GrdReport.DataBind(); if (GrdReport.Rows.Count < 1) { btnExportExcel.Visible = false; } if (Request.QueryString["gVrTqMn"] != null) { if (Request.QueryString["gVrTqMn"].ToString() == "Pose") { if (Session["Rolls"] != null) { if (Session["Rolls"].ToString() == "2") { GrdReport.Columns[GrdReport.Columns.Count - 2].Visible = true; } } } if (Request.QueryString["gVrTqMn"].ToString() == "NPose") { if (Session["Rolls"] != null) { if (Session["Rolls"].ToString() == "2") { GrdReport.Columns[GrdReport.Columns.Count - 1].Visible = true; } } } } } if (Request.QueryString["gVrTqMinID"] != null) { PPRDataBL obj = new PPRDataBL(); DataTable dt = new DataTable(); dt = obj.GetMisReportDataBL(Request.QueryString["MinCount"] != null ? Request.QueryString["MinCount"].ToString() : "", Session["UserId"] != null ? Session["UserId"].ToString() : "", Request.QueryString["gVrTqMinID"] != null ? Request.QueryString["gVrTqMinID"].ToString() : "", Session["Rolls"] != null ? Session["Rolls"].ToString() : "", spprid, sminid); hdnFlag.Value = Request.QueryString["gVrTqMinID"] != null ? Request.QueryString["gVrTqMinID"].ToString() : ""; GrdReport.DataSource = dt; GrdReport.DataBind(); if (GrdReport.Rows.Count < 1) { btnExportExcel.Visible = false; } lblmin.Visible = false; ddlMinistry.Visible = false; } }