//private DataTable CreateOpeningBalance(string conString, string strDateFrom, string strDateTo, int intyearIdno) //{ // AccountBookDAL objAccBookDAL11 = new AccountBookDAL(); // DataTable ds11 = new DataTable(); // hidstr.Value = ""; // //if (ddlParty.SelectedValue.Count() > 0) // if (ddlParty.Items.Count > 1) // { // if (ddlParty.SelectedIndex == 0) // { // for (int count = 1; count <= ddlParty.Items.Count - 1; count++) // { // hidstr.Value = ddlParty.Items[count].Value + "," + hidstr.Value; // } // } // else // { // hidstr.Value = ddlParty.SelectedValue + ","; // } // if (hidstr.Value != "" && Convert.ToString(hidstr.Value).Length > 1) // { // hidstr.Value = hidstr.Value.Substring(0, hidstr.Value.Length - 1); // } // string[] Arr = Convert.ToString(hidstr.Value).Split(new char[] { ',' }); // foreach (string I in Arr) // { // DataTable dtOutput = objAccBookDAL11.OpeningBalGrid(ApplicationFunction.ConnectionString(), "OpeningBalGrdyr", strDateFrom, strDateTo, intyearIdno, Convert.ToInt64(I)); // if (dtOutput != null && dtOutput.Rows.Count > 0) // { // if (ds11 == null || ds11.Rows.Count == 0) // { // ds11.Merge(dtOutput); // } // else // { // ds11.Merge(dtOutput); // } // } // } // } // return ds11; //} #endregion #region Grid Events... protected void grdMain_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "cmdshowdetail") { #region Ledger Account string OpeningBal = "0"; DataTable DtLedger = ConvertToDatatable(); GridViewRow row = (GridViewRow)((LinkButton)e.CommandSource).Parent.Parent; int PreviousRow = row.RowIndex - 1; LinkButton lnkBtnParticular = (LinkButton)row.FindControl("lnkBtnParticular"); //if (lnkBtnParticular.Text == "April") //{ // Label lblDebitOP = (Label)grdMain.Rows[PreviousRow].FindControl("lbl2Debit"); // Label lblCreditOP = (Label)grdMain.Rows[PreviousRow].FindControl("lbl3Credit"); // Double DebitOP = Convert.ToDouble(lblDebitOP.Text.Trim()); // Double CreditOP = Convert.ToDouble(lblCreditOP.Text.Trim()); // if (DebitOP > CreditOP) // { // OpeningBal = lblDebitOP.Text + " Dr"; // } // else // { // OpeningBal = lblCreditOP.Text + " Cr"; // } //} //else //{ // Label lbl4Balance = (Label)grdMain.Rows[PreviousRow].FindControl("lbl4Balance"); // OpeningBal = lbl4Balance.Text; //} int monthNo = 0; if (OpeningBal.ToLower() != "april") { monthNo = ApplicationFunction.monthNo(lnkBtnParticular.Text.Trim()); } int year = 0; if (monthNo > 3 && monthNo <= 12) { year = Convert.ToDateTime(ApplicationFunction.mmddyyyy(Convert.ToString(Session["StartDate"]))).Year; } else { year = Convert.ToDateTime(ApplicationFunction.mmddyyyy(Convert.ToString(Session["StartDate"]))).Year + 1; } string startDate = Convert.ToString("01-" + monthNo + "-" + year); //dd-MM-yyyy string endDate = Convert.ToString(DateTime.DaysInMonth(year, monthNo) + "-" + monthNo + "-" + year); //dd-MM-yyyy Int64 TruckIdno = Convert.ToInt64(Session["TruckIdno"]); string TruckNo = Convert.ToString(Session["TruckNo"]); Session["TruckNo"] = TruckNo; // string PartyName = TruckNo.Replace("&", " "); //ScriptManager.RegisterStartupScript(this, this.GetType(), "alertpopup", "ShowPopup('" + startDate + "','" + endDate + "','" + partyId + "','" + OpeningBal + "','" + PartyName + "')", true); Response.Redirect("CostVchrDetail.aspx?startdate=" + startDate + "&enddate=" + endDate + "&TruckIdno=" + TruckIdno + "&TruckNo=" + TruckNo); #endregion } else if (e.CommandName == "cmdshowdetail1D") { #region Ledger Year Wise Details... string StartDate = Convert.ToString(Convert.ToString(Session["StartDate"])); string EndDate = Convert.ToString(Session["EndDate"]); string FrmType = "LdgrAll"; Int64 TruckIdno = Convert.ToInt64(Session["TruckIdno"]); string TruckNo = Convert.ToString(Session["TruckNo"]); Session["TruckNo"] = TruckNo; Response.Redirect("CostVchrDetail.aspx?startdate=" + StartDate + "&enddate=" + EndDate + "&TruckIdno=" + TruckIdno + "&FrmType=" + FrmType + "&TruckNo=" + TruckNo); #endregion } }