1、修改库存详情采购成本合计、员工成本合计字段类型,返回小数部分;

2、商品零售毛利汇总页,员工毛利添加四舍五入;
3、查询采购报表(按商品)页"已终止"的订单不返回未执行金额和数量,汇总数据增加四舍五入;
This commit is contained in:
chenlin 2024-09-09 15:32:50 +08:00
parent 315e22a488
commit 606d1e513e
3 changed files with 13 additions and 9 deletions

View File

@ -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
}

View File

@ -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 = "--"

View File

@ -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
}