Пример #1
0
        public JsonResult ThisMonth()
        {
            List <CategoryData> lstCat = new List <CategoryData>();
            List <pxSelectCategoryPieChart_Result> lstCategory = salesBL.GetCategoryPieChart();
            decimal?total = lstCategory.Sum(e => e.NetSales);

            foreach (pxSelectCategoryPieChart_Result item in lstCategory)
            {
                CategoryData cat = new CategoryData();
                cat.y    = item.NetSales / total * 100;
                cat.name = item.CategoryDesc + " (" + item.NetSales.Value.ToString("F") + ")";
                lstCat.Add(cat);
            }
            return(Json(lstCat, JsonRequestBehavior.AllowGet));
        }