コード例 #1
0
        private void btn修改_Click(object sender, EventArgs e)
        {
            if (trainee.入职时间.Year == DateTime.Today.Year)
            {
                MessageBox.Show("错误:新入职的定职人员不能手工录入");
                return;
            }

            ManagementTraineePayRiseStandard standard = ManagementTraineePayRiseStandard.GetManagementTraineePayRiseStandard(trainee.届别, trainee.岗位级别, type, "A", 1);

            if (standard == null)
            {
                MessageBox.Show("错误:请录入提幅标准表后再试(入职半年内自动根据标准提资)");
                return;
            }
            ManagementTraineePayStandard prevStandard = ManagementTraineePayStandard.GetLatestBeforeOneday(trainee.员工编号, new DateTime(DateTime.Today.Year, 7, 1));

            if (prevStandard == null)
            {
                MessageBox.Show("错误:找不到上期年薪");
                return;
            }

            SelectInputTypeDialog stt_dialog = new SelectInputTypeDialog();

            if (stt_dialog.ShowDialog() == DialogResult.OK)
            {
                bool isCheck = stt_dialog.是验证录入;

                TraineeSalaryStandardInputForm form = new TraineeSalaryStandardInputForm(trainee, isCheck);
                form.Owner = this;
                form.ShowDialog();
            }
        }
コード例 #2
0
        protected void LoadData()
        {
            CreateWaitDialog("正在查询...", "请稍等");

            plan_list_a = ManagementTraineeSalaryPlan.GeneratePlanList(division, grade, type, "A");
            plan_list_b = ManagementTraineeSalaryPlan.GeneratePlanList(division, grade, type, "B");
            plan_list_c = ManagementTraineeSalaryPlan.GeneratePlanList(division, grade, type, "C");

            string years = "五";

            if (plan_list_a.Count == 24)
            {
                years = "六";
            }
            if (plan_list_a.Count == 28)
            {
                years = "七";
            }

            UpStepType ust = ManagementTraineePayStandard.GetUpStepType(division, grade, type);
            string     p   = "";

            switch (ust)
            {
            case UpStepType.五年两段三类:
                p = "52"; break;

            case UpStepType.五年两段四类:
                p = "51"; break;

            case UpStepType.五年三段四类:
                p = "53"; break;

            case UpStepType.七年两段五类:
                p = "71"; break;

            case UpStepType.七年三段五类:
                p = "72"; break;
            }

            lbl标题.Text = division + " 届定职人员(" + grade + ")【" + type + "】" + years + "年薪酬计划表";
            //加载模板
            string filename = Path.Combine(Application.StartupPath, "ReportTemplates\\" + p + "YearSalaryPlan.tab");

            spreadsheetControl1.LoadDocument(filename);

            sheet   = spreadsheetControl1.ActiveWorksheet;
            columns = sheet.Columns;
            rows    = sheet.Rows;
            cells   = sheet.Cells;

            SetWaitDialogCaption("正在加载数据...");

            FillTable();

            sheet.ScrollToColumn(0);//焦点切回开始位置

            CloseWaitDialog();
        }
コード例 #3
0
        public TraineeSalaryStandardInputForm(ManagementTraineeInfo trainee, bool isCheck)
            : this()
        {
            this.trainee = trainee;
            this.isCheck = isCheck;

            prevStandard = ManagementTraineePayStandard.GetLatestBeforeOneday(trainee.员工编号, new DateTime(year, 7, 1));

            if (prevStandard == null)
            {
                MessageBox.Show("错误:找不到上期年薪");
                this.Close();
            }
        }
