예제 #1
0
        /// <summary>
        /// 作用:统计各个类别报销情况
        /// 作者:汪建龙
        /// 编写时间:2016年11月19日11:23:27
        /// </summary>
        /// <param name="sheets"></param>
        /// <returns></returns>
        public ActionResult CollectCategory(List <Sheet> sheets)
        {
            var result = SheetStatisticHelper.Statistic(sheets);
            var dict   = new Dictionary <string, double>();

            foreach (var value in result.Values)
            {
                dict = dict.Union(value).ToDictionary(e => e.Key, e => e.Value);
            }
            ViewBag.Result = result;
            ViewBag.Dict   = dict;
            ViewBag.Sheets = sheets;

            return(View());
        }
예제 #2
0
        public ActionResult DownloadReport(int year, int month)
        {
            var sheets   = Core.SheetManager.GetSheets(year, month);
            var results  = SheetStatisticHelper.Statistic(sheets);
            var title    = string.Format("杭州智拓{0}年{1}月报销表", year, month);
            var workbook = ExcelManager.DownloadReport(results, title);

            if (workbook != null)
            {
                byte[] fileContents = ExcelManager.Translate(workbook);
                return(File(fileContents, "application/ms-excel", string.Format("{0}.xls", title)));
            }

            return(Content("内部服务器错误!"));
        }