/// <summary>
        /// 增加一条数据
        /// </summary>
        public static bool Add(EtNet_Models.AusRottenInfo model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into AusRottenInfo(");
            strSql.Append("applydate,applycantid,totalmoney,remark,txt,jobflowid,billstate,itemtype,person,banker,bankname,banknum)");
            strSql.Append(" values (");
            strSql.Append("@applydate,@applycantid,@totalmoney,@remark,@txt,@jobflowid,@billstate,@itemtype,@person,@banker,@bankname,@banknum)");

            SqlParameter[] parameters =
            {
                new SqlParameter("@applydate",   SqlDbType.Date,      3),
                new SqlParameter("@applycantid", SqlDbType.Int,       4),
                new SqlParameter("@totalmoney",  SqlDbType.Money,     8),
                new SqlParameter("@remark",      SqlDbType.Text),
                new SqlParameter("@txt",         SqlDbType.VarChar, 200),
                new SqlParameter("@jobflowid",   SqlDbType.Int,       4),
                new SqlParameter("@itemtype",    SqlDbType.VarChar, 100),
                new SqlParameter("@billstate",   SqlDbType.Int,       4),
                new SqlParameter("@person",      SqlDbType.VarChar, 100),
                new SqlParameter("@banker",      SqlDbType.VarChar,  50),
                new SqlParameter("@bankname",    SqlDbType.VarChar, 100),
                new SqlParameter("@banknum",     SqlDbType.VarChar, 100)
            };
            parameters[0].Value  = model.applydate;
            parameters[1].Value  = model.applycantid;
            parameters[2].Value  = model.totalmoney;
            parameters[3].Value  = model.remark;
            parameters[4].Value  = model.txt;
            parameters[5].Value  = model.jobflowid;
            parameters[6].Value  = model.itemtype;
            parameters[7].Value  = model.billstate;
            parameters[8].Value  = model.person;
            parameters[9].Value  = model.Banker;
            parameters[10].Value = model.BankName;
            parameters[11].Value = model.bankNum;

            int result = EtNet_DAL.DBHelper.ExecuteCommand(strSql.ToString(), parameters);

            if (result >= 1)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Beispiel #2
0
        /// <summary>
        /// 回收报销单
        /// </summary>
        /// <param name="jfid">工作流的id值</param>
        private void RefreshReimbursement(int jfid)
        {
            EtNet_Models.JobFlow model = EtNet_BLL.JobFlowManager.GetModel(jfid);
            int    login = ((EtNet_Models.LoginInfo)Session["login"]).Id;
            string str   = "";

            if (model == null)
            {
                str = "<script>alert('回收失败,该报销申请单已删除')</script>";
            }
            else if (model.auditstatus == "02" || model.auditstatus == "04")
            {
                str = "<script>alert('回收失败,只有状态是未开始与被拒绝的单据才能回收')</script>";
            }
            else if (model.founderid != login)
            {
                str = "<script>alert('回收失败,无此权限')</script>";
            }
            else
            {
                string strfresh = " jobflowid = " + jfid;
                EtNet_BLL.AuditJobFlowManager.Delete(strfresh);                                        //删除审批人员的数据

                string id = EtNet_BLL.AusRottenInfoManager.GetList(strfresh).Rows[0]["id"].ToString(); //根据工作流id值获取报销单的id值
                EtNet_Models.AusRottenInfo rotten = EtNet_BLL.AusRottenInfoManager.GetModel(int.Parse(id));
                rotten.txt = "";                                                                       //清空审批人员的审核意见
                EtNet_BLL.AusRottenInfoManager.Update(rotten);
                if (model.auditstatus == "03")
                {
                    this.hidstatus.Value = "03";
                }
                else
                {
                    this.hidstatus.Value = "";
                }
                model.savestatus  = "草稿";
                model.auditstatus = "01";
                if (EtNet_BLL.JobFlowManager.Update(model))
                {
                    str = "<script>alert('成功收回报销申请单!')</script>";
                }
            }
            Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "refresh", str, false);
        }
        /// <summary>
        /// 根据工作流id得到对象实体
        /// </summary>
        /// <param name="jobflowid"></param>
        /// <returns></returns>
        public static EtNet_Models.AusRottenInfo GetModelByjob(int jobflowid)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select * from AusRottenInfo ");
            strSql.Append(" where jobflowid=@jobflowid");
            SqlParameter[] parameters =
            {
                new SqlParameter("@jobflowid", SqlDbType.Int, 4)
            };
            parameters[0].Value = jobflowid;

            EtNet_Models.AusRottenInfo model = new EtNet_Models.AusRottenInfo();
            DataTable tbl = EtNet_DAL.DBHelper.GetDataSet(strSql.ToString(), parameters);

            if (tbl.Rows.Count > 0)
            {
                model.id          = int.Parse(tbl.Rows[0]["id"].ToString());
                model.applydate   = DateTime.Parse(tbl.Rows[0]["applydate"].ToString());
                model.applycantid = int.Parse(tbl.Rows[0]["applycantid"].ToString());
                model.totalmoney  = decimal.Parse(tbl.Rows[0]["totalmoney"].ToString());
                model.remark      = tbl.Rows[0]["remark"].ToString();
                model.txt         = tbl.Rows[0]["txt"].ToString();
                model.jobflowid   = int.Parse(tbl.Rows[0]["jobflowid"].ToString());
                model.billstate   = int.Parse(tbl.Rows[0]["billstate"].ToString());
                model.itemtype    = tbl.Rows[0]["itemtype"].ToString();
                model.person      = tbl.Rows[0]["person"].ToString();
                model.Banker      = tbl.Rows[0]["banker"].ToString();
                model.BankName    = tbl.Rows[0]["bankname"].ToString();
                model.bankNum     = tbl.Rows[0]["banknum"].ToString();
                return(model);
            }
            else
            {
                return(null);
            }
        }
