Browse Source

Merge branch 'fms_3.0' into debug

# Conflicts:
#	controller/census/invoice_payment.go
zwxi 11 months ago
parent
commit
20fa2445c0
2 changed files with 18 additions and 12 deletions
  1. 17 11
      controller/census/invoice_payment.go
  2. 1 1
      controller/contract/pre_register.go

+ 17 - 11
controller/census/invoice_payment.go

@@ -811,8 +811,6 @@ func getCensusIncomeListV2(ch chan models.CensusIncomeChartResp, req fms.IncomeL
 		historyCond += ` AND new_company = 0 `
 	}
 
-
-
 	var latestTime time.Time
 
 	invoiceItem, err := fms.GetLatestIncome(cond, pars)
@@ -863,7 +861,7 @@ func getCensusIncomeListV2(ch chan models.CensusIncomeChartResp, req fms.IncomeL
 			req.StartDate = "2023-04"
 			req.EndDate = "3023-04"
 		} else {
-			startDateTime,_ := time.Parse(utils.FormatMonth, req.StartDate)
+			startDateTime, _ := time.Parse(utils.FormatMonth, req.StartDate)
 			if startDateTime.Before(historyTime) {
 				req.StartDate = "2023-04"
 			}
@@ -1612,6 +1610,7 @@ func (ct *InvoicePaymentController) NotInvoiceList(c *gin.Context) {
 							item.SellerName = v.SellerName
 							item.RaiSellerId = v.RaiSellerId
 							item.RaiSellerName = v.RaiSellerName
+							item.RMBRate = v.RMBRate
 
 							NotInvoiceSummaryMap[v.ContractRegisterId] = append(NotInvoiceSummaryMap[v.ContractRegisterId], &item)
 						}
@@ -1625,6 +1624,7 @@ func (ct *InvoicePaymentController) NotInvoiceList(c *gin.Context) {
 							item.SellerName = v.SellerName
 							item.RaiSellerId = v.RaiSellerId
 							item.RaiSellerName = v.RaiSellerName
+							item.RMBRate = v.RMBRate
 
 							NotInvoiceSummaryMap[v.ContractRegisterId] = append(NotInvoiceSummaryMap[v.ContractRegisterId], &item)
 						}
@@ -1641,6 +1641,8 @@ func (ct *InvoicePaymentController) NotInvoiceList(c *gin.Context) {
 						item1.SellerName = v.SellerName
 						item1.RaiSellerId = v.RaiSellerId
 						item1.RaiSellerName = v.RaiSellerName
+						item1.RMBRate = v.RMBRate
+
 						NotInvoiceSummaryMap[v.ContractRegisterId] = append(NotInvoiceSummaryMap[v.ContractRegisterId], &item1)
 
 						item2 := fms.NotInvoicePaymentSummaryItem{
@@ -1651,6 +1653,7 @@ func (ct *InvoicePaymentController) NotInvoiceList(c *gin.Context) {
 						item2.SellerName = v.SellerName
 						item2.RaiSellerId = v.RaiSellerId
 						item2.RaiSellerName = v.RaiSellerName
+						item2.RMBRate = v.RMBRate
 
 						NotInvoiceSummaryMap[v.ContractRegisterId] = append(NotInvoiceSummaryMap[v.ContractRegisterId], &item2)
 					}
@@ -1665,6 +1668,7 @@ func (ct *InvoicePaymentController) NotInvoiceList(c *gin.Context) {
 						item1.SellerName = v.SellerName
 						item1.RaiSellerId = v.RaiSellerId
 						item1.RaiSellerName = v.RaiSellerName
+						item1.RMBRate = v.RMBRate
 
 						NotInvoiceSummaryMap[v.ContractRegisterId] = append(NotInvoiceSummaryMap[v.ContractRegisterId], &item1)
 					}
@@ -1679,6 +1683,7 @@ func (ct *InvoicePaymentController) NotInvoiceList(c *gin.Context) {
 						item2.SellerName = v.SellerName
 						item2.RaiSellerId = v.RaiSellerId
 						item2.RaiSellerName = v.RaiSellerName
+						item2.RMBRate = v.RMBRate
 
 						NotInvoiceSummaryMap[v.ContractRegisterId] = append(NotInvoiceSummaryMap[v.ContractRegisterId], &item2)
 					}
@@ -1711,7 +1716,7 @@ func (ct *InvoicePaymentController) NotInvoiceList(c *gin.Context) {
 			}
 
 			for registerId, list := range NotInvoiceSummaryMap {
-				for _, v := range list {
+				for i, v := range list {
 					// fmt.Println("v.ContractRegisterId", v.ContractRegisterId)
 					// fmt.Println("v.ServiceProductId:", v.ServiceProductId)
 					// fmt.Println("v.NotInvoicedAmountTotal:", v.NotInvoicedAmountTotal)
@@ -1721,26 +1726,27 @@ func (ct *InvoicePaymentController) NotInvoiceList(c *gin.Context) {
 							// 有合规登记或补录合同过的,有serviceAmountMap信息
 							if _, ok := serviceAmountMap[registerId]; ok {
 								if _, ok2 := serviceAmountMap[registerId][v.ServiceProductId]; ok2 {
-									v.NotInvoicedAmountOriginTotal = serviceAmountMap[registerId][v.ServiceProductId].ServiceAmount - v.InvoiceAmountTotal
+									list[i].NotInvoicedAmountOriginTotal = serviceAmountMap[registerId][v.ServiceProductId].ServiceAmount - v.InvoiceAmountTotal
 								}
 							} else {
 								// 预登记没有合同套餐金额信息
-								v.NotInvoicedAmountOriginTotal = v.InvoiceAmountTotal - v.PaymentAmountTotal
+								list[i].NotInvoicedAmountOriginTotal = v.InvoiceAmountTotal - v.PaymentAmountTotal
 							}
 						} else {
 							if _, ok := serviceAmountMap[registerId]; ok {
 								// 有合规登记或补录合同过的,有serviceAmountMap信息
 								if _, ok2 := serviceAmountMap[registerId][v.ServiceProductId]; ok2 {
-									v.NotInvoicedAmountOriginTotal = serviceAmountMap[registerId][v.ServiceProductId].ServiceAmount - v.PaymentAmountTotal
+									list[i].NotInvoicedAmountOriginTotal = serviceAmountMap[registerId][v.ServiceProductId].ServiceAmount - v.PaymentAmountTotal
 								}
 							} else {
 								// 预登记没有合同套餐金额信息
-								v.NotInvoicedAmountOriginTotal = v.PaymentAmountTotal - v.InvoiceAmountTotal
+								list[i].NotInvoicedAmountOriginTotal = v.PaymentAmountTotal - v.InvoiceAmountTotal
 							}
 						}
-						v.NotInvoicedAmountTotal = v.NotInvoicedAmountOriginTotal / v.RMBRate
-						v.NotInvoicedAmountTotal, _ = strconv.ParseFloat(fmt.Sprintf("%.2f", v.NotInvoicedAmountTotal), 64)
 					}
+					list[i].NotInvoicedAmountTotal = v.NotInvoicedAmountOriginTotal / v.RMBRate
+					list[i].NotInvoicedAmountTotal, _ = strconv.ParseFloat(fmt.Sprintf("%.2f", v.NotInvoicedAmountTotal), 64)
+
 					// 补充销售信息
 					if v.SellerId > 0 && v.RaiSellerId > 0 {
 						if v.ServiceProductId == 1 {
@@ -2447,7 +2453,7 @@ func ExportNotInvoiceCensusList(c *gin.Context, results *fms.NotInvoicePaymentCe
 			} else {
 
 				dataRow.AddCell().SetString(fmt.Sprintf("%.2f", item.NotInvoicedAmountOriginTotal)) // 未开票金额
-				dataRow.AddCell().SetString(fmt.Sprintf("%.2f", item.NotInvoicedAmountTotal)) // 未开票换算金额
+				dataRow.AddCell().SetString(fmt.Sprintf("%.2f", item.NotInvoicedAmountTotal))       // 未开票换算金额
 
 				dataRow.AddCell().SetString(serviceProductIdMap[item.ServiceProductId]) // 套餐类型
 

+ 1 - 1
controller/contract/pre_register.go

@@ -1164,7 +1164,7 @@ func (rg *PreRegisterController) Save(c *gin.Context) {
 		if v.ContractInvoiceId != 0 {
 			//更新
 			invoiceHandleType = 1
-			invoiceUpdateCols = append(invoiceUpdateCols, "OriginAmount", "CurrencyUnit",
+			invoiceUpdateCols = append(invoiceUpdateCols, "Amount","OriginAmount", "CurrencyUnit",
 				"InvoiceDate", "Remark", "ServiceProductId", "StartDate", "EndDate", "ModifyTime")
 		} else {
 			//新增