private void SetInitialRow() { DataTable Dt = new DataTable(); DataRow dr; Dt.Columns.Add("TransferNo", typeof(string)); Dt.Columns.Add("Date", typeof(string)); Dt.Columns.Add("Employee", typeof(string)); Dt.Columns.Add("FromLocation", typeof(string)); Dt.Columns.Add("ToLocation", typeof(string)); Dt.Columns.Add("Notes", typeof(string)); Dt.Columns.Add("Amount", typeof(string)); dr = Dt.NewRow(); dr["TransferNo"] = ""; dr["Date"] = ""; dr["Employee"] = ""; dr["FromLocation"] = ""; dr["ToLocation"] = ""; dr["Notes"] = ""; dr["Amount"] = ""; Dt.Rows.Add(dr); ViewState["CurrentTable"] = Dt; GridDetails.DataSource = Dt; GridDetails.DataBind(); }
protected void ReportGrid_RowCommand(object sender, GridViewCommandEventArgs e) { try { switch (e.CommandName) { case ("Select"): { ViewState["EditID"] = Convert.ToInt32(e.CommandArgument); DS = Obj_Recipe.GetRecordForEdit(Convert.ToInt32(e.CommandArgument), out StrError); if (DS.Tables.Count > 0) { if (DS.Tables[0].Rows.Count > 0) { txtDate.Text = DS.Tables[0].Rows[0]["OrderDate"].ToString(); txtTotalOrderCost.Text = DS.Tables[0].Rows[0]["TotalOrderCost"].ToString(); } if (DS.Tables[1].Rows.Count > 0) { GridDetails.DataSource = DS.Tables[1]; ViewState["CurrentTable"] = DS.Tables[1]; GridDetails.DataBind(); } if (DS.Tables[2].Rows.Count > 0) { GridItemDtls.DataSource = DS.Tables[2]; ViewState["ItemDetails"] = DS.Tables[2]; GridItemDtls.DataBind(); } else { SetInitialRow(); } BtnUpdate.Visible = true; BtnSave.Visible = false; } } break; case ("Delete"): { ViewState["DeleteID"] = Convert.ToInt32(e.CommandArgument); Entity_Recipe.OrderId = Convert.ToInt32(e.CommandArgument); Entity_Recipe.UserId = Convert.ToInt32(Session["UserId"]); Entity_Recipe.LoginDate = Convert.ToDateTime(DateTime.Now.ToShortDateString()); int DeletedRow = Obj_Recipe.DeleteRecord(ref Entity_Recipe, out StrError); if (DeletedRow != 0) { obj_Comm.ShowPopUpMsg("Record Deleted Successfully!", this.Page); MakeEmptyForm(); } } break; } } catch (Exception ex) { throw new Exception(ex.Message); } }
private void SetInitialRow() { DataTable Dt = new DataTable(); DataRow dr; Dt.Columns.Add("DamageNo", typeof(string)); Dt.Columns.Add("Date", typeof(string)); Dt.Columns.Add("type", typeof(string)); Dt.Columns.Add("Employee", typeof(string)); Dt.Columns.Add("InwardNo", typeof(string)); Dt.Columns.Add("InwardDate", typeof(string)); Dt.Columns.Add("PONO", typeof(string)); Dt.Columns.Add("Suplier", typeof(string)); Dt.Columns.Add("Amount", typeof(string)); dr = Dt.NewRow(); dr["DamageNo"] = ""; dr["Date"] = ""; dr["type"] = ""; dr["Employee"] = ""; dr["InwardNo"] = ""; dr["InwardDate"] = ""; dr["PONO"] = ""; dr["Suplier"] = ""; dr["Amount"] = "0.00"; Dt.Rows.Add(dr); ViewState["CurrentTable"] = Dt; GridDetails.DataSource = Dt; GridDetails.DataBind(); }
public void SetInitialRow() { try { DataTable dt = new DataTable(); DataRow dr = null; dt.Columns.Add(new DataColumn("#", typeof(int))); dt.Columns.Add(new DataColumn("RecipeId", typeof(Int32))); dt.Columns.Add(new DataColumn("RecipeName", typeof(string))); dt.Columns.Add(new DataColumn("Quantity", typeof(string))); dt.Columns.Add(new DataColumn("AmtPerPlate", typeof(string))); dt.Columns.Add(new DataColumn("TotalAmt", typeof(decimal))); dr = dt.NewRow(); dr["#"] = 0; dr["RecipeId"] = 0; dr["RecipeName"] = string.Empty; dr["Quantity"] = string.Empty; dr["AmtPerPlate"] = string.Empty; dr["TotalAmt"] = 0; dt.Rows.Add(dr); ViewState["CurrentTable"] = dt; GridDetails.DataSource = dt; GridDetails.DataBind(); } catch (Exception ex) { throw new Exception(ex.Message); } }
private void SetInitialRow() { DataTable Dt = new DataTable(); DataRow dr; Dt.Columns.Add("IssueNo", typeof(string)); Dt.Columns.Add("IssueDate", typeof(string)); Dt.Columns.Add("ItemName", typeof(string)); Dt.Columns.Add("Qty", typeof(decimal)); Dt.Columns.Add("IssueQty", typeof(decimal)); Dt.Columns.Add("PendingQty", typeof(decimal)); Dt.Columns.Add("Cafeteria", typeof(string)); Dt.Columns.Add("EmpName", typeof(string)); Dt.Columns.Add("Notes", typeof(string)); dr = Dt.NewRow(); dr["IssueNo"] = ""; dr["IssueDate"] = ""; dr["ItemName"] = ""; dr["Qty"] = 0; dr["IssueQty"] = 0; dr["PendingQty"] = 0; dr["Cafeteria"] = ""; dr["EmpName"] = ""; dr["Notes"] = ""; Dt.Rows.Add(dr); ViewState["CurrentTable"] = Dt; GridDetails.DataSource = Dt; GridDetails.DataBind(); }
private void SetInitialRow() { DataTable dt = new DataTable(); DataRow dr; dt.Columns.Add("#", typeof(Int32)); dt.Columns.Add("EmployeeId", typeof(Int32)); dt.Columns.Add("PersonName", typeof(string)); dt.Columns.Add("ContactNo", typeof(string)); dt.Columns.Add("EmailId", typeof(string)); dt.Columns.Add("Address", typeof(string)); dr = dt.NewRow(); dr["#"] = 0; dr["EmployeeId"] = 0; dr["PersonName"] = ""; dr["ContactNo"] = ""; dr["EmailId"] = ""; dr["Address"] = ""; dt.Rows.Add(dr); ViewState["CurrentTable"] = dt; GridDetails.DataSource = dt; GridDetails.DataBind(); }
private void SetInitialRow() { DataTable dt = new DataTable(); DataRow dr; dt.Columns.Add("#", typeof(Int32)); dt.Columns.Add("BankId", typeof(Int32)); dt.Columns.Add("BankName", typeof(string)); dt.Columns.Add("AccountNo", typeof(string)); dt.Columns.Add("NoteB", typeof(string)); dr = dt.NewRow(); dr["#"] = 0; dr["BankId"] = 0; dr["BankName"] = ""; dr["AccountNo"] = ""; dr["NoteB"] = ""; dt.Rows.Add(dr); ViewState["CurrentTable"] = dt; GridDetails.DataSource = dt; GridDetails.DataBind(); }
public void ReportGrid() { StrCondition = string.Empty; try { if (!TxtForMonth.Text.Equals("")) { StrCondition += " and RC.RequisitionDate Between '" + Convert.ToDateTime("01-" + TxtForMonth.Text).ToString("MM-dd-yyyy") + "' and '" + (Convert.ToDateTime(TxtForMonth.Text).AddMonths(1).AddDays(-1)).ToString("MM-dd-yyyy") + "'"; } if (TxtForMonth.Text.Equals("")) { StrCondition += " and RC.RequisitionDate Between '" + Convert.ToDateTime("01-Jan-1990").ToString("MM-dd-yyyy") + "' and '" + Convert.ToDateTime(DateTime.Now.ToShortDateString()).ToString("MM-dd-yyyy") + "'"; } if (Convert.ToInt32(ddlRequisitionNo.SelectedValue) > 0) { StrCondition += " and RC.RequisitionCafeId = " + Convert.ToInt32(ddlRequisitionNo.SelectedValue); } if (Convert.ToInt32(ddlInwardNo.SelectedValue) > 0) { StrCondition += " and OUR.OutwardId = " + Convert.ToInt32(ddlInwardNo.SelectedValue); } if (!Convert.ToBoolean(Session["IsCentral"].ToString())) { StrCondition = StrCondition + " AND RC.CafeteriaId=" + Convert.ToInt32(Session["CafeteriaId"].ToString()); } DS = Obj_Reports.MonthReportReport(StrCondition, out StrError); if (DS.Tables.Count > 0 && DS.Tables[0].Rows.Count > 0) { if (!FlagPrint) { ImgBtnPrint.Visible = true; } if (!FlagPrint) { ImgBtnExcel.Visible = true; } GridDetails.DataSource = DS.Tables[0]; GridDetails.DataBind(); lblCount.Text = DS.Tables[0].Rows.Count.ToString() + "Record Found"; DS = null; } else { GridDetails.DataSource = DS.Tables[0]; GridDetails.DataBind(); lblCount.Text = ""; DS = null; SetInitialRow(); ImgBtnPrint.Visible = false; } } catch (Exception ex) { throw new Exception(ex.Message); } }
protected void GridReport_RowCommand(object sender, GridViewCommandEventArgs e) { try { switch (e.CommandName) { case ("SelectGrid"): { int CurRow = Convert.ToInt32(e.CommandArgument); int InwardOutwardID = Convert.ToInt32(GridReport.Rows[CurRow].Cells[0].Text); ViewState["EditID"] = InwardOutwardID; DS = Obj_DailyInwardOutwardRegister.GetDailyInwardOutwardRegisterForEdit(InwardOutwardID, out StrError); if (DS.Tables.Count > 0) { if (DS.Tables[0].Rows.Count > 0) { lblDInwardNo.Text = DS.Tables[0].Rows[0]["InwardNo"].ToString(); TxtDate.Text = DS.Tables[0].Rows[0]["TxtDate"].ToString(); lblEmployee.Text = DS.Tables[0].Rows[0]["EmpName"].ToString(); } if (DS.Tables[1].Rows.Count > 0) { GridDetails.DataSource = DS.Tables[1]; GridDetails.DataBind(); } } } break; } } catch (Exception ex) { } }
protected void GridDetails_RowCommand(object sender, GridViewCommandEventArgs e) { try { switch (e.CommandName) { case ("Delete"): { ViewState["DeleteID"] = Convert.ToInt32(e.CommandArgument); DataTable dtdelete = (DataTable)ViewState["CurrentTable"]; for (int currindex = 0; currindex < dtdelete.Rows.Count; currindex++) { dtdelete.Rows.RemoveAt(Convert.ToInt32(e.CommandArgument)); break; } GridDetails.DataSource = dtdelete; GridDetails.DataBind(); } break; } } catch (Exception ex) { } }
protected void GridDetails_RowDeleting(object sender, GridViewDeleteEventArgs e) { try { if ((!(string.IsNullOrEmpty(GridDetails.Rows[0].Cells[3].Text))) && (GridDetails.Rows[0].Cells[3].Text.Equals(" "))) { Obj_Comm.ShowPopUpMsg("There Is No Record To Delete", this.Page); } else { if (ViewState["CurrentTable"] != null) { int id = e.RowIndex; DataTable dt = (DataTable)ViewState["CurrentTable"]; dt.Rows.RemoveAt(id); if (dt.Rows.Count > 0) { GridDetails.DataSource = dt; ViewState["CurrentTable"] = dt; GridDetails.DataBind(); } else { SetInitialRow(); } MakeControlEmpty(); } } } catch (Exception ex) { throw new Exception(ex.Message); } }
public void GetDamageDtls() { try { int TransId = Convert.ToInt32(Request.QueryString["ID"]); DS = Obj_Trans.BindForPrint(TransId, out StrError); if (DS.Tables.Count > 0) { if (DS.Tables[0].Rows.Count > 0) { lblTransferNo.Text = obj_Comm.ToTitleCase(DS.Tables[0].Rows[0]["TransNo"].ToString()); lblTransferBy.Text = obj_Comm.ToTitleCase(Session["UserName"].ToString()); lblTransferDate.Text = obj_Comm.ToTitleCase(DS.Tables[0].Rows[0]["Date"].ToString()); } if (DS.Tables[1].Rows.Count > 0) { GridDetails.DataSource = DS.Tables[1]; GridDetails.DataBind(); } } } catch (Exception ex) { throw new Exception(ex.Message); } }
private void SetInitialRow() { DataTable dt = new DataTable(); DataRow dr; dt.Columns.Add("#", typeof(Int32)); dt.Columns.Add("ProjectCompanyId", typeof(Int32)); dt.Columns.Add("Company", typeof(string)); dt.Columns.Add("BankTypeId", typeof(Int32)); dt.Columns.Add("BankType", typeof(string)); dt.Columns.Add("BankName", typeof(string)); dt.Columns.Add("Branch", typeof(string)); dt.Columns.Add("AccountNo", typeof(string)); dt.Columns.Add("RTGSNo", typeof(string)); dt.Columns.Add("ChequeDrawnAccName", typeof(string)); dr = dt.NewRow(); dr["#"] = 0; dr["ProjectCompanyId"] = 0; dr["Company"] = ""; dr["BankTypeId"] = 0; dr["BankType"] = ""; dr["BankName"] = ""; dr["Branch"] = ""; dr["AccountNo"] = ""; dr["RTGSNo"] = ""; dr["ChequeDrawnAccName"] = ""; dt.Rows.Add(dr); ViewState["CurrentTable"] = dt; GridDetails.DataSource = dt; GridDetails.DataBind(); }
private void SetInitialRow() { DataTable dt = new DataTable(); DataRow dr; dt.Columns.Add("#", typeof(Int32)); dt.Columns.Add("FlatTypeId", typeof(Int32)); dt.Columns.Add("FlatType", typeof(string)); dt.Columns.Add("UnitNo", typeof(string)); dt.Columns.Add("UnitArea", typeof(decimal)); dt.Columns.Add("PropTaxAmt", typeof(decimal)); dt.Columns.Add("SMAmt", typeof(decimal)); dr = dt.NewRow(); dr["#"] = 0; dr["FlatTypeId"] = 0; dr["FlatType"] = ""; dr["UnitNo"] = ""; dr["UnitArea"] = 0; dr["PropTaxAmt"] = 0; dr["SMAmt"] = 0; dt.Rows.Add(dr); ViewState["CurrentTable"] = dt; GridDetails.DataSource = dt; GridDetails.DataBind(); }
protected void GridDetails_RowDeleting(object sender, GridViewDeleteEventArgs e) { try { if (ViewState["CurrentTable"] != null) { int id = e.RowIndex; DataTable dt = (DataTable)ViewState["CurrentTable"]; dt.Rows.RemoveAt(id); if (dt.Rows.Count > 0) { GridDetails.DataSource = dt; ViewState["CurrentTable"] = dt; GridDetails.DataBind(); } else { setInitialRow(); } EmptyFormFields(); } } catch { } }
private void SetInitialRow() { DataTable dt = new DataTable(); DataRow dr; dt.Columns.Add("#", typeof(Int32)); dt.Columns.Add("RequisitionNo", typeof(string)); dt.Columns.Add("RequisitionDate", typeof(string)); dt.Columns.Add("Cafeteria", typeof(string)); dt.Columns.Add("CafeteriaId", typeof(Int32)); dt.Columns.Add("IsCancel", typeof(Int32)); dr = dt.NewRow(); dr["#"] = 0; dr["RequisitionNo"] = ""; dr["RequisitionDate"] = ""; dr["Cafeteria"] = ""; dr["CafeteriaId"] = 0; dr["IsCancel"] = 0; dt.Rows.Add(dr); ViewState["CurrentTable1"] = dt; GridDetails.DataSource = dt; GridDetails.DataBind(); }
protected void GridDetails_RowDeleting(object sender, GridViewDeleteEventArgs e) { try { //===========Get The Grid View RowIndex See ImgBtnDeleteNew commnad Argumnet for syntax CommandArgument='<%# Eval("#")+ ","+((GridViewRow)Container).RowIndex %>' //int DeleteId = Convert.ToInt32(((ImageButton)GrdBagDtls.Rows[e.RowIndex].Cells[0].FindControl("ImgBtnDelete")).CommandArgument.ToString()); //Page.RegisterClientScriptBlock("", "<script>DeleteEquipFunction()</script>"); int i = Convert.ToInt32(hiddenbox.Value); if (i == 1) { if (ViewState["CurrentTable"] != null) { int id = e.RowIndex; DataTable dt = (DataTable)ViewState["CurrentTable"]; dt.Rows.RemoveAt(id); if (dt.Rows.Count > 0) { GridDetails.DataSource = dt; ViewState["CurrentTable"] = dt; GridDetails.DataBind(); } else { SetInitialRow(); } MakeControlEmpty(); } } } catch (Exception ex) { throw new Exception(ex.Message); } }
public void setInitialRow() { DataTable dt = new DataTable(); DataRow dr; dt.Columns.Add("#", typeof(Int32)); dt.Columns.Add("PersonName", typeof(string)); dt.Columns.Add("Designation", typeof(string)); dt.Columns.Add("ContactNo1", typeof(string)); dt.Columns.Add("ContactNo2", typeof(string)); dt.Columns.Add("EmailId1", typeof(string)); dt.Columns.Add("EmailId2", typeof(string)); dt.Columns.Add("Note", typeof(string)); dr = dt.NewRow(); dr["#"] = 0; dr["PersonName"] = ""; dr["Designation"] = ""; dr["ContactNo1"] = ""; dr["ContactNo2"] = ""; dr["EmailId1"] = ""; dr["EmailId2"] = ""; dr["Note"] = ""; dt.Rows.Add(dr); ViewState["CurrentTable"] = dt; GridDetails.DataSource = dt; GridDetails.DataBind(); }
protected void GridDetails_RowDeleting(object sender, GridViewDeleteEventArgs e) { try { if (ViewState["CurrentTable"] != null) { int id = e.RowIndex; DataTable dt = (DataTable)ViewState["CurrentTable"]; dt.Rows.RemoveAt(id); if (dt.Rows.Count > 0) { GridDetails.DataSource = dt; GridDetails.DataBind(); ViewState["CurrentTable"] = dt; } else { SetInitialRow(); } } } catch (Exception ex) { throw new Exception(ex.Message); } }
private void SetInitialRow() { DataTable Dt = new DataTable(); DataRow dr; Dt.Columns.Add("Center", typeof(string)); Dt.Columns.Add("Location", typeof(string)); Dt.Columns.Add("Date", typeof(string)); Dt.Columns.Add("AssignNo", typeof(string)); Dt.Columns.Add("Item", typeof(decimal)); Dt.Columns.Add("ItemDesc", typeof(string)); Dt.Columns.Add("Qty", typeof(string)); Dt.Columns.Add("Rate", typeof(string)); Dt.Columns.Add("Amount", typeof(string)); Dt.Columns.Add("Unit", typeof(string)); dr = Dt.NewRow(); dr["Center"] = ""; dr["Location"] = ""; dr["Date"] = ""; dr["AssignNo"] = ""; dr["Item"] = 0; dr["ItemDesc"] = ""; dr["Qty"] = ""; dr["Rate"] = ""; dr["Amount"] = ""; dr["Unit"] = ""; Dt.Rows.Add(dr); ViewState["CurrentTable"] = Dt; GridDetails.DataSource = Dt; GridDetails.DataBind(); }
private void SetInitialRow() { DataTable Dt = new DataTable(); DataRow dr; Dt.Columns.Add("Type", typeof(string)); Dt.Columns.Add("Stock_No", typeof(string)); Dt.Columns.Add("Date", typeof(string)); Dt.Columns.Add("Inward_No", typeof(string)); Dt.Columns.Add("INDate", typeof(string)); Dt.Columns.Add("Employee", typeof(string)); Dt.Columns.Add("To_Location", typeof(decimal)); Dt.Columns.Add("Status", typeof(string)); Dt.Columns.Add("Amount", typeof(decimal)); Dt.Columns.Add("Remark", typeof(string)); dr = Dt.NewRow(); dr["Type"] = ""; dr["Stock_No"] = ""; dr["Date"] = ""; dr["Inward_No"] = ""; dr["INDate"] = ""; dr["Employee"] = ""; dr["To_Location"] = 0; dr["Status"] = ""; dr["Amount"] = 0.00; dr["Remark"] = ""; Dt.Rows.Add(dr); ViewState["CurrentTable"] = Dt; GridDetails.DataSource = Dt; GridDetails.DataBind(); }
protected void ddlRequisitionNo_SelectedIndexChanged(object sender, EventArgs e) { bool DupFlag = false; int ID = 0; try { if (GrdReport.Rows.Count != null) { for (int i = 0; i < GrdReport.Rows.Count; i++) { if (Convert.ToInt32(GrdReport.Rows[i].Cells[6].Text) == Convert.ToInt32(ddlRequisitionNo.SelectedValue)) { DupFlag = true; ViewState["DupFlag1"] = true; ID = Convert.ToInt32(GrdReport.Rows[i].Cells[7].Text); } } } if (DupFlag == false) { ID = Convert.ToInt32(ddlRequisitionNo.SelectedValue); } DS = Obj_IssueRegister.FillItemGrid(ID, out StrError, DupFlag); if (DS.Tables.Count > 0) { if (DupFlag == false) { TxtReqstnDate.Text = Convert.ToDateTime(DS.Tables[0].Rows[0]["RequisitionDate"]).ToString("dd-MMM-yyyy"); TxtReqBy.Text = Session["UserName"].ToString(); //DS.Tables[0].Rows[0]["CreatedBy"].ToString(); // lblCafeteria.Text = DS.Tables[0].Rows[0]["Cafeteria"].ToString(); } else { TxtReqstnDate.Text = Convert.ToDateTime(DS.Tables[1].Rows[0]["RequisitionDate"]).ToString("dd-MMM-yyyy"); TxtReqBy.Text = DS.Tables[1].Rows[0]["CreatedBy"].ToString(); // lblCafeteria.Text = DS.Tables[1].Rows[0]["Cafeteria"].ToString(); } GridDetails.DataSource = null; GridDetails.DataBind(); GridDetails.DataSource = DS.Tables[0]; GridDetails.DataBind(); ViewState["CurrentTable"] = DS.Tables[0]; //for (int i = 0; i < GridDetails.Rows.Count; i++) //{ // if (Convert.ToDecimal(GridDetails.Rows[i].Cells[5].Text) == 0) // { // GridDetails.Rows[i].Enabled = false; // } //} } } catch (Exception ex) { Obj_Comm.ShowPopUpMsg(ex.Message, this.Page); } }
protected void ImgBtnExcel_Click(object sender, ImageClickEventArgs e) { try { if (!TxtForMonth.Text.Equals("")) { StrCondition += " and RC.RequisitionDate Between '" + Convert.ToDateTime(TxtForMonth.Text).ToString("MM-dd-yyyy") + "' and '" + Convert.ToDateTime(TxtForMonth.Text).ToString("MM-dd-yyyy") + "'"; } if (TxtForMonth.Text.Equals("")) { StrCondition += " and RC.RequisitionDate Between '" + Convert.ToDateTime("01-Jan-1990").ToString("MM-dd-yyyy") + "' and '" + Convert.ToDateTime(DateTime.Now.ToShortDateString()).ToString("MM-dd-yyyy") + "'"; } if (Convert.ToInt32(ddlRequisitionNo.SelectedValue) > 0) { StrCondition += " and RC.RequisitionCafeId = " + Convert.ToInt32(ddlRequisitionNo.SelectedValue); } if (Convert.ToInt32(ddlInwardNo.SelectedValue) > 0) { StrCondition += " and OUR.OutwardId = " + Convert.ToInt32(ddlInwardNo.SelectedValue); } if (!Convert.ToBoolean(Session["IsCentral"].ToString())) { StrCondition = StrCondition + " AND RC.CafeteriaId=" + Convert.ToInt32(Session["CafeteriaId"].ToString()); } DS = Obj_Reports.MonthReportReport(StrCondition, out StrError); DS.Tables[0].Columns[1].ColumnName = "Requisition Date"; DS.Tables[0].Columns[4].ColumnName = "Assign Date"; DS.Tables[0].Columns[5].ColumnName = "Particular"; DS.Tables[0].Columns[6].ColumnName = "Category"; DS.Tables[0].Columns[7].ColumnName = "Requisition_Qty"; DS.Tables[0].Columns[8].ColumnName = "Assign_Qty"; DS.Tables[0].Columns[9].ColumnName = "Pending_Qty"; if (DS.Tables.Count > 0 && DS.Tables[0].Rows.Count > 0) { GridView GridExp = new GridView(); GridExp.DataSource = DS.Tables[0]; GridExp.DataBind(); Obj_Comm.Export("MonthlyReport" + "_" + DateTime.Now.ToString("dd-MMM-yyyy") + ".xls", GridExp); } else { Obj_Comm.ShowPopUpMsg("No Data Found To Export...!", this.Page); DS.Dispose(); GridDetails.DataSource = null; GridDetails.DataBind(); } DS = null; } catch (ThreadAbortException tex) { } catch (Exception ex) { Obj_Comm.ShowPopUpMsg(ex.Message, this.Page); } }
public void ReportGrid() { StrCondition = string.Empty; try { if (ChkFromDate.Checked) { StrCondition += " and IR.IssueDate Between '" + Convert.ToDateTime(TxtFromDate.Text).ToString("MM-dd-yyyy") + "'and'" + Convert.ToDateTime(TxtToDate.Text).ToString("MM-dd-yyyy") + "'"; } if (!ChkFromDate.Checked) { StrCondition += " and IR.IssueDate Between '" + Convert.ToDateTime("01-Jan-1990").ToString("MM-dd-yyyy") + "' and '" + Convert.ToDateTime(DateTime.Now.ToShortDateString()).ToString("MM-dd-yyyy") + "'"; } if (Convert.ToInt32(ddlIssueNo.SelectedValue) > 0) { StrCondition += " and IR.IssueRegisterId=" + Convert.ToInt32(ddlIssueNo.SelectedValue); } if (Convert.ToInt32(ddlItem.SelectedValue) > 0) { StrCondition += " and IM.ItemId=" + Convert.ToInt32(ddlItem.SelectedValue); } if (Convert.ToInt32(ddlLocation.SelectedValue) > 0) { StrCondition += " and SL.StockLocationID=" + Convert.ToInt32(ddlLocation.SelectedValue); } DS = Obj_IssueRegister.ShowIssueRegisterDetailsReport(StrCondition, out StrError); if (DS.Tables.Count > 0 && DS.Tables[0].Rows.Count > 0) { if (!FlagPrint) { ImgBtnPrint.Visible = true; } GridDetails.DataSource = DS.Tables[0]; GridDetails.DataBind(); lblCount.Text = DS.Tables[0].Rows.Count.ToString() + "Record Found"; DS = null; //ScriptManager.RegisterStartupScript(this,this.GetType(),"starScript","") } else { GridDetails.DataSource = DS.Tables[0]; GridDetails.DataBind(); lblCount.Text = ""; DS = null; SetInitialRow(); ImgBtnPrint.Visible = false; } } catch (Exception ex) { throw new Exception(ex.Message); } }
protected void GrdReport_ItemCommand(object source, RepeaterCommandEventArgs e) { try { switch (e.CommandName) { case ("Select"): { if (Convert.ToInt32(e.CommandArgument) != 0) { ViewState["EditID"] = Convert.ToInt32(e.CommandArgument); Ds = Obj_Call.GetRecordForEdit(Convert.ToInt32(e.CommandArgument), out StrError); if (Ds.Tables.Count > 0 && Ds.Tables[0].Rows.Count > 0) { ddlProject.SelectedValue = Ds.Tables[0].Rows[0]["PCId"].ToString(); } else { MakeEmptyForm(); } if (Ds.Tables.Count > 0 && Ds.Tables[1].Rows.Count > 0) { GridDetails.DataSource = Ds.Tables[1]; GridDetails.DataBind(); ViewState["CurrentTable"] = Ds.Tables[1]; } else { //MakeEmptyForm(); SetInitialRow(); } Ds = null; Obj_Call = null; BtnSave.Visible = false; if (!FlagEdit) { BtnUpdate.Visible = true; } if (!FlagDel) { BtnDelete.Visible = true; } //TxtCountry.Focus(); } break; } } } catch (Exception ex) { throw new Exception(ex.Message); } }
protected void GrdReport_ItemCommand(object source, RepeaterCommandEventArgs e) { try { switch (e.CommandName) { case ("Select"): { if (Convert.ToInt32(e.CommandArgument) != 0) { ViewState["EditID"] = Convert.ToInt32(e.CommandArgument); Ds = Obj_TaxMaster.GetTaxMasterForEdit(Convert.ToInt32(e.CommandArgument), out StrError); if (Ds.Tables.Count > 0 && Ds.Tables[0].Rows.Count > 0) { TxtTaxName.Text = Ds.Tables[0].Rows[0]["TaxName"].ToString(); //TxtTaxPer.Text = Ds.Tables[0].Rows[0]["TaxPer"].ToString(); //TXTEFFECTIVEDATE.Text =!string.IsNullOrEmpty(Ds.Tables[0].Rows[0]["EffectiveFrom"].ToString())?Ds.Tables[0].Rows[0]["EffectiveFrom"].ToString():DateTime.Now.ToString("dd-MMM-yyyy"); ////TxtTaxName.Enabled = false; //RdoTaxType.SelectedValue = !string.IsNullOrEmpty(Ds.Tables[0].Rows[0]["TaxTypeID"].ToString()) ? Convert.ToString((Ds.Tables[0].Rows[0]["TaxTypeID"].ToString())) : "1"; } else { MakeEmptyForm(); } if (Ds.Tables.Count > 0 && Ds.Tables[1].Rows.Count > 0) { GridDetails.DataSource = Ds.Tables[1]; GridDetails.DataBind(); ViewState["CurrentTable"] = Ds.Tables[1]; } else { GridDetails.DataSource = null; GridDetails.DataBind(); ViewState["CurrentTable"] = null; } Ds = null; Obj_TaxMaster = null; if (!FlagEdit) { BtnUpdate.Visible = true; } BtnSave.Visible = false; if (!FlagDel) { BtnDelete.Visible = true; } TxtTaxName.Focus(); } break; } } } catch (Exception ex) { throw new Exception(ex.Message); } }
protected void ImgBtnExcel_Click(object sender, ImageClickEventArgs e) { try { if (ChkFromDate.Checked) { StrCondition += " and OWR.StockAsOn>= '" + Convert.ToDateTime(TxtFromDate.Text).ToString("MM-dd-yyyy") + "' and OWR.StockAsOn<='" + Convert.ToDateTime(TxtToDate.Text).ToString("MM-dd-yyyy") + "'"; } if (!ChkFromDate.Checked) { StrCondition += " and OWR.StockAsOn>= '" + Convert.ToDateTime("01-Jan-1990").ToString("MM-dd-yyyy") + "' and OWR.StockAsOn<='" + Convert.ToDateTime(DateTime.Now.ToShortDateString()).ToString("MM-dd-yyyy") + "'"; } //if (Convert.ToInt32(ddlStockNo.SelectedValue) > 0) //{ // StrCondition += " and OWRD.LocationId = " + Convert.ToInt32(ddlStockNo.SelectedValue); //} if (!Convert.ToBoolean(Session["IsCentral"].ToString())) { StrCondition = StrCondition + " AND OWR.Location =" + Convert.ToInt32(Session["CafeteriaId"].ToString()); } if (Convert.ToBoolean(Session["IsCentral"].ToString())) { if (Convert.ToInt32(ddlStockNo.SelectedValue) > 0) { StrCondition = StrCondition + " and OWR.Location =" + Convert.ToInt32(ddlStockNo.SelectedValue); } } DS = Obj_Reports.MonthReportReport(StrCondition, out StrError); if (DS.Tables.Count > 0 && DS.Tables[0].Rows.Count > 0) { GridView GridExp = new GridView(); GridExp.DataSource = DS.Tables[0]; GridExp.DataBind(); Obj_Comm.Export("Cost_Centre_Wise_Report" + "_" + DateTime.Now.ToString("dd-MMM-yyyy") + ".xls", GridExp); } else { Obj_Comm.ShowPopUpMsg("No Data Found To Export...!", this.Page); DS.Dispose(); GridDetails.DataSource = null; GridDetails.DataBind(); } DS = null; } catch (ThreadAbortException tex) { } catch (Exception ex) { Obj_Comm.ShowPopUpMsg(ex.Message, this.Page); } }
protected void GrdReport_ItemCommand(object source, RepeaterCommandEventArgs e) { try { switch (e.CommandName) { case ("Select"): { if (Convert.ToInt32(e.CommandArgument) != 0) { ViewState["EditID"] = Convert.ToInt32(e.CommandArgument); Ds = Obj_UnitConversion.GetRecordToEdit(Convert.ToInt32(e.CommandArgument), out StrError); if (Ds.Tables.Count > 0) { if (Ds.Tables.Count > 0 && Ds.Tables[0].Rows.Count > 0) { ddlUnit.SelectedValue = Ds.Tables[0].Rows[0]["UnitId"].ToString(); } if (Ds.Tables[1].Rows.Count > 0) { GridDetails.DataSource = Ds.Tables[1]; GridDetails.DataBind(); ViewState["CurrentTable"] = Ds.Tables[1]; } else { MakeEmptyForm(); } } Ds = null; Obj_UnitConversion = null; if (!FlagEdit) { BtnUpdate.Visible = true; } BtnSave.Visible = false; if (!FlagDel) { BtnDelete.Visible = true; } ddlUnit.Focus(); MakeControlEmpty(); } break; } } } catch (Exception ex) { obj_Comman.ShowPopUpMsg(ex.Message, this.Page); return; } }
protected void ImgAddGrid_Click(object sender, ImageClickEventArgs e) { try { if (ViewState["CurrentTable"] != null) { DataTable dtCurrentTable = (DataTable)ViewState["CurrentTable"]; DataRow dtTableRow = null; if (dtCurrentTable.Rows.Count > 0) { if (string.IsNullOrEmpty(dtCurrentTable.Rows[0]["UnitFactor"].ToString())) { dtCurrentTable.Rows.RemoveAt(0); } } if (ViewState["GridIndex"] != null) { int rowindex = Convert.ToInt32(ViewState["GridIndex"]); dtCurrentTable.Rows[rowindex]["UnitId"] = Convert.ToInt32(ddlUnitConversion.SelectedValue); dtCurrentTable.Rows[rowindex]["UnitFactor"] = ddlUnitConversion.SelectedItem.Text; dtCurrentTable.Rows[rowindex]["Qty"] = Convert.ToDecimal(txtQty.Text); ViewState["CurrentTable"] = dtCurrentTable; GridDetails.DataSource = dtCurrentTable; GridDetails.DataBind(); MakeControlEmpty(); } else { dtTableRow = dtCurrentTable.NewRow(); dtTableRow["#"] = 0; dtTableRow["UnitId"] = Convert.ToInt32(ddlUnitConversion.SelectedValue); dtTableRow["UnitFactor"] = ddlUnitConversion.SelectedItem.Text; dtTableRow["Qty"] = Convert.ToDecimal(txtQty.Text); dtCurrentTable.Rows.Add(dtTableRow); ViewState["CurrentTable"] = dtCurrentTable; GridDetails.DataSource = dtCurrentTable; GridDetails.DataBind(); MakeControlEmpty(); } } } catch (Exception ex) { obj_Comman.ShowPopUpMsg(ex.Message, this.Page); } }
private void SetInitialRow() { DataTable Dt = new DataTable(); DataRow dr; Dt.Columns.Add("RequisitionNo", typeof(string)); Dt.Columns.Add("ReqDate", typeof(string)); Dt.Columns.Add("IssuseNo", typeof(string)); Dt.Columns.Add("IssuseDate", typeof(string)); Dt.Columns.Add("ReqLocation", typeof(string)); Dt.Columns.Add("IssuseLocation", typeof(string)); Dt.Columns.Add("ReqBy", typeof(string)); Dt.Columns.Add("IssuBy", typeof(string)); Dt.Columns.Add("CategoryName", typeof(string)); Dt.Columns.Add("ItemName", typeof(string)); Dt.Columns.Add("ItemDesc", typeof(string)); Dt.Columns.Add("RemarkForPO", typeof(string)); Dt.Columns.Add("Unit", typeof(string)); Dt.Columns.Add("Qty", typeof(decimal)); Dt.Columns.Add("OutwardQty", typeof(decimal)); Dt.Columns.Add("PendingQty", typeof(decimal)); Dt.Columns.Add("Rate", typeof(decimal)); Dt.Columns.Add("Amount", typeof(decimal)); dr = Dt.NewRow(); dr["RequisitionNo"] = ""; dr["ReqDate"] = ""; dr["IssuseNo"] = ""; dr["IssuseDate"] = ""; dr["ReqLocation"] = ""; dr["IssuseLocation"] = ""; dr["ReqBy"] = ""; dr["IssuBy"] = ""; dr["CategoryName"] = ""; dr["ItemName"] = ""; dr["ItemDesc"] = ""; dr["RemarkForPO"] = ""; dr["Unit"] = ""; dr["Qty"] = 0; dr["OutwardQty"] = 0; dr["PendingQty"] = 0; dr["Rate"] = 0; dr["Amount"] = 0; Dt.Rows.Add(dr); ViewState["CurrentTable"] = Dt; GridDetails.DataSource = Dt; GridDetails.DataBind(); }