Exemplo n.º 1
0
        //获取统计时间段
        public ActionResult GetStatisticTimes(Guid projectId)
        {
            StatisticLogic logic  = new StatisticLogic();
            var            result = logic.GetStatisticTimes(projectId);

            return(Json(result));
        }
Exemplo n.º 2
0
        //打开项目详情统计页面
        public ActionResult ProjectDetailStatistic(Guid projectId)
        {
            StatisticLogic logic       = new StatisticLogic();
            ProjectModel   ProjectInfo = logic.GetProjectDetailById(projectId);
            //return View(ProjectInfo.ToPublicAnonymousType());
            SumHourModel shm = logic.GetTotalValueById(projectId);

            if (shm == null)
            {
                ProjectInfo.TotalValue = 0;
            }
            else
            {
                ProjectInfo.TotalValue = shm.TotalValue;
            }
            ViewBag.ProjectInfo = ProjectInfo;

            //计算折线统计图表中的PloatPlones的值
            List <String> times = logic.GetStatisticTimes(projectId);
            ProjectTime   pt    = logic.GetProjectTime(projectId);

            String planBYM = pt.PBeginTime.Substring(0, 7);
            String planEYM = pt.PEndTime.Substring(0, 7);
            String planBD  = pt.PBeginTime.Substring(8, 2);
            String planED  = pt.PEndTime.Substring(8, 2);

            String realBYM = pt.RBeginTime.Substring(0, 7);
            String realEYM = pt.REndTime.Substring(0, 7);
            String realBD  = pt.RBeginTime.Substring(8, 2);
            String realED  = pt.REndTime.Substring(8, 2);

            int count = times.Count;

            for (int i = 0; i < count; i++)
            {
                if (times[i] == planBYM)
                {
                    ViewBag.PlanBegin = i + (double.Parse(planBD) - getMonthMiddleDay(planBYM)) / getMonthDays(planBYM);
                }
                if (times[i] == planEYM)
                {
                    ViewBag.PlanEnd = i + (double.Parse(planED) - getMonthMiddleDay(planEYM)) / getMonthDays(planEYM);
                }
                if (times[i] == realBYM)
                {
                    ViewBag.RealBegin = i + (double.Parse(realBD) - getMonthMiddleDay(realBYM)) / getMonthDays(realBYM);
                }
                if (times[i] == realEYM)
                {
                    //此种情况为 还未登记 或只登记了一天,在前端统计图渲染时,实际投入的开始时间和结束时间相同,时间区域不会显示,这里故意 +0.008,为了让时间区域显示
                    if (pt.RBeginTime == pt.REndTime)
                    {
                        ViewBag.RealEnd = i + (double.Parse(realED) - getMonthMiddleDay(realEYM)) / getMonthDays(realEYM) + 0.008;
                    }
                    else
                    {
                        ViewBag.RealEnd = i + (double.Parse(realED) - getMonthMiddleDay(realEYM)) / getMonthDays(realEYM);
                    }
                }
            }
            ViewBag.ProjectTime = pt;

            return(View());
        }