ziwen преди 1 година
родител
ревизия
a8d0b0c7c7
променени са 1 файла, в които са добавени 22 реда и са изтрити 19 реда
  1. 22 19
      controller/census/invoice_payment.go

+ 22 - 19
controller/census/invoice_payment.go

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