ziwen 1 year ago
parent
commit
70fa3847b8
1 changed files with 5 additions and 3 deletions
  1. 5 3
      models/fms/invoice_payment_summary.go

+ 5 - 3
models/fms/invoice_payment_summary.go

@@ -168,9 +168,11 @@ func GetContractSummaryInvoicePaymentAmount(condition string, pars []interface{}
 	joinCond := ` (a.invoice_id = b.contract_invoice_id OR a.payment_id = b.contract_invoice_id) `
 
 	query := global.DEFAULT_MYSQL.Table("invoice_payment_summary AS a").
-		Select("IFNULL(SUM(b.amount),0)").
-		Joins(fmt.Sprintf("JOIN contract_invoice AS b ON %s AND b.is_deleted = 0 ", joinCond)).
-		Where(condition, pars...)
+		Select("*").
+		Joins(fmt.Sprintf(" JOIN contract_invoice AS b ON %s AND b.is_deleted = 0 ", joinCond)).
+		Where(condition, pars...).Group("id")
+
+	
 	err = query.Find(&amountTotal).Error
 	return
 }