1、优化进销存报表,之前由于计算期初库存时改变了日期,导致查询的采购等数量不准确;
This commit is contained in:
parent
1710712684
commit
b56dc88ebd
|
@ -457,7 +457,8 @@ func getSystemStartData(req *ErpDecisionReportReq, stock ErpStock) (DecisionRepo
|
|||
return DecisionReportData{}, nil
|
||||
}
|
||||
|
||||
tempReq := req
|
||||
tempReq1 := *req
|
||||
tempReq := &tempReq1
|
||||
tempReq.EndTime = time.Now().Format(QueryTimeFormat)
|
||||
|
||||
var respData DecisionReportData
|
||||
|
@ -1673,7 +1674,8 @@ func getSumStartData(req *ErpDecisionReportReq) (DecisionReportData, error) {
|
|||
return DecisionReportData{}, nil
|
||||
}
|
||||
|
||||
tempReq := req
|
||||
tempReq1 := *req
|
||||
tempReq := &tempReq1
|
||||
tempReq.EndTime = time.Now().Format(QueryTimeFormat)
|
||||
|
||||
var respData DecisionReportData
|
||||
|
@ -2425,7 +2427,7 @@ func getSumAllotData(req *ErpDecisionReportReq) (DecisionReportData, error) {
|
|||
logger.Errorf("getAllotCounts err:", err)
|
||||
return DecisionReportData{}, err
|
||||
}
|
||||
qs = qs.Where("erp_inventory_allot_commodity.created_at > ?", parse)
|
||||
qs = qs.Where("erp_inventory_allot_order.receive_time > ?", parse)
|
||||
}
|
||||
|
||||
if req.EndTime != "" {
|
||||
|
@ -2434,7 +2436,7 @@ func getSumAllotData(req *ErpDecisionReportReq) (DecisionReportData, error) {
|
|||
logger.Errorf("getAllotCounts err:", err)
|
||||
return DecisionReportData{}, err
|
||||
}
|
||||
qs = qs.Where("erp_inventory_allot_commodity.created_at <= ?", parse)
|
||||
qs = qs.Where("erp_inventory_allot_order.receive_time <= ?", parse)
|
||||
}
|
||||
|
||||
if len(req.CommodityName) > 0 { // 商品名称
|
||||
|
@ -2595,10 +2597,17 @@ func getSumDecisionReportData(req *ErpDecisionReportReq) (DecisionSumData, error
|
|||
sumData.TotalProductIn + sumData.TotalCheckIn + sumData.TotalOrderReject
|
||||
if sumData.TotalEndStock < (sumData.TotalPurchaseReturn + sumData.TotalOrderSale + sumData.TotalAllotOut + sumData.TotalSystemOut + sumData.TotalCheckOut) {
|
||||
sumData.TotalEndStock = 0
|
||||
sumData.TotalEndAmount = 0
|
||||
} else {
|
||||
sumData.TotalEndStock -= sumData.TotalPurchaseReturn + sumData.TotalOrderSale + sumData.TotalAllotOut + sumData.TotalSystemOut + sumData.TotalCheckOut
|
||||
}
|
||||
|
||||
sumData.TotalEndAmount = sumData.TotalBeginAmount + sumData.TotalPurchaseAmount + sumData.TotalAllotInAmount +
|
||||
sumData.TotalProductInAmount + sumData.TotalCheckInAmount + sumData.TotalRejectAmount
|
||||
if sumData.TotalEndAmount < (sumData.TotalReturnAmount + sumData.TotalSaleAmount + sumData.TotalAllotOutAmount + sumData.TotalSystemOutAmount + sumData.TotalCheckOutAmount) {
|
||||
sumData.TotalEndAmount = 0
|
||||
} else {
|
||||
sumData.TotalEndAmount -= sumData.TotalReturnAmount + sumData.TotalSaleAmount + sumData.TotalAllotOutAmount + sumData.TotalSystemOutAmount + sumData.TotalCheckOutAmount
|
||||
}
|
||||
}
|
||||
|
||||
roundDecisionSumData(&sumData)
|
||||
|
|
Loading…
Reference in New Issue
Block a user