DengBiao 1 год назад
Родитель
Сommit
a3c3750684
1 измененных файлов: 30 добавлений и 17 удалений
  1. +30
    -17
      app/admin/svc/svc_data_statisstics.go

+ 30
- 17
app/admin/svc/svc_data_statisstics.go Просмотреть файл

@@ -725,25 +725,38 @@ func CentralKitchenForSchoolDataStatisticsExport(req md.CentralKitchenForSchoolD

j := 3 //表头前两行用了,只能从第三行开始
var sumClassNum, sumBreakfast, sumLunch, sumDinner = int64(0), int64(0), int64(0), int64(0)
for k2, v2 := range v1 {
if k2 == "" {
//若年级为空,则为教师餐
k2 = "教师餐"
}

for k3, v3 := range v2 {
if k3 == "" {
//若班级为空,则为教师餐
k3 = "教师餐"
tmpClassDb := db.ClassDb{}
tmpClassDb.Set(0)
classList, err := tmpClassDb.FindClassAscByEnterprise(tmpEnterprise.Id)
if err != nil {
logx.Error(err)
println("<<<<CentralKitchenForSchoolDataStatisticsExport4>>>>>Error:::", err.Error())
panic(err)
}
for _, class := range *classList {
for k2, v2 := range v1 {
if k2 == "" {
//若年级为空,则为教师餐
k2 = "教师餐"
}

xlsx.SetSheetRow("Sheet1", "A"+strconv.Itoa(j), &[]interface{}{
k2, k3, v3["breakfast"], v3["lunch"], v3["dinner"]})
sumClassNum++
sumBreakfast += v3["breakfast"]
sumLunch += v3["lunch"]
sumDinner += v3["dinner"]
j++
for k3, v3 := range v2 {
if class.Name != k3 {
continue
}
if k3 == "" {
//若班级为空,则为教师餐
k3 = "教师餐"
}

xlsx.SetSheetRow("Sheet1", "A"+strconv.Itoa(j), &[]interface{}{
k2, k3, v3["breakfast"], v3["lunch"], v3["dinner"]})
sumClassNum++
sumBreakfast += v3["breakfast"]
sumLunch += v3["lunch"]
sumDinner += v3["dinner"]
j++
}
}
}
xlsx.SetSheetRow("Sheet1", "A"+strconv.Itoa(j), &[]interface{}{


Загрузка…
Отмена
Сохранить