private void 人力toolStripButton_Click(object sender, EventArgs e)
        {
            if (lblStatus.Text.Trim() == OverTimeBillStatus.等待人力资源复核.ToString())
            {
                HR_OvertimeBill overTime = new HR_OvertimeBill();

                overTime.ID               = Convert.ToInt32(m_billNo);
                overTime.HR_Signature     = BasicInfo.LoginID;
                overTime.HR_SignatureDate = ServerTime.Time;

                overTime.BillStatus = OverTimeBillStatus.确认加班完成情况.ToString();

                if (!m_overTimeServer.UpdateOverTimeBill(overTime, "人力资源", out error))
                {
                    MessageDialog.ShowPromptMessage(error);
                    return;
                }

                string msg = string.Format("{0} 号加班单人力资源复核成功,等待确认加班完成情况", m_billNo);
                m_billMessageServer.PassFlowMessage(m_billNo, msg, BillFlowMessage_ReceivedUserType.角色,
                                                    m_billMessageServer.GetDeptLeaderRoleName(m_personnerServer.GetPersonnelViewInfo(
                                                                                                  txtApplicant.Tag.ToString()).部门编号).ToList());
                this.Close();
            }
            else
            {
                MessageDialog.ShowPromptMessage("请确认单据状态!");
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 处理自动生成的加班单的人员信息
        /// </summary>
        /// <param name="infoTable">人员信息列表</param>
        /// <param name="saveFlag">保存标志</param>
        public void AutoCreateOverTime_BatchOperation(DataTable infoTable, bool saveFlag)
        {
            string error = null;

            DepotManagementDataContext ctx = CommentParameter.DepotDataContext;

            ctx.Connection.Open();
            ctx.Transaction = ctx.Connection.BeginTransaction();

            try
            {
                infoTable.AcceptChanges();
                DataTable tempTable = DataSetHelper.SelectDistinct("", infoTable, "单据号");

                foreach (DataRow dr in tempTable.Rows)
                {
                    var varData = from a in ctx.HR_OvertimePersonnel
                                  where a.BillID == Convert.ToInt32(dr["单据号"])
                                  select a;

                    ctx.HR_OvertimePersonnel.DeleteAllOnSubmit(varData);

                    DataTable tempTable1 = DataSetHelper.SiftDataTable(infoTable, " 单据号 = " + Convert.ToInt32(dr["单据号"]), out error);

                    foreach (DataRow dr1 in tempTable1.Rows)
                    {
                        if (Convert.ToBoolean(dr1["选"]))
                        {
                            HR_OvertimePersonnel personnel = new HR_OvertimePersonnel();

                            personnel.BillID = Convert.ToInt32(dr["单据号"]);
                            personnel.WorkID = dr1["人员工号"].ToString();

                            ctx.HR_OvertimePersonnel.InsertOnSubmit(personnel);
                        }
                    }

                    if (!saveFlag)
                    {
                        var varBill = from a in ctx.HR_OvertimeBill
                                      where a.ID == Convert.ToInt32(dr["单据号"])
                                      select a;

                        HR_OvertimeBill billInfo = varBill.Single();

                        billInfo.Authorize  = true;
                        billInfo.BillStatus = "已完成";
                    }
                }

                ctx.SubmitChanges();
                ctx.Transaction.Commit();
            }
            catch (Exception ex)
            {
                ctx.Transaction.Rollback();
                throw new Exception(ex.Message);
            }
        }
        private void 主管审核toolStripButton_Click(object sender, EventArgs e)
        {
            if (lblStatus.Text.Trim() == OverTimeBillStatus.等待主管审核.ToString())
            {
                IQueryable <View_HR_PersonnelArchive> directorGroup = m_personnerServer.GetDeptDirector(
                    m_personnerServer.GetPersonnelInfo(txtApplicant.Tag.ToString()).Dept, "0");
                bool flag = false;

                if (directorGroup != null && directorGroup.Count() > 0)
                {
                    foreach (var item in directorGroup)
                    {
                        if (BasicInfo.LoginID == item.员工编号)
                        {
                            flag = true;
                            break;
                        }
                    }
                }

                if (flag)
                {
                    HR_OvertimeBill overTime = new HR_OvertimeBill();

                    overTime.ID                        = Convert.ToInt32(m_billNo);
                    overTime.Date                      = Convert.ToDateTime(dtpDate.Value.ToShortDateString());
                    overTime.CompensateMode            = cmbCompensateMode.Text;
                    overTime.Hours                     = numHours.Value;
                    overTime.DeptDirector              = BasicInfo.LoginID;
                    overTime.DeptDirectorSignatureDate = ServerTime.Time;
                    overTime.BillStatus                = OverTimeBillStatus.等待部门负责人审核.ToString();

                    if (!m_overTimeServer.UpdateOverTimeBill(overTime, "部门主管审批", out error))
                    {
                        MessageDialog.ShowPromptMessage(error);
                        return;
                    }

                    string msg = string.Format("{0} 号加班单主管审核成功,请部门负责人审批", m_billNo);
                    m_billMessageServer.PassFlowMessage(m_billNo, msg, BillFlowMessage_ReceivedUserType.角色,
                                                        m_billMessageServer.GetDeptPrincipalRoleName(m_personnerServer.GetPersonnelViewInfo(
                                                                                                         txtApplicant.Tag.ToString()).部门编号).ToList());

                    MessageDialog.ShowPromptMessage("主管审核成功!");
                    this.Close();
                }
                else
                {
                    MessageDialog.ShowPromptMessage("您不是申请人的部门主管,请等待部门主管审核!");
                    return;
                }
            }
            else
            {
                MessageDialog.ShowPromptMessage("请确认单据状态!");
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 通过单据号修改加班单的实际加班小时数
        /// </summary>
        /// <param name="billNo">单据号</param>
        /// <param name="hours">实际小时数</param>
        /// <returns>修改成功返回True失败返回False</returns>
        public bool UpdateOverTimeBillByHours(string billNo, double hours)
        {
            DepotManagementDataContext dataContxt = CommentParameter.DepotDataContext;

            var result = from a in dataContxt.HR_OvertimeBill
                         where a.ID == Convert.ToInt32(billNo)
                         select a;

            if (result.Count() == 1)
            {
                HR_OvertimeBill overTime = result.Single();

                overTime.RealHours = hours;
            }
            else
            {
                return(false);
            }

            dataContxt.SubmitChanges();
            return(true);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// 领导审核修改加班单据
        /// </summary>
        /// <param name="overTime">出差单据数据集</param>
        /// <param name="roleType">角色类型</param>
        /// <param name="error">错误信息</param>
        /// <returns>成功返回True,失败返回False</returns>
        public bool UpdateOverTimeBill(HR_OvertimeBill overTime, string roleType, out string error)
        {
            error = "";
            DepotManagementDataContext dataContxt = CommentParameter.DepotDataContext;

            dataContxt.Connection.Open();
            dataContxt.Transaction = dataContxt.Connection.BeginTransaction();

            try
            {
                var result = from a in dataContxt.HR_OvertimeBill
                             where a.ID == overTime.ID
                             select a;

                if (result.Count() != 1)
                {
                    error = "信息有误,请查证后再操作!";
                    return(false);
                }

                HR_OvertimeBill bill = result.Single();
                List <string>   list = new List <string>();
                DataTable       dt   = GlobalObject.DatabaseServer.QueryInfo("select * from HR_OvertimePersonnel where billID=" + bill.ID);

                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    list.Add(dt.Rows[i]["WorkID"].ToString());
                }

                bill.BillStatus = overTime.BillStatus;

                switch (roleType)
                {
                case "部门主管审批":
                    bill.DeptDirector = overTime.DeptDirector;
                    bill.DeptDirectorSignatureDate = overTime.DeptDirectorSignatureDate;
                    break;

                case "分管领导审批":
                    bill.Leader = overTime.Leader;
                    bill.LeaderSignatureDate = overTime.LeaderSignatureDate;
                    bill.Authorize           = overTime.Authorize;
                    bill.VerifyHours         = overTime.VerifyHours;
                    bill.RealHours           = overTime.RealHours;
                    break;

                case "部门负责人审批":
                    bill.DeptPrincipal = overTime.DeptPrincipal;
                    bill.DeptPrincipalSignatureDate = overTime.DeptPrincipalSignatureDate;
                    bill.Authorize   = overTime.Authorize;
                    bill.VerifyHours = overTime.VerifyHours;
                    bill.RealHours   = overTime.RealHours;
                    break;

                case "人力资源":
                    bill.HR_Signature     = overTime.HR_Signature;
                    bill.HR_SignatureDate = overTime.HR_SignatureDate;
                    break;

                case "确认加班完成情况":
                    bill.Verifier           = overTime.Verifier;
                    bill.VerifyFinish       = overTime.VerifyFinish;
                    bill.VerifyHours        = overTime.VerifyHours;
                    bill.VerifySignaturDate = overTime.VerifySignaturDate;
                    bill.RealHours          = Convert.ToDouble(overTime.VerifyHours);
                    break;

                default:
                    break;
                }

                dataContxt.SubmitChanges();

                if (GlobalObject.GeneralFunction.StringConvertToEnum <OverTimeBillStatus>(bill.BillStatus) == OverTimeBillStatus.已完成)
                {
                    ITimeExceptionServer service = ServerModuleFactory.GetServerModule <ITimeExceptionServer>();
                    service.OperationTimeException_Replenishments(dataContxt, bill.ID.ToString(), CE_HR_AttendanceExceptionType.加班);
                }

                dataContxt.Transaction.Commit();
                return(true);
            }
            catch (Exception ex)
            {
                dataContxt.Transaction.Rollback();
                error = ex.Message;
                return(false);
            }
        }
Ejemplo n.º 6
0
        /// <summary>
        /// 修改加班申请
        /// </summary>
        /// <param name="overTime">加班申请主信息</param>
        /// <param name="personnel">加班人员</param>
        /// <param name="billID">单据号</param>
        /// <param name="error">错误信息</param>
        /// <returns>成功返回true,失败返回False</returns>
        public bool UpdateOverTimeBill(HR_OvertimeBill overTime, List <HR_OvertimePersonnel> personnel, int billID, out string error)
        {
            error = "";

            try
            {
                DepotManagementDataContext dataContxt = CommentParameter.DepotDataContext;

                var resultMain = from a in dataContxt.HR_OvertimeBill
                                 where a.ID == billID
                                 select a;

                if (resultMain.Count() != 1)
                {
                    error = "信息有误,请查证后再操作!";
                    return(false);
                }
                else
                {
                    HR_OvertimeBill bill = resultMain.Single();

                    bill.BeginTime         = overTime.BeginTime;
                    bill.EndTime           = overTime.EndTime;
                    bill.VerifyHours       = overTime.VerifyHours;
                    bill.RealHours         = overTime.RealHours;
                    bill.CompensateMode    = overTime.CompensateMode;
                    bill.OvertimeAddress   = overTime.OvertimeAddress;
                    bill.Date              = overTime.Date;
                    bill.Errand            = overTime.Errand;
                    bill.Hours             = overTime.Hours;
                    bill.NumberOfPersonnel = overTime.NumberOfPersonnel;
                    bill.BillStatus        = overTime.BillStatus;
                }

                var result = from c in dataContxt.HR_OvertimePersonnel
                             where c.BillID == billID
                             select c;

                if (result.Count() > 0)
                {
                    dataContxt.HR_OvertimePersonnel.DeleteAllOnSubmit(result);

                    foreach (var item in personnel)
                    {
                        HR_OvertimePersonnel personnleList = item;

                        personnleList.BillID = billID;
                        personnleList.WorkID = item.WorkID;

                        dataContxt.HR_OvertimePersonnel.InsertOnSubmit(personnleList);
                    }
                }

                dataContxt.SubmitChanges();
                return(true);
            }
            catch (Exception ex)
            {
                error = ex.Message;
                return(false);
            }
        }
Ejemplo n.º 7
0
        /// <summary>
        /// 新增加班申请
        /// </summary>
        /// <param name="overTime">加班申请主信息</param>
        /// <param name="personnel">加班人员</param>
        /// <param name="error">错误信息</param>
        /// <returns>成功返回新增的单据编号,失败返回-1</returns>
        public int AddOverTimeBill(HR_OvertimeBill overTime, List <HR_OvertimePersonnel> personnel, out string error)
        {
            DepotManagementDataContext dataContxt = CommentParameter.DepotDataContext;

            dataContxt.Connection.Open();
            dataContxt.Transaction = dataContxt.Connection.BeginTransaction();
            error = "";

            try
            {
                var result = from a in dataContxt.HR_OvertimeBill
                             where a.Applicant == overTime.Applicant && a.BeginTime == overTime.BeginTime
                             select a;

                if (result.Count() > 0)
                {
                    if (result.Count() == 1)
                    {
                        var resultList = from c in dataContxt.HR_OvertimePersonnel
                                         where c.BillID == result.Single().ID
                                         select c;

                        foreach (HR_OvertimePersonnel item in resultList)
                        {
                            foreach (HR_OvertimePersonnel list in personnel)
                            {
                                if (item.WorkID == list.WorkID)
                                {
                                    error = "同一员工不能在同一时间申请多个单据!";
                                    return(-1);
                                }
                            }
                        }
                    }
                }

                dataContxt.HR_OvertimeBill.InsertOnSubmit(overTime);
                dataContxt.SubmitChanges();

                int billID = -1;

                var resultOvertime = from a in dataContxt.HR_OvertimeBill
                                     where a.Applicant == overTime.Applicant && a.Date == overTime.Date &&
                                     a.BeginTime == overTime.BeginTime
                                     select a;

                if (resultOvertime.Count() == 1)
                {
                    billID = resultOvertime.Single().ID;

                    foreach (var item in personnel)
                    {
                        HR_OvertimePersonnel personnleList = item;

                        personnleList.BillID = billID;
                        personnleList.WorkID = item.WorkID;

                        new AttendanceAnalysis().DataTimeIsRepeat <HR_OvertimeBill>(dataContxt, resultOvertime.Single(), personnleList.WorkID);
                        dataContxt.HR_OvertimePersonnel.InsertOnSubmit(personnleList);
                    }
                }

                dataContxt.SubmitChanges();
                dataContxt.Transaction.Commit();
                return(billID);
            }
            catch (Exception ex)
            {
                error = ex.Message;
                dataContxt.Transaction.Rollback();
                return(-1);
            }
        }
        private void 负责人toolStripButton_Click(object sender, EventArgs e)
        {
            if (lblStatus.Text.Trim() == OverTimeBillStatus.等待部门负责人审核.ToString())
            {
                HR_OvertimeBill overTime = new HR_OvertimeBill();

                overTime.ID            = Convert.ToInt32(m_billNo);
                overTime.DeptPrincipal = BasicInfo.LoginID;
                overTime.DeptPrincipalSignatureDate = ServerTime.Time;
                overTime.RealHours   = Convert.ToDouble(numVerifyHours.Value);
                overTime.VerifyHours = numVerifyHours.Value;

                if (!cbAuthorize.Checked)
                {
                    if (MessageBox.Show("您是否同意【" + txtApplicant.Text + "】的加班申请?", "消息",
                                        MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        cbAuthorize.Checked = true;
                    }
                }

                overTime.Authorize = cbAuthorize.Checked;

                IQueryable <View_HR_PersonnelArchive> directorGroup = m_personnerServer.GetDeptDirector(
                    m_personnerServer.GetPersonnelInfo(txtApplicant.Tag.ToString()).Dept, "1");
                bool flag = false;

                if (directorGroup != null && directorGroup.Count() > 0)
                {
                    foreach (var item in directorGroup)
                    {
                        if (txtApplicant.Tag.ToString() == item.员工编号)
                        {
                            flag = true;
                            break;
                        }
                    }
                }

                if (!cbAuthorize.Checked)
                {
                    overTime.BillStatus = OverTimeBillStatus.已完成.ToString();
                }
                else if (!flag)
                {
                    if (ServerTime.Time > dtpBeginTime.Value)
                    {
                        overTime.BillStatus = OverTimeBillStatus.已完成.ToString();
                    }
                    else
                    {
                        overTime.BillStatus = OverTimeBillStatus.确认加班完成情况.ToString();
                    }
                }
                else
                {
                    overTime.BillStatus = OverTimeBillStatus.等待分管领导审批.ToString();
                }

                if (!m_overTimeServer.UpdateOverTimeBill(overTime, "部门负责人审批", out error))
                {
                    MessageDialog.ShowPromptMessage(error);
                    return;
                }

                if (overTime.BillStatus == OverTimeBillStatus.已完成.ToString())
                {
                    if (!cbAuthorize.Checked)
                    {
                        string        msg        = string.Format("{0} 号加班申请单已经处理完毕,部门负责人审批未批准", m_billNo);
                        List <string> noticeUser = new List <string>();

                        noticeUser.Add(txtApplicant.Tag.ToString());

                        m_billMessageServer.EndFlowMessage(m_billNo, msg, null, noticeUser);

                        MessageDialog.ShowPromptMessage("加班申请单已经处理完毕,部门负责人审批未批准!");
                        this.Close();
                    }
                    else
                    {
                        string        msg        = string.Format("{0} 号加班申请单已经处理完毕", m_billNo);
                        List <string> noticeUser = new List <string>();

                        noticeUser.Add(txtApplicant.Tag.ToString());

                        m_billMessageServer.EndFlowMessage(m_billNo, msg, null, noticeUser);

                        MessageDialog.ShowPromptMessage("加班申请单已经处理完毕!");
                        this.Close();
                    }
                }
                else if (overTime.BillStatus == OverTimeBillStatus.确认加班完成情况.ToString())
                {
                    string msg = string.Format("{0} 号加班单部门负责人审批成功,等待确认加班完成情况", m_billNo);
                    m_billMessageServer.PassFlowMessage(m_billNo, msg, BillFlowMessage_ReceivedUserType.用户, BasicInfo.LoginID);
                }
                else
                {
                    string msg = string.Format("{0} 号加班单部门负责人审批成功,请分管领导人审批", m_billNo);
                    m_billMessageServer.PassFlowMessage(m_billNo, msg, BillFlowMessage_ReceivedUserType.角色,
                                                        m_billMessageServer.GetDeptLeaderRoleName(m_personnerServer.GetPersonnelViewInfo(
                                                                                                      txtApplicant.Tag.ToString()).部门编号).ToList());
                }

                this.Close();
            }
            else
            {
                MessageDialog.ShowPromptMessage("请确认单据状态!");
            }
        }
        private void 修改单据ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (BasicInfo.LoginID == txtApplicant.Tag.ToString())
            {
                if (lblStatus.Text == "已完成")
                {
                    MessageDialog.ShowPromptMessage("单据已完成,不能修改!");
                    return;
                }

                if (!CheckControl())
                {
                    return;
                }

                List <HR_OvertimePersonnel> lstPersonnel = new List <HR_OvertimePersonnel>(dataGridView2.Rows.Count);

                for (int i = 0; i < dataGridView2.Rows.Count; i++)
                {
                    HR_OvertimePersonnel       personnel = new HR_OvertimePersonnel();
                    DataGridViewCellCollection cells     = dataGridView2.Rows[i].Cells;

                    personnel.WorkID = dataGridView2.Rows[i].Cells["员工编号"].Value.ToString();

                    lstPersonnel.Add(personnel);
                }

                HR_OvertimeBill overTimeBill = new HR_OvertimeBill();

                overTimeBill.ID                = Convert.ToInt32(m_billNo);
                overTimeBill.Authorize         = false;
                overTimeBill.BeginTime         = dtpBeginTime.Value;
                overTimeBill.CompensateMode    = cmbCompensateMode.Text;
                overTimeBill.Date              = dtpDate.Value;
                overTimeBill.OvertimeAddress   = cmbOvertimeAddress.Text;
                overTimeBill.Errand            = txtErrand.Text;
                overTimeBill.Hours             = numHours.Value;
                overTimeBill.RealHours         = Convert.ToDouble(numHours.Value);
                overTimeBill.NumberOfPersonnel = Convert.ToInt32(txtNumOfPersonnel.Text);
                overTimeBill.EndTime           = dtpEndTime.Value;
                overTimeBill.VerifyHours       = numVerifyHours.Value;

                IQueryable <View_HR_PersonnelArchive> directorGroup1 = m_personnerServer.GetDeptDirector(
                    m_personnerServer.GetPersonnelInfo(txtApplicant.Tag.ToString()).Dept, "1");

                bool flagPri        = false; //判断申请人是不是负责人
                bool isDeptDirector = false; //申请部门有没有主管

                if (directorGroup1 != null && directorGroup1.Count() > 0)
                {
                    foreach (var item in directorGroup1)
                    {
                        if (BasicInfo.LoginID == item.员工编号)
                        {
                            flagPri = true;

                            break;
                        }
                    }
                }

                IQueryable <View_HR_PersonnelArchive> directorGroup = m_personnerServer.GetDeptDirector(
                    m_personnerServer.GetPersonnelInfo(txtApplicant.Tag.ToString()).Dept, "0");
                bool flag = false;//判断申请人是不是主管

                if (directorGroup != null && directorGroup.Count() > 0)
                {
                    isDeptDirector = true;

                    foreach (var item in directorGroup)
                    {
                        if (BasicInfo.LoginID == item.员工编号)
                        {
                            flag = true;

                            break;
                        }
                    }
                }

                if (!flag && !flagPri)
                {
                    if (isDeptDirector)
                    {
                        overTimeBill.BillStatus = OverTimeBillStatus.等待主管审核.ToString();
                    }
                    else
                    {
                        overTimeBill.BillStatus = OverTimeBillStatus.等待部门负责人审核.ToString();
                    }
                }
                else if (flag && !flagPri)
                {
                    overTimeBill.BillStatus = OverTimeBillStatus.等待部门负责人审核.ToString();
                }
                else
                {
                    overTimeBill.BillStatus = OverTimeBillStatus.等待分管领导审批.ToString();
                }

                if (!m_overTimeServer.UpdateOverTimeBill(overTimeBill, lstPersonnel, Convert.ToInt32(m_billNo), out error))
                {
                    MessageDialog.ShowPromptMessage(error);
                    return;
                }
                MessageDialog.ShowPromptMessage("修改成功!");

                m_billMessageServer.DestroyMessage(m_billNo);

                if (overTimeBill.BillStatus.Equals(OverTimeBillStatus.等待主管审核.ToString()))
                {
                    m_billMessageServer.PassFlowMessage(m_billNo, string.Format("{0}号加班申请单,请主管审核", m_billNo),
                                                        BillFlowMessage_ReceivedUserType.角色,
                                                        m_billMessageServer.GetDeptDirectorRoleName(m_personnerServer.GetPersonnelViewInfo(
                                                                                                        txtApplicant.Tag.ToString()).部门编号).ToList());
                }
                else if (overTimeBill.BillStatus == OverTimeBillStatus.等待部门负责人审核.ToString())
                {
                    m_billMessageServer.PassFlowMessage(m_billNo, string.Format("{0}号加班申请单,请部门负责人审核", m_billNo),
                                                        BillFlowMessage_ReceivedUserType.角色, m_billMessageServer.GetDeptPrincipalRoleName(
                                                            m_personnerServer.GetPersonnelViewInfo(txtApplicant.Tag.ToString()).部门编号).ToList());
                }
                else
                {
                    m_billMessageServer.PassFlowMessage(m_billNo, string.Format("{0}号加班申请单,请分管领导审核", m_billNo),
                                                        BillFlowMessage_ReceivedUserType.角色, m_billMessageServer.GetDeptLeaderRoleName(
                                                            m_personnerServer.GetPersonnelViewInfo(txtApplicant.Tag.ToString()).部门编号).ToList());
                }
            }

            this.Close();
        }
        private void 完成情况toolStripButton_Click(object sender, EventArgs e)
        {
            if (lblStatus.Text.Trim() == OverTimeBillStatus.确认加班完成情况.ToString())
            {
                if (BasicInfo.LoginID != txtApplicant.Tag.ToString())
                {
                    IQueryable <View_HR_PersonnelArchive> directorGroup = m_personnerServer.GetDeptDirector(
                        m_personnerServer.GetPersonnelInfo(txtApplicant.Tag.ToString()).Dept, "0");
                    IQueryable <View_HR_PersonnelArchive> directorGroup1 = m_personnerServer.GetDeptDirector(
                        m_personnerServer.GetPersonnelInfo(txtApplicant.Tag.ToString()).Dept, "1");
                    IQueryable <View_HR_PersonnelArchive> directorGroup2 = m_personnerServer.GetDeptDirector(
                        m_personnerServer.GetPersonnelInfo(txtApplicant.Tag.ToString()).Dept, "2");
                    bool flag = false;

                    if (directorGroup != null && directorGroup.Count() > 0)
                    {
                        foreach (var item in directorGroup)
                        {
                            if (BasicInfo.LoginID == item.员工编号)
                            {
                                flag = true;
                                break;
                            }
                        }
                    }

                    if (directorGroup1 != null && directorGroup1.Count() > 0)
                    {
                        foreach (var item in directorGroup1)
                        {
                            if (BasicInfo.LoginID == item.员工编号)
                            {
                                flag = true;
                                break;
                            }
                        }
                    }

                    if (directorGroup2 != null && directorGroup2.Count() > 0)
                    {
                        foreach (var item in directorGroup2)
                        {
                            if (BasicInfo.LoginID == item.员工编号)
                            {
                                flag = true;
                                break;
                            }
                        }
                    }

                    if (flag)
                    {
                        if (!cbVerify.Checked)
                        {
                            if (MessageBox.Show("您是否确定【" + txtApplicant.Text + "】的加班完成?", "消息",
                                                MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                            {
                                cbAuthorize.Checked = true;
                            }
                        }

                        HR_OvertimeBill overTime = new HR_OvertimeBill();

                        overTime.ID                 = Convert.ToInt32(m_billNo);
                        overTime.VerifyFinish       = cbVerify.Checked;
                        overTime.Verifier           = BasicInfo.LoginID;
                        overTime.VerifyHours        = numVerifyHours.Value;
                        overTime.VerifySignaturDate = ServerTime.Time;
                        overTime.BillStatus         = OverTimeBillStatus.已完成.ToString();

                        if (!m_overTimeServer.UpdateOverTimeBill(overTime, "确认加班完成情况", out error))
                        {
                            MessageDialog.ShowPromptMessage(error);
                            return;
                        }

                        string        msg        = string.Format("{0} 号加班单确认加班完成情况成功", m_billNo);
                        List <string> noticeUser = new List <string>();

                        noticeUser.Add(txtApplicant.Tag.ToString());

                        m_billMessageServer.EndFlowMessage(m_billNo, string.Format("{0} 号加班申请已经处理完毕", m_billNo), null, noticeUser);

                        MessageDialog.ShowPromptMessage("确认加班完成情况成功!");
                        this.Close();
                    }
                    else
                    {
                        MessageDialog.ShowPromptMessage("只有部门主管、负责人、分管领导才可以对单据进行确认!");
                        return;
                    }
                }
                else
                {
                    MessageDialog.ShowPromptMessage("只有部门主管、负责人、分管领导才可以对单据进行确认!");
                    return;
                }
            }
            else
            {
                MessageDialog.ShowPromptMessage("请确认单据状态!");
            }

            this.Close();
        }
        private void 分管领导审批toolStripButton2_Click(object sender, EventArgs e)
        {
            if (lblStatus.Text.Trim() == OverTimeBillStatus.等待分管领导审批.ToString())
            {
                HR_OvertimeBill overTime = new HR_OvertimeBill();

                overTime.ID     = Convert.ToInt32(m_billNo);
                overTime.Leader = BasicInfo.LoginID;
                overTime.LeaderSignatureDate = ServerTime.Time;
                overTime.RealHours           = Convert.ToDouble(numHours.Value);

                if (!cbAuthorize.Checked)
                {
                    if (MessageBox.Show("您是否同意【" + txtApplicant.Text + "】的加班申请?", "消息",
                                        MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        cbAuthorize.Checked = true;
                    }
                }

                overTime.Authorize  = cbAuthorize.Checked;
                overTime.BillStatus = OverTimeBillStatus.已完成.ToString();

                if (!m_overTimeServer.UpdateOverTimeBill(overTime, "分管领导审批", out error))
                {
                    MessageDialog.ShowPromptMessage(error);
                    return;
                }

                if (overTime.BillStatus == OverTimeBillStatus.已完成.ToString())
                {
                    if (!cbAuthorize.Checked)
                    {
                        string        msg        = string.Format("{0} 号加班申请已经处理完毕,分管领导审批未批准", m_billNo);
                        List <string> noticeUser = new List <string>();

                        noticeUser.Add(txtApplicant.Tag.ToString());

                        m_billMessageServer.EndFlowMessage(m_billNo, msg, null, noticeUser);

                        MessageDialog.ShowPromptMessage("加班申请已经处理完毕,审批未批准!");
                    }
                    else
                    {
                        string        msg        = string.Format("{0} 号加班申请单已经处理完毕", m_billNo);
                        List <string> noticeUser = new List <string>();
                        noticeUser.Add(txtApplicant.Tag.ToString());

                        m_billMessageServer.EndFlowMessage(m_billNo, msg, null, noticeUser);

                        MessageDialog.ShowPromptMessage("加班申请单已经处理完毕!");
                        this.Close();
                    }
                }
                else
                {
                    string msg = string.Format("{0} 号加班单分管领导人审批成功,等待确认加班完成情况", m_billNo);
                    m_billMessageServer.PassFlowMessage(m_billNo, msg, BillFlowMessage_ReceivedUserType.用户, BasicInfo.LoginID);

                    MessageDialog.ShowPromptMessage("分管领导人审批成功!");
                }

                this.Close();
            }
            else
            {
                MessageDialog.ShowPromptMessage("请确认单据状态!");
            }
        }