/// <summary>
        /// 修改选择的数据
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void lnkbtnModify_Click(object sender, EventArgs e)
        {
            int index = gvFinanceFeeList.SelectedIndex;
            int id    = int.Parse(gvFinanceFeeList.DataKeys[index]["ID"].ToString());

            B_FinanceDeptInfo financeDeptInfo = new B_FinanceDeptInfo();

            financeDeptInfo.ID                 = id;
            financeDeptInfo.FinanceYear        = this.ddlFinanceYear.SelectedValue;
            financeDeptInfo.DeptID             = this.ddlDept.SelectedValue;
            financeDeptInfo.TripBudgetCost     = this.txtTripBudget.Text.Trim();
            financeDeptInfo.TrainingBudgetCost = this.txtTrainingBudget.Text;
            financeDeptInfo.ZDBudgetCost       = this.txtZDBudget.Text;
            financeDeptInfo.TripUseCost        = this.txtTripUse.Text;
            financeDeptInfo.TrainingUseCost    = this.txtTrainingUse.Text;
            financeDeptInfo.ZDUseCost          = this.txtZDUse.Text;
            if (financeDeptInfo.Save())
            {
                //得到所有财务费用
                BindFinanceList();
                //清空页面数据
                ClearData();
                IMessage ms = new WebFormMessage(Page, ConstString.PromptInfo.ACTION_EDIT_SUC);
                ms.Show();
            }
            else
            {
                IMessage ms = new WebFormMessage(Page, financeDeptInfo.ErrMsgs[0].ToString());
                ms.Show();
            }
        }
        /// <summary>
        /// 添加一条数据
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void lnkbtnAdd_Click(object sender, EventArgs e)
        {
            B_FinanceDeptInfo financeDeptInfo = new B_FinanceDeptInfo();
            financeDeptInfo.FinanceYear = this.ddlFinanceYear.SelectedValue;
            financeDeptInfo.DeptID = this.ddlDept.SelectedValue;
            financeDeptInfo.TripBudgetCost = this.txtTripBudget.Text.Trim();
            financeDeptInfo.TrainingBudgetCost = this.txtTrainingBudget.Text;
            financeDeptInfo.ZDBudgetCost = this.txtZDBudget.Text;
            financeDeptInfo.TripUseCost ="0";
            financeDeptInfo.TrainingUseCost = "0";
            financeDeptInfo.ZDBudgetCost = "0";
            if (financeDeptInfo.Save())
            {
                //得到所有财务费用
                BindFinanceList();
                //清空页面数据
                ClearData();

                IMessage ms = new WebFormMessage(Page, ConstString.PromptInfo.ACTION_ADD_SUC);
                ms.Show();
            }
            else
            {
                IMessage im = new WebFormMessage(Page, financeDeptInfo.ErrMsgs[0].ToString());
                im.Show();
            }
        }
        /// <summary>
        /// 添加一条数据
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void lnkbtnAdd_Click(object sender, EventArgs e)
        {
            B_FinanceDeptInfo financeDeptInfo = new B_FinanceDeptInfo();

            financeDeptInfo.FinanceYear        = this.ddlFinanceYear.SelectedValue;
            financeDeptInfo.DeptID             = this.ddlDept.SelectedValue;
            financeDeptInfo.TripBudgetCost     = this.txtTripBudget.Text.Trim();
            financeDeptInfo.TrainingBudgetCost = this.txtTrainingBudget.Text;
            financeDeptInfo.ZDBudgetCost       = this.txtZDBudget.Text;
            financeDeptInfo.TripUseCost        = "0";
            financeDeptInfo.TrainingUseCost    = "0";
            financeDeptInfo.ZDBudgetCost       = "0";
            if (financeDeptInfo.Save())
            {
                //得到所有财务费用
                BindFinanceList();
                //清空页面数据
                ClearData();

                IMessage ms = new WebFormMessage(Page, ConstString.PromptInfo.ACTION_ADD_SUC);
                ms.Show();
            }
            else
            {
                IMessage im = new WebFormMessage(Page, financeDeptInfo.ErrMsgs[0].ToString());
                im.Show();
            }
        }
        /// <summary>
        ///
        /// </summary>
        private void BindFinanceList()
        {
            B_FinanceDeptInfo bllFinanceList = new B_FinanceDeptInfo();
            //得到所有财务费用
            DataTable dt = bllFinanceList.GetAllFinanceDeptInfo();

            if (dt != null)
            {
                gvFinanceFeeList.DataSource = dt;
                gvFinanceFeeList.DataBind();
            }
        }
        /// <summary>
        /// 删除选择的数据
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void lnkbtnDelete_Click(object sender, EventArgs e)
        {
            int index = this.gvFinanceFeeList.SelectedIndex;
            int id    = int.Parse(gvFinanceFeeList.DataKeys[index]["ID"].ToString());

            B_FinanceDeptInfo financeDeptInfo = new B_FinanceDeptInfo();

            financeDeptInfo.Load(id);
            financeDeptInfo.DeleteById(id.ToString());

            BindFinanceList();
            //清空页面数据
            ClearData();
            IMessage ms = new WebFormMessage(Page, ConstString.PromptInfo.ACTION_DEL_SUC);

            ms.Show();
        }
        private void CaiWuFeiYong()
        {
            //财务审核完成后调用 处室发生费用
            string            year           = DateTime.Now.Year.ToString();
            B_FinanceDeptInfo bllFinanceInfo = new B_FinanceDeptInfo();
            int    result = 0;
            double heji   = 0;

            if (txtHeJi.Text != "")
            {
                heji = Convert.ToDouble(txtHeJi.Text);
            }
            //取得处室
            string chuShiID = ddlBianZhiBuMen.SelectedValue;

            if (txtType.Text == "出差")
            {
                result = bllFinanceInfo.UpdateFinanceFeesByDeptID(year, chuShiID, heji, 0);
            }
            else if (txtType.Text == "培训")
            {
                result = bllFinanceInfo.UpdateFinanceFeesByDeptID(year, chuShiID, 0, heji);
            }
        }
