zwxi 11 months ago
parent
commit
6912b16a41
2 changed files with 52 additions and 40 deletions
  1. 33 22
      controller/census/invoice_payment.go
  2. 19 18
      models/fms/contract_invoice.go

+ 33 - 22
controller/census/invoice_payment.go

@@ -79,7 +79,7 @@ func ExportInvoicePaymentCensusList(c *gin.Context, results *fms.InvoicePaymentC
 	sheet.AddRow()
 
 	// 表头, 套餐动态获取
-	rowTitle := []string{"序号", "客户名称", "代付方", "是否新客户", "合同有效期", "开票日", "开票金额", "到款日", "到款金额", "付款方式", "销售",
+	rowTitle := []string{"序号", "客户名称", "代付方", "是否新客户", "合同起始日期", "合同结束日期", "开票日", "开票金额", "开票换算金额(元)", "到款日", "到款金额", "到款换算金额(元)", "付款方式", "销售",
 		"销售组别", "销售类型"}
 	serviceTempCond := ``
 	serviceTempPars := make([]interface{}, 0)
@@ -188,14 +188,20 @@ func ExportInvoicePaymentCensusList(c *gin.Context, results *fms.InvoicePaymentC
 		// 合同有效期
 		colD := dataRow.AddCell()
 		colD.VMerge = mergeRowNum
-		colD.SetString(fmt.Sprint(v.StartDate, "至", v.EndDate))
+		colD.SetString(v.StartDate)
+
+		colF := dataRow.AddCell()
+		colF.VMerge = mergeRowNum
+		colF.SetString(v.EndDate)
 		// 开票到款信息
 		for k2, v2 := range v.InvoicePaymentList {
 			rowData := []string{
 				v2.InvoiceDate,                                // 开票日
-				fmt.Sprint(v2.InvoiceAmount),                  // 开票金额
+				fmt.Sprint(v2.InvoiceOriginAmount),            // 开票金额
+				fmt.Sprint(v2.InvoiceAmount),                  // 开票换算金额
 				v2.PaymentDate,                                // 到款日
-				fmt.Sprint(v2.PaymentAmount),                  // 到款金额
+				fmt.Sprint(v2.PaymentOriginAmount),            // 到款金额
+				fmt.Sprint(v2.PaymentAmount),                  // 到款换算金额
 				fms.ContractPaymentPayTypeNameMap[v2.PayType], // 付款方式
 				v2.SellerName,                                 // 销售
 				v2.SellerGroupName,                            // 组别
@@ -828,7 +834,6 @@ func getCensusIncomeListV2(ch chan models.CensusIncomeChartResp, req fms.IncomeL
 		}
 	}
 
-
 	var latestTime time.Time
 
 	invoiceItem, err := fms.GetLatestIncome(cond, pars)
@@ -1060,7 +1065,7 @@ func getCensusIncomeListV2(ch chan models.CensusIncomeChartResp, req fms.IncomeL
 						partAccumulate = 0.0
 					}
 				}
-			} else if endDateTime.Before(historyTime) || endDateTime.Equal(historyTime)  {
+			} else if endDateTime.Before(historyTime) || endDateTime.Equal(historyTime) {
 				//全部走旧查询
 				//fmt.Println("旧查询")
 				//fmt.Println("st:",st)
@@ -1593,7 +1598,7 @@ func (ct *InvoicePaymentController) NotInvoiceList(c *gin.Context) {
 						if serviceAmount, ok := serviceAmountMap[v.ContractRegisterId]; ok {
 							item := fms.NotInvoicePaymentSummaryItem{
 								NotInvoicedAmountOriginTotal: serviceAmount[2].ServiceAmount,
-								ServiceProductId:       2,
+								ServiceProductId:             2,
 							}
 							item.SellerId = v.SellerId
 							item.SellerName = v.SellerName
@@ -1606,7 +1611,7 @@ func (ct *InvoicePaymentController) NotInvoiceList(c *gin.Context) {
 						if serviceAmount, ok := serviceAmountMap[v.ContractRegisterId]; ok {
 							item := fms.NotInvoicePaymentSummaryItem{
 								NotInvoicedAmountOriginTotal: serviceAmount[1].ServiceAmount,
-								ServiceProductId:       1,
+								ServiceProductId:             1,
 							}
 							item.SellerId = v.SellerId
 							item.SellerName = v.SellerName
@@ -1622,7 +1627,7 @@ func (ct *InvoicePaymentController) NotInvoiceList(c *gin.Context) {
 					if serviceAmount, ok := serviceAmountMap[v.ContractRegisterId]; ok {
 						item1 := fms.NotInvoicePaymentSummaryItem{
 							NotInvoicedAmountOriginTotal: serviceAmount[2].ServiceAmount,
-							ServiceProductId:       2,
+							ServiceProductId:             2,
 						}
 						item1.SellerId = v.SellerId
 						item1.SellerName = v.SellerName
@@ -1632,7 +1637,7 @@ func (ct *InvoicePaymentController) NotInvoiceList(c *gin.Context) {
 
 						item2 := fms.NotInvoicePaymentSummaryItem{
 							NotInvoicedAmountOriginTotal: serviceAmount[1].ServiceAmount,
-							ServiceProductId:       1,
+							ServiceProductId:             1,
 						}
 						item2.SellerId = v.SellerId
 						item2.SellerName = v.SellerName
@@ -1646,7 +1651,7 @@ func (ct *InvoicePaymentController) NotInvoiceList(c *gin.Context) {
 					if serviceAmount, ok := serviceAmountMap[v.ContractRegisterId]; ok {
 						item1 := fms.NotInvoicePaymentSummaryItem{
 							NotInvoicedAmountOriginTotal: serviceAmount[1].ServiceAmount,
-							ServiceProductId:       1,
+							ServiceProductId:             1,
 						}
 						item1.SellerId = v.SellerId
 						item1.SellerName = v.SellerName
@@ -1660,7 +1665,7 @@ func (ct *InvoicePaymentController) NotInvoiceList(c *gin.Context) {
 					if serviceAmount, ok := serviceAmountMap[v.ContractRegisterId]; ok {
 						item2 := fms.NotInvoicePaymentSummaryItem{
 							NotInvoicedAmountOriginTotal: serviceAmount[2].ServiceAmount,
-							ServiceProductId:       2,
+							ServiceProductId:             2,
 						}
 						item2.SellerId = v.SellerId
 						item2.SellerName = v.SellerName
@@ -1725,8 +1730,8 @@ func (ct *InvoicePaymentController) NotInvoiceList(c *gin.Context) {
 								v.NotInvoicedAmountOriginTotal = v.PaymentAmountTotal - v.InvoiceAmountTotal
 							}
 						}
-						v.NotInvoicedAmountTotal = v.NotInvoicedAmountOriginTotal/v.RMBRate
-						v.NotInvoicedAmountTotal ,_= strconv.ParseFloat(fmt.Sprintf("%.2f", v.NotInvoicedAmountTotal), 64)
+						v.NotInvoicedAmountTotal = v.NotInvoicedAmountOriginTotal / v.RMBRate
+						v.NotInvoicedAmountTotal, _ = strconv.ParseFloat(fmt.Sprintf("%.2f", v.NotInvoicedAmountTotal), 64)
 					}
 					// 补充销售信息
 					if v.SellerId > 0 && v.RaiSellerId > 0 {
@@ -2121,6 +2126,7 @@ func (ct *InvoicePaymentController) NotPaymentList(c *gin.Context) {
 				v.PaymentAmount = summaryList[i].PaymentAmount
 				v.PaymentOriginAmount = summaryList[i].PaymentOriginAmount
 				v.PayType = summaryList[i].PayType
+				v.NotPaymentOriginAmount = summaryList[i].InvoiceOriginAmount - summaryList[i].PaymentOriginAmount
 				v.NotPaymentAmount = summaryList[i].InvoiceAmount - summaryList[i].PaymentAmount
 				v.ServiceProductId = summaryList[i].ServiceProductId
 				v.UnitName = unitMap[summaryList[i].CurrencyUnit]
@@ -2528,7 +2534,7 @@ func ExportNotPaymentCensusList(c *gin.Context, results *fms.NotInvoicePaymentCe
 	sheet.AddRow()
 
 	// 表头, 套餐动态获取
-	rowTitle := []string{"序号", "客户名称", "合同编号", "合同有效期", "套餐类型", "开票日", "开票金额", "金额单位", "开票销售",
+	rowTitle := []string{"序号", "客户名称", "合同编号", "合同起始日期", "合同结束日期", "套餐类型", "开票日", "开票金额", "金额单位", "开票换算金额", "开票销售",
 		"销售组别", "销售类型"}
 
 	titleRow := sheet.AddRow()
@@ -2563,7 +2569,11 @@ func ExportNotPaymentCensusList(c *gin.Context, results *fms.NotInvoicePaymentCe
 		// 合同有效期
 		colD := dataRow.AddCell()
 		colD.VMerge = mergeRowNum
-		colD.SetString(fmt.Sprint(v.StartDate, "至", v.EndDate))
+		colD.SetString(v.StartDate)
+
+		colF := dataRow.AddCell()
+		colF.VMerge = mergeRowNum
+		colF.SetString(v.EndDate)
 		// 套餐类型
 		colE := dataRow.AddCell()
 		colE.VMerge = mergeRowNum
@@ -2572,12 +2582,13 @@ func ExportNotPaymentCensusList(c *gin.Context, results *fms.NotInvoicePaymentCe
 		// 开票到款信息
 		for _, v2 := range v.InvoicePaymentList {
 			rowData := []string{
-				v2.InvoiceDate,                  // 开票日
-				fmt.Sprint(v2.NotPaymentAmount), // 开票金额
-				v2.UnitName,                     // 开票金额
-				v2.SellerName,                   // 销售
-				v2.SellerGroupName,              // 组别
-				sellerTypeMap[v2.SellerType],    // 销售类型
+				v2.InvoiceDate,                        // 开票日
+				fmt.Sprint(v2.NotPaymentOriginAmount), // 开票原始金额
+				v2.UnitName,                           // 开票金额
+				fmt.Sprint(v2.NotPaymentAmount),       // 开票换算金额
+				v2.SellerName,                         // 销售
+				v2.SellerGroupName,                    // 组别
+				sellerTypeMap[v2.SellerType],          // 销售类型
 			}
 			for i := range rowData {
 				dataRow.AddCell().SetString(rowData[i])

+ 19 - 18
models/fms/contract_invoice.go

@@ -711,24 +711,25 @@ type NotPaymentCensusItem struct {
 
 // NotPaymentCensusInfo 开票到款统计信息
 type NotPaymentCensusInfo struct {
-	InvoiceId           int                                 `json:"invoice_id" description:"开票ID"`
-	InvoiceDate         string                              `json:"invoice_time" description:"开票日期"`
-	InvoiceAmount       float64                             `json:"invoice_amount" description:"开票换算金额"`
-	InvoiceOriginAmount float64                             `json:"invoice_origin_amount" description:"开票原始金额"`
-	SellerId            int                                 `json:"seller_id" description:"销售ID"`
-	SellerName          string                              `json:"seller_name" description:"销售名称"`
-	SellerGroupId       int                                 `json:"seller_group_id" description:"销售组别ID"`
-	SellerGroupName     string                              `json:"seller_group_name" description:"销售组别名称"`
-	PaymentId           int                                 `json:"payment_id" description:"到款ID"`
-	PaymentDate         string                              `json:"payment_date" description:"到款日期"`
-	PaymentAmount       float64                             `json:"payment_amount" description:"到款换算金额"`
-	PaymentOriginAmount float64                             `json:"payment_origin_amount" description:"到款原始金额"`
-	PayType             int                                 `json:"pay_type" description:"付款方式:0-无;1-年付;2-半年付;3-季付;4-次付;5-异常"`
-	ServiceAmountList   []*ContractPaymentServiceAmountItem `json:"service_amount_list" description:"到款套餐金额分配信息"`
-	SellerType          int                                 `json:"seller_type" description:"销售类型:1ficc销售,2权益销售"`
-	NotPaymentAmount    float64                             `json:"not_payment_amount" description:"开票未到款金额"`
-	ServiceProductId    int                                 `json:"service_product_id" description:"套餐类型:1ficc套餐,2权益套餐"`
-	UnitName            string                              `json:"unit_name" description:"单位名称"`
+	InvoiceId              int                                 `json:"invoice_id" description:"开票ID"`
+	InvoiceDate            string                              `json:"invoice_time" description:"开票日期"`
+	InvoiceAmount          float64                             `json:"invoice_amount" description:"开票换算金额"`
+	InvoiceOriginAmount    float64                             `json:"invoice_origin_amount" description:"开票原始金额"`
+	SellerId               int                                 `json:"seller_id" description:"销售ID"`
+	SellerName             string                              `json:"seller_name" description:"销售名称"`
+	SellerGroupId          int                                 `json:"seller_group_id" description:"销售组别ID"`
+	SellerGroupName        string                              `json:"seller_group_name" description:"销售组别名称"`
+	PaymentId              int                                 `json:"payment_id" description:"到款ID"`
+	PaymentDate            string                              `json:"payment_date" description:"到款日期"`
+	PaymentAmount          float64                             `json:"payment_amount" description:"到款换算金额"`
+	PaymentOriginAmount    float64                             `json:"payment_origin_amount" description:"到款原始金额"`
+	PayType                int                                 `json:"pay_type" description:"付款方式:0-无;1-年付;2-半年付;3-季付;4-次付;5-异常"`
+	ServiceAmountList      []*ContractPaymentServiceAmountItem `json:"service_amount_list" description:"到款套餐金额分配信息"`
+	SellerType             int                                 `json:"seller_type" description:"销售类型:1ficc销售,2权益销售"`
+	NotPaymentOriginAmount float64                             `json:"not_payment_origin_amount" description:"开票未到款金额"`
+	NotPaymentAmount       float64                             `json:"not_payment_amount" description:"开票未到款换算金额"`
+	ServiceProductId       int                                 `json:"service_product_id" description:"套餐类型:1ficc套餐,2权益套餐"`
+	UnitName               string                              `json:"unit_name" description:"单位名称"`
 }
 
 // GetCensusSellerGroupInvoicePageListV2 获取销售组开票统计列表-分页