protected void Page_Load(object sender, EventArgs e) { if (Session["Comid"] == null) { Response.Redirect("~/Shoppingcart/Admin/ShoppingCartLogin.aspx"); } PageConn pgcon = new PageConn(); con = pgcon.dynconn; MasterCls1 clsMaster = new MasterCls1(); DataTable dt = new DataTable(); DocumentCls1 clsDocument = new DocumentCls1(); EmployeeCls clsEmployee = new EmployeeCls(); if (!IsPostBack) { if (Session["Comid"] == null) { Response.Redirect("~/Shoppingcart/Admin/ShoppingCartLogin.aspx"); } lblBusiness0.Text = Session["Cname"].ToString(); ViewState["sortOrder"] = ""; lblmsg.Text = ""; fillstore(); fillfilterstore(); fillgrid(); } }
protected void imgbtnsubmit_Click(object sender, EventArgs e) { string str = "SELECT * FROM RuleApproveTypeMaster where RuleApproveTypeName = '" + txtdocapprvltype.Text + "'and Whid='" + ddlbusiness.SelectedValue + "' "; SqlCommand cmd1 = new SqlCommand(str, con); cmd1.CommandType = CommandType.Text; SqlDataAdapter da = new SqlDataAdapter(cmd1); DataTable dt = new DataTable(); da.Fill(dt); if (dt.Rows.Count == 0) { clsDocument = new DocumentCls1(); Int32 rst = clsDocument.InsertDocumentApproveTypeMaster(txtdocapprvltype.Text, txtdesc.Text, ddlbusiness.SelectedValue); if (rst > 0) { lblmsg.Visible = true; lblmsg.Text = "Record inserted Successfully."; FillDocumentApproveType(); clearall(); } } else { lblmsg.Visible = true; lblmsg.Text = "Record already exist"; } pnladd.Visible = false; Label8.Visible = false; btnadd.Visible = true; Label8.Text = "Add New Document Approval Type"; }
protected void FillDocumentTypeAll() { DocumentCls1 clsDocument = new DocumentCls1(); DataTable dt = new DataTable(); dt = clsDocument.SelectDocTypeAll(ddlbusiness.SelectedValue); ddldoctype.DataSource = dt; ddldoctype.DataBind(); }
protected void LinkButton152_Click(object sender, EventArgs e) { DocumentCls1 clsDocument = new DocumentCls1(); DataTable dt = new DataTable(); dt = clsDocument.SelectDocTypeAll(ddlbusiness.SelectedValue); ddldoctype.DataSource = dt; ddldoctype.DataBind(); }
protected void FillDocumentTypeAll() { DocumentCls1 clsDocument = new DocumentCls1(); DataTable dt = new DataTable(); dt = clsDocument.SelectDocTypeAll(ddlbusiness.SelectedValue); ddldoctype.DataSource = dt; ddldoctype.DataBind(); ddldoctype.Items.Insert(0, "--Select--"); ddldoctype.Items[0].Value = "0"; }
protected void FillDocumentTypeAll() { DocumentCls1 clsDocument = new DocumentCls1(); DataTable dt = new DataTable(); dt = clsDocument.SelectDocTypeAll(ddlbusiness.SelectedValue); ddldoctype.DataSource = dt; ddldoctype.DataTextField = "doctype"; ddldoctype.DataValueField = "DocumentTypeId"; ddldoctype.DataBind(); //ddldoctype.Items.Insert(0, "--Select--"); EventArgs e = new EventArgs(); object sender = new object(); ddldoctype_SelectedIndexChanged(sender, e); }
protected void Page_Load(object sender, EventArgs e) { PageConn pgcon = new PageConn(); con = pgcon.dynconn; MasterCls1 clsMaster = new MasterCls1(); DataTable dt = new DataTable(); DocumentCls1 clsDocument = new DocumentCls1(); EmployeeCls clsEmployee = new EmployeeCls(); if (!IsPostBack) { lblBusiness0.Text = Session["Cname"].ToString(); ViewState["sortOrder"] = ""; lblmsg.Text = ""; fillstore(); fillfilterstore(); fillgrid(); } }
protected void fillaccess() { DataTable dts = select("Select EmailApproval.* from EmailApproval Where ControlNo='" + Request.QueryString["cn"] + "'"); Session["EmployeeId"] = dts.Rows[0]["UserId"]; DocumentCls1 clsDocument = new DocumentCls1(); DataTable dte = select("Select distinct RuleDetail.RuleDetailId from RuleDetail inner join RuleProcessMaster on RuleDetail.RuleDetailId=RuleProcessMaster.RuleDetailId where RuleDetail.RuleDetailId='" + Convert.ToInt32(Request.QueryString["rdt"]) + "' and RuleProcessMaster.DocumentId='" + dts.Rows[0]["DocumentId"] + "' and RuleProcessMaster.EmployeeId='" + Session["EmployeeId"] + "' "); if (dte.Rows.Count <= 0) { lblmsg.Text = "Your Document approval has been successfully recorded."; if (Request.QueryString["cn"] != null && Request.QueryString["ap"] != "ync") { bool success = clsDocument.InsertRuleProcess(Convert.ToInt32(dts.Rows[0]["DocumentId"]), Convert.ToInt32(Request.QueryString["rdt"]), "Email Approval", Convert.ToBoolean(true)); success = true; string str = "Update EmailApproval Set AnswerReceived='True', DatetimeInventorySend='" + DateTime.Now.ToString() + "' where ControlNo='" + Request.QueryString["cn"] + "'"; SqlCommand cmd = new SqlCommand(str, dynconn); if (dynconn.State.ToString() != "Open") { dynconn.Open(); } cmd.ExecuteNonQuery(); dynconn.Close(); sendmail(dts); } else if (Request.QueryString["ap"] == "ync") { bool success = clsDocument.InsertRuleProcess(Convert.ToInt32(dts.Rows[0]["DocumentId"]), Convert.ToInt32(Request.QueryString["rdt"]), "Email Rejected", Convert.ToBoolean(false)); success = true; string str = "Update EmailApproval Set AnswerReceived='True',ApprovalReject='True', DatetimeInventorySend='" + DateTime.Now.ToString() + "' where ControlNo='" + Request.QueryString["cn"] + "'"; SqlCommand cmd = new SqlCommand(str, dynconn); if (dynconn.State.ToString() != "Open") { dynconn.Open(); } cmd.ExecuteNonQuery(); dynconn.Close(); sendmail(dts); } } else { lblmsg.Text = "This Document already approved before"; } string str1 = " Select Distinct CompanyMaster.CompanyName, EmployeeMaster.EmployeeName, OutGoingMailServer,WebMasterEmail, EmailMasterLoginPassword, AdminEmail, CompanyMaster.CompanyLogo,WarehouseMaster.Name as Wname,CityMasterTbl.CityName,StateMasterTbl.Statename,CountryMaster.CountryName from EmployeeMaster inner join WarehouseMaster on WarehouseMaster.WarehouseId=EmployeeMaster.Whid" + " inner join CompanyWebsitMaster on CompanyWebsitMaster.Whid= WarehouseMaster.WarehouseId inner join " + " CompanyMaster on CompanyMaster.CompanyId=CompanyWebsitMaster.CompanyId inner join CompanyAddressMaster" + " on CompanyAddressMaster.CompanyMasterId=CompanyMaster.CompanyId inner join CountryMaster on " + "CountryMaster.CountryId=CompanyAddressMaster.Country inner join StateMasterTbl on " + "StateMasterTbl.StateId=CompanyAddressMaster.State inner join CityMasterTbl on " + "CityMasterTbl.CityId=CompanyAddressMaster.City where CompanyWebsitMaster.Whid='" + dts.Rows[0]["Whid"] + "' and EmployeeMaster.EmployeeMasterId='" + dts.Rows[0]["UserId"] + "'"; SqlCommand cmdsq = new SqlCommand(str1, dynconn); SqlDataAdapter adp = new SqlDataAdapter(cmdsq); DataTable dt = new DataTable(); adp.Fill(dt); if (dt.Rows.Count > 0) { Wname.Text = Convert.ToString(dt.Rows[0]["Wname"]); lblciti.Text = Convert.ToString(dt.Rows[0]["CityName"]); lblstate.Text = Convert.ToString(dt.Rows[0]["Statename"]); lblcountry.Text = Convert.ToString(dt.Rows[0]["CountryName"]); lblcname.Text = Convert.ToString(dt.Rows[0]["CompanyName"]); img1.ImageUrl = "~/ShoppingCart/images/" + Convert.ToString(dt.Rows[0]["CompanyLogo"]); } DataTable dtsaa = select("Select DocumentMaster.DocumentTitle, EmployeeMaster.EmployeeName,RuleProcessMaster.* from RuleMaster inner join RuleDetail on RuleDetail.RuleId=RuleMaster.RuleId inner join RuleProcessMaster on RuleProcessMaster.RuleDetailId=RuleDetail.RuleDetailId inner join EmployeeMaster on EmployeeMaster.EmployeeMasterId= RuleProcessMaster.EmployeeId inner join DocumentMaster on DocumentMaster.DocumentId=RuleProcessMaster.DocumentId where RuleProcessMaster.DocumentId='" + dts.Rows[0]["DocumentId"] + "' and RuleProcessMaster.EmployeeId='" + dts.Rows[0]["UserId"] + "'"); if (dtsaa.Rows.Count > 0) { lblDocId.Text = Convert.ToString(dts.Rows[0]["DocumentId"]); lbldoctitle.Text = Convert.ToString(dtsaa.Rows[0]["DocumentTitle"]); lblemployeename.Text = Convert.ToString(dtsaa.Rows[0]["EmployeeName"]); lblapprovaldatetime.Text = Convert.ToString(dtsaa.Rows[0]["RuleProcessDate"]); } }
protected void btnaddnewaccount_Click(object sender, EventArgs e) { if (ddlbusiness.SelectedIndex > -1) { string str1 = "select Name,Report_Period_Id,StartDate,EndDate from ReportPeriod where Compid = '" + Session["comid"] + "' and Whid='" + ddlbusiness.SelectedValue + "' order by EndDate Desc"; SqlCommand cmd1 = new SqlCommand(str1); cmd1.Connection = con; SqlDataAdapter da1 = new SqlDataAdapter(); da1.SelectCommand = cmd1; DataTable ds1 = new DataTable(); da1.Fill(ds1); if (ds1.Rows.Count >= 1) { string[] separator1 = new string[] { " TO " }; string[] strSplitArr1 = ds1.Rows[0]["Name"].ToString().Split(separator1, StringSplitOptions.RemoveEmptyEntries); int i111 = Convert.ToInt32(strSplitArr1.Length); if (i111 == 2 || i111 == 1) { int fr = Convert.ToInt32(strSplitArr1[0].ToString()); int sec = 0; if (i111 > 1) { sec = Convert.ToInt32(strSplitArr1[1].ToString()); } string strdate1 = ""; string lastdate = ""; string strdate2 = ""; string lasttwodata = ""; int ddt1 = fr + 1; int dde1 = sec + 1; strdate1 = ddt1.ToString(); lastdate = strdate1.Substring(2); string peram = ""; if (i111 == 2) { strdate2 = dde1.ToString(); lasttwodata = strdate2.Substring(2); peram = ddt1 + " TO " + dde1; } else { peram = ddt1.ToString(); } string addsdate = Convert.ToDateTime(ds1.Rows[0]["StartDate"]).AddMonths(12).ToShortDateString(); string addedate = Convert.ToDateTime(ds1.Rows[0]["EndDate"]).AddMonths(12).ToShortDateString(); SqlCommand cmdtr = new SqlCommand("Insert into ReportPeriod(Name,StartDate,EndDate,FistStartDate,Active,Compid,Whid)Values('" + peram + "','" + addsdate + "','" + addedate + "','" + DateTime.Now.ToShortDateString() + "','0','" + Session["comid"] + "','" + ddlbusiness.SelectedValue + "') ", con); if (con.State.ToString() != "Open") { con.Open(); } cmdtr.ExecuteNonQuery(); con.Close(); SqlCommand cmsa = new SqlCommand("SELECT max(Report_Period_Id) from ReportPeriod where Compid='" + Session["comid"] + "' and Whid='" + ddlbusiness.SelectedValue + "'", con); con.Open(); object xde = cmsa.ExecuteScalar(); con.Close(); string str5t = "select Id from AccountMaster where Whid='" + ddlbusiness.SelectedValue + "'"; SqlCommand cmd32t = new SqlCommand(str5t, con); SqlDataAdapter adp15t = new SqlDataAdapter(cmd32t); DataTable dtlogin14t = new DataTable(); adp15t.Fill(dtlogin14t); foreach (DataRow dr in dtlogin14t.Rows) { SqlCommand cmdtr1 = new SqlCommand("Insert into AccountBalance(AccountMasterId,Balance,Report_Period_Id)Values('" + dr["Id"] + "','0','" + xde + "') ", con); con.Open(); cmdtr1.ExecuteNonQuery(); con.Close(); } lblmsg.Text = "New accounting year created successfully"; lblmsg.Visible = true; DocumentCls1 clsDocument = new DocumentCls1(); // Int32 mainyearcabinet = clsDocument.InsertDocumentMainType("Accounting", ddlbusiness.SelectedValue); string maincabinetmax = "select * from DocumentMainType where CID='" + Session["comid"].ToString() + "' and Whid='" + ddlbusiness.SelectedValue + "' and DocumentMainType='Accounting' "; SqlCommand cmdmaincabinetmax = new SqlCommand(maincabinetmax, con); SqlDataAdapter adpmaincabinetmax = new SqlDataAdapter(cmdmaincabinetmax); DataTable dtmaincabinetmax = new DataTable(); adpmaincabinetmax.Fill(dtmaincabinetmax); if (dtmaincabinetmax.Rows.Count > 0) { Int32 mainyeardrawer = clsDocument.InsertDocumentSubType(Convert.ToInt32(dtmaincabinetmax.Rows[0]["DocumentMainTypeId"]), "" + peram + ""); string maindrawermax = "select Max(DocumentSubTypeId) as DocumentSubTypeId from DocumentSubType "; SqlCommand just = new SqlCommand(maindrawermax, con); SqlDataAdapter adpmaindrawermax = new SqlDataAdapter(just); DataTable dtmaindrawermax = new DataTable(); adpmaindrawermax.Fill(dtmaindrawermax); if (dtmaindrawermax.Rows.Count > 0) { string perment = ""; if (i111 == 2) { perment = lastdate + "-" + lasttwodata; } else { perment = peram; } Int32 mainyearfolder = clsDocument.InsertDocumentType1(Convert.ToInt32(dtmaindrawermax.Rows[0]["DocumentSubTypeId"]), "Purchase Invoice" + " " + perment); Int32 mainyearfolder1 = clsDocument.InsertDocumentType1(Convert.ToInt32(dtmaindrawermax.Rows[0]["DocumentSubTypeId"]), "Cash Payments" + " " + perment); Int32 mainyearfolder2 = clsDocument.InsertDocumentType1(Convert.ToInt32(dtmaindrawermax.Rows[0]["DocumentSubTypeId"]), "Cash Receipts" + " " + perment); Int32 mainyearfolder3 = clsDocument.InsertDocumentType1(Convert.ToInt32(dtmaindrawermax.Rows[0]["DocumentSubTypeId"]), "Journal Entry" + " " + perment); Int32 mainyearfolder4 = clsDocument.InsertDocumentType1(Convert.ToInt32(dtmaindrawermax.Rows[0]["DocumentSubTypeId"]), "Sales Invoice" + " " + perment); Int32 mainyearfolder5 = clsDocument.InsertDocumentType1(Convert.ToInt32(dtmaindrawermax.Rows[0]["DocumentSubTypeId"]), "Retail Sales Invoice" + " " + perment); Int32 mainyearfolder6 = clsDocument.InsertDocumentType1(Convert.ToInt32(dtmaindrawermax.Rows[0]["DocumentSubTypeId"]), "Debit-Credit Note" + " " + perment); Int32 mainyearfolder7 = clsDocument.InsertDocumentType1(Convert.ToInt32(dtmaindrawermax.Rows[0]["DocumentSubTypeId"]), "Quick Cash Entry" + " " + perment); Int32 mainyearfolder8 = clsDocument.InsertDocumentType1(Convert.ToInt32(dtmaindrawermax.Rows[0]["DocumentSubTypeId"]), "Paypal Cash/Bank Receipts" + " " + perment); Int32 mainyearfolder9 = clsDocument.InsertDocumentType1(Convert.ToInt32(dtmaindrawermax.Rows[0]["DocumentSubTypeId"]), "Paypal Cash/Bank Payments" + " " + perment); Int32 mainyearfolder10 = clsDocument.InsertDocumentType1(Convert.ToInt32(dtmaindrawermax.Rows[0]["DocumentSubTypeId"]), "Cash Statement" + " " + perment); Int32 mainyearfolder11 = clsDocument.InsertDocumentType1(Convert.ToInt32(dtmaindrawermax.Rows[0]["DocumentSubTypeId"]), "Paypal Statement" + " " + perment); } } fillgrid(); } } } }