예제 #1
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;
 }
예제 #2
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);
            }
        }
예제 #3
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;
        }
예제 #4
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;
        }
예제 #5
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;
        }
예제 #6
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();
        }
예제 #7
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;
        }
예제 #8
0
        public DataTable GetReportProfileHDTInMonth(DateTime Month, string lstOrgOrderNumber, List<string> lstUnit, List<string> lstDept, List<string> lstPart, bool IsCreateTemplate, string userLogin)
        {
            DataTable table = CreateReportProfileHDTInMonthSchema();
            if (IsCreateTemplate)
            {
                return table.ConfigTable();
            }
            DateTime monthStart = new DateTime(Month.Year, Month.Month, 1);
            DateTime monthEnd = monthStart.AddMonths(1).AddMilliseconds(-1);
            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] = lstOrgOrderNumber;
                listObjHDTJob[12] = 1;
                listObjHDTJob[13] = Int32.MaxValue - 1;
                var lstHDTJob = hdtJobServices.GetData<Hre_HDTJobEntity>(listObjHDTJob, ConstantSql.hrm_hr_sp_get_HDTJob, userLogin, ref status).ToList();
                //Hieu.Van: HungLe yêu cầu thêm nghiệp vụ này idTask: 19234
                //Chỉ xuất những người còn làm HDTJob trong tháng

                lstHDTJob = lstHDTJob.Where(s => s.DateFrom != null && s.DateFrom.Value.Month == Month.Month).ToList();
               
                if (lstUnit.Count() > 0)
                {
                    lstHDTJob = lstHDTJob.Where(s => lstUnit.Contains(s.Unit)).ToList();
                }
                if (lstDept.Count() > 0)
                {
                    lstHDTJob = lstHDTJob.Where(s => lstDept.Contains(s.Dept)).ToList();
                }
                if (lstPart.Count() > 0)
                {
                    lstHDTJob = lstHDTJob.Where(s => lstPart.Contains(s.Part)).ToList();
                }
                if (lstHDTJob.Count == 0)
                {
                    return table;
                }
                var lstProfileIDsByHDTJob = lstHDTJob.Select(s => s.ProfileID).ToList();
                #region DS ngày công Theo ProfileIds
                var workDayRepository = new Att_WorkDayRepository(unitOfWork);
                var lstWorkDay = new List<Att_Workday>().Select(s => new
                {
                    s.ID,
                    s.ProfileID,
                    s.WorkDate,
                    s.ShiftActual
                }).ToList();

                lstWorkDay.AddRange(workDayRepository.FindBy(s => s.IsDelete == null && s.FirstInTime != null && s.LastOutTime != null && s.WorkDate.Month == Month.Month 
                    && lstProfileIDsByHDTJob.Contains(s.ProfileID)).Select(s => new
                {
                    s.ID,
                    s.ProfileID,
                    s.WorkDate,
                    s.ShiftActual
                }).ToList());
                #endregion
                #region DS ngày nghỉ Theo ProfileIds
                var leavedayRepository = new Att_LeavedayRepository(unitOfWork);
                var lstleaveday = new List<Att_LeaveDay>().Select(s => new
                {
                    s.ID,
                    s.ProfileID,
                    s.DateStart,
                    s.DateEnd
                }).ToList();

                lstleaveday.AddRange(leavedayRepository.FindBy(s => s.IsDelete == null
                    && s.DateStart.Month <= Month.Month && s.DateEnd.Month >= Month.Month
                    && lstProfileIDsByHDTJob.Contains(s.ProfileID) && s.Status == LeaveDayStatus.E_APPROVED.ToString()).Select(s => new
                    {
                        s.ID,
                        s.ProfileID,
                        s.DateStart,
                        s.DateEnd
                    }).ToList());
                #endregion
                #region DS ca làm việc
                var shiftRepository = new Cat_ShiftRepository(unitOfWork);
                var lstShift = new List<Cat_Shift>().Select(s => new
                {
                    s.ID,
                    s.Code
                }).ToList();

                lstShift.AddRange(shiftRepository.FindBy(s => s.IsDelete == null ).Select(s => new
                    {
                        s.ID,
                        s.Code
                    }).ToList());
                #endregion
                Hre_ProfileServices hreService = new Hre_ProfileServices();
                lstHDTJob = hreService.getHDTJobByPrice(lstHDTJob, monthStart, monthEnd);
                foreach (var HDTJob in lstHDTJob)
                {
                    DataRow row = table.NewRow();
                    row[Hre_ReportProfileHDTInMonthEntity.FieldNames.ProfileName] = HDTJob.ProfileName;
                    row[Hre_ReportProfileHDTInMonthEntity.FieldNames.CodeEmp] = HDTJob.CodeEmp;
                    row[Hre_ReportProfileHDTInMonthEntity.FieldNames.E_DEPARTMENT] = HDTJob.E_DEPARTMENT;
                    row[Hre_ReportProfileHDTInMonthEntity.FieldNames.E_DIVISION] = HDTJob.E_DIVISION;
                    row[Hre_ReportProfileHDTInMonthEntity.FieldNames.E_SECTION] = HDTJob.E_SECTION;
                    row[Hre_ReportProfileHDTInMonthEntity.FieldNames.E_TEAM] = HDTJob.E_TEAM;
                    row[Hre_ReportProfileHDTInMonthEntity.FieldNames.E_UNIT] = HDTJob.E_UNIT;
                    row[Hre_ReportProfileHDTInMonthEntity.FieldNames.Unit] = HDTJob.Unit;
                    row[Hre_ReportProfileHDTInMonthEntity.FieldNames.Dept] = HDTJob.Dept;
                    row[Hre_ReportProfileHDTInMonthEntity.FieldNames.Part] = HDTJob.Part;
                    row[Hre_ReportProfileHDTInMonthEntity.FieldNames.Line] = HDTJob.Line;
                    row[Hre_ReportProfileHDTInMonthEntity.FieldNames.Price] = HDTJob.Price != null ? HDTJob.Price : 0;
                    row[Hre_ReportProfileHDTInMonthEntity.FieldNames.Session] = HDTJob.Session;
                    row[Hre_ReportProfileHDTInMonthEntity.FieldNames.HDTJobTypeName] = HDTJob.HDTJobTypeName;
                    row[Hre_ReportProfileHDTInMonthEntity.FieldNames.HDTJobTypeNameHVN] = HDTJob.HDTJobTypeNameHVN;
                    row[Hre_ReportProfileHDTInMonthEntity.FieldNames.StandardElement] = HDTJob.StandardElement;
                    row[Hre_ReportProfileHDTInMonthEntity.FieldNames.EncryptJob] = HDTJob.EncryptJob;
                    row[Hre_ReportProfileHDTInMonthEntity.FieldNames.HDTJobGroupName] = HDTJob.HDTJobGroupName;
                    var workdaybypro = lstWorkDay.Where(s => s.ProfileID == HDTJob.ProfileID).ToList();
                    if (workdaybypro.Count  == 0)
                    {
                        continue;
                    }
                    for (int i = 1; i <= 31; i++)
                    {
                        var workdaybydate = workdaybypro.Where(s => s.WorkDate != null && s.WorkDate.Day == i).FirstOrDefault();
                        if (workdaybydate == null)
                        {
                            continue;
                        }
                        else
                        {
                            var leavedaybydate = lstleaveday.Where(s => s.DateStart.Day <= i && s.DateEnd.Day >= i).FirstOrDefault();
                            if (leavedaybydate != null)
                            {
                                continue;
                            }
                            else
                            {
                                var shiftbydate = lstShift.Where(s => s.ID == workdaybydate.ShiftActual).FirstOrDefault();
                                row[Hre_ReportProfileHDTInMonthEntity.FieldNames.Data + i] = shiftbydate != null ? shiftbydate.Code : null;
                            }
                        }
                    }
                    table.Rows.Add(row);
                }
            }
            return table.ConfigTable();
        }
