diff --git a/app/admin/models/commodity.go b/app/admin/models/commodity.go index 1777534..3d8e3a7 100644 --- a/app/admin/models/commodity.go +++ b/app/admin/models/commodity.go @@ -11,6 +11,7 @@ import ( "go-admin/tools/config" "golang.org/x/sync/errgroup" "gorm.io/gorm" + "math" "math/rand" "sort" "strconv" @@ -2436,8 +2437,8 @@ type ErpStockCommodityListResp struct { Total int `json:"total"` // 数据总条数 PageIndex int `json:"pageIndex"` // 页码 PageSize int `json:"pageSize"` // 每页展示条数 - TotalWholesalePrice int `json:"total_wholesale_price"` // 入库采购价之和 - TotalStaffPrice int `json:"total_staff_price"` // 入库员工成本价之和 + TotalWholesalePrice float64 `json:"total_wholesale_price"` // 入库采购价之和 + TotalStaffPrice float64 `json:"total_staff_price"` // 入库员工成本价之和 ExportUrl string `json:"export_url"` } @@ -2546,8 +2547,8 @@ func (m *ErpStockCommodityListReq) GetDetailList(c *gin.Context, nType uint32) ( resp.Total = int(count) resp.PageIndex = page + 1 resp.PageSize = m.PageSize - resp.TotalWholesalePrice = int(nTotalCount.TotalWholesalePrice) - resp.TotalStaffPrice = int(nTotalCount.TotalStaffCostPrice + nTotalCount.TotalWholesalePrice) + resp.TotalWholesalePrice = math.Round(nTotalCount.TotalWholesalePrice*100) / 100 + resp.TotalStaffPrice = math.Round((nTotalCount.TotalStaffCostPrice+nTotalCount.TotalWholesalePrice)*100) / 100 return resp, nil } diff --git a/app/admin/models/erp_order.go b/app/admin/models/erp_order.go index 427f63d..da40df0 100644 --- a/app/admin/models/erp_order.go +++ b/app/admin/models/erp_order.go @@ -2844,6 +2844,7 @@ func QueryRetailMargin(req *ErpOrderRetailMarginReq, c *gin.Context) (*ErpOrderR existingData.SalesCost = math.Round(existingData.SalesCost*100) / 100 existingData.SalesMargin = math.Round(existingData.SalesMargin*100) / 100 existingData.EmployeeCost = math.Round(existingData.EmployeeCost*100) / 100 + existingData.EmployeeMargin = math.Round(existingData.EmployeeMargin*100) / 100 if existingData.SalesAmount == 0 { existingData.GrossMargins = "--" diff --git a/app/admin/models/purchase.go b/app/admin/models/purchase.go index 6b3e07f..2dd697b 100644 --- a/app/admin/models/purchase.go +++ b/app/admin/models/purchase.go @@ -4343,10 +4343,10 @@ func getReportByCommodityFromCommon(req *ErpPurchaseReportByCommodityReq, c *gin } resp.PlanCount = totalData.PlanCount - resp.PlanAmount = totalData.PlanAmount - resp.Amount = totalData.Amount + resp.PlanAmount = math.Round(totalData.PlanAmount*100) / 100 + resp.Amount = math.Round(totalData.Amount*100) / 100 resp.Count = totalData.Count - resp.NonExecutionAmount = totalData.NonExecutionAmount + resp.NonExecutionAmount = math.Round(totalData.NonExecutionAmount*100) / 100 resp.NonExecutionCount = totalData.NonExecutionCount if req.IsExport == 1 { @@ -4434,8 +4434,10 @@ func getPurchaseOrderAndCommodityData(orderID, commodityId uint32) (ErpCommodity purchaseOrderData.Amount = purchaseData.Amount purchaseOrderData.Price = purchaseData.Price purchaseOrderData.Count = purchaseData.Count - purchaseOrderData.NonExecutionAmount = purchaseData.NonExecutionAmount - purchaseOrderData.NonExecutionCount = purchaseData.NonExecutionCount + if purchaseOrder.State != ErpPurchaseOrderEnd { + purchaseOrderData.NonExecutionAmount = purchaseData.NonExecutionAmount + purchaseOrderData.NonExecutionCount = purchaseData.NonExecutionCount + } return purchaseOrderData, commodityData, nil }