protected void btnup_Click(object sender, EventArgs e) { DataTable dt1111 = MainAcocount.SelectReportPeriodwithWhid(ddlwarehouse.SelectedValue); if (dt1111.Rows.Count > 0) { if (Convert.ToDateTime(txtDate.Text) >= Convert.ToDateTime(dt1111.Rows[0]["StartDate"]) && Convert.ToDateTime(txtDate.Text) <= Convert.ToDateTime(dt1111.Rows[0]["EndDate"])) { ModalPopupExtender1.Show(); } else { lblMSG.Visible = true; lblMSG.Text = "Please check your date. You cannot select any date earlier/later than start/end date of the year"; } } }
protected void grid_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "Send") { ViewState["TaskId"] = Convert.ToInt32(e.CommandArgument); DataTable dtcrNew11 = MainAcocount.SelectOfficedocforGeneral(Convert.ToString(ViewState["TaskId"]), 9); GridView1.DataSource = dtcrNew11; GridView1.DataBind(); ModalPopupExtenderAddnew.Show(); } if (e.CommandName == "Add") { string te = "AddDocMaster.aspx?takid=" + ViewState["idd1"].ToString() + "&storeid=" + ViewState["idd"].ToString() + ""; // objm=" + ViewState["idd1"].ToString() + "&storeid=" + + ""; ScriptManager.RegisterStartupScript(this, typeof(string), "OPEN_WINDOW", "window.open('" + te + "');", true); } }
protected void ImageButton3_Click(object sender, EventArgs e) { DataTable dt1111 = MainAcocount.SelectReportPeriodwithWhid(ddlwarehouse.SelectedValue); if (dt1111.Rows.Count > 0) { if (Convert.ToDateTime(txtDate.Text) >= Convert.ToDateTime(dt1111.Rows[0]["StartDate"]) && Convert.ToDateTime(txtDate.Text) <= Convert.ToDateTime(dt1111.Rows[0]["EndDate"])) { lblMSG.Text = ""; // lblstartdate.Text = dt1111.Rows[0][0].ToString(); // ModalPopupExtender2.Show(); checkCrDr(); lblsss.Visible = false; lbldise.Visible = false; } else { lblMSG.Visible = true; lblMSG.Text = "Please check your date. You cannot select any date earlier/later than start/end date of the year"; } } }
public void fillwareselect() { chkappentry.Visible = false; DataTable appri = ClsAccountAppr.Apprreuqired(); if (appri.Rows.Count > 0) { ViewState["AccRS"] = "ACC"; int kn = ClsAccountAppr.Allowchkappr(ddlwarehouse.SelectedValue); if (kn == 1) { chkappentry.Visible = true; } } else { ViewState["AccRS"] = ""; } lblMSG.Text = ""; ImageButton3.Enabled = true; btnedit.Enabled = true; DataTable dtpaacc = select("Select * from AccountPageRightAccess where cid='" + Session["Comid"] + "' and Access='1' and AccType='0'"); if (dtpaacc.Rows.Count > 0) { ImageButton3.Enabled = false; btnedit.Enabled = false; DataTable dtrc = select(" select Accountingpagerightwithdesignation.* from Accountingpagerightwithdesignation inner join DesignationMaster on Accountingpagerightwithdesignation.DesignationId=DesignationMaster.DesignationMasterId " + " inner join DepartmentmasterMNC on DepartmentmasterMNC.Id=DesignationMaster.DeptId where DesignationId='" + Session["DesignationId"] + "' and DepartmentmasterMNC.whid='" + ddlwarehouse.SelectedValue + "'"); if (dtrc.Rows.Count > 0) { if (Convert.ToInt32(dtrc.Rows[0]["AccessRight"]) == 0) { lblMSG.Text = "Sorry,you are not access right for this business"; } else if (Convert.ToInt32(dtrc.Rows[0]["AccessRight"]) == 2) { if (Convert.ToInt32(dtrc.Rows[0]["Edit_Right"]) == 1) { btnedit.Enabled = true; } else if (Convert.ToInt32(dtrc.Rows[0]["Insert_Right"]) == 1) { ImageButton3.Enabled = true; } } else { ImageButton3.Enabled = true; btnedit.Enabled = true; } } else { lblMSG.Text = "Sorry,you are not access right for this business"; } } if (Request.QueryString["docid"] != null) { chkdoc.Checked = false; chkdoc.Visible = false; } else { chkdoc.Visible = true; } DataTable ds = MainAcocount.SelectEntrynumber("3", ddlwarehouse.SelectedValue); if (ds.Rows.Count > 0) { if (ds.Rows[0]["Id"].ToString() != "") { i = Convert.ToInt32(ds.Rows[0]["Id"]) + 1; } else { i = 1; } } else { i = 1; } txtEntryNo.Text = Convert.ToString(i); accountfill(); }
public void checkCrDr() { int accesin = 0; DataTable dtdr = select("Select AccountAddDataRequireTbl.* from AccountAddDataRequireTbl where Compid='" + Session["Comid"] + "' and Access='1'"); if (dtdr.Rows.Count > 0) { DataTable dtd = select("Select Distinct AccountPageDataAddDesignationRight.* from AccountPageDataAddDesignationRight where DesignationId='" + Convert.ToString(Session["DesignationId"]) + "'"); if (dtd.Rows.Count > 0) { if (Convert.ToInt32(dtd.Rows[0]["Accessbus"]) == 0) { accesin = 1; } else if (Convert.ToInt32(dtd.Rows[0]["Accessbus"]) == Convert.ToInt32(ddlwarehouse.SelectedValue)) { accesin = 1; } } } else { accesin = 1; } //int accesin = ClsAccountAppr.AccessInsert(ddlwarehouse.SelectedValue); if (accesin == 1) { bool access = UserAccess.Usercon("TranctionMaster", "", "Tranction_Master_Id", "", "", "compid", "TranctionMaster"); if (access == true) { decimal totalCr = 0; decimal totalDr = 0; foreach (GridViewRow gdr in GridView1.Rows) { if (gdr.Cells[2].Text == "Credit") { totalCr = totalCr + Convert.ToDecimal(gdr.Cells[3].Text); } else { totalDr = totalDr + Convert.ToDecimal(gdr.Cells[3].Text); } } if (totalCr == totalDr) { try { DataTable ds9 = MainAcocount.SelectEntrynumber("3", ddlwarehouse.SelectedValue); if (ds9.Rows.Count > 0) { if (ds9.Rows[0]["Id"].ToString() != "") { i = Convert.ToInt32(ds9.Rows[0]["Id"]) + 1; } else { i = 1; } } else { i = 1; } int id = MainAcocount.InsertTransactionMaster(Convert.ToDateTime(txtDate.Text), i.ToString(), "3", Convert.ToInt32(Session["userid"]), totalDr, ddlwarehouse.SelectedValue); if (i > 0) { ViewState["tid"] = id.ToString(); int tsid = MainAcocount.Sp_Insert_TranctionMasterSuppliment(id, "", 0, 0, 0); foreach (GridViewRow gdr1 in GridView1.Rows) { if (gdr1.Cells[2].Text == "Credit") { int tdid = MainAcocount.Sp_Insert_Tranction_Details1(0, Convert.ToInt32(gdr1.Cells[0].Text), 0, Convert.ToDecimal(gdr1.Cells[3].Text), id, Convert.ToString(gdr1.Cells[4].Text.Replace(" ", "")), Convert.ToDateTime(txtDate.Text), ddlwarehouse.SelectedValue); } else { int tdid = MainAcocount.Sp_Insert_Tranction_Details1(Convert.ToInt32(gdr1.Cells[0].Text), 0, Convert.ToDecimal(gdr1.Cells[3].Text), 0, id, Convert.ToString(gdr1.Cells[4].Text.Replace(" ", "")), Convert.ToDateTime(txtDate.Text), ddlwarehouse.SelectedValue); } } DataTable dtapprequirment = ClsAccountAppr.Apprreuqired(); if (dtapprequirment.Rows.Count > 0) { ClsAccountAppr.AccountAppMaster(ddlwarehouse.SelectedValue, ViewState["tid"].ToString(), chkappentry.Checked); } lblMSG.Visible = true; lblMSG.Text = "Record inserted successfully"; } else { lblMSG.Visible = true; lblMSG.Text = "Record is not added"; } txtDate.Text = System.DateTime.Now.ToShortDateString(); lblentrytype.Text = "Journal Entry"; DataTable ds56 = MainAcocount.SelectEntrynumber("3", ddlwarehouse.SelectedValue); if (ds56.Rows.Count > 0) { if (ds56.Rows[0]["Id"].ToString() != "") { i = Convert.ToInt32(ds56.Rows[0]["Id"]) + 1; } else { i = 1; } } else { i = 1; } txtEntryNo.Text = Convert.ToString(i); lbldise.Text = Convert.ToString(i); GridView1.DataSource = null; GridView1.DataBind(); ViewState["dt"] = null; if (Request.QueryString["docid"] != null) { inserdocatt(); } else { if (chkdoc.Checked == true) { entry(); // ModalPopupExtender1.Show(); // filldoc(); } } } catch (Exception ex) { lblMSG.Visible = true; lblMSG.Text = "Error:" + ex.Message.ToString(); } } else { if (totalCr > totalDr) { ddlcrdr.SelectedIndex = ddlcrdr.Items.IndexOf(ddlcrdr.Items.FindByText("Debit")); txtAmount.Text = Convert.ToString(totalCr - totalDr); } else if (totalCr < totalDr) { ddlcrdr.SelectedIndex = ddlcrdr.Items.IndexOf(ddlcrdr.Items.FindByText("Credit")); txtAmount.Text = Convert.ToString(totalDr - totalCr); } txtmemo.Focus(); txtmemo.Text = ""; lblMSG.Visible = true; lblMSG.Text = "Please check the total amount of all account debited must equal the total amount of all account credited"; } clear(); } else { lblMSG.Visible = true; lblMSG.Text = "Sorry, You are not permitted for greater record as per price plan"; } } else { lblMSG.Visible = true; lblMSG.Text = "You are not permited to insert record for this page."; } }
protected void Page_Load(object sender, EventArgs e) { //PageConn pgcon = new PageConn(); //con = pgcon.dynconn; //connection = pgcon.dynconn; pagetitleclass pg = new pagetitleclass(); string strData = Request.Url.ToString(); compid = Session["Comid"].ToString(); char[] separator = new char[] { '/' }; string[] strSplitArr = strData.Split(separator); int i = Convert.ToInt32(strSplitArr.Length); page = strSplitArr[i - 1].ToString(); Page.Title = pg.getPageTitle(page); if (!IsPostBack) { if (Request.QueryString["docid"] != null) { DataTable dtpt11 = MainAcocount.SelectDocumentMasterwithId(Convert.ToString(Request.QueryString["docid"])); if (dtpt11.Rows.Count > 0) { Label2.Text = dtpt11.Rows[0]["DocumentId"].ToString(); Label10.Text = dtpt11.Rows[0]["DocumentTitle"].ToString(); Label11.Text = Convert.ToDateTime(dtpt11.Rows[0]["DocumentDate"]).ToShortDateString();; Label12.Text = dtpt11.Rows[0]["DocumentType"].ToString(); Fillddlwarehouse(); ddlwarehouse.SelectedValue = dtpt11.Rows[0]["WarehouseId"].ToString(); ddlwarehouse.Enabled = false; ddlwarehouse_SelectedIndexChanged(sender, e); pnnl.Visible = true; } } } if (!IsPostBack) { if (Request.QueryString["docid"] == null) { fillware(); DataTable dteeed = ClsStore.SelectEmployeewithIdwise(); if (dteeed.Rows.Count > 0) { ddlwarehouse.SelectedValue = Convert.ToString(dteeed.Rows[0]["Whid"]); } } lblMSG.Visible = false; txtDate.Text = System.DateTime.Now.ToShortDateString(); lblentrytype.Text = "Journal Entry"; if (Request.QueryString["Tid"] != null) { // if (Request.QueryString["EntryN"] != null && Request.QueryString["EntryT"] != null) ddlwarehouse.Enabled = false; ViewState["Trid"] = Request.QueryString["Tid"].ToString(); ViewState["tid"] = ViewState["Trid"]; FillRequestedData(); } else { fillwareselect(); } } }
protected void FillRequestedData() { if (ViewState["Trid"] != null) { DataTable dtR1 = MainAcocount.SelectFillTrndata(Convert.ToString(ViewState["Trid"])); if (dtR1.Rows.Count > 0) { lblsss.Visible = true; lbldise.Visible = true; ddlwarehouse.SelectedValue = Convert.ToString(dtR1.Rows[0]["Whid"]); EventArgs e = new EventArgs(); object sender = new object(); ddlwarehouse_SelectedIndexChanged(sender, e); ViewState["TrMid1"] = Convert.ToString(dtR1.Rows[0]["Tranction_Master_Id"]); ViewState["TrDdatetimeOfTrs1"] = Convert.ToDateTime(dtR1.Rows[0]["DateTimeOfTransaction"]); //ViewState["TrMSuppId1"] = Convert.ToInt32(dtR1.Rows[0]["Tranction_Master_SupplimentId"]); txtEntryNo.Text = dtR1.Rows[0]["EntryNumber"].ToString(); lbldise.Text = dtR1.Rows[0]["EntryNumber"].ToString(); txtDate.Text = dtR1.Rows[0]["Date"].ToString(); //txtdesc.Text = dtR1.Rows[0]["MasterMemo"].ToString(); int entrytypeforCRDRinGrd = Convert.ToInt32(dtR1.Rows[0]["EntryTypeId"]); DataTable dt = new DataTable(); foreach (DataRow ddd in dtR1.Rows) { if (ViewState["dt"] == null) { //DataTable dt = new DataTable(); DataColumn dtcom = new DataColumn(); dtcom.DataType = System.Type.GetType("System.String"); dtcom.ColumnName = "AccountId"; dtcom.ReadOnly = false; dtcom.Unique = false; dtcom.AllowDBNull = true; dt.Columns.Add(dtcom); DataColumn dtcomd = new DataColumn(); dtcomd.DataType = System.Type.GetType("System.String"); dtcomd.ColumnName = "TrDid"; dtcomd.ReadOnly = false; dtcomd.Unique = false; dtcomd.AllowDBNull = true; dt.Columns.Add(dtcomd); DataColumn dtcomid = new DataColumn(); dtcomid.DataType = System.Type.GetType("System.String"); dtcomid.ColumnName = "Account"; dtcomid.ReadOnly = false; dtcomid.Unique = false; dtcomid.AllowDBNull = true; dt.Columns.Add(dtcomid); DataColumn dtcom12 = new DataColumn(); dtcom12.DataType = System.Type.GetType("System.String"); dtcom12.ColumnName = "CrDr"; dtcom12.ReadOnly = false; dtcom12.Unique = false; dtcom12.AllowDBNull = true; dt.Columns.Add(dtcom12); DataColumn dtcom13 = new DataColumn(); dtcom13.DataType = System.Type.GetType("System.String"); dtcom13.ColumnName = "Amount"; dtcom13.ReadOnly = false; dtcom13.Unique = false; dtcom13.AllowDBNull = true; dt.Columns.Add(dtcom13); DataColumn dtcom14 = new DataColumn(); dtcom14.DataType = System.Type.GetType("System.String"); dtcom14.ColumnName = "Memo"; dtcom14.ReadOnly = false; dtcom14.Unique = false; dtcom14.AllowDBNull = true; dt.Columns.Add(dtcom14); DataRow dtrow = dt.NewRow(); //dtrow["AccountId"] = ddlAccount.SelectedValue; //dtrow["Account"] = ddlAccount.SelectedItem.Text; //dtrow["CrDr"] = ddlcrdr.SelectedItem.Text; //dtrow["Amount"] = txtAmount.Text; if (ddd["AccountCredit"].ToString() != "0" && ddd["AccountCredit"].ToString() != "") { dtrow["AccountId"] = ddd["AccountCredit"].ToString(); DataTable dtAccNm = MainAcocount.SelectAccountId(ddd["AccountCredit"].ToString(), ddlwarehouse.SelectedValue); dtrow["Account"] = dtAccNm.Rows[0]["AccountName"].ToString(); dtrow["CrDr"] = "Credit"; dtrow["Amount"] = ddd["AmountCredit"].ToString(); dtrow["TrDid"] = ddd["Tranction_Details_Id"].ToString(); } else if (ddd["AccountDebit"].ToString() != "0" && ddd["AccountDebit"].ToString() != "") { dtrow["AccountId"] = ddd["AccountDebit"]; DataTable dtAccNm = MainAcocount.SelectAccountId(ddd["AccountDebit"].ToString(), ddlwarehouse.SelectedValue); dtrow["Account"] = Convert.ToString(dtAccNm.Rows[0]["AccountName"]); dtrow["CrDr"] = "Debit"; dtrow["Amount"] = ddd["AmountDebit"].ToString(); dtrow["TrDid"] = ddd["Tranction_Details_Id"].ToString(); } else { dtrow["Account"] = ""; dtrow["CrDr"] = "Debit"; dtrow["Amount"] = ddd["AmountDebit"].ToString(); dtrow["TrDid"] = ddd["Tranction_Details_Id"].ToString(); } dtrow["Memo"] = Convert.ToString(ddd["Memo"]); dt.Rows.Add(dtrow); ViewState["dt"] = dt; //GridView1.DataSource = dt; //GridView1.DataBind(); } else { //DataTable dt = new DataTable(); dt = (DataTable)ViewState["dt"]; DataRow dtrow = dt.NewRow(); //dtrow["AccountId"] = ddlAccount.SelectedValue; //dtrow["Account"] = ddlAccount.SelectedItem.Text; //dtrow["CrDr"] = ddlcrdr.SelectedItem.Text; //dtrow["Amount"] = txtAmount.Text; if (ddd["AccountCredit"].ToString() != "0" && ddd["AccountCredit"].ToString() != "") { dtrow["AccountId"] = ddd["AccountCredit"].ToString(); DataTable dtAccNm = MainAcocount.SelectAccountId(ddd["AccountCredit"].ToString(), ddlwarehouse.SelectedValue); dtrow["Account"] = dtAccNm.Rows[0]["AccountName"].ToString(); dtrow["CrDr"] = "Credit"; dtrow["Amount"] = ddd["AmountCredit"].ToString(); dtrow["TrDid"] = ddd["Tranction_Details_Id"].ToString(); } else if (ddd["AccountDebit"].ToString() != "0" && ddd["AccountDebit"].ToString() != "") { dtrow["AccountId"] = ddd["AccountDebit"]; DataTable dtAccNm = MainAcocount.SelectAccountId(ddd["AccountDebit"].ToString(), ddlwarehouse.SelectedValue); dtrow["Account"] = dtAccNm.Rows[0]["AccountName"].ToString(); dtrow["CrDr"] = "Debit"; dtrow["Amount"] = ddd["AmountDebit"].ToString(); dtrow["TrDid"] = ddd["Tranction_Details_Id"].ToString(); } else { dtrow["Account"] = ""; dtrow["CrDr"] = "Debit"; dtrow["Amount"] = ddd["AmountDebit"].ToString(); dtrow["TrDid"] = ddd["Tranction_Details_Id"].ToString(); } dtrow["Memo"] = Convert.ToString(ddd["Memo"]); dt.Rows.Add(dtrow); //dtrow["Memo"] = txtmemo.Text; //dt.Rows.Add(dtrow); ViewState["dt"] = dt; //GridView1.DataSource = dt; //GridView1.DataBind(); } DataTable ForEditGrd = new DataTable(); //dtE.Rows.RemoveAt(0); GridView1.DataSource = dt; GridView1.DataBind(); txtEntryNo.Text = dtR1.Rows[0]["EntryNumber"].ToString(); lbldise.Text = dtR1.Rows[0]["EntryNumber"].ToString(); if (Request.QueryString["vid"] != null) { Panel1.Enabled = false; GridView1.Columns[6].Visible = false; btnedit.Visible = false; } else { Panel1.Enabled = false; GridView1.Columns[6].Visible = false; btnedit.Visible = true; //btnup.Visible = true; } } } } }