예제 #9
0
        public DataTable GetReportProfileHDTNotWork(DateTime DateFrom, DateTime DateTo, string lstOrgOrderNumber, string nameReport, bool isCreateTemplate,string userLogin)
        {
            string status = string.Empty;
            //List<Hre_ReportProfileHDTNotWorkEntity> lstReportProfileHDTNotWork = new List<Hre_ReportProfileHDTNotWorkEntity>();
            using (var context = new VnrHrmDataContext())
            {
                var unitOfWork = (IUnitOfWork)(new UnitOfWork(context));
                var basevices = new BaseService();


                DataTable tb = GetSchema_ReportProfileHDTNotWork(nameReport);
                if (isCreateTemplate)
                {
                    return tb.ConfigTable();
                }


                var hdtJobServices = new Hre_HDTJobServices();
                List<object> listObjHDTJob = new List<object>();
                listObjHDTJob.AddRange(new object[14]);
                listObjHDTJob[5] = lstOrgOrderNumber;
                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_HDTJob, userLogin, ref status).ToList();

                if (lstHDTJob == null || lstHDTJob.Count == 0)
                {
                    return tb.ConfigTable();
                }

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

                //var lstobjectProfileids = new List<object>();
                //string strIDs = string.Empty;
                //foreach (var item in lstProfileIDsByHDTJob)
                //{
                //    strIDs += Common.DotNetToOracle(item.ToString()) + ",";
                //}
                //if (strIDs.IndexOf(",") > 0)
                //    strIDs = strIDs.Substring(0, strIDs.Length - 1);
                //lstobjectProfileids.Add(strIDs);
                //var lstLeaveDay = basevices.GetData<Att_LeaveDayEntity>(strIDs, ConstantSql.hrm_att_sp_get_LeavedayByIds, ref status);

                List<object> para = new List<object>();
                para.AddRange(new object[3]);
                para[0] = (object)lstOrgOrderNumber;
                para[1] = DateFrom;
                para[2] = DateTo;
                var lstLeaveDay = GetData<Att_LeaveDayEntity>(para, ConstantSql.hrm_att_getdata_LeaveDay, userLogin, ref status);
                if (lstLeaveDay.Count > 0)
                {
                    lstLeaveDay = lstLeaveDay.Where(s => lstProfileIDsByHDTJob.Contains(s.ProfileID)).ToList();
                }

                if (lstLeaveDay != null && lstLeaveDay.Count > 0)
                {
                    lstLeaveDay = lstLeaveDay.Where(s => s.DateStart != null && s.DateEnd != null && s.DateStart <= DateTo && s.DateEnd >= DateFrom).ToList();
                }

                if (lstLeaveDay == null)
                {
                    return tb.ConfigTable();
                }

                List<object> listObjLeaveDayType = new List<object>();
                listObjLeaveDayType.Add(null);
                listObjLeaveDayType.Add(null);
                listObjLeaveDayType.Add(1);
                listObjLeaveDayType.Add(Int32.MaxValue - 1);
                var lstLeaveDayType = basevices.GetData<Cat_LeaveDayTypeEntity>(listObjLeaveDayType, ConstantSql.hrm_cat_sp_get_LeaveDayType, userLogin, ref status).ToList();

                Hre_ProfileServices hreService = new Hre_ProfileServices();
                lstHDTJob = hreService.getHDTJobByPrice(lstHDTJob, DateFrom, DateTo);

                foreach (var HDTJob in lstHDTJob)
                {
                    DataRow row = tb.NewRow();

                    row["ProfileName"] = HDTJob.ProfileName;
                    row["CodeEmp"] = HDTJob.CodeEmp;
                    row["E_DEPARTMENT"] = HDTJob.E_DEPARTMENT;
                    row["E_DIVISION"] = HDTJob.E_DIVISION;
                    row["E_SECTION"] = HDTJob.E_SECTION;
                    row["E_TEAM"] = HDTJob.E_TEAM;
                    row["E_UNIT"] = HDTJob.E_UNIT;
                    row["HDTJobGroupCode"] = HDTJob.HDTJobGroupCode;
                    row["HDTJobTypeCode"] = HDTJob.HDTJobTypeCode;

                    if (HDTJob.DateFrom != null)
                        row["HDTDateFrom"] = HDTJob.DateFrom;

                    if (HDTJob.DateTo != null)
                        row["HDTDateTo"] = HDTJob.DateTo;

                    if (HDTJob.Price != null)
                        row["Price"] = HDTJob.Price;
                    if (HDTJob.DateTo != null && HDTJob.DateFrom != null)
                    {
                        var leavedaybyhdt = lstLeaveDay.Where(s => s.ProfileID == HDTJob.ProfileID
                       && (s.DateStart != null && s.DateEnd != null && s.DateStart.Date <= HDTJob.DateTo.Value.Date && s.DateEnd.Date >= HDTJob.DateFrom.Value.Date)).FirstOrDefault();
                        if (lstLeaveDayType != null && leavedaybyhdt != null)
                        {
                            var leavedaytype = lstLeaveDayType.Where(s => s.ID == leavedaybyhdt.LeaveDayTypeID).FirstOrDefault();
                            row["LeaveDayTypeCode"] = leavedaytype != null ? leavedaytype.Code : null;
                        }
                    }
                    else
                    {
                        var leavedaybyhdt = lstLeaveDay.Where(s => s.ProfileID == HDTJob.ProfileID
                       && (s.DateStart != null && s.DateEnd != null && s.DateStart.Date <= HDTJob.DateFrom.Value.Date && s.DateEnd.Date >= HDTJob.DateFrom.Value.Date)).FirstOrDefault();
                        if (lstLeaveDayType != null && leavedaybyhdt != null)
                        {
                            var leavedaytype = lstLeaveDayType.Where(s => s.ID == leavedaybyhdt.LeaveDayTypeID).FirstOrDefault();
                            row["LeaveDayTypeCode"] = leavedaytype != null ? leavedaytype.Code : null;
                        }
                    }

                    tb.Rows.Add(row);
                }

                return tb.ConfigTable();
            }
        }
