优化生产反馈缺陷:

1.门店经营数据相关金额四舍五入保留2位小数;
2.零售毛利汇总数据相关金额四舍五入保留2位小数;
This commit is contained in:
chenlin 2024-07-04 09:31:38 +08:00
parent 0a5fe58bbe
commit 85c6476f01

View File

@ -2238,6 +2238,10 @@ func constructFinalStoreManageDataList(storeManageDataList []StoreManageData, re
// Create a map to store data by date for easier processing
storeDataMap := make(map[string]StoreManageData)
for _, data := range storeManageDataList {
data.TotalSalesAmount = math.Round(data.TotalSalesAmount*100) / 100
data.PromotionFee = math.Round(data.PromotionFee*100) / 100
data.SalesProfit = math.Round(data.SalesProfit*100) / 100
data.StaffProfit = math.Round(data.StaffProfit*100) / 100
storeDataMap[data.Date] = data
}
@ -2590,6 +2594,12 @@ func QueryRetailMargin(req *ErpOrderRetailMarginReq, c *gin.Context) (*ErpOrderR
existingData.SalesMargin += salesMargin
existingData.EmployeeCost += employeeCost
// 处理数据四舍五入保留2位小数
existingData.SalesAmount = math.Round(existingData.SalesAmount*100) / 100
existingData.SalesCost = math.Round(existingData.SalesCost*100) / 100
existingData.SalesMargin = math.Round(existingData.SalesMargin*100) / 100
existingData.EmployeeCost = math.Round(existingData.EmployeeCost*100) / 100
if existingData.SalesAmount == 0 {
existingData.GrossMargins = "--"
} else {