private DataTable ConvertToDatatable() { CostLedgerDAL objcostDAL = new CostLedgerDAL(); DataTable dTN = new DataTable(); hidstr.Value = ""; string strAction = ""; DateTime?strDateFrom; DateTime?strDateTo; if (txtDateFrom.Text == "") { strDateFrom = null; } else { strDateFrom = Convert.ToDateTime(ApplicationFunction.mmddyyyy(txtDateFrom.Text)); } if (txtDateTo.Text == "") { strDateTo = null; } else { strDateTo = Convert.ToDateTime(ApplicationFunction.mmddyyyy(txtDateTo.Text)); } int intyearIdno = Convert.ToInt32(ddlDateRange.SelectedValue); Int64 intPrtyIdno = Convert.ToInt64(ddlParty.SelectedValue); #region Ledger Report DataTable dsTable = objcostDAL.SelectRep("SelectReport", intPrtyIdno, strDateFrom, strDateTo, intyearIdno, ApplicationFunction.ConnectionString()); objcostDAL = null; return(dsTable); }
private void BindPartyName() { CostLedgerDAL obj = new CostLedgerDAL(); DataSet ds = obj.FillLedger(ApplicationFunction.ConnectionString()); if ((ds != null) && (ds.Tables[0].Rows.Count > 0)) { ddlParty.DataSource = ds; ddlParty.DataTextField = "Acnt_Name"; ddlParty.DataValueField = "ID"; ddlParty.DataBind(); objAccountBookDAL = null; ddlParty.Items.Insert(0, new ListItem("--Select--", "0")); } }
private void BindGrid() { try { //if (ddlcompany.SelectedValue == "0") //{ // //ScriptManager.RegisterStartupScript(this, typeof(Page), "alert", "ShowMessage('Please Select Company Name!');", true); // msg = "Please Select Company Name!"; // ScriptManager.RegisterStartupScript(this, this.GetType(), "alertmsg", "PassMessage('" + msg + "')", true); // ddlcompany.Focus(); // return; //} //if (ddlParty.SelectedValue == "0") //{ // msg = "Please Select Party Name!"; // ScriptManager.RegisterStartupScript(this, this.GetType(), "alertmsg", "PassMessage('" + msg + "')", true); // ddlParty.Focus(); // return; //} DataTable dsTable1 = ConvertToDatatable(); if (dsTable1 != null && dsTable1.Rows.Count > 0) { grdMain.DataSource = dsTable1; grdMain.DataBind(); imgBtnExcel.Visible = true; printRep.Visible = true; lblTotalRecord.Text = "T. Record (s): " + dsTable1.Rows.Count; //if (rdoOB.Checked == true || rdoRP.Checked == true) } else { grdMain.DataSource = null; grdMain.DataBind(); imgBtnExcel.Visible = false; printRep.Visible = false; lblTotalRecord.Text = "T. Record (s): 0 "; } objAccountBookDAL = null; } catch (Exception Ex) { throw (Ex); } }
private DataTable ConvertToDatatable() { CostLedgerDAL objAccBookDAL = new CostLedgerDAL(); DataTable dTN = new DataTable(); hidstr.Value = ""; Int64 TruckIdno = 0; Int32 YearIdno = 0; string PrtyName = ""; Int64 PrtyIdno = 0; PrtyName = Convert.ToString(Session["PrtyName"]); lblLedgerName.Text = "[" + Convert.ToString(Session["PrtyName"]) + "]"; PrtyIdno = Convert.ToInt64(Session["PrtyIdno"]); TruckIdno = Convert.ToInt64(Session["TruckIdno"]); TruckIdno = Convert.ToInt64(Session["TruckIdno"]); 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, PrtyIdno, 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); }