예제 #10
0
        public ActionResult ExportHDTJobListByTemplate([DataSourceRequest] DataSourceRequest request, Hre_HDTJobSearchModel model)
        {
            HeaderInfo headerInfo1 = new HeaderInfo() { Name = "DateFrom", Value = model.DateFrom == null ? DateTime.Now : model.DateFrom };
            HeaderInfo headerInfo2 = new HeaderInfo() { Name = "DateTo", Value = model.DateTo == null ? DateTime.Now : model.DateTo };
            List<HeaderInfo> listHeaderInfo = new List<HeaderInfo>() { headerInfo1, headerInfo2 };
            string status = string.Empty;
            var isDataTable = false;
            object obj = new Hre_ProfileModel();
            var actionServices = new ActionService(UserLogin);
            List<object> lstObjSearch = new List<object>();
            lstObjSearch.Add(model.ProfileName);
            lstObjSearch.Add(model.CodeEmp);
            lstObjSearch.Add(model.HDTJobTypeID);
            lstObjSearch.Add(model.JobTitleID);
            lstObjSearch.Add(model.PositionID);
            lstObjSearch.Add(model.OrgStructureID);
            lstObjSearch.Add(model.DateFrom);
            lstObjSearch.Add(model.DateTo);
            lstObjSearch.Add(model.Price);
            lstObjSearch.Add(model.IsCreateTemplate);
            lstObjSearch.Add(model.ExportId);
            lstObjSearch.Add(model.ExportType);
            lstObjSearch.Add(1);
            lstObjSearch.Add(int.MaxValue - 1);
            var result = actionServices.GetData<Hre_HDTJobEntity>(lstObjSearch, ConstantSql.hrm_hr_sp_get_HDTJob, ref status);
            var profileServices = new Hre_ProfileServices();
            var listResult = profileServices.getHDTJobByPrice(result, model.DateFrom, model.DateTo).Translate<Hre_HDTJobModel>();
            if (model != null && model.IsCreateTemplate)
            {
                var path = Common.GetPath("Templates");
                ExportService exportService = new ExportService();
                ConfigExport cfgExport = new ConfigExport()
                {
                    Object = new Hre_HDTJobModel(),
                    FileName = "Hre_HDTJob",
                    OutPutPath = path,
                    HeaderInfo = listHeaderInfo,
                    DownloadPath = Hrm_Main_Web + "Templates",
                    IsDataTable = isDataTable
                };
                var str = exportService.CreateTemplate(cfgExport);
                return Json(str);
            }

            if (model.ExportId != Guid.Empty)
            {
                if (model.DateFrom != null && model.DateTo != null)
                {
                    var fullPath = ExportService.Export(model.ExportId, listResult, listHeaderInfo, model.ExportType);
                    return Json(fullPath);
                }
                else
                {
                    var fullPath = ExportService.Export(model.ExportId, listResult, null, model.ExportType);
                    return Json(fullPath);
                }

            }
            return Json(result.ToDataSourceResult(request));
        }
