Beispiel #1
0
        private void btn重新同步_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("重新同步后需重新审核,确实重新同步吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2, 0, false) == DialogResult.Yes)
            {
                Thread.Sleep(200);

                CreateWaitDialog("正在同步...", "请耐心等待");
                //删除历史数据
                SalaryAuditingResult.ClearAuditingResult((string)cbb日历组.EditValue, (string)ccb薪资组.EditValue);
                //删除工资表
                PrivateSalary.ClearPrivateSalary((string)cbb日历组.EditValue, (string)ccb薪资组.EditValue);
                //清除旧的抽查记录
                PayCheckRecord.ClearPayCheckRecord((string)cbb日历组.EditValue, (string)ccb薪资组.EditValue);
                //同步基础工资
                StringBuilder sb = SalaryResult.SychSalaryResult((string)cbb日历组.EditValue, (string)ccb薪资组.EditValue);
                //同步工资明细
                StringBuilder sbItem = SalaryResultItem.SychSalaryResultItem((string)cbb日历组.EditValue, (string)ccb薪资组.EditValue);
                sb.Append(sbItem.ToString());

                CloseWaitDialog();

                MyHelper.WriteLog(LogType.信息, "重新同步上表工资", String.Format("日历组:{0}, {1}   薪资组: {2}, {3}", (string)cbb日历组.EditValue, cbb日历组.Text, (string)ccb薪资组.EditValue, ccb薪资组.Text));

                string msg = sb.ToString();
                if (string.IsNullOrEmpty(msg))
                {
                    LoadData(true);
                }
                else
                {
                    MessageBox.Show(msg);
                }
            }
            SetButtonEnabled();
        }
        protected void LoadData(bool onlyPayGroup)
        {
            currRows.Clear();

            CreateWaitDialog("正在查询...", "请稍等");
            //清除原来的数据
            List <PrivateSalary> rows = PrivateSalary.GetPrivateSalarys(null, (string)cbb日历组.EditValue);

            foreach (PrivateSalary row in rows)
            {
                if (myPayGroupList.Find(a => a.英文名 == row.薪资组.Trim()) != null)
                {
                    currRows.Add(row);
                }
            }
            if (onlyPayGroup)
            {
                currRows = currRows.FindAll(a => a.薪资组 == (string)cb薪资组.EditValue);
                SetButtonEnabled();
            }
            //排序
            currRows = currRows.OrderBy(a => a.基础工资表.财务公司).ThenBy(a => a.基础工资表.财务部门序号).ThenBy(a => a.基础工资表.员工序号).ToList();

            CreateWaitDialog("正在加载...", "请稍等");

            gridControl1.DataSource = currRows;
            gridControl1.RefreshDataSource();

            CloseWaitDialog();

            SetButtonEnabled();

            gridView1.ExpandAllGroups();
        }
 private void bandedGridView1_CustomColumnDisplayText(object sender, CustomColumnDisplayTextEventArgs e)
 {
     if (e.Column.Name == "财务部门")
     {
         PrivateSalary item = bandedGridView1.GetRow(e.ListSourceRowIndex) as PrivateSalary;
         e.DisplayText = item.基础工资表.财务部门;
     }
 }
        private void bandedGridView1_RowCellClick(object sender, DevExpress.XtraGrid.Views.Grid.RowCellClickEventArgs e)
        {
            PrivateSalary item = bandedGridView1.GetRow(bandedGridView1.FocusedRowHandle) as PrivateSalary;

            if (item != null && item.职级工资减项 > 0 && e.Column.FieldName == "职级工资减项")
            {
                SalaryDecuctionInfoForm form = new SalaryDecuctionInfoForm(item);
                form.Show();
            }
        }