コード例 #4
0
        protected void LoadData()
        {
            CreateWaitDialog("正在查询...", "请稍等");

            salary_standard_items = ManagementTraineePayStandard.GetManagementTraineePayStandards(trainee.员工编号);

            division = trainee.届别;
            grade    = trainee.岗位级别;
            type     = trainee.岗位级别 == "一级" ? trainee.岗位类型 : trainee.专业属性;

            lbl姓名.Text = "姓名:" + trainee.姓名;
            lbl届别.Text = "届别:" + trainee.届别;
            lbl类别.Text = trainee.岗位级别 == "一级" ? "岗位类型:" + type : "专业属性:" + type;

            UpStepType ust = ManagementTraineePayStandard.GetUpStepType(division, grade, type);

            switch (ust)
            {
            case UpStepType.五年两段三类:
            case UpStepType.五年两段四类:
                year_count = 5; break;

            case UpStepType.五年三段四类:
                year_count = 6; break;

            case UpStepType.七年两段五类:
            case UpStepType.七年三段五类:
                year_count = 7; break;
            }

            lbl标题.Text = "定职人员(" + grade + ")【" + type + "】" + trainee.姓名 + "个人年度评定结果及提资表";
            //加载模板
            string filename = Path.Combine(Application.StartupPath, "ReportTemplates\\" + year_count + "-YearSalaryList.tab");

            spreadsheetControl1.LoadDocument(filename);

            sheet   = spreadsheetControl1.ActiveWorksheet;
            columns = sheet.Columns;
            rows    = sheet.Rows;
            cells   = sheet.Cells;

            SetWaitDialogCaption("正在加载数据...");

            FillTable();

            sheet.ScrollToColumn(0); //焦点切回开始位置

            CloseWaitDialog();
        }
コード例 #5
0
        private void ShowRiseRateInputForm(bool isCheck)
        {
            UpStepType ust = ManagementTraineePayStandard.GetUpStepType(division, grade, type);

            switch (ust)
            {
            case UpStepType.五年两段三类:
                RiseRate52InputForm riseRate52InputForm = new RiseRate52InputForm(division, grade, type, isCheck);
                riseRate52InputForm.Owner = this;
                riseRate52InputForm.ShowDialog();
                break;

            case UpStepType.五年两段四类:
                RiseRate51InputForm riseRate51InputForm = new RiseRate51InputForm(division, grade, type, isCheck);
                riseRate51InputForm.Owner = this;
                riseRate51InputForm.ShowDialog();
                break;

            case UpStepType.五年三段四类:
                RiseRate53InputForm riseRate62InputForm = new RiseRate53InputForm(division, grade, type, isCheck);
                riseRate62InputForm.Owner = this;
                riseRate62InputForm.ShowDialog();
                break;

            case UpStepType.七年两段五类:
                RiseRate71InputForm riseRate71InputForm = new RiseRate71InputForm(division, grade, type, isCheck);
                riseRate71InputForm.Owner = this;
                riseRate71InputForm.ShowDialog();
                break;

            case UpStepType.七年三段五类:
                RiseRate72InputForm riseRate72InputForm = new RiseRate72InputForm(division, grade, type, isCheck);
                riseRate72InputForm.Owner = this;
                riseRate72InputForm.ShowDialog();
                break;
            }
        }
コード例 #6
0
        List <ManagementTraineePayStandardInput> CreateEditingRows()
        {
            List <ManagementTraineePayStandardInput> list = new List <ManagementTraineePayStandardInput>();

            int 提资序数 = prevStandard.提资序数 + 1;
            ManagementTraineePayStandard first = ManagementTraineePayStandard.CreateFirstStandard(trainee.员工编号);

            for (int i = 0; i < 4; i++)
            {
                int      年度   = i >= 2 ? year + 1 : year;
                DateTime 年度开始 = new DateTime(年度, 1, 1);
                int      季度   = (i + 2) % 4 + 1;

                int m = 年度 - first.年份;
                int n = 季度 - first.季度;
                int q = m * 4 + n; //距离起薪季度数

                string type = trainee.岗位级别 == "一级" ? trainee.岗位类型 : trainee.专业属性;
                //升阶(满足升阶条件,先升阶,每阶+100, 满阶是 10000)
                double step = ManagementTraineePayStandard.GetStep(trainee.届别, trainee.岗位级别, type, q);
                if (step == 0)
                {
                    提资序数 = 10000;
                }
                if (step == 2)
                {
                    提资序数 = 100;
                }

                ManagementTraineePayStandardInput item = ManagementTraineePayStandardInput.AddManagementTraineePayStandardInput(trainee.员工编号, 年度, 季度, i + 1, 提资序数, isCheck);
                list.Add(item);

                提资序数++;
            }

            return(list);
        }