Beispiel #4
0
        /// <summary>
        /// 保存数据方法
        /// </summary>
        private void Save()
        {
            string[] strfile    = FileUp(Request.Files);
            string   cname      = ""; //单据全称
            string   attachment = ""; //单据名称,不包含流水号
            string   txt        = ""; //单据的流水号


            if (StrNumbers(this.iptnumbers.Value, out cname, out attachment, out txt))
            {
                //创建工作流
                EtNet_Models.JobFlow jobmodel = new EtNet_Models.JobFlow();
                jobmodel.attachment  = attachment;
                jobmodel.txt         = txt;
                jobmodel.cname       = cname;
                jobmodel.sort        = "01";                                          //报销申请的编号
                jobmodel.auditsort   = "01";                                          //审核分类已不用
                jobmodel.auditstatus = "01";                                          //未开始
                jobmodel.createtime  = DateTime.Now;                                  //默认是当前时间
                jobmodel.endtime     = DateTime.Now;
                jobmodel.founderid   = ((EtNet_Models.LoginInfo)Session["login"]).Id; //登录人员的id号
                jobmodel.savestatus  = "草稿";
                jobmodel.ruleid      = int.Parse(this.ddlrule.SelectedValue);         //得到审批流程
                int maxid = EtNet_BLL.JobFlowManager.AddAndGetId(jobmodel);

                if (strfile[6] == "1")
                {
                    CreateJobFlowFile(strfile, maxid); //保存文件的路径到数据库中
                }
                //新增报销申请数据
                EtNet_Models.AusRottenInfo model = new EtNet_Models.AusRottenInfo();
                model.applycantid = ((EtNet_Models.LoginInfo)Session["login"]).Id; //填单人员的关联id
                model.applydate   = DateTime.Now;                                  //填单日期
                model.jobflowid   = maxid;                                         //工作流id
                model.remark      = Server.UrlDecode(this.iptremark.Value);        //备注
                model.totalmoney  = decimal.Parse(this.hidmoney.Value);            //总金额
                model.txt         = "";                                            //审批人员填写的字段(审批意见)
                model.itemtype    = "";                                            //首先赋值该申请单的项目类别为空


                model.billstate = 1;//int.Parse(this.ddlbillstate.SelectedValue); //判断其是有票还是无票的(现在隐藏这个功能,默认都是有票)

                //收款帐号信息
                model.Banker   = txtbanker.Value;
                model.BankName = txtbankname.Value;
                model.bankNum  = txtbanknum.Value;

                string[] result = CreateDetail(maxid);
                model.itemtype = result[0];
                model.person   = result[1];

                if (EtNet_BLL.AusRottenInfoManager.Add(model)) //如果添加成功
                {
                    AddOrderDetail(maxid, Convert.ToDouble(model.totalmoney));
                    this.hidjobflow.Value = maxid.ToString();                                                                                         //得到工作流id
                    ClientScript.RegisterClientScriptBlock(Page.GetType(), "a", "alert('保存成功');self.location.href='ShowReimbursedForm.aspx';", true); //self.location.href='ShowReimbursedForm.aspx';
                    //LoadDetialData();
                    this.ibtnSubmit.Visible = this.ibtnReset.Visible = this.ibtnSave.Visible = false;
                    this.savesubmit.Visible = true;
                }
                else
                {
                    EtNet_BLL.AusDetialInfoManager.Del(maxid);
                    EtNet_BLL.JobFlowManager.Delete(maxid);
                    EtNet_BLL.JobFlowFileManager.Delete(maxid);
                }
            }
            else
            {
                Reset();
            }
        }