Beispiel #5
0
        private void btn生成工资表_Click(object sender, EventArgs e)
        {
            SalaryAuditingResult checkInfo = SalaryAuditingResult.GetSalaryAuditingResult((string)ccb薪资组.EditValue, (string)cbb日历组.EditValue);

            if (checkInfo != null && checkInfo.表工资已审核)
            {
                CreateWaitDialog("正在生成工资表...", "请稍等");

                //清空已有的工资表
                PrivateSalary.ClearPrivateSalary(checkInfo.日历组, checkInfo.薪资组);

                PayCounter payCounter = new PayCounter(checkInfo);
                //如果计算成功
                bool successed = payCounter.Calculate();

#if (DEBUG)
                //为了方便测试,在普通网使用不控制
                if (MyHelper.GetLocalIp()[0].StartsWith("192.168."))
                {
                    successed = true;
                    //保存计算时间
                    payCounter.审核情况表.工资计算时间 = DateTime.Now;
                    payCounter.审核情况表.制表人    = AccessController.CurrentUser.姓名;
                    payCounter.审核情况表.制表时间   = DateTime.Now;
                    payCounter.审核情况表.Save();
                    payCounter.审核情况表.UnLock();
                }
#endif

                if (successed)
                {
                    //保存工资表
                    foreach (SalaryCalculator cal in payCounter.员工工资计算器列表)
                    {
                        cal.Save();
                    }
                    SetWaitDialogCaption("正在加载数据...");
                    LoadData(true);
                    CloseWaitDialog();
                    MyHelper.WriteLog(LogType.信息, "生成工资表", checkInfo.ToString <SalaryAuditingResult>());
                }
                else
                {
                    CloseWaitDialog();
                    MessageBox.Show("生成工资表失败,详细原因点击确定后显示", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    //显示错误列表
                    ErrorDialog form = new ErrorDialog(payCounter.错误列表);
                    form.ShowDialog();
                }
            }
            else
            {
                MessageBox.Show("生成工资表失败:基础工资表未审核。", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Beispiel #6
0
        public void Error(string errMsg)
        {
            //删除工资
            PrivateSalary.ClearPrivateSalary(日历组, 薪资组);
            //删除计算时间
            SalaryAuditingResult 审核情况表 = this.工资计算器.审核情况表;

            审核情况表.工资计算时间 = DateTime.MinValue;
            审核情况表.Save();

            throw new Exception(errMsg);
        }
        protected void LoadData()
        {
            string accType  = cb账户类型.EditValue as string;
            string calRunId = cbb日历组.EditValue as string;

            CreateWaitDialog("正在查询...", "请稍等");

            List <PrivateSalary> rows = new List <PrivateSalary>();

            string errMsg = "";

            foreach (PayGroup payGroup in myPayGroupList)
            {
                SalaryAuditingResult checkInfo = SalaryAuditingResult.GetSalaryAuditingResult(payGroup.英文名, calRunId);
                if (checkInfo != null)
                {
                    if (checkInfo.已审核)
                    {
                        rows.AddRange(PrivateSalary.GetPrivateSalarys(payGroup.英文名, calRunId));
                        continue;
                    }
                    else
                    {
                        errMsg = String.Format("薪资组【{0}】的工资表未审核\n", payGroup.中文名);
                    }
                }
            }

            if (errMsg != "")
            {
                CloseWaitDialog();
                MessageBox.Show(errMsg, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            //生成报盘记录
            currRows = rows;
            //排序
            currRows = currRows.OrderBy(a => a.基础工资表.财务公司).ThenBy(a => a.基础工资表.财务部门序号).ThenBy(a => a.基础工资表.员工序号).ToList();

            CreateWaitDialog("正在加载...", "请稍等");

            pivotGridControl1.DataSource = currRows;

            CloseWaitDialog();

            CalRunInfo cal = CalRunInfo.Get(calRunId);

            当前期间 = String.Format("{0}年{1}", cal.年度, cal.月份) + "月";
            当前账号 = cb账户类型.Text;
        }
Beispiel #8
0
        //产生抽查记录
        private void GenerateCheckRecords()
        {
            int 最少抽查数 = (int)(员工工资计算器列表.Count * 0.1 + 0.9);
            var 薪等集合  = from p in 员工工资计算器列表
                        group p by p.评定职等 into g
                        select g;

            List <PrivateSalary> 候选的记录 = GetWaiting();
            List <PrivateSalary> 抽中的记录 = new List <PrivateSalary>();

            //每个薪资组选择一条记录
            foreach (var grade in 薪等集合)
            {
                List <PrivateSalary> items = 候选的记录.FindAll(a => a.评定职等 == grade.Key);
                if (items.Count > 0)
                {
                    Random        rdm          = new Random(unchecked ((int)DateTime.Now.Ticks));
                    int           x            = (int)rdm.Next(0, items.Count);
                    PrivateSalary selectedItem = items[x];
                    抽中的记录.Add(selectedItem);
                    //把选择的记录从候选表删除
                    候选的记录.Remove(selectedItem);
                }
            }
            //如果小于最少抽查数,继续抽查
            while (抽中的记录.Count < 最少抽查数 && 候选的记录.Count > 0)
            {
                Random        rdm          = new Random(unchecked ((int)DateTime.Now.Ticks));
                int           x            = (int)rdm.Next(0, 候选的记录.Count);
                PrivateSalary selectedItem = 候选的记录[x];
                抽中的记录.Add(selectedItem);
                //把选择的记录从候选表删除
                候选的记录.Remove(selectedItem);
            }
            //清除旧的抽查记录
            PayCheckRecord.ClearPayCheckRecord(日历组, 薪资组);
            //保存选中的记录
            foreach (PrivateSalary item in 抽中的记录)
            {
                PayCheckRecord rec = PayCheckRecord.AddPayCheckRecord(item.标识);
                rec.抽取时间 = DateTime.Now;
                rec.薪资组  = item.薪资组;
                rec.日历组  = item.日历组;
                rec.Save();
            }
        }
        public SalaryDecuctionInfoForm(PrivateSalary ps)
        {
            InitializeComponent();
            this.ps = ps;

            textEdit契约津贴标准.Text     = ps.契约津贴标准.ToString("#0.00");
            textEdit工资借款标准.Text     = ps.工资借款标准.ToString("#0.00");
            textEdit福利借款标准.Text     = ps.福利借款标准.ToString("#0.00");
            textEdit报账工资标准.Text     = ps.报账工资标准.ToString("#0.00");
            textEdit工资借款标准.Text     = ps.工资借款标准.ToString("#0.00");
            textEdit薪资奖励每月分摊金额.Text = ps.薪资奖励_月摊.ToString("#0.00");
            textEdit本月执行绩效工资额.Text  = ps.本月执行绩效工资额.ToString("#0.00");
            textEdit合计.Text         = ps.职级工资减项.ToString("#0.00");

            textEdit年薪资奖励.Text     = (ps.薪资奖励_月摊 * 12).ToString("#0.00");
            textEdit年绩效工资.Text     = (ps.年绩效工资_月摊 * 12).ToString("#0.00");
            textEdit年绩效工资每月分摊.Text = ps.年绩效工资_月摊.ToString("#0.00");
        }
Beispiel #10
0
        protected void LoadData()
        {
            CreateWaitDialog("正在查询...", "请稍等");

            List <PrivateSalary> rows = new List <PrivateSalary>();

            foreach (PayGroup payGroup in AccessController.我管理的薪资组)
            {
                rows.AddRange(PrivateSalary.GetPrivateSalarys(Convert.ToInt32(year.Value), Convert.ToInt32(month.Text), ccb发放单位.Text, payGroup.英文名));
            }
            //过滤
            rows = rows.FindAll(a => a.封闭工资账号.银行名称 == ccb银行.Text).ToList();
            //排序
            rows = rows.OrderBy(a => a.基础工资表.财务公司).ThenBy(a => a.基础工资表.财务部门序号).ThenBy(a => a.基础工资表.员工序号).ToList();

            int currOrder = 1;

            foreach (PrivateSalary item in rows)
            {
                item.序号 = currOrder++;
            }

            CreateWaitDialog("正在加载...", "请稍等");

            if (ccb银行.Text == "中信银行")
            {
                documentViewer1.PrintingSystem = zx_report.PrintingSystem;
                zx_report.银行名称 = ccb银行.Text;
                zx_report.工资表  = rows;
                zx_report.BindData();
                zx_report.CreateDocument(false);
            }
            else
            {
                documentViewer1.PrintingSystem = report.PrintingSystem;
                report.银行名称 = ccb银行.Text;
                report.工资表  = rows;
                report.BindData();
                report.CreateDocument(false);
            }
            CloseWaitDialog();

            当前期间 = String.Format("{0}年{1}", year.Value, month.Text) + "月";
        }
        private void ShowDetailItems()
        {
            EmployeeSalaryStructure item = bandedGridView1.GetRow(bandedGridView1.FocusedRowHandle) as EmployeeSalaryStructure;

            if (item != null)
            {
                PrivateSalary ps = PrivateSalary.GetPrivateSalary(item.员工编号, Convert.ToInt32(year.EditValue), Convert.ToInt32(month.EditValue));
                if (ps == null)
                {
                    MessageBox.Show(string.Format("没有找到{0} {1}年{2}月的工资。", item.姓名, year.Text, month.Text));
                }
                else
                {
                    ps.薪酬结构 = item;
                    SalaryDetailForm form = new SalaryDetailForm(ps);
                    form.ShowDialog();
                }
            }
        }
Beispiel #12
0
        protected void LoadData(string searchScope)
        {
            string calRunId = cbb日历组.EditValue as string;

            CreateWaitDialog("正在查询...", "请稍等");

            List <PrivateSalary> rows = new List <PrivateSalary>();

            foreach (PayGroup payGroup in AccessController.我管理的薪资组)
            {
                SalaryAuditingResult checkInfo = SalaryAuditingResult.GetSalaryAuditingResult(payGroup.英文名, calRunId);
                if (checkInfo != null)
                {
                    rows.AddRange(PrivateSalary.GetPrivateSalarys(payGroup.英文名, calRunId));
                }
            }
            switch (searchScope)
            {
            case "按发放单位":
                rows = rows.FindAll(a => a.基础工资表.财务公司 == (string)ccb发放单位.EditValue);
                break;

            case "按所属公司":
                rows = rows.FindAll(a => a.基础工资表.财务公司 == (string)ccb发放单位.EditValue && a.基础工资表.公司名称 == (string)ccb所属公司.EditValue);
                break;

            default:
                break;
            }
            //排序
            rows = rows.OrderBy(a => a.基础工资表.财务公司).ThenBy(a => a.基础工资表.财务部门序号).ThenBy(a => a.基础工资表.员工序号).ToList();

            CreateWaitDialog("正在加载...", "请稍等");

            report.DataSource = rows;
            report.CreateDocument(true);

            CloseWaitDialog();

            CalRunInfo cal = CalRunInfo.Get(calRunId);

            当前期间 = String.Format("{0}年{1}", cal.年度, cal.月份) + "月";
        }
Beispiel #13
0
        protected void LoadData()
        {
            CreateWaitDialog("正在查询...", "请稍等");

            List <PrivateSalary> rows = new List <PrivateSalary>();

            foreach (PayGroup payGroup in AccessController.我管理的薪资组)
            {
                rows.AddRange(PrivateSalary.GetPrivateSalarys(Convert.ToInt32(year.Value), Convert.ToInt32(month.Text), ccb发放单位.Text, payGroup.英文名));
            }
            //排序
            rows = rows.OrderBy(a => a.基础工资表.财务公司).ThenBy(a => a.基础工资表.财务部门序号).ThenBy(a => a.基础工资表.员工序号).ToList();

            CreateWaitDialog("正在加载...", "请稍等");

            report.DataSource = rows;
            report.CreateDocument(false);

            CloseWaitDialog();
            当前期间 = String.Format("{0}年{1}", year.Value, month.Text) + "月";
        }
        protected void LoadData()
        {
            CreateWaitDialog("正在查询...", "请稍等");

            List <PrivateSalary> rows = new List <PrivateSalary>();

            foreach (PayGroup payGroup in AccessController.我管理的薪资组)
            {
                rows.AddRange(PrivateSalary.GetPrivateSalarys(Convert.ToInt32(year.Value), Convert.ToInt32(month.Text), ccb发放单位.Text, payGroup.英文名));
            }
            //排序
            rows = rows.OrderBy(a => a.基础工资表.财务公司).ThenBy(a => a.基础工资表.财务部门序号).ThenBy(a => a.基础工资表.员工序号).ToList();

            CreateWaitDialog("正在加载...", "请稍等");

            //2018-5-26 设置序号
            int    currOrder   = 1;
            string lastCalDept = null; //上一个人的计算部门

            foreach (PrivateSalary item in rows)
            {
                if (lastCalDept != item.基础工资表.财务部门)
                {
                    currOrder = 1;
                }

                item.序号     = currOrder++;
                lastCalDept = item.基础工资表.财务部门;
            }

            report.DataSource = rows;
            report.CreateDocument(false);

            CloseWaitDialog();
            当前期间 = String.Format("{0}年{1}", year.Value, month.Text) + "月";
        }
Beispiel #15
0
        private void btn审核_Click(object sender, EventArgs e)
        {
            //必须审核完抽查的记录才能正式审核
            ColumnView colView = (ColumnView)gridControl1.MainView;

            if (colView != null)
            {
                PrivateSalary currentItem = (PrivateSalary)colView.GetFocusedRow();
                if (currentItem != null)
                {
                    PayCheckRecord pcr = PayCheckRecord.GetPayCheckRecord(currentItem.标识);
                    if (pcr != null)
                    {
                        if (MessageBox.Show(currentItem.姓名 + " 的工资经核实无误吗?", "询问", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2, 0, false) == DialogResult.Yes)
                        {
                            if (MessageBox.Show(currentItem.姓名 + " 的工资经核实无误吗?", "再次确认", MessageBoxButtons.YesNo, MessageBoxIcon.Asterisk, MessageBoxDefaultButton.Button2, 0, false) == DialogResult.Yes)
                            {
                                pcr.DoAuditing(AccessController.CurrentUser.姓名);

                                MyHelper.WriteLog(LogType.信息, "审核抽查的工资记录", pcr.ToString <PayCheckRecord>());

                                MessageBox.Show("当前记录已审核成功");
                            }
                        }
                    }
                    else
                    {
                        MessageBox.Show("审核失败:找不到记录, 请重新打开后重试。", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
                else
                {
                    MessageBox.Show("审核失败:找不到工资记录, 请重新打开后重试。", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
        protected void LoadData()
        {
            string accType = cb账户类型.EditValue as string;

            CreateWaitDialog("正在查询...", "请稍等");

            //生成报盘记录
            currRows.Clear();

            switch (accType)
            {
            case "A":
            case "D":
                List <SalaryResult> salaryList = new List <SalaryResult>();
                //获取上表工资清单
                foreach (PayGroup payGroup in AccessController.我管理的薪资组)
                {
                    salaryList.AddRange(SalaryResult.GetSalaryResults(Convert.ToInt32(year.Value), Convert.ToInt32(month.Text), ccb发放单位.Text, payGroup.英文名));
                }
                foreach (SalaryResult row in salaryList)
                {
                    ToBankReportItem item = new ToBankReportItem();

                    item.账户类型 = accType;
                    item.员工编号 = row.员工编号;
                    item.员工姓名 = row.姓名;
                    item.员工序号 = row.员工序号;
                    item.部门序号 = row.财务部门序号;
                    SetBankInfo(row.员工编号, accType, item);

                    if (accType == "A")     //上表
                    {
                        item.金额 = row.实发工资总额;
                        currRows.Add(item);
                    }
                    if (accType == "D" && row.未休年休假工资 > 0)     //年休假
                    {
                        item.金额 = row.未休年休假工资;
                        currRows.Add(item);
                    }
                }
                break;

            case "B":
                List <PrivateSalary> rows = new List <PrivateSalary>();
                foreach (PayGroup payGroup in AccessController.我管理的薪资组)
                {
                    rows.AddRange(PrivateSalary.GetPrivateSalarys(Convert.ToInt32(year.Value), Convert.ToInt32(month.Text), ccb发放单位.Text, payGroup.英文名));
                }
                foreach (PrivateSalary row in rows)
                {
                    ToBankReportItem item = new ToBankReportItem();

                    item.账户类型 = accType;
                    item.员工编号 = row.员工编号;
                    item.员工姓名 = row.姓名;
                    item.部门序号 = row.基础工资表.财务部门序号;
                    item.员工序号 = row.基础工资表.员工序号;
                    item.金额   = row.本次实发工资;
                    SetBankInfo(row.员工编号, accType, item);

                    currRows.Add(item);
                }
                break;
            }

            //排序
            currRows = currRows.OrderBy(a => a.部门序号).ThenBy(a => a.员工序号).ToList();

            CreateWaitDialog("正在加载...", "请稍等");

            gridControl1.DataSource = currRows;
            gridView1.ExpandAllGroups();

            CloseWaitDialog();

            当前期间 = String.Format("{0}年{1}", year.Value, month.Text) + "月";
            当前账号 = cb账户类型.Text;
        }
Beispiel #17
0
        public void Save()
        {
            if (!计算完成)
            {
                return;
            }

            #region 保存计算结果

            //保存计算结果
            pSal = PrivateSalary.AddPrivateSalary(this.员工编号, this.年, this.月, this.薪资组, this.日历组);

            pSal.姓名 = 姓名;

            pSal.职级工资   = 职级工资_标准;
            pSal.本次发放标准 = 本次发放标准;
            pSal.其它奖项   = 其它奖项;
            pSal.其它扣项   = 其它扣项;
            pSal.工资降级   = 工资降级;
            pSal.其它代垫费用 = 其它代垫费用;
            pSal.津贴补助   = 津贴补助;
            pSal.工资系数   = 工资系数;
            pSal.封闭出勤工资 = 封闭出勤工资;
            pSal.封闭工资合计 = 封闭工资合计;
            pSal.个人所得税  = 个人所得税;
            pSal.总应税工资  = 总应税工资;
            pSal.工资发放总额 = 工资发放总额;
            pSal.实发工资   = 实发工资;
            //2018年1月新增字段
            pSal.薪酬体系    = 薪酬体系;
            pSal.评定职等    = 评定职等;
            pSal.评定职级    = 评定职级;
            pSal.执行职级    = 执行职级;
            pSal.标准职级月薪  = 标准职级月薪;
            pSal.执行职级月薪  = 执行职级月薪;
            pSal.月薪类型    = 月薪类型;
            pSal.是标准职级工资 = 月薪类型 == "常资";
            pSal.职务名称    = PsHelper.GetValue(PsHelper.职务代码, this.表工资表.职务代码);

            pSal.本月剩余月薪额        = 本月剩余月薪额;
            pSal.提前借工资本月还款额     = 提前借工资本月还款额;
            pSal.个人专用车费用本月还款额   = 个人专用车费用本月还款额;
            pSal.月租房报销费用本月实际报销额 = 月租房报销费用本月实际报销额;
            pSal.探亲飞机票本月实际报销额   = 探亲飞机票本月实际报销额;
            pSal.本月执行绩效工资额      = 本月执行绩效工资额;
            pSal.本月实得绩效工资额      = 本月实得绩效工资额;
            //2018-4-4 增加
            pSal.放弃年休假补助    = 放弃年休假补助;
            pSal.交通餐饮补助执行标准 = 交通餐饮补助标准;
            pSal.满勤奖执行标准    = 满勤奖标准;
            pSal.放弃年休假天数    = 放弃年休假天数;
            //2018-5-24 增加
            pSal.工资借款标准   = 工资借款标准;
            pSal.报账工资标准   = 报账工资标准;
            pSal.福利借款标准   = 福利借款标准;
            pSal.契约津贴标准   = 契约津贴标准;
            pSal.薪资奖励_月摊  = 薪资奖励_月摊;
            pSal.年绩效工资_月摊 = 年绩效工资_月摊;
            pSal.月应发工资    = 月应发工资;

            pSal.Save();

            #endregion
        }
        private void btn重新计算_Click(object sender, EventArgs e)
        {
            SalaryAuditingResult checkInfo = SalaryAuditingResult.GetSalaryAuditingResult((string)cb薪资组.EditValue, (string)cbb日历组.EditValue);

            if (checkInfo != null)
            {
                if (checkInfo.已冻结 == false)
                {
                    if (MessageBox.Show("重新计算后系统自动重建抽查记录,您确定要重新计算吗?", "询问", MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2, 0, false) == DialogResult.Yes)
                    {
                        CreateWaitDialog("正在计算工资...", "请稍等");

                        //清空已有的工资表
                        PrivateSalary.ClearPrivateSalary(checkInfo.日历组, checkInfo.薪资组);
                        checkInfo.UndoAuditing();
                        PayCounter payCounter = new PayCounter(checkInfo);
                        //如果计算成功
                        bool successed = payCounter.Calculate();

#if (DEBUG)
                        //为了方便测试,在普通网使用不控制
                        if (MyHelper.GetLocalIp()[0].StartsWith("192.168."))
                        {
                            successed = true;
                            //保存计算时间
                            payCounter.审核情况表.工资计算时间 = DateTime.Now;
                            payCounter.审核情况表.制表人    = AccessController.CurrentUser.姓名;
                            payCounter.审核情况表.制表时间   = DateTime.Now;
                            payCounter.审核情况表.Save();
                            payCounter.审核情况表.UnLock();
                        }
#endif

                        if (successed)
                        {
                            //保存工资表
                            foreach (SalaryCalculator cal in payCounter.员工工资计算器列表)
                            {
                                cal.Save();
                            }
                            SetWaitDialogCaption("正在加载数据...");
                            LoadData(true);
                            CloseWaitDialog();

                            //显示错误列表
                            if (payCounter.错误列表.Count > 0)
                            {
                                ErrorDialog form = new ErrorDialog(payCounter.错误列表);
                                form.ShowDialog();
                            }
                            MyHelper.WriteLog(LogType.信息, "重新计算工资", checkInfo.ToString <SalaryAuditingResult>());
                        }
                        else
                        {
                            CloseWaitDialog();
                            MessageBox.Show("重新计算失败,详细原因点击确定后显示", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            //显示错误列表
                            ErrorDialog form = new ErrorDialog(payCounter.错误列表);
                            form.ShowDialog();
                        }
                    }
                }
                else
                {
                    MessageBox.Show("重新计算失败:已冻结的工资表不能反审重新计算。", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else
            {
                MessageBox.Show("重新计算失败:数据错误,请重新生成工资表后再试。", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        protected void LoadData(bool onlyPayGroup)
        {
            currRows.Clear();

            CreateWaitDialog("正在查询...", "请稍等");
            //清除原来的数据
            List <PrivateSalary> rows = PrivateSalary.GetPrivateSalarys(null, (string)cbb日历组.EditValue);

            foreach (PrivateSalary row in rows)
            {
                if (myPayGroupList.Find(a => a.英文名 == row.薪资组.Trim()) != null)
                {
                    currRows.Add(row);
                }
            }
            if (onlyPayGroup)
            {
                currRows = currRows.FindAll(a => a.薪资组 == (string)cb薪资组.EditValue);
                SetButtonEnabled();
            }
            //排序
            currRows = currRows.OrderBy(a => a.基础工资表.财务公司).ThenBy(a => a.基础工资表.财务部门序号).ThenBy(a => a.基础工资表.员工序号).ToList();

            //2018-5-24 设置序号
            int    currOrder   = 1;
            string lastCalDept = null; //上一个人的计算部门

            foreach (PrivateSalary item in currRows)
            {
                if (lastCalDept != item.基础工资表.财务部门)
                {
                    currOrder = 1;
                }

                item.序号     = currOrder++;
                lastCalDept = item.基础工资表.财务部门;
            }

            CreateWaitDialog("正在加载...", "请稍等");

            gridControl1.DataSource = currRows;
            gridControl1.RefreshDataSource();

            CloseWaitDialog();

            #region 显示审核信息

            if (onlyPayGroup)
            {
                lbl审核人.Text  = "审核人: ";
                lbl审核时间.Text = "审核时间: ";

                SalaryAuditingResult checkInfo = SalaryAuditingResult.GetSalaryAuditingResult((string)cb薪资组.EditValue, (string)cbb日历组.EditValue);
                if (checkInfo != null)
                {
                    lbl审核人.Text  = "审核人: " + checkInfo.表审核人;
                    lbl审核时间.Text = "审核时间: " + checkInfo.表审核时间.ToString();
                }
            }
            #endregion

            SetButtonEnabled();

            bandedGridView1.ExpandAllGroups();
        }
        public void Calculate()
        {
            try
            {
                decimal 标准职级工资, 个人职级工资;
                bool    是标准职级工资 = true;
                bool    工资系数    = false;

                //获取薪酬信息
                GetPayInfo();

                #region 计算职级工资

                StepPayRate        stepPayRate = null;
                List <StepPayRate> rates       = 工资计算器.标准职级工资表.FindAll(a => a.薪级标识 == 薪级_月初).OrderByDescending(a => a.执行日期).ToList();
                if (rates.Count > 0)
                {
                    stepPayRate = rates[0];
                }
                //月底职级
                List <StepPayRate> rates_月底 = 工资计算器.标准职级工资表.FindAll(a => a.薪级标识 == 薪级_月底).OrderByDescending(a => a.执行日期).ToList();
                if (rates.Count > 0)
                {
                    StepPayRate stepPayRate_月底 = rates[0];
                    //如果月底职级改变,去工资低的
                    if (stepPayRate_月底.标识 != stepPayRate.标识)
                    {
                        stepPayRate = stepPayRate.工资额 < stepPayRate_月底.工资额 ? stepPayRate : stepPayRate_月底;
                    }
                }
                //重新计算有效的薪等薪级
                if (stepPayRate != null)
                {
                    封闭薪等 = stepPayRate.薪等标识;
                    封闭薪级 = stepPayRate.薪级标识;
                }

                PersonPayRate        personPayRate = null;
                List <PersonPayRate> pRates        = 工资计算器.个人职级工资表.FindAll(a => a.效 && a.员工编号 == this.员工编号).OrderByDescending(a => a.生效日期).ToList();
                if (pRates.Count > 0)
                {
                    personPayRate = pRates[0];
                    //津贴补助
                    津贴补助 = personPayRate.津贴1金额 + personPayRate.津贴2金额;
                }
                标准职级工资  = stepPayRate == null ? 0 : stepPayRate.工资额;
                个人职级工资  = personPayRate == null ? 0 : personPayRate.月薪;
                职级工资    = 个人职级工资 == 0 ? 标准职级工资 : 个人职级工资;
                是标准职级工资 = 个人职级工资 == 0;

                #endregion

                #region 获取薪等薪级名称

                薪等名称 = SalaryNode.GetName(封闭薪等);
                薪级名称 = SalaryNode.GetName(封闭薪级);

                #endregion

                #region 计算其它奖扣项

                //计算其它奖项
                List <OtherMoney> myOtherMoneyItems = 工资计算器.其它奖扣项.FindAll(a => a.员工编号 == this.员工编号 && a.类型 == "其它奖项");
                其它奖项 = myOtherMoneyItems.Sum(a => a.金额);

                //计算其它扣项
                myOtherMoneyItems = 工资计算器.其它奖扣项.FindAll(a => a.员工编号 == this.员工编号 && a.类型 == "其它扣项");
                其它扣项 = myOtherMoneyItems.Sum(a => a.金额);

                //计算工资降级
                myOtherMoneyItems = 工资计算器.其它奖扣项.FindAll(a => a.员工编号 == this.员工编号 && a.类型 == "工资降级");
                工资降级  = myOtherMoneyItems.Sum(a => a.金额);
                工资降级 += 表工资表.工资降级;

                //计算代垫费用
                myOtherMoneyItems = 工资计算器.其它奖扣项.FindAll(a => a.员工编号 == this.员工编号 && a.类型 == "代垫费用");
                其它代垫费用            = myOtherMoneyItems.Sum(a => a.金额);
                代垫费用 = 表工资表.代垫费用 + 其它代垫费用;
                #endregion

                #region 获取工资系数

                //获取工资系数
                EmpPayRate epRate = 工资计算器.工资系数表.Find(a => a.员工编号 == this.员工编号);
                if (epRate != null)
                {
                    工资系数 = epRate.系数;
                    工资系数 = true;
                }

                #endregion

                //有封闭工资的人才需要计算
                if (职级工资 > 0 || 其它奖项 != 0 || 其它扣项 != 0 || 工资降级 != 0 || 其它代垫费用 != 0)
                {
                    //2017.10.22 如果封闭工资没有设置职级工资,职级工资就是上表工资的工资标准
                    //主要针对没有封闭职级工资,但是有比较大的奖项在封闭工资系统发放的情况
                    if (职级工资 == 0)
                    {
                        职级工资 = 表工资表.表工资 + 工资降级;
                    }

                    #region 计算封闭出勤工资

                    //年休假工资
                    年休假工资 = 表工资表.未休年休假工资;

                    //清除老的还款记录
                    PersonRepayment.Clear(this.员工编号, this.年, this.月);

                    #region 自动创建还款记录

                    //自动创建还款记录
                    List <PersonBorrow> personBorrowList = PersonBorrow.GetMyBorrows(this.员工编号, this.年, this.月);
                    foreach (PersonBorrow borrowItem in personBorrowList)
                    {
                        //如果还有未还清的款
                        if (borrowItem.余额 > 0)
                        {
                            PersonRepayment pRepayment = PersonRepayment.AddPersonRepayment(borrowItem, this.年, this.月);
                            pRepayment.还款金额 = borrowItem.余额 > borrowItem.每月扣还 ? borrowItem.每月扣还 : borrowItem.余额;
                            pRepayment.员工编号 = this.员工编号;
                            pRepayment.创建人  = AccessController.CurrentUser.姓名;
                            pRepayment.创建时间 = DateTime.Now;
                            pRepayment.Save();
                        }
                    }
                    #endregion

                    #region 获取还款记录

                    List <PersonRepayment> prList = PersonRepayment.GetPersonRepayments(this.员工编号, this.年, this.月);
                    if (prList.Count > 0)
                    {
                        PersonRepayment 还款_提前借工资 = prList.Find(a => a.项目 == "提前借工资");
                        if (还款_提前借工资 != null)
                        {
                            提前借工资本月还款额 = 还款_提前借工资.还款金额;
                        }

                        PersonRepayment 还款_个人专用车费用 = prList.Find(a => a.项目 == "个人专用车费用");
                        if (还款_个人专用车费用 != null)
                        {
                            个人专用车费用本月还款额 = 还款_个人专用车费用.还款金额;
                        }
                    }

                    #endregion

                    #region 获取报销记录

                    List <PersonReimbursement> rbList = PersonReimbursement.GetPersonReimbursements(this.员工编号, this.年, this.月);
                    if (rbList.Count > 0)
                    {
                        PersonReimbursement 报销_月租房报销 = rbList.Find(a => a.项目 == "月租房报销");
                        if (报销_月租房报销 != null)
                        {
                            月租房报销费用本月实际报销额 = 报销_月租房报销.报销金额;
                        }

                        PersonReimbursement 报销_探亲飞机票 = rbList.Find(a => a.项目 == "探亲飞机票");
                        if (报销_探亲飞机票 != null)
                        {
                            探亲飞机票本月实际报销额 = 报销_探亲飞机票.报销金额;
                        }
                    }

                    #endregion

                    #region 获取绩效工资

                    EffectivePerformanceSalary 绩效考核 = EffectivePerformanceSalary.GetEffective(this.员工编号, this.年, this.月);
                    if (绩效考核 != null)
                    {
                        本月执行绩效工资额 = 绩效考核.绩效工资;
                        本月实得绩效工资额 = 绩效考核.实得工资;
                    }

                    #endregion

                    if (工资系数)
                    {
                        本月剩余月薪额 = (职级工资 + 表工资表.未休年休假工资) * 工资系数;
                    }

                    else
                    {
                        本月剩余月薪额 = 职级工资;
                    }

                    //2016.6.6 调整,将减掉的部分移到后面
                    //本月剩余月薪额 = 本月剩余月薪额 - 提前借工资本月还款额 - 个人专用车费用本月还款额 - 月租房报销费用本月实际报销额 - 探亲飞机票本月实际报销额 - 本月执行绩效工资额;

                    //计算挂考勤的工资
                    挂考勤的工资 = 本月剩余月薪额;

                    //排班天数
                    排班天数 = 表工资表.企业排班天数;

                    //出勤天数
                    实际出勤天数 = 表工资表.实际出勤天数;

                    //封闭出勤工资基准
                    封闭出勤工资计算标准 = 挂考勤的工资 - 工资降级 - 表工资表.表工资;
                    if (工资系数)
                    {
                        封闭出勤工资计算标准 = 封闭出勤工资计算标准 - 表工资表.未休年休假工资;
                    }
                    //剔除考核工资个人部分
                    封闭出勤工资计算标准 -= 本月执行绩效工资额;
                    //本次发放标准
                    本次发放标准 = 封闭出勤工资计算标准;

                    //出勤天数
                    班别 = 表工资表.班别.Trim();

                    decimal attDays = 实际出勤天数;
                    //封闭出勤工资中, 行政班出勤天数不能大于排班天数
                    if (班别 == "6") //行政班
                    {
                        attDays = 实际出勤天数 > 排班天数 ? 排班天数 : 实际出勤天数;
                    }

                    if (班别 == "6") //行政班
                    {
                        if (实际出勤天数 > 10)
                        {
                            封闭出勤工资 = 封闭出勤工资计算标准 - 封闭出勤工资计算标准 / (decimal)21.75 * (排班天数 - attDays);
                        }
                        else
                        {
                            封闭出勤工资 = (封闭出勤工资计算标准 / (decimal)21.75) * attDays;
                        }
                    }
                    else
                    {
                        if (班别 == "8") //特殊+业务代表+司机
                        {
                            封闭出勤工资 = (封闭出勤工资计算标准 / 排班天数) * attDays;
                        }
                        else
                        {
                            封闭出勤工资 = (封闭出勤工资计算标准 / 26) * attDays;
                        }
                    }

                    #endregion

                    //封闭奖扣合计
                    封闭奖扣合计 = 其它奖项 - 其它扣项;

                    //工资合计
                    //2016.6.6 调整 与上面对应
                    //原来  封闭工资合计 = 封闭出勤工资 + 封闭奖扣合计 + 津贴补助 + 本月实得绩效工资额;
                    封闭工资合计 = 封闭出勤工资 + 封闭奖扣合计 + 津贴补助 + 本月实得绩效工资额 - 提前借工资本月还款额 - 个人专用车费用本月还款额 - 月租房报销费用本月实际报销额 - 探亲飞机票本月实际报销额;
                    封闭工资合计 = Math.Round(封闭工资合计, 2, MidpointRounding.AwayFromZero);

                    //总应税工资
                    总应税工资 = 表工资表.合计应税工资额 + 封闭工资合计;  //上表税前应税工资(含年休假工资)加上封闭部分的工资

                    //工资发放总额
                    工资发放总额 = 表工资表.表工资总额 + 表工资表.未休年休假工资 + 封闭工资合计;    //上表工资总额不含年休假

                    //个税(总个税)
                    个人所得税 = GetTax(总应税工资);

                    //实发(含封闭和上表)
                    实发工资 = 总应税工资 - 个人所得税 - 代垫费用;
                    实发工资 = Math.Round(实发工资, 2, MidpointRounding.AwayFromZero);

                    #region 保存计算结果

                    //保存计算结果
                    pSal = PrivateSalary.AddPrivateSalary(this.员工编号, this.年, this.月, this.薪资组, this.日历组);

                    pSal.姓名 = 姓名;

                    pSal.职级工资    = 职级工资;
                    pSal.本次发放标准  = 本次发放标准;
                    pSal.是标准职级工资 = 是标准职级工资;
                    pSal.其它奖项    = 其它奖项;
                    pSal.其它扣项    = 其它扣项;
                    pSal.工资降级    = 工资降级;
                    pSal.其它代垫费用  = 其它代垫费用;
                    pSal.津贴补助    = 津贴补助;
                    pSal.工资系数    = 工资系数;
                    pSal.封闭出勤工资  = 封闭出勤工资;
                    pSal.封闭工资合计  = 封闭工资合计;
                    pSal.个人所得税   = 个人所得税;
                    pSal.总应税工资   = 总应税工资;
                    pSal.工资发放总额  = 工资发放总额;
                    pSal.实发工资    = 实发工资;

                    if (是标准职级工资)
                    {
                        pSal.薪等   = 封闭薪等;
                        pSal.薪级   = 封闭薪级;
                        pSal.薪等名称 = 薪等名称;
                        pSal.薪级名称 = 薪级名称;
                    }

                    pSal.职务名称 = PsHelper.GetValue(PsHelper.职务代码, this.表工资表.职务代码);

                    pSal.本月剩余月薪额        = 本月剩余月薪额;
                    pSal.提前借工资本月还款额     = 提前借工资本月还款额;
                    pSal.个人专用车费用本月还款额   = 个人专用车费用本月还款额;
                    pSal.月租房报销费用本月实际报销额 = 月租房报销费用本月实际报销额;
                    pSal.探亲飞机票本月实际报销额   = 探亲飞机票本月实际报销额;
                    pSal.本月执行绩效工资额      = 本月执行绩效工资额;
                    pSal.本月实得绩效工资额      = 本月实得绩效工资额;

                    pSal.Save();
                    #endregion
                }
            }
            catch (Exception e)
            {
                Error(e.Message);
            }
        }
Beispiel #21
0
        private void FillTable()
        {
            if (mySalary == null)
            {
                return;
            }

            DateTime 期间开始 = new DateTime(mySalary.年度, mySalary.月份, 1);
            DateTime 期间结束 = 期间开始.AddMonths(1).AddDays(-1);

            EmployeeSalaryStructure 薪酬结构 = mySalary.薪酬结构;
            SalaryResult            表工资  = mySalary.基础工资表;
            PrivateSalary           封闭工资 = mySalary;
            WageLoan          工资借款       = WageLoan.GetEffective(mySalary.员工编号, 期间开始);
            ContractAllowance 契约津贴       = ContractAllowance.GetEffective(mySalary.员工编号, 期间开始);

            decimal 月薪剩余 = 0;

            #region 薪酬结构
            if (薪酬结构 != null)
            {
                cells["G3"].Value = (薪酬结构.年薪_合计 / 10000).ToString("#0.####");
                cells["G4"].Value = (薪酬结构.年薪_奖励 / 10000).ToString("#0.####");
                cells["G5"].Value = (薪酬结构.年薪_12个月 / 10000).ToString("#0.####");
            }
            else
            {
                cells["G3"].Value = (封闭工资.职级工资 * 12 / 10000).ToString("#0.####");
                cells["G5"].Value = 封闭工资.职级工资.ToString("#0.##");
            }

            cells["G6"].Value = 封闭工资.职级工资.ToString("#0.##");
            月薪剩余 = 封闭工资.职级工资;

            if (工资借款 != null)
            {
                List <MonthlyWageLoanItem> items = MonthlyWageLoanItem.GetMonthlyWageLoanItems(mySalary.员工编号);
                items = items.FindAll(a => a.期间开始 >= 工资借款.开始时间 && a.期间开始 <= 期间结束);

                cells["G7"].Value = 工资借款.月借款额度.ToString("#0.##");
                cells["G8"].Value = items.Sum(a => a.月借款标准).ToString("#0.##");

                月薪剩余 -= 工资借款.月借款额度;
            }

            if (契约津贴 != null)
            {
                List <MonthlyContractAllowanceItem> items = MonthlyContractAllowanceItem.GetMonthlyContractAllowanceItems(mySalary.员工编号);
                items = items.FindAll(a => a.期间开始 >= 契约津贴.开始时间 && a.期间开始 <= 期间结束);

                cells["G7"].Value = 契约津贴.月津贴额度.ToString("#0.##");
                cells["G8"].Value = items.Sum(a => a.月津贴标准).ToString("#0.##");

                月薪剩余 -= 契约津贴.月津贴额度;
            }

            月薪剩余 -= 封闭工资.本月执行绩效工资额;

            cells["G16"].Value = 封闭工资.本月执行绩效工资额.ToString("#0.##");
            cells["G17"].Value = 月薪剩余.ToString("#0.##");
            #endregion

            //工资发放
            #region 工资发放

            cells["G18"].Value = 表工资.企业排班天数.ToString("#0.##");
            cells["G19"].Value = 表工资.实际出勤天数.ToString("#0.##");
            cells["G20"].Value = 封闭工资.总出勤工资.ToString("#0.##");

            cells["G21"].Value = 表工资.未休年休假工资.ToString("#0.##");
            cells["G22"].Value = 表工资.实得满勤奖.ToString("#0.##");
            cells["G23"].Value = 封闭工资.总补助工资.ToString("#0.##");

            decimal 加班工资 = 表工资.法定节假日出勤工资 + 表工资.休息日出勤工资 + 表工资.月综合出勤工资 + 表工资.工作日延长工作出勤工资;
            cells["G24"].Value = 加班工资.ToString("#0.##");
            cells["G25"].Value = 表工资.综合考核工资.ToString("#0.##");
            cells["G28"].Value = 封闭工资.奖项_不含满勤奖.ToString("#0.##");
            cells["G29"].Value = 封闭工资.扣项.ToString("#0.##");

            cells["G30"].Value = 封闭工资.工资发放总额.ToString("#0.##");
            //社保缴纳
            cells["G33"].Value = 表工资.住房公积金个人缴纳金额.ToString("#0.##");
            cells["G34"].Value = 表工资.养老保险个人缴纳金额.ToString("#0.##");
            cells["G35"].Value = 表工资.大病医疗个人缴纳金额.ToString("#0.##");
            cells["G36"].Value = 表工资.医疗保险个人缴纳金额.ToString("#0.##");
            cells["G37"].Value = 表工资.失业保险个人缴纳金额.ToString("#0.##");
            cells["G38"].Value = 0; //生育
            cells["G39"].Value = 0; //工伤
            cells["G40"].Value = 表工资.社保个人缴纳金额.ToString("#0.##");
            //预留工资作奖金
            //税后工资
            cells["G43"].Value = 封闭工资.总应税工资.ToString("#0.##");
            cells["G44"].Value = 封闭工资.个人所得税.ToString("#0.##");
            cells["G45"].Value = 封闭工资.总代垫费用.ToString("#0.##");
            cells["G46"].Value = 封闭工资.实发工资.ToString("#0.##");
            //年薪资奖励
            //预留工资作奖金
            //税后奖金

            #endregion
        }
Beispiel #22
0
 public SalaryDetailForm(PrivateSalary salary)
     : this()
 {
     this.mySalary = salary;
 }