Kaynağa Gözat

add:导出提成添加合计

zoie 1 ay önce
ebeveyn
işleme
ec44ef8bb8
2 değiştirilmiş dosya ile 18 ekleme ve 4 silme
  1. 16 2
      controllers/Percentage.go
  2. 2 2
      models/Percentage/Percentage.go

+ 16 - 2
controllers/Percentage.go

@@ -253,6 +253,13 @@ func (c *PercentageController) Percentage_Export() {
 		line++
 	}
 
+	// ------------- 最后一行 合计 ------------------------
+	f.SetRowHeight("Sheet1", line, 22)
+	f.MergeCell("Sheet1", fmt.Sprintf("B%d", line), fmt.Sprintf("G%d", line))
+	f.SetCellValue("Sheet1", fmt.Sprintf("B%d", line), "合计")
+	f.SetCellFormula("Sheet1", fmt.Sprintf("%s%d", schemeEndCell, line), fmt.Sprintf("SUM(%s5:%s%d)", schemeEndCell, schemeEndCell, line-1))
+	f.SetCellFormula("Sheet1", fmt.Sprintf("%s%d", reportingEndCell, line), fmt.Sprintf("SUM(%s5:%s%d)", reportingEndCell, reportingEndCell, line-1))
+
 	Style4, _ := f.NewStyle(
 		&excelize.Style{
 			Font:      &excelize.Font{Size: 11, Family: "宋体"},
@@ -317,7 +324,7 @@ func (c *PercentageController) Percentage_Export() {
 			Fill: excelize.Fill{Type: "pattern", Color: []string{"#92D050"}, Pattern: 1},
 		})
 
-	f.SetCellStyle("Sheet1", "A5", fmt.Sprintf("%s%d", reportingEndCell, line-1), Style4)
+	f.SetCellStyle("Sheet1", "A5", fmt.Sprintf("%s%d", reportingEndCell, line), Style4)
 
 	f.SetCellStyle("Sheet1", schemeStartCell+"2", schemeEndCell+"4", StyleYellowFill)
 	f.SetCellStyle("Sheet1", schemeEndCell+"5", fmt.Sprintf("%s%d", schemeEndCell, line-1), StyleYellowFill1)
@@ -489,6 +496,13 @@ func (c *PercentageController) Percentage_User_Export() {
 		line++
 	}
 
+	// ------------- 最后一行 合计 ------------------------
+	f.SetRowHeight("Sheet1", line, 22)
+	f.MergeCell("Sheet1", fmt.Sprintf("B%d", line), fmt.Sprintf("G%d", line))
+	f.SetCellValue("Sheet1", fmt.Sprintf("B%d", line), "合计")
+	f.SetCellFormula("Sheet1", fmt.Sprintf("%s%d", schemeEndCell, line), fmt.Sprintf("SUM(%s5:%s%d)", schemeEndCell, schemeEndCell, line-1))
+	f.SetCellFormula("Sheet1", fmt.Sprintf("%s%d", reportingEndCell, line), fmt.Sprintf("SUM(%s5:%s%d)", reportingEndCell, reportingEndCell, line-1))
+
 	Style4, _ := f.NewStyle(
 		&excelize.Style{
 			Font:      &excelize.Font{Size: 11, Family: "宋体"},
@@ -553,7 +567,7 @@ func (c *PercentageController) Percentage_User_Export() {
 			Fill: excelize.Fill{Type: "pattern", Color: []string{"#92D050"}, Pattern: 1},
 		})
 
-	f.SetCellStyle("Sheet1", "A5", fmt.Sprintf("%s%d", reportingEndCell, line-1), Style4)
+	f.SetCellStyle("Sheet1", "A5", fmt.Sprintf("%s%d", reportingEndCell, line), Style4)
 
 	f.SetCellStyle("Sheet1", schemeStartCell+"2", schemeEndCell+"4", StyleYellowFill)
 	f.SetCellStyle("Sheet1", schemeEndCell+"5", fmt.Sprintf("%s%d", schemeEndCell, line-1), StyleYellowFill1)

+ 2 - 2
models/Percentage/Percentage.go

@@ -421,7 +421,7 @@ func (dao *PercentageDaoImpl) Read_Percentage_List_SQL(T_name, T_uuid, T_start_d
 	if T_export {
 		sql += " ORDER BY t_company_uuid asc,p.t_task_int_id asc"
 	} else {
-		sql += " ORDER BY t_state asc,p.t_task_int_id DESC"
+		sql += " ORDER BY p.t_task_int_id DESC"
 	}
 
 	if page_z != 9999 {
@@ -485,7 +485,7 @@ func (dao *PercentageDaoImpl) Read_Percentage_User_List_SQL(T_uuid, T_name, T_st
 	if T_export {
 		sql += " ORDER BY t_company_uuid asc,p.t_task_int_id asc"
 	} else {
-		sql += " ORDER BY t_state asc,p.t_task_int_id DESC"
+		sql += " ORDER BY p.t_task_int_id DESC"
 	}
 
 	if page_z != 9999 {