public FormDimissionList(AuthorityFlag authFlag)
        {
            InitializeComponent();

            m_billMessageServer.BillType = "员工离职申请单";
            AuthorityControl(authFlag);

            txtApplicant.Text  = BasicInfo.LoginName;
            txtApplicant.Tag   = BasicInfo.LoginID;
            txtDept.Text       = BasicInfo.DeptName;
            txtDept.Tag        = BasicInfo.DeptCode;
            txtWorkPost.Text   = m_personnerServer.GetPersonnelArchiveByNameAndCode(BasicInfo.LoginName, BasicInfo.LoginID);
            dtpDate.Value      = ServerTime.Time;
            lblStatus.Text     = DimissionBillStatus.新建单据.ToString();
            menuStrip1.Visible = true;

            DataTable dt = m_personnerServer.GetHighestDept(txtApplicant.Tag.ToString());

            if (dt != null && dt.Rows.Count > 0)
            {
                m_highDept = dt.Rows[0]["deptCode"].ToString();
            }
        }
Пример #2
0
        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="authorityFlag">权限标志</param>
        /// <param name="billNo">排班单据号,如果为0,则表示为新建方式</param>
        public FormWorkSchedule(AuthorityFlag authorityFlag, int billNo)
        {
            InitializeComponent();

            m_billMessageServer.BillType = "排班管理";

            m_billNo   = billNo;
            m_authFlag = authorityFlag;

            this.dataGridView1.EditMode = DataGridViewEditMode.EditOnEnter;

            toolStrip1.Visible = true;

            if (m_billNo == 0)
            {
                DateTime time = ServerTime.Time;

                dtpBegin.Value = time;
                dtpEnd.Value   = time;
                numYear.Value  = time.Year;
                numMonth.Value = time.Month;

                ClearControl();
            }
            else
            {
                m_workSchedulingInfo = m_workSchedulingServer.GetWorkSchedulingByBillNo(m_billNo);

                m_workSchedulingDetail = m_workSchedulingServer.GetWorkSchedulingDetail(m_billNo, out m_numberOfPeople);

                InitDataGridView(m_workSchedulingInfo.排班起始时间, m_workSchedulingInfo.排班结束时间);

                txtBillNo.Text        = m_billNo.ToString();
                txtCreaterWorkID.Text = m_workSchedulingInfo.排班人;
                txtCreaterWorkID.Tag  = m_workSchedulingInfo.员工编号;
                txtDeptDirector.Text  = m_workSchedulingInfo.部门主管;
                txtDeptPrincipal.Text = m_workSchedulingInfo.部门负责人;
                txtRemark.Text        = m_workSchedulingInfo.备注;
                txtStatus.Text        = m_workSchedulingInfo.单据状态;

                dtpBegin.Value = m_workSchedulingInfo.排班起始时间;
                dtpEnd.Value   = m_workSchedulingInfo.排班结束时间;

                if (m_workSchedulingInfo.已审核日期.ToString() != "")
                {
                    dtpCompletion.Value = Convert.ToDateTime(m_workSchedulingInfo.已审核日期);
                }

                if (m_workSchedulingInfo.主管签定时间.ToString() != "")
                {
                    dtpDeptDirectorDate.Value = Convert.ToDateTime(m_workSchedulingInfo.主管签定时间);
                }

                if (m_workSchedulingInfo.负责人签定时间.ToString() != "")
                {
                    dtpDeptPrincipalDate.Value = Convert.ToDateTime(m_workSchedulingInfo.负责人签定时间);
                }

                dtpCreateDate.Value       = m_workSchedulingInfo.排班时间;
                dtpEnd.Value              = m_workSchedulingInfo.排班结束时间;
                dateTimePendingDate.Value = m_workSchedulingInfo.待审核日期;
                txtScheduleName.Text      = m_workSchedulingInfo.排班名称;

                numYear.Value  = m_workSchedulingInfo.排班年份;
                numMonth.Value = m_workSchedulingInfo.排班月份;

                if (dateTimePendingDate.Value > dtpCompletion.Value)
                {
                    dateTimePendingDate.Enabled = false;
                }
            }

            DataTable dt = m_personnerServer.GetHighestDept(txtCreaterWorkID.Tag.ToString());

            if (dt != null && dt.Rows.Count > 0)
            {
                m_highDept = dt.Rows[0]["deptCode"].ToString();
            }
        }
        public FormOverTimeList(AuthorityFlag authFlag, int billID)
        {
            InitializeComponent();

            IQueryable <HR_AttendanceScheme> dtScheme = m_attendanceSchemeServer.GetLinqResult();

            string punchInMorning = dtScheme.Take(1).Single().BeginTimeInTheMorning.Value.Hour.ToString() +
                                    ":" + dtScheme.Take(1).Single().BeginTimeInTheMorning.Value.Minute.ToString();

            string punchInMorningEnd = dtScheme.Take(1).Single().EndTimeInTheMorning.Value.Hour.ToString() +
                                       ":" + dtScheme.Take(1).Single().EndTimeInTheMorning.Value.Minute.ToString();

            string punchInAfternoonEnd = dtScheme.Take(1).Single().EndTimeInTheAfternoon.Value.Hour.ToString() +
                                         ":" + dtScheme.Take(1).Single().EndTimeInTheAfternoon.Value.Minute.ToString();

            string punchInAfternoon = dtScheme.Take(1).Single().BeginTimeInTheAfternoon.Value.Hour.ToString() +
                                      ":" + dtScheme.Take(1).Single().BeginTimeInTheAfternoon.Value.Minute.ToString();

            double restHours = (Convert.ToDateTime(punchInAfternoon) - Convert.ToDateTime(punchInMorningEnd)).Hours;

            restHours += Convert.ToDouble((Convert.ToDateTime(punchInAfternoon) - Convert.ToDateTime(punchInMorningEnd)).Minutes) / 60;

            m_punchInMorning      = punchInMorning;
            m_punchInMorningEnd   = punchInMorningEnd;
            m_punchInAfternoonEnd = punchInAfternoonEnd;
            m_punchInAfternoon    = punchInAfternoon;
            m_restHours           = restHours;

            m_billMessageServer.BillType = "加班申请单";

            m_authorityFlag = authFlag;

            if (billID != 0)
            {
                m_billNo = billID.ToString();

                BindControl(m_billNo);
            }
            else
            {
                txtApplicant.Text      = BasicInfo.LoginName;
                txtApplicant.Tag       = BasicInfo.LoginID;
                lblStatus.Text         = OverTimeBillStatus.新建单据.ToString();
                cbAuthorize.Visible    = false;
                cbVerify.Visible       = false;
                numVerifyHours.Visible = false;
                lblVerifyHours.Visible = false;

                DateTime time = ServerTime.Time;

                if (!m_overTimeServer.IsChooseDoubleRest(UniversalFunction.GetPersonnelInfo(txtApplicant.Tag.ToString()).职位编码.ToString(), "", ""))
                {
                    if (Convert.ToDateTime(dtpEndTime.Value.ToShortTimeString()) > Convert.ToDateTime(m_punchInAfternoonEnd))
                    {
                        if ((dtpEndTime.Value.Month > 9 || dtpEndTime.Value.Month < 5))
                        {
                            dtpBeginTime.Value = Convert.ToDateTime(dtpBeginTime.Value.ToShortDateString() + " " + "17:30:00");
                        }
                        else if (dtpEndTime.Value.Month >= 5)
                        {
                            dtpBeginTime.Value = Convert.ToDateTime(dtpBeginTime.Value.ToShortDateString() + " " + "18:30:00");
                        }
                    }
                }

                dtpDate.Value = time;
            }

            DataTable dt = m_personnerServer.GetHighestDept(txtApplicant.Tag.ToString());

            if (dt != null && dt.Rows.Count > 0)
            {
                m_highDept = dt.Rows[0]["deptCode"].ToString();
            }

            人力toolStripButton.Visible   = false;
            toolStripSeparator4.Visible = false;

            dtpBeginTime.ValueChanged += new EventHandler(DateTimePick_ValueChanged);
            dtpEndTime.ValueChanged   += new EventHandler(DateTimePick_ValueChanged);
        }