DengBiao 8 kuukautta sitten
vanhempi
commit
2418e7dc8c
1 muutettua tiedostoa jossa 37 lisäystä ja 33 poistoa
  1. +37
    -33
      app/admin/svc/svc_data_statisstics.go

+ 37
- 33
app/admin/svc/svc_data_statisstics.go Näytä tiedosto

@@ -662,42 +662,46 @@ func SelfSupportForSchoolDataStatisticsExport(req md.SelfSupportForSchoolDataSta

var totalData = map[string]map[string]float64{}
for k2, vv := range v {
var sumNum, sumAmount = float64(0), float64(0)
xlsx.NewSheet(k2)
titleList = []string{" 设 备 分 餐 数 据 统 计 表 "}
xlsx.SetSheetRow(k2, "A1", &titleList)
titleList = []string{"日 期", "消费笔数", "消费金额"}
xlsx.SetSheetRow(k2, "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(k2, "A1", "C1") //合并单元格
xlsx.SetCellStyle(k2, "A1", "C1", style)
xlsx.SetColWidth(k2, "A", "C", 20)
j := 3 //表头前两行用了,只能从第三行开始
for _, v := range deviceList {
if k2 == v.Name {
var sumNum, sumAmount = float64(0), float64(0)
xlsx.NewSheet(k2)
titleList = []string{" 设 备 分 餐 数 据 统 计 表 "}
xlsx.SetSheetRow(k2, "A1", &titleList)
titleList = []string{"日 期", "消费笔数", "消费金额"}
xlsx.SetSheetRow(k2, "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(k2, "A1", "C1") //合并单元格
xlsx.SetCellStyle(k2, "A1", "C1", style)
xlsx.SetColWidth(k2, "A", "C", 20)
j := 3 //表头前两行用了,只能从第三行开始

for i := 0; i <= diffDays; i++ {
date := date1.AddDate(0, 0, i).Format("2006-01-02")
if vv[date] != nil {
xlsx.SetSheetRow(k2, "A"+strconv.Itoa(j), &[]interface{}{date, vv[date]["num"], vv[date]["amount"]})
sumNum += vv[date]["num"]
sumAmount += vv[date]["amount"]
} else {
xlsx.SetSheetRow(k2, "A"+strconv.Itoa(j), &[]interface{}{date, 0, 0})
}
j++
}
for i := 0; i <= diffDays; i++ {
date := date1.AddDate(0, 0, i).Format("2006-01-02")
if vv[date] != nil {
xlsx.SetSheetRow(k2, "A"+strconv.Itoa(j), &[]interface{}{date, vv[date]["num"], vv[date]["amount"]})
sumNum += vv[date]["num"]
sumAmount += vv[date]["amount"]
} else {
xlsx.SetSheetRow(k2, "A"+strconv.Itoa(j), &[]interface{}{date, 0, 0})
}
j++
}

xlsx.SetSheetRow(k2, "A"+strconv.Itoa(j), &[]interface{}{
"合计", sumNum, sumAmount})
if totalData[k2] == nil {
totalData[k2] = map[string]float64{}
xlsx.SetSheetRow(k2, "A"+strconv.Itoa(j), &[]interface{}{
"合计", sumNum, sumAmount})
if totalData[k2] == nil {
totalData[k2] = map[string]float64{}
}
totalData[k2]["num"] = sumNum
totalData[k2]["amount"] = sumAmount
}
}
totalData[k2]["num"] = sumNum
totalData[k2]["amount"] = sumAmount
}

//xlsx.NewSheet("所有档口")


Ladataan…
Peruuta
Tallenna