public string RecusiveCongViec(long congviecid, List <CongViecBO> LstCongViec, string rootIdx,
                                       List <DM_NGUOIDUNG> ListNguoiDung, List <HSCV_CONGVIEC_NGUOITHAMGIAXULY> ListThamGia,
                                       List <HSCV_CONGVIEC_LAPKEHOACH> ListPlan)
        {
            HSCV_CONGVIECBusiness           = Get <HSCV_CONGVIECBusiness>();
            HSCV_TRINHDUYETCONGVIECBusiness = Get <HSCV_TRINHDUYETCONGVIECBusiness>();
            HSCV_CONGVIEC_XINLUIHANBusiness = Get <HSCV_CONGVIEC_XINLUIHANBusiness>();
            PHIEUDANHGIACONGVIECBusiness    = Get <PHIEUDANHGIACONGVIECBusiness>();

            var    LstCongViecRoot = LstCongViec.Where(x => x.CONGVIECGOC_ID == congviecid).ToList();
            var    html            = "";
            string thamgia         = "";
            var    idx             = 1;
            int    size            = 0;
            int    sizePlan        = 0;

            if (LstCongViecRoot.Count > 0)
            {
                foreach (var item in LstCongViecRoot)
                {
                    InitRow(LstCongViec, ListThamGia, ListPlan, ListNguoiDung, ref html, ref idx,
                            out sizePlan, out size, ref thamgia, item, rootIdx + "." + idx.ToString(), false);
                }
            }
            return(html);
        }
        public PartialViewResult ResultTheoDoiCongViec(string FROM_QUERY_DATE, string TO_QUERY_DATE, string DONVI_ID, string NHANVIEN_ID)
        {
            HSCV_CONGVIECBusiness                  = Get <HSCV_CONGVIECBusiness>();
            HSCV_CONGVIEC_LAPKEHOACHBusiness       = Get <HSCV_CONGVIEC_LAPKEHOACHBusiness>();
            HSCV_TRINHDUYETCONGVIECBusiness        = Get <HSCV_TRINHDUYETCONGVIECBusiness>();
            HSCV_CONGVIEC_XINLUIHANBusiness        = Get <HSCV_CONGVIEC_XINLUIHANBusiness>();
            PHIEUDANHGIACONGVIECBusiness           = Get <PHIEUDANHGIACONGVIECBusiness>();
            HSCV_CONGVIEC_NGUOITHAMGIAXULYBusiness = Get <HSCV_CONGVIEC_NGUOITHAMGIAXULYBusiness>();
            DM_NGUOIDUNGBusiness = Get <DM_NGUOIDUNGBusiness>();
            DateTime            date1         = FROM_QUERY_DATE.ToDateTime().Value;
            DateTime            date2         = TO_QUERY_DATE.ToDateTime().Value;
            var                 LstDeptId     = DONVI_ID.ToListInt(',');
            List <DM_NGUOIDUNG> ListNguoiDung = DM_NGUOIDUNGBusiness.GetDataByUnitId(LstDeptId);

            var LstCongViec = HSCV_CONGVIECBusiness.GetDsCongViec(LstDeptId, ListNguoiDung.Select(x => x.ID).ToList(), date1, date2);
            // Công việc gốc
            var LstCongViecRoot = LstCongViec.Where(x => x.IS_SUBTASK == null).ToList();

            List <long> ListJobId = LstCongViec.Select(x => x.ID).ToList();

            // Add thêm các công việc con được giao xuống nhưng có công việc cha ko nằm trong danh sách công việc hiện tại của phòng ban, danh sách người dùng
            foreach (var job in LstCongViec)
            {
                if (!ListJobId.Contains(job.ParentId) && !LstCongViecRoot.Contains(job))
                {
                    LstCongViecRoot.Add(job);
                }
            }
            var ListThamGia = HSCV_CONGVIEC_NGUOITHAMGIAXULYBusiness.GetData(ListJobId);
            var ListPlan    = HSCV_CONGVIEC_LAPKEHOACHBusiness.GetData(ListJobId);

            ListNguoiDung = DM_NGUOIDUNGBusiness.GetData(ListThamGia.Select(x => x.USER_ID).ToList());
            var    html     = "";
            var    idx      = 1;
            int    sizePlan = 0;
            int    size     = 0;
            string thamgia  = "";

            ListReportModel = new List <ReportExcelModel>();
            foreach (var item in LstCongViecRoot)
            {
                currentJobStt = idx;
                InitRow(LstCongViec, ListThamGia, ListPlan, ListNguoiDung, ref html, ref idx,
                        out sizePlan, out size, ref thamgia, item, "", true);
            }
            SessionManager.SetValue("ListReportModel", ListReportModel);
            return(PartialView("ResultTheoDoiCongViec", html));
        }