예제 #11
0
        public ActionResult GetHDTJobList([DataSourceRequest] DataSourceRequest request, Hre_HDTJobSearchModel model)
        {
            var actionServices = new ActionService(UserLogin);
            string status = string.Empty;
            List<object> lstObjSearch = new List<object>();
            lstObjSearch.Add(model.ProfileName);
            lstObjSearch.Add(model.CodeEmp);
            lstObjSearch.Add(model.HDTJobTypeID);
            lstObjSearch.Add(model.JobTitleID);
            lstObjSearch.Add(model.PositionID);
            lstObjSearch.Add(model.OrgStructureID);
            lstObjSearch.Add(model.DateFrom);
            lstObjSearch.Add(model.DateTo);
            lstObjSearch.Add(model.Price);
            lstObjSearch.Add(model.IsCreateTemplate);
            lstObjSearch.Add(model.ExportId);
            lstObjSearch.Add(model.ExportType);
            lstObjSearch.Add(1);
            lstObjSearch.Add(int.MaxValue - 1);
            var result = actionServices.GetData<Hre_HDTJobEntity>(lstObjSearch, ConstantSql.hrm_hr_sp_get_HDTJob, ref status);
            if (result.Count > 0)
            {
                var profileServices = new Hre_ProfileServices();
                var listResult = profileServices.getHDTJobByPrice(result, model.DateFrom, model.DateTo);
                return Json(listResult.ToDataSourceResult(request));
            }
            else
            {
                return null;
            }

        }
