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