Browse Source

Merge branch 'new_2.6'

ziwen 1 year ago
parent
commit
b9b12f4586
2 changed files with 14 additions and 25 deletions
  1. 13 24
      controller/census/invoice_payment.go
  2. 1 1
      models/fms/invoice_payment_summary.go

+ 13 - 24
controller/census/invoice_payment.go

@@ -1912,10 +1912,10 @@ func (ct *InvoicePaymentController) NotInvoiceList(c *gin.Context) {
 			contractIdSumMap := make(map[int]int)
 
 			for _, v := range registerList {
-				if v.InvoicedAmountCount >= v.PaymentAmountCount {
-					invoiceTotal += v.InvoicedAmountCount
-				} else if v.InvoicedAmountCount == 0 {
-					invoiceTotal += v.PaymentAmountCount
+				if v.InvoicedAmount >= v.PaymentAmount {
+					invoiceTotal += v.InvoicedAmount
+				} else if v.InvoicedAmount == 0 {
+					invoiceTotal += v.PaymentAmount
 				}
 				rate := v.RMBRate
 				if rate == 0.0 {
@@ -1974,35 +1974,24 @@ func (ct *InvoicePaymentController) NotInvoiceList(c *gin.Context) {
 				return
 			}
 
-			invoiceSumMap := make(map[string]map[int]float64)
-			contractSumMap := make(map[string]map[int]float64)
-			//contractIdSumMap := make(map[int]int)
+			invoiceSumMap := make(map[string]float64)
+			contractSumMap := make(map[string]float64)
+			contractIdSumMap := make(map[int]int)
 
 			for _, v := range registerList {
-				if _,ok := invoiceSumMap[v.CurrencyUnit]; !ok{
-					invoiceSumMap[v.CurrencyUnit] = make(map[int]float64)
-				}
 				if v.InvoiceOrigin >= v.PaymentOrigin {
-					invoiceSumMap[v.CurrencyUnit][v.ServiceProductId] += v.InvoicedAmount
+					invoiceSumMap[v.CurrencyUnit] += v.InvoicedAmount
 				} else {
-					invoiceSumMap[v.CurrencyUnit][v.ServiceProductId]  += v.PaymentAmount
+					invoiceSumMap[v.CurrencyUnit] += v.PaymentAmount
 				}
-				//if _, ok := contractIdSumMap[v.ContractRegisterId]; !ok {
-				//	contractIdSumMap[v.ContractRegisterId] = 1
-				//	contractSumMap[v.CurrencyUnit] += v.ContractAmount
-				//}
-			}
-			for _, v := range serviceAmountList {
-				if _,ok := contractSumMap[v.CurrencyUnit]; !ok{
-					contractSumMap[v.CurrencyUnit] = make(map[int]float64)
+				if _, ok := contractIdSumMap[v.ContractRegisterId]; !ok {
+					contractIdSumMap[v.ContractRegisterId] = 1
+					contractSumMap[v.CurrencyUnit] += v.ContractAmount
 				}
-				contractSumMap[v.CurrencyUnit][v.ProductId]  += v.ServiceAmount
 			}
 
 			for _, v := range contractAmountCurrencyTotals {
-				ficcAmuount := contractSumMap[v.Code][1] - invoiceSumMap[v.Code][1]
-				raiAmuount := contractSumMap[v.Code][2] - invoiceSumMap[v.Code][2]
-				v.Amount = ficcAmuount+raiAmuount
+				v.Amount = contractSumMap[v.Code] - invoiceSumMap[v.Code]
 			}
 
 		}()

+ 1 - 1
models/fms/invoice_payment_summary.go

@@ -355,7 +355,7 @@ func GetInvoiceCensusList(condition string, pars []interface{}) (results []*Invo
 		Joins("left JOIN invoice_payment_summary AS a ON a.register_id = b.contract_register_id AND b.is_deleted = 0").
 		Joins("LEFT JOIN contract_invoice AS c ON a.invoice_id = c.contract_invoice_id AND c.is_deleted = 0").
 		Joins("LEFT JOIN contract_invoice AS d ON a.payment_id = d.contract_invoice_id AND d.is_deleted = 0").
-		Where(condition, pars...).Group("contract_register_id,service_product_id")
+		Where(condition, pars...).Group("contract_register_id")
 
 	nq := global.DEFAULT_MYSQL.Table("(?) AS e", query).
 		Select("*").Where(" e.invoiced_amount_count <>  e.contract_amount ")