Exemplo n.º 7
0
        /// <summary>
        /// 实体加载
        /// </summary>
        protected override void EntityToControl()
        {
            B_Finance entity = base.EntityData != null ? base.EntityData as B_Finance : new B_Finance();

            //拟稿人
            this.txtNiGaoRen.Text   = string.IsNullOrEmpty(entity.ReceiveUserName) ? CurrentUserInfo.DisplayName : entity.ReceiveUserName;
            this.txtNiGaoRenID.Text = string.IsNullOrEmpty(entity.ReceiveUserID) ? CurrentUserInfo.UserName : entity.ReceiveUserID;
            //新版OA时间精确到秒(控制时间的显示格式)
            //bool isOld = entity.DraftDate < base.OAStartTime;
            //职务
            drpZhiWu.DataSource = GetPostList();
            drpZhiWu.DataBind();
            drpZhiCheng.DataSource = GetTitleList();
            drpZhiCheng.DataBind();
            //附件
            ucAttachment.UCDataList   = entity.FileList;
            this.txtFeeYuSuan.Text    = entity.FeeYuSuan;
            this.txtFeeFaSheng.Text   = entity.FeeFaSheng;
            this.txtShenPiYiJian.Text = entity.ShenPiYiJian;
            //编制部门及预算
            if (base.StepName == ProcessConstString.StepName.STEP_DRAFT && !base.IsPreview)
            {
                OADept.GetDeptByUser(this.ddlBianZhiBuMen, string.IsNullOrEmpty(entity.ReceiveUserID) ? CurrentUserInfo.UserName : entity.ReceiveUserID, 1, true, false);
                FormsMethod.SelectedDropDownList(this.ddlBianZhiBuMen, entity.BianZhiBuMenID); B_FinanceDeptInfo bllInfo = new B_FinanceDeptInfo();
                M_FinanceDeptInfo info = bllInfo.GetFinanceDeptInfoByDeptID(DateTime.Now.Year.ToString(), this.ddlBianZhiBuMen.SelectedValue);

                this.txtFeeYuSuan.Text  = info.TripBudgetCost;
                this.txtFeeFaSheng.Text = info.TripUseCost;

                string ManagerDeptID = OADept.GetDeptID("总经理部");

                Double FeeFa = Convert.ToDouble(string.IsNullOrEmpty(txtFeeFaSheng.Text) ? "0" : txtFeeFaSheng.Text);
                Double FeeYu = Convert.ToDouble(string.IsNullOrEmpty(txtFeeYuSuan.Text) ? "0" : txtFeeYuSuan.Text);
                Double Rate  = (string.IsNullOrEmpty(FeeRate) == true ? 0.1 : Convert.ToDouble(FeeRate));
                if ((FeeFa - FeeYu) / FeeYu > Rate)
                {
                    OAUser.GetUserByDeptPost(ddlZongJingLi, ManagerDeptID, OUConstString.PostName.ZONGJINGLI, true, false, 1);
                    ddlZongJingLi.Enabled = true;
                    this.SubmitStatus     = 1;
                }
                else if (FeeFa > FeeYu)
                {
                    OAUser.GetUserByDeptPost(ddlZhuGuanLingDao, ManagerDeptID, OUConstString.PostName.FUZONGJINGLI, true, false, 1);
                    ddlZhuGuanLingDao.Enabled = true;
                    this.SubmitStatus         = 2;
                }
                else if (FeeFa <= FeeYu)
                {
                    OAUser.GetUserByDeptPost(ddlChuLingDao, this.ddlBianZhiBuMen.SelectedValue, OUConstString.PostName.CHUZHANG, false, true, 0);
                    ddlChuLingDao.Enabled = true;
                    this.SubmitStatus     = 3;
                }
                ListItem item = new ListItem(this.txtNiGaoRen.Text, this.txtNiGaoRenID.Text);
                if (ddlChuLingDao.Items.Contains(item))
                {
                    ddlChuLingDao.Items.Clear();
                    OAUser.GetUserByDeptPost(ddlZhuGuanLingDao, ManagerDeptID, OUConstString.PostName.FUZONGJINGLI, true, false, 1);
                    ddlZhuGuanLingDao.Enabled = true;
                    this.SubmitStatus         = 2;
                }
                else if (ddlZhuGuanLingDao.Items.Contains(item))
                {
                    ddlZhuGuanLingDao.Items.Clear();
                    OAUser.GetUserByDeptPost(ddlZongJingLi, ManagerDeptID, OUConstString.PostName.ZONGJINGLI, true, false, 1);
                    ddlZongJingLi.Enabled = true;
                    this.SubmitStatus     = 1;
                }
            }
            else
            {
                FormsMethod.SetDropDownList(this.ddlBianZhiBuMen, entity.BianZhiBuMenID, entity.Department);
                FormsMethod.SetDropDownList(this.ddlZongJingLi, entity.GeneralManagerID, entity.GeneralManager);
                FormsMethod.SetDropDownList(this.ddlZhuGuanLingDao, entity.ChargeLeaderID, entity.ChargeLeader);
                FormsMethod.SetDropDownList(this.ddlChuLingDao, entity.DepartmentLeaderID, entity.DepartmentLeader);
            }
            //申请单编号
            this.txtBianHao.Text = entity.DocumentNo;
            FormsMethod.SelectedDropDownList(this.drpZhiWu, entity.ZhiWu);
            FormsMethod.SelectedDropDownList(this.drpZhiCheng, entity.ZhiCheng);

            //部门负责人
            if (base.StepName == ProcessConstString.StepName.STEP_DRAFT && !base.IsPreview)
            {
                if (this.ddlBianZhiBuMen.Items.Count > 0)
                {
                    OAUser.GetUserByDeptPost(this.ddlFuZeRen, this.ddlBianZhiBuMen.SelectedValue, OUConstString.PostName.CHUZHANG, true, true);
                }
                FormsMethod.SelectedDropDownList(this.ddlFuZeRen, entity.FuZeRenID);
            }
            else
            {
                FormsMethod.SetDropDownList(this.ddlFuZeRen, entity.FuZeRenID, entity.DeptPrincipal);
            }

            //订票处
            if (base.StepName == ProcessConstString.StepName.FinanceStepName.STEP_DepartLeader ||
                base.StepName == ProcessConstString.StepName.FinanceStepName.STEP_ChargeLeader ||
                base.StepName == ProcessConstString.StepName.FinanceStepName.STEP_GeneralManager &&
                !base.IsPreview)
            {
                string[] arrayBookingOffice = OAUser.GetUserByRoleName(OUConstString.RoleName.BookingOffice);
                this.txtBookingOfficeID.Text = arrayBookingOffice[0];
            }

            //是否退回
            if (base.StepName == ProcessConstString.StepName.STEP_DRAFT)
            {
                this.txtIsBack.Text = entity.IsBack.ToString();
            }

            //拟稿人及日期
            if (entity.DraftDate != DateTime.MinValue)
            {
                this.lblNiGaoRiQi.Text = entity.DraftDate.ToString(DateFormat);

                //拟稿人显示非下拉列表框形式
                this.txtNiGaoRen.Visible = false;
                this.lbNiGaoRen.Visible  = true;
                //this.lbNiGaoRen.Text = entity.Drafter + strNewLine + entity.DraftDate.ToString(ConstString.DateFormat.Long);
                this.lbNiGaoRen.Text = entity.Drafter;
            }
            else
            {
                this.lblNiGaoRiQi.Text = DateTime.Now.ToString(DateFormat);
            }

            //抄送
            this.txtChaoSong.Text       = entity.CopySend;
            this.txtChaoSongID.Text     = entity.ChaoSongID;
            this.txtChaoSongDeptID.Text = entity.ChaoSongDeptID;

            //主题
            this.txtZhuTi.Text = entity.DocumentTitle;

            this.txtTongXing.Text = entity.TongXingRenYuan;

            //出差任务
            //this.txtNeiRong.Text = SysString.HtmlToTextCode(entity.Content);
            this.txtChuChaiRenWu.Text = entity.ChuChaiRenWu;
            this.timeChuFa.Text       = entity.ChuFaShiJian;
            this.timeHuiCheng.Text    = entity.HuiChengShiJian;

            //商务信息
            this.txtShangWu.Text = entity.ShangWuXinXi;

            //目的地
            this.txtDestination.Text = entity.Destination;

            //拟稿人
            //this.txtNiGaoRen.Text = entity.Drafter;
            //this.txtNiGaoRenID.Text = entity.NiGaoRenID;

            //提示信息
            this.txtTiShiXinXi.Text   = entity.Message;
            this.txtBanShuiXinXi.Text = entity.Message;

            //提示信息添加
            this.txtTianJia.Text = entity.MessageAdd;

            this.txtGeneralManagerID.Text = entity.GeneralManagerID;

            this.txtChargeLeaderID.Text = entity.ChargeLeaderID;

            this.txtDepartmentLeaderID.Text = entity.DepartmentLeaderID;
        }
        /// <summary>
        /// 实体加载
        /// </summary>
        protected override void EntityToControl()
        {
            B_FinanceZDBX entity = base.EntityData != null ? base.EntityData as B_FinanceZDBX : new B_FinanceZDBX();
            //附件
            ucAttachment.UCDataList = entity.FileList;

            this.txtYuSuanJinE.Text = entity.YuSuanJinE;
            this.txtLeiJiBaoXiaoJinE.Text = entity.LeiJiBaoXiaoJinE;
            this.txtIsChaoYuSuan.Text = entity.IsChaoYuSuan == true ? "1" : "";
            this.txtIsManager.Text = entity.IsLeader == true ? "1" : "";
            string userID = string.IsNullOrEmpty(entity.ReceiveUserID) ? CurrentUserInfo.UserName : entity.ReceiveUserID;
            if (base.StepName == ProcessConstString.StepName.STEP_DRAFT && !base.IsPreview)
            {
                //拟稿日期
                txtNiGaoRiQi.Text = DateTime.Now.ToString("yyyy-MM-dd");
                //拟稿人
                this.txtNiGaoRen.Text = CurrentUserInfo.DisplayName;
                this.txtNiGaoRenID.Text = CurrentUserInfo.UserName;
                OADept.GetDeptByUser(this.ddlDepartment, userID, 1, true, false);
                FormsMethod.SelectedDropDownList(this.ddlDepartment, entity.DepartmentID);

                string[] ManagerIds = OAUser.GetDeptManagerArray(this.ddlDepartment.SelectedValue, -1);

                if (ManagerIds[0].Contains(CurrentUserInfo.UserName))
                {
                    txtIsManager.Text = "1";
                }
                if (txtIsManager.Text == "1")
                {
                    OAUser.GetUserByDeptPost(ddlChuLingDao, this.ddlDepartment.SelectedValue, OUConstString.PostName.FUCHUZHANG, false, true, 0);
                }
                else
                {
                    FounderSoftware.Framework.Business.ViewBase vDept = OADept.GetDeptByDeptUser(this.ddlDepartment.SelectedValue, userID, 2);
                    //根据处室部门的ID和用户账号找出用户所属该处室下的科室-修改bug
                    if (!string.IsNullOrEmpty(vDept.IDs))
                    {
                        OAUser.GetUserByDeptPost(ddlYanShouRen, vDept.IDs, OUConstString.PostName.FUKEZHANG, false, true, 2);
                    }
                }

                B_FinanceDeptInfo bllInfo = new B_FinanceDeptInfo();
                M_FinanceDeptInfo info = bllInfo.GetFinanceDeptInfoByDeptID(DateTime.Now.Year.ToString(), this.ddlDepartment.SelectedValue);
                this.txtYuSuanJinE.Text = info.ZDBudgetCost;
                this.txtLeiJiBaoXiaoJinE.Text = info.ZDUseCost;

                if (!string.IsNullOrEmpty(entity.ChuLingDaoID))
                {
                    FormsMethod.SelectedDropDownList(this.ddlChuLingDao, entity.ChuLingDaoID);
                }

                if (!string.IsNullOrEmpty(entity.YanShouRenID))
                {
                    FormsMethod.SelectedDropDownList(this.ddlYanShouRen, entity.YanShouRenID);
                }
            }
            else
            {
                FormsMethod.SetDropDownList(this.ddlDepartment, entity.DepartmentID, entity.Department);
                FormsMethod.SetDropDownList(this.ddlZongJingLi, entity.ZongJingLiID, entity.ZongJingLi);
                FormsMethod.SetDropDownList(this.ddlZhuGuanLingDao, entity.ZhuGuanLingDaoID, entity.ZhuGuanLingDao);
                FormsMethod.SetDropDownList(this.ddlChuLingDao, entity.ChuLingDaoID, entity.ChuLingDao);
                FormsMethod.SetDropDownList(this.ddlYanShouRen, entity.YanShouRenID, entity.YanShouRen);
                FormsMethod.SetDropDownList(this.ddlJingShouRen, entity.JingShouRenID, entity.JingShouRen);
            }

            //验收
            if (base.StepName == ProcessConstString.StepName.FinanceZDBXStepName.STEP_KeZhang && !base.IsPreview)
            {
                OAUser.GetUserByDeptPost(ddlChuLingDao, this.ddlDepartment.SelectedValue, OUConstString.PostName.CHUZHANG, false, true, 0);
            }

            //处长审核
            if (base.StepName == ProcessConstString.StepName.FinanceZDBXStepName.STEP_ChuZhang && !base.IsPreview)
            {
                OAUser.GetUserByRole(this.ddlZongJingLi, OUConstString.RoleName.COMPANY_LEADER);
                OAUser.GetUserByRole(this.ddlZhuGuanLingDao, OUConstString.RoleName.COMPANY_LEADER);
                OAUser.GetUserByRole(this.ddlJingShouRen, OUConstString.RoleName.CaiWu);
                if (txtIsManager.Text != "1")
                {
                    B_FinanceDeptInfo bllInfo = new B_FinanceDeptInfo();
                    M_FinanceDeptInfo info = bllInfo.GetFinanceDeptInfoByDeptID(DateTime.Now.Year.ToString(), this.ddlDepartment.SelectedValue);
                    this.txtYuSuanJinE.Text = info.ZDBudgetCost;
                    this.txtLeiJiBaoXiaoJinE.Text = info.ZDUseCost;
                    Double FeeFa = Convert.ToDouble(string.IsNullOrEmpty(txtLeiJiBaoXiaoJinE.Text) ? "0" : txtLeiJiBaoXiaoJinE.Text);
                    Double FeeYu = Convert.ToDouble(string.IsNullOrEmpty(txtYuSuanJinE.Text) ? "0" : txtYuSuanJinE.Text);
                    Double Rate = (string.IsNullOrEmpty(FeeRate) == true ? 0.1 : Convert.ToDouble(FeeRate));
                    if (FeeFa > FeeYu)
                    {
                        txtIsChaoYuSuan.Text = "1";
                    }
                }
            }

            //领导审核
            if (base.StepName == ProcessConstString.StepName.FinanceZDBXStepName.STEP_LingDao && !base.IsPreview)
            {
                OAUser.GetUserByRole(this.ddlJingShouRen, OUConstString.RoleName.CaiWu);
            }

            //是否退回
            if (base.StepName == ProcessConstString.StepName.STEP_DRAFT)
            {
                //this.txtIsBack.Text = entity.IsBack.ToString();
            }

            //拟稿人及日期
            if (entity.DraftDate != DateTime.MinValue)
            {
                this.txtNiGaoRiQi.Text = entity.DraftDate.ToString(DateFormat);

                //拟稿人显示非下拉列表框形式
                this.txtNiGaoRen.Visible = false;
                this.lblNiGaoRen.Visible = true;
                //this.lbNiGaoRen.Text = entity.Drafter + strNewLine + entity.DraftDate.ToString(ConstString.DateFormat.Long);
                this.lblNiGaoRen.Text = entity.Drafter;

            }
            else
            {
                this.txtNiGaoRiQi.Text = DateTime.Now.ToString(DateFormat);
            }
            //申请单编号
            this.txtDocumentNo.Text = entity.DocumentNo;

            this.txtDanJuZhangShu.Text = entity.DanJuZhangShu == Int32.MinValue ? "" : entity.DanJuZhangShu.ToString();

            this.txtYongTu.Text = entity.YongTu;

            txtBaoXiaoJinE.Text = entity.BaoXiaoJinE;
            txtBaoXiaoJinEDaXie.Text = entity.BaoXiaoJinEDaXie;

            this.txtShouKuanDanWei.Text = entity.ShouKuanDanWei;

            this.txtShouKuanZhangHao.Text = entity.ShouKuanZhangHao;

            this.txtShouKuanYinHang.Text = entity.ShouKuanYinHang;

            this.txtShouKuanZhangHao.Text = entity.ShouKuanZhangHao;

            this.txtYanQingRenShu.Text = entity.YanQingRenShu;

            this.txtRenJunXiaoFeiE.Text = entity.RenJunXiaoFeiE;

            ////拟稿人
            //this.txtNiGaoRen.Text = entity.Drafter;
            //this.txtNiGaoRenID.Text = entity.NiGaoRenID;

            //提示信息
            this.txtTiShiXinXi.Text = entity.Message;

            //提示信息添加
            this.txtTianJia.Text = entity.MessageAdd;

            //this.txtGeneralManagerID.Text = entity.GeneralManagerID;

            //this.txtChargeLeaderID.Text = entity.ChargeLeaderID;

            //this.txtDepartmentLeaderID.Text = entity.DepartmentLeaderID;
        }
