public ActionResult Index() { long depId = CurrenUser.DeptId ?? 4; if (CurrenUser.IsAdminAndAcct()) { depId = 4; } var currentYear = DateTime.Now.Year; var filter = new PlanFilter() { Id = depId, Year = currentYear }; ViewBag.AllPrograms = programService.GetModelAll(); ViewBag.AllSalse = usersServices.GetAll(x => x.DeptId == depId && x.IsActive == true); var listUserShow = planSaleService.GetAllByUser(CurrenUser, currentYear, depId); var listDeptShow = planSaleService.GetAllDeptList(currentYear, depId); var depList = usersServices.GetSalesDept(); ViewBag.AlldeptSalseList = new SelectList(depList, "Id", "DeptName"); ViewBag.PlanOfDep = listDeptShow; ViewBag.PlanFilter = filter; return(View(listUserShow)); }
private List <PlanYearSummaryReport> ProcessProsonalPlanFollowup(PlanFilter filter) { var summary = crmCustomerService.SummarysList(CurrenUser, filter); var totalShipmentExc = summary.Sum(x => x.TotalShippments); //So lo thanh cong var totalSuccessExc = summary.Sum(x => x.SuccessFully); // khach hang moi thanh cong var totalVistedExc = summary.Sum(x => x.TotalVisitedSuccess); //Vieng tham var totaldocdExc = summary.Sum(x => x.TotalDocument); //Bai viet var totalEmailExc = summary.Sum(x => x.TotalFirstSendEmail); //Guid bao gia var plans = planMonthService.GetQuery(x => (filter.Month == 0 || x.PlanMonth == filter.Month) && x.PlanYear == filter.Year); var listUserShow = planSaleService.GetAllByUser(CurrenUser, filter.Year, filter.Id); switch (filter.SummaryByType) { case SummaryByType.ByUser: plans = plans.Where(x => x.CRMPlanProgMonth.CRMPLanSale.SalesId == filter.Id); break; case SummaryByType.ByDeparment: plans = plans.Where(x => x.CRMPlanProgMonth.CRMPLanSale.Sales.DeptId == filter.Id); break; case SummaryByType.ByOffice: plans = plans.Where(x => x.CRMPlanProgMonth.CRMPLanSale.Sales.ComId == filter.Id); break; } var planMonths = plans.Where(x => x.PlanMonth == filter.Month).ToList(); foreach (var p in planMonths) { for (int i = 1; i <= 12; i++) { } } return(new List <PlanYearSummaryReport>()); }