// GET api/<controller>/5 public Cat_UnusualAllowanceCfgModel Get(Guid id) { var profileName = string.Empty; var service = new Cat_UnusualAllowanceCfgServices(); ActionService actionService = new ActionService(UserLogin); var result = actionService.GetByIdUseStore <Cat_UnusualAllowanceCfgEntity>(id, ConstantSql.hrm_cat_sp_get_UnusualAllowanceCfgId, ref status); if (result == null) { return(new Cat_UnusualAllowanceCfgModel()); } var cat_UnsualAllowanceCfgEntity = new Cat_UnusualAllowanceCfgModel { ID = result.ID, Code = result.Code, Comment = result.Comment, UnusualAllowanceCfgName = result.UnusualAllowanceCfgName, IsAddToHourlyRate = result.IsAddToHourlyRate, IsChargePIT = result.IsChargePIT, IsExcludePayslip = result.IsExcludePayslip, MethodCalculation = result.MethodCalculation, Formula = result.Formula, EDType = result.EDType, Amount = result.Amount, Type = result.Type }; return(cat_UnsualAllowanceCfgEntity); }
// GET api/<controller>/5 public Cat_UnusualAllowanceCfgModel Get(Guid id) { var profileName = string.Empty; var service = new Cat_UnusualAllowanceCfgServices(); ActionService actionService = new ActionService(UserLogin); var result = actionService.GetByIdUseStore<Cat_UnusualAllowanceCfgEntity>(id, ConstantSql.hrm_cat_sp_get_UnusualAllowanceCfgId, ref status); if (result == null) { return new Cat_UnusualAllowanceCfgModel(); } var cat_UnsualAllowanceCfgEntity = new Cat_UnusualAllowanceCfgModel { ID = result.ID, Code = result.Code, Comment = result.Comment, UnusualAllowanceCfgName = result.UnusualAllowanceCfgName, IsAddToHourlyRate = result.IsAddToHourlyRate, IsChargePIT = result.IsChargePIT, IsExcludePayslip = result.IsExcludePayslip, MethodCalculation = result.MethodCalculation, Formula = result.Formula, EDType = result.EDType, Amount = result.Amount, Type = result.Type }; return cat_UnsualAllowanceCfgEntity; }
DataTable CreateReportEvalutionSchema(DateTime? _dateFrom, DateTime? _dateTo,string userLogin) { using (var context = new VnrHrmDataContext()) { DataTable tb = new DataTable("Eva_ReportEvalutionDataEntity"); tb.Columns.Add(Eva_ReportEvalutionDataEntity.FieldNames.CodeEmp); tb.Columns.Add(Eva_ReportEvalutionDataEntity.FieldNames.ProfileName); if (_dateFrom != null && _dateTo != null) { if (!tb.Columns.Contains(Eva_ReportEvalutionDataEntity.FieldNames.HistoryDateFrom)) { tb.Columns.Add(Eva_ReportEvalutionDataEntity.FieldNames.HistoryDateFrom, typeof(DateTime)); } } tb.Columns.Add(Eva_ReportEvalutionDataEntity.FieldNames.Year, typeof(DateTime)); tb.Columns.Add(Eva_ReportEvalutionDataEntity.FieldNames.Time, typeof(int)); tb.Columns.Add(Eva_ReportEvalutionDataEntity.FieldNames.E_UNIT); tb.Columns.Add(Eva_ReportEvalutionDataEntity.FieldNames.E_DIVISION); tb.Columns.Add(Eva_ReportEvalutionDataEntity.FieldNames.E_DEPARTMENT); //tb.Columns.Add(Eva_ReportEvalutionDataEntity.FieldNames.UnitAbb); //tb.Columns.Add(Eva_ReportEvalutionDataEntity.FieldNames.DivisionAbb); tb.Columns.Add(Eva_ReportEvalutionDataEntity.FieldNames.E_TEAM); tb.Columns.Add(Eva_ReportEvalutionDataEntity.FieldNames.E_SECTION); //tb.Columns.Add(Eva_ReportEvalutionDataEntity.FieldNames.DepartmentAbb); tb.Columns.Add(Eva_ReportEvalutionDataEntity.FieldNames.GroupCode); tb.Columns.Add(Eva_ReportEvalutionDataEntity.FieldNames.LocationByGroupCode); tb.Columns.Add(Eva_ReportEvalutionDataEntity.FieldNames.ActualWokingPlace); tb.Columns.Add(Eva_ReportEvalutionDataEntity.FieldNames.ReportEvalutionDataNode, typeof(DateTime)); tb.Columns.Add(Eva_ReportEvalutionDataEntity.FieldNames.Age, typeof(int)); tb.Columns.Add(Eva_ReportEvalutionDataEntity.FieldNames.Entering, typeof(DateTime)); tb.Columns.Add(Eva_ReportEvalutionDataEntity.FieldNames.ServiceYear, typeof(string)); tb.Columns.Add(Eva_ReportEvalutionDataEntity.FieldNames.ServiceYearKi, typeof(string)); tb.Columns.Add(Eva_ReportEvalutionDataEntity.FieldNames.PayRankSalary); tb.Columns.Add(Eva_ReportEvalutionDataEntity.FieldNames.BasicSalary, typeof(double)); tb.Columns.Add(Eva_ReportEvalutionDataEntity.FieldNames.Rank); tb.Columns.Add(Eva_ReportEvalutionDataEntity.FieldNames.RankZone); tb.Columns.Add(Eva_ReportEvalutionDataEntity.FieldNames.JobTitle); tb.Columns.Add(Eva_ReportEvalutionDataEntity.FieldNames.QualificationAbilitytitle); //tb.Columns.Add(Eva_ReportEvalutionDataEntity.FieldNames.BasicSalary1, typeof(double?)); //tb.Columns.Add(Eva_ReportEvalutionDataEntity.FieldNames.AreaAllowance); //tb.Columns.Add(Eva_ReportEvalutionDataEntity.FieldNames.SpecialAllowance); //tb.Columns.Add(Eva_ReportEvalutionDataEntity.FieldNames.DrivingAllowance); //tb.Columns.Add(Eva_ReportEvalutionDataEntity.FieldNames.AdjustmentAllowanceForVP, typeof(double?)); //tb.Columns.Add(Eva_ReportEvalutionDataEntity.FieldNames.ChildCareAllowance, typeof(double?)); string status = string.Empty; List<object> paraUnusualAllowanceCfg = new List<object>(); paraUnusualAllowanceCfg.AddRange(new object[6]); paraUnusualAllowanceCfg[4] = 1; paraUnusualAllowanceCfg[5] = int.MaxValue; var catServiceUnusualAllowanceCfg = new Cat_UnusualAllowanceCfgServices(); var lstUnusualAllowanceCfg = catServiceUnusualAllowanceCfg.GetData<Cat_UnusualAllowanceCfgEntity>(paraUnusualAllowanceCfg, ConstantSql.hrm_cat_sp_get_UnusualAllowanceCfg, userLogin, ref status); if (lstUnusualAllowanceCfg != null) { foreach (var item in lstUnusualAllowanceCfg) { if (!string.IsNullOrEmpty(item.Code) && !tb.Columns.Contains(item.Code)) { tb.Columns.Add(item.Code, typeof(double)); } } } if (_dateFrom != null && _dateTo != null) { int _yearFrom = _dateFrom.Value.Year; int _yearTo = _dateTo.Value.Year; while (_yearFrom <= _yearTo) { string YearField = "Year" + _yearFrom; if (!tb.Columns.Contains(YearField)) tb.Columns.Add(YearField); _yearFrom += 1; } if (!tb.Columns.Contains(Eva_ReportEvalutionDataEntity.FieldNames.HistoryDateFrom)) { tb.Columns.Add(Eva_ReportEvalutionDataEntity.FieldNames.HistoryDateFrom, typeof(DateTime)); } } if (!tb.Columns.Contains(Eva_ReportEvalutionDataEntity.FieldNames.TotalSalaryAllowance)) tb.Columns.Add(Eva_ReportEvalutionDataEntity.FieldNames.TotalSalaryAllowance, typeof(double)); if (!tb.Columns.Contains(Eva_ReportEvalutionDataEntity.FieldNames.C1)) tb.Columns.Add(Eva_ReportEvalutionDataEntity.FieldNames.C1, typeof(int)); if (!tb.Columns.Contains(Eva_ReportEvalutionDataEntity.FieldNames.C2)) tb.Columns.Add(Eva_ReportEvalutionDataEntity.FieldNames.C2, typeof(int)); if (!tb.Columns.Contains(Eva_ReportEvalutionDataEntity.FieldNames.C3)) tb.Columns.Add(Eva_ReportEvalutionDataEntity.FieldNames.C3, typeof(int)); if (!tb.Columns.Contains(Eva_ReportEvalutionDataEntity.FieldNames.C4)) tb.Columns.Add(Eva_ReportEvalutionDataEntity.FieldNames.C4, typeof(int)); if (!tb.Columns.Contains(Eva_ReportEvalutionDataEntity.FieldNames.C5)) tb.Columns.Add(Eva_ReportEvalutionDataEntity.FieldNames.C5, typeof(int)); if (!tb.Columns.Contains(Eva_ReportEvalutionDataEntity.FieldNames.C6)) tb.Columns.Add(Eva_ReportEvalutionDataEntity.FieldNames.C6, typeof(int)); if (!tb.Columns.Contains(Eva_ReportEvalutionDataEntity.FieldNames.C7)) tb.Columns.Add(Eva_ReportEvalutionDataEntity.FieldNames.C7, typeof(int)); if (!tb.Columns.Contains(Eva_ReportEvalutionDataEntity.FieldNames.C8)) tb.Columns.Add(Eva_ReportEvalutionDataEntity.FieldNames.C8, typeof(int)); if (!tb.Columns.Contains(Eva_ReportEvalutionDataEntity.FieldNames.C9)) tb.Columns.Add(Eva_ReportEvalutionDataEntity.FieldNames.C9, typeof(int)); if (!tb.Columns.Contains(Eva_ReportEvalutionDataEntity.FieldNames.C10)) tb.Columns.Add(Eva_ReportEvalutionDataEntity.FieldNames.C10, typeof(int)); if (!tb.Columns.Contains(Eva_ReportEvalutionDataEntity.FieldNames.C11)) tb.Columns.Add(Eva_ReportEvalutionDataEntity.FieldNames.C11, typeof(int)); if (!tb.Columns.Contains(Eva_ReportEvalutionDataEntity.FieldNames.C12)) tb.Columns.Add(Eva_ReportEvalutionDataEntity.FieldNames.C12, typeof(int)); if (!tb.Columns.Contains(Eva_ReportEvalutionDataEntity.FieldNames.C13)) tb.Columns.Add(Eva_ReportEvalutionDataEntity.FieldNames.C13, typeof(int)); if (!tb.Columns.Contains(Eva_ReportEvalutionDataEntity.FieldNames.C14)) tb.Columns.Add(Eva_ReportEvalutionDataEntity.FieldNames.C14, typeof(int)); if (!tb.Columns.Contains(Eva_ReportEvalutionDataEntity.FieldNames.C15)) tb.Columns.Add(Eva_ReportEvalutionDataEntity.FieldNames.C15, typeof(int)); if (!tb.Columns.Contains(Eva_ReportEvalutionDataEntity.FieldNames.C16)) tb.Columns.Add(Eva_ReportEvalutionDataEntity.FieldNames.C16, typeof(int)); if (!tb.Columns.Contains(Eva_ReportEvalutionDataEntity.FieldNames.C17)) tb.Columns.Add(Eva_ReportEvalutionDataEntity.FieldNames.C17); if (!tb.Columns.Contains(Eva_ReportEvalutionDataEntity.FieldNames.C18)) tb.Columns.Add(Eva_ReportEvalutionDataEntity.FieldNames.C18); if (!tb.Columns.Contains(Eva_ReportEvalutionDataEntity.FieldNames.C19)) tb.Columns.Add(Eva_ReportEvalutionDataEntity.FieldNames.C19, typeof(double)); if (!tb.Columns.Contains(Eva_ReportEvalutionDataEntity.FieldNames.C20)) tb.Columns.Add(Eva_ReportEvalutionDataEntity.FieldNames.C20, typeof(double)); if (!tb.Columns.Contains(Eva_ReportEvalutionDataEntity.FieldNames.C21)) tb.Columns.Add(Eva_ReportEvalutionDataEntity.FieldNames.C21, typeof(double)); if (!tb.Columns.Contains(Eva_ReportEvalutionDataEntity.FieldNames.C22)) tb.Columns.Add(Eva_ReportEvalutionDataEntity.FieldNames.C22); if (!tb.Columns.Contains(Eva_ReportEvalutionDataEntity.FieldNames.C23)) tb.Columns.Add(Eva_ReportEvalutionDataEntity.FieldNames.C23, typeof(double)); if (!tb.Columns.Contains(Eva_ReportEvalutionDataEntity.FieldNames.C24)) tb.Columns.Add(Eva_ReportEvalutionDataEntity.FieldNames.C24, typeof(double)); if (!tb.Columns.Contains(Eva_ReportEvalutionDataEntity.FieldNames.C25)) tb.Columns.Add(Eva_ReportEvalutionDataEntity.FieldNames.C25, typeof(double)); if (!tb.Columns.Contains(Eva_ReportEvalutionDataEntity.FieldNames.C26)) tb.Columns.Add(Eva_ReportEvalutionDataEntity.FieldNames.C26, typeof(double)); if (!tb.Columns.Contains(Eva_ReportEvalutionDataEntity.FieldNames.C27)) tb.Columns.Add(Eva_ReportEvalutionDataEntity.FieldNames.C27, typeof(double)); if (!tb.Columns.Contains(Eva_ReportEvalutionDataEntity.FieldNames.C28)) tb.Columns.Add(Eva_ReportEvalutionDataEntity.FieldNames.C28, typeof(double)); if (!tb.Columns.Contains(Eva_ReportEvalutionDataEntity.FieldNames.C29)) tb.Columns.Add(Eva_ReportEvalutionDataEntity.FieldNames.C29, typeof(double)); if (!tb.Columns.Contains(Eva_ReportEvalutionDataEntity.FieldNames.C30)) tb.Columns.Add(Eva_ReportEvalutionDataEntity.FieldNames.C30, typeof(double)); if (!tb.Columns.Contains(Eva_ReportEvalutionDataEntity.FieldNames.C31)) tb.Columns.Add(Eva_ReportEvalutionDataEntity.FieldNames.C31); if (!tb.Columns.Contains(Eva_ReportEvalutionDataEntity.FieldNames.C32)) tb.Columns.Add(Eva_ReportEvalutionDataEntity.FieldNames.C32); //if (!tb.Columns.Contains(Eva_ReportEvalutionDataEntity.FieldNames.TotalC1C2)) // tb.Columns.Add(Eva_ReportEvalutionDataEntity.FieldNames.TotalC1C2, typeof(int)); //if (!tb.Columns.Contains(Eva_ReportEvalutionDataEntity.FieldNames.TotalC3C4C5C6C7)) // tb.Columns.Add(Eva_ReportEvalutionDataEntity.FieldNames.TotalC3C4C5C6C7, typeof(int)); //if (!tb.Columns.Contains(Eva_ReportEvalutionDataEntity.FieldNames.TotalC1C2C3C4C5C6C7)) // tb.Columns.Add(Eva_ReportEvalutionDataEntity.FieldNames.TotalC1C2C3C4C5C6C7, typeof(int)); //if (!tb.Columns.Contains(Eva_ReportEvalutionDataEntity.FieldNames.TotalC8C9)) // tb.Columns.Add(Eva_ReportEvalutionDataEntity.FieldNames.TotalC8C9, typeof(int)); if (!tb.Columns.Contains(Eva_ReportEvalutionDataEntity.FieldNames.TimeEvalutionData)) tb.Columns.Add(Eva_ReportEvalutionDataEntity.FieldNames.TimeEvalutionData); if (!tb.Columns.Contains(Eva_ReportEvalutionDataEntity.FieldNames.DateStart)) tb.Columns.Add(Eva_ReportEvalutionDataEntity.FieldNames.DateStart, typeof(DateTime)); if (!tb.Columns.Contains(Eva_ReportEvalutionDataEntity.FieldNames.DateEnd)) tb.Columns.Add(Eva_ReportEvalutionDataEntity.FieldNames.DateEnd, typeof(DateTime)); if (!tb.Columns.Contains(Eva_ReportEvalutionDataEntity.FieldNames.TimeEvalutionDataCode)) tb.Columns.Add(Eva_ReportEvalutionDataEntity.FieldNames.TimeEvalutionDataCode); return tb; } }
public DataTable GetReportEvalutionData(int year, Guid? _TimesGetDataID, string orgStructureID, bool _IsCreateTemplate, DateTime? _dateStart, DateTime? _dateEnd, DateTime? _dateFrom, DateTime? _dateTo, Guid? _JobTitleID, Guid? _PositionID, Guid? _WorkPlaceID, Guid? _RankID,string userLogin) { using (var context = new VnrHrmDataContext()) { var unitOfWork = (IUnitOfWork)(new UnitOfWork(context)); DataTable table = CreateReportEvalutionSchema(_dateFrom, _dateTo, userLogin); if (_IsCreateTemplate) return table; string status = string.Empty; List<Eva_EvalutionDataEntity> lstEvalutionDataEntity = new List<Eva_EvalutionDataEntity>(); DateTime _datetime = new DateTime(year, 01, 01); //Ngay goc DateTime datetimeNode = _dateEnd.Value; List<object> paraEvalutionData = new List<object>(); paraEvalutionData.AddRange(new object[17]); paraEvalutionData[0] = orgStructureID; paraEvalutionData[1] = year; paraEvalutionData[2] = _datetime; //paraEvalutionData[3] = time; paraEvalutionData[10] = _TimesGetDataID; paraEvalutionData[11] = _JobTitleID; paraEvalutionData[12] = _PositionID; paraEvalutionData[13] = _WorkPlaceID; paraEvalutionData[14] = _RankID; paraEvalutionData[15] = 1; paraEvalutionData[16] = int.MaxValue - 1; var evaServiceEvalutionData = new Eva_EvalutionDataServices(); //chi danh gia nhung nv ngay vao lam <= ngay goc var lstEvalutionData = evaServiceEvalutionData.GetData<Eva_EvalutionDataEntity>(paraEvalutionData, ConstantSql.hrm_eva_getdata_EvalutionData, userLogin, ref status); Guid[] lstSalaryClassIDs = null; Guid[] lstProfielIds = null; if (lstEvalutionData != null) { lstSalaryClassIDs = lstEvalutionData.Where(s => s.SalaryClassID != null).Select(s => s.SalaryClassID.Value).Distinct().ToArray(); lstProfielIds = lstEvalutionData.Where(s => s.ProfileID != null).Select(s => s.ProfileID.Value).Distinct().ToArray(); } #region luong co ban List<object> paraBasicSalary = new List<object>(); paraBasicSalary.AddRange(new object[10]); DateTime _dateMin = DateTime.MinValue; paraBasicSalary[2] = orgStructureID; paraBasicSalary[3] = _dateMin; paraBasicSalary[4] = datetimeNode; paraBasicSalary[5] = _dateMin; paraBasicSalary[6] = datetimeNode; paraBasicSalary[8] = 1; paraBasicSalary[9] = int.MaxValue - 1; var salServiceBasicSalary = new Sal_BasicSalaryServices(); var lstBasicSalary = salServiceBasicSalary.GetData<Sal_BasicSalaryEntity>(paraBasicSalary, ConstantSql.hrm_sal_sp_get_BasicPayroll, userLogin, ref status); if (lstBasicSalary != null && lstProfielIds != null) lstBasicSalary = lstBasicSalary.Where(s => lstProfielIds.Contains(s.ProfileID)).ToList(); List<object> paraSalaryRank = new List<object>(); paraSalaryRank.AddRange(new object[4]); paraSalaryRank[2] = 1; paraSalaryRank[3] = int.MaxValue; var catServiceSalaryRank = new Cat_SalaryRankServices(); var lstSalaryRank = catServiceSalaryRank.GetData<Cat_SalaryRankEntity>(paraSalaryRank, ConstantSql.hrm_cat_sp_get_SalaryRank, userLogin, ref status); if (lstSalaryRank != null && lstSalaryClassIDs != null) lstSalaryRank = lstSalaryRank.Where(s => s.DateOfEffect <= datetimeNode && lstSalaryClassIDs.Contains(s.SalaryClassID.Value)).ToList(); #endregion #region phu cap List<object> paraUnusualAllowance = new List<object>(); paraUnusualAllowance.AddRange(new object[9]); paraBasicSalary[3] = _dateMin; paraBasicSalary[4] = datetimeNode; paraUnusualAllowance[7] = 1; paraUnusualAllowance[8] = int.MaxValue - 1; var salServiceUnusualAllowance = new Sal_UnusualAllowanceServices(); var lstUnusualAllowance = salServiceUnusualAllowance.GetData<Sal_UnusualAllowanceEntity>(paraUnusualAllowance, ConstantSql.hrm_sal_sp_get_UnusualED, userLogin, ref status); List<Guid> lstUnusualAllowanceIDs = null; if (lstUnusualAllowance != null) { //lstUnusualAllowance = lstUnusualAllowance.Where(s => s.MonthEnd <= datetimeNode || (s.MonthStart <= datetimeNode && s.MonthEnd == null)).ToList(); lstUnusualAllowanceIDs = lstUnusualAllowance.Where(s => s.UnusualEDTypeID != null).Select(s => s.UnusualEDTypeID.Value).Distinct().ToList(); } #endregion #region loai phu cap List<object> paraUnusualAllowanceCfg = new List<object>(); paraUnusualAllowanceCfg.AddRange(new object[6]); paraUnusualAllowanceCfg[4] = 1; paraUnusualAllowanceCfg[5] = int.MaxValue - 1; var catServiceUnusualAllowanceCfg = new Cat_UnusualAllowanceCfgServices(); var lstUnusualAllowanceCfg = catServiceUnusualAllowanceCfg.GetData<Cat_UnusualAllowanceCfgEntity>(paraUnusualAllowanceCfg, ConstantSql.hrm_cat_sp_get_UnusualAllowanceCfg, userLogin, ref status); if (lstUnusualAllowanceCfg != null && lstUnusualAllowanceIDs != null) lstUnusualAllowanceCfg = lstUnusualAllowanceCfg.Where(s => lstUnusualAllowanceIDs.Contains(s.ID)).ToList(); #endregion #region lay lich su danh gia List<Eva_PerformanceEntity> lstPerformance = null; int _yearFrom = DateTime.MinValue.Year; int _yearTo = DateTime.MinValue.Year; if (_dateFrom != null && _dateTo != null) { _yearFrom = _dateFrom.Value.Year; _yearTo = _dateTo.Value.Year; var evaServicePerformance = new Eva_PerformanceServices(); List<object> paraPerformance = new List<object>(); paraPerformance.AddRange(new object[20]); paraPerformance[2] = orgStructureID; paraPerformance[18] = 1; paraPerformance[19] = int.MaxValue - 1; lstPerformance = evaServicePerformance.GetData<Eva_PerformanceEntity>(paraPerformance, ConstantSql.hrm_eva_sp_get_PerformanceGeneral, userLogin, ref status); if (lstPerformance != null) lstPerformance = lstPerformance.Where(s => s.YearEvaluation != null).ToList(); if (lstPerformance.Count != 0) lstPerformance = lstPerformance.Where(s => s.YearEvaluation.Value.Year >= _yearFrom && s.YearEvaluation.Value.Year <= _yearTo).ToList(); } #endregion DateTime dateFirstKi = _dateStart.Value; foreach (var item in lstEvalutionData) { DataRow row = table.NewRow(); #region thong tin nhan vien row[Eva_ReportEvalutionDataEntity.FieldNames.CodeEmp] = item.CodeEmp; row[Eva_ReportEvalutionDataEntity.FieldNames.ProfileName] = item.ProfileName; row[Eva_ReportEvalutionDataEntity.FieldNames.E_DEPARTMENT] = item.E_DEPARTMENT; row[Eva_ReportEvalutionDataEntity.FieldNames.E_DIVISION] = item.E_DIVISION; row[Eva_ReportEvalutionDataEntity.FieldNames.E_SECTION] = item.E_SECTION; row[Eva_ReportEvalutionDataEntity.FieldNames.E_TEAM] = item.E_TEAM; row[Eva_ReportEvalutionDataEntity.FieldNames.E_UNIT] = item.E_UNIT; row[Eva_ReportEvalutionDataEntity.FieldNames.GroupCode] = item.CostCentreCode; row[Eva_ReportEvalutionDataEntity.FieldNames.LocationByGroupCode] = item.WorkPlaceCode; row[Eva_ReportEvalutionDataEntity.FieldNames.ReportEvalutionDataNode] = datetimeNode; #endregion #region tham nien if (item.DateOfBirth != null) row[Eva_ReportEvalutionDataEntity.FieldNames.Age] = DateTime.Today.Year - item.DateOfBirth.Value.Year; if (item.DateHire != null) { row[Eva_ReportEvalutionDataEntity.FieldNames.Entering] = item.DateHire; double dayServiceYear; dayServiceYear = datetimeNode.Subtract(item.DateHire.Value).TotalDays; double _TotalYear = dayServiceYear / 360; double _tempYear = 0; if (_TotalYear > 0) { string[] parts = _TotalYear.ToString().Split('.'); double _intMonth = double.Parse(parts[0]); if (parts.Length > 1) { double _modMonth = double.Parse("0." + parts[1]) * 12; if (_modMonth >= 10) { _tempYear = _intMonth + (_modMonth / 100); } else { _tempYear = _intMonth + (_modMonth / 10); } } row[Eva_ReportEvalutionDataEntity.FieldNames.ServiceYear] = String.Format("{0:0.0}", _tempYear); ; } if (item.DateHire.Value > dateFirstKi) { if (_TotalYear > 0) row[Eva_ReportEvalutionDataEntity.FieldNames.ServiceYearKi] = String.Format("{0:0.0}", _tempYear); } else { row[Eva_ReportEvalutionDataEntity.FieldNames.ServiceYearKi] = 1.0; } } #endregion var objBasicSalary = lstBasicSalary.Where(s => s.ProfileID == item.ProfileID).FirstOrDefault(); if (objBasicSalary != null) row[Eva_ReportEvalutionDataEntity.FieldNames.BasicSalary] = double.Parse(objBasicSalary.GrossAmount); row[Eva_ReportEvalutionDataEntity.FieldNames.Rank] = item.SalaryClassName; row[Eva_ReportEvalutionDataEntity.FieldNames.QualificationAbilitytitle] = item.AbilityTitleVNI; if (item.SalaryClassID != null) { var objSalaryRank = lstSalaryRank.Where(s => s.SalaryClassID == item.SalaryClassID).FirstOrDefault(); if (objSalaryRank != null) row[Eva_ReportEvalutionDataEntity.FieldNames.RankZone] = objSalaryRank.SalaryRankName; } row[Eva_ReportEvalutionDataEntity.FieldNames.JobTitle] = item.JobTitleName; Guid[] lstUnusualAllowanceProfileCfgIds = null; if (lstUnusualAllowance != null) { lstUnusualAllowance = lstUnusualAllowance.Where(s => s.ProfileID == item.ProfileID && s.UnusualEDTypeID != null).ToList(); lstUnusualAllowanceProfileCfgIds = lstUnusualAllowance.Select(s => s.UnusualEDTypeID.Value).ToArray(); } if (lstUnusualAllowanceCfg != null && lstUnusualAllowanceProfileCfgIds != null) lstUnusualAllowanceCfg = lstUnusualAllowanceCfg.Where(s => lstUnusualAllowanceProfileCfgIds.Contains(s.ID)).ToList(); double? totalUnusualAllowance = 0; if (lstUnusualAllowanceCfg != null) { foreach (var itemUnusualAllowanceCfg in lstUnusualAllowanceCfg) { var objUnusualAllowance = lstUnusualAllowance.Where(s => s.UnusualEDTypeID == itemUnusualAllowanceCfg.ID).OrderByDescending(s => s.MonthEnd).FirstOrDefault(); if (objUnusualAllowance != null) { row[itemUnusualAllowanceCfg.Code] = objUnusualAllowance.Amount; totalUnusualAllowance += objUnusualAllowance.Amount; } } } #region lich su danh gia if (_dateFrom != null && _dateTo != null && lstPerformance != null) { _yearFrom = _dateFrom.Value.Year; _yearTo = _dateTo.Value.Year; var lstPerformanceProfile = lstPerformance.Where(s => s.ProfileID == item.ProfileID).OrderByDescending(s => s.YearEvaluation).ToList(); if (lstPerformanceProfile.Count != 0) { while (_yearTo >= _yearFrom) { var objPerformanceFirst = lstPerformanceProfile.Where(s => s.YearEvaluation.Value.Year == _yearTo).OrderByDescending(s => s.YearEvaluation).FirstOrDefault(); _yearTo -= 1; var objPerformance = lstPerformanceProfile.Where(s => s.YearEvaluation.Value.Year == _yearTo).OrderByDescending(s => s.YearEvaluation).FirstOrDefault(); int _yeartemp = _yearTo + 1; if (objPerformanceFirst != null && objPerformanceFirst.Level1Name != null) { if (objPerformanceFirst.RankID != null && objPerformance != null && objPerformance.Level1Name != null && objPerformance.RankID != null) { if (objPerformanceFirst.RankID != objPerformance.RankID) { row["Year" + _yeartemp] = "(" + objPerformanceFirst.Level1Name + ")"; row["Year" + _yearTo] = "(" + objPerformance.Level1Name + ")"; _yearTo -= 1; while (_yearTo >= _yearFrom) { var objPerformanceYear = lstPerformanceProfile.Where(s => s.YearEvaluation.Value.Year == _yearTo).OrderByDescending(s => s.YearEvaluation).FirstOrDefault(); if (objPerformanceYear != null && objPerformanceYear.Level1Name != null) row["Year" + _yearTo] = "(" + objPerformanceYear.Level1Name + ")"; _yearTo -= 1; } } else { row["Year" + _yeartemp] = objPerformanceFirst.Level1Name; } } else { row["Year" + _yeartemp] = objPerformanceFirst.Level1Name; } } } } row[Eva_ReportEvalutionDataEntity.FieldNames.HistoryDateFrom] = _dateFrom.Value.ToShortDateString(); } #endregion if (totalUnusualAllowance > 0) row[Eva_ReportEvalutionDataEntity.FieldNames.TotalSalaryAllowance] = totalUnusualAllowance; if (item.Year != null) row[Eva_ReportEvalutionDataEntity.FieldNames.Year] = item.Year; //if (item.Time !=null) // row[Eva_ReportEvalutionDataEntity.FieldNames.Time] = item.Time; #region lan danh gia if (item.TimeEvalutionData != null) row[Eva_ReportEvalutionDataEntity.FieldNames.TimeEvalutionData] = item.TimeEvalutionData; if (item.TimeEvalutionDataCode != null) row[Eva_ReportEvalutionDataEntity.FieldNames.TimeEvalutionDataCode] = item.TimeEvalutionDataCode; #endregion #region C1->C32 if (item.C1 != null) row[Eva_ReportEvalutionDataEntity.FieldNames.C1] = item.C1; if (item.C2 != null) row[Eva_ReportEvalutionDataEntity.FieldNames.C2] = item.C2; if (item.C3 != null) row[Eva_ReportEvalutionDataEntity.FieldNames.C3] = item.C3; if (item.C4 != null) row[Eva_ReportEvalutionDataEntity.FieldNames.C4] = item.C4; if (item.C5 != null) row[Eva_ReportEvalutionDataEntity.FieldNames.C5] = item.C5; if (item.C6 != null) row[Eva_ReportEvalutionDataEntity.FieldNames.C6] = item.C6; if (item.C7 != null) row[Eva_ReportEvalutionDataEntity.FieldNames.C7] = item.C7; if (item.C8 != null) row[Eva_ReportEvalutionDataEntity.FieldNames.C8] = item.C8; if (item.C9 != null) row[Eva_ReportEvalutionDataEntity.FieldNames.C9] = item.C9; if (item.C10 != null) row[Eva_ReportEvalutionDataEntity.FieldNames.C10] = item.C10; if (item.C11 != null) row[Eva_ReportEvalutionDataEntity.FieldNames.C11] = item.C11; if (item.C12 != null) row[Eva_ReportEvalutionDataEntity.FieldNames.C12] = item.C12; if (item.C13 != null) row[Eva_ReportEvalutionDataEntity.FieldNames.C13] = item.C13; if (item.C14 != null) row[Eva_ReportEvalutionDataEntity.FieldNames.C14] = item.C14; if (item.C15 != null) row[Eva_ReportEvalutionDataEntity.FieldNames.C15] = item.C15; if (item.C16 != null) row[Eva_ReportEvalutionDataEntity.FieldNames.C16] = item.C16; if (item.C17 != null) row[Eva_ReportEvalutionDataEntity.FieldNames.C17] = item.C17; if (item.C18 != null) row[Eva_ReportEvalutionDataEntity.FieldNames.C18] = item.C18; if (item.C19 != null) row[Eva_ReportEvalutionDataEntity.FieldNames.C19] = item.C19; if (item.C20 != null) row[Eva_ReportEvalutionDataEntity.FieldNames.C20] = item.C20; if (item.C21 != null) row[Eva_ReportEvalutionDataEntity.FieldNames.C21] = item.C21; if (item.C22 != null) row[Eva_ReportEvalutionDataEntity.FieldNames.C22] = item.C22; if (item.C23 != null) row[Eva_ReportEvalutionDataEntity.FieldNames.C23] = item.C23; if (item.C24 != null) row[Eva_ReportEvalutionDataEntity.FieldNames.C24] = item.C24; if (item.C25 != null) row[Eva_ReportEvalutionDataEntity.FieldNames.C25] = item.C25; if (item.C26 != null) row[Eva_ReportEvalutionDataEntity.FieldNames.C26] = item.C26; if (item.C27 != null) row[Eva_ReportEvalutionDataEntity.FieldNames.C27] = item.C27; if (item.C28 != null) row[Eva_ReportEvalutionDataEntity.FieldNames.C28] = item.C28; if (item.C29 != null) row[Eva_ReportEvalutionDataEntity.FieldNames.C29] = item.C29; if (item.C30 != null) row[Eva_ReportEvalutionDataEntity.FieldNames.C30] = item.C30; if (item.C31 != null) row[Eva_ReportEvalutionDataEntity.FieldNames.C31] = item.C31; if (item.C32 != null) row[Eva_ReportEvalutionDataEntity.FieldNames.C32] = item.C32; #endregion #region Bo sung //int _tempC1 = 0; //int _TempC2 = 0; //int _tempC3 = 0; //int _tempC4 = 0; //int _tempC5 = 0; //int _tempC6 = 0; //int _tempC7 = 0; //int _tempC8 = 0; //int _tempC9 = 0; //#region TotalC1C2 //if (item.C1 != null) // _tempC1 = item.C1.Value; //if (item.C2 != null) // _TempC2 = item.C2.Value; //if (item.C1 != null || item.C2 != null) // row[Eva_ReportEvalutionDataEntity.FieldNames.TotalC1C2] = _tempC1 + _TempC2; //#endregion //#region TotalC3C4C5C6C7 //if (item.C3 != null) // _tempC3 = item.C3.Value; //if (item.C4 != null) // _tempC4 = item.C4.Value; //if (item.C5 != null) // _tempC5 = item.C5.Value; //if (item.C6 != null) // _tempC6 = item.C6.Value; //if (item.C7 != null) // _tempC7 = item.C7.Value; //if (item.C3 != null || item.C4 != null || item.C5 != null || item.C6 != null || item.C7 != null) // row[Eva_ReportEvalutionDataEntity.FieldNames.TotalC3C4C5C6C7] = _tempC3 + _tempC4 + _tempC5 + _tempC6 + _tempC7; //#endregion //#region TotalC1C2C3C4C5C6C7 //if (item.C1 != null || item.C2 != null || item.C3 != null || item.C4 != null || item.C5 != null || item.C6 != null || item.C7 != null) // row[Eva_ReportEvalutionDataEntity.FieldNames.TotalC1C2C3C4C5C6C7] = _tempC1 + _TempC2 + _tempC3 + _tempC4 + _tempC5 + _tempC6 + _tempC7; //#endregion //#region TotalC8C9 //if (item.C8 != null) // _tempC8 = item.C8.Value; //if (item.C9 != null) // _tempC9 = item.C9.Value; //if (item.C8 != null || item.C9 != null) // row[Eva_ReportEvalutionDataEntity.FieldNames.TotalC8C9] = _tempC8 + _tempC9; //#endregion #endregion #region thoi gian danh gia row[Eva_ReportEvalutionDataEntity.FieldNames.DateStart] = _dateStart; row[Eva_ReportEvalutionDataEntity.FieldNames.DateEnd] = _dateEnd; #endregion table.Rows.Add(row); } return table.ConfigTable(); // #endregion } }
public CatElementModel Post([Bind] CatElementModel model) { ActionService service = new ActionService(UserLogin); string status = string.Empty; //#region Validate //string message = string.Empty; //var checkValidate = HRM.Business.Main.Domain.ValidatorService.OnValidateData<CatElementModel>(model, "Cat_Element", ref message); //if (!checkValidate) //{ // model.ActionStatus = message; // return model; //} //#endregion if (model.IsSalaryTime) { CatElementModel SalaryTimeModel = new CatElementModel(); SalaryTimeModel.ElementCode = HRM.Infrastructure.Utilities.EnumDropDown.SalaryType.E_BASICSALARY_TIME.ToString(); SalaryTimeModel.MethodPayroll = MethodPayroll.E_NORMAL.ToString(); SalaryTimeModel.ElementName = ConstantDisplay.HRM_Category_GradePayroll_IsSalaryTime.ToString(); SalaryTimeModel.GradePayrollID = model.GradePayrollID.Value; SalaryTimeModel.Formula = "([" + PayrollElement.SAL_BASIC_SALARY + "]" + "/" + "[" + PayrollElement.ATT_STD_DAY + "])" + "*" + "[" + PayrollElement.ATT_WORKING_DAY + "]"; return(service.UpdateOrCreate <Cat_ElementEntity, CatElementModel>(SalaryTimeModel)); } if (model.IsSalaryOvertime) { CatElementModel SalaryOvertimeModel = new CatElementModel(); SalaryOvertimeModel.ElementCode = HRM.Infrastructure.Utilities.EnumDropDown.SalaryType.E_BASICSALARY_OVERTIME.ToString(); SalaryOvertimeModel.MethodPayroll = MethodPayroll.E_NORMAL.ToString(); SalaryOvertimeModel.ElementName = ConstantDisplay.HRM_Category_GradePayroll_IsSalaryOvertime.ToString(); SalaryOvertimeModel.GradePayrollID = model.GradePayrollID.Value; SalaryOvertimeModel.Formula = "(([" + PayrollElement.SAL_BASIC_SALARY + "]" + "/" + "[" + PayrollElement.ATT_STD_DAY + "])" + "/" + "[" + PayrollElement.ATT_HOURS_PER_DAY + "])" + "*" + "[" + PayrollElement.ATT_OVERTIME_HOURS + "]"; return(service.UpdateOrCreate <Cat_ElementEntity, CatElementModel>(SalaryOvertimeModel)); } if (model.IsSalaryLeaveDay) { CatElementModel SalaryLeaveDayModel = new CatElementModel(); SalaryLeaveDayModel.ElementCode = HRM.Infrastructure.Utilities.EnumDropDown.SalaryType.E_BASICSALARY_LEAVEDAY.ToString(); SalaryLeaveDayModel.MethodPayroll = MethodPayroll.E_NORMAL.ToString(); SalaryLeaveDayModel.ElementName = ConstantDisplay.HRM_Category_GradePayroll_IsSalaryLeaveDay.ToString(); SalaryLeaveDayModel.GradePayrollID = model.GradePayrollID.Value; SalaryLeaveDayModel.Formula = "(([" + PayrollElement.SAL_BASIC_SALARY + "]" + "/" + "[" + PayrollElement.ATT_STD_DAY + "])" + "/" + "[" + PayrollElement.ATT_HOURS_PER_DAY + "])" + "*" + "[" + PayrollElement.ATT_TOTAL_PAID_LEAVEDAY_HOURS + "]"; return(service.UpdateOrCreate <Cat_ElementEntity, CatElementModel>(SalaryLeaveDayModel)); } if (model.IsSalaryUsualAllowance) { var UsualAllowanceServices = new Cat_UnusualAllowanceCfgServices(); var elementServices = new Cat_ElementServices(); var lstObj = new List <object>(); lstObj.Add(null); lstObj.Add(null); lstObj.Add(1); lstObj.Add(int.MaxValue - 1); var lstUsualAllowance = UsualAllowanceServices.GetData <Cat_UsualAllowanceEntity>(lstObj, ConstantSql.hrm_cat_sp_get_UsualAllowance, UserLogin, ref status).ToList(); if (lstUsualAllowance != null) { List <CatElementModel> lstElement = new List <CatElementModel>(); foreach (var item in lstUsualAllowance) { CatElementModel SalaryUsualAllowanceModel = new CatElementModel(); SalaryUsualAllowanceModel.ElementCode = item.Code; SalaryUsualAllowanceModel.MethodPayroll = MethodPayroll.E_NORMAL.ToString(); SalaryUsualAllowanceModel.ElementName = item.UsualAllowanceName; SalaryUsualAllowanceModel.GradePayrollID = model.GradePayrollID.Value; SalaryUsualAllowanceModel.Formula = "[" + item.Code + "]"; lstElement.Add(SalaryUsualAllowanceModel); } if (lstElement != null) { model.ActionStatus = elementServices.Add(lstElement); } } return(model); } return(null); }
// DELETE api/<controller>/5 public void Delete(Guid ID) { var service = new Cat_UnusualAllowanceCfgServices(); var result = service.Remove <Cat_UnusualAllowanceCfgEntity>(ID); }
public DataTable GetCompareUnusualAllowance(DateTime dateFrom, DateTime dateTo, string orderNmber, Guid? workplaceID, string statusProfile, string UserLogin, bool IsCreateTeamplate) { DataTable tb = CreateCompareUnusualAllowanceSchema(); using (var context = new VnrHrmDataContext()) { var monthSub = dateFrom.AddMonths(-1); string status = string.Empty; var profileServices = new Hre_ProfileServices(); var objProfile = new List<object>(); objProfile.Add(orderNmber); objProfile.Add(null); objProfile.Add(null); var lstProfile = profileServices.GetData<Hre_ProfileEntity>(objProfile, ConstantSql.hrm_hr_sp_get_ProfileIdsByOrg, UserLogin, ref status); if (workplaceID != null) { lstProfile = lstProfile.Where(s => s.WorkPlaceID != null && s.WorkPlaceID.Value == workplaceID.Value).ToList(); } string _statusAll = EnumDropDown.StatusEmployee.E_ALL.ToString(); if (!string.IsNullOrEmpty(statusProfile) && statusProfile != _statusAll) { lstProfile = lstProfile.Where(s => s.Status == statusProfile).ToList(); } var lstProfileID = lstProfile.Select(s => s.ID).ToList(); var UnusCfgServices = new Cat_UnusualAllowanceCfgServices(); var objUnuCfg = new List<object>(); objUnuCfg.Add(null); objUnuCfg.Add(null); objUnuCfg.Add(null); objUnuCfg.Add(null); objUnuCfg.Add(1); objUnuCfg.Add(int.MaxValue - 1); var lstUnuCfg = UnusCfgServices.GetData<Cat_UnusualAllowanceCfgEntity>(objUnuCfg, ConstantSql.hrm_cat_sp_get_UnusualAllowanceCfg, UserLogin, ref status).Where(m => m.Type == EnumDropDown.UnusualEDType.E_UNUSUALALLOWANCE.ToString()).ToList(); var unuServices = new Sal_UnusualAllowanceServices(); var objUnu = new List<object>(); objUnu.AddRange(new object[9]); objUnu[7] = 1; objUnu[8] = int.MaxValue - 1; var lstUnu = unuServices.GetData<Sal_UnusualAllowanceEntity>(objUnu, ConstantSql.hrm_sal_sp_get_UnusualED, UserLogin, ref status); var pastDateFrom = dateFrom.AddMonths(-1); var pastDateTo = dateTo.AddMonths(-1); foreach (var item in lstUnuCfg) { DataRow dr = tb.NewRow(); dr[Sal_CompareUnusualAllowanceEntity.FieldNames.UnusualAllowanceCfgName] = item.UnusualAllowanceCfgName; var earing = EnumDropDown.EDType.E_EARNING.ToString(); var deduction = EnumDropDown.EDType.E_DEDUCTION.ToString(); var lstUnuByTypeID = lstUnu.Where(s => s.UnusualEDTypeID == item.ID && lstProfileID.Contains(s.ProfileID)).ToList(); var lstPastEaring = lstUnuByTypeID.Where(s => s.EDTypeCfg == earing && s.MonthStart >= pastDateFrom && s.MonthEnd <= pastDateTo).ToList(); var lstLastEaring = lstUnuByTypeID.Where(s => s.EDTypeCfg == earing && s.MonthStart >= dateFrom && s.MonthEnd <= dateTo).ToList(); var lstPastDeduction = lstUnuByTypeID.Where(s => s.EDTypeCfg == deduction && s.MonthStart >= pastDateFrom && s.MonthEnd <= pastDateTo).ToList(); var lstLastDeduction = lstUnuByTypeID.Where(s => s.EDTypeCfg == deduction && s.MonthStart >= dateFrom && s.MonthEnd <= dateTo).ToList(); if (tb.Columns.Contains("EEARING1")) { if (lstPastEaring.Count > 0) dr[Sal_CompareUnusualAllowanceEntity.FieldNames.EEARING1] = lstPastEaring.Sum(s => s.Amount); } if (tb.Columns.Contains("EEARING2")) { if (lstLastEaring.Count > 0) dr[Sal_CompareUnusualAllowanceEntity.FieldNames.EEARING2] = lstLastEaring.Sum(s => s.Amount); } if (tb.Columns.Contains("EDEDUCTION1")) { if (lstPastDeduction.Count > 0) dr[Sal_CompareUnusualAllowanceEntity.FieldNames.EDEDUCTION1] = lstPastDeduction.Sum(s => s.Amount); } if (tb.Columns.Contains("EDEDUCTION1")) { if (lstLastDeduction.Count > 0) dr[Sal_CompareUnusualAllowanceEntity.FieldNames.EDEDUCTION2] = lstLastDeduction.Sum(s => s.Amount); } tb.Rows.Add(dr); } return tb.ConfigTable(true); } }
// DELETE api/<controller>/5 public void Delete(Guid ID) { var service = new Cat_UnusualAllowanceCfgServices(); var result = service.Remove<Cat_UnusualAllowanceCfgEntity>(ID); }
public CatElementModel Post([Bind]CatElementModel model) { ActionService service = new ActionService(UserLogin); string status = string.Empty; //#region Validate //string message = string.Empty; //var checkValidate = HRM.Business.Main.Domain.ValidatorService.OnValidateData<CatElementModel>(model, "Cat_Element", ref message); //if (!checkValidate) //{ // model.ActionStatus = message; // return model; //} //#endregion if(model.IsSalaryTime){ CatElementModel SalaryTimeModel = new CatElementModel(); SalaryTimeModel.ElementCode = HRM.Infrastructure.Utilities.EnumDropDown.SalaryType.E_BASICSALARY_TIME.ToString(); SalaryTimeModel.MethodPayroll = MethodPayroll.E_NORMAL.ToString(); SalaryTimeModel.ElementName = ConstantDisplay.HRM_Category_GradePayroll_IsSalaryTime.ToString(); SalaryTimeModel.GradePayrollID = model.GradePayrollID.Value; SalaryTimeModel.Formula = "([" + PayrollElement.SAL_BASIC_SALARY + "]" + "/" + "[" + PayrollElement.ATT_STD_DAY + "])" + "*" + "[" + PayrollElement.ATT_WORKING_DAY + "]"; return service.UpdateOrCreate<Cat_ElementEntity, CatElementModel>(SalaryTimeModel); } if(model.IsSalaryOvertime){ CatElementModel SalaryOvertimeModel = new CatElementModel(); SalaryOvertimeModel.ElementCode = HRM.Infrastructure.Utilities.EnumDropDown.SalaryType.E_BASICSALARY_OVERTIME.ToString(); SalaryOvertimeModel.MethodPayroll = MethodPayroll.E_NORMAL.ToString(); SalaryOvertimeModel.ElementName = ConstantDisplay.HRM_Category_GradePayroll_IsSalaryOvertime.ToString(); SalaryOvertimeModel.GradePayrollID = model.GradePayrollID.Value; SalaryOvertimeModel.Formula = "(([" + PayrollElement.SAL_BASIC_SALARY + "]" + "/" + "[" + PayrollElement.ATT_STD_DAY + "])" + "/" + "[" + PayrollElement.ATT_HOURS_PER_DAY + "])" + "*" + "[" + PayrollElement.ATT_OVERTIME_HOURS + "]"; return service.UpdateOrCreate<Cat_ElementEntity, CatElementModel>(SalaryOvertimeModel); } if(model.IsSalaryLeaveDay){ CatElementModel SalaryLeaveDayModel = new CatElementModel(); SalaryLeaveDayModel.ElementCode = HRM.Infrastructure.Utilities.EnumDropDown.SalaryType.E_BASICSALARY_LEAVEDAY.ToString(); SalaryLeaveDayModel.MethodPayroll = MethodPayroll.E_NORMAL.ToString(); SalaryLeaveDayModel.ElementName = ConstantDisplay.HRM_Category_GradePayroll_IsSalaryLeaveDay.ToString(); SalaryLeaveDayModel.GradePayrollID = model.GradePayrollID.Value; SalaryLeaveDayModel.Formula = "(([" + PayrollElement.SAL_BASIC_SALARY + "]" + "/" + "[" + PayrollElement.ATT_STD_DAY + "])" + "/" + "[" + PayrollElement.ATT_HOURS_PER_DAY + "])" + "*" + "[" + PayrollElement.ATT_TOTAL_PAID_LEAVEDAY_HOURS + "]"; return service.UpdateOrCreate<Cat_ElementEntity, CatElementModel>(SalaryLeaveDayModel); } if(model.IsSalaryUsualAllowance){ var UsualAllowanceServices = new Cat_UnusualAllowanceCfgServices(); var elementServices = new Cat_ElementServices(); var lstObj = new List<object>(); lstObj.Add(null); lstObj.Add(null); lstObj.Add(1); lstObj.Add(int.MaxValue -1); var lstUsualAllowance = UsualAllowanceServices.GetData<Cat_UsualAllowanceEntity>(lstObj, ConstantSql.hrm_cat_sp_get_UsualAllowance, UserLogin, ref status).ToList(); if (lstUsualAllowance != null) { List<CatElementModel> lstElement = new List<CatElementModel>(); foreach (var item in lstUsualAllowance) { CatElementModel SalaryUsualAllowanceModel = new CatElementModel(); SalaryUsualAllowanceModel.ElementCode = item.Code; SalaryUsualAllowanceModel.MethodPayroll = MethodPayroll.E_NORMAL.ToString(); SalaryUsualAllowanceModel.ElementName = item.UsualAllowanceName; SalaryUsualAllowanceModel.GradePayrollID = model.GradePayrollID.Value; SalaryUsualAllowanceModel.Formula = "[" + item.Code + "]"; lstElement.Add(SalaryUsualAllowanceModel); } if (lstElement != null) { model.ActionStatus = elementServices.Add(lstElement); } } return model; } return null; }