From 98d8fba819eab8683ea9fa54b8978cde4c7e07ff Mon Sep 17 00:00:00 2001 From: zhangqian <zhangqian@123.com> Date: 星期五, 05 七月 2024 18:19:10 +0800 Subject: [PATCH] 两个月度统计下载如果下载的是当前月,取实时数据 & 修复若干bug --- service/warehouse_month_forms.go | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/service/warehouse_month_forms.go b/service/warehouse_month_forms.go index 9af8677..09ccfe6 100644 --- a/service/warehouse_month_forms.go +++ b/service/warehouse_month_forms.go @@ -99,8 +99,8 @@ f.SetCellValue("Sheet1", "E"+column, v.Unit) f.SetCellValue("Sheet1", "F"+column, v.SalePrice) - slf.FillDealerTypeToExcel(v.InputItems, inputStart, i+3, inputTypes, f) - slf.FillDealerTypeToExcel(v.OutputItems, outputStart, i+3, outputTypes, f) + slf.FillDealerTypeToExcel(v.InputItems, inputStart, i+3, inputTypes, f, constvar.InputTotalHeader) + slf.FillDealerTypeToExcel(v.OutputItems, outputStart, i+3, outputTypes, f, constvar.OutPutTotalHeader) } fileName := fmt.Sprintf("%s鏈堝害缁熻鎶ヨ〃%s.xlsx", "浠撳簱", time.Now().Format("2006-01-02-1504")) @@ -139,7 +139,7 @@ return sum } -func (slf *WarehouseMonthFormsService) FillDealerTypeToExcel(items []*models.WarehouseStatsItems, startIndex int, column int, dealerTypes []string, f *excelize.File) { +func (slf *WarehouseMonthFormsService) FillDealerTypeToExcel(items []*models.WarehouseStatsItems, startIndex int, column int, dealerTypes []string, f *excelize.File, totalHeader string) { columnStr := strconv.Itoa(column) sum := slf.SumItems(items) detailMap := models.WarehouseStatsItemMap(items) @@ -154,7 +154,7 @@ var amount decimal.Decimal if detailMap[dealerTypes[i]] != nil { amount = detailMap[dealerTypes[i]].Amount - } else if dealerTypes[i] == constvar.InputTotalHeader { + } else if dealerTypes[i] == totalHeader { amount = sum } f.SetCellValue("Sheet1", getColumnAlphabet(startIndex+i)+columnStr, amount) -- Gitblit v1.8.0