Beispiel #5
0
        /// <summary>
        /// 提交数据
        /// </summary>
        private void Submit()
        {
            string[] strfile    = FileUp(Request.Files);
            string   cname      = ""; //单据全称
            string   attachment = ""; //单据名称,不包含流水号
            string   txt        = ""; //单据的流水号

            if (strfile[0] != "")
            {
                Page.ClientScript.RegisterStartupScript(Page.GetType(), "jobflow", "<script>alert('提交申请失败原因:" + strfile[0] + "!');</script>", false);
                Reset();
            }
            else
            {
                if (StrNumbers(this.iptnumbers.Value, out cname, out attachment, out txt))
                {
                    //创建工作流
                    EtNet_Models.JobFlow jobmodel = new EtNet_Models.JobFlow();
                    jobmodel.attachment  = attachment;
                    jobmodel.txt         = txt;
                    jobmodel.cname       = cname;
                    jobmodel.sort        = "01"; //报销申请
                    jobmodel.auditsort   = "";
                    jobmodel.auditstatus = "01";
                    jobmodel.createtime  = DateTime.Now;                                  //默认是当前时间
                    jobmodel.endtime     = DateTime.Now;
                    jobmodel.founderid   = ((EtNet_Models.LoginInfo)Session["login"]).Id; //登录人员的id号
                    jobmodel.savestatus  = "已提交";
                    jobmodel.ruleid      = int.Parse(this.ddlrule.SelectedValue);
                    int maxid = EtNet_BLL.JobFlowManager.AddAndGetId(jobmodel); //作为工作流id

                    if (strfile[6] == "1")
                    {
                        CreateJobFlowFile(strfile, maxid);
                    }

                    EtNet_Models.AusRottenInfo model = new EtNet_Models.AusRottenInfo();
                    model.applycantid = ((EtNet_Models.LoginInfo)Session["login"]).Id;
                    model.applydate   = DateTime.Now;
                    model.jobflowid   = maxid;                                  //工作流id
                    model.remark      = Server.UrlDecode(this.iptremark.Value); //备注
                    model.totalmoney  = decimal.Parse(this.hidmoney.Value);     //总金额
                    model.txt         = "";                                     //审批人员填写的字段
                    model.itemtype    = "";                                     //首先赋值该申请单的项目类别为空
                    model.billstate   = 1;                                      //int.Parse(this.ddlbillstate.SelectedValue); //判断其是有票还是无票的(现在隐藏这个功能,默认都是有票)

                    //收款帐号信息
                    model.Banker   = txtbanker.Value;
                    model.BankName = txtbankname.Value;
                    model.bankNum  = txtbanknum.Value;

                    string[] result = CreateDetail(maxid);
                    model.itemtype = result[0];
                    model.person   = result[1];
                    if (EtNet_BLL.AusRottenInfoManager.Add(model))
                    {
                        AddOrderDetail(maxid, Convert.ToDouble(model.totalmoney));
                        int ruleid = int.Parse(this.ddlrule.SelectedValue); //获得所选择的审批流程
                        CreateApproval(ruleid, maxid);
                        SendInformation(maxid, ruleid);
                        ClientScript.RegisterClientScriptBlock(Page.GetType(), "a", "alert('送审成功');self.location.href='ShowReimbursedForm.aspx';", true); //self.location.href='ShowReimbursedForm.aspx';
                        this.ibtnSubmit.Visible = this.ibtnReset.Visible = this.ibtnSave.Visible = false;
                    }
                    else
                    {
                        EtNet_BLL.AusDetialInfoManager.Del(maxid);
                        EtNet_BLL.JobFlowManager.Delete(maxid);
                        EtNet_BLL.JobFlowFileManager.Delete(maxid);
                    }
                }
                else
                {
                    Reset();
                }
            }
        }
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public static bool Update(EtNet_Models.AusRottenInfo model)
 {
     return(EtNet_DAL.AusRottenInfoService.Update(model));
 }
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public static bool  Add(EtNet_Models.AusRottenInfo model)
 {
     return(EtNet_DAL.AusRottenInfoService.Add(model));
 }
        protected void rptauditjobflow_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            switch (e.CommandName)
            {
            case "audit":
                string[] str = e.CommandArgument.ToString().Split('-');
                string   rs  = ReviewerStatus(str[0], ((EtNet_Models.LoginInfo)Session["login"]).Id);
                if (rs == "")
                {
                    //工作流已删除或审核人员已更改
                    LoadRptjobflowData();
                    Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "faudit", "<script>alert('不能进入审批界面,原因可能是该申请已修改或删除!')</script>", false);
                    return;
                }
                else if (rs == "F")
                {
                    LoadRptjobflowData();
                    Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "faudit", "<script>alert('不能进入审批界面,原因可能是审批受限制!')</script>", false);
                }
                else if (rs == "T")
                {
                    string strstatus = JobFlowAuditStatus(int.Parse(str[0]));
                    if (strstatus == "03" || strstatus == "04")
                    {
                        Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "auditR", "<script>alert('该工作流已由他人审批,无需再审!')</script>", false);
                    }
                    else
                    {
                        if (str[1] == "01")
                        {
                            if (HttpContext.Current.Request.QueryString["page"] != null)
                            {
                                int page = int.Parse(HttpContext.Current.Request.QueryString["page"]);
                                Response.Redirect("ReimbursedForm/AuditReimbursedForm.aspx?pageindex=" + page + "&jobflowid=" + str[0]);
                            }
                            else
                            {
                                Response.Redirect("ReimbursedForm/AuditReimbursedForm.aspx?jobflowid=" + str[0]);
                            }
                        }

                        else if (str[1] == "02")
                        {
                            if (HttpContext.Current.Request.QueryString["page"] != null)
                            {
                                int page = int.Parse(HttpContext.Current.Request.QueryString["page"]);
                                Response.Redirect("../Order/AuditOrder.aspx?pageindex=" + page + "&jobflowid=" + str[0]);
                            }
                            else
                            {
                                Response.Redirect("../Order/AuditOrder.aspx?jobflowid=" + str[0]);
                            }
                        }
                        else if (str[1] == "03")
                        {
                            if (HttpContext.Current.Request.QueryString["page"] != null)
                            {
                                int page = int.Parse(HttpContext.Current.Request.QueryString["page"]);
                                Response.Redirect("../CusInfo/AuditCus.aspx?pageindex=" + page + "&jobflowid=" + str[0]);
                            }
                            else
                            {
                                Response.Redirect("../CusInfo/AuditCus.aspx?jobflowid=" + str[0]);
                            }
                        }
                        else if (str[1] == "04")
                        {
                            if (HttpContext.Current.Request.QueryString["page"] != null)
                            {
                                int page = int.Parse(HttpContext.Current.Request.QueryString["page"]);
                                Response.Redirect("../Announcement/AnnouncementAuditFirm.aspx?pageindex=" + page + "&jobflowid=" + str[0]);
                            }
                            else
                            {
                                Response.Redirect("../Announcement/AnnouncementAuditFirm.aspx?jobflowid=" + str[0]);
                            }
                        }
                        else if (str[1] == "05")
                        {
                            if (HttpContext.Current.Request.QueryString["page"] != null)
                            {
                                int page = int.Parse(HttpContext.Current.Request.QueryString["page"]);
                                Response.Redirect("../Financial/AuditPayment.aspx?pageindex=" + page + "&jobflowid=" + str[0]);
                            }
                            else
                            {
                                Response.Redirect("../Financial/AuditPayment.aspx?jobflowid=" + str[0]);
                            }
                        }
                        else
                        {
                        }
                    }
                }
                else if (rs == "P")
                {
                    Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "auditP", "<script>alert('不能重复审批!')</script>", false);
                }
                else
                {
                }
                break;

            case "search":
                string[] str2  = e.CommandArgument.ToString().Split('-');
                int      jfid2 = int.Parse(str2[0]);
                if (str2[1] == "01")     //报销审核的查看
                {
                    SearchReimbursement(jfid2);
                }
                else if (str2[1] == "02")     //定审核的查看
                {
                    SearchOrder(jfid2);
                }
                else if (str2[1] == "03")     //客户审批查看
                {
                    SearchCus(jfid2);
                }
                else if (str2[1] == "04")     //公告审核查看
                {
                    SearchAnnoun(jfid2);
                }
                else if (str2[1] == "05")     //付款申请单查看
                {
                    SearchPayment(jfid2);
                }
                break;

            case "refresh":
                string[]             str3     = e.CommandArgument.ToString().Split('-');
                int                  jfid3    = int.Parse(str3[0]);                                        //工作流id
                EtNet_Models.JobFlow model    = EtNet_BLL.JobFlowManager.GetModel(jfid3);                  //得到工作流实例
                string               strfresh = " jobflowid = " + jfid3;
                EtNet_BLL.AuditJobFlowManager.Delete(strfresh);                                            //删除审核数据,将审核状态改为初始状态
                model.savestatus  = "草稿";
                model.auditstatus = "01";                                                                  //审核状态改为未开始状态
                model.txt         = "";                                                                    //审核意见置空
                if (model.sort == "01")                                                                    //报销审核
                {
                    string id = EtNet_BLL.AusRottenInfoManager.GetList(strfresh).Rows[0]["id"].ToString(); //根据工作流id得到报销单的id值
                    EtNet_Models.AusRottenInfo rotten = EtNet_BLL.AusRottenInfoManager.GetModel(int.Parse(id));
                    if (rotten != null)
                    {
                        rotten.txt = "";    //清空审批人员的审批意见
                        EtNet_BLL.AusRottenInfoManager.Update(rotten);
                    }
                }
                else if (model.sort == "02")     //订单审核
                {
                }
                else if (model.sort == "03")     //客户审核
                {
                    string                sqlcus = " jobflowid = " + jfid3;
                    DataTable             tblcus = EtNet_BLL.CustomerManager.GetList(1, sqlcus, "id");
                    EtNet_Models.Customer cus    = EtNet_BLL.CustomerManager.getCustomerById(int.Parse(tblcus.Rows[0]["id"].ToString()));
                    if (cus != null)
                    {
                        cus.Txt = "";
                        EtNet_BLL.CustomerManager.updateCustomer(cus);
                    }
                }
                else if (model.sort == "04")     //公告审批
                {
                    string    sqlano = " jobflowid = " + jfid3;
                    DataTable tblano = EtNet_BLL.AnnouncementInfoManager.GetList(1, sqlano, "id");
                    EtNet_Models.AnnouncementInfo ano = EtNet_BLL.AnnouncementInfoManager.GetModel(int.Parse(tblano.Rows[0]["id"].ToString()));
                    if (ano != null)
                    {
                        ano.txt = "";
                        EtNet_BLL.AnnouncementInfoManager.Update(ano);
                    }
                }
                else if (model.sort == "05")     //付款审核
                {
                }

                if (EtNet_BLL.JobFlowManager.Update(model))
                {
                    Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "success", "<script>alert('撤销成功')</script>", false);
                }
                break;
            }
        }
        /// <summary>
        /// 保存数据
        /// </summary>
        private void Save()
        {
            if (IsCanModifyUp())
            {
                string[] strfile = FileUp(Request.Files);
                if (strfile[0] != "")
                {
                    Page.ClientScript.RegisterStartupScript(Page.GetType(), "jobflow", "<script>alert('草稿保存失败原因:" + strfile[0] + "!');</script>", false);
                }
                else
                {
                    int jfid = int.Parse(Request.QueryString["id"]); //获取工作流的id值
                    EtNet_Models.JobFlow jobmodel = EtNet_BLL.JobFlowManager.GetModel(jfid);
                    jobmodel.createtime = DateTime.Now;              //默认是当前时间
                    jobmodel.endtime    = DateTime.Now;
                    jobmodel.savestatus = "草稿";
                    jobmodel.ruleid     = int.Parse(this.ddlrule.SelectedValue);
                    //判断是否有附件
                    if (strfile[6] == "1")
                    {
                        CreateJobFlowFile(strfile, jfid);
                    }

                    EtNet_BLL.JobFlowManager.Update(jobmodel);
                    EtNet_BLL.AusDetialInfoManager.Del(jfid);

                    string    Sqlstr = " jobflowid =" + jfid.ToString();
                    DataTable tbl    = EtNet_BLL.ViewBLL.ViewAusRottenInfoManager.getlist(Sqlstr);
                    EtNet_Models.AusRottenInfo rottenmodel = EtNet_BLL.AusRottenInfoManager.GetModel(int.Parse(tbl.Rows[0]["id"].ToString()));
                    double lasttotalmoney = Convert.ToDouble(rottenmodel.totalmoney);
                    rottenmodel.applydate  = DateTime.Now;
                    rottenmodel.totalmoney = Decimal.Parse(this.hidmoney.Value);
                    rottenmodel.remark     = Server.UrlDecode(this.iptremark.Value);
                    rottenmodel.txt        = "";

                    //账户信息
                    rottenmodel.Banker   = txtbanker.Value;
                    rottenmodel.BankName = txtbankname.Value;
                    rottenmodel.bankNum  = txtbanknum.Value;

                    string[] result = getItemandPerson();
                    rottenmodel.itemtype = result[0];
                    rottenmodel.person   = result[1];

                    if (EtNet_BLL.AusRottenInfoManager.Update(rottenmodel)) //如果更新成功
                    {
                        bool create = CreateDetial(jfid);
                        CreateOrderDetail(jfid, lasttotalmoney, Convert.ToDouble(rottenmodel.totalmoney));
                        this.hidjobflow.Value = jfid.ToString(); //得到工作流id
                        //LoadDetialData();
                        this.ibtnSubmit.Visible = this.ibtnReset.Visible = this.ibtnSave.Visible = false;
                        this.savesubmit.Visible = true;
                        ClientScript.RegisterClientScriptBlock(Page.GetType(), "a", "alert('修改成功');self.location.href='ShowReimbursedForm.aspx';", true);//
                    }
                }
            }
            else
            {
                Response.Redirect("../Error.aspx?error=2");
            }
        }
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public static bool Update(EtNet_Models.AusRottenInfo model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update AusRottenInfo set ");
            strSql.Append("applydate=@applydate,");
            strSql.Append("applycantid=@applycantid,");
            strSql.Append("totalmoney=@totalmoney,");
            strSql.Append("remark=@remark,");
            strSql.Append("txt=@txt,");
            strSql.Append("jobflowid=@jobflowid,");
            strSql.Append("billstate=@billstate,");
            strSql.Append("itemtype=@itemtype,");
            strSql.Append("person=@person,");
            strSql.Append("banker=@banker,");
            strSql.Append("bankname=@bankname,");
            strSql.Append("banknum=@banknum");
            strSql.Append(" where id=@id");
            SqlParameter[] parameters =
            {
                new SqlParameter("@applydate",   SqlDbType.Date,      3),
                new SqlParameter("@applycantid", SqlDbType.Int,       4),
                new SqlParameter("@totalmoney",  SqlDbType.Money,     8),
                new SqlParameter("@remark",      SqlDbType.VarChar, 200),
                new SqlParameter("@txt",         SqlDbType.VarChar, 200),
                new SqlParameter("@jobflowid",   SqlDbType.Int,       4),
                new SqlParameter("@billstate",   SqlDbType.Int,       4),
                new SqlParameter("@itemtype",    SqlDbType.VarChar, 100),
                new SqlParameter("@person",      SqlDbType.VarChar, 100),
                new SqlParameter("@id",          SqlDbType.Int,       4),
                new SqlParameter("@banker",      SqlDbType.VarChar,  50),
                new SqlParameter("@bankname",    SqlDbType.VarChar, 100),
                new SqlParameter("@banknum",     SqlDbType.VarChar, 100)
            };


            parameters[0].Value  = model.applydate;
            parameters[1].Value  = model.applycantid;
            parameters[2].Value  = model.totalmoney;
            parameters[3].Value  = model.remark;
            parameters[4].Value  = model.txt;
            parameters[5].Value  = model.jobflowid;
            parameters[6].Value  = model.billstate;
            parameters[7].Value  = model.itemtype;
            parameters[8].Value  = model.person;
            parameters[9].Value  = model.id;
            parameters[10].Value = model.Banker;
            parameters[11].Value = model.BankName;
            parameters[12].Value = model.bankNum;

            int result = EtNet_DAL.DBHelper.ExecuteCommand(strSql.ToString(), parameters);

            if (result >= 1)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Beispiel #11
0
        /// <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);
                }
            }
        }
Beispiel #12
0
        /// <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);
                }
            }
        }