Ejemplo n.º 1
0
 public string ActionCancel(string selectedIds, string userLogin)
 {
     using (var context = new VnrHrmDataContext())
     {
         string message = string.Empty;
         var unitOfWork = (IUnitOfWork)(new UnitOfWork(context));
         var repo = new Hre_StopWorkingRepository(unitOfWork);
         var profileServices = new Hre_ProfileServices();
         string status = string.Empty;
         List<Guid> lstIds = selectedIds.Split(',').Select(x => Guid.Parse(x)).ToList();
         var lstStopWorkings = repo.FindBy(m => m.ID != null && lstIds.Contains(m.ID)).ToList();
         foreach (var StopWorking in lstStopWorkings)
         {
             var profile = profileServices.GetData<Hre_ProfileEntity>(Common.DotNetToOracle(StopWorking.ProfileID.ToString()), ConstantSql.hrm_hr_sp_get_ProfileById, userLogin, ref status).FirstOrDefault();
             profile.StatusSyn = StopWorking.LastStatusSyn;
             StopWorking.Status = HRM.Infrastructure.Utilities.EnumDropDown.StopWorkStatus.E_CANCEL.ToString();
             profile.StopWorkType = null;
             profile.TypeSuspense = null;
             profile.RequestDate = null;
             profile.DateQuit = null;
             profile.ResReasonID = null;
             profile.IsHoldSal = false;
             profile.ResignNo = null;
             profile.TypeOfStop = null;
             profileServices.Edit(profile);
         }
         repo.SaveChanges();
         message = NotificationType.Success.ToString();
         return message;
     }
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Lay DS luong hieu luc cua toan cong ty. Moi nhan vien chi co 1 muc luong trong danh sach.
        /// </summary>
        /// <param name="lstSalaryAll">get all Salary</param>
        /// <param name="monthEffect"></param>
        /// <returns></returns>


        public void Approved(List<Guid> selectedIds, string status, string userLoginName)
        {
            using (var context = new VnrHrmDataContext())
            {
                string statusMessage = string.Empty;
                var unitOfWork = (IUnitOfWork)(new UnitOfWork(context));
                var repoProfile = new Hre_ProfileRepository(unitOfWork);
                var repoHoldSalary = new Sal_HoldSalaryRepository(unitOfWork);
                var lstHoldSalary = repoHoldSalary.FindBy(s => selectedIds.Contains(s.ID)).ToList();
                var lstProfileIDs = lstHoldSalary.Select(s => s.ProfileID).ToList();
                var profileServices = new Hre_ProfileServices();
                var objProfile = new List<object>();
                objProfile.AddRange(new object[17]);
                objProfile[15] = 1;
                objProfile[16] = int.MaxValue - 1;
                var lstProfile = profileServices.GetData<Hre_ProfileEntity>(objProfile, ConstantSql.hrm_hr_sp_get_ProfileAll,userLoginName, ref statusMessage).ToList().Translate<Hre_Profile>();
                //var lstProfiles = repoProfile.FindBy(m => m.ID != null && lstProfileIDs.Contains(m.ID)).ToList();

                foreach (var holdSalary in lstHoldSalary)
                {
                    holdSalary.Status = status;
                    var profileByID = lstProfile.Where(s => s.ID == holdSalary.ProfileID.Value).FirstOrDefault();
                    profileByID.MonthHoldSal = holdSalary.MonthSalary;
                    profileByID.IsHoldSal = true;
                }
                repoHoldSalary.SaveChanges();
                repoProfile.SaveChanges();


            }
        }
Ejemplo n.º 3
0
 /// <summary>
 /// [Tho.Bui] - Lấy dữ liệu Nhân Viên (Hre_ProfilePartyUnion) theo ProfileId
 /// </summary>
 /// <param name="id"></param>
 /// <returns></returns>
 public Hre_ProfilePartyUnionModel Put(Hre_ProfilePartyUnionModel model)
 {
     var service = new Hre_ProfileServices();
     string status = string.Empty;
     List<object> listObj = new List<object>() { model.ProfileID };
     var entity = service.GetData<Hre_ProfilePartyUnionEntity>(listObj, ConstantSql.hrm_hr_sp_get_ProfilePartyUnionprofileId, UserLogin, ref status).FirstOrDefault();
     var model1 = entity.CopyData<Hre_ProfilePartyUnionModel>();
     model.ActionStatus = status;
     return model1;
 }
Ejemplo n.º 4
0
 /// <summary> Load Profile la nguoi phê duyệt </summary>
 /// <param name="text"></param>
 /// <returns></returns>
 public JsonResult GetMultiProfileApprove(string text)
 {
     string status = string.Empty;
     var service = new Hre_ProfileServices();
     var get = service.GetData<Hre_ProfileMultiEntity>(text, ConstantSql.hrm_hr_sp_get_ApproveProfile_multi, UserLogin, ref status);
     var result = get.Select(item => new Hre_ProfileMultiModel()
     {
         ID = item.ID,
         ProfileName = item.ProfileName,
     });
     return Json(result, JsonRequestBehavior.AllowGet);
 }
Ejemplo n.º 5
0
        public ActionResult Paysips(string userLogin)
        {
            if (!CheckPermission()) return RedirectToAction("Denied", "Portal");
            var id = Session[SessionObjects.ProfileID];
            var service = new Hre_ProfileServices();
            string status = string.Empty;
            var listModel = service.GetData<Hre_ProfileModelPortal>(HRM.Infrastructure.Utilities.Common.DotNetToOracle(id.ToString()), ConstantSql.hrm_hr_sp_get_ProfileById, userLogin, ref status).FirstOrDefault();
            if (listModel != null)
            {
                Session["ProfileName"] = listModel.ProfileName;
                listModel.ActionStatus = status;
            }
            return GetOnlyView(listModel);

           
        }
        public Ins_InsuranceSalaryPaybackModel Post([Bind]Ins_InsuranceSalaryPaybackModel model)
        {
            var hrService = new Hre_ProfileServices();
            var baseService = new BaseService();
            string status = string.Empty;
            #region Validate
            string message = string.Empty;
            var checkValidate = HRM.Business.Main.Domain.ValidatorService.OnValidateData<Ins_InsuranceSalaryPaybackModel>(model, "Ins_InsuranceSalaryPayback", ref message);
            if (!checkValidate)
            {
                model.ActionStatus = message;
                return model;
            }
            #endregion

            ActionService service = new ActionService(UserLogin);
            return service.UpdateOrCreate<Ins_InsuranceSalaryPaybackEntity, Ins_InsuranceSalaryPaybackModel>(model);
        }
Ejemplo n.º 7
0
 public JsonResult GetMultiProfileOrQuit(string text,bool isProfileQuit)
 {
     //hrm_hr_sp_get_ProfileQuit_multi
     string status = string.Empty;
     var service = new Hre_ProfileServices();
     var get = service.GetData<Hre_ProfileMultiEntity>(text, ConstantSql.hrm_hr_sp_get_Profile_multi, UserLogin, ref status);
     if (isProfileQuit)
     {
         get = service.GetData<Hre_ProfileMultiEntity>(text, ConstantSql.hrm_hr_sp_get_ProfileQuit_multi, UserLogin, ref status);
     }
     if (get != null)
     {
         var result = get.Select(item => new Hre_ProfileMultiModel()
         {
             ID = item.ID,
             ProfileName = item.ProfileName,
         });
         return Json(result, JsonRequestBehavior.AllowGet);
     }
     return Json(null);            
 }
Ejemplo n.º 8
0
        /// <summary>
        /// [Chuc.Nguyen] - Lấy dữ liệu Nhân Viên (Hre_Profile) theo Id
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public Hre_ProfileModel GetById(Guid id)
        {
            var service = new Hre_ProfileServices();
            string status = string.Empty;
            var entity = service.GetData<Hre_ProfileEntity>(Common.DotNetToOracle(id.ToString()), ConstantSql.hrm_hr_sp_get_ProfileById, UserLogin, ref status).FirstOrDefault();
            //xu ly tam de lay ten loai nghi viec vi hien tai left join nhiu qa trong store khong chay dc
            if (entity.TypeOfStopID != null)
            {
                var catservice = new Cat_NameEntityServices();
                var entityNameEntity = catservice.GetData<Cat_NameEntityEntity>(Common.DotNetToOracle(entity.TypeOfStopID.ToString()), ConstantSql.hrm_cat_sp_get_NameEntityById, UserLogin, ref status).FirstOrDefault();
                if (entityNameEntity != null)
                {
                    entity.TypeOfStopName = entityNameEntity.NameEntityName;
                }

            }
            var model = entity.CopyData<Hre_ProfileModel>();
            if (model != null && model.DateOfEffect != null)
            {
                model.DateOfEffectOld = model.DateOfEffect;
            }
            model.ActionStatus = status;
            return model;
        }
Ejemplo n.º 9
0
        public List<Eva_EvalutionDataEntity> SummaryEvalutionData(int year, Guid? _TimesGetDataID, string orgStructureID, DateTime? _daystart, DateTime? _dayend,string userLogin)
        {
            using (var context = new VnrHrmDataContext())
            {
                //    #region Get Data
                string status = string.Empty;
                List<Eva_EvalutionDataEntity> lstEvalutionDataEntity = new List<Eva_EvalutionDataEntity>();

                //    //ds nv
                var hrService = new Hre_ProfileServices();
                var service = new BaseService();
                List<object> strOrgIDs = new List<object>();
                strOrgIDs.AddRange(new object[1]);
                strOrgIDs[0] = (object)orgStructureID;

                var lstProfile = hrService.GetData<Hre_ProfileEntity>(strOrgIDs, ConstantSql.hrm_eva_sp_getdata_ProfileByOrg, userLogin, ref status).ToList();
                if (lstProfile == null || lstProfile.Count == 0)
                    return lstEvalutionDataEntity;
                List<Guid> lstProfileIDs = lstProfile.Select(s => s.ID).ToList();
                IUnitOfWork unitOfWork = new UnitOfWork(context);
                var lstattattendancetable = new List<Att_AttendanceTable>().Select(d => new
                {
                    d.LateEarlyDeductionHours,
                    d.ProfileID
                }).ToList();

                foreach (var lstProfileID in lstProfileIDs.Chunk(1000))
                {
                    lstattattendancetable.AddRange(unitOfWork.CreateQueryable<Att_AttendanceTable>(Guid.Empty,
                        d => lstProfileID.Contains(d.ProfileID) && d.MonthYear >= _daystart
                            && d.MonthYear <= _dayend).Select(d => new
                            {
                                d.LateEarlyDeductionHours,
                                d.ProfileID
                            }).ToList());
                }

                #region Lay cau hinh luu vao cot C1->C16
                Sys_AttOvertimePermitConfigServices sysServices = new Sys_AttOvertimePermitConfigServices();
                string DataC1 = sysServices.GetConfigValue<string>(AppConfig.HRM_EVA_CONFIG_SAVE_C1);
                string DataC2 = sysServices.GetConfigValue<string>(AppConfig.HRM_EVA_CONFIG_SAVE_C2);
                string DataC3 = sysServices.GetConfigValue<string>(AppConfig.HRM_EVA_CONFIG_SAVE_C3);
                string DataC4 = sysServices.GetConfigValue<string>(AppConfig.HRM_EVA_CONFIG_SAVE_C4);
                string DataC5 = sysServices.GetConfigValue<string>(AppConfig.HRM_EVA_CONFIG_SAVE_C5);
                string DataC6 = sysServices.GetConfigValue<string>(AppConfig.HRM_EVA_CONFIG_SAVE_C6);
                string DataC7 = sysServices.GetConfigValue<string>(AppConfig.HRM_EVA_CONFIG_SAVE_C7);
                string DataC8 = sysServices.GetConfigValue<string>(AppConfig.HRM_EVA_CONFIG_SAVE_C8);
                string DataC9 = sysServices.GetConfigValue<string>(AppConfig.HRM_EVA_CONFIG_SAVE_C9);
                string DataC10 = sysServices.GetConfigValue<string>(AppConfig.HRM_EVA_CONFIG_SAVE_C10);
                string DataC11 = sysServices.GetConfigValue<string>(AppConfig.HRM_EVA_CONFIG_SAVE_C11);
                string DataC12 = sysServices.GetConfigValue<string>(AppConfig.HRM_EVA_CONFIG_SAVE_C12);
                string DataC13 = sysServices.GetConfigValue<string>(AppConfig.HRM_EVA_CONFIG_SAVE_C13);
                string DataC14 = sysServices.GetConfigValue<string>(AppConfig.HRM_EVA_CONFIG_SAVE_C14);
                string DataC15 = sysServices.GetConfigValue<string>(AppConfig.HRM_EVA_CONFIG_SAVE_C15);
                string DataC16 = sysServices.GetConfigValue<string>(AppConfig.HRM_EVA_CONFIG_SAVE_C16);
                #endregion

                string[] lstDataC1 = null;
                string[] lstDataC2 = null;
                string[] lstDataC3 = null;
                string[] lstDataC4 = null;
                string[] lstDataC5 = null;
                string[] lstDataC6 = null;
                string[] lstDataC7 = null;
                string[] lstDataC8 = null;
                List<Cat_LeaveDayTypeEntity> templstleavedaytypeC1 = null;
                List<Cat_LeaveDayTypeEntity> templstleavedaytypeC2 = null;
                List<Cat_LeaveDayTypeEntity> templstleavedaytypeC3 = null;
                List<Cat_LeaveDayTypeEntity> templstleavedaytypeC4 = null;
                List<Cat_LeaveDayTypeEntity> templstleavedaytypeC5 = null;
                List<Cat_LeaveDayTypeEntity> templstleavedaytypeC6 = null;
                List<Cat_LeaveDayTypeEntity> templstleavedaytypeC7 = null;
                List<Cat_LeaveDayTypeEntity> templstleavedaytypeC8 = null;
                List<object> tempobjparam = new List<object>();
                tempobjparam.Add(orgStructureID);
                var tempcatService = new Cat_LeaveDayTypeServices();
                var templstcatLeaveDayType = tempcatService.GetData<Cat_LeaveDayTypeEntity>(tempobjparam, ConstantSql.hrm_cat_getdata_LeaveDayType, userLogin, ref status).ToList();
                if (templstcatLeaveDayType.Count > 0)
                {

                    #region Loai Nghi
                    #region C1
                    if (DataC1 != null)
                    {
                        DataC1 = DataC1.Replace(" ", "").Trim();
                        lstDataC1 = DataC1.Split(',').ToArray();
                        if (lstDataC1 != null && lstDataC1.Count() > 0)
                        {
                            templstleavedaytypeC1 = templstcatLeaveDayType.Where(s => lstDataC1.Contains(s.Code)).ToList();
                        }
                    }
                    #endregion
                    #region C2
                    if (DataC2 != null)
                    {
                        DataC2 = DataC2.Replace(" ", "").Trim();
                        lstDataC2 = DataC2.Split(',').ToArray();
                        if (lstDataC2 != null && lstDataC2.Count() > 0)
                        {
                            templstleavedaytypeC2 = templstcatLeaveDayType.Where(s => lstDataC2.Contains(s.Code)).ToList();
                        }
                    }
                    #endregion
                    #region C3
                    if (DataC3 != null)
                    {
                        DataC3 = DataC3.Replace(" ", "").Trim();
                        lstDataC3 = DataC3.Split(',').ToArray();
                        if (lstDataC3 != null && lstDataC3.Count() > 0)
                        {
                            templstleavedaytypeC3 = templstcatLeaveDayType.Where(s => lstDataC3.Contains(s.Code)).ToList();
                        }
                    }
                    #endregion
                    #region C4
                    if (DataC4 != null)
                    {
                        DataC4 = DataC4.Replace(" ", "").Trim();
                        lstDataC4 = DataC4.Split(',').ToArray();
                        if (lstDataC4 != null && lstDataC4.Count() > 0)
                        {
                            templstleavedaytypeC4 = templstcatLeaveDayType.Where(s => lstDataC4.Contains(s.Code)).ToList();
                        }
                    }
                    #endregion
                    #region C5
                    if (DataC5 != null)
                    {
                        DataC5 = DataC5.Replace(" ", "").Trim();
                        lstDataC5 = DataC5.Split(',').ToArray();
                        if (lstDataC5 != null && lstDataC5.Count() > 0)
                        {
                            templstleavedaytypeC5 = templstcatLeaveDayType.Where(s => lstDataC5.Contains(s.Code)).ToList();
                        }
                    }
                    #endregion
                    #region C6
                    if (DataC6 != null)
                    {
                        DataC6 = DataC6.Replace(" ", "").Trim();
                        lstDataC6 = DataC6.Split(',').ToArray();
                        if (lstDataC6 != null && lstDataC6.Count() > 0)
                        {
                            templstleavedaytypeC6 = templstcatLeaveDayType.Where(s => lstDataC6.Contains(s.Code)).ToList();
                        }
                    }
                    #endregion
                    #region C7
                    if (DataC7 != null)
                    {
                        DataC7 = DataC7.Replace(" ", "").Trim();
                        lstDataC7 = DataC7.Split(',').ToArray();
                        if (lstDataC7 != null && lstDataC7.Count() > 0)
                        {
                            templstleavedaytypeC7 = templstcatLeaveDayType.Where(s => lstDataC7.Contains(s.Code)).ToList();
                        }
                    }
                    #endregion
                    #region C8
                    if (DataC8 != null)
                    {
                        DataC8 = DataC8.Replace(" ", "").Trim();
                        lstDataC8 = DataC8.Split(',').ToArray();
                        if (lstDataC8 != null && lstDataC8.Count() > 0)
                        {
                            templstleavedaytypeC8 = templstcatLeaveDayType.Where(s => lstDataC8.Contains(s.Code)).ToList();
                        }
                    }
                    #endregion
                    #endregion
                }
                #region doi tuong loc theo loai nghi
                //var catService = new Cat_LeaveDayTypeServices();
                //List<object> objparam = new List<object>();
                //objparam.Add(orgStructureID);
                //var lstcatLeaveDayType = catService.GetData<Cat_LeaveDayTypeEntity>(objparam, ConstantSql.hrm_cat_getdata_LeaveDayType, ref status).ToList();
                //var lstleavedaytypeC1 = lstcatLeaveDayType.Where(s => s.Code == "P").ToList();
                //var lstleavedaytypeC2 = lstcatLeaveDayType.Where(s => s.Code == "M" || s.Code == "SM" || s.Code == "SP" || s.Code == "DL" || s.Code == "DSP").ToList();
                //var lstleavedaytypeC3 = lstcatLeaveDayType.Where(s => s.Code == "SU" || s.Code == "SC").ToList();
                //var lstleavedaytypeC4 = lstcatLeaveDayType.Where(s => s.Code == "DP" || s.Code == "SD").ToList();
                //var lstleavedaytypeC5 = lstcatLeaveDayType.Where(s => s.Code == "AL").ToList();
                //var lstleavedaytypeC7 = lstcatLeaveDayType.Where(s => s.Code == "D").ToList();
                Dictionary<string, List<Cat_LeaveDayTypeEntity>> dicLeaveByType = new Dictionary<string, List<Cat_LeaveDayTypeEntity>>();
                //dicLeaveByType.Add("C1", lstleavedaytypeC1);
                //dicLeaveByType.Add("C2", lstleavedaytypeC2);
                //dicLeaveByType.Add("C3", lstleavedaytypeC3);
                //dicLeaveByType.Add("C4", lstleavedaytypeC4);
                //dicLeaveByType.Add("C5", lstleavedaytypeC5);
                //dicLeaveByType.Add("C7", lstleavedaytypeC7);
                if (templstleavedaytypeC1 != null && templstleavedaytypeC1.Count > 0)
                    dicLeaveByType.Add("C1", templstleavedaytypeC1);
                if (templstleavedaytypeC2 != null && templstleavedaytypeC2.Count > 0)
                    dicLeaveByType.Add("C2", templstleavedaytypeC2);
                if (templstleavedaytypeC3 != null && templstleavedaytypeC3.Count > 0)
                    dicLeaveByType.Add("C3", templstleavedaytypeC3);
                if (templstleavedaytypeC4 != null && templstleavedaytypeC4.Count > 0)
                    dicLeaveByType.Add("C4", templstleavedaytypeC4);
                if (templstleavedaytypeC5 != null && templstleavedaytypeC5.Count > 0)
                    dicLeaveByType.Add("C5", templstleavedaytypeC5);
                if (templstleavedaytypeC6 != null && templstleavedaytypeC6.Count > 0)
                    dicLeaveByType.Add("C6", templstleavedaytypeC6);
                if (templstleavedaytypeC7 != null && templstleavedaytypeC7.Count > 0)
                    dicLeaveByType.Add("C7", templstleavedaytypeC7);
                if (templstleavedaytypeC8 != null && templstleavedaytypeC8.Count > 0)
                    dicLeaveByType.Add("C8", templstleavedaytypeC8);
                #endregion
                #region ngay nghi
                string strE_APPROVED = LeaveDayStatus.E_APPROVED.ToString();
                var lstLeaveDay = new List<Att_LeaveDay>().Select(d => new
                {
                    d.LeaveDayTypeID,
                    d.ProfileID,
                    d.LeaveDays,
                    d.DateStart,
                    d.DateEnd
                }).ToList();

                foreach (var lstProfileID in lstProfileIDs.Chunk(1000))
                {
                    lstLeaveDay.AddRange(unitOfWork.CreateQueryable<Att_LeaveDay>(Guid.Empty,
                        d => lstProfileID.Contains(d.ProfileID) && d.DateStart <= _dayend
                            && d.DateEnd >= _daystart && d.Status == strE_APPROVED).Select(d => new
                            {
                                d.LeaveDayTypeID,
                                d.ProfileID,
                                d.LeaveDays,
                                d.DateStart,
                                d.DateEnd
                            }).ToList());
                }
                #endregion
                #region ky luat
                var lsthreDiscipline = new List<Hre_Discipline>().Select(d => new
                {
                    d.DisciplinedTypesSuggestID,
                    d.ProfileID
                }).ToList();

                foreach (var lstProfileID in lstProfileIDs.Chunk(1000))
                {
                    lsthreDiscipline.AddRange(unitOfWork.CreateQueryable<Hre_Discipline>(Guid.Empty,
                        d => lstProfileID.Contains(d.ProfileID) && d.DateOfEffective >= _daystart
                            && d.DateOfEffective <= _dayend).Select(d => new
                            {
                                d.DisciplinedTypesSuggestID,
                                d.ProfileID
                            }).ToList());
                }
                #endregion
                #region loai ky luat
                List<object> paraDisciplinedTypes = new List<object>();
                paraDisciplinedTypes.AddRange(new object[3]);
                paraDisciplinedTypes[1] = 1;
                paraDisciplinedTypes[2] = int.MaxValue;
                var catSerciceDisciplinedTypes = new Cat_DisciplinedTypesServices();
                var lstDisciplinedTypes = catSerciceDisciplinedTypes.GetData<Cat_DisciplinedTypesEntity>(paraDisciplinedTypes, ConstantSql.hrm_cat_sp_get_DisciplinedTypes, userLogin, ref status);
                //var objDisciplinedTypeVW = lstDisciplinedTypes.Where(s => s.Code == "VW").FirstOrDefault();
                //var objDisciplinedTypeWW = lstDisciplinedTypes.Where(s => s.Code == "WW").FirstOrDefault();
                //var objDisciplinedTypeDS = lstDisciplinedTypes.Where(s => s.Code == "DS").FirstOrDefault();

                Cat_DisciplinedTypesEntity tempobjDisciplinedType11 = null;
                Cat_DisciplinedTypesEntity tempobjDisciplinedType12 = null;
                Cat_DisciplinedTypesEntity tempobjDisciplinedType13 = null;
                #endregion
                #region Loai ky luat
                if (lstDisciplinedTypes != null)
                {
                    #region C11
                    if (DataC11 != null)
                    {
                        DataC11 = DataC11.Replace(" ", "").Trim();
                        tempobjDisciplinedType11 = lstDisciplinedTypes.Where(s => s.Code == DataC11).FirstOrDefault();
                    }
                    #endregion
                    #region C12
                    if (DataC12 != null)
                    {
                        DataC12 = DataC12.Replace(" ", "").Trim();
                        tempobjDisciplinedType12 = lstDisciplinedTypes.Where(s => s.Code == DataC12).FirstOrDefault();
                    }
                    #endregion
                    #region C13
                    if (DataC13 != null)
                    {
                        DataC13 = DataC13.Replace(" ", "").Trim();
                        tempobjDisciplinedType13 = lstDisciplinedTypes.Where(s => s.Code == DataC13).FirstOrDefault();
                    }
                    #endregion
                }

                #endregion
                #region Danh gia
                var kaiServiceKaizenData = new Kai_KaiZenDataServices();
                var listKaiKaizenData = new List<Kai_KaizenData>().Select(d => new
                {
                    d.Accumulate,
                    d.MarkPerform,
                    d.ProfileID
                }).ToList();

                foreach (var lstProfileID in lstProfileIDs.Chunk(1000))
                {
                    listKaiKaizenData.AddRange(unitOfWork.CreateQueryable<Kai_KaizenData>(Guid.Empty, d => d.ProfileID.HasValue
                        && lstProfileID.Contains(d.ProfileID.Value) && d.Month >= _daystart && d.Month <= _dayend).Select(d => new
                        {
                            d.Accumulate,
                            d.MarkPerform,
                            d.ProfileID
                        }).ToList());
                }
                #endregion
                #region Loai thieu quet the la quen quet the voi ma la FC
                var objTamScanResonMissID = unitOfWork.CreateQueryable<Cat_TAMScanReasonMiss>(Guid.Empty, s => s.Code.Trim() == "FC").Select(s => s.ID).FirstOrDefault();
                #endregion
                #region lay du lieu quen quet the
          
                var lstworkDayProfiles = new List<Att_Workday>().Select(d => new
                {
                    d.ProfileID,
                    d.WorkDate
                    
                }).ToList();
                if (objTamScanResonMissID != null)
                {
                    List<string> lstType = new List<string> 
                    { 
                        WorkdayType.E_MISS_IN.ToString(),
                        WorkdayType.E_MISS_IN_OUT.ToString(),
                        WorkdayType.E_MISS_OUT.ToString()
                    };
                    foreach (var lstProfileID in lstProfileIDs.Chunk(1000))
                    {
                        lstworkDayProfiles.AddRange(unitOfWork.CreateQueryable<Att_Workday>(Guid.Empty, d => lstProfileID.Contains(d.ProfileID) && _daystart <= d.WorkDate && d.WorkDate <= _dayend && lstType.Contains(d.Type) && d.MissInOutReason == objTamScanResonMissID).Select(d => new
                        {
                            d.ProfileID,
                            d.WorkDate
                        }).ToList());
                    }
                }
              
                #endregion
                bool? _tempC9LATEEARLYDEDUCTIONHOURS = false;
                bool? _tempC9FAILINGTORECORDCARD = false;
                bool? _tempC10LATEEARLYDEDUCTIONHOURS = false;
                bool? _tempC10FAILINGTORECORDCARD = false;

                #region xac dinh dlieu luu cot C9 va C10
                if (DataC9 != null)
                {
                    if (DataC9.Replace(" ", "").Trim() == "LATEEARLYDEDUCTIONHOURS")
                    {
                        _tempC9LATEEARLYDEDUCTIONHOURS = true;
                    }
                    else if (DataC9.Replace(" ", "").Trim() == "FAILINGTORECORDCARD")
                    {
                        _tempC9FAILINGTORECORDCARD = true;
                    }
                }
                if (DataC10 != null)
                {
                    if (DataC10.Replace(" ", "").Trim() == "LATEEARLYDEDUCTIONHOURS")
                    {
                        _tempC10LATEEARLYDEDUCTIONHOURS = true;
                    }
                    else if (DataC10.Replace(" ", "").Trim() == "FAILINGTORECORDCARD")
                    {
                        _tempC10FAILINGTORECORDCARD = true;
                    }
                }
                #endregion
                #region xac dinh dlieu luu cot C14->C16
                bool? _tempC14MARKPERFORM = false;
                bool? _tempC14ACCUMULATE = false;
                bool? _tempC15MARKPERFORM = false;
                bool? _tempC15ACCUMULATE = false;
                bool? _tempC16MARKPERFORM = false;
                bool? _tempC16ACCUMULATE = false;

                if (DataC14 != null)
                {
                    if (DataC14.Replace(" ", "").Trim() == "MARKPERFORM")
                    {
                        _tempC14MARKPERFORM = true;
                    }
                    else if (DataC14.Replace(" ", "").Trim() == "ACCUMULATE")
                    {
                        _tempC14ACCUMULATE = true;
                    }
                }
                if (DataC15 != null)
                {
                    if (DataC15.Replace(" ", "").Trim() == "MARKPERFORM")
                    {
                        _tempC15MARKPERFORM = true;
                    }
                    else if (DataC15.Replace(" ", "").Trim() == "ACCUMULATE")
                    {
                        _tempC15ACCUMULATE = true;
                    }
                }
                if (DataC16 != null)
                {
                    if (DataC16.Replace(" ", "").Trim() == "MARKPERFORM")
                    {
                        _tempC16MARKPERFORM = true;
                    }
                    else if (DataC16.Replace(" ", "").Trim() == "ACCUMULATE")
                    {
                        _tempC16ACCUMULATE = true;
                    }
                }

                #endregion

                foreach (var profile in lstProfile)
                {
                    Eva_EvalutionDataEntity entity = new Eva_EvalutionDataEntity();
                    entity.CodeEmp = profile.CodeEmp;
                    entity.ProfileName = profile.ProfileName;
                    entity.ProfileID = profile.ID;
                    entity.TimesGetDataID = _TimesGetDataID;
                    entity.Year = new DateTime(year, 01, 01);
                    int C1 = 0;
                    int C2 = 0;
                    int C3 = 0;
                    int C4 = 0;
                    int C5 = 0;
                    int C6 = 0;
                    int C7 = 0;
                    int C8 = 0;
                    int C9 = 0;
                    int C10 = 0;
                    var lstLeaveDayprofile = lstLeaveDay.Where(s => s.ProfileID == profile.ID).ToList();
                    if (lstLeaveDayprofile.Count > 0)
                    {
                        foreach (var attLeaveDayprofile in lstLeaveDayprofile)
                        {
                            #region C1->C8
                            foreach (var item in dicLeaveByType)
                            {
                                List<Cat_LeaveDayTypeEntity> lstLeavetype = (List<Cat_LeaveDayTypeEntity>)item.Value;
                                int temp = 0;
                                if (attLeaveDayprofile.LeaveDayTypeID != null && lstLeavetype.Any(m => m.ID == attLeaveDayprofile.LeaveDayTypeID) && attLeaveDayprofile.LeaveDays > 0)
                                {
                                    string _strLeaveDays = attLeaveDayprofile.LeaveDays.ToString();
                                    string[] _partLeaveDays = _strLeaveDays.Split('.');
                                    int _intLeaveDays = int.Parse(_partLeaveDays[0]);
                                    if (_partLeaveDays.Count() > 1)
                                    {
                                        int _modLeaveDays = int.Parse(_partLeaveDays[1]);
                                        if (_modLeaveDays > 0)
                                        {
                                            temp += _intLeaveDays + 1;
                                        }
                                    }
                                    else
                                    {
                                        temp += _intLeaveDays;
                                    }
                                }
                                if (item.Key == "C1")
                                {
                                    C1 += temp;
                                }
                                if (item.Key == "C2")
                                {
                                    C2 += temp;
                                }
                                if (item.Key == "C3")
                                {
                                    C3 += temp;
                                }
                                if (item.Key == "C4")
                                {
                                    C4 += temp;
                                }
                                if (item.Key == "C5")
                                {
                                    C5 += temp;
                                }
                                if (item.Key == "C6")
                                {
                                    C6 += temp;
                                }
                                if (item.Key == "C7")
                                {
                                    C7 += temp;
                                }
                                if (item.Key == "C8")
                                {
                                    C8 += temp;
                                }
                            }
                        }
                            #endregion
                    }

                    #region tong tre som va quen quet the C9->C10
                    #region C9
                    if (_tempC9LATEEARLYDEDUCTIONHOURS == true)
                    {
                        var lstattattendancetableprofile = lstattattendancetable.Where(s => s.ProfileID == profile.ID).ToList();
                        if (lstattattendancetableprofile.Count > 0)
                        {
                            C9 = lstattattendancetableprofile.Where(s => s.LateEarlyDeductionHours > 0).Count();
                        }
                    }
                    else if (_tempC9FAILINGTORECORDCARD == true)
                    {
                        var lstworkDayprofile = lstworkDayProfiles.Where(s => s.ProfileID == profile.ID).ToList();
                        if (lstworkDayprofile.Count > 0)
                        {
                            C9 = lstworkDayprofile.Count();
                        }
                        if (lstLeaveDayprofile.Count > 0)
                        {
                            foreach (var objWorkDay in lstworkDayprofile)
                            {
                                var objLeaveDayByWorkDay = lstLeaveDayprofile.Where(s => s.DateStart <= objWorkDay.WorkDate && s.DateEnd >= objWorkDay.WorkDate).ToList();
                                if (objLeaveDayByWorkDay.Count > 0)
                                {
                                    C9 -= 1;
                                }
                            }
                        }
                    }
                    #endregion
                    #region C10
                    if (_tempC10LATEEARLYDEDUCTIONHOURS == true)
                    {
                        var lstattattendancetableprofile = lstattattendancetable.Where(s => s.ProfileID == profile.ID).ToList();
                        if (lstattattendancetableprofile.Count > 0)
                        {
                            C10 = lstattattendancetableprofile.Where(s => s.LateEarlyDeductionHours > 0).Count();
                        }
                    }
                    else if (_tempC10FAILINGTORECORDCARD == true)
                    {
                        var lstworkDayprofile = lstworkDayProfiles.Where(s => s.ProfileID == profile.ID).ToList();
                        if (lstworkDayprofile.Count > 0)
                        {
                            C10 = lstworkDayprofile.Count();
                        }
                        if (lstLeaveDayprofile.Count>0)
                        {
                            foreach (var objWorkDay in lstworkDayprofile)
                            {
                                var objLeaveDayByWorkDay = lstLeaveDayprofile.Where(s => s.DateStart <= objWorkDay.WorkDate && s.DateEnd >= objWorkDay.WorkDate).ToList();
                                if (objLeaveDayByWorkDay.Count > 0)
                                {
                                    C10 -= 1;
                                }
                            }
                        }
                    }
                    #endregion
                    #endregion
                    if (C1 > 0)
                        entity.C1 = C1;
                    if (C2 > 0)
                        entity.C2 = C2;
                    if (C3 > 0)
                        entity.C3 = C3;
                    if (C4 > 0)
                        entity.C4 = C4;
                    if (C5 > 0)
                        entity.C5 = C5;
                    if (C6 > 0)
                        entity.C6 = C6;
                    if (C7 > 0)
                        entity.C7 = C7;
                    if (C8 > 0)
                        entity.C8 = C8;
                    if (C9 > 0)
                        entity.C9 = C9;
                    if (C10 > 0)
                        entity.C10 = C10;
                    #region C11->C13
                    if (lsthreDiscipline.Count > 0)
                    {
                        var lsthreDisciplineprofile = lsthreDiscipline.Where(s => s.ProfileID == profile.ID).ToList();
                        if (lsthreDisciplineprofile.Count > 0)
                        {
                            if (tempobjDisciplinedType11 != null)
                            {
                                var lsthreDiscipline11 = lsthreDisciplineprofile.Where(s => s.DisciplinedTypesSuggestID == tempobjDisciplinedType11.ID).ToList();
                                if (lsthreDiscipline11.Count > 0)
                                    entity.C11 = lsthreDiscipline11.Count;
                            }
                            if (tempobjDisciplinedType12 != null)
                            {
                                var lsthreDiscipline12 = lsthreDisciplineprofile.Where(s => s.DisciplinedTypesSuggestID == tempobjDisciplinedType12.ID).ToList();
                                if (lsthreDiscipline12.Count > 0)
                                    entity.C12 = lsthreDiscipline12.Count;
                            }
                            if (tempobjDisciplinedType13 != null)
                            {
                                var lsthreDiscipline13 = lsthreDisciplineprofile.Where(s => s.DisciplinedTypesSuggestID == tempobjDisciplinedType13.ID).ToList();
                                if (lsthreDiscipline13.Count > 0)
                                    entity.C13 = lsthreDiscipline13.Count;
                            }
                        }
                    }
                    #endregion
                    #region C14->C16
                    if (listKaiKaizenData.Count > 0)
                    {
                        var listKaiKaizenDataprofile = listKaiKaizenData.Where(s => s.ProfileID == profile.ID).ToList();
                        int _tempAccumulate = 0;
                        int _MarkPerform = 0;
                        if (listKaiKaizenDataprofile.Count > 0)
                        {
                            #region Danh Gia
                            _MarkPerform = listKaiKaizenDataprofile.Where(s => s.MarkPerform > 0).Count();
                            _tempAccumulate = int.Parse(listKaiKaizenDataprofile.Select(s => s.Accumulate).Sum().ToString());
                            #region C14
                            if (_tempC14MARKPERFORM == true && _MarkPerform > 0)
                            {
                                entity.C14 = _MarkPerform;
                            }
                            else if (_tempC14ACCUMULATE == true && _tempAccumulate > 0)
                            {
                                entity.C14 = _tempAccumulate;
                            }
                            #endregion
                            #region C15
                            if (_tempC15MARKPERFORM == true && _MarkPerform > 0)
                            {
                                entity.C15 = _MarkPerform;
                            }
                            else if (_tempC15ACCUMULATE == true && _tempAccumulate > 0)
                            {
                                entity.C15 = _tempAccumulate;
                            }
                            #endregion
                            #region C16
                            if (_tempC16MARKPERFORM == true && _MarkPerform > 0)
                            {
                                entity.C16 = _MarkPerform;
                            }
                            else if (_tempC16ACCUMULATE == true && _tempAccumulate > 0)
                            {
                                entity.C16 = _tempAccumulate;
                            }
                            #endregion
                            #endregion
                        }

                    }
                    #endregion
                    if (entity != null)
                    {
                        lstEvalutionDataEntity.Add(entity);
                    }
                }
                return lstEvalutionDataEntity;
                //    #endregion
            }
        }
Ejemplo n.º 10
0
        public Sal_InsuranceSalaryModel Post([Bind]Sal_InsuranceSalaryModel model)
        {
            #region Validate

            ActionService service = new ActionService(UserLogin);
            string message = string.Empty;
            bool checkValidate = true;
            if (model.IsCreateByProfile != null && model.IsCreateByProfile == true)
            {
                checkValidate = HRM.Business.Main.Domain.ValidatorService.OnValidateData<Sal_InsuranceSalaryModel>(model, "Sal_InsuranceSalaryByProfile", ref message);
                if (!checkValidate)
                {
                    model.ActionStatus = message;
                    return model;
                }
                return service.UpdateOrCreate<Sal_InsuranceSalaryEntity, Sal_InsuranceSalaryModel>(model);
            }

            //var checkValidate = HRM.Business.Main.Domain.ValidatorService.OnValidateData<Sal_InsuranceSalaryModel>(model, "Sal_InsuranceSalary", ref message);
            if (model.OrgStructureID != null && model.OrgStructureID != string.Empty)
            {
                checkValidate = HRM.Business.Main.Domain.ValidatorService.OnValidateData<Sal_InsuranceSalaryModel>(model, "Sal_InsuranceSalaryOrgStructure", ref message);
            }
            else
            {
                checkValidate = HRM.Business.Main.Domain.ValidatorService.OnValidateData<Sal_InsuranceSalaryModel>(model, "Sal_InsuranceSalary", ref message);
            }
            if (!checkValidate)
            {
                model.ActionStatus = message;
                return model;
            }
            #endregion

            string status = string.Empty;

            var hrService = new Hre_ProfileServices();
            var insuranceServices = new Sal_InsuranceSalaryServices();
            if (!string.IsNullOrEmpty(model.OrgStructureID))
            {
                List<Guid> listGuid = new List<Guid>();
                if (model.ProfileIDsExclude != null)
                {
                    var listStr = model.ProfileIDsExclude.Split(',');

                    if (listStr[0] != "")
                    {

                        foreach (var item in listStr)
                        {
                            listGuid.Add(Guid.Parse(item));
                        }
                    }
                }


                List<object> listObj = new List<object>();
                listObj.Add(model.OrgStructureID);
                listObj.Add(string.Empty);
                listObj.Add(string.Empty);
                var lstProfile = hrService.GetData<Hre_ProfileIdEntity>(listObj, ConstantSql.hrm_hr_sp_get_ProfileIdsByOrgStructure, userLogin, ref status).Select(s => s.ID).ToList();
                if (listGuid != null)
                {
                    lstProfile = lstProfile.Where(s => !listGuid.Contains(s)).ToList();
                }

                if (lstProfile.Count == 0 && model.ProfileID == Guid.Empty)
                {
                    model.ActionStatus = ConstantDisplay.HRM_Common_NotEmployee.TranslateString();
                    return model;
                }

                List<Sal_InsuranceSalaryEntity> lstGradeEntity = new List<Sal_InsuranceSalaryEntity>();

                foreach (var item in lstProfile)
                {
                    Sal_InsuranceSalaryEntity gradeEntity = new Sal_InsuranceSalaryEntity
                    {
                        ProfileID = item,
                        DateCreate = model.DateCreate,
                        DateLock = model.DateLock,
                        CurrencyID = model.CurrencyID,
                        InsuranceAmount = model.InsuranceAmount,
                        ID = model.ID,
                        DateEffect = model.DateEffect,
                        IsSocialIns = model.IsSocialIns,
                        IsMedicalIns = model.IsMedicalIns,
                        IsUnimploymentIns = model.IsUnimploymentIns,
                        IsDelete = model.IsDelete,
                        UserUpdate = model.UserCreate,
                        UserCreate = model.UserCreate,
                        DecisionNo = model.DecisionNo
                    };
                    //model.ActionStatus =  gradeServices.Add(gradeEntity);
                    lstGradeEntity.Add(gradeEntity);
                }
                model.ActionStatus = insuranceServices.Add(lstGradeEntity);
                return model;
            }
            if (!string.IsNullOrEmpty(model.ProfileIDs))
            {
                var listStr = model.ProfileIDs.Split(',');
                List<Guid> listGuid = new List<Guid>();
                if (listStr[0] != "")
                {
                    foreach (var item in listStr)
                    {
                        listGuid.Add(Guid.Parse(item));
                    }
                }
                List<Sal_InsuranceSalaryEntity> lstGradeEntity = new List<Sal_InsuranceSalaryEntity>();
                foreach (var item in listGuid)
                {
                    Sal_InsuranceSalaryEntity gradeEntity = new Sal_InsuranceSalaryEntity
                    {
                        ProfileID = item,
                        DateCreate = model.DateCreate,
                        DateLock = model.DateLock,
                        CurrencyID = model.CurrencyID,
                        InsuranceAmount = model.InsuranceAmount,
                        ID = model.ID,
                        DateEffect = model.DateEffect,
                        IsSocialIns = model.IsSocialIns,
                        IsMedicalIns = model.IsMedicalIns,
                        IsUnimploymentIns = model.IsUnimploymentIns,
                        IsDelete = model.IsDelete,
                        UserUpdate = model.UserCreate,
                        UserCreate = model.UserCreate,
                        DecisionNo = model.DecisionNo
                    };
                    //model.ActionStatus =  gradeServices.Add(gradeEntity);
                    lstGradeEntity.Add(gradeEntity);
                }
                model.ActionStatus = insuranceServices.Add(lstGradeEntity);
                return model;
            }

            return service.UpdateOrCreate<Sal_InsuranceSalaryEntity, Sal_InsuranceSalaryModel>(model);
        }
Ejemplo n.º 11
0
        public ActionResult GetReportDetailCard([DataSourceRequest] DataSourceRequest request, Can_ReportDetailCardSearchModel Model)
        {
            var service = new Can_ReportServices();
            var hrService = new Hre_ProfileServices();
            ListQueryModel lstModel = new ListQueryModel
            {
                PageIndex = request.Page,
                PageSize = request.PageSize,
                Filters = ExtractFilterAttributes(request),
                Sorts = ExtractSortAttributes(request)
            };
            DateTime From = SqlDateTime.MinValue.Value;
            DateTime To = SqlDateTime.MaxValue.Value;
            if (Model.DateFrom != null)
            {
                From = Model.DateFrom.Value;
            }
            if (Model.DateTo != null)
            {
                To = Model.DateTo.Value;
            }
            if (Model.CanteenID != null) Model.CanteenIDs.Add(Model.CanteenID);
            if (Model.CateringID != null) Model.CateringIDs.Add(Model.CateringID);
            if (Model.LineID != null) Model.LineIDs.Add(Model.LineID);
            var result = service.ReportDetailCard(Model.CateringIDs, Model.CanteenIDs, Model.LineIDs, From, To, Model.OrgStructureID);
            var rs = result.Translate<Can_ReportDetailCardModel>();

            #region xử lý xuất báo cáo

            if (Model.ExportID != Guid.Empty)
            {
                var fullPath = ExportService.Export(Model.ExportID, rs);
                return Json(fullPath);
            }
            #endregion
            request.Page = 1;
            var dataSourceResult = result.ToDataSourceResult(request);
            return Json(rs.ToDataSourceResult(request));
        }
Ejemplo n.º 12
0
        public ActionResult GetReportAdjustmentMealAllowancePayment([DataSourceRequest] DataSourceRequest request, Can_ReportAdjustmentMealAllowancePaymentModel Model)
        {
            var service = new Can_ReportServices();
            var hrService = new Hre_ProfileServices();
            var Actionservices = new ActionService(UserLogin);
            ListQueryModel lstModel = new ListQueryModel
            {
                PageIndex = request.Page,
                PageSize = request.PageSize,
                Filters = ExtractFilterAttributes(request),
                Sorts = ExtractSortAttributes(request)
            };
            DateTime From = SqlDateTime.MinValue.Value;
            DateTime To = SqlDateTime.MaxValue.Value;
            if (Model.DateFrom != null)
            {
                From = Model.DateFrom.Value;
            }
            if (Model.DateTo != null)
            {
                To = Model.DateTo.Value;
            }
            List<Guid?> OrgIds = new List<Guid?>();
            if (Model.OrgStructureID != null && Model.OrgStructureID.Count() > 0)
            {
                OrgIds = Model.OrgStructureID;
            }
            string strOrgIDs = Common.ListToString(OrgIds);
            string profileName = string.Empty;
            string codeEmp = string.Empty;
            if (Model.ProfileName != string.Empty)
            {
                profileName = Model.ProfileName;
            }

            if (Model.CodeEmp != string.Empty)
            {
                codeEmp = Model.CodeEmp;
            }
            List<Guid> lstProfileIDs = new List<Guid>();
            List<Object> Lstsearch = new List<object>();
            Lstsearch.Add(strOrgIDs);
            Lstsearch.Add(profileName);
            Lstsearch.Add(codeEmp);
            if (Model.OrgStructureID != null)
            {
                string status = string.Empty;
                lstProfileIDs = Actionservices.GetData<Hre_ProfileIdEntity>(Lstsearch, ConstantSql.hrm_hr_sp_get_ProfileIdsByOrg, ref status).Select(s => s.ID).ToList();
            }
            var result = service.ReportAdjustmentMealAllowancePayment(From, To, lstProfileIDs);
            if (Model.ExportID != Guid.Empty)
            {
                var fullPath = ExportService.Export(Model.ExportID, result);
                return Json(fullPath);
            }
            return Json(result.ToDataSourceResult(request));
        }
Ejemplo n.º 13
0
        public ActionResult GetMealRecordMissingList([DataSourceRequest] DataSourceRequest request, Can_MealRecordMissingSearchModel model)
        {
            var service = new Can_MealRecordMissingServices();
            var hrService = new Hre_ProfileServices();
            DateTime DateFrom = SqlDateTime.MinValue.Value;
            DateTime DateTo = SqlDateTime.MaxValue.Value;
            if (model.DateFrom != null)
            {
                DateFrom = model.DateFrom.Value;
            }
            if (model.DateTo != null)
            {
                DateTo = model.DateTo.Value;
            }
            //string strOrgIDs = Common.ListToString(model.OrgStructureID);
            #region xử lý lấy lstProfileIds theo OrgStructureID
            List<Guid> lstProfileIDs = new List<Guid>();
            string status = string.Empty;
            List<object> lstObj = new List<object>();

            //lstObj.Add(strOrgIDs); 
            lstObj.Add(model.OrgStructureID);
            lstObj.Add(null);
            lstObj.Add(null);
            List<Guid> _temp = new List<Guid>();
            List<Guid> _profileIDs = new List<Guid>();
            var baseService = new ActionService(UserLogin);
            if (model.ProfileIDSearch != null)
            {
                var lst = model.ProfileIDSearch.Split(',');
                _temp = lst.Select(Guid.Parse).ToList();

                if (model.OrgStructureID != null)
                {
                    lstProfileIDs = baseService.GetData<Hre_ProfileIdEntity>(lstObj, ConstantSql.hrm_hr_sp_get_ProfileIdsByOrg, ref status).Select(m => m.ID).ToList();
                    _profileIDs = lstProfileIDs.Where(m => !_temp.Contains(m)).ToList();
                    lstProfileIDs.AddRange(_profileIDs);
                }
                else
                {
                    lstProfileIDs = _temp;
                }
            }
            else
            {
                lstProfileIDs = baseService.GetData<Hre_ProfileIdEntity>(lstObj, ConstantSql.hrm_hr_sp_get_ProfileIdsByOrg, ref status).Select(m => m.ID).ToList();
            }
            #endregion
            // var result = service.GetAllUseEntity<Can_MealRecordMissingEntity>(ref status);

            service.ComputeMealRecordMissing(lstProfileIDs,
                DateFrom,
                DateTo,
                model.TamScanReasonMissID,
                model.Status,
                model.MealAllowanceTypeSettingID);
            return Json(true);
        }
        public Tra_RequirementTrainModel Post([Bind]Tra_RequirementTrainModel model)
        {
            #region Validate
            if(model.isAnalysis==true)
            {
                string message = string.Empty;
                var checkValidate = HRM.Business.Main.Domain.ValidatorService.OnValidateData<Tra_RequirementTrainModel>(model,"Tra_RequirementTrain_Tab", "Tra_RequirementTrain", ref message);
                if (!checkValidate)
                {
                    model.ActionStatus = message;
                    return model;
                }
            }
            #endregion

            var requirementDetailServices = new Tra_RequirementTrainDetailServices();
            var profileServices = new Hre_ProfileServices();
             string[] arrCodeEmp = new string[1];
             if (!string.IsNullOrEmpty(model.lstCodeEmp) && model.lstCodeEmp.IndexOf(',') > 1)
             {
                 arrCodeEmp = model.lstCodeEmp.Split(',').ToArray();
             }
             else {
                 arrCodeEmp[0] = model.lstCodeEmp;
             }
        
            ActionService service = new ActionService(UserLogin);
            string status = string.Empty;
            //var objProfile = new List<object>();
            //objProfile.AddRange(new object[17]);
            //objProfile[15] = 1;
            //objProfile[16] = int.MaxValue - 1;
            //var lstProfile = profileServices.GetData<Hre_ProfileEntity>(objProfile, ConstantSql.hrm_hr_sp_get_ProfileAll, UserLogin, ref status).ToList().Translate<Hre_ProfileModel>();
            //if (arrCodeEmp != null)
            //{
            //    lstProfile = lstProfile.Where(s => arrCodeEmp.Contains(s.CodeEmp)).ToList();
            //}
            var lstProfile = profileServices.GetData<Hre_ProfileEntity>(model.lstCodeEmp, ConstantSql.hrm_hr_sp_get_ProfileAllByCodeEmps, UserLogin, ref status).ToList().Translate<Hre_ProfileModel>();

            model = service.UpdateOrCreate<Tra_RequirementTrainEntity, Tra_RequirementTrainModel>(model);

            var objRequirementDetail = new List<object>();
            objRequirementDetail.Add(null);
            objRequirementDetail.Add(1);
            objRequirementDetail.Add(int.MaxValue -1);
            var lstRequirementDetail = requirementDetailServices.GetData<Tra_RequirementTrainDetailEntity>(objRequirementDetail,ConstantSql.hrm_tra_sp_get_RequirementDetail,UserLogin,ref status).ToList();
            foreach (var item in lstProfile)
            {
               
                var entity = lstRequirementDetail.Where(s => s.ProfileID == item.ID && s.RequirementTrainID == model.ID && s.CourseID == model.CourseID).FirstOrDefault();
             
                var requirementDetailEntity = new Tra_RequirementTrainDetailEntity();
                requirementDetailEntity.ProfileID = item.ID;
                requirementDetailEntity.RequirementTrainID = model.ID;
                requirementDetailEntity.CourseID = model.CourseID;
                requirementDetailEntity.YearAnalyze = model.DateSeniority;
                if (item.DateHire != null && model.DateSeniority != null)
                {
                    requirementDetailEntity.Seniority = Math.Floor(model.DateSeniority.Value.Subtract(item.DateHire.Value).TotalDays/30);
                }
                if (entity == null)
                {
                    model.ActionStatus = requirementDetailServices.Add(requirementDetailEntity);
                }
            }

            return model;
            //return service.UpdateOrCreate<Tra_RequirementTrainEntity, Tra_RequirementTrainModel>(model);
        }
Ejemplo n.º 15
0
        public DataTable GetReportRecieveObjectByTime(string orgStructureIDs, DateTime dateFrom, DateTime dateTo, bool IsCreateTemplate, string userLogin)
        {
            DataTable table = GetSchemaReportRecieveObjectByTime(userLogin);
            if (IsCreateTemplate)
            {
                return table.ConfigTable();
            }
            string status = string.Empty;
            using (var context = new VnrHrmDataContext())
            {
                var unitOfWork = (IUnitOfWork)(new UnitOfWork(context));
                var basevices = new BaseService();
                var hdtJobServices = new Hre_HDTJobServices();
                List<object> listObjHDTJob = new List<object>();
                listObjHDTJob.AddRange(new object[14]);
                listObjHDTJob[5] = orgStructureIDs;
                listObjHDTJob[6] = dateFrom;
                listObjHDTJob[7] = dateTo;
                listObjHDTJob[12] = 1;
                listObjHDTJob[13] = Int32.MaxValue - 1;
                var lstHDTJob = hdtJobServices.GetData<Hre_HDTJobEntity>(listObjHDTJob, ConstantSql.hrm_hr_sp_get_RptRecieveObjectByTime, userLogin, ref status).ToList();
                if (lstHDTJob.Count == 0)
                {
                    return table;
                }

                var lstProfileIDByHDTJob = lstHDTJob.Select(s => s.ProfileID).Distinct().ToList();

                #region Lấy WorkDay
                var workDayRepository = new Att_WorkDayRepository(unitOfWork);
                var lstworkDays = new List<Att_Workday>().Select(d => new
                {
                    d.ProfileID,
                    d.WorkDate,
                    d.FirstInTime,
                    d.LastOutTime
                }).ToList();

                foreach (var item in lstProfileIDByHDTJob.Chunk(1000))
                {
                    lstworkDays.AddRange(workDayRepository.FindBy(s => s.IsDelete == null && s.WorkDate >= dateFrom
                        && s.WorkDate <= dateTo && item.Contains(s.ProfileID)).Select(d => new
                        {
                            d.ProfileID,
                            d.WorkDate,
                            d.FirstInTime,
                            d.LastOutTime
                        }).ToList());
                }

                if (lstworkDays.Count == 0)
                {
                    return table;
                }
                #endregion

                #region Lấy MealRecord
                var mealRecordRepository = new Can_MealRecordRepository(unitOfWork);
                var lstmeadrecored = new List<Can_MealRecord>().Select(d => new
                {
                    d.ProfileID,
                    d.WorkDay,
                    d.Amount
                }).ToList();

                foreach (var item in lstProfileIDByHDTJob.Chunk(1000))
                {
                    lstmeadrecored.AddRange(mealRecordRepository.FindBy(s => s.IsDelete == null && s.WorkDay >= dateFrom
                        && s.WorkDay <= dateTo && item.Contains(s.ProfileID)).Select(d => new
                        {
                            d.ProfileID,
                            d.WorkDay,
                            d.Amount
                        }).ToList());
                }
                #endregion

                List<object> listObjPrice = new List<object>();
                listObjPrice.Add(null);
                listObjPrice.Add(null);
                listObjPrice.Add(null);
                listObjPrice.Add(1);
                listObjPrice.Add(Int32.MaxValue - 1);
                var lstHDTJobTypePrice = basevices.GetData<Cat_HDTJobTypePriceEntity>(listObjPrice, ConstantSql.hrm_cat_sp_get_HDTJobTypePrice, userLogin, ref status).Where(s => s.Price != null).Distinct().ToList();
                var profileServices = new Hre_ProfileServices();
                var listResult = profileServices.getHDTJobByPrice(lstHDTJob, dateFrom, dateTo);

                var ListProfileID = listResult.Select(m => m.ProfileID).Distinct().ToList();

                foreach (var profileID in ListProfileID)
                {
                    var firstProfile = listResult.Where(m => m.ProfileID == profileID).FirstOrDefault();
                    var lstWorkDaysByProfile = lstworkDays.Where(m => m.ProfileID == profileID && (m.FirstInTime != null || m.LastOutTime != null)).ToList();
                    var lstmeadlbypro = lstmeadrecored.Where(s => s.ProfileID == profileID).ToList();
                    if (firstProfile != null && lstWorkDaysByProfile.Count != 0)
                    {
                        bool isAdd = false;
                        DataRow row = table.NewRow();
                        row[Hre_ReportRecieveObjectByTimeEntity.FieldNames.ProfileName] = firstProfile.ProfileName;
                        row[Hre_ReportRecieveObjectByTimeEntity.FieldNames.CodeEmp] = firstProfile.CodeEmp;
                        row[Hre_ReportRecieveObjectByTimeEntity.FieldNames.E_DEPARTMENT] = firstProfile.E_DEPARTMENT;
                        row[Hre_ReportRecieveObjectByTimeEntity.FieldNames.E_DIVISION] = firstProfile.E_DIVISION;
                        row[Hre_ReportRecieveObjectByTimeEntity.FieldNames.E_SECTION] = firstProfile.E_SECTION;
                        row[Hre_ReportRecieveObjectByTimeEntity.FieldNames.E_TEAM] = firstProfile.E_TEAM;
                        row[Hre_ReportRecieveObjectByTimeEntity.FieldNames.E_UNIT] = firstProfile.E_UNIT;
                        row[Hre_ReportRecieveObjectByTimeEntity.FieldNames.Dept] = firstProfile.Dept;
                        row[Hre_ReportRecieveObjectByTimeEntity.FieldNames.Unit] = firstProfile.Unit;
                        row[Hre_ReportRecieveObjectByTimeEntity.FieldNames.Part] = firstProfile.Part;
                        row[Hre_ReportRecieveObjectByTimeEntity.FieldNames.Line] = firstProfile.Line;
                        row[Hre_ReportRecieveObjectByTimeEntity.FieldNames.Session] = firstProfile.Session;
                        var hdtjobbyprofile = lstHDTJob.Where(s => s.ProfileID == profileID).ToList();
                        var workdaybyProfile = lstworkDays.Where(s => s.ProfileID == profileID).ToList();
                        foreach (var item in lstHDTJobTypePrice)
                        {
                            var resultByPrice = listResult.Where(m => m.ProfileID == profileID && m.Price == item.Price).ToList();

                            if (resultByPrice.Count == 0)
                            {
                                continue;
                            }
                            int? count = 0;

                            foreach (var Price in resultByPrice)
                            {
                                if (Price.DateTo == null)
                                {
                                    Price.DateTo = dateTo;
                                }
                                for (DateTime date = Price.DateFrom.Value; date <= Price.DateTo; date = date.AddDays(1))
                                {
                                    var workdaybyprice = workdaybyProfile.Where(s => s.WorkDate != null && s.WorkDate.Date == date.Date && s.FirstInTime != null && s.LastOutTime != null).FirstOrDefault();
                                    var mealbyprice = lstmeadlbypro.Where(s => s.Amount != null && s.WorkDay != null && s.WorkDay.Value.Date == date.Date && (double)s.Amount == Price.Price).FirstOrDefault();

                                    if (workdaybyprice != null && mealbyprice != null)
                                    {
                                        count++;
                                    }
                                    row[item.Price.ToString()] = count != 0 ? count : null;
                                    if (count != null && count != 0)
                                    {
                                        isAdd = true;
                                    }
                                }

                            }
                        }
                        if (isAdd == true)
                        {
                            table.Rows.Add(row);
                        }
                    }
                }
            }
            return table.ConfigTable();
        }
Ejemplo n.º 16
0
        public DataTable GetReportHCSeniority(DateTime dateSearch, List<Guid> lstjobTitles, Guid orgID, Guid? orgTypeId, bool isIncludeQuitEmp, bool isCreateTemplate, string userLogin)
        {
            List<string> lstSeniority = new List<string> { ">12 Tháng", "9-12 Tháng", "6-9 Tháng", "3-6 Tháng", "0-2 Tháng" };
            DataTable table = CreateReportHCSenioritySchema(orgID, orgTypeId, userLogin);
            if (isCreateTemplate)
            {
                return table.ConfigTable();
            }
            string status = string.Empty;
            using (var context = new VnrHrmDataContext())
            {
                var unitOfWork = (IUnitOfWork)(new UnitOfWork(context));
                var serviceProfile = new Hre_ProfileServices();
                var baseService = new BaseService();
                var lstObjProfileIDs = new List<object>();
                DataRow row1 = table.NewRow();

                var jobtitleServices = new Cat_JobTitleServices();
                var lstJobtitle = jobtitleServices.GetData<Cat_JobTitleEntity>(lstjobTitles[0], ConstantSql.hrm_cat_sp_get_JobTitleById, userLogin,ref status).FirstOrDefault();

                var orgsService = new Cat_OrgStructureServices();
                var lstallorgs = orgsService.GetDataNotParam<Cat_OrgStructure>(ConstantSql.hrm_cat_sp_get_AllOrg, userLogin, ref status).ToList();

                var lstorgs = lstallorgs.Where(s => s.ParentID == orgID).ToList();
                var lstOrgName = lstallorgs.Where(s => s.ID == orgID).FirstOrDefault();

                var listorgid = lstorgs.Select(s => new { s.ID, s.OrderNumber, s.Code, s.OrgStructureName }).ToList();

                //Xử Lý lấy tất cả nhân viên trong phòng ban đã chọn và group 1 cấp
                var orgIDs = string.Empty;
                orderNumber = string.Empty;
                foreach (var item in listorgid)
                {
                    orderNumber += item.OrderNumber.ToString() + ",";
                    getChildOrgStructure(lstallorgs, item.ID);
                }
                if (orderNumber.IndexOf(',') > 0)
                    orderNumber = orderNumber.Substring(0, orderNumber.Length - 1);

                var lstObjOrgByOrderNumber = new List<object>();
                lstObjOrgByOrderNumber.Add(orderNumber);
                var lstOrgByOrderNumber = orgsService.GetData<Cat_OrgStructure>(lstObjOrgByOrderNumber, ConstantSql.hrm_cat_sp_get_OrgStructureByOrderNumber, userLogin,ref status).Select(s => s.ID).ToList();

                List<object> listObj = new List<object>();
                listObj.Add(orderNumber);
                listObj.Add(string.Empty);
                listObj.Add(string.Empty);

                var lstprofile = GetData<Hre_ProfileEntity>(listObj, ConstantSql.hrm_hr_sp_get_ProfileIdsByOrg, userLogin,ref status).ToList();

                if (!isIncludeQuitEmp)
                {
                    lstprofile = lstprofile.Where(s => s.DateQuit == null).ToList();
                }
                if (lstjobTitles != null && lstjobTitles[0] != null && lstjobTitles[0] != Guid.Empty)
                {
                    lstprofile = lstprofile.Where(s => s.JobTitleID != null && lstjobTitles.Contains(s.JobTitleID.Value)).ToList();
                }
                if (lstprofile == null || lstorgs == null)
                {
                    return table;
                }
                if (lstJobtitle != null)
                {
                    row1[Hre_ReportHCSeniorityEntity.FieldNames.OrgStructureName] = lstOrgName == null ? string.Empty : lstOrgName.OrgStructureName + " - " + lstJobtitle.JobTitleName;
                }
                else
                {
                    row1[Hre_ReportHCSeniorityEntity.FieldNames.OrgStructureName] = lstOrgName == null ? string.Empty : lstOrgName.OrgStructureName;

                }

                table.Rows.Add(row1);

                foreach (var item in lstSeniority)
                {
                    DataRow row = table.NewRow();
                    row[Hre_ReportHCSeniorityEntity.FieldNames.Type] = item;
                    var IDsCount = string.Empty;
                    var count = 0;
                    int totalcount = 0;
                    foreach (var org in lstorgs)
                    {

                        //xử lý đến nhân viên của phòng ban con
                        orderNumber = string.Empty;
                        orderNumber += org.OrderNumber.ToString() + ",";
                        getChildOrgStructure(lstallorgs, org.ID);

                        if (orderNumber.IndexOf(',') > 0)
                            orderNumber = orderNumber.Substring(0, orderNumber.Length - 1);

                        var lstObjOrgByOrderNumberCount = new List<object>();
                        lstObjOrgByOrderNumberCount.Add(orderNumber);
                        var lstOrgByOrderNumberCount = orgsService.GetData<Cat_OrgStructure>(lstObjOrgByOrderNumberCount, ConstantSql.hrm_cat_sp_get_OrgStructureByOrderNumber, userLogin,ref status).ToList();
                        if (orgTypeId != null)
                        {
                            lstOrgByOrderNumberCount = lstOrgByOrderNumberCount.Where(s => s.OrgStructureTypeID == orgTypeId).ToList();
                        }
                        foreach (var orgName in lstOrgByOrderNumberCount)
                        {
                            var lstprofilebyOrg = lstprofile.Where(s => s.OrgStructureID != null && orgName.ID == s.OrgStructureID.Value).ToList();
                            if (lstprofilebyOrg == null)
                            {
                                continue;
                            }
                            // > 12 tháng
                            DateTime dateHire = DateTime.MinValue;
                            if (item == ">12 Tháng")
                            {
                                dateHire = dateSearch.AddMonths(-12);
                                count = lstprofilebyOrg.Where(m => m.DateHire < dateHire).Count();
                            }
                            // 9 -12 tháng
                            if (item == "9-12 Tháng")
                            {
                                dateHire = dateSearch.AddMonths(-9);
                                DateTime datehireTo = dateSearch.AddMonths(-12);
                                count = lstprofilebyOrg.Where(m => m.DateHire < dateHire && m.DateHire >= datehireTo).Count();
                            }
                            // 6-9 tháng
                            if (item == "6-9 Tháng")
                            {
                                dateHire = dateSearch.AddMonths(-6);
                                DateTime datehireTo = dateSearch.AddMonths(-9);
                                count = lstprofilebyOrg.Where(m => m.DateHire < dateHire && m.DateHire >= datehireTo).Count();
                            }
                            // 3-6 tháng
                            if (item == "3-6 Tháng")
                            {
                                dateHire = dateSearch.AddMonths(-3);
                                DateTime datehireTo = dateSearch.AddMonths(-6);
                                count = lstprofilebyOrg.Where(m => m.DateHire < dateHire && m.DateHire >= datehireTo).Count();
                            }
                            // 0-2 tháng
                            if (item == "0-2 Tháng")
                            {
                                dateHire = dateSearch.AddMonths(-2);
                                count = lstprofilebyOrg.Where(m => m.DateHire >= dateHire).Count();
                            }

                            totalcount += count;

                            if (count > 0)
                            {
                                var orgStructureName = orgName.OrgStructureName + "_" + orgName.Code;
                                if (orgName != null && !string.IsNullOrEmpty(orgName.OrgStructureName) && table.Columns.Contains(orgName.OrgStructureName))
                                {
                                    row[Hre_ReportHCGenderEntity.FieldNames.HeadCount] = totalcount;
                                    row[orgName.OrgStructureName] = count;
                                    row[Hre_ReportHCGenderEntity.FieldNames.Total] = totalcount;

                                }
                            }
                        }
                    }
                    //if (totalcount == 0)
                    //{
                    //    continue;
                    //}
                    table.Rows.Add(row);


                }
                DataRow datarow = table.NewRow();
                datarow[1] = "Total GT";
                for (int i = 2; i < table.Columns.Count; i++)
                {
                    int gt = 0;
                    for (int j = 0; j < table.Rows.Count; j++)
                    {
                        var valueRow = table.Rows[j][i].ToString();
                        if (!string.IsNullOrEmpty(valueRow) && !string.IsNullOrWhiteSpace(valueRow))
                        {
                            var value = int.Parse(valueRow);
                            if (value >= 0)
                            {
                                gt += value;
                            }
                        }
                    }

                    datarow[i] = gt;
                }

                table.Rows.Add(datarow);
                return table.ConfigTable(true);
            }
        }
Ejemplo n.º 17
0
        public DataTable GetReportHCGender(DateTime dateSearch, List<Guid?> lstjobTitles, Guid orgID, Guid? orgTypeID, string Gender, bool _isIncludeQuitEmp, bool isCreateTemplate, string userLogin)
        {

            DataTable table = CreateReportHCGenderSchema(orgID, orgTypeID,userLogin);
            if (isCreateTemplate)
            {
                return table.ConfigTable();
            }
            string status = string.Empty;
            using (var context = new VnrHrmDataContext())
            {

                DataRow row1 = table.NewRow();
                var unitOfWork = (IUnitOfWork)(new UnitOfWork(context));
                var serviceProfile = new Hre_ProfileServices();
                var baseService = new BaseService();
                var lstObjProfileIDs = new List<object>();

                var orgsService = new Cat_OrgStructureServices();
                var lstallorgs = orgsService.GetDataNotParam<Cat_OrgStructure>(ConstantSql.hrm_cat_sp_get_AllOrg, userLogin, ref status).ToList();

                var lstorgs = lstallorgs.Where(s => s.ParentID == orgID).ToList();
                var lstOrgName = lstallorgs.Where(s => s.ID == orgID).FirstOrDefault();

                string male = EnumDropDown.GenderType.E_MALE.ToString();
                string female = EnumDropDown.GenderType.E_FEMALE.ToString();


                var listorgid = lstorgs.Select(s => new { s.ID, s.OrderNumber, s.Code, s.OrgStructureName }).ToList();

                //Xử Lý lấy tất cả nhân viên trong phòng ban đã chọn và group 1 cấp
                var orgIDs = string.Empty;
                orderNumber = string.Empty;

                foreach (var item in listorgid)
                {
                    orderNumber += item.OrderNumber.ToString() + ",";
                    getChildOrgStructure(lstallorgs, item.ID);
                }
                if (orderNumber.IndexOf(',') > 0)
                    orderNumber = orderNumber.Substring(0, orderNumber.Length - 1);

                var lstObjOrgByOrderNumber = new List<object>();
                lstObjOrgByOrderNumber.Add(orderNumber);
                var lstOrgByOrderNumber = orgsService.GetData<Cat_OrgStructure>(lstObjOrgByOrderNumber, ConstantSql.hrm_cat_sp_get_OrgStructureByOrderNumber, userLogin ,ref status).Select(s => s.ID).ToList();

                List<object> listObj = new List<object>();
                listObj.Add(orderNumber);
                listObj.Add(string.Empty);
                listObj.Add(string.Empty);

                var lstprofile = GetData<Hre_ProfileEntity>(listObj, ConstantSql.hrm_hr_sp_get_ProfileIdsByOrg, userLogin ,ref status).ToList();
                if (!_isIncludeQuitEmp)
                {
                    lstprofile = lstprofile.Where(s => s.DateQuit == null).ToList();
                }

                var jobtitleService = new Cat_JobTitleServices();
                var lstObjJobtitle = new List<object>();
                lstObjJobtitle.Add(null);
                lstObjJobtitle.Add(null);
                lstObjJobtitle.Add(null);
                lstObjJobtitle.Add(1);
                lstObjJobtitle.Add(100000);

                var lstJobtitle = GetData<Cat_JobTitleEntity>(lstObjJobtitle, ConstantSql.hrm_cat_sp_get_JobTitle, userLogin ,ref status).ToList();

                if (lstjobTitles != null && lstjobTitles[0] != null && lstjobTitles[0] != Guid.Empty)
                {
                    lstprofile = lstprofile.Where(s => s.JobTitleID != null && lstjobTitles.Contains(s.JobTitleID.Value)).ToList();
                    lstJobtitle = lstJobtitle.Where(s => lstjobTitles.Contains(s.ID)).ToList();
                }
                if (lstprofile == null || lstorgs == null)
                {
                    return table;
                }



                string gender = string.Empty;
                if (Gender == male)
                {
                    gender = "Male";

                }
                else
                {
                    gender = "Female";
                }

                row1[Hre_ReportHCGenderEntity.FieldNames.OrgStructureName] = lstOrgName == null ? string.Empty : lstOrgName.OrgStructureName + " - " + gender;
                table.Rows.Add(row1);

                foreach (var item in lstJobtitle)
                {
                    bool addTitle = false;
                    int totalcount = 0;
                    var count = 0;

                    DataRow row = table.NewRow();
                    var lstJobtitleById = lstJobtitle.Where(s => item.ID == s.ID).FirstOrDefault();
                    row[Hre_ReportHCGenderEntity.FieldNames.JobTitleName] = lstJobtitleById == null ? string.Empty : lstJobtitleById.JobTitleName;

                    foreach (var org in listorgid)
                    {

                        //xử lý đếm nhân viên của phòng ban con
                        orderNumber = string.Empty;
                        orderNumber += org.OrderNumber.ToString() + ",";
                        getChildOrgStructure(lstallorgs, org.ID);

                        if (orderNumber.IndexOf(',') > 0)
                            orderNumber = orderNumber.Substring(0, orderNumber.Length - 1);

                        var lstObjOrgByOrderNumberCount = new List<object>();
                        lstObjOrgByOrderNumberCount.Add(orderNumber);
                        var lstOrgByOrderNumberCount = orgsService.GetData<Cat_OrgStructure>(lstObjOrgByOrderNumberCount, ConstantSql.hrm_cat_sp_get_OrgStructureByOrderNumber, userLogin,ref status).ToList();
                        if (orgTypeID != null)
                        {
                            lstOrgByOrderNumberCount = lstOrgByOrderNumberCount.Where(s => s.OrgStructureTypeID == orgTypeID).ToList();
                        }

                        foreach (var orgName in lstOrgByOrderNumberCount)
                        {

                            var lstprofilebyOrg = lstprofile.Where(s => s.OrgStructureID != null && orgName.ID == s.OrgStructureID.Value && s.JobTitleID == lstJobtitleById.ID && s.Gender == Gender && s.DateHire != null && s.DateHire.Value <= dateSearch).ToList();

                            if (lstprofilebyOrg == null)
                            {
                                continue;
                            }
                            count = lstprofilebyOrg.Count();
                            totalcount += count;
                            if (count > 0)
                            {
                                var orgStructureName = orgName.OrgStructureName;
                                if (orgName != null && !string.IsNullOrEmpty(orgName.OrgStructureName) && table.Columns.Contains(orgStructureName))
                                {
                                    row[orgName.OrgStructureName] = count;
                                }
                                row[Hre_ReportHCGenderEntity.FieldNames.HeadCount] = totalcount;
                                row[Hre_ReportHCGenderEntity.FieldNames.Total] = totalcount;

                            }
                        }
                    }
                    if (totalcount == 0)
                    {
                        continue;
                    }
                    table.Rows.Add(row);

                }
                DataRow datarow = table.NewRow();
                datarow[1] = "Total GT";
                for (int i = 2; i < table.Columns.Count; i++)
                {
                    int gt = 0;
                    for (int j = 0; j < table.Rows.Count; j++)
                    {
                        var valueRow = table.Rows[j][i].ToString();
                        if (!string.IsNullOrEmpty(valueRow) && !string.IsNullOrWhiteSpace(valueRow))
                        {
                            var value = int.Parse(valueRow);
                            if (value >= 0)
                            {
                                gt += value;
                            }
                        }
                    }

                    datarow[i] = gt;
                }

                table.Rows.Add(datarow);
                return table.ConfigTable(true);
            }
        }
Ejemplo n.º 18
0
        public List<Hre_ReportSumaryHDTProfileEntity> GetReportSumaryHDTProfile(DateTime? DateFrom, DateTime? DateTo, Guid? HDTJobGroupID, string CodeEmp, string userLogin)
        {
            string status = string.Empty;
            List<Hre_ReportSumaryHDTProfileEntity> lstReportSumaryHDTProfile = new List<Hre_ReportSumaryHDTProfileEntity>();
            using (var context = new VnrHrmDataContext())
            {
                var unitOfWork = (IUnitOfWork)(new UnitOfWork(context));
                var basevices = new BaseService();
                var hdtJobServices = new Hre_HDTJobServices();
                var ProfileServices = new Hre_ProfileServices();
                List<object> listObjHDTJob = new List<object>();
                listObjHDTJob.Add(null);
                listObjHDTJob.Add(CodeEmp);
                listObjHDTJob.Add(null);
                listObjHDTJob.Add(null);
                listObjHDTJob.Add(null);
                listObjHDTJob.Add(null);
                listObjHDTJob.Add(DateFrom);
                listObjHDTJob.Add(DateTo);
                listObjHDTJob.Add(null);
                listObjHDTJob.Add(null);
                listObjHDTJob.Add(null);
                listObjHDTJob.Add(null);
                listObjHDTJob.Add(1);
                listObjHDTJob.Add(Int32.MaxValue - 1);
                var lstHDTJob = hdtJobServices.GetData<Hre_HDTJobEntity>(listObjHDTJob, ConstantSql.hrm_hr_sp_get_ReportSumaryHDTProfile, userLogin, ref status).ToList();
                if (lstHDTJob.Count == 0)
                {
                    return lstReportSumaryHDTProfile;
                }
                if (HDTJobGroupID != null)
                {
                    lstHDTJob = lstHDTJob.Where(s => s.HDTJobGroupID == HDTJobGroupID).ToList();
                }
                var lstprofileids = lstHDTJob.Select(s => s.ProfileID).Distinct().ToList();

                string selectedIds = Common.DotNetToOracle(String.Join(",", lstHDTJob.Select(s => s.ProfileID.ToString()).ToList<string>()));

                var lstInsurance = new List<Ins_ProfileInsuranceMonthlyEntity>();
                int _total = lstprofileids.Count;
                int _totalPage = _total / 100 + 1;
                int _pageSize = 100;
                for (int _page = 1; _page <= _totalPage; _page++)
                {
                    int _skip = _pageSize * (_page - 1);
                    var _listCurrenPage = lstprofileids.Skip(_skip).Take(_pageSize).ToList();
                    string _strselectedIDs = Common.DotNetToOracle(string.Join(",", _listCurrenPage));
                    var lstresultInsurance = basevices.GetData<Ins_ProfileInsuranceMonthlyEntity>(_strselectedIDs, ConstantSql.hrm_ins_sp_get_ProfileInsMonthlyByProfileIds, userLogin, ref status).ToList();
                    if (lstresultInsurance != null && lstresultInsurance.Count > 0)
                    {
                        lstInsurance.AddRange(lstresultInsurance);
                    }
                }

                var lstHDTJobCut = ProfileServices.getHDTJobByPrice(lstHDTJob, DateFrom, DateTo);

                foreach (var HDTJob in lstHDTJobCut)
                {
                    Hre_ReportSumaryHDTProfileEntity entity = new Hre_ReportSumaryHDTProfileEntity();
                    entity.ProfileName = HDTJob.ProfileName;
                    entity.CodeEmp = HDTJob.CodeEmp;
                    entity.E_UNIT = HDTJob.E_UNIT;
                    entity.E_DIVISION = HDTJob.E_DIVISION;
                    entity.E_DEPARTMENT = HDTJob.E_DEPARTMENT;
                    entity.E_TEAM = HDTJob.E_TEAM;
                    entity.E_SECTION = HDTJob.E_SECTION;
                    entity.Dept = HDTJob.Dept;
                    entity.Type = HDTJob.Type != null ? HDTJob.Type.TranslateString() : null;
                    entity.HDTJobGroupCode = HDTJob.HDTJobGroupCode;
                    entity.HDTJobGroupName = HDTJob.HDTJobGroupName;
                    entity.DateFrom = HDTJob.DateFrom;
                    entity.DateTo = HDTJob.DateTo;
                    var insuracebyHDT = lstInsurance.Where(s => s.HDTJobGroupCode == HDTJob.HDTJobGroupCode && s.ProfileID == HDTJob.ProfileID && s.AmountHDTIns > 0).ToList();
                    entity.MonthInsurance = insuracebyHDT != null ? insuracebyHDT.Count : 0;
                    lstReportSumaryHDTProfile.Add(entity);
                }
            }

            return lstReportSumaryHDTProfile;
        }
Ejemplo n.º 19
0
        public Sal_UnusualAllowanceModel Post([Bind]Sal_UnusualAllowanceModel model)
        {
            var hrService = new Hre_ProfileServices();
            var UnusualAllowanceServices = new Sal_UnusualAllowanceServices();
            string status = string.Empty;
            #region Validate
            string message = string.Empty;
            var checkValidate = false;
            //kiểm tra xem có phải là đang create ở trang chi tiết nv ko
            if (model.IsGeneralProfile != null && model.IsGeneralProfile == true)
            {
                checkValidate = HRM.Business.Main.Domain.ValidatorService.OnValidateData<Sal_UnusualAllowanceModel>(model, "Sal_UnusualEDGeneralProfile", ref message);

                if (!checkValidate)
                {
                    model.ActionStatus = message;
                    return model;
                }
                ActionService service = new ActionService(UserLogin);
                return service.UpdateOrCreate<Sal_UnusualAllowanceEntity, Sal_UnusualAllowanceModel>(model);
            }
            else
            {
                if (!string.IsNullOrEmpty(model.OrgStructureIDs))
                {
                    checkValidate = HRM.Business.Main.Domain.ValidatorService.OnValidateData<Sal_UnusualAllowanceModel>(model, "Sal_UnusualEDOrg", ref message);
                }
                else
                {
                    checkValidate = HRM.Business.Main.Domain.ValidatorService.OnValidateData<Sal_UnusualAllowanceModel>(model, "Sal_UnusualED", ref message);
                }
                if (!checkValidate)
                {
                    model.ActionStatus = message;
                    return model;
                }

                if (!string.IsNullOrEmpty(model.OrgStructureIDs))
                {
                    List<Guid> listGuid = new List<Guid>();
                    if (model.ProfileIDExclusion != null)
                    {
                        var listStr = model.ProfileIDExclusion.Split(',');

                        if (listStr[0] != "")
                        {
                            foreach (var item in listStr)
                            {
                                listGuid.Add(Guid.Parse(item));
                            }
                        }
                    }
                    List<object> listObj = new List<object>();
                    listObj.Add(model.OrgStructureID);
                    listObj.Add(string.Empty);
                    listObj.Add(string.Empty);
                    var lstProfile = hrService.GetData<Hre_ProfileIdEntity>(listObj, ConstantSql.hrm_hr_sp_get_ProfileIdsByOrgStructure, userLogin, ref status).Select(s => s.ID).ToList();
                    if (listGuid != null)
                    {
                        lstProfile = lstProfile.Where(s => !listGuid.Contains(s)).ToList();
                    }

                    List<Sal_UnusualAllowanceEntity> lstUnusualAllowance = new List<Sal_UnusualAllowanceEntity>();
                    foreach (var i in lstProfile)
                    {
                        Sal_UnusualAllowanceEntity item = new Sal_UnusualAllowanceEntity();
                        item = model.Copy<Sal_UnusualAllowanceEntity>();
                        item.ProfileID = i;
                        lstUnusualAllowance.Add(item);
                    }
                    model.ActionStatus = UnusualAllowanceServices.Add(lstUnusualAllowance);
                    return model;
                }
                else
                {
                    string[] listProfile = model.ProfileIDs.Split(',');
                    List<Sal_UnusualAllowanceEntity> lstUnusualAllowance = new List<Sal_UnusualAllowanceEntity>();
                    foreach (var i in listProfile)
                    {
                        Sal_UnusualAllowanceEntity item = new Sal_UnusualAllowanceEntity();
                        item = model.Copy<Sal_UnusualAllowanceEntity>();
                        item.ProfileID = Guid.Parse(i);
                        lstUnusualAllowance.Add(item);
                    }
                    model.ActionStatus = UnusualAllowanceServices.Add(lstUnusualAllowance);
                    return model;
                }
            }
            #endregion

        }
Ejemplo n.º 20
0
        public List<Hre_ReportHDTJobNotDateEndEntity> GetReportHDTJobNotDateEnd(DateTime? DateFrom, DateTime? DateTo, string lstOrgOrderNumber, string userLogin)
        {
            string status = string.Empty;
            List<Hre_ReportHDTJobNotDateEndEntity> lstReportHDTJobNotDateEndEntity = new List<Hre_ReportHDTJobNotDateEndEntity>();
            using (var context = new VnrHrmDataContext())
            {
                var unitOfWork = (IUnitOfWork)(new UnitOfWork(context));
                var basevices = new BaseService();
                var hdtJobServices = new Hre_HDTJobServices();
                var ProfileServices = new Hre_ProfileServices();
                List<object> listObjHDTJob = new List<object>();
                listObjHDTJob.Add(null);
                listObjHDTJob.Add(null);
                listObjHDTJob.Add(null);
                listObjHDTJob.Add(null);
                listObjHDTJob.Add(null);
                listObjHDTJob.Add(lstOrgOrderNumber);
                listObjHDTJob.Add(DateFrom);
                listObjHDTJob.Add(DateTo);
                listObjHDTJob.Add(null);
                listObjHDTJob.Add(null);
                listObjHDTJob.Add(null);
                listObjHDTJob.Add(null);
                listObjHDTJob.Add(1);
                listObjHDTJob.Add(Int32.MaxValue - 1);
                var lstHDTJob = hdtJobServices.GetData<Hre_HDTJobEntity>(listObjHDTJob, ConstantSql.hrm_hr_sp_get_HDTJob, userLogin, ref status).ToList();

                if (lstHDTJob == null)
                {
                    return lstReportHDTJobNotDateEndEntity;
                }

                var lstResultHDTJob = ProfileServices.getHDTJobByPrice(lstHDTJob, DateFrom, DateTo);

                var profileinList = lstResultHDTJob.Select(s => s.ProfileID).Distinct().ToList();


                foreach (var ids in profileinList)
                {
                    bool isNull = false;
                    var hdtbypro = lstResultHDTJob.Where(s => s.ProfileID == ids).OrderBy(s => s.DateFrom).ToList();
                    var hdt = lstResultHDTJob.Where(s => s.ProfileID == ids).FirstOrDefault();

                    foreach (var item in hdtbypro)
                    {
                        if (hdtbypro.Count == 1 && item.DateTo != null)
                        {
                            continue;
                        }

                        if (item.DateTo == null)
                        {
                            isNull = true;
                        }

                        if (isNull)
                        {
                            Hre_ReportHDTJobNotDateEndEntity entity = new Hre_ReportHDTJobNotDateEndEntity();
                            entity.CodeEmp = item.CodeEmp;
                            entity.ProfileName = item.ProfileName;
                            entity.E_UNIT = item.E_UNIT;
                            entity.E_DIVISION = item.E_DIVISION;
                            entity.E_DEPARTMENT = item.E_DEPARTMENT;
                            entity.E_TEAM = item.E_TEAM;
                            entity.E_SECTION = item.E_SECTION;
                            entity.Dept = item.Dept;
                            entity.HDTJobTypeCode = item.HDTJobTypeCode;
                            entity.HDTJobTypeName = item.HDTJobTypeName;
                            entity.HDTJobGroupName = item.HDTJobGroupName;
                            entity.DateFrom = item.DateFrom;
                            entity.DateTo = item.DateTo;
                            entity.StatusView = item.StatusView;
                            lstReportHDTJobNotDateEndEntity.Add(entity);
                        }

                        if (item.DateTo != null)
                        {
                            isNull = false;
                        }
                    }
                }
            }
            lstReportHDTJobNotDateEndEntity = lstReportHDTJobNotDateEndEntity.OrderBy(s => s.CodeEmp).ToList();
            return lstReportHDTJobNotDateEndEntity;
        }
Ejemplo n.º 21
0
 public ActionResult GetReportMealTimeSummary([DataSourceRequest] DataSourceRequest request, Can_ReportMealTimeSummaryModel Model)
 {
     var service = new Can_ReportServices();
     var hrService = new Hre_ProfileServices();
     ListQueryModel lstModel = new ListQueryModel
     {
         PageIndex = request.Page,
         PageSize = request.PageSize,
         Filters = ExtractFilterAttributes(request),
         Sorts = ExtractSortAttributes(request)
     };
     DateTime From = DateTime.Now.AddMonths(-1);
     DateTime To = DateTime.Now;
     if (Model.DateFrom != null)
     {
         From = Model.DateFrom.Value;
     }
     if (Model.DateTo != null)
     {
         To = Model.DateTo.Value;
     }
     string status = string.Empty;
     var result = service.ReportMealTimeSummary(Model.CateringIDs,
         Model.CanteenIDs,
         Model.LineIDs,
         From,
         To,
         Model.OrgIDs);
     if (Model.ExportID != Guid.Empty)
     {
         var fullPath = ExportService.Export(Model.ExportID, result);
         return Json(fullPath);
     }
     return Json(result.ToDataSourceResult(request));
 }
Ejemplo n.º 22
0
        public List<Hre_ReportSumarySeniorHDTProfileEntity> GetReportSumarySeniorHDTProfile(DateTime? DateFrom, DateTime? DateTo, string profileName,
            string codeEmp, string OrgStructureID, string userLogin)
        {
            string status = string.Empty;
            List<Hre_ReportSumarySeniorHDTProfileEntity> lstReportSumarySeniorHDTProfile = new List<Hre_ReportSumarySeniorHDTProfileEntity>();
            using (var context = new VnrHrmDataContext())
            {
                var unitOfWork = (IUnitOfWork)(new UnitOfWork(context));
                var basevices = new BaseService();
                var hdtJobServices = new Hre_HDTJobServices();
                var ProfileServices = new Hre_ProfileServices();
                List<object> listObjHDTJob = new List<object>();
                listObjHDTJob.Add(profileName);
                listObjHDTJob.Add(codeEmp);
                listObjHDTJob.Add(null);
                listObjHDTJob.Add(null);
                listObjHDTJob.Add(null);
                listObjHDTJob.Add(OrgStructureID);
                listObjHDTJob.Add(DateFrom);
                listObjHDTJob.Add(DateTo);
                listObjHDTJob.Add(null);
                listObjHDTJob.Add(null);
                listObjHDTJob.Add(null);
                listObjHDTJob.Add(null);
                listObjHDTJob.Add(1);
                listObjHDTJob.Add(Int32.MaxValue - 1);
                var lstHDTJob = hdtJobServices.GetData<Hre_HDTJobEntity>(listObjHDTJob, ConstantSql.hrm_hr_sp_get_RptRecieveObjectByTime, userLogin, ref status).ToList();

                if (lstHDTJob.Count == 0)
                {
                    return lstReportSumarySeniorHDTProfile;
                }

                var lstProfileIds = lstHDTJob.Select(s => s.ProfileID).Distinct().ToList();
                string selectedIds = Common.DotNetToOracle(String.Join(",", lstHDTJob.Select(s => s.ProfileID.ToString()).ToList<string>()));

                var lstInsurance = new List<Ins_ProfileInsuranceMonthlyEntity>();
                int _total = lstProfileIds.Count;
                int _totalPage = _total / 100 + 1;
                int _pageSize = 100;
                for (int _page = 1; _page <= _totalPage; _page++)
                {
                    int _skip = _pageSize * (_page - 1);
                    var _listCurrenPage = lstProfileIds.Skip(_skip).Take(_pageSize).ToList();
                    string _strselectedIDs = Common.DotNetToOracle(string.Join(",", _listCurrenPage));
                    var lstresultInsurance = basevices.GetData<Ins_ProfileInsuranceMonthlyEntity>(_strselectedIDs, ConstantSql.hrm_ins_sp_get_ProfileInsMonthlyByProfileIds, userLogin, ref status).ToList();
                    if (lstresultInsurance != null && lstresultInsurance.Count > 0)
                    {
                        lstInsurance.AddRange(lstresultInsurance);
                    }
                }

                var lstHDTJobCut = ProfileServices.getHDTJobByPrice(lstHDTJob, DateFrom, DateTo);

                var lstprofileNameDistince = lstHDTJob.Select(s => new { s.ProfileID, s.ProfileName, s.CodeEmp, s.E_DEPARTMENT }).Distinct().ToList();
                foreach (var profile in lstprofileNameDistince)
                {
                    Hre_ReportSumarySeniorHDTProfileEntity entity = new Hre_ReportSumarySeniorHDTProfileEntity();
                    entity.CodeEmp = profile.CodeEmp;
                    entity.ProfileName = profile.ProfileName;
                    entity.E_DEPARTMENT = profile.E_DEPARTMENT;
                    var hdtbyProfile = lstHDTJobCut.Where(s => s.ProfileID == profile.ProfileID).ToList();
                    int counttype4 = 0;
                    int counttype5 = 0;
                    foreach (var item in hdtbyProfile)
                    {
                        var insuracebyHDT4 = lstInsurance.Where(s => s.HDTJobGroupCode == item.HDTJobGroupCode && s.ProfileID == item.ProfileID && s.AmountHDTIns > 0 && item.Type == "E_TYPE4").ToList();
                        if (insuracebyHDT4.Count > 0)
                        {
                            counttype4 += insuracebyHDT4.Count;
                        }
                        var insuracebyHDT5 = lstInsurance.Where(s => s.HDTJobGroupCode == item.HDTJobGroupCode && s.ProfileID == item.ProfileID && s.AmountHDTIns > 0 && item.Type == "E_TYPE5").ToList();
                        if (insuracebyHDT4.Count > 0)
                        {
                            counttype5 += insuracebyHDT5.Count;
                        }
                    }

                    entity.MonthInsuranceType4 = counttype4;
                    entity.MonthInsuranceType5 = counttype5;
                    lstReportSumarySeniorHDTProfile.Add(entity);
                }
            }
            return lstReportSumarySeniorHDTProfile;
        }
Ejemplo n.º 23
0
        public ActionResult GetReportMultiSlideCard([DataSourceRequest] DataSourceRequest request, Can_ReportMultiSlideCardSearchModel Model)
        {
            var service = new Can_ReportServices();
            var hrService = new Hre_ProfileServices();
            var Actionservices = new ActionService(UserLogin);
            ListQueryModel lstModel = new ListQueryModel
            {
                PageIndex = request.Page,
                PageSize = request.PageSize,
                Filters = ExtractFilterAttributes(request),
                Sorts = ExtractSortAttributes(request)
            };
            DateTime From = SqlDateTime.MinValue.Value;
            DateTime To = SqlDateTime.MaxValue.Value;
            if (Model.DateFrom != null)
            {
                From = Model.DateFrom.Value;
            }
            if (Model.DateTo != null)
            {
                To = Model.DateTo.Value;
            }
            List<Guid?> OrgIds = new List<Guid?>();
            if (Model.OrgStructureID != null && Model.OrgStructureID.Count() > 0)
            {
                OrgIds = Model.OrgStructureID;
            }
            string strOrgIDs = Common.ListToString(OrgIds);
            string status = string.Empty;
            string profilename = null;
            string codeemp = null;
            List<object> objectsearch = new List<object>();
            objectsearch.Add(strOrgIDs);
            objectsearch.Add(profilename);
            objectsearch.Add(codeemp);
            List<Guid> lstProfileIDs = Actionservices.GetData<Hre_ProfileIdEntity>(objectsearch, ConstantSql.hrm_hr_sp_get_ProfileIdsByOrg, ref status).Select(s => s.ID).ToList();
            var result = service.ReportMultiSlideCard(Model.CateringID, Model.CanteenID, Model.LineID, Model.WorkPlaceID, From, To, lstProfileIDs, Model.IsIncludeQuitEmp);
            var rs = result.Translate<Can_ReportMultiSlideCardModel>();

            #region xử lý xuất báo cáo

            if (Model.ExportID != Guid.Empty)
            {
                var fullPath = ExportService.Export(Model.ExportID, rs);
                return Json(fullPath);
            }
            #endregion
            request.Page = 1;
            var dataSourceResult = result.ToDataSourceResult(request);
            return Json(rs.ToDataSourceResult(request));
        }
Ejemplo n.º 24
0
        public DataTable GetReportUnusualHDT(DateTime? DateFrom, DateTime? DateTo, string lstOrgOrderNumber, bool _isCreateTemplate, string userLogin)
        {
            using (var context = new VnrHrmDataContext())
            {
                string status = string.Empty;
                var unitOfWork = (UnitOfWork)(new UnitOfWork(context));
                DataTable table = CreateReportUnusualHDTScheme();
                var basevices = new BaseService();
                var hdtJobServices = new Hre_HDTJobServices();
                var ProfileServices = new Hre_ProfileServices();
                List<object> listObjHDTJob = new List<object>();
                listObjHDTJob.Add(null);
                listObjHDTJob.Add(null);
                listObjHDTJob.Add(null);
                listObjHDTJob.Add(null);
                listObjHDTJob.Add(null);
                listObjHDTJob.Add(lstOrgOrderNumber);
                listObjHDTJob.Add(DateFrom);
                listObjHDTJob.Add(DateTo);
                listObjHDTJob.Add(null);
                listObjHDTJob.Add(null);
                listObjHDTJob.Add(null);
                listObjHDTJob.Add(null);
                listObjHDTJob.Add(1);
                listObjHDTJob.Add(Int32.MaxValue - 1);
                var lstReportUnusualHDT = hdtJobServices.GetData<Hre_HDTJobEntity>(listObjHDTJob, ConstantSql.hrm_hr_sp_get_HDTJob, userLogin, ref status).ToList();
                if (lstReportUnusualHDT.Count == 0)
                {
                    return table;
                }
                lstReportUnusualHDT = ProfileServices.getHDTJobByPrice(lstReportUnusualHDT, DateFrom, DateTo);

                var lstprofileids = lstReportUnusualHDT.Select(s => s.ProfileID).Distinct().ToList();
                var repoCan_MealRecord = new CustomBaseRepository<Can_MealRecord>(unitOfWork);
                var lstmealrecord = new List<Can_MealRecord>().Select(d => new
                {
                    d.ProfileID,
                    d.TimeLog,
                    d.LineID,
                    d.Amount
                }).ToList();
                foreach (var item in lstprofileids.Chunk(1000))
                {
                    lstmealrecord.AddRange(repoCan_MealRecord.FindBy(s => s.IsDelete == null && lstprofileids.Contains(s.ProfileID) && s.TimeLog >= DateFrom && s.TimeLog <= DateTo).Select(d => new
                    {
                        d.ProfileID,
                        d.TimeLog,
                        d.LineID,
                        d.Amount
                    }).ToList());
                }
                var lstlineids = lstmealrecord.Select(s => s.LineID).Distinct().ToList();

                var repoCan_Line = new CustomBaseRepository<Can_Line>(unitOfWork);
                var lstline = repoCan_Line.FindBy(s => s.IsDelete == null && lstlineids.Contains(s.ID) && s.IsHDTJOB == true).ToList();
                foreach (var item in lstReportUnusualHDT)
                {
                    DataRow row = table.NewRow();
                    row[Hre_ReportUnusualHDTEntity.FieldNames.CodeEmp] = item.CodeEmp;
                    row[Hre_ReportUnusualHDTEntity.FieldNames.ProfileName] = item.ProfileName;
                    row[Hre_ReportUnusualHDTEntity.FieldNames.E_DEPARTMENT] = item.E_DEPARTMENT;
                    row[Hre_ReportUnusualHDTEntity.FieldNames.E_DIVISION] = item.E_DIVISION;
                    row[Hre_ReportUnusualHDTEntity.FieldNames.E_SECTION] = item.E_SECTION;
                    row[Hre_ReportUnusualHDTEntity.FieldNames.E_TEAM] = item.E_TEAM;
                    row[Hre_ReportUnusualHDTEntity.FieldNames.E_UNIT] = item.E_UNIT;
                    row[Hre_ReportUnusualHDTEntity.FieldNames.HDTJobTypeCode] = item.HDTJobTypeCode;
                    row[Hre_ReportUnusualHDTEntity.FieldNames.HDTJobTypeName] = item.HDTJobTypeName;
                    if (item.Price != null)
                    {
                        row[Hre_ReportUnusualHDTEntity.FieldNames.Price] = item.Price;
                    }
                    var mealbypro = lstmealrecord.Where(s => s.ProfileID == item.ProfileID).FirstOrDefault();
                    if (mealbypro != null)
                    {
                        if (mealbypro.TimeLog != null)
                        {
                            row[Hre_ReportUnusualHDTEntity.FieldNames.TimeScan] = mealbypro.TimeLog.Value.ToString("dd/MM/yyyy hh:ss");
                        }
                        var linebyhdt = lstline.Where(s => s.ID == mealbypro.LineID).FirstOrDefault();
                        if (linebyhdt != null && linebyhdt.Amount != null)
                        {
                            row[Hre_ReportUnusualHDTEntity.FieldNames.PriceRecieve] = linebyhdt.Amount;
                        }
                        if (linebyhdt != null && linebyhdt.Amount != null)
                        {
                            if (item.Price != (double)linebyhdt.Amount)
                            {
                                row[Hre_ReportUnusualHDTEntity.FieldNames.RevieveWrong] = true;
                            }
                        }
                        if (item.Price != null && linebyhdt == null)
                        {
                            row[Hre_ReportUnusualHDTEntity.FieldNames.HaveRegister] = true;
                        }
                        if (item.Price == null && linebyhdt != null)
                        {
                            row[Hre_ReportUnusualHDTEntity.FieldNames.NotRegister] = true;
                        }
                    }
                    table.Rows.Add(row);
                }
                return table.ConfigTable(true);
            }
        }
Ejemplo n.º 25
0
 public ActionResult GetReportSumaryReturnMoneyEat([DataSourceRequest] DataSourceRequest request, Can_ReportSumaryReturnMoneyEatSearchModel Model)
 {
     var service = new Can_ReportServices();
     var hrService = new Hre_ProfileServices();
     ListQueryModel lstModel = new ListQueryModel
     {
         PageIndex = request.Page,
         PageSize = request.PageSize,
         Filters = ExtractFilterAttributes(request),
         Sorts = ExtractSortAttributes(request)
     };
     DateTime From = SqlDateTime.MinValue.Value;
     DateTime To = SqlDateTime.MaxValue.Value;
     if (Model.DateFrom != null)
     {
         From = Model.DateFrom.Value;
     }
     if (Model.DateTo != null)
     {
         To = Model.DateTo.Value;
     }
     var result = service.GetReportSumaryReturnMoneyEat(Model.CateringIDs, Model.CanteenIDs, Model.LineIDs, Model.WorkPlaceID, From, To, Model.OrgStructureID, Model.CodeEmp, Model.IsIncludeQuitEmp);
     #region xử lý xuất báo cáo
     if (Model.ExportID != Guid.Empty)
     {
         var fullPath = ExportService.Export(Model.ExportID, result);
         return Json(fullPath);
     }
     #endregion
     request.Page = 1;
     var dataSourceResult = result.ToDataSourceResult(request);
     return Json(result.ToDataSourceResult(request));
 }
Ejemplo n.º 26
0
        public List<Hre_ReportDependantProfileQuitEntity> GetReportDependantProfileQuits(DateTime? dateFrom, DateTime? dateTo, Guid? workPlaceID, string orgStructureID, string userLogin)
        {
            string status = string.Empty;
            List<Hre_ReportDependantProfileQuitEntity> lstReportDependantProfileQuit = new List<Hre_ReportDependantProfileQuitEntity>();
            using (var context = new VnrHrmDataContext())
            {
                var unitOfWork = (IUnitOfWork)(new UnitOfWork(context));
                var basevices = new BaseService();
                var hdtJobServices = new Hre_HDTJobServices();
                var ProfileServices = new Hre_ProfileServices();
                List<object> listObjHDTJob = new List<object>();
                listObjHDTJob.Add(orgStructureID);
                listObjHDTJob.Add(workPlaceID);
                listObjHDTJob.Add(dateFrom);
                listObjHDTJob.Add(dateTo);
                listObjHDTJob.Add(1);
                listObjHDTJob.Add(Int32.MaxValue - 1);
                var lstDependant = hdtJobServices.GetData<Hre_DependantEntity>(listObjHDTJob, ConstantSql.hrm_hr_sp_get_ReportDependantProfileQuit, userLogin, ref status).ToList();

                if (lstDependant.Count == 0)
                {
                    return lstReportDependantProfileQuit;
                }
                Guid[] lstprofileIds = lstDependant.Select(x => Guid.Parse(x.ProfileID.ToString())).ToArray();

                var repostopwoking = new Hre_StopWorkingRepository(unitOfWork);
                var profileids = repostopwoking.FindBy(s => s.IsDelete == null && s.ProfileID != null && lstprofileIds.Contains(s.ProfileID.Value)
                    && (s.StopWorkType == HRM.Infrastructure.Utilities.EnumDropDown.StopWorkType.E_SUSPENSE.ToString() ||
                    s.StopWorkType == HRM.Infrastructure.Utilities.EnumDropDown.StopWorkType.E_STOP.ToString()
                    )).Select(s => s.ProfileID).ToList();
                if (profileids != null && profileids.Count > 0)
                {
                    lstDependant = lstDependant.Where(s => profileids.Contains(s.ProfileID)).ToList();
                }

                foreach (var Dependant in lstDependant)
                {
                    Hre_ReportDependantProfileQuitEntity entity = new Hre_ReportDependantProfileQuitEntity();
                    entity.CodeEmp = Dependant.CodeEmp;
                    entity.ProfileName = Dependant.ProfileName;
                    entity.DependantName = Dependant.DependantName;
                    entity.DateOfBirth = Dependant.DateOfBirth;
                    entity.DateQuit = Dependant.DateQuit;
                    entity.MonthOfEffect = Dependant.MonthOfEffect;
                    lstReportDependantProfileQuit.Add(entity);
                }
            }
            return lstReportDependantProfileQuit;
        }
Ejemplo n.º 27
0
        public DataTable GetEvalutionDataByTemplate(int year, int? time, string orgStructureID,string userLogin)
        {
            using (var context = new VnrHrmDataContext())
            {
                var unitOfWork = (IUnitOfWork)(new UnitOfWork(context));

                DataTable table = CreateEvalutionDataSchema();

                DateTime _daystart = new DateTime(year - 1, 04, 01);
                int daysInFeb = System.DateTime.DaysInMonth(year, 2);
                DateTime _dayend = new DateTime(year, 02, daysInFeb);
                if (time == 2)
                {
                    int daysInMar = System.DateTime.DaysInMonth(year, 3);
                    _dayend = new DateTime(year, 03, daysInMar);
                }
                string status = string.Empty;
                List<Eva_EvalutionDataEntity> lstEvalutionDataEntity = new List<Eva_EvalutionDataEntity>();
                //    //ds nv
                var hrService = new Hre_ProfileServices();
                var service = new BaseService();
                List<object> strOrgIDs = new List<object>();
                strOrgIDs.AddRange(new object[3]);
                strOrgIDs[0] = (object)orgStructureID;
                var lstProfile = hrService.GetData<Hre_ProfileEntity>(strOrgIDs, ConstantSql.hrm_hr_sp_get_ProfileIdsByOrg, userLogin, ref status).ToList();
                if (lstProfile == null)
                    return table;
                DateTime _datetime = new DateTime(year, 01, 01);
                List<object> paraEvalutionData = new List<object>();
                paraEvalutionData.AddRange(new object[13]);

                paraEvalutionData[0] = orgStructureID;
                paraEvalutionData[1] = year;
                paraEvalutionData[2] = _datetime;
                paraEvalutionData[3] = time;
                paraEvalutionData[11] = 1;
                paraEvalutionData[12] = int.MaxValue - 1;

                var evaServiceEvalutionData = new Eva_EvalutionDataServices();
                var lstEvalutionData = evaServiceEvalutionData.GetData<Eva_EvalutionDataEntity>(paraEvalutionData, ConstantSql.hrm_eva_sp_get_EvalutionData, userLogin, ref status);
                foreach (var item in lstEvalutionData)
                {
                    var profile = lstProfile.Where(s => s.ID == item.ProfileID).FirstOrDefault();
                    if (profile != null)
                    {
                        DataRow row = table.NewRow();

                        row[Eva_ReportEvalutionDataEntity.FieldNames.CodeEmp] = profile.CodeEmp;
                        row[Eva_ReportEvalutionDataEntity.FieldNames.ProfileName] = profile.ProfileName;
                        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;
                        table.Rows.Add(row);
                    }
                }
                return table.ConfigTable(true);
                //    #endregion
            }
        }
Ejemplo n.º 28
0
        public List<Hre_HDTJobEntity> GetReportHDTJobOut(DateTime? DateTo, string lstOrgOrderNumber, Guid? workPlaceID, string profileName, string CodeEmp, string userLogin)
        {
            string status = string.Empty;
            List<Hre_HDTJobEntity> lstReportHDTJobEntity = new List<Hre_HDTJobEntity>();
            using (var context = new VnrHrmDataContext())
            {
                var unitOfWork = (IUnitOfWork)(new UnitOfWork(context));
                var basevices = new BaseService();
                var hdtJobServices = new Hre_HDTJobServices();
                var profileServices = new Hre_ProfileServices();
                List<object> listObjHDTJob = new List<object>();
                listObjHDTJob.Add(profileName);
                listObjHDTJob.Add(CodeEmp);
                listObjHDTJob.Add(null);
                listObjHDTJob.Add(null);
                listObjHDTJob.Add(null);
                listObjHDTJob.Add(lstOrgOrderNumber);
                listObjHDTJob.Add(null);
                listObjHDTJob.Add(null);
                listObjHDTJob.Add(null);
                listObjHDTJob.Add(null);
                listObjHDTJob.Add(null);
                listObjHDTJob.Add(null);
                listObjHDTJob.Add(1);
                listObjHDTJob.Add(Int32.MaxValue - 1);
                var lstHDTJob = hdtJobServices.GetData<Hre_HDTJobEntity>(listObjHDTJob, ConstantSql.hrm_hr_sp_get_HDTJob, userLogin, ref status).ToList();

                if (lstHDTJob.Count == 0)
                {
                    return lstReportHDTJobEntity;
                }
                if (DateTo != null)
                {
                    lstHDTJob = lstHDTJob.Where(s => s.DateTo != null && s.DateTo.Value.Date == DateTo.Value.Date).ToList();
                }
                lstReportHDTJobEntity = profileServices.getHDTJobByPrice(lstHDTJob, null, DateTo);
            }
            return lstReportHDTJobEntity;
        }
Ejemplo n.º 29
0
        public DataTable GetReportHCSales(DateTime DateSearch, Guid orgID, bool isCreateTemplate,string userLogin)
        {

            Hre_ReportServices reportServices = new Hre_ReportServices();
            DataTable table = CreateReportHCSalesSchema(userLogin);
            string status = string.Empty;
            using (var context = new VnrHrmDataContext())
            {
                if (isCreateTemplate)
                {
                    return table.ConfigTable();
                }
                string key1 = "SaleIn";
                string key2 = "SaleOut";
                var count = 1;
                var unitOfWork = (IUnitOfWork)(new UnitOfWork(context));
                var serviceProfile = new Hre_ProfileServices();
                var baseService = new BaseService();

                var orgsService = new Cat_OrgStructureServices();

                var lstallorgs = orgsService.GetDataNotParam<Cat_OrgStructure>(ConstantSql.hrm_cat_sp_get_AllOrg, userLogin, ref status).ToList();

                var orgTypeService = new Cat_OrgStructureTypeServices();
                var lstObjOrgType = new List<object>();
                lstObjOrgType.Add(null);
                lstObjOrgType.Add(null);
                lstObjOrgType.Add(1);
                lstObjOrgType.Add(int.MaxValue - 1);
                var lstOrgType = orgTypeService.GetData<Cat_OrgStructureType>(lstObjOrgType, ConstantSql.hrm_cat_sp_get_OrgStructureType, userLogin, ref status);

                var lstorgs = lstallorgs.Where(s => s.ParentID == orgID).ToList();
                var lstOrgName = lstallorgs.Where(s => s.ID == orgID).FirstOrDefault();

                var listorgid = lstorgs.Select(s => new { s.ID, s.OrderNumber, s.Code, s.OrgStructureName }).ToList();

                //Xử Lý lấy tất cả nhân viên trong phòng ban đã chọn và group 1 cấp
                var orgIDs = string.Empty;
                orderNumber = string.Empty;

                foreach (var item in listorgid)
                {
                    orderNumber += item.OrderNumber.ToString() + ",";
                    getChildOrgStructure(lstallorgs, item.ID);
                }
                if (orderNumber.IndexOf(',') > 0)
                    orderNumber = orderNumber.Substring(0, orderNumber.Length - 1);

                var lstObjOrgByOrderNumber = new List<object>();
                lstObjOrgByOrderNumber.Add(orderNumber);
                var lstOrgByOrderNumber = orgsService.GetData<Cat_OrgStructure>(lstObjOrgByOrderNumber, ConstantSql.hrm_cat_sp_get_OrgStructureByOrderNumber, userLogin, ref status).Select(s => s.ID).ToList();

                List<object> listObj = new List<object>();
                listObj.Add(orderNumber);
                listObj.Add(string.Empty);
                listObj.Add(string.Empty);

                var lstprofile = reportServices.GetData<Hre_ProfileEntity>(listObj, ConstantSql.hrm_hr_sp_get_ProfileIdsByOrg, userLogin, ref status).ToList();

                var salesTypeServices = new Eva_SalesTypeServices();
                var lstObjSalesType = new List<object>();
                lstObjSalesType.Add(null);
                lstObjSalesType.Add(1);
                lstObjSalesType.Add(int.MaxValue);
                var lstSalesType = salesTypeServices.GetData<Eva_SalesTypeEntity>(lstObjSalesType, ConstantSql.hrm_eva_sp_get_SalesType, userLogin, ref status).Select(s => s.Code).ToList();

                var saleEvaluationServices = new Eva_SaleEvaluationServices();
                var lstObjSaleEvaluation = new List<object>();
                lstObjSaleEvaluation.Add(null);
                lstObjSaleEvaluation.Add(null);
                lstObjSaleEvaluation.Add(null);
                lstObjSaleEvaluation.Add(1);
                lstObjSaleEvaluation.Add(int.MaxValue);
                var lstSaleEvaluation = saleEvaluationServices.GetData<Eva_SaleEvaluationEntity>(lstObjSaleEvaluation, ConstantSql.hrm_eva_sp_get_SaleEvaluation, userLogin, ref status).ToList();

                foreach (var org in listorgid)
                {
                    DataRow row = table.NewRow();

                    row[Hre_ReportHCSalesEntity.FieldNames.CodeEmp] = org == null ? string.Empty : org.OrgStructureName;

                    //xử lý đếm nhân viên của phòng ban con
                    orderNumber = string.Empty;
                    orderNumber += org.OrderNumber.ToString() + ",";
                    getChildOrgStructure(lstallorgs, org.ID);

                    if (orderNumber.IndexOf(',') > 0)
                        orderNumber = orderNumber.Substring(0, orderNumber.Length - 1);

                    var lstObjOrgByOrderNumberCount = new List<object>();
                    lstObjOrgByOrderNumberCount.Add(orderNumber);
                    var lstOrgByOrderNumberCount = orgsService.GetData<Cat_OrgStructure>(lstObjOrgByOrderNumberCount, ConstantSql.hrm_cat_sp_get_OrgStructureByOrderNumber, userLogin, ref status).ToList();
                    //if(count <= 0){
                    //    continue;
                    //}
                    bool addTitle = false;
                    foreach (var item in lstOrgByOrderNumberCount)
                    {
                        var lstprofilebyOrg = lstprofile.Where(s => s.OrgStructureID != null && item.ID == s.OrgStructureID.Value && s.DateHire != null && s.DateHire.Value.Year <= DateSearch.Year && s.DateQuit == null).Select(s => s.ID).ToList();
                        if (lstprofilebyOrg == null && lstprofilebyOrg.Count <= 0)
                        {
                            continue;
                        }
                        var lstSaleEvaluations = lstSaleEvaluation.Where(s => lstprofilebyOrg.Contains(s.ProfileID.Value) && s.Year != null && s.Year.Value.Year <= DateSearch.Year).ToList();
                        count = 0;
                        count = lstSaleEvaluation.Count;
                        foreach (var sale in lstSaleEvaluations)
                        {

                            var lstProfileResult = lstprofile.Where(s => s.ID == sale.ProfileID.Value).FirstOrDefault();

                            var orgName = reportServices.GetParentOrg(lstallorgs, lstOrgType, lstProfileResult.OrgStructureID);
                            if (orgName.Count < 3)
                            {
                                orgName.Insert(0, string.Empty);
                                if (orgName.Count < 3)
                                {
                                    orgName.Insert(0, string.Empty);
                                }
                            }

                            DataRow row1 = table.NewRow();

                            row1[Hre_ReportHCSalesEntity.FieldNames.CodeEmp] = lstProfileResult == null ? string.Empty : lstProfileResult.CodeEmp;
                            row1[Hre_ReportHCSalesEntity.FieldNames.ProfileName] = lstProfileResult == null ? string.Empty : lstProfileResult.ProfileName;
                            row1[Hre_ReportHCSalesEntity.FieldNames.PositionName] = lstProfileResult == null ? string.Empty : lstProfileResult.PositionName;
                            row1[Hre_ReportHCSalesEntity.FieldNames.JobTitleName] = lstProfileResult == null ? string.Empty : lstProfileResult.JobTitleName;
                            row1[Hre_ReportHCSalesEntity.FieldNames.ProfileSupervisorName] = lstProfileResult == null ? string.Empty : lstProfileResult.SupervisorName;
                            row1[Hre_ReportHCSalesEntity.FieldNames.DateHire] = lstProfileResult == null ? string.Empty : lstProfileResult.DateHire.Value.ToShortDateString();
                            row1[Hre_ReportHCSalesEntity.FieldNames.Channel] = orgName[2];
                            row1[Hre_ReportHCSalesEntity.FieldNames.Region] = orgName[1];
                            row1[Hre_ReportHCSalesEntity.FieldNames.Area] = orgName[0];
                            row1[Hre_ReportHCSalesEntity.FieldNames.WorkingPlaceName] = lstProfileResult == null ? string.Empty : lstProfileResult.WorkPlaceName;
                            for (int i = 1; i <= 12; i++)
                            {
                                var saleCode = sale.SalesTypeCode + "_" + i;
                                if (sale.SalesTypeCode == key1 && sale.Year != null && sale.Year.Value.Month == i)
                                {
                                    row1[Hre_ReportHCSalesEntity.FieldNames.TargetSalesIn + "_" + i] = sale.TagetNumber;
                                    row1[Hre_ReportHCSalesEntity.FieldNames.ActSalesIn + "_" + i] = sale.ResultNumber;
                                    row1[Hre_ReportHCSalesEntity.FieldNames.SalesIn + "_" + i] = sale.ResultPercent != null ? sale.ResultPercent.Value.ToString(ConstantFormat.HRM_Format_Number_Double2) : null;
                                }
                                if (sale.SalesTypeCode == key2 && sale.Year != null && sale.Year.Value.Month == i)
                                {
                                    row1[Hre_ReportHCSalesEntity.FieldNames.TargetSalesOut + "_" + i] = sale.TagetNumber;
                                    row1[Hre_ReportHCSalesEntity.FieldNames.ActSalesOut + "_" + i] = sale.ResultNumber;
                                    row1[Hre_ReportHCSalesEntity.FieldNames.SalesOut + "_" + i] = sale.ResultPercent != null ? sale.ResultPercent.Value.ToString(ConstantFormat.HRM_Format_Number_Double2) : null;
                                }

                                if (lstSaleEvaluation.Where(s => s.Year != null).Select(s => s.Year.Value.Month).ToList().Contains(i) && table.Columns.Contains(saleCode))
                                {
                                    row1[sale.SalesTypeCode + "_" + i] = sale.ResultPercent != null ? sale.ResultPercent.Value.ToString(ConstantFormat.HRM_Format_Number_Double2) : null;
                                }
                            }
                            if (!addTitle)
                            {
                                table.Rows.Add(row);
                                addTitle = true;
                            }
                            table.Rows.Add(row1);
                        }

                    }


                }



                return table.ConfigTable(true);
            }
        }
Ejemplo n.º 30
0
 public List<Hre_HDTJobEntity> GetReportHDTJobDecisionAssignWork(DateTime? Datesearch, string lstOrgOrderNumber, Guid? positionID, Guid? jobTitleID, string profileName, string CodeEmp, string userLogin)
 {
     string status = string.Empty;
     List<Hre_HDTJobEntity> lstReportHDTJobEntity = new List<Hre_HDTJobEntity>();
     using (var context = new VnrHrmDataContext())
     {
         var unitOfWork = (IUnitOfWork)(new UnitOfWork(context));
         var basevices = new BaseService();
         var hdtJobServices = new Hre_HDTJobServices();
         var profileServices = new Hre_ProfileServices();
         List<object> listObjHDTJob = new List<object>();
         listObjHDTJob.Add(profileName);
         listObjHDTJob.Add(CodeEmp);
         listObjHDTJob.Add(null);
         listObjHDTJob.Add(null);
         listObjHDTJob.Add(null);
         listObjHDTJob.Add(lstOrgOrderNumber);
         listObjHDTJob.Add(null);
         listObjHDTJob.Add(null);
         listObjHDTJob.Add(null);
         listObjHDTJob.Add(null);
         listObjHDTJob.Add(null);
         listObjHDTJob.Add(null);
         listObjHDTJob.Add(1);
         listObjHDTJob.Add(Int32.MaxValue - 1);
         
         var lstHDTJob = hdtJobServices.GetData<Hre_HDTJobEntity>(listObjHDTJob, ConstantSql.hrm_hr_sp_get_HDTJob, userLogin, ref status).ToList();              
         if (lstHDTJob.Count == 0)
         {
             return lstReportHDTJobEntity;
         }
         if (Datesearch != null )
         {
             lstHDTJob = lstHDTJob.Where(s => s.DateFrom != null &&  s.DateTo != null && (s.DateFrom.Value.Date == Datesearch.Value.Date || s.DateTo.Value.Date == Datesearch.Value.Date)).ToList();
         }
         
         lstReportHDTJobEntity = profileServices.getHDTJobByPrice(lstHDTJob, null, null);
         lstReportHDTJobEntity = lstReportHDTJobEntity.OrderByDescending(s => s.CodeEmp).ThenBy(s => s.ProfileName).ThenBy(s => s.DateFrom).ToList();
     }
     return lstReportHDTJobEntity;
 }