ソースを参照

Merge branch 'fms_2.8'

ziwen 1 年間 前
コミット
57969c1b7c

+ 6 - 6
controller/census/invoice_payment.go

@@ -1199,9 +1199,9 @@ func getCensusIncomeListV2(ch chan models.CensusIncomeChartResp, req fms.IncomeL
 					amountPars = append(amountPars, summaryIds)
 					if req.SellerIds != "" {
 						sellerIds := strings.Split(req.SellerIds, ",")
-						amountCond += ` AND ((c.seller_id in ? AND a.invoice_id <> 0 AND c.invoice_time BETWEEN ? AND ?)`
-						amountCond += `OR (d.seller_id in ? 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)
+						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 seller_id = ? `
+						amountPars = append(amountPars, st, ed, st, ed, sellerIds)
 					} 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 ?))`
@@ -1305,9 +1305,9 @@ func getCensusIncomeListV2(ch chan models.CensusIncomeChartResp, req fms.IncomeL
 					amountPars = append(amountPars, prevSummaryIds)
 					if req.SellerIds != "" {
 						sellerIds := strings.Split(req.SellerIds, ",")
-						amountCond += ` AND ((c.seller_id in ? AND a.invoice_id <> 0 AND c.invoice_time BETWEEN ? AND ?)`
-						amountCond += `OR (d.seller_id in ? 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)
+						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 seller_id = ? `
+						amountPars = append(amountPars, prevSt, prevEd, prevSt, prevEd, sellerIds)
 					} 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 ?))`

+ 1 - 1
models/fms/invoice_payment_summary.go

@@ -197,7 +197,7 @@ type IncomeSummaryItem struct {
 // GetContractSummaryIncomeAmount 获取汇总金额合计信息
 func GetContractSummaryIncomeAmount(condition string, pars []interface{}) (results []*IncomeSummaryItem, err error) {
 	query := global.DEFAULT_MYSQL.Table("invoice_payment_summary AS a").
-		Select("IF(a.invoice_id=0,d.amount, b.amount) AS amount,IF(a.invoice_id=0,d.invoice_time, b.invoice_time) AS invoice_date, c.contract_type,c.company_name,IF(a.invoice_id=0,d.seller_name, b.seller_name) AS seller_name").
+		Select("IF(a.invoice_id=0,d.amount, b.amount) AS amount,IF(a.invoice_id=0,d.invoice_time, b.invoice_time) AS invoice_date, c.contract_type,c.company_name,IF(a.invoice_id=0,d.seller_name, b.seller_name) AS seller_name,IF(a.invoice_id=0,d.seller_id, b.seller_id) AS seller_id").
 		Joins("LEFT JOIN contract_invoice AS b ON a.invoice_id = b.contract_invoice_id AND b.is_deleted = 0 ").
 		Joins("LEFT JOIN contract_invoice AS d ON a.payment_id = d.contract_invoice_id AND d.is_deleted = 0").
 		Joins("JOIN contract_register AS c ON a.register_id = c.contract_register_id AND c.is_deleted = 0").