Преглед изворни кода

Merge branch 'master' into add_mode

add_mode
DengBiao пре 1 година
родитељ
комит
808c5aa465
1 измењених фајлова са 12 додато и 7 уклоњено
  1. +12
    -7
      app/admin/svc/svc_data_statisstics.go

+ 12
- 7
app/admin/svc/svc_data_statisstics.go Прегледај датотеку

@@ -659,25 +659,30 @@ func SelfSupportForSchoolDataStatisticsExport(req md.SelfSupportForSchoolDataSta
totalData[k2]["amount"] = sumAmount
}

xlsx.NewSheet("Sheet1")
//xlsx.NewSheet("所有档口")
xlsx.SetSheetName("Sheet1", "所有档口")
titleList = []string{" 设 备 分 餐 数 据 统 计 表 "}
xlsx.SetSheetRow("Sheet1", "A1", &titleList)
xlsx.SetSheetRow("所有档口", "A1", &titleList)
titleList = []string{"名 称", "消费笔数", "消费金额"}
xlsx.SetSheetRow("Sheet1", "A2", &titleList)
xlsx.SetSheetRow("所有档口", "A2", &titleList)
style, err := xlsx.NewStyle(`{"fill":{"type":"pattern","color":["FFFF00"],"pattern":1}, "alignment":{"horizontal":"center"}}`)
if err != nil {
logx.Error(err)
println("<<<<SelfSupportForSchoolDataStatisticsExport4>>>>>Error:::", err.Error())
panic(err)
}
xlsx.MergeCell("Sheet1", "A1", "C1") //合并单元格
xlsx.SetCellStyle("Sheet1", "A1", "C1", style)
xlsx.SetColWidth("Sheet1", "A", "C", 20)
xlsx.MergeCell("所有档口", "A1", "C1") //合并单元格
xlsx.SetCellStyle("所有档口", "A1", "C1", style)
xlsx.SetColWidth("所有档口", "A", "C", 20)
j := 3 //表头前两行用了,只能从第三行开始
var totalNum, totalAmount float64
for key, val := range totalData {
xlsx.SetSheetRow("Sheet1", "A"+strconv.Itoa(j), &[]interface{}{key, val["num"], val["amount"]})
totalNum += val["num"]
totalAmount += val["amount"]
xlsx.SetSheetRow("所有档口", "A"+strconv.Itoa(j), &[]interface{}{key, val["num"], val["amount"]})
j++
}
xlsx.SetSheetRow("所有档口", "A"+strconv.Itoa(j), &[]interface{}{"合计", totalNum, totalAmount})

//xlsx.DeleteSheet("Sheet1") //TODO::只能放这里删除
//将文件保存至服务器


Loading…
Откажи
Сачувај