コード例 #7
0
        private void FillTable()
        {
            if (salary_standard_items == null || salary_standard_items.Count == 0)
            {
                return;
            }
            //最后一次评定
            ManagementTraineeAbility last_ability = ManagementTraineeAbility.GetLastAbility(trainee.员工编号);

            //倒序,从大到小找
            salary_standard_items = salary_standard_items.OrderByDescending(a => a.开始执行时间).ToList();
            int      第一年        = Convert.ToInt32(trainee.届别);
            DateTime start_date = new DateTime(第一年, 7, 1);

            decimal year_salary = 0;

            for (int i = 0; i <= year_count * 4; i++) //注:多算一次,否则得不到年薪
            {
                int offset = i / 4;

                if (i >= year_count * 4)
                {
                    break;
                }
                if (last_ability == null && i >= 4)
                {
                    break;
                }

                //填第三行,年度
                cells[2, 2 + i + offset].Value = start_date.Year;

                ManagementTraineePayStandard standard = salary_standard_items.Find(a => a.开始执行时间 <= start_date);
                if (standard == null)
                {
                    break;
                }

                cells[5, 2 + i + offset].Value = standard.年薪.ToString("#0.##");
                year_salary += standard.年薪;

                if (standard.开始执行时间 == start_date && standard.增幅 > 0)
                {
                    cells[6, 2 + i + offset].Value = standard.增幅.ToString("#0.##") + "%";
                }

                //下一个开始时间
                start_date = start_date.AddMonths(3);

                //统计年薪
                if (i % 4 == 3)
                {
                    //获取年度评定
                    ManagementTraineeAbility ability = ManagementTraineeAbility.GetManagementTraineeAbility(trainee.员工编号, start_date.Year);
                    if (ability != null && i < (year_count - 1) * 4) //最后一年不需要填入评审结果
                    {
                        //退一格
                        cells[4, 2 + i + offset + 1].Value = ability.能力级别;
                    }
                    //计算上一年的年薪
                    cells[4, 2 + i + offset - 3].Value = (year_salary / (decimal)4.0).ToString("#0.##");
                    year_salary = 0;
                }
                //超过最后一次评定12个月
                if (last_ability != null)
                {
                    int m = start_date.Year - last_ability.年度;
                    int n = start_date.Month - 6;
                    if (m * 12 + n > 12)
                    {
                        break;
                    }
                }
            }
        }
コード例 #8
0
        private void btn保存提交_Click(object sender, EventArgs e)
        {
            bool isSameEditor = false;

            CreateWaitDialog("正在准备保存...", "请稍等");
            try
            {
                //检查是否所有职等都录入完成
                foreach (ManagementTraineeAbilityInput ta in trainee_ability_list)
                {
                    if (string.IsNullOrEmpty(ta.能力级别))
                    {
                        MessageBox.Show("错误:能力级别不能为空");
                        return;
                    }
                }

                int order = 1;
                foreach (ManagementTraineeAbilityInput item in trainee_ability_list)
                {
                    if (item.另一人录入的记录 != null)
                    {
                        string editor          = AccessController.CurrentUser.姓名;
                        string editor_opposite = item.另一人录入的记录.录入人.Trim();
                        if (editor == editor_opposite && editor_opposite != "")
                        {
                            isSameEditor = true;
                            break;
                        }
                    }
                    item.序号   = order++;
                    item.录入人  = AccessController.CurrentUser.姓名;
                    item.录入时间 = DateTime.Now;
                    item.Save();
                }

                if (isSameEditor)
                {
                    CloseWaitDialog();

                    MessageBox.Show("提交失败:两次录入不能是同一个人");
                    return;
                }

                foreach (ManagementTraineeAbilityInput item in trainee_ability_list)
                {
                    //手动比较录入的内容
                    item.CompareInputContent();
                }

                SetWaitDialogCaption("正在比较双人录入是否一致...");

                LoadData(true);
                //检查差异
                bool all_same = true;
                foreach (ManagementTraineeAbilityInput ms in trainee_ability_list)
                {
                    if (!ms.另一人已录入 || ms.内容不同的字段.Count > 0)
                    {
                        all_same = false;
                        break;
                    }
                }
                if (all_same)
                {
                    //转成正式
                    foreach (ManagementTraineeAbilityInput ms in trainee_ability_list)
                    {
                        ms.UpdateToFormalTable();
                        //生成员工提资标准
                        ManagementTraineePayStandard.CreatePayStandards(ms.员工编号, ms.年度);
                    }
                    MessageBox.Show("双人录入成功");
                }
                else
                {
                    //显示差异
                    gridControl1.DataSource = trainee_ability_list;
                    gridControl1.Refresh();
                    MessageBox.Show("提交失败:红色项目不一致,请重新核对修改");
                }
                gridControl1.Focus();
                this.Refresh();
            }
            catch (Exception err)
            {
                MessageBox.Show(err.Message);
            }
            finally
            {
                CloseWaitDialog();
            }
        }
