|
@@ -87,28 +87,25 @@ func ReportProduceDownload(c *gin.Context, apictx *ApiSession) (interface{}, err
|
|
|
Alignment: &excelize.Alignment{Horizontal: "center", Vertical: "center"},
|
|
|
Border: border,
|
|
|
})
|
|
|
- offset := 0
|
|
|
companyName := getCompanyName(apictx)
|
|
|
|
|
|
- var budgetCount float64 = 0
|
|
|
- var realCount float64 = 0
|
|
|
+ var budgetAmount float64 = 0
|
|
|
+ var realAmount float64 = 0
|
|
|
var row int = 0
|
|
|
|
|
|
for _, produce := range produces {
|
|
|
produceExcel := NewReportProduceExcel(f)
|
|
|
+ produceExcel.Row = row
|
|
|
produceExcel.Content = produce
|
|
|
-
|
|
|
produceExcel.Title = fmt.Sprintf("%s加工单", companyName)
|
|
|
//设置对应的数据
|
|
|
- produceExcel.Offset = offset
|
|
|
produceExcel.Draws()
|
|
|
- budgetCount += produceExcel.BudgetCount
|
|
|
- realCount += produceExcel.RealCount
|
|
|
- offset += 15
|
|
|
- row = produceExcel.Row
|
|
|
+ budgetAmount += produceExcel.BudgetAmount
|
|
|
+ realAmount += produceExcel.RealAmount
|
|
|
+ row = produceExcel.Row + 3
|
|
|
|
|
|
}
|
|
|
- row++
|
|
|
+ row = row - 2
|
|
|
startCell := fmt.Sprintf("%s%d", "A", row)
|
|
|
endCell := fmt.Sprintf("%s%d", "H", row)
|
|
|
f.MergeCell(sheetName, startCell, endCell)
|
|
@@ -116,23 +113,23 @@ func ReportProduceDownload(c *gin.Context, apictx *ApiSession) (interface{}, err
|
|
|
f.SetCellValue(sheetName, startCell, "汇总金额")
|
|
|
|
|
|
// 预算金额汇总
|
|
|
- budgetCountCell := fmt.Sprintf("%s%d", "I", row)
|
|
|
- budgetCountStr := ""
|
|
|
- if realCount > 0 {
|
|
|
- budgetCountStr = fmt.Sprintf("%.3f", budgetCount)
|
|
|
+ budgetAmountCell := fmt.Sprintf("%s%d", "I", row)
|
|
|
+ budgetAmountStr := ""
|
|
|
+ if budgetAmount > 0 {
|
|
|
+ budgetAmountStr = fmt.Sprintf("%.3f", budgetAmount)
|
|
|
}
|
|
|
- f.SetCellValue(sheetName, budgetCountCell, budgetCountStr)
|
|
|
- f.SetCellStyle(sheetName, budgetCountCell, budgetCountCell, alignCenterStyle)
|
|
|
+ f.SetCellValue(sheetName, budgetAmountCell, budgetAmountStr)
|
|
|
+ f.SetCellStyle(sheetName, budgetAmountCell, budgetAmountCell, alignCenterStyle)
|
|
|
|
|
|
// 实际金额汇总
|
|
|
- RealCountCell := fmt.Sprintf("%s%d", "J", row)
|
|
|
+ realAmountCell := fmt.Sprintf("%s%d", "J", row)
|
|
|
|
|
|
- realCountStr := ""
|
|
|
- if realCount > 0 {
|
|
|
- realCountStr = fmt.Sprintf("%.3f", realCount)
|
|
|
+ realAmountStr := ""
|
|
|
+ if realAmount > 0 {
|
|
|
+ realAmountStr = fmt.Sprintf("%.3f", realAmount)
|
|
|
}
|
|
|
- f.SetCellValue(sheetName, RealCountCell, realCountStr)
|
|
|
- f.SetCellStyle(sheetName, RealCountCell, RealCountCell, alignCenterStyle)
|
|
|
+ f.SetCellValue(sheetName, realAmountCell, realAmountStr)
|
|
|
+ f.SetCellStyle(sheetName, realAmountCell, realAmountCell, alignCenterStyle)
|
|
|
|
|
|
f.SetRowHeight(sheetName, row, 21)
|
|
|
|
|
@@ -260,28 +257,23 @@ func ReportProductDownload(c *gin.Context, apictx *ApiSession) (interface{}, err
|
|
|
Alignment: &excelize.Alignment{Horizontal: "center", Vertical: "center"},
|
|
|
Border: border,
|
|
|
})
|
|
|
- offset := 0
|
|
|
companyName := getCompanyName(apictx)
|
|
|
|
|
|
- var budgetCount float64 = 0
|
|
|
- var realCount float64 = 0
|
|
|
+ var budgetAmount float64 = 0
|
|
|
+ var realAmount float64 = 0
|
|
|
var row int = 0
|
|
|
|
|
|
for _, product := range products {
|
|
|
- produceExcel := NewReportProductBill(f)
|
|
|
- produceExcel.Content = product
|
|
|
-
|
|
|
- produceExcel.Title = fmt.Sprintf("%s成品采购单", companyName)
|
|
|
- //设置对应的数据
|
|
|
- produceExcel.Offset = offset
|
|
|
- produceExcel.Draws()
|
|
|
- budgetCount += produceExcel.BudgetCount
|
|
|
- realCount += produceExcel.RealCount
|
|
|
- offset += 15
|
|
|
- row = produceExcel.Row
|
|
|
-
|
|
|
+ productExcel := NewReportProductBill(f)
|
|
|
+ productExcel.Row = row
|
|
|
+ productExcel.Content = product
|
|
|
+ productExcel.Title = fmt.Sprintf("%s成品采购单", companyName)
|
|
|
+ productExcel.Draws()
|
|
|
+ budgetAmount += productExcel.BudgetAmount
|
|
|
+ realAmount += productExcel.RealAmount
|
|
|
+ row = productExcel.Row + 3
|
|
|
}
|
|
|
- row++
|
|
|
+ row = row - 2
|
|
|
startCell := fmt.Sprintf("%s%d", "A", row)
|
|
|
endCell := fmt.Sprintf("%s%d", "H", row)
|
|
|
f.MergeCell(sheetName, startCell, endCell)
|
|
@@ -289,23 +281,23 @@ func ReportProductDownload(c *gin.Context, apictx *ApiSession) (interface{}, err
|
|
|
f.SetCellValue(sheetName, startCell, "汇总金额")
|
|
|
|
|
|
// 预算金额汇总
|
|
|
- budgetCountCell := fmt.Sprintf("%s%d", "I", row)
|
|
|
+ budgetAmountCell := fmt.Sprintf("%s%d", "I", row)
|
|
|
budgetCountStr := ""
|
|
|
- if realCount > 0 {
|
|
|
- budgetCountStr = fmt.Sprintf("%.3f", budgetCount)
|
|
|
+ if realAmount > 0 {
|
|
|
+ budgetCountStr = fmt.Sprintf("%.3f", realAmount)
|
|
|
}
|
|
|
- f.SetCellValue(sheetName, budgetCountCell, budgetCountStr)
|
|
|
- f.SetCellStyle(sheetName, budgetCountCell, budgetCountCell, alignCenterStyle)
|
|
|
+ f.SetCellValue(sheetName, budgetAmountCell, budgetCountStr)
|
|
|
+ f.SetCellStyle(sheetName, budgetAmountCell, budgetAmountCell, alignCenterStyle)
|
|
|
|
|
|
// 实际金额汇总
|
|
|
- RealCountCell := fmt.Sprintf("%s%d", "J", row)
|
|
|
+ realAmountCell := fmt.Sprintf("%s%d", "J", row)
|
|
|
|
|
|
- realCountStr := ""
|
|
|
- if realCount > 0 {
|
|
|
- realCountStr = fmt.Sprintf("%.3f", realCount)
|
|
|
+ realAmountStr := ""
|
|
|
+ if realAmount > 0 {
|
|
|
+ realAmountStr = fmt.Sprintf("%.3f", realAmount)
|
|
|
}
|
|
|
- f.SetCellValue(sheetName, RealCountCell, realCountStr)
|
|
|
- f.SetCellStyle(sheetName, RealCountCell, RealCountCell, alignCenterStyle)
|
|
|
+ f.SetCellValue(sheetName, realAmountCell, realAmountStr)
|
|
|
+ f.SetCellStyle(sheetName, realAmountCell, realAmountCell, alignCenterStyle)
|
|
|
|
|
|
f.SetRowHeight(sheetName, row, 21)
|
|
|
|