ziwen 1 年之前
父节点
当前提交
4f43c0271c
共有 1 个文件被更改,包括 16 次插入15 次删除
  1. 16 15
      controller/census/invoice_payment.go

+ 16 - 15
controller/census/invoice_payment.go

@@ -1822,7 +1822,6 @@ func (ct *InvoicePaymentController) NotInvoiceList(c *gin.Context) {
 			}
 
 			// 重组汇总数据
-			summaryMap := make(map[int][]*fms.NotPaymentCensusInfo)
 			sellerList, e := crmService.GetSellerDepartmentListWithGroupAndTeam()
 			if e != nil {
 				resp.FailData("获取销售失败", "Err:"+e.Error(), c)
@@ -1849,10 +1848,15 @@ func (ct *InvoicePaymentController) NotInvoiceList(c *gin.Context) {
 
 			for registerId, list := range NotInvoiceSummaryMap {
 				for _, v := range list {
+					fmt.Println("v.ContractRegisterId",v.ContractRegisterId)
 					fmt.Println("v.ServiceProductId:",v.ServiceProductId)
 					fmt.Println("v.NotInvoicedAmountTotal:",v.NotInvoicedAmountTotal)
 					if v.NotInvoicedAmountTotal == 0 {
-						v.NotInvoicedAmountTotal = serviceAmountMap[registerId][v.ServiceProductId].ServiceAmount - v.InvoiceAmountTotal
+						if v.InvoiceAmountTotal > v.PaymentAmountTotal{
+							v.NotInvoicedAmountTotal = serviceAmountMap[registerId][v.ServiceProductId].ServiceAmount - v.InvoiceAmountTotal
+						} else {
+							v.NotInvoicedAmountTotal = serviceAmountMap[registerId][v.ServiceProductId].ServiceAmount - v.PaymentAmountTotal
+						}
 					}
 					if v.SellerId > 0 && v.RaiSellerId > 0 {
 						if v.ServiceProductId == 1 {
@@ -1885,17 +1889,16 @@ func (ct *InvoicePaymentController) NotInvoiceList(c *gin.Context) {
 				v.NewCompany = registerList[i].NewCompany
 				v.StartDate = utils.TimeTransferString(utils.FormatDate, registerList[i].StartDate)
 				v.EndDate = utils.TimeTransferString(utils.FormatDate, registerList[i].EndDate)
-				v.InvoicePaymentList = summaryMap[registerList[i].SummaryId]
 				v.ContractType = registerList[i].ContractType
 				v.ContractCode = registerList[i].ContractCode
 				v.ContractAmount = registerList[i].ContractAmount
 				v.UnitName = unitMap[registerList[i].CurrencyUnit]
 				v.ProductIds = registerList[i].ProductIds
-				if registerList[i].InvoicedAmount != 0 {
-					v.NotInvoiceTotal = registerList[i].ContractAmount - registerList[i].InvoicedAmount
-				} else {
-					v.NotInvoiceTotal = registerList[i].ContractAmount - registerList[i].PaymentAmount
-				}
+				//if registerList[i].InvoicedAmount != 0 {
+				//	v.NotInvoiceTotal = registerList[i].ContractAmount - registerList[i].InvoicedAmount
+				//} else {
+				//	v.NotInvoiceTotal = registerList[i].ContractAmount - registerList[i].PaymentAmount
+				//}
 
 				v.NotInvoiceList = NotInvoiceSummaryMap[registerList[i].ContractRegisterId]
 				respList = append(respList, v)
@@ -2126,8 +2129,10 @@ func (ct *InvoicePaymentController) NotPaymentList(c *gin.Context) {
 	}
 	if req.SortType == "asc" {
 		page.AddOrderItem(base.OrderItem{Column: "e.invoice_time", Asc: true})
+		page.AddOrderItem(base.OrderItem{Column: "e.modify_time", Asc: false})
 	} else {
 		page.AddOrderItem(base.OrderItem{Column: "e.invoice_time", Asc: false})
+		page.AddOrderItem(base.OrderItem{Column: "e.modify_time", Asc: false})
 	}
 
 	if req.IsExport == 1 {
@@ -2553,7 +2558,7 @@ func ExportNotPaymentCensusList(c *gin.Context, results *fms.NotInvoicePaymentCe
 	sheet.AddRow()
 
 	// 表头, 套餐动态获取
-	rowTitle := []string{"序号", "客户名称", "是否新客户", "合同有效期", "开票日", "开票金额", "到款日", "到款金额", "付款方式", "销售",
+	rowTitle := []string{"序号", "客户名称", "合同编号", "合同有效期", "开票日", "开票金额", "开票销售",
 		"销售组别", "销售类型"}
 
 	titleRow := sheet.AddRow()
@@ -2563,7 +2568,6 @@ func ExportNotPaymentCensusList(c *gin.Context, results *fms.NotInvoicePaymentCe
 		v.SetStyle(style)
 	}
 
-	newCompanyMap := map[int]string{0: "否", 1: "是"}
 	sellerTypeMap := map[int]string{1: "FICC销售", 2: "权益销售"}
 	for k, v := range list {
 		dataRow := sheet.AddRow()
@@ -2579,10 +2583,10 @@ func ExportNotPaymentCensusList(c *gin.Context, results *fms.NotInvoicePaymentCe
 		colB := dataRow.AddCell()
 		colB.VMerge = mergeRowNum
 		colB.SetString(v.CompanyName)
-		// 是否新客户
+		// 合同编号
 		colC := dataRow.AddCell()
 		colC.VMerge = mergeRowNum
-		colC.SetString(newCompanyMap[v.NewCompany])
+		colC.SetString(v.ContractCode)
 		// 合同有效期
 		colD := dataRow.AddCell()
 		colD.VMerge = mergeRowNum
@@ -2592,9 +2596,6 @@ func ExportNotPaymentCensusList(c *gin.Context, results *fms.NotInvoicePaymentCe
 			rowData := []string{
 				v2.InvoiceDate,                                // 开票日
 				fmt.Sprint(v2.InvoiceAmount),                  // 开票金额
-				v2.PaymentDate,                                // 到款日
-				fmt.Sprint(v2.PaymentAmount),                  // 到款金额
-				fms.ContractPaymentPayTypeNameMap[v2.PayType], // 付款方式
 				v2.SellerName,                                 // 销售
 				v2.SellerGroupName,                            // 组别
 				sellerTypeMap[v2.SellerType],                  // 销售类型