ziwen 1 year ago
parent
commit
ee8b872370

+ 146 - 73
controller/census/invoice_payment.go

@@ -447,7 +447,7 @@ func ExportInvoicePaymentCensusList(c *gin.Context, results *fms.InvoicePaymentC
 				fms.ContractPaymentPayTypeNameMap[v2.PayType], // 付款方式
 				v2.SellerName,                                 // 销售
 				v2.SellerGroupName,                            // 组别
-				v2.SellerType,                  // 销售类型
+				v2.SellerType,                                 // 销售类型
 			}
 			// 套餐金额信息
 			serviceTempShowAmount := make(map[int]string)
@@ -1600,7 +1600,6 @@ func (ct *InvoicePaymentController) NotInvoiceList(c *gin.Context) {
 		noSummaryCond += ` AND b.product_ids = '2' `
 	}
 
-
 	page := new(base.Page)
 	page.SetPageSize(req.PageSize)
 	page.SetCurrent(req.Current)
@@ -1646,7 +1645,7 @@ func (ct *InvoicePaymentController) NotInvoiceList(c *gin.Context) {
 	for _, v := range registerList {
 		queryRegisterIds = append(queryRegisterIds, v.ContractRegisterId)
 	}
-	fmt.Println("queryRegisterIds:",queryRegisterIds)
+	fmt.Println("queryRegisterIds:", queryRegisterIds)
 	results := new(fms.NotInvoicePaymentCensusResp)
 	if len(queryRegisterIds) > 0 {
 		// 获取合同的套餐金额信息
@@ -1661,7 +1660,7 @@ func (ct *InvoicePaymentController) NotInvoiceList(c *gin.Context) {
 				serviceAmountMap[v.ContractRegisterId] = make(map[int]*fms.ContractServiceAmount)
 			}
 			serviceAmountMap[v.ContractRegisterId][v.ProductId] = v
-			fmt.Println("ServiceAmount,ProductId",v.ServiceAmount,v.ProductId,v.ContractRegisterId)
+			fmt.Println("ServiceAmount,ProductId", v.ServiceAmount, v.ProductId, v.ContractRegisterId)
 		}
 
 		// 获取汇总数据IDs, 用于查询合计数据
@@ -1724,12 +1723,12 @@ func (ct *InvoicePaymentController) NotInvoiceList(c *gin.Context) {
 				resp.FailMsg("获取失败", "GetNoInvoicePaymentCensusData, Err: "+e.Error(), c)
 				return
 			}
-			fmt.Println("len(summaryData)",len(summaryData))
-			fmt.Println("len(noSummaryData)",len(noSummaryData))
+			fmt.Println("len(summaryData)", len(summaryData))
+			fmt.Println("len(noSummaryData)", len(noSummaryData))
 			summaryList = summaryData
 			NotInvoiceSummaryMap := make(map[int][]*fms.NotInvoicePaymentSummaryItem, 0)
 			for _, v := range summaryList {
-				fmt.Println("v2.ContractRegisterId",v.ContractRegisterId)
+				fmt.Println("v2.ContractRegisterId", v.ContractRegisterId)
 				NotInvoiceSummaryMap[v.RegisterId] = append(NotInvoiceSummaryMap[v.RegisterId], v)
 			}
 
@@ -1741,14 +1740,14 @@ func (ct *InvoicePaymentController) NotInvoiceList(c *gin.Context) {
 			//	//summaryIds = append(summaryIds, summaryList[i].SummaryId)
 			//}
 
-			fmt.Println("len(NotInvoiceSummaryMap):",len(NotInvoiceSummaryMap))
+			fmt.Println("len(NotInvoiceSummaryMap):", len(NotInvoiceSummaryMap))
 
 			for _, v := range summaryList {
-				fmt.Println("ProductIds:",v.ProductIds)
-				fmt.Println("ContractRegisterId:",v.ContractRegisterId)
-				fmt.Println("ServiceProductId:",v.ServiceProductId)
-				fmt.Println("RegisterId:",v.RegisterId)
-				fmt.Println("len(NotInvoiceSummaryMap[v.RegisterId]):",len(NotInvoiceSummaryMap[v.ContractRegisterId]))
+				fmt.Println("ProductIds:", v.ProductIds)
+				fmt.Println("ContractRegisterId:", v.ContractRegisterId)
+				fmt.Println("ServiceProductId:", v.ServiceProductId)
+				fmt.Println("RegisterId:", v.RegisterId)
+				fmt.Println("len(NotInvoiceSummaryMap[v.RegisterId]):", len(NotInvoiceSummaryMap[v.ContractRegisterId]))
 				if (v.ProductIds == "1,2" || v.ProductIds == "2,1") && len(NotInvoiceSummaryMap[v.ContractRegisterId]) == 1 {
 					if v.ServiceProductId == 1 {
 						item := fms.NotInvoicePaymentSummaryItem{
@@ -1848,11 +1847,11 @@ 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)
+					fmt.Println("v.ContractRegisterId", v.ContractRegisterId)
+					fmt.Println("v.ServiceProductId:", v.ServiceProductId)
+					fmt.Println("v.NotInvoicedAmountTotal:", v.NotInvoicedAmountTotal)
 					if v.NotInvoicedAmountTotal == 0 {
-						if v.InvoiceAmountTotal > v.PaymentAmountTotal{
+						if v.InvoiceAmountTotal > v.PaymentAmountTotal {
 							v.NotInvoicedAmountTotal = serviceAmountMap[registerId][v.ServiceProductId].ServiceAmount - v.InvoiceAmountTotal
 						} else {
 							v.NotInvoicedAmountTotal = serviceAmountMap[registerId][v.ServiceProductId].ServiceAmount - v.PaymentAmountTotal
@@ -1950,10 +1949,10 @@ func (ct *InvoicePaymentController) NotInvoiceList(c *gin.Context) {
 					invoiceTotal += v.PaymentAmountCount
 				}
 				rate := v.RMBRate
-				if rate == 0.0{
+				if rate == 0.0 {
 					rate = 1.0
 				}
-				contractAmount += v.ContractAmount/v.RMBRate
+				contractAmount += v.ContractAmount / v.RMBRate
 			}
 
 		}()
@@ -2006,7 +2005,6 @@ func (ct *InvoicePaymentController) NotInvoiceList(c *gin.Context) {
 			invoiceSumMap := make(map[string]float64)
 			contractSumMap := make(map[string]float64)
 
-
 			for _, v := range registerList {
 				if v.InvoicedAmount >= v.PaymentAmount {
 					invoiceSumMap[v.CurrencyUnit] += v.InvoicedAmount
@@ -2038,7 +2036,7 @@ func (ct *InvoicePaymentController) NotInvoiceList(c *gin.Context) {
 		}
 		results.DataList = respList
 		results.InvoiceTotal = invoiceTotal
-		results.NotInvoiceTotal, _ = strconv.ParseFloat(fmt.Sprintf("%.2f", contractAmount - invoiceTotal), 64)
+		results.NotInvoiceTotal, _ = strconv.ParseFloat(fmt.Sprintf("%.2f", contractAmount-invoiceTotal), 64)
 		results.InvoiceCurrencyTotal = invoiceCurrencyTotals
 		results.PaymentCurrencyTotal = paymentCurrencyTotals
 		results.NotInvoiceCurrencyTotal = contractAmountCurrencyTotals
@@ -2210,7 +2208,19 @@ func (ct *InvoicePaymentController) NotPaymentList(c *gin.Context) {
 			//	//summaryIds = append(summaryIds, summaryList[i].SummaryId)
 			//
 			//}
-
+			// 货币列表
+			currencyOB := new(fms.CurrencyUnit)
+			currencyCond := `enable = 1`
+			currencyPars := make([]interface{}, 0)
+			currencyList, e := currencyOB.List(currencyCond, currencyPars)
+			if e != nil {
+				resp.FailMsg("获取失败", "获取货币列表失败, Err: "+e.Error(), c)
+				return
+			}
+			unitMap := make(map[string]string)
+			for i := range currencyList {
+				unitMap[currencyList[i].Code] = currencyList[i].UnitName
+			}
 			//// 获取合同的套餐金额信息
 			//serviceAmountList, e := fms.GetContractServiceAmountByContractRegisterIds(queryRegisterIds)
 			//if e != nil {
@@ -2251,25 +2261,11 @@ func (ct *InvoicePaymentController) NotPaymentList(c *gin.Context) {
 				v.PaymentAmount = summaryList[i].PaymentAmount
 				v.PayType = summaryList[i].PayType
 				v.NotPaymentAmount = summaryList[i].InvoiceAmount - summaryList[i].PaymentAmount
-				v.ServiceProductId =  summaryList[i].ServiceProductId
-
+				v.ServiceProductId = summaryList[i].ServiceProductId
+				v.UnitName = unitMap[summaryList[i].CurrencyUnit]
 				summaryMap[summaryList[i].SummaryId] = append(summaryMap[summaryList[i].SummaryId], v)
 			}
 
-			// 货币列表
-			currencyOB := new(fms.CurrencyUnit)
-			currencyCond := `enable = 1`
-			currencyPars := make([]interface{}, 0)
-			currencyList, e := currencyOB.List(currencyCond, currencyPars)
-			if e != nil {
-				resp.FailMsg("获取失败", "获取货币列表失败, Err: "+e.Error(), c)
-				return
-			}
-			unitMap := make(map[string]string)
-			for i := range currencyList {
-				unitMap[currencyList[i].Code] = currencyList[i].UnitName
-			}
-
 			// 响应列表
 			for i := range registerList {
 				v := new(fms.NotPaymentCensusItem)
@@ -2288,7 +2284,6 @@ func (ct *InvoicePaymentController) NotPaymentList(c *gin.Context) {
 				respList = append(respList, v)
 			}
 		}()
-
 		// 开票到款金额合计(换算后)
 		var invoiceTotal, paymentTotal float64
 		wg.Add(1)
@@ -2488,58 +2483,127 @@ func ExportNotInvoiceCensusList(c *gin.Context, results *fms.NotInvoicePaymentCe
 	}
 	incomeSummaryItemList := make([]*fms.NotPaymentCensusItem, 0)
 	incomeSummaryItemList = list
+
+	sellerList, e := crmService.GetSellerDepartmentListWithGroupAndTeam()
+	if e != nil {
+		resp.FailData("获取销售失败", "Err:"+e.Error(), c)
+		return
+	}
+	sellerMap := make(map[int]*crm.SellerAdminWithGroupTeam)
+	for i := range sellerList {
+		sellerMap[sellerList[i].SellerId] = sellerList[i]
+	}
+	sellerTypeMap := map[int]string{2: "FICC销售", 5: "权益销售"}
+	serviceProductIdMap := map[int]string{
+		1: "FICC套餐",
+		2: "权益套餐",
+	}
 	// 填充数据
 	for i, v := range incomeSummaryItemList {
 		dataRow := sheet.AddRow()
-		sheet.AddRow()
+		dataRow2 := sheet.AddRow()
 
 		cell := dataRow.AddCell()
 		cell.VMerge = 1
 		cell.SetString(strconv.Itoa(i + 1)) //序号
+		dataRow2.AddCell().SetString("")
 
 		cell2 := dataRow.AddCell()
 		cell2.VMerge = 1
-		cell2.SetString(v.CompanyName)       // 客户名称
+		cell2.SetString(v.CompanyName) // 客户名称
+		dataRow2.AddCell().SetString("")
 
 		cell3 := dataRow.AddCell()
 		cell3.VMerge = 1
-		cell3.SetString(v.ContractCode)      // 合同编号
+		cell3.SetString(v.ContractCode) // 合同编号
+		dataRow2.AddCell().SetString("")
 
 		cell4 := dataRow.AddCell()
 		cell4.VMerge = 1
-		cell4.SetString(v.StartDate)         // 合同开始时间
+		cell4.SetString(v.StartDate) // 合同开始时间
+		dataRow2.AddCell().SetString("")
 
 		cell5 := dataRow.AddCell()
 		cell5.VMerge = 1
-		cell5.SetString(v.EndDate)           // 合同结束时间
+		cell5.SetString(v.EndDate) // 合同结束时间
+		dataRow2.AddCell().SetString("")
 
 		cell6 := dataRow.AddCell()
 		cell6.VMerge = 1
-		cell6.SetString(v.ContractCode)      // 合同金额
+		cell6.SetString(fmt.Sprintf("%.2f", v.ContractAmount)) // 合同金额
+		dataRow2.AddCell().SetString("")
 
 		cell7 := dataRow.AddCell()
 		cell7.VMerge = 1
-		cell7.SetString(v.UnitName)          // 金额单位
-
-		for _, item := range v.NotInvoiceList {
-			//if j == 1{
-			//	dataRow2.AddCell().SetString(fmt.Sprintf("%.2f", item.NotInvoicedAmountTotal)) // 未开票金额
-			//	dataRow2.AddCell().SetString(strconv.Itoa(item.ServiceProductId))              // 套餐类型
-			//	dataRow2.AddCell().SetString(item.SellerName)                                  // 销售
-			//	dataRow2.AddCell().SetString(item.SellerGroupName)                             // 销售组别
-			//	dataRow2.AddCell().SetString(item.SellerType)                                  // 销售类型
-			//} else {
-			//	dataRow.AddCell().SetString(fmt.Sprintf("%.2f", item.NotInvoicedAmountTotal)) // 未开票金额
-			//	dataRow.AddCell().SetString(strconv.Itoa(item.ServiceProductId))              // 套餐类型
-			//	dataRow.AddCell().SetString(item.SellerName)                                  // 销售
-			//	dataRow.AddCell().SetString(item.SellerGroupName)                             // 销售组别
-			//	dataRow.AddCell().SetString(item.SellerType)                                  // 销售类型
-			//}
-			dataRow.AddCell().SetString(fmt.Sprintf("%.2f", item.NotInvoicedAmountTotal)) // 未开票金额
-			dataRow.AddCell().SetString(strconv.Itoa(item.ServiceProductId))              // 套餐类型
-			dataRow.AddCell().SetString(item.SellerName)                                  // 销售
-			dataRow.AddCell().SetString(item.SellerGroupName)                             // 销售组别
-			dataRow.AddCell().SetString(item.SellerType)                                  // 销售类型
+		cell7.SetString(v.UnitName) // 金额单位
+		dataRow2.AddCell().SetString("")
+
+		for j, item := range v.NotInvoiceList {
+			if j == 1 {
+				dataRow2.AddCell().SetString(fmt.Sprintf("%.2f", item.NotInvoicedAmountTotal)) // 未开票金额
+				dataRow2.AddCell().SetString(serviceProductIdMap[item.ServiceProductId])       // 套餐类型
+
+				if item.SellerId > 0 && item.RaiSellerId > 0 {
+					if item.ServiceProductId == 1 {
+						item.SellerGroupName = sellerMap[item.SellerId].GroupName
+						item.SellerType = sellerTypeMap[sellerMap[item.SellerId].DepartmentId]
+						dataRow2.AddCell().SetString(item.SellerName)      // 销售
+						dataRow2.AddCell().SetString(item.SellerGroupName) // 销售组别
+						dataRow2.AddCell().SetString(item.SellerType)      // 销售类型
+					} else {
+						item.RaiSellerGroupName = sellerMap[item.RaiSellerId].GroupName
+						item.SellerType = sellerTypeMap[sellerMap[item.RaiSellerId].DepartmentId]
+						dataRow2.AddCell().SetString(item.RaiSellerName)      // 销售
+						dataRow2.AddCell().SetString(item.RaiSellerGroupName) // 销售组别
+						dataRow2.AddCell().SetString(item.SellerType)         // 销售类型
+					}
+				} else if item.SellerId > 0 && item.RaiSellerId == 0 {
+					item.SellerGroupName = sellerMap[item.SellerId].GroupName
+					item.SellerType = sellerTypeMap[sellerMap[item.SellerId].DepartmentId]
+					dataRow2.AddCell().SetString(item.SellerName)      // 销售
+					dataRow2.AddCell().SetString(item.SellerGroupName) // 销售组别
+					dataRow2.AddCell().SetString(item.SellerType)      // 销售类型
+				} else if item.SellerId == 0 && item.RaiSellerId > 0 {
+					item.RaiSellerGroupName = sellerMap[item.RaiSellerId].GroupName
+					item.SellerType = sellerTypeMap[sellerMap[item.RaiSellerId].DepartmentId]
+					dataRow2.AddCell().SetString(item.RaiSellerName)      // 销售
+					dataRow2.AddCell().SetString(item.RaiSellerGroupName) // 销售组别
+					dataRow2.AddCell().SetString(item.SellerType)         // 销售类型
+				}
+
+			} else {
+				dataRow.AddCell().SetString(fmt.Sprintf("%.2f", item.NotInvoicedAmountTotal)) // 未开票金额
+				dataRow.AddCell().SetString(serviceProductIdMap[item.ServiceProductId])       // 套餐类型
+
+				if item.SellerId > 0 && item.RaiSellerId > 0 {
+					if item.ServiceProductId == 1 {
+						item.SellerGroupName = sellerMap[item.SellerId].GroupName
+						item.SellerType = sellerTypeMap[sellerMap[item.SellerId].DepartmentId]
+						dataRow.AddCell().SetString(item.SellerName)      // 销售
+						dataRow.AddCell().SetString(item.SellerGroupName) // 销售组别
+						dataRow.AddCell().SetString(item.SellerType)      // 销售类型
+					} else {
+						item.RaiSellerGroupName = sellerMap[item.RaiSellerId].GroupName
+						item.SellerType = sellerTypeMap[sellerMap[item.RaiSellerId].DepartmentId]
+						dataRow.AddCell().SetString(item.RaiSellerName)      // 销售
+						dataRow.AddCell().SetString(item.RaiSellerGroupName) // 销售组别
+						dataRow.AddCell().SetString(item.SellerType)         // 销售类型
+					}
+				} else if item.SellerId > 0 && item.RaiSellerId == 0 {
+					item.SellerGroupName = sellerMap[item.SellerId].GroupName
+					item.SellerType = sellerTypeMap[sellerMap[item.SellerId].DepartmentId]
+					dataRow.AddCell().SetString(item.SellerName)      // 销售
+					dataRow.AddCell().SetString(item.SellerGroupName) // 销售组别
+					dataRow.AddCell().SetString(item.SellerType)      // 销售类型
+				} else if item.SellerId == 0 && item.RaiSellerId > 0 {
+					item.RaiSellerGroupName = sellerMap[item.RaiSellerId].GroupName
+					item.SellerType = sellerTypeMap[sellerMap[item.RaiSellerId].DepartmentId]
+					dataRow.AddCell().SetString(item.RaiSellerName)      // 销售
+					dataRow.AddCell().SetString(item.RaiSellerGroupName) // 销售组别
+					dataRow.AddCell().SetString(item.SellerType)         // 销售类型
+				}
+			}
+
 		}
 	}
 
@@ -2595,7 +2659,7 @@ func ExportNotPaymentCensusList(c *gin.Context, results *fms.NotInvoicePaymentCe
 	sheet.AddRow()
 
 	// 表头, 套餐动态获取
-	rowTitle := []string{"序号", "客户名称", "合同编号", "合同有效期", "开票日", "开票金额", "开票销售",
+	rowTitle := []string{"序号", "客户名称", "合同编号", "合同有效期", "套餐类型", "开票日", "开票金额", "金额单位", "开票销售",
 		"销售组别", "销售类型"}
 
 	titleRow := sheet.AddRow()
@@ -2604,7 +2668,10 @@ func ExportNotPaymentCensusList(c *gin.Context, results *fms.NotInvoicePaymentCe
 		v.SetString(rowTitle[i])
 		v.SetStyle(style)
 	}
-
+	serviceProductIdMap := map[int]string{
+		1: "FICC套餐",
+		2: "权益套餐",
+	}
 	sellerTypeMap := map[int]string{1: "FICC销售", 2: "权益销售"}
 	for k, v := range list {
 		dataRow := sheet.AddRow()
@@ -2628,14 +2695,20 @@ func ExportNotPaymentCensusList(c *gin.Context, results *fms.NotInvoicePaymentCe
 		colD := dataRow.AddCell()
 		colD.VMerge = mergeRowNum
 		colD.SetString(fmt.Sprint(v.StartDate, "至", v.EndDate))
+		// 套餐类型
+		colE := dataRow.AddCell()
+		colE.VMerge = mergeRowNum
+		colE.SetString(serviceProductIdMap[v.InvoicePaymentList[0].ServiceProductId])
+
 		// 开票到款信息
 		for _, v2 := range v.InvoicePaymentList {
 			rowData := []string{
-				v2.InvoiceDate,                                // 开票日
-				fmt.Sprint(v2.InvoiceAmount),                  // 开票金额
-				v2.SellerName,                                 // 销售
-				v2.SellerGroupName,                            // 组别
-				sellerTypeMap[v2.SellerType],                  // 销售类型
+				v2.InvoiceDate,               // 开票日
+				fmt.Sprint(v2.InvoiceAmount), // 开票金额
+				v2.UnitName,                  // 开票金额
+				v2.SellerName,                // 销售
+				v2.SellerGroupName,           // 组别
+				sellerTypeMap[v2.SellerType], // 销售类型
 			}
 			for i := range rowData {
 				dataRow.AddCell().SetString(rowData[i])

+ 1 - 0
models/fms/contract_invoice.go

@@ -707,6 +707,7 @@ type NotPaymentCensusInfo struct {
 	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:"单位名称"`
 }
 
 

+ 4 - 3
models/fms/invoice_payment_summary.go

@@ -96,13 +96,14 @@ type InvoicePaymentSummaryItem struct {
 	InvoicedAmount   float64   `gorm:"column:invoiced_amount" json:"invoiced_amount" description:"开票金额"`
 	CurrencyUnit     string    `gorm:"column:currency_unit" json:"currency_unit" description:"货币国际代码"`
 	RMBRate          float64   `gorm:"column:rmb_rate" json:"rmb_rate" description:"人民币汇率(create_time当日)"`
+	UnitName         string    `json:"unit_name" description:"单位名称"`
 }
 
 // GetInvoicePaymentCensusSummaryData 获取商品到款统计列表-汇总数据
 func GetInvoicePaymentCensusSummaryData(condition string, pars []interface{}) (results []*InvoicePaymentSummaryItem, err error) {
 	fields := []string{"a.id AS summary_id", "a.register_id", "a.invoice_id", "a.payment_id", "a.service_product_id", "b.company_name", "b.start_date", "b.end_date",
 		"c.origin_amount AS invoice_amount", "c.invoice_time AS invoice_date", "IF(c.seller_id > 0, c.seller_id, d.seller_id) AS seller_id", "IF(c.seller_name = '' OR c.seller_name IS NULL, d.seller_name, c.seller_name) AS seller_name", "IF(c.seller_group_id > 0,c.seller_group_id,d.seller_group_id) AS seller_group_id",
-		"IF(c.seller_group_name = '' OR c.seller_group_name IS NULL, d.seller_group_name, c.seller_group_name) AS seller_group_name", "d.origin_amount AS payment_amount", "d.invoice_time AS payment_date", "d.pay_type",
+		"IF(c.seller_group_name = '' OR c.seller_group_name IS NULL, d.seller_group_name, c.seller_group_name) AS seller_group_name", "d.origin_amount AS payment_amount", "d.invoice_time AS payment_date", "d.pay_type","b.currency_unit",
 	}
 	query := global.DEFAULT_MYSQL.Table("invoice_payment_summary AS a").
 		Select(strings.Join(fields, ",")).
@@ -246,7 +247,7 @@ func GetInvoiceCensusPageList(page base.IPage, condition string, pars []interfac
 func GetNoPaymentCensusPageList(page base.IPage, condition string, pars []interface{}) (results []*InvoiceSummary, count int64, err error) {
 	query := global.DEFAULT_MYSQL.Table("invoice_payment_summary AS a").
 		Select("b.*, a.id as summary_id, IF(a.invoice_id >0, 1,0) as sort_invoice_id, IF(a.payment_id >0, 1,0) as sort_payment_id, COALESCE(SUM( c.amount ),0) AS invoiced_amount_count,COALESCE(SUM( d.amount ),0) AS payment_amount_count "+
-			" ,c.invoice_time ","c.origin_amount AS summary_invoice_amount","d.origin_amount AS summary_payment_amount","a.invoice_id","a.payment_id").
+			" ,c.invoice_time ", "c.origin_amount AS summary_invoice_amount", "d.origin_amount AS summary_payment_amount", "a.invoice_id", "a.payment_id").
 		Joins("JOIN contract_register AS b ON a.register_id = b.contract_register_id AND b.is_deleted = 0").
 		Joins("LEFT JOIN contract_invoice AS c ON a.invoice_id = c.contract_invoice_id AND c.is_deleted = 0").
 		Joins("LEFT JOIN contract_invoice AS d ON a.payment_id = d.contract_invoice_id AND d.is_deleted = 0").
@@ -361,4 +362,4 @@ func GetInvoiceCensusList(condition string, pars []interface{}) (results []*Invo
 		return
 	}
 	return
-}
+}