예제 #12
0
        public ActionResult GetReportDetailProfileHDTJob([DataSourceRequest] DataSourceRequest request, Hre_ReportDetailProfileHDTJobModel model)
        {
            #region Validate
            string status = string.Empty;
            string message = string.Empty;
            var checkValidate = ValidatorService.OnValidateData<Hre_ReportDetailProfileHDTJobModel>(model, "Hre_ReportDetailProfileHDTJob", ref message);
            if (!checkValidate)
            {
                return Json(message);
            }
            #endregion
            var actionService = new ActionService(UserLogin);
            var hrService = new Hre_ProfileServices();
            object obj = new Hre_ReportDetailProfileHDTJobModel();
            var isDataTable = false;
            HeaderInfo headerInfo1 = new HeaderInfo() { Name = "DateSearch", Value = model.DateSearch != null ? model.DateSearch : DateTime.Now };
            List<HeaderInfo> listHeaderInfo = new List<HeaderInfo>() { headerInfo1 };
            List<object> lstObjSearch = new List<object>();
            lstObjSearch.Add(null);
            lstObjSearch.Add(null);
            lstObjSearch.Add(null);
            lstObjSearch.Add(null);
            lstObjSearch.Add(null);
            lstObjSearch.Add(model.OrgStructureID);
            lstObjSearch.Add(null);
            lstObjSearch.Add(null);
            lstObjSearch.Add(null);
            lstObjSearch.Add(null);
            lstObjSearch.Add(null);
            lstObjSearch.Add(null);
            lstObjSearch.Add(1);
            lstObjSearch.Add(int.MaxValue - 1);
            var result = actionService.GetData<Hre_HDTJobEntity>(lstObjSearch, ConstantSql.hrm_hr_sp_get_HDTJob, ref status).Where(s =>
                (s.DateFrom <= model.DateSearch && s.DateTo >= model.DateSearch) || (s.DateFrom <= model.DateSearch && s.DateTo == null)).ToList();

            if (result.Count > 0)
            {
                var profileServices = new Hre_ProfileServices();
                var listResult = profileServices.getHDTJobByPrice(result, model.DateFrom, model.DateTo).Translate<Hre_ReportDetailProfileHDTJobModel>();
                return Json(listResult.ToDataSourceResult(request));
            }
            if (model != null && model.IsCreateTemplate)
            {
                var path = Common.GetPath("Templates");
                ExportService exportService = new ExportService();
                ConfigExport cfgExport = new ConfigExport()
                {
                    Object = new Hre_ReportDetailProfileHDTJobModel(),
                    FileName = "Hre_ReportDetailProfileHDTJob",
                    OutPutPath = path,
                    HeaderInfo = listHeaderInfo,
                    DownloadPath = Hrm_Main_Web + "Templates",
                    IsDataTable = false
                };
                var str = exportService.CreateTemplate(cfgExport);
                return Json(str);
            }

            if (model.ExportID != Guid.Empty)
            {
                var fullPath = ExportService.Export(model.ExportID, result, listHeaderInfo, model.ExportType);

                return Json(fullPath);
            }
            return Json(result.ToDataSourceResult(request));
        }