コード例 #9
0
        private void btn保存提交_Click(object sender, EventArgs e)
        {
            bool isSameEditor = false;

            CreateWaitDialog("正在准备保存...", "请稍等");
            try
            {
                //检查是否所有职等都录入完成
                foreach (ManagementTraineeInfoInput ms in trainee_info_list)
                {
                    if (ms.年薪 == 0)
                    {
                        MessageBox.Show("温馨提醒:发现有年薪为 0 的人员,请仔细检查确认");
                        break;
                    }
                }
                //重新排序
                trainee_info_list = trainee_info_list.OrderBy(a => a.序号).ThenByDescending(a => a.年薪).ThenBy(a => a.入职时间).ToList();


                int order = 1;
                foreach (ManagementTraineeInfoInput item in trainee_info_list)
                {
                    if (item.另一人录入的记录 != null)
                    {
                        string editor          = AccessController.CurrentUser.姓名;
                        string editor_opposite = item.另一人录入的记录.录入人.Trim();
                        if (editor == editor_opposite && editor_opposite != "")
                        {
                            isSameEditor = true;
                            break;
                        }
                    }
                    item.序号   = order++;
                    item.录入人  = AccessController.CurrentUser.姓名;
                    item.录入时间 = DateTime.Now;
                    item.Save();
                }

                if (isSameEditor)
                {
                    CloseWaitDialog();

                    MessageBox.Show("提交失败:两次录入不能是同一个人");
                    return;
                }

                foreach (ManagementTraineeInfoInput item in trainee_info_list)
                {
                    //手动比较录入的内容
                    item.CompareInputContent();
                }

                SetWaitDialogCaption("正在比较双人录入是否一致...");

                LoadData(true);
                //检查差异
                bool all_same = true;
                foreach (ManagementTraineeInfoInput ms in trainee_info_list)
                {
                    if (!ms.另一人已录入 || ms.内容不同的字段.Count > 0)
                    {
                        all_same = false;
                        break;
                    }
                }
                if (all_same)
                {
                    trainee_info_list = trainee_info_list.OrderBy(a => a.序号).ThenByDescending(a => a.年薪).ThenBy(a => a.入职时间).ToList();
                    //转成正式
                    foreach (ManagementTraineeInfoInput ms in trainee_info_list)
                    {
                        ms.UpdateToFormalTable();
                        //生成员工第一年的提资标准
                        ManagementTraineePayStandard.CreatePayStandards(ms.员工编号, Convert.ToInt32(ms.届别));
                    }
                    MessageBox.Show("双人录入成功");
                }
                else
                {
                    //显示差异
                    gridControl1.DataSource = trainee_info_list;
                    gridControl1.Refresh();
                    MessageBox.Show("提交失败:红色项目不一致,请重新核对修改");
                }
                gridControl1.Focus();
                this.Refresh();
            }
            catch (Exception err)
            {
                MessageBox.Show(err.Message);
            }
            finally
            {
                CloseWaitDialog();
            }
        }