Пример #1
0
        public JsonResult QueryProductVendorStatistics()
        {
            QF_Report filter = BuildQueryFilterEntity <QF_Report>();
            var       list   = ReportBigService.ProductVendorStatisticsList(filter);

            return(AjaxGridJson(list));
        }
Пример #2
0
        public ActionResult SearchExportProductVendorStatistics()
        {
            var filter = SerializeHelper.JsonDeserializeFixed <QF_Report>(Request.Form["queryString"]);

            filter.PageIndex = 0;
            filter.PageSize  = int.MaxValue;

            var list = ReportBigService.ProductVendorStatisticsList(filter);

            list.data.ForEach(p => { p.SerialNumber = list.data.IndexOf(p) + 1; });
            var tables = new List <DataTable>
            {
                DataMapper.ListToDataTable(list.data)
            };
            var dynamicTitle = filter.StatisticsObject == StatisticsObject.Product ? "产品名称" : "供应商名称";
            var columns      = new List <List <ColumnData> >
            {
                new List <ColumnData>
                {
                    new ColumnData {
                        FieldName = "SerialNumber", Width = 10, Title = "序号", HorizontalAlignment = HorizAlignments.Centered
                    },
                    new ColumnData {
                        FieldName = "Name", Width = 20, Title = dynamicTitle, HorizontalAlignment = HorizAlignments.Left
                    },
                    new ColumnData {
                        FieldName = "ComplaintCount", Width = 10, Title = "	投诉量", HorizontalAlignment = HorizAlignments.Left
                    },
                    new ColumnData {
                        FieldName = "FinishCount", Width = 10, Title = "完结数量", HorizontalAlignment = HorizAlignments.Left
                    },
                    new ColumnData {
                        FieldName = "FinishCountProportion", Width = 10, Title = "完结率", HorizontalAlignment = HorizAlignments.Left
                    }
                }
            };
            var excelExport = new ExcelFileExporter();
            var fileName    = string.Empty;
            var excelByte   = excelExport.CreateFile(tables, new List <string>()
            {
                "产品供应商统计"
            }, columns, null, out fileName, "产品供应商统计");

            fileName = "产品供应商统计.xls";
            return(File(new MemoryStream(excelByte), "application/ms-excel", fileName));
        }