From 251ece5903af45819f1a5177afbbe90b01e6baeb Mon Sep 17 00:00:00 2001 From: DengBiao <2319963317@qq.com> Date: Sat, 23 Sep 2023 18:00:02 +0800 Subject: [PATCH] update --- app/admin/svc/svc_data_statisstics.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/app/admin/svc/svc_data_statisstics.go b/app/admin/svc/svc_data_statisstics.go index bdacc5e..f0eda24 100644 --- a/app/admin/svc/svc_data_statisstics.go +++ b/app/admin/svc/svc_data_statisstics.go @@ -851,7 +851,7 @@ func CentralKitchenForSchoolDataStatisticsExport(req md.CentralKitchenForSchoolD for k3, v3 := range v2 { xlsx.NewSheet(k3) - titleList = []string{startDate.Format("2006-01-02") + "~~" + endDate.Format("2006-01-02") + " (" + k1 + ", " + k3 + ") 班级明细"} + titleList = []string{startDate.Format("2006-01-02") + "~~" + endDate.Format("2006-01-02") + " [" + k1 + ", " + k3 + "] 班级明细"} xlsx.SetSheetRow(k3, "A1", &titleList) titleList = []string{"姓名", "早餐", "午餐", "晚餐"} xlsx.SetSheetRow(k3, "A2", &titleList) @@ -863,14 +863,20 @@ func CentralKitchenForSchoolDataStatisticsExport(req md.CentralKitchenForSchoolD panic(err) } xlsx.SetCellStyle(k3, "A1", "D1", style) - xlsx.SetColWidth(k3, "A", "D", 20) + + var sumBreakfast, sumLunch, sumDinner = int64(0), int64(0), int64(0) j := 3 //表头前两行用了,只能从第三行开始 for k4, v4 := range v3 { xlsx.SetSheetRow(k3, "A"+strconv.Itoa(j), &[]interface{}{ k4, v4["breakfast"], v4["lunch"], v4["dinner"]}) + sumBreakfast += v4["breakfast"] + sumLunch += v4["lunch"] + sumDinner += v4["dinner"] j++ } + xlsx.SetSheetRow(k3, "A"+strconv.Itoa(j), &[]interface{}{ + "合计", sumBreakfast, sumLunch, sumDinner}) } }