Exemplo n.º 9
0
        /// <summary>
        /// 实体加载
        /// </summary>
        protected override void EntityToControl()
        {
            B_FinanceZDBX entity = base.EntityData != null ? base.EntityData as B_FinanceZDBX : new B_FinanceZDBX();

            //附件
            ucAttachment.UCDataList = entity.FileList;

            this.txtYuSuanJinE.Text       = entity.YuSuanJinE;
            this.txtLeiJiBaoXiaoJinE.Text = entity.LeiJiBaoXiaoJinE;
            this.txtIsChaoYuSuan.Text     = entity.IsChaoYuSuan == true ? "1" : "";
            this.txtIsManager.Text        = entity.IsLeader == true ? "1" : "";
            string userID = string.IsNullOrEmpty(entity.ReceiveUserID) ? CurrentUserInfo.UserName : entity.ReceiveUserID;

            if (base.StepName == ProcessConstString.StepName.STEP_DRAFT && !base.IsPreview)
            {
                //拟稿日期
                txtNiGaoRiQi.Text = DateTime.Now.ToString("yyyy-MM-dd");
                //拟稿人
                this.txtNiGaoRen.Text   = CurrentUserInfo.DisplayName;
                this.txtNiGaoRenID.Text = CurrentUserInfo.UserName;
                OADept.GetDeptByUser(this.ddlDepartment, userID, 1, true, false);
                FormsMethod.SelectedDropDownList(this.ddlDepartment, entity.DepartmentID);

                string[] ManagerIds = OAUser.GetDeptManagerArray(this.ddlDepartment.SelectedValue, -1);

                if (ManagerIds[0].Contains(CurrentUserInfo.UserName))
                {
                    txtIsManager.Text = "1";
                }
                if (txtIsManager.Text == "1")
                {
                    OAUser.GetUserByDeptPost(ddlChuLingDao, this.ddlDepartment.SelectedValue, OUConstString.PostName.FUCHUZHANG, false, true, 0);
                }
                else
                {
                    FounderSoftware.Framework.Business.ViewBase vDept = OADept.GetDeptByDeptUser(this.ddlDepartment.SelectedValue, userID, 2);
                    //根据处室部门的ID和用户账号找出用户所属该处室下的科室-修改bug
                    if (!string.IsNullOrEmpty(vDept.IDs))
                    {
                        OAUser.GetUserByDeptPost(ddlYanShouRen, vDept.IDs, OUConstString.PostName.FUKEZHANG, false, true, 2);
                    }
                }

                B_FinanceDeptInfo bllInfo = new B_FinanceDeptInfo();
                M_FinanceDeptInfo info    = bllInfo.GetFinanceDeptInfoByDeptID(DateTime.Now.Year.ToString(), this.ddlDepartment.SelectedValue);
                this.txtYuSuanJinE.Text       = info.ZDBudgetCost;
                this.txtLeiJiBaoXiaoJinE.Text = info.ZDUseCost;

                if (!string.IsNullOrEmpty(entity.ChuLingDaoID))
                {
                    FormsMethod.SelectedDropDownList(this.ddlChuLingDao, entity.ChuLingDaoID);
                }

                if (!string.IsNullOrEmpty(entity.YanShouRenID))
                {
                    FormsMethod.SelectedDropDownList(this.ddlYanShouRen, entity.YanShouRenID);
                }
            }
            else
            {
                FormsMethod.SetDropDownList(this.ddlDepartment, entity.DepartmentID, entity.Department);
                FormsMethod.SetDropDownList(this.ddlZongJingLi, entity.ZongJingLiID, entity.ZongJingLi);
                FormsMethod.SetDropDownList(this.ddlZhuGuanLingDao, entity.ZhuGuanLingDaoID, entity.ZhuGuanLingDao);
                FormsMethod.SetDropDownList(this.ddlChuLingDao, entity.ChuLingDaoID, entity.ChuLingDao);
                FormsMethod.SetDropDownList(this.ddlYanShouRen, entity.YanShouRenID, entity.YanShouRen);
                FormsMethod.SetDropDownList(this.ddlJingShouRen, entity.JingShouRenID, entity.JingShouRen);
            }

            //验收
            if (base.StepName == ProcessConstString.StepName.FinanceZDBXStepName.STEP_KeZhang && !base.IsPreview)
            {
                OAUser.GetUserByDeptPost(ddlChuLingDao, this.ddlDepartment.SelectedValue, OUConstString.PostName.CHUZHANG, false, true, 0);
            }

            //处长审核
            if (base.StepName == ProcessConstString.StepName.FinanceZDBXStepName.STEP_ChuZhang && !base.IsPreview)
            {
                OAUser.GetUserByRole(this.ddlZongJingLi, OUConstString.RoleName.COMPANY_LEADER);
                OAUser.GetUserByRole(this.ddlZhuGuanLingDao, OUConstString.RoleName.COMPANY_LEADER);
                OAUser.GetUserByRole(this.ddlJingShouRen, OUConstString.RoleName.CaiWu);
                if (txtIsManager.Text != "1")
                {
                    B_FinanceDeptInfo bllInfo = new B_FinanceDeptInfo();
                    M_FinanceDeptInfo info    = bllInfo.GetFinanceDeptInfoByDeptID(DateTime.Now.Year.ToString(), this.ddlDepartment.SelectedValue);
                    this.txtYuSuanJinE.Text       = info.ZDBudgetCost;
                    this.txtLeiJiBaoXiaoJinE.Text = info.ZDUseCost;
                    Double FeeFa = Convert.ToDouble(string.IsNullOrEmpty(txtLeiJiBaoXiaoJinE.Text) ? "0" : txtLeiJiBaoXiaoJinE.Text);
                    Double FeeYu = Convert.ToDouble(string.IsNullOrEmpty(txtYuSuanJinE.Text) ? "0" : txtYuSuanJinE.Text);
                    Double Rate  = (string.IsNullOrEmpty(FeeRate) == true ? 0.1 : Convert.ToDouble(FeeRate));
                    if (FeeFa > FeeYu)
                    {
                        txtIsChaoYuSuan.Text = "1";
                    }
                }
            }

            //领导审核
            if (base.StepName == ProcessConstString.StepName.FinanceZDBXStepName.STEP_LingDao && !base.IsPreview)
            {
                OAUser.GetUserByRole(this.ddlJingShouRen, OUConstString.RoleName.CaiWu);
            }

            //是否退回
            if (base.StepName == ProcessConstString.StepName.STEP_DRAFT)
            {
                //this.txtIsBack.Text = entity.IsBack.ToString();
            }

            //拟稿人及日期
            if (entity.DraftDate != DateTime.MinValue)
            {
                this.txtNiGaoRiQi.Text = entity.DraftDate.ToString(DateFormat);

                //拟稿人显示非下拉列表框形式
                this.txtNiGaoRen.Visible = false;
                this.lblNiGaoRen.Visible = true;
                //this.lbNiGaoRen.Text = entity.Drafter + strNewLine + entity.DraftDate.ToString(ConstString.DateFormat.Long);
                this.lblNiGaoRen.Text = entity.Drafter;
            }
            else
            {
                this.txtNiGaoRiQi.Text = DateTime.Now.ToString(DateFormat);
            }
            //申请单编号
            this.txtDocumentNo.Text = entity.DocumentNo;

            this.txtDanJuZhangShu.Text = entity.DanJuZhangShu == Int32.MinValue ? "" : entity.DanJuZhangShu.ToString();

            this.txtYongTu.Text = entity.YongTu;

            txtBaoXiaoJinE.Text      = entity.BaoXiaoJinE;
            txtBaoXiaoJinEDaXie.Text = entity.BaoXiaoJinEDaXie;

            this.txtShouKuanDanWei.Text = entity.ShouKuanDanWei;

            this.txtShouKuanZhangHao.Text = entity.ShouKuanZhangHao;

            this.txtShouKuanYinHang.Text = entity.ShouKuanYinHang;

            this.txtShouKuanZhangHao.Text = entity.ShouKuanZhangHao;

            this.txtYanQingRenShu.Text = entity.YanQingRenShu;

            this.txtRenJunXiaoFeiE.Text = entity.RenJunXiaoFeiE;

            ////拟稿人
            //this.txtNiGaoRen.Text = entity.Drafter;
            //this.txtNiGaoRenID.Text = entity.NiGaoRenID;

            //提示信息
            this.txtTiShiXinXi.Text = entity.Message;

            //提示信息添加
            this.txtTianJia.Text = entity.MessageAdd;

            //this.txtGeneralManagerID.Text = entity.GeneralManagerID;

            //this.txtChargeLeaderID.Text = entity.ChargeLeaderID;

            //this.txtDepartmentLeaderID.Text = entity.DepartmentLeaderID;
        }
        /// <summary>
        /// 实体加载
        /// </summary>
        protected override void EntityToControl()
        {
            B_Finance entity = base.EntityData != null ? base.EntityData as B_Finance : new B_Finance();
            //拟稿人
            this.txtNiGaoRen.Text = string.IsNullOrEmpty(entity.ReceiveUserName) ? CurrentUserInfo.DisplayName : entity.ReceiveUserName;
            this.txtNiGaoRenID.Text = string.IsNullOrEmpty(entity.ReceiveUserID) ? CurrentUserInfo.UserName : entity.ReceiveUserID;
            //新版OA时间精确到秒(控制时间的显示格式)
            //bool isOld = entity.DraftDate < base.OAStartTime;
            //职务
            drpZhiWu.DataSource = GetPostList();
            drpZhiWu.DataBind();
            drpZhiCheng.DataSource = GetTitleList();
            drpZhiCheng.DataBind();
            //附件
            ucAttachment.UCDataList = entity.FileList;
            this.txtFeeYuSuan.Text = entity.FeeYuSuan;
            this.txtFeeFaSheng.Text = entity.FeeFaSheng;
            this.txtShenPiYiJian.Text = entity.ShenPiYiJian;
            //编制部门及预算
            if (base.StepName == ProcessConstString.StepName.STEP_DRAFT && !base.IsPreview)
            {
                OADept.GetDeptByUser(this.ddlBianZhiBuMen, string.IsNullOrEmpty(entity.ReceiveUserID) ? CurrentUserInfo.UserName : entity.ReceiveUserID, 1, true, false);
                FormsMethod.SelectedDropDownList(this.ddlBianZhiBuMen, entity.BianZhiBuMenID); B_FinanceDeptInfo bllInfo = new B_FinanceDeptInfo();
                M_FinanceDeptInfo info = bllInfo.GetFinanceDeptInfoByDeptID(DateTime.Now.Year.ToString(), this.ddlBianZhiBuMen.SelectedValue);

                this.txtFeeYuSuan.Text = info.TripBudgetCost;
                this.txtFeeFaSheng.Text = info.TripUseCost;

                string ManagerDeptID = OADept.GetDeptID("总经理部");

                Double FeeFa = Convert.ToDouble(string.IsNullOrEmpty(txtFeeFaSheng.Text) ? "0" : txtFeeFaSheng.Text);
                Double FeeYu = Convert.ToDouble(string.IsNullOrEmpty(txtFeeYuSuan.Text) ? "0" : txtFeeYuSuan.Text);
                Double Rate = (string.IsNullOrEmpty(FeeRate) == true ? 0.1 : Convert.ToDouble(FeeRate));
                if ((FeeFa - FeeYu) / FeeYu > Rate)
                {
                    OAUser.GetUserByDeptPost(ddlZongJingLi, ManagerDeptID, OUConstString.PostName.ZONGJINGLI, true, false, 1);
                    ddlZongJingLi.Enabled = true;
                    this.SubmitStatus = 1;
                }
                else if (FeeFa > FeeYu)
                {
                    OAUser.GetUserByDeptPost(ddlZhuGuanLingDao, ManagerDeptID, OUConstString.PostName.FUZONGJINGLI, true, false, 1);
                    ddlZhuGuanLingDao.Enabled = true;
                    this.SubmitStatus = 2;
                }
                else if (FeeFa <= FeeYu)
                {
                    OAUser.GetUserByDeptPost(ddlChuLingDao, this.ddlBianZhiBuMen.SelectedValue, OUConstString.PostName.CHUZHANG, false, true, 0);
                    ddlChuLingDao.Enabled = true;
                    this.SubmitStatus = 3;
                }
                ListItem item = new ListItem(this.txtNiGaoRen.Text, this.txtNiGaoRenID.Text);
                if (ddlChuLingDao.Items.Contains(item))
                {
                    ddlChuLingDao.Items.Clear();
                    OAUser.GetUserByDeptPost(ddlZhuGuanLingDao, ManagerDeptID, OUConstString.PostName.FUZONGJINGLI, true, false, 1);
                    ddlZhuGuanLingDao.Enabled = true;
                    this.SubmitStatus = 2;
                }
                else if (ddlZhuGuanLingDao.Items.Contains(item))
                {
                    ddlZhuGuanLingDao.Items.Clear();
                    OAUser.GetUserByDeptPost(ddlZongJingLi, ManagerDeptID, OUConstString.PostName.ZONGJINGLI, true, false, 1);
                    ddlZongJingLi.Enabled = true;
                    this.SubmitStatus = 1;
                }
            }
            else
            {
                FormsMethod.SetDropDownList(this.ddlBianZhiBuMen, entity.BianZhiBuMenID, entity.Department);
                FormsMethod.SetDropDownList(this.ddlZongJingLi, entity.GeneralManagerID, entity.GeneralManager);
                FormsMethod.SetDropDownList(this.ddlZhuGuanLingDao, entity.ChargeLeaderID, entity.ChargeLeader);
                FormsMethod.SetDropDownList(this.ddlChuLingDao, entity.DepartmentLeaderID, entity.DepartmentLeader);
            }
            //申请单编号
            this.txtBianHao.Text = entity.DocumentNo;
            FormsMethod.SelectedDropDownList(this.drpZhiWu, entity.ZhiWu);
            FormsMethod.SelectedDropDownList(this.drpZhiCheng, entity.ZhiCheng);

            //部门负责人
            if (base.StepName == ProcessConstString.StepName.STEP_DRAFT && !base.IsPreview)
            {
                if (this.ddlBianZhiBuMen.Items.Count > 0)
                {
                    OAUser.GetUserByDeptPost(this.ddlFuZeRen, this.ddlBianZhiBuMen.SelectedValue, OUConstString.PostName.CHUZHANG, true, true);
                }
                FormsMethod.SelectedDropDownList(this.ddlFuZeRen, entity.FuZeRenID);
            }
            else
            {
                FormsMethod.SetDropDownList(this.ddlFuZeRen, entity.FuZeRenID, entity.DeptPrincipal);
            }

            //订票处
            if (base.StepName == ProcessConstString.StepName.FinanceStepName.STEP_DepartLeader ||
                base.StepName == ProcessConstString.StepName.FinanceStepName.STEP_ChargeLeader ||
                base.StepName == ProcessConstString.StepName.FinanceStepName.STEP_GeneralManager
                && !base.IsPreview)
            {
                string[] arrayBookingOffice = OAUser.GetUserByRoleName(OUConstString.RoleName.BookingOffice);
                this.txtBookingOfficeID.Text = arrayBookingOffice[0];

            }

            //是否退回
            if (base.StepName == ProcessConstString.StepName.STEP_DRAFT)
            {
                this.txtIsBack.Text = entity.IsBack.ToString();
            }

            //拟稿人及日期
            if (entity.DraftDate != DateTime.MinValue)
            {
                this.lblNiGaoRiQi.Text = entity.DraftDate.ToString(DateFormat);

                //拟稿人显示非下拉列表框形式
                this.txtNiGaoRen.Visible = false;
                this.lbNiGaoRen.Visible = true;
                //this.lbNiGaoRen.Text = entity.Drafter + strNewLine + entity.DraftDate.ToString(ConstString.DateFormat.Long);
                this.lbNiGaoRen.Text = entity.Drafter;

            }
            else
            {
                this.lblNiGaoRiQi.Text = DateTime.Now.ToString(DateFormat);
            }

            //抄送
            this.txtChaoSong.Text = entity.CopySend;
            this.txtChaoSongID.Text = entity.ChaoSongID;
            this.txtChaoSongDeptID.Text = entity.ChaoSongDeptID;

            //主题
            this.txtZhuTi.Text = entity.DocumentTitle;

            this.txtTongXing.Text = entity.TongXingRenYuan;

            //出差任务
            //this.txtNeiRong.Text = SysString.HtmlToTextCode(entity.Content);
            this.txtChuChaiRenWu.Text = entity.ChuChaiRenWu;
            this.timeChuFa.Text = entity.ChuFaShiJian;
            this.timeHuiCheng.Text = entity.HuiChengShiJian;

            //商务信息
            this.txtShangWu.Text = entity.ShangWuXinXi;

            //目的地
            this.txtDestination.Text = entity.Destination;

            //拟稿人
            //this.txtNiGaoRen.Text = entity.Drafter;
            //this.txtNiGaoRenID.Text = entity.NiGaoRenID;

            //提示信息
            this.txtTiShiXinXi.Text = entity.Message;
            this.txtBanShuiXinXi.Text = entity.Message;

            //提示信息添加
            this.txtTianJia.Text = entity.MessageAdd;

            this.txtGeneralManagerID.Text = entity.GeneralManagerID;

            this.txtChargeLeaderID.Text = entity.ChargeLeaderID;

            this.txtDepartmentLeaderID.Text = entity.DepartmentLeaderID;
        }
 private void CaiWuFeiYong()
 {
     //财务审核完成后调用 处室发生费用
     string year = DateTime.Now.Year.ToString();
     B_FinanceDeptInfo bllFinanceInfo = new B_FinanceDeptInfo();
     int result = 0;
     double heji = 0;
     if (txtHeJi.Text != "")
         heji = Convert.ToDouble(txtHeJi.Text);
     //取得处室
     string chuShiID = ddlBianZhiBuMen.SelectedValue;
     if (txtType.Text == "出差")
     {
         result = bllFinanceInfo.UpdateFinanceFeesByDeptID(year, chuShiID, heji, 0);
     }
     else if (txtType.Text == "培训")
     {
         result = bllFinanceInfo.UpdateFinanceFeesByDeptID(year, chuShiID, 0, heji);
     }
 }
        /// <summary>
        /// 删除选择的数据
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void lnkbtnDelete_Click(object sender, EventArgs e)
        {
            int index = this.gvFinanceFeeList.SelectedIndex;
            int id = int.Parse(gvFinanceFeeList.DataKeys[index]["ID"].ToString());

            B_FinanceDeptInfo financeDeptInfo = new B_FinanceDeptInfo();
            financeDeptInfo.Load(id);
            financeDeptInfo.DeleteById(id.ToString());

            BindFinanceList();
            //清空页面数据
            ClearData();
            IMessage ms = new WebFormMessage(Page, ConstString.PromptInfo.ACTION_DEL_SUC);
            ms.Show();
        }
 /// <summary>
 /// 
 /// </summary>
 private void BindFinanceList()
 {
     B_FinanceDeptInfo bllFinanceList = new B_FinanceDeptInfo();
     //得到所有财务费用
     DataTable dt = bllFinanceList.GetAllFinanceDeptInfo();
     if (dt != null)
     {
         gvFinanceFeeList.DataSource = dt;
         gvFinanceFeeList.DataBind();
     }
 }
        /// <summary>
        /// 修改选择的数据
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void lnkbtnModify_Click(object sender, EventArgs e)
        {
            int index = gvFinanceFeeList.SelectedIndex;
            int id = int.Parse(gvFinanceFeeList.DataKeys[index]["ID"].ToString());

            B_FinanceDeptInfo financeDeptInfo = new B_FinanceDeptInfo();
            financeDeptInfo.ID = id;
            financeDeptInfo.FinanceYear = this.ddlFinanceYear.SelectedValue;
            financeDeptInfo.DeptID = this.ddlDept.SelectedValue;
            financeDeptInfo.TripBudgetCost = this.txtTripBudget.Text.Trim();
            financeDeptInfo.TrainingBudgetCost = this.txtTrainingBudget.Text;
            financeDeptInfo.ZDBudgetCost = this.txtZDBudget.Text;
            financeDeptInfo.TripUseCost = this.txtTripUse.Text;
            financeDeptInfo.TrainingUseCost = this.txtTrainingUse.Text;
            financeDeptInfo.ZDUseCost = this.txtZDUse.Text;
            if (financeDeptInfo.Save())
            {
                //得到所有财务费用
                BindFinanceList();
                //清空页面数据
                ClearData();
                IMessage ms = new WebFormMessage(Page, ConstString.PromptInfo.ACTION_EDIT_SUC);
                ms.Show();

            }
            else
            {
                IMessage ms = new WebFormMessage(Page, financeDeptInfo.ErrMsgs[0].ToString());
                ms.Show();
            }
        }