From f7120ddc7cfb06b2e8580d348b7ea74875e37af6 Mon Sep 17 00:00:00 2001 From: DengBiao <2319963317@qq.com> Date: Tue, 5 Mar 2024 20:40:55 +0800 Subject: [PATCH] update --- app/admin/svc/svc_data_statisstics.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/admin/svc/svc_data_statisstics.go b/app/admin/svc/svc_data_statisstics.go index 274bddc..2a3393d 100644 --- a/app/admin/svc/svc_data_statisstics.go +++ b/app/admin/svc/svc_data_statisstics.go @@ -1754,6 +1754,7 @@ func CentralKitchenForSchoolDataStatisticsExport(req md.CentralKitchenForSchoolD xlsx.SetCellStyle("Sheet1", "A1", "E1", style) xlsx.SetColWidth("Sheet1", "A", "E", 20) + var incomeTotal, refundTotal, realityAmountTotal, rateFeeTotal float64 j := 3 //表头前两行用了,只能从第三行开始 for _, v := range m { var income, refund string @@ -1795,8 +1796,13 @@ func CentralKitchenForSchoolDataStatisticsExport(req md.CentralKitchenForSchoolD realityAmount := utils.StrToFloat64(income) - utils.StrToFloat64(refund) rateFee := realityAmount * 0.0038 xlsx.SetSheetRow("Sheet1", "A"+strconv.Itoa(j), &[]interface{}{v.Name, income, refund, realityAmount, rateFee}) + incomeTotal += utils.StrToFloat64(income) + refundTotal += utils.StrToFloat64(refund) + realityAmountTotal += realityAmount + rateFeeTotal += rateFee j++ } + xlsx.SetSheetRow("Sheet1", "A"+strconv.Itoa(j), &[]interface{}{"总计", incomeTotal, refundTotal, realityAmountTotal, rateFeeTotal}) //将文件保存至服务器 xlsx.SaveAs("./static" + downloadPath) break