ziwen 1 năm trước cách đây
mục cha
commit
399fe42641
1 tập tin đã thay đổi với 21 bổ sung18 xóa
  1. 21 18
      controller/census/invoice_payment.go

+ 21 - 18
controller/census/invoice_payment.go

@@ -1745,26 +1745,29 @@ func (ct *InvoicePaymentController) NotInvoiceList(c *gin.Context) {
 						NotInvoiceSummaryMap[v.ContractRegisterId] = append(NotInvoiceSummaryMap[v.ContractRegisterId], &item)
 					}
 				} else if (v.ProductIds == "1,2" || v.ProductIds == "2,1") && len(NotInvoiceSummaryMap[v.ContractRegisterId]) == 0 {
-					item1 := fms.NotInvoicePaymentSummaryItem{
-						NotInvoicedAmountTotal: serviceAmountMap[v.ContractRegisterId][2].ServiceAmount,
-						ServiceProductId:       2,
-					}
-					item1.SellerId = v.SellerId
-					item1.SellerName = v.SellerName
-					item1.RaiSellerId = v.RaiSellerId
-					item1.RaiSellerName = v.RaiSellerName
-					NotInvoiceSummaryMap[v.ContractRegisterId] = append(NotInvoiceSummaryMap[v.ContractRegisterId], &item1)
-
-					item2 := fms.NotInvoicePaymentSummaryItem{
-						NotInvoicedAmountTotal: serviceAmountMap[v.ContractRegisterId][1].ServiceAmount,
-						ServiceProductId:       1,
+					if serviceAmount, ok := serviceAmountMap[v.ContractRegisterId]; ok{
+						item1 := fms.NotInvoicePaymentSummaryItem{
+							NotInvoicedAmountTotal: serviceAmount[2].ServiceAmount,
+							ServiceProductId:       2,
+						}
+						item1.SellerId = v.SellerId
+						item1.SellerName = v.SellerName
+						item1.RaiSellerId = v.RaiSellerId
+						item1.RaiSellerName = v.RaiSellerName
+						NotInvoiceSummaryMap[v.ContractRegisterId] = append(NotInvoiceSummaryMap[v.ContractRegisterId], &item1)
+
+						item2 := fms.NotInvoicePaymentSummaryItem{
+							NotInvoicedAmountTotal: serviceAmount[1].ServiceAmount,
+							ServiceProductId:       1,
+						}
+						item2.SellerId = v.SellerId
+						item2.SellerName = v.SellerName
+						item2.RaiSellerId = v.RaiSellerId
+						item2.RaiSellerName = v.RaiSellerName
+
+						NotInvoiceSummaryMap[v.ContractRegisterId] = append(NotInvoiceSummaryMap[v.ContractRegisterId], &item2)
 					}
-					item2.SellerId = v.SellerId
-					item2.SellerName = v.SellerName
-					item2.RaiSellerId = v.RaiSellerId
-					item2.RaiSellerName = v.RaiSellerName
 
-					NotInvoiceSummaryMap[v.ContractRegisterId] = append(NotInvoiceSummaryMap[v.ContractRegisterId], &item2)
 				} else if v.ProductIds == "1" && len(NotInvoiceSummaryMap[v.ContractRegisterId]) == 0 {
 					if serviceAmount, ok := serviceAmountMap[v.ContractRegisterId]; ok{
 						item1 := fms.NotInvoicePaymentSummaryItem{