Exemplo n.º 1
0
        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));
        }