private void BindGrid() { try { DataTable dsTable1 = ConvertToDatatable(); if (dsTable1 != null && dsTable1.Rows.Count > 0) { grdMain.DataSource = dsTable1; grdMain.DataBind(); imgBtnExcel.Visible = true; printRep.Visible = true; } else { grdMain.DataSource = null; grdMain.DataBind(); imgBtnExcel.Visible = false; printRep.Visible = false; } objAccountBookDAL = null; } catch (Exception Ex) { throw (Ex); } }
private void BindGrid() { DataTable DT = ConvertToDataTable(); if (DT != null && DT.Rows.Count > 0) { grdMain.DataSource = DT; grdMain.DataBind(); } else { grdMain.DataSource = null; grdMain.DataBind(); } objAccountBookDAL = null; }
private void BindGroup() { chkIemModel.DataSource = null; chkIemModel.Items.Clear(); DataTable dt = objAccountBookDAL.FillPrtyAndItem(conString, "groups"); if (dt.Rows.Count > 0) { chkIemModel.DataSource = dt; chkIemModel.DataTextField = "AHEAD_NAME"; chkIemModel.DataValueField = "AHead_Idno"; chkIemModel.DataBind(); objAccountBookDAL = null; } else { chkIemModel.Items.Insert(0, new ListItem("--Select--", "0")); } }
public static string[] GetPartyNo(string prefixText) { string constr = ApplicationFunction.ConnectionString(); List <string> PartyNumber = new List <string>(); DataTable dtNames = new DataTable(); AccountBookDAL obj = new AccountBookDAL(); DataSet dt = obj.SelectPartyList(prefixText, ApplicationFunction.ConnectionString()); if (dt != null && dt.Tables.Count > 0 && dt.Tables[0].Rows.Count > 0) { for (int i = 0; i < dt.Tables[0].Rows.Count; i++) { string item = AjaxControlToolkit.AutoCompleteExtender.CreateAutoCompleteItem(Convert.ToString(dt.Tables[0].Rows[i]["Acnt_Name"]), Convert.ToString(dt.Tables[0].Rows[i]["Acnt_Idno"])); PartyNumber.Add(item); } return(PartyNumber.ToArray()); } else { return(null); } }
private void BindGrid() { DataTable DT = ConvertToDataTable(); if (DT != null && DT.Rows.Count > 0) { grdMain.DataSource = DT; grdMain.DataBind(); Double TotalNetAmount = 0; Double TotalNetDebitAmount = 0; for (int i = 0; i < DT.Rows.Count; i++) { TotalNetAmount += Convert.ToDouble(DT.Rows[i]["CREDIT"]); TotalNetDebitAmount += Convert.ToDouble(DT.Rows[i]["DEBIT"]); } lblNetTotalAmount.Text = TotalNetAmount.ToString("N2"); lblDebitAmount.Text = TotalNetDebitAmount.ToString("N2"); int startRowOnPage = (grdMain.PageIndex * grdMain.PageSize) + 1; int lastRowOnPage = startRowOnPage + grdMain.Rows.Count - 1; lblcontant.Text = "Showing " + startRowOnPage.ToString() + " - " + lastRowOnPage.ToString() + " of " + DT.Rows.Count.ToString(); lblcontant.Visible = true; divpaging.Visible = true; } else { grdMain.DataSource = null; grdMain.DataBind(); lblcontant.Visible = false; divpaging.Visible = false; } objAccountBookDAL = null; }
private DataTable ConvertToDatatable() { CostCategorySumryDAL objAccBookDAL = new CostCategorySumryDAL(); DataTable dTN = new DataTable(); hidstr.Value = ""; Int64 TruckIdno = 0; Int32 YearIdno = 0; TruckIdno = Convert.ToInt64(Session["TruckIdno"]); YearIdno = Convert.ToInt32(Request.QueryString["YearIdno"]); lblTruckNo.Text = "[" + Convert.ToString(Session["TruckNo"]) + "]"; //Int64 intCompIdno = ddlcompany.SelectedItem.Text == "All" ? 0 : Convert.ToInt64(ddlcompany.SelectedValue); #region Ledger Report dTN.Columns.Add("PERTI"); dTN.Columns.Add("DEBIT"); dTN.Columns.Add("CREDIT"); dTN.Columns.Add("Balance"); dTN.Columns.Add("Mon"); dTN.Columns.Add("Truck_Idno"); string strAction = "SelectDetailReport"; DataSet dsTable = objAccBookDAL.FillCostgrid(ApplicationFunction.ConnectionString(), strAction, TruckIdno, YearIdno); #region if (dsTable != null && dsTable.Tables.Count > 0 && dsTable.Tables[0].Rows.Count > 0) { int i, j, m, mon; i = j = m = mon = 0; mon = 4; j = 0; for (i = 0; i < 12; i++) { DateTimeFormatInfo info = DateTimeFormatInfo.GetInstance(null); if (mon > 12) { mon = 1; } dTN.Rows.Add(); dTN.Rows[i][0] = (new ListItem(info.GetMonthName(mon).ToString(), mon.ToString())); dTN.Rows[i][1] = dTN.Rows[i][2] = dTN.Rows[i][3] = "00.00"; dTN.Rows[i][4] = mon; mon += 1; } for (i = 0; i < 12; i++) { if (j < dsTable.Tables[0].Rows.Count) { if (Convert.ToString(dsTable.Tables[0].Rows[j][4]) != "") { if (Convert.ToDouble(dTN.Rows[i][4]) == Convert.ToDouble(Convert.ToString(dsTable.Tables[0].Rows[j][4]).Substring(4, 2))) { dTN.Rows[i][0] = Convert.ToString(dsTable.Tables[0].Rows[j][0]); dTN.Rows[i][1] = string.Format("{0:0,0.00}", Convert.ToString(dsTable.Tables[0].Rows[j][1])); dTN.Rows[i][2] = string.Format("{0:0,0.00}", Convert.ToString(dsTable.Tables[0].Rows[j][2])); dTN.Rows[i][3] = string.Format("{0:0,0.00}", Convert.ToString(dsTable.Tables[0].Rows[j][3])); j += 1; } } } else { break; } } } #endregion #endregion objAccountBookDAL = null; return(dTN); }
protected void grdMain_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "showdetail") { GridViewRow row = (GridViewRow)((LinkButton)e.CommandSource).Parent.Parent; LinkButton lnkBtnVchrType = (LinkButton)row.FindControl("lnkBtnVchrType"); string Vchr_Type = lnkBtnVchrType.Text; HiddenField hidVchrIdno = (HiddenField)row.FindControl("hidVchrIdno"); int Vchr_Idno = Convert.ToInt32(hidVchrIdno.Value); HiddenField hidDoc = (HiddenField)row.FindControl("hidDoc"); int HId = Convert.ToInt32(hidDoc.Value); HiddenField hidVchrFrm = (HiddenField)row.FindControl("hidVchrFrm"); string FTyp = hidVchrFrm.Value.ToUpper(); string PageName = string.Empty; if (string.IsNullOrEmpty(FTyp) == false) { if (FTyp == "IB") { PageName = "Invoice.aspx?q="; } else if (FTyp == "ARIV") { PageName = "AmntAgainstInvoice.aspx?q="; } else if (FTyp == "CB") { PageName = "ChlnBooking.aspx?q="; } else if (FTyp == "FS") { PageName = "FuelSlip.aspx?FuelSlipIdno="; } else if (FTyp == "GR") { PageName = "GRPrep.aspx?Gr="; } else if (FTyp == "PTD") { PageName = "PaymentToOwn.aspx?q="; } else if (FTyp == "ACB") { PageName = "ChlnAmntPayment.aspx?q="; } else if (FTyp == "PB") { PageName = "PurchaseBill.aspx?PB="; } else if (FTyp == "SB") { PageName = "SaleBill.aspx?SbillIdno="; } if (string.IsNullOrEmpty(PageName) == false) { if (FTyp == "CB") { AccountBookDAL obj = new AccountBookDAL(); var lst = obj.SelectChallanType(Convert.ToInt64(HId)); string GRType = ""; if (lst != null) { GRType = Convert.ToString(lst.Gr_Type); string url = PageName + HId + "-" + GRType; string fullURL = "window.open('" + url + "', '_blank' );"; ScriptManager.RegisterStartupScript(this, typeof(string), "OPEN_WINDOW", fullURL, true); } } else if (FTyp == "IB") { AccountBookDAL obj = new AccountBookDAL(); var lst = obj.SelectInvoiceType(Convert.ToInt64(HId)); string GRType = ""; if (lst != null) { GRType = Convert.ToString(lst.Gr_Type); string url = PageName + HId + "-" + GRType; string fullURL = "window.open('" + url + "', '_blank' );"; ScriptManager.RegisterStartupScript(this, typeof(string), "OPEN_WINDOW", fullURL, true); } } else { string url = PageName + HId; string fullURL = "window.open('" + url + "', '_blank' );"; ScriptManager.RegisterStartupScript(this, typeof(string), "OPEN_WINDOW", fullURL, true); } } } else { string url = "VchrEntry.aspx?VchrIdno=" + HId; string fullURL = "window.open('" + url + "', '_blank' );"; ScriptManager.RegisterStartupScript(this, typeof(string), "OPEN_WINDOW", fullURL, true); } } }