/// <summary> /// 拒绝审批的方法 /// </summary> private void Refuse() { int jobflowid = int.Parse(Request.QueryString["jobflowid"].ToString()); //工作流的id string comparedata = " reviewerid=" + ((EtNet_Models.LoginInfo)Session["login"]).Id + " AND jobflowid=" + jobflowid.ToString(); if (EtNet_BLL.AuditJobFlowManager.GetList(comparedata).Rows.Count == 0) { //该工作流被收回或删除导致审批提交失败 Response.Redirect("../Job/AuditError.aspx?error=0"); } else if (EtNet_BLL.JobFlowManager.GetModel(jobflowid).auditstatus == "03" || EtNet_BLL.JobFlowManager.GetModel(jobflowid).auditstatus == "04") { //该工作流是审核方式是选审或会签所以在提交审核时,工作流已由他人审核通过 Response.Redirect("../Job/AuditError.aspx?error=1"); } else { string ruletxt = ""; //审批的分类 string strsql = " jobflowcode=" + jobflowid.ToString(); DataTable tbl = EtNet_BLL.ViewBLL.ViewAnnouncementInfoManager.getList("", strsql); if (tbl.Rows.Count == 1) { int ruleid = int.Parse(tbl.Rows[0]["ruleid"].ToString()); EtNet_Models.ApprovalRule rule = EtNet_BLL.ApprovalRuleManager.GetModel(ruleid); ruletxt = rule.sort; //修改当前审核人的记录 EtNet_Models.AuditJobFlow auditmodel = null; string auditstr = " jobflowid=" + jobflowid.ToString() + " AND reviewerid=" + ((EtNet_Models.LoginInfo)Session["login"]).Id; DataTable audittbl = EtNet_BLL.AuditJobFlowManager.GetList(auditstr); // 查找到当前审核人员的记录 int num = int.Parse(audittbl.Rows[0]["numbers"].ToString()); //当前审核人员编号 string mainreviewer = audittbl.Rows[0]["mainreviewer"].ToString(); //当前审核人是不是最终审核人 auditmodel = new EtNet_Models.AuditJobFlow(); auditmodel.auditoperat = "拒绝"; auditmodel.audittime = DateTime.Now; auditmodel.id = int.Parse(audittbl.Rows[0]["id"].ToString()); auditmodel.jobflowid = int.Parse(audittbl.Rows[0]["jobflowid"].ToString()); auditmodel.mainreviewer = audittbl.Rows[0]["mainreviewer"].ToString(); auditmodel.nowreviewer = "P"; //能查找到工作流记录,但不能进行审核操作 auditmodel.numbers = int.Parse(audittbl.Rows[0]["numbers"].ToString()); auditmodel.operatstatus = "已审批"; auditmodel.reviewerid = int.Parse(audittbl.Rows[0]["reviewerid"].ToString()); auditmodel.opiniontxt = Server.UrlDecode(this.iptcomment.Value.Trim()); EtNet_BLL.AuditJobFlowManager.Update(auditmodel); EtNet_Models.JobFlow jobflowmodel = new EtNet_Models.JobFlow(); jobflowmodel = EtNet_BLL.JobFlowManager.GetModel(jobflowid); //依据不同的审核类型进行操作 switch (ruletxt) { case "单审": case "会审": jobflowmodel.endtime = DateTime.Now; jobflowmodel.auditstatus = "03"; //工作流的审核状态为“被拒绝” EtNet_BLL.JobFlowManager.Update(jobflowmodel); break; case "选审": string st = " jobflowid=" + jobflowid.ToString(); DataTable tbla = EtNet_BLL.AuditJobFlowManager.GetList(st); bool refuse = true; for (int j = 0; j < tbla.Rows.Count; j++) { if (tbla.Rows[j]["auditoperat"].ToString() != "拒绝") { refuse = false; //还有其他审核人员未审 break; } } if (refuse) { jobflowmodel.endtime = DateTime.Now; jobflowmodel.auditstatus = "03"; // 工作流的审核状态为被拒绝 EtNet_BLL.JobFlowManager.Update(jobflowmodel); } else { jobflowmodel.auditstatus = "02"; // 工作流的审核状态为进行中 EtNet_BLL.JobFlowManager.Update(jobflowmodel); } break; } EtNet_Models.LoginInfo login = (EtNet_Models.LoginInfo)Session["login"]; string strad = "标题为" + jobflowmodel.cname + "公告,【" + login.Cname + "】拒绝审批!"; SendInfo(strad, jobflowmodel.id); //修改公告的审批意见 int announcementid = int.Parse(tbl.Rows[0]["id"].ToString()); EtNet_Models.AnnouncementInfo announcement = EtNet_BLL.AnnouncementInfoManager.GetModel(announcementid); announcement.opiniontxt = announcement.opiniontxt + login.Cname + "的审批意见:" + Server.UrlDecode(this.iptcomment.Value.Trim()) + "|"; EtNet_BLL.AnnouncementInfoManager.Update(announcement); if (HttpContext.Current.Request.QueryString["pageindex"] != null) { int page = int.Parse(HttpContext.Current.Request.QueryString["pageindex"]); Response.Redirect("../Job/AuditJobFlow.aspx?page=" + page + ""); } else { Response.Redirect("../Job/AuditJobFlow.aspx"); } } else { Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "audit", "<script> alert('审批出错!')</script>", false); } } }
protected void rptapplyleaveform_ItemCommand(object source, RepeaterCommandEventArgs e) { switch (e.CommandName) { case "edit": int jobflowid = int.Parse(e.CommandArgument.ToString()); EtNet_Models.JobFlow model = EtNet_BLL.JobFlowManager.GetModel(jobflowid); if (model != null && model.savestatus == "草稿") { Response.Redirect("ModifyLeaveForm.aspx?id=" + e.CommandArgument.ToString()); } else { LoadLeaveFormData(); Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "edit", "<script>alert('不能修改该请假单!')</script>", false); } break; case "search": Response.Redirect("SearchLeaveForm.aspx?id=" + e.CommandArgument.ToString()); break; case "del": int jfid = int.Parse(e.CommandArgument.ToString()); EtNet_Models.JobFlow jfmodel = EtNet_BLL.JobFlowManager.GetModel(jfid); if (jfmodel == null || jfmodel.auditstatus != "01") { LoadLeaveFormData(); Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "del", "<script>alert('删除失败,单据已删除或审核员已审核!')</script>", false); } else { string strSql = " jobflowid = " + e.CommandArgument.ToString(); EtNet_BLL.AuditJobFlowManager.Delete(strSql); int id = int.Parse(EtNet_BLL.ApplyLeaveListManager.GetList(strSql).Rows[0]["id"].ToString()); EtNet_BLL.ApplyLeaveListManager.Delete(id); DelFile(Convert.ToInt32(e.CommandArgument.ToString())); //删除上传的附件 EtNet_BLL.JobFlowFileManager.Delete(Convert.ToInt32(e.CommandArgument.ToString())); //删除工作流 EtNet_BLL.JobFlowManager.Delete(Convert.ToInt32(Convert.ToInt32(e.CommandArgument.ToString()))); LoadLeaveFormData(); Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "del", "<script>alert('删除成功!')</script>", false); } break; case "refresh": int refreshjfid = int.Parse(e.CommandArgument.ToString()); EtNet_Models.JobFlow refreshmodel = EtNet_BLL.JobFlowManager.GetModel(refreshjfid); if (refreshmodel != null && (refreshmodel.auditstatus == "01" || refreshmodel.auditstatus == "03")) { string strfresh = " jobflowid = " + e.CommandArgument.ToString(); EtNet_BLL.AuditJobFlowManager.Delete(strfresh); //删除审核人员的数据,请假单回到草稿状态 refreshmodel.savestatus = "草稿"; refreshmodel.auditstatus = "01"; string leaveformid = EtNet_BLL.ApplyLeaveListManager.GetList(strfresh).Rows[0]["id"].ToString(); //更具工作流id值获取请假单的id值 EtNet_Models.ApplyLeaveList leavemodel = EtNet_BLL.ApplyLeaveListManager.GetModel(int.Parse(leaveformid)); leavemodel.txt = ""; EtNet_BLL.ApplyLeaveListManager.Update(leavemodel); string strname = refreshmodel.cname; //请假单单编号 if (EtNet_BLL.JobFlowManager.Update(refreshmodel)) { Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "reone", "<script>alert('成功收回单据号为" + strname + "的请假单!')</script>", false); } } else { Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "retwo", "<script>alert('该请假单不能回收,原因可能已删除审核人员在审核或审核已通过!')</script>", false); } LoadLeaveFormData(); break; } }
/// <summary> /// 通过审批的方法 /// </summary> private void Pass() { int jobflowid = int.Parse(Request.QueryString["jobflowid"].ToString()); //工作流的id string comparedata = " reviewerid=" + ((EtNet_Models.LoginInfo)Session["login"]).Id + " AND jobflowid=" + jobflowid.ToString(); if (EtNet_BLL.AuditJobFlowManager.GetList(comparedata).Rows.Count == 0) { //该工作流被收回或删除导致审批提交失败 Response.Redirect("../Job/AuditError.aspx?error=0"); } else if (EtNet_BLL.JobFlowManager.GetModel(jobflowid).auditstatus == "03" || EtNet_BLL.JobFlowManager.GetModel(jobflowid).auditstatus == "04") { //该工作流是审批方式是选审或会签所以在提交审批时,工作流已由他人审批通过 Response.Redirect("../Job/AuditError.aspx?error=1"); } else { string ruletxt = ""; //审批的分类 string strsql = " jobflowcode=" + jobflowid.ToString(); DataTable tbl = EtNet_BLL.ViewBLL.ViewAnnouncementInfoManager.getList("", strsql); if (tbl.Rows.Count == 1) { int ruleid = int.Parse(tbl.Rows[0]["ruleid"].ToString()); EtNet_Models.ApprovalRule rule = EtNet_BLL.ApprovalRuleManager.GetModel(ruleid); ruletxt = rule.sort; //修改当前审核人的记录 EtNet_Models.AuditJobFlow auditmodel = null; string auditstr = " jobflowid=" + jobflowid.ToString() + " AND reviewerid=" + ((EtNet_Models.LoginInfo)Session["login"]).Id; DataTable audittbl = EtNet_BLL.AuditJobFlowManager.GetList(auditstr); // 查找到当前审核人员的记录 int num = int.Parse(audittbl.Rows[0]["numbers"].ToString()); //当前审核人员编号 string mainreviewer = audittbl.Rows[0]["mainreviewer"].ToString(); //当前审核人是不是最终审核人 auditmodel = new EtNet_Models.AuditJobFlow(); auditmodel.auditoperat = "通过"; auditmodel.audittime = DateTime.Now; auditmodel.id = int.Parse(audittbl.Rows[0]["id"].ToString()); auditmodel.jobflowid = int.Parse(audittbl.Rows[0]["jobflowid"].ToString()); auditmodel.mainreviewer = audittbl.Rows[0]["mainreviewer"].ToString(); auditmodel.nowreviewer = "P"; //能查找到工作流记录,但不能进行审核操作 auditmodel.numbers = int.Parse(audittbl.Rows[0]["numbers"].ToString()); auditmodel.operatstatus = "已审批"; auditmodel.reviewerid = int.Parse(audittbl.Rows[0]["reviewerid"].ToString()); auditmodel.opiniontxt = Server.UrlDecode(this.iptcomment.Value.Trim()); EtNet_BLL.AuditJobFlowManager.Update(auditmodel); EtNet_Models.JobFlow jobflowmodel = new EtNet_Models.JobFlow(); jobflowmodel = EtNet_BLL.JobFlowManager.GetModel(jobflowid); //依据不同的审核类型进行操作 switch (ruletxt) { case "单审": if (mainreviewer != "T") { auditmodel = new EtNet_Models.AuditJobFlow(); //设置下一个审核人的数据记录 string nextauditstr = " jobflowid=" + jobflowid.ToString() + " AND numbers=" + (num + 1).ToString(); DataTable nextaudittbl = EtNet_BLL.AuditJobFlowManager.GetList(nextauditstr); auditmodel.auditoperat = nextaudittbl.Rows[0]["auditoperat"].ToString(); auditmodel.audittime = DateTime.Parse(nextaudittbl.Rows[0]["audittime"].ToString()); auditmodel.id = int.Parse(nextaudittbl.Rows[0]["id"].ToString()); auditmodel.jobflowid = int.Parse(nextaudittbl.Rows[0]["jobflowid"].ToString()); auditmodel.mainreviewer = nextaudittbl.Rows[0]["mainreviewer"].ToString(); auditmodel.nowreviewer = "T"; //设置其为审核人员 auditmodel.numbers = int.Parse(nextaudittbl.Rows[0]["numbers"].ToString()); auditmodel.operatstatus = nextaudittbl.Rows[0]["operatstatus"].ToString(); auditmodel.reviewerid = int.Parse(nextaudittbl.Rows[0]["reviewerid"].ToString()); auditmodel.opiniontxt = nextaudittbl.Rows[0]["opiniontxt"].ToString(); EtNet_BLL.AuditJobFlowManager.Update(auditmodel); jobflowmodel.auditstatus = "02"; //工作流的审核状态为“进行中” EtNet_BLL.JobFlowManager.Update(jobflowmodel); } else { jobflowmodel.endtime = DateTime.Now; jobflowmodel.auditstatus = "04"; //工作流的审核状态为“已通过” EtNet_BLL.JobFlowManager.Update(jobflowmodel); } break; case "选审": jobflowmodel.endtime = DateTime.Now; jobflowmodel.auditstatus = "04"; //工作流的审核状态为“已通过” EtNet_BLL.JobFlowManager.Update(jobflowmodel); EtNet_BLL.AuditJobFlowManager.UpdateOther(" reviewerid != " + ((EtNet_Models.LoginInfo)Session["login"]).Id + " and jobflowid=" + jobflowid.ToString()); break; case "会审": bool pass = true; string straudit = " jobflowid=" + jobflowid.ToString(); DataTable auditjobtbl = EtNet_BLL.AuditJobFlowManager.GetList(straudit); for (int i = 0; i < auditjobtbl.Rows.Count; i++) { if (auditjobtbl.Rows[i]["auditoperat"].ToString() != "通过") { pass = false; //说明还有其他审核人员未开始审核 break; } } if (pass) { jobflowmodel.endtime = DateTime.Now; jobflowmodel.auditstatus = "04"; //工作流的状审核状态为“已通过” EtNet_BLL.JobFlowManager.Update(jobflowmodel); } else { jobflowmodel.auditstatus = "02"; //工作流的状审核状态为“进行中” EtNet_BLL.JobFlowManager.Update(jobflowmodel); } break; } EtNet_Models.LoginInfo login = (EtNet_Models.LoginInfo)Session["login"]; string strad = "标题为" + jobflowmodel.cname + "公告,【" + login.Cname + "】通过审批!"; SendInfo(strad, jobflowmodel.id); SendNextAudit(jobflowmodel.id); //修改公告的审批意见 int announcementid = int.Parse(tbl.Rows[0]["id"].ToString()); EtNet_Models.AnnouncementInfo announcement = EtNet_BLL.AnnouncementInfoManager.GetModel(announcementid); announcement.opiniontxt = announcement.opiniontxt + login.Cname + "的审批意见:" + Server.UrlDecode(this.iptcomment.Value.Trim()) + "|"; if (jobflowmodel.auditstatus == "04") { announcement.statusid = 2; announcement.createtime = DateTime.Now; AnnouncementInformation(announcementid); } EtNet_BLL.AnnouncementInfoManager.Update(announcement); if (HttpContext.Current.Request.QueryString["pageindex"] != null) { int page = int.Parse(HttpContext.Current.Request.QueryString["pageindex"]); Response.Redirect("../Job/AuditJobFlow.aspx?page=" + page + ""); } else { Response.Redirect("../Job/AuditJobFlow.aspx"); } } else { Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "audit", "<script> alert('审批出错!')</script>", false); } } }
/// <summary> /// 拒绝方法 /// </summary> private void Refuse() { int jobflowid = int.Parse(Request.QueryString["jobflowid"].ToString()); //工作流的id string comparedata = " reviewerid=" + ((EtNet_Models.LoginInfo)Session["login"]).Id + " AND jobflowid=" + jobflowid.ToString(); if (EtNet_BLL.AuditJobFlowManager.GetList(comparedata).Rows.Count == 0) { //该工作流被收回或删除导致审批提交失败 Response.Redirect("../AuditError.aspx?error=0"); } else if (EtNet_BLL.JobFlowManager.GetModel(jobflowid).auditstatus == "03" || EtNet_BLL.JobFlowManager.GetModel(jobflowid).auditstatus == "04") { //该工作流是审核方式是选审或会签所以在提交审核时,工作流已由他人审核通过 Response.Redirect("../AuditError.aspx?error=1"); } else { string ruletxt = ""; //审核的分类 string sqlstr = " jobflowid=" + jobflowid; DataTable tbl = EtNet_BLL.ViewBLL.ViewApplyOfficeSupplyManager.getList(sqlstr); if (tbl.Rows.Count == 1) { ruletxt = tbl.Rows[0]["rulesort"].ToString(); //修改办公用品申请单 EtNet_Models.ApplyOfficeSupply model = new EtNet_Models.ApplyOfficeSupply(); model.applicantid = int.Parse(tbl.Rows[0]["founderid"].ToString()); model.applydate = DateTime.Parse(tbl.Rows[0]["applydate"].ToString()); model.id = int.Parse(tbl.Rows[0]["id"].ToString()); model.jobflowid = int.Parse(tbl.Rows[0]["jobflowid"].ToString()); model.remark = tbl.Rows[0]["remark"].ToString(); model.txt = tbl.Rows[0]["txt"].ToString() + ((EtNet_Models.LoginInfo)Session["login"]).Cname + "的审核意见:" + Server.UrlDecode(this.treacomment.Value.Trim()) + "|"; EtNet_BLL.ApplyOfficeSupplyManager.Update(model); //修改当前审核人的记录 EtNet_Models.AuditJobFlow auditmodel = null; string auditstr = " jobflowid=" + jobflowid.ToString() + " AND reviewerid=" + ((EtNet_Models.LoginInfo)Session["login"]).Id; DataTable audittbl = EtNet_BLL.AuditJobFlowManager.GetList(auditstr); // 查找到当前审核人员的记录 int num = int.Parse(audittbl.Rows[0]["numbers"].ToString()); //当前审核人员编号 string mainreviewer = audittbl.Rows[0]["mainreviewer"].ToString(); //当前审核人是不是最终审核人 auditmodel = new EtNet_Models.AuditJobFlow(); auditmodel.auditoperat = "拒绝"; auditmodel.audittime = DateTime.Now; auditmodel.id = int.Parse(audittbl.Rows[0]["id"].ToString()); auditmodel.jobflowid = int.Parse(audittbl.Rows[0]["jobflowid"].ToString()); auditmodel.mainreviewer = audittbl.Rows[0]["mainreviewer"].ToString(); auditmodel.nowreviewer = "P"; //能查找到工作流记录,但不能进行审核操作 auditmodel.numbers = int.Parse(audittbl.Rows[0]["numbers"].ToString()); auditmodel.operatstatus = "已审核"; auditmodel.reviewerid = int.Parse(audittbl.Rows[0]["reviewerid"].ToString()); EtNet_BLL.AuditJobFlowManager.Update(auditmodel); EtNet_Models.JobFlow jobflowmodel = new EtNet_Models.JobFlow(); jobflowmodel = EtNet_BLL.JobFlowManager.GetModel(jobflowid); //依据不同的审核类型进行操作 switch (ruletxt) { case "单审": case "会签": jobflowmodel.endtime = DateTime.Now; jobflowmodel.auditstatus = "03"; //工作流的审核状态为“被拒绝” EtNet_BLL.JobFlowManager.Update(jobflowmodel); break; case "选审": string st = " jobflowid=" + jobflowid.ToString(); DataTable tbla = EtNet_BLL.AuditJobFlowManager.GetList(st); bool refuse = true; for (int j = 0; j < tbla.Rows.Count; j++) { if (tbla.Rows[j]["auditoperat"].ToString() != "拒绝") { refuse = false; //还有其他审核人员未审 break; } } if (refuse) { jobflowmodel.endtime = DateTime.Now; jobflowmodel.auditstatus = "03"; // 工作流的审核状态为被拒绝 EtNet_BLL.JobFlowManager.Update(jobflowmodel); } else { jobflowmodel.auditstatus = "02"; // 工作流的审核状态为进行中 EtNet_BLL.JobFlowManager.Update(jobflowmodel); } break; } string strad = "拒绝编号为" + jobflowmodel.cname + "的单据申请"; SendInfo(strad, jobflowmodel.id); Response.Redirect("../AuditJobFlow.aspx"); } else { Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "audit", "<script> alert('审批出错!')</script>", false); } } }
//送审 protected void imgbtnaudit_Click(object sender, ImageClickEventArgs e) { string[] str = FileUp(Request.Files); if (str[0] != "") { string strerror = "<script> alert('" + str[0] + "');</script>"; this.hidtxt.Value = Server.UrlDecode(this.hidtxt.Value); this.ddlrule.SelectedIndex = 0; this.auditpic.InnerHtml = ""; LoadFile(); Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "fileup", strerror, false); return; } int checkpid = 0; //校对人的id值 int signpid = 0; //签发人的id值 if (TestRule(this.ddlrule.SelectedValue, ref checkpid, ref signpid)) { int id = int.Parse(Request.QueryString["id"]); EtNet_Models.AnnouncementInfo model = EtNet_BLL.AnnouncementInfoManager.GetModel(id); if (model != null) { model.createtime = DateTime.Now; model.title = this.ipttitle.Value; model.starttime = DateTime.Parse(this.iptstart.Value); model.period = int.Parse(this.iptperiod.Value); model.endtime = model.starttime.AddDays(model.period); model.txt = Server.UrlDecode(this.hidtxt.Value); model.carboncopy = this.hidcarboncopy.Value; model.carboncopytxt = this.iptcarboncopy.Value; model.checkpid = checkpid; model.signpid = signpid; model.filenum = this.iptorder.Value; model.filetime = DateTime.Now; model.firmid = int.Parse(this.ddlfirm.SelectedValue); model.imgid = int.Parse(this.hidimgseal.Value); model.printtime = DateTime.Now; model.themeword = this.iptword.Value; model.yearnow = DateTime.Now.Year.ToString(); EtNet_BLL.AnnouncementInfoManager.Update(model); EtNet_Models.JobFlow jfmodel = EtNet_BLL.JobFlowManager.GetModel(model.jobflowid); jfmodel.cname = this.ipttitle.Value; jfmodel.createtime = DateTime.Now; //默认是当前时间 jfmodel.endtime = DateTime.Now; jfmodel.ruleid = int.Parse(this.ddlrule.SelectedValue); jfmodel.savestatus = "已提交"; EtNet_BLL.JobFlowManager.Update(jfmodel); CreateApproval(jfmodel.ruleid, jfmodel.id); SendInformation(jfmodel.id, jfmodel.ruleid); CreateFile(str, id); OperationRecord(id); Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "ad", "<script> alert('送审成功'); window.location='AnnouncementShowFirm.aspx'</script>", false); } else { Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "ad", "<script> alert('送审失败'); window.location='AnnouncementShowFirm.aspx'</script>", false); } } else { this.hidtxt.Value = Server.UrlDecode(this.hidtxt.Value); this.ddlrule.SelectedIndex = 0; this.auditpic.InnerHtml = ""; LoadFile(); } }
/// <summary> /// 拒绝方法 /// </summary> private void Refuse() { int jobflowid = int.Parse(Request.QueryString["jobflowid"].ToString()); //工作流的id EtNet_Models.LoginInfo login = (EtNet_Models.LoginInfo)Session["login"]; string comparedata = " reviewerid=" + login.Id.ToString() + " AND jobflowid=" + jobflowid.ToString(); if (EtNet_BLL.AuditJobFlowManager.GetList(comparedata).Rows.Count == 0) { //该工作流被收回或删除导致审批提交失败 Response.Redirect("../AuditError.aspx?error=0"); } else if (EtNet_BLL.JobFlowManager.GetModel(jobflowid).auditstatus == "03" || EtNet_BLL.JobFlowManager.GetModel(jobflowid).auditstatus == "04") { //该工作流是审核方式是选审或会签所以在提交审核时,工作流已由他人审核通过 Response.Redirect("../AuditError.aspx?error=1"); } else { string ruletxt = ""; //审核的分类 string streimburse = " jobflowid=" + jobflowid.ToString(); DataTable tbl = EtNet_BLL.ViewBLL.ViewAusRottenInfoManager.getlist(streimburse); if (tbl.Rows.Count == 1) { ruletxt = tbl.Rows[0]["rulesort"].ToString(); //修改报销申请单 EtNet_Models.AusRottenInfo rotmodel = new EtNet_Models.AusRottenInfo(); rotmodel.applycantid = int.Parse(tbl.Rows[0]["applycantid"].ToString()); rotmodel.applydate = DateTime.Parse(tbl.Rows[0]["applydate"].ToString()); rotmodel.id = int.Parse(tbl.Rows[0]["id"].ToString()); rotmodel.jobflowid = int.Parse(tbl.Rows[0]["jobflowid"].ToString()); //rotmodel.reimbursedsort = int.Parse(tbl.Rows[0]["reimbursedsort"].ToString()); rotmodel.remark = tbl.Rows[0]["remark"].ToString(); rotmodel.totalmoney = Decimal.Parse(tbl.Rows[0]["totalmoney"].ToString()); //rotmodel.belongsort = int.Parse(tbl.Rows[0]["belongsort"].ToString()); rotmodel.billstate = int.Parse(tbl.Rows[0]["billstatecode"].ToString()); rotmodel.txt = tbl.Rows[0]["txt"].ToString() + login.Cname + "的审批意见:" + Server.UrlDecode(this.tracomment.Value.Trim()) + "|"; rotmodel.itemtype = tbl.Rows[0]["itemtype"].ToString(); //项目类别汇总 rotmodel.person = tbl.Rows[0]["person"].ToString(); //报销人员汇总 rotmodel.Banker = tbl.Rows[0]["banker"].ToString(); rotmodel.BankName = tbl.Rows[0]["bankname"].ToString(); rotmodel.bankNum = tbl.Rows[0]["banknum"].ToString(); EtNet_BLL.AusRottenInfoManager.Update(rotmodel); //修改当前审核人的记录 EtNet_Models.AuditJobFlow auditmodel = null; string auditstr = " jobflowid=" + jobflowid.ToString() + " AND reviewerid=" + login.Id.ToString(); DataTable audittbl = EtNet_BLL.AuditJobFlowManager.GetList(auditstr); // 查找到当前审核人员的记录 int num = int.Parse(audittbl.Rows[0]["numbers"].ToString()); //当前审核人员编号 string mainreviewer = audittbl.Rows[0]["mainreviewer"].ToString(); //当前审核人是不是最终审核人 auditmodel = new EtNet_Models.AuditJobFlow(); auditmodel.auditoperat = "拒绝"; auditmodel.audittime = DateTime.Now; auditmodel.id = int.Parse(audittbl.Rows[0]["id"].ToString()); auditmodel.jobflowid = int.Parse(audittbl.Rows[0]["jobflowid"].ToString()); auditmodel.mainreviewer = audittbl.Rows[0]["mainreviewer"].ToString(); auditmodel.nowreviewer = "P"; //能查找到工作流记录,但不能进行审核操作 auditmodel.numbers = int.Parse(audittbl.Rows[0]["numbers"].ToString()); auditmodel.operatstatus = "已审批"; auditmodel.reviewerid = int.Parse(audittbl.Rows[0]["reviewerid"].ToString()); auditmodel.opiniontxt = Server.UrlDecode(this.tracomment.Value.Trim()); EtNet_BLL.AuditJobFlowManager.Update(auditmodel); EtNet_Models.JobFlow jobflowmodel = new EtNet_Models.JobFlow(); jobflowmodel = EtNet_BLL.JobFlowManager.GetModel(jobflowid); //依据不同的审核类型进行操作 switch (ruletxt) { case "单审": case "会审": jobflowmodel.endtime = DateTime.Now; jobflowmodel.auditstatus = "03"; //工作流的审核状态为“被拒绝” EtNet_BLL.JobFlowManager.Update(jobflowmodel); break; case "选审": string st = " jobflowid=" + jobflowid.ToString(); DataTable tbla = EtNet_BLL.AuditJobFlowManager.GetList(st); bool refuse = true; for (int j = 0; j < tbla.Rows.Count; j++) { if (tbla.Rows[j]["auditoperat"].ToString() != "拒绝") { refuse = false; //还有其他审核人员未审 break; } } if (refuse) { jobflowmodel.endtime = DateTime.Now; jobflowmodel.auditstatus = "03"; // 工作流的审核状态为被拒绝 EtNet_BLL.JobFlowManager.Update(jobflowmodel); } else { jobflowmodel.auditstatus = "02"; // 工作流的审核状态为进行中 EtNet_BLL.JobFlowManager.Update(jobflowmodel); } break; } string strad = "编号为" + jobflowmodel.cname + "的单据,【" + login.Cname + "】拒绝审批!"; SendInfo(strad, jobflowmodel.id); if (HttpContext.Current.Request.QueryString["pageindex"] != null) { int page = int.Parse(HttpContext.Current.Request.QueryString["pageindex"]); Response.Redirect("../AuditJobFlow.aspx?page=" + page + ""); } else { Response.Redirect("../AuditJobFlow.aspx"); } } else { Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "audit", "<script> alert('审批出错!')</script>", false); } } }
/// <summary> /// 通过审核方法 /// </summary> private void Pass() { int jobflowid = int.Parse(Request.QueryString["jobflowid"].ToString()); //工作流的id EtNet_Models.LoginInfo login = ((EtNet_Models.LoginInfo)Session["login"]); string comparedata = " reviewerid=" + login.Id.ToString() + " AND jobflowid=" + jobflowid.ToString(); if (EtNet_BLL.AuditJobFlowManager.GetList(comparedata).Rows.Count == 0) { //该工作流被收回或删除导致审批提交失败 Response.Redirect("../AuditError.aspx?error=0"); } else if (EtNet_BLL.JobFlowManager.GetModel(jobflowid).auditstatus == "03" || EtNet_BLL.JobFlowManager.GetModel(jobflowid).auditstatus == "04") { //该工作流是审核方式是选审或会签所以在提交审核时,工作流已由他人审核通过 Response.Redirect("../AuditError.aspx?error=1"); } else { string ruletxt = ""; //审核的分类 string streimburse = " jobflowid=" + jobflowid.ToString(); DataTable tbl = EtNet_BLL.ViewBLL.ViewAusRottenInfoManager.getlist(streimburse); //得到审核的信息 if (tbl.Rows.Count == 1) { ruletxt = tbl.Rows[0]["rulesort"].ToString(); //修改报销申请单 EtNet_Models.AusRottenInfo rotmodel = new EtNet_Models.AusRottenInfo(); rotmodel.applycantid = int.Parse(tbl.Rows[0]["applycantid"].ToString()); //填单人员关联id rotmodel.applydate = DateTime.Parse(tbl.Rows[0]["applydate"].ToString()); //填单时间 rotmodel.id = int.Parse(tbl.Rows[0]["id"].ToString()); //表id rotmodel.jobflowid = int.Parse(tbl.Rows[0]["jobflowid"].ToString()); //工作流关联id //rotmodel.reimbursedsort = int.Parse(tbl.Rows[0]["reimbursedsort"].ToString()); rotmodel.remark = tbl.Rows[0]["remark"].ToString(); //备注 rotmodel.totalmoney = Decimal.Parse(tbl.Rows[0]["totalmoney"].ToString()); //总金额 //rotmodel.belongsort = int.Parse(tbl.Rows[0]["belongsort"].ToString()); rotmodel.billstate = int.Parse(tbl.Rows[0]["billstatecode"].ToString()); //有票付款还是无票付款(现在隐藏该项,默认都是有票付款) rotmodel.txt = tbl.Rows[0]["txt"].ToString() + login.Cname + "的审批意见:" + Server.UrlDecode(this.tracomment.Value.Trim()) + "|"; rotmodel.itemtype = tbl.Rows[0]["itemtype"].ToString(); //项目类别汇总 rotmodel.person = tbl.Rows[0]["person"].ToString(); //报销人员汇总 rotmodel.Banker = tbl.Rows[0]["banker"].ToString(); rotmodel.BankName = tbl.Rows[0]["bankname"].ToString(); rotmodel.bankNum = tbl.Rows[0]["banknum"].ToString(); EtNet_BLL.AusRottenInfoManager.Update(rotmodel); //修改当前审核人的记录 EtNet_Models.AuditJobFlow auditmodel = null; string auditstr = " jobflowid=" + jobflowid.ToString() + " AND reviewerid=" + login.Id.ToString(); DataTable audittbl = EtNet_BLL.AuditJobFlowManager.GetList(auditstr); // 查找到当前审核人员的记录 int num = int.Parse(audittbl.Rows[0]["numbers"].ToString()); //当前审核人员编号 string mainreviewer = audittbl.Rows[0]["mainreviewer"].ToString(); //当前审核人是不是最终审核人 auditmodel = new EtNet_Models.AuditJobFlow(); auditmodel.auditoperat = "通过"; auditmodel.audittime = DateTime.Now; auditmodel.id = int.Parse(audittbl.Rows[0]["id"].ToString()); auditmodel.jobflowid = int.Parse(audittbl.Rows[0]["jobflowid"].ToString()); auditmodel.mainreviewer = audittbl.Rows[0]["mainreviewer"].ToString(); auditmodel.nowreviewer = "P"; //能查找到工作流记录,但不能进行审核操作 auditmodel.numbers = int.Parse(audittbl.Rows[0]["numbers"].ToString()); auditmodel.operatstatus = "已审批"; auditmodel.reviewerid = int.Parse(audittbl.Rows[0]["reviewerid"].ToString()); auditmodel.opiniontxt = Server.UrlDecode(this.tracomment.Value.Trim()); EtNet_BLL.AuditJobFlowManager.Update(auditmodel); EtNet_Models.JobFlow jobflowmodel = new EtNet_Models.JobFlow(); jobflowmodel = EtNet_BLL.JobFlowManager.GetModel(jobflowid); //依据不同的审核类型进行操作 switch (ruletxt) { case "单审": if (mainreviewer != "T") { auditmodel = new EtNet_Models.AuditJobFlow(); //设置下一个审核人的数据记录 string nextauditstr = " jobflowid=" + jobflowid.ToString() + " AND numbers=" + (num + 1).ToString(); DataTable nextaudittbl = EtNet_BLL.AuditJobFlowManager.GetList(nextauditstr); auditmodel.auditoperat = nextaudittbl.Rows[0]["auditoperat"].ToString(); //审批操作 开始/未开始/通过 auditmodel.audittime = DateTime.Parse(nextaudittbl.Rows[0]["audittime"].ToString()); auditmodel.id = int.Parse(nextaudittbl.Rows[0]["id"].ToString()); auditmodel.jobflowid = int.Parse(nextaudittbl.Rows[0]["jobflowid"].ToString()); auditmodel.mainreviewer = nextaudittbl.Rows[0]["mainreviewer"].ToString(); auditmodel.nowreviewer = "T"; //设置其为审核人员 auditmodel.numbers = int.Parse(nextaudittbl.Rows[0]["numbers"].ToString()); auditmodel.operatstatus = nextaudittbl.Rows[0]["operatstatus"].ToString(); auditmodel.reviewerid = int.Parse(nextaudittbl.Rows[0]["reviewerid"].ToString()); auditmodel.opiniontxt = nextaudittbl.Rows[0]["opiniontxt"].ToString(); EtNet_BLL.AuditJobFlowManager.Update(auditmodel); jobflowmodel.auditstatus = "02"; //工作流的审核状态为“进行中” EtNet_BLL.JobFlowManager.Update(jobflowmodel); } else { jobflowmodel.endtime = DateTime.Now; jobflowmodel.auditstatus = "04"; //工作流的审核状态为“已通过” EtNet_BLL.JobFlowManager.Update(jobflowmodel); //ModifyPayMoney(jobflowid); } break; case "选审": jobflowmodel.endtime = DateTime.Now; jobflowmodel.auditstatus = "04"; //工作流的审核状态为“已通过” EtNet_BLL.JobFlowManager.Update(jobflowmodel); EtNet_BLL.AuditJobFlowManager.UpdateOther(" reviewerid != " + login.Id + " and jobflowid=" + jobflowid.ToString()); //ModifyPayMoney(jobflowid); break; case "会审": bool pass = true; string strsql = " jobflowid=" + jobflowid.ToString(); DataTable auditjobtbl = EtNet_BLL.AuditJobFlowManager.GetList(strsql); for (int i = 0; i < auditjobtbl.Rows.Count; i++) { if (auditjobtbl.Rows[i]["auditoperat"].ToString() != "通过") { pass = false; //说明还有其他审核人员未开始审核 break; } } if (pass) { jobflowmodel.endtime = DateTime.Now; jobflowmodel.auditstatus = "04"; //工作流的状审核状态为“已通过” EtNet_BLL.JobFlowManager.Update(jobflowmodel); //ModifyPayMoney(jobflowid); } else { jobflowmodel.auditstatus = "02"; //工作流的状审核状态为“进行中” EtNet_BLL.JobFlowManager.Update(jobflowmodel); } break; } string strad = "编号为" + jobflowmodel.cname + "的单据,【" + login.Cname + "】通过审批!"; SendInfo(strad, jobflowmodel.id); SendNextAudit(jobflowmodel.id); if (HttpContext.Current.Request.QueryString["pageindex"] != null) { int page = int.Parse(HttpContext.Current.Request.QueryString["pageindex"]); Response.Redirect("../AuditJobFlow.aspx?page=" + page + ""); } else { Response.Redirect("../AuditJobFlow.aspx"); } } else { Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "audit", "<script> alert('审批出错!')</script>", false); } } }
//审核通过 protected void btnpass_Click(object sender, EventArgs e) { int jobflowid = int.Parse(Request.QueryString["jobflowid"].ToString()); //工作流的id string comparedata = " reviewerid=" + ((EtNet_Models.LoginInfo)Session["login"]).Id + " AND jobflowid=" + jobflowid.ToString(); if (EtNet_BLL.AuditJobFlowManager.GetList(comparedata).Rows.Count == 0) { //该工作流被收回或删除导致审批提交失败 Response.Redirect("../AuditError.aspx?error=0"); } else if (EtNet_BLL.JobFlowManager.GetModel(jobflowid).auditstatus == "03" || EtNet_BLL.JobFlowManager.GetModel(jobflowid).auditstatus == "04") { //该工作流是审核方式是选审或会签所以在提交审核时,工作流已由他人审核通过 Response.Redirect("../AuditError.aspx?error=1"); } else { string ruletxt = ""; //审核的分类 DataTable tbl = EtNet_BLL.ViewBLL.ViewApplyLeaveListManager.getOneList(jobflowid); if (tbl.Rows.Count == 1) { ruletxt = tbl.Rows[0]["rulesort"].ToString(); //修改请假单 EtNet_Models.ApplyLeaveList model = new EtNet_Models.ApplyLeaveList(); model.applydate = DateTime.Parse(tbl.Rows[0]["applydate"].ToString()); model.endtime = DateTime.Parse(tbl.Rows[0]["leaveendtime"].ToString()); model.id = int.Parse(tbl.Rows[0]["id"].ToString()); model.jobflowid = int.Parse(tbl.Rows[0]["jobflowid"].ToString()); model.leavepeopleid = int.Parse(tbl.Rows[0]["founderid"].ToString()); model.remark = tbl.Rows[0]["remark"].ToString(); model.sort = tbl.Rows[0]["applyleavesort"].ToString(); model.starttime = DateTime.Parse(tbl.Rows[0]["leavestarttime"].ToString()); model.txt = tbl.Rows[0]["applyleavetxt"].ToString() + ((EtNet_Models.LoginInfo)Session["login"]).Cname + "的审核意见:" + Server.UrlDecode(this.treacomment.Value.Trim()) + "|"; EtNet_BLL.ApplyLeaveListManager.Update(model); //修改当前审核人的记录 EtNet_Models.AuditJobFlow auditmodel = null; string auditstr = " jobflowid=" + jobflowid.ToString() + " AND reviewerid=" + ((EtNet_Models.LoginInfo)Session["login"]).Id; DataTable audittbl = EtNet_BLL.AuditJobFlowManager.GetList(auditstr); // 查找到当前审核人员的记录 int num = int.Parse(audittbl.Rows[0]["numbers"].ToString()); //当前审核人员编号 string mainreviewer = audittbl.Rows[0]["mainreviewer"].ToString(); //当前审核人是不是最终审核人 auditmodel = new EtNet_Models.AuditJobFlow(); auditmodel.auditoperat = "通过"; auditmodel.audittime = DateTime.Now; auditmodel.id = int.Parse(audittbl.Rows[0]["id"].ToString()); auditmodel.jobflowid = int.Parse(audittbl.Rows[0]["jobflowid"].ToString()); auditmodel.mainreviewer = audittbl.Rows[0]["mainreviewer"].ToString(); auditmodel.nowreviewer = "P"; //能查找到工作流记录,但不能进行审核操作 auditmodel.numbers = int.Parse(audittbl.Rows[0]["numbers"].ToString()); auditmodel.operatstatus = "已审核"; auditmodel.reviewerid = int.Parse(audittbl.Rows[0]["reviewerid"].ToString()); EtNet_BLL.AuditJobFlowManager.Update(auditmodel); EtNet_Models.JobFlow jobflowmodel = new EtNet_Models.JobFlow(); jobflowmodel = EtNet_BLL.JobFlowManager.GetModel(jobflowid); //依据不同的审核类型进行操作 switch (ruletxt) { case "单审": if (mainreviewer != "T") { auditmodel = new EtNet_Models.AuditJobFlow(); //设置下一个审核人的数据记录 string nextauditstr = " jobflowid=" + jobflowid.ToString() + " AND numbers=" + (num + 1).ToString(); DataTable nextaudittbl = EtNet_BLL.AuditJobFlowManager.GetList(nextauditstr); auditmodel.auditoperat = nextaudittbl.Rows[0]["auditoperat"].ToString(); auditmodel.audittime = DateTime.Parse(nextaudittbl.Rows[0]["audittime"].ToString()); auditmodel.id = int.Parse(nextaudittbl.Rows[0]["id"].ToString()); auditmodel.jobflowid = int.Parse(nextaudittbl.Rows[0]["jobflowid"].ToString()); auditmodel.mainreviewer = nextaudittbl.Rows[0]["mainreviewer"].ToString(); auditmodel.nowreviewer = "T"; //设置其为审核人员 auditmodel.numbers = int.Parse(nextaudittbl.Rows[0]["numbers"].ToString()); auditmodel.operatstatus = nextaudittbl.Rows[0]["operatstatus"].ToString(); auditmodel.reviewerid = int.Parse(nextaudittbl.Rows[0]["reviewerid"].ToString()); EtNet_BLL.AuditJobFlowManager.Update(auditmodel); jobflowmodel.auditstatus = "02"; //工作流的审核状态为“进行中” EtNet_BLL.JobFlowManager.Update(jobflowmodel); } else { jobflowmodel.endtime = DateTime.Now; jobflowmodel.auditstatus = "04"; //工作流的审核状态为“已通过” EtNet_BLL.JobFlowManager.Update(jobflowmodel); } break; case "选审": jobflowmodel.endtime = DateTime.Now; jobflowmodel.auditstatus = "04"; //工作流的审核状态为“已通过” EtNet_BLL.JobFlowManager.Update(jobflowmodel); break; case "会签": bool pass = true; string strsql = " jobflowid=" + jobflowid.ToString(); DataTable auditjobtbl = EtNet_BLL.AuditJobFlowManager.GetList(strsql); for (int i = 0; i < auditjobtbl.Rows.Count; i++) { if (auditjobtbl.Rows[i]["auditoperat"].ToString() != "通过") { pass = false; //说明还有其他审核人员未开始审核 break; } } if (pass) { jobflowmodel.endtime = DateTime.Now; jobflowmodel.auditstatus = "04"; //工作流的状审核状态为“已通过” EtNet_BLL.JobFlowManager.Update(jobflowmodel); } else { jobflowmodel.auditstatus = "02"; //工作流的状审核状态为“进行中” EtNet_BLL.JobFlowManager.Update(jobflowmodel); } break; } string strad = "通过编号为" + jobflowmodel.cname + "的单据申请"; SendInfo(strad, jobflowmodel.id); Response.Redirect("../AuditJobFlow.aspx"); } else { Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "audit", "<script> alert('审批出错!')</script>", false); } } }