コード例 #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void CreateSalaryBoardList_Click(object sender, DirectEventArgs e)
        {
            try
            {
                var salaryBoard = new hr_SalaryBoardList();
                if (!string.IsNullOrEmpty(hdfDepartmentId.Text))
                {
                    salaryBoard.DepartmentId = Convert.ToInt32(hdfDepartmentId.Text);
                }
                if (!string.IsNullOrEmpty(hdfMonth.Text))
                {
                    salaryBoard.Month = Convert.ToInt32(hdfMonth.Text);
                }
                if (!string.IsNullOrEmpty(hdfYear.Text))
                {
                    salaryBoard.Year = Convert.ToInt32(hdfYear.Text);
                }
                salaryBoard.Title       = txtTitleSalaryBoard.Text;
                salaryBoard.Description = txtDesciptionSalaryBoard.Text;
                salaryBoard.CreatedDate = DateTime.Now;
                salaryBoard.CreatedBy   = CurrentUser.User.UserName;

                hr_SalaryBoardListServices.Create(salaryBoard);
                ResetFormSalaryList();
                grpSalaryBoardList.Reload();
            }
            catch (Exception ex)
            {
                Dialog.ShowNotification("Có lỗi xảy ra" + ex.Message);
            }
        }
コード例 #2
0
ファイル: SalaryBoardList.aspx.cs プロジェクト: war-man/HRM
 /// <summary>
 /// Insert or Update Catalog
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void InsertOrUpdate(object sender, DirectEventArgs e)
 {
     try
     {
         var salaryBoardList = new hr_SalaryBoardList();
         // check id
         if (!string.IsNullOrEmpty(hdfSalaryBoardListId.Text) && Convert.ToInt32(hdfSalaryBoardListId.Text) > 0)
         {
             var result = hr_SalaryBoardListServices.GetById(Convert.ToInt32(hdfSalaryBoardListId.Text));
             if (result != null)
             {
                 salaryBoardList = result;
             }
         }
         // set new props
         if (!string.IsNullOrEmpty(hdfConfigId.Text))
         {
             salaryBoardList.ConfigId = Convert.ToInt32(hdfConfigId.Text);
         }
         if (!string.IsNullOrEmpty(hdfDepartmentId.Text))
         {
             salaryBoardList.DepartmentId = Convert.ToInt32(hdfDepartmentId.Text);
         }
         if (!string.IsNullOrEmpty(hdfMonth.Text))
         {
             salaryBoardList.Month = Convert.ToInt32(hdfMonth.Text);
         }
         if (!string.IsNullOrEmpty(hdfYear.Text))
         {
             salaryBoardList.Year = Convert.ToInt32(hdfYear.Text);
         }
         salaryBoardList.Title       = txtTitleSalaryBoard.Text;
         salaryBoardList.Code        = txtCode.Text;
         salaryBoardList.Description = txtDesciptionSalaryBoard.Text;
         if (salaryBoardList.Id > 0)
         {
             salaryBoardList.EditedDate = DateTime.Now;
             salaryBoardList.EditedBy   = CurrentUser.User.UserName;
             hr_SalaryBoardListServices.Update(salaryBoardList);
         }
         else
         {
             salaryBoardList.CreatedDate = DateTime.Now;
             salaryBoardList.CreatedBy   = CurrentUser.User.UserName;
             hr_SalaryBoardListServices.Create(salaryBoardList);
         }
         wdSetting.Hide();
         grdSalaryBoardList.Reload();
         Dialog.ShowNotification("Lưu thành công");
     }
     catch (Exception ex)
     {
         Dialog.ShowError(ex.Message);
     }
 }
コード例 #3
0
ファイル: SalaryBoardList.aspx.cs プロジェクト: war-man/HRM
        /// <summary>
        /// Init setting window
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void InitWindow(object sender, DirectEventArgs e)
        {
            var param = e.ExtraParams["Id"];

            if (int.TryParse(param, out var id))
            {
                if (id > 0)
                {
                    // edit
                    wdSetting.Title = @"Sửa bảng lương";
                    wdSetting.Icon  = Icon.Pencil;
                }
                else
                {
                    // insert
                    wdSetting.Title = @"Thêm mới bảng lương";
                    wdSetting.Icon  = Icon.Add;
                }
                hdfSalaryBoardListId.Text = id.ToString();
                var salaryBoardList = new hr_SalaryBoardList();
                if (id > 0)
                {
                    var result = hr_SalaryBoardListServices.GetById(Convert.ToInt32(hdfSalaryBoardListId.Text));
                    if (result != null)
                    {
                        salaryBoardList = result;
                    }
                    hdfMonth.Text = salaryBoardList.Month.ToString();
                    cbxMonth.Text = salaryBoardList.Month.ToString();
                    hdfYear.Text  = salaryBoardList.Year.ToString();
                    spnYear.Text  = salaryBoardList.Year.ToString();
                }

                txtTitleSalaryBoard.Text      = salaryBoardList.Title;
                txtCode.Text                  = salaryBoardList.Code;
                txtDesciptionSalaryBoard.Text = salaryBoardList.Description;
                hdfConfigId.Text              = salaryBoardList.ConfigId.ToString();
                cbxConfigList.Text            = cat_PayrollConfigServices.GetFieldValueById(salaryBoardList.ConfigId, "Name");
                hdfDepartmentId.Text          = salaryBoardList.DepartmentId.ToString();
                cbxDepartment.Text            = cat_DepartmentServices.GetFieldValueById(salaryBoardList.DepartmentId, "Name");
                // show window
                wdSetting.Show();
            }
        }
