ziwen 1 year ago
parent
commit
6fd8157280
1 changed files with 6 additions and 6 deletions
  1. 6 6
      controller/census/invoice_payment.go

+ 6 - 6
controller/census/invoice_payment.go

@@ -1198,9 +1198,9 @@ func getCensusIncomeListV2(ch chan models.CensusIncomeChartResp, req fms.IncomeL
 					amountPars = append(amountPars, summaryIds)
 					if req.SellerIds != "" {
 						sellerIds := strings.Split(req.SellerIds, ",")
-						amountCond += ` AND (( a.invoice_id <> 0 AND b.invoice_time BETWEEN ? AND ?)`
-						amountCond += `OR ( a.payment_id <> 0 AND a.invoice_id = 0 AND d.invoice_time BETWEEN ? AND ?)) AND final_seller_id = ? `
-						amountPars = append(amountPars, st, ed, st, ed, sellerIds)
+						amountCond += ` AND (( b.seller_id = ? AND a.invoice_id <> 0 AND b.invoice_time BETWEEN ? AND ?)`
+						amountCond += `OR ( d.seller_id = ? AND  a.payment_id <> 0 AND a.invoice_id = 0 AND d.invoice_time BETWEEN ? AND ?)) `
+						amountPars = append(amountPars, sellerIds,st, ed, sellerIds,st, ed)
 					} else {
 						amountCond += ` AND ((a.invoice_id <> 0 AND b.invoice_time BETWEEN ? AND ?)`
 						amountCond += `OR (a.payment_id <> 0 AND a.invoice_id = 0 AND d.invoice_time BETWEEN ? AND ?))`
@@ -1304,9 +1304,9 @@ func getCensusIncomeListV2(ch chan models.CensusIncomeChartResp, req fms.IncomeL
 					amountPars = append(amountPars, prevSummaryIds)
 					if req.SellerIds != "" {
 						sellerIds := strings.Split(req.SellerIds, ",")
-						amountCond += ` AND (( a.invoice_id <> 0 AND c.invoice_time BETWEEN ? AND ?)`
-						amountCond += `OR ( a.payment_id <> 0 AND a.invoice_id = 0 AND d.invoice_time BETWEEN ? AND ?)) AND final_seller_id = ? `
-						amountPars = append(amountPars, prevSt, prevEd, prevSt, prevEd, sellerIds)
+						amountCond += ` AND (( b.seller_id = ? AND a.invoice_id <> 0 AND b.invoice_time BETWEEN ? AND ?)`
+						amountCond += `OR ( d.seller_id = ? AND  a.payment_id <> 0 AND a.invoice_id = 0 AND d.invoice_time BETWEEN ? AND ?)) `
+						amountPars = append(amountPars, sellerIds,prevSt, prevEd, sellerIds,prevSt, prevEd)
 					} else {
 						amountCond += ` AND ((a.invoice_id <> 0 AND b.invoice_time BETWEEN ? AND ?)`
 						amountCond += `OR (a.payment_id <> 0 AND a.invoice_id = 0 AND d.invoice_time BETWEEN ? AND ?))`