コード例 #4
0
ファイル: SalaryBoardList.aspx.cs プロジェクト: war-man/HRM
        /// <summary>
        /// Lay du lieu tu cham cong
        /// </summary>
        /// <param name="boardList"></param>
        /// <param name="salaryInfo"></param>
        private void GetDataFromTimeSheet(hr_SalaryBoardList boardList, hr_SalaryBoardInfo salaryInfo)
        {
            ////Lay ID bang cham cong
            //var timeSheetReport = hr_TimeSheetReportServices.GetTimeSheetReport(boardList.DepartmentId,
            //    boardList.Month, boardList.Year, TimeSheetHandlerType);
            //if(timeSheetReport != null)
            //{
            //    salaryInfo.WorkStandardDay = timeSheetReport.WorkInMonth;
            //    //Lay tong cong thuc te
            //    var timeSheetList = hr_TimeSheetServices.GetByTimeSheetReportIdAndRecordId(salaryInfo.RecordId, timeSheetReport.Id);
            //    double? totalWork = 0.0;
            //    double? totalNormal = 0.0;
            //    double? totalWorkLeaveDay = 0.0;
            //    double? totalOverTime = 0.0;
            //    double? totalOverTimeDay = 0.0;
            //    double? totalOverTimeNight = 0.0;
            //    double? totalOverTimeHoliday = 0.0;
            //    double? totalOverTimeWeekend = 0.0;

            //    foreach(var itemTimeSheet in timeSheetList)
            //    {
            //        var timeSheetEvent = JSON.Deserialize<List<TimeSheetItemModel>>(itemTimeSheet.Detail);
            //        if(timeSheetEvent.Count > 0)
            //        {
            //            var symbol = hr_TimeSheetSymbolServices.GetSymbolFullDay(ConstPaySalary, null);
            //            if(symbol != null)
            //            {
            //                var listTimeFullDay =
            //                    timeSheetEvent.Where(d => d.TypeGroup == ConstPaySalary && d.Symbol == symbol.Code);
            //                foreach(var itemNormal in listTimeFullDay)
            //                {
            //                    totalNormal += itemNormal.WorkConvert;
            //                }
            //            }

            //            var listOverTime =
            //                timeSheetEvent.Where(d => d.TypeGroup == ConstOverTime);
            //            var listOverTimeDay =
            //                timeSheetEvent.Where(d => d.TypeGroup == ConstOverTimeDay);
            //            var listOverTimeNight =
            //                timeSheetEvent.Where(d => d.TypeGroup == ConstOverTimeNight);
            //            var listOverTimeHoliday =
            //                timeSheetEvent.Where(d => d.TypeGroup == ConstOverTimeHoliday);
            //            var listOverTimeWeekend =
            //                timeSheetEvent.Where(d => d.TypeGroup == ConstOverTimeWeekend);
            //            var listWorkLeaveDay =
            //                timeSheetEvent.Where(d => d.TypeGroup == ConstLeave);

            //            foreach(var itemEvent in timeSheetEvent)
            //            {
            //                totalWork += itemEvent.WorkConvert;
            //            }

            //            foreach(var item in listWorkLeaveDay)
            //            {
            //                if(item.WorkConvert != null)
            //                {
            //                    totalWorkLeaveDay += item.WorkConvert;
            //                }
            //            }

            //            foreach(var item in listOverTime)
            //            {
            //                if(item.TimeConvert != null)
            //                {
            //                    totalOverTime += item.TimeConvert;
            //                }
            //            }

            //            foreach(var item in listOverTimeDay)
            //            {
            //                if(item.TimeConvert != null)
            //                {
            //                    totalOverTimeDay += item.TimeConvert;
            //                }
            //            }

            //            foreach(var item in listOverTimeNight)
            //            {
            //                if(item.TimeConvert != null)
            //                {
            //                    totalOverTimeNight += item.TimeConvert;
            //                }
            //            }

            //            foreach(var item in listOverTimeHoliday)
            //            {
            //                if(item.TimeConvert != null)
            //                {
            //                    totalOverTimeHoliday += item.TimeConvert;
            //                }
            //            }

            //            foreach(var item in listOverTimeWeekend)
            //            {
            //                if(item.TimeConvert != null)
            //                {
            //                    totalOverTimeWeekend += item.TimeConvert;
            //                }
            //            }

            //        }
            //    }

            //    salaryInfo.WorkActualDay = Math.Round(totalWork.Value, 2);
            //    salaryInfo.WorkNormalDay = Math.Round(totalNormal.Value, 2);
            //    salaryInfo.WorkPaidLeave = Math.Round(totalWorkLeaveDay.Value, 2);
            //    salaryInfo.OverTime = Math.Round(totalOverTime.Value, 2);
            //    salaryInfo.OverTimeDay = Math.Round(totalOverTimeDay.Value, 2);
            //    salaryInfo.OverTimeNight = Math.Round(totalOverTimeNight.Value, 2);
            //    salaryInfo.OverTimeHoliday = Math.Round(totalOverTimeHoliday.Value, 2);
            //    salaryInfo.OverTimeWeekend = Math.Round(totalOverTimeWeekend.Value, 2);
            //}
        }