ziwen 2 年之前
父节点
当前提交
8f4dbb73bb

+ 1 - 0
controller/census/invoice_payment.go

@@ -810,6 +810,7 @@ func (ct *InvoicePaymentController) List(c *gin.Context) {
 				v.EndDate = utils.TimeTransferString(utils.FormatDate, registerList[i].EndDate)
 				v.ServicesName = servicesNameMap[registerList[i].ContractRegisterId]
 				v.InvoicePaymentList = summaryMap[registerList[i].SummaryId]
+				v.ContractType = registerList[i].ContractType
 				respList = append(respList, v)
 			}
 		}()

+ 1 - 1
controller/contract/pre_register.go

@@ -388,7 +388,6 @@ func (rg *PreRegisterController) Edit(c *gin.Context) {
 	if len(req.List) > 0 {
 		currencyUnit = req.List[0].CurrencyUnit
 	}
-
 	// 获取销售分组信息
 	sellerList, e := crmService.GetSellerDepartmentListWithGroupAndTeam()
 	if e != nil {
@@ -932,6 +931,7 @@ func (rg *PreRegisterController) Save(c *gin.Context) {
 	ob.StartDate = startDate
 	ob.EndDate = endDate
 	ob.ModifyTime = time.Now()
+	ob.CurrencyUnit = req.List[0].CurrencyUnit
 	if req.RegisterType == fms.ContractInvoiceTypePreMake {
 		//sellerItem := sellerMap[r.SellerId]
 		//if sellerItem == nil {

+ 14 - 10
controller/contract/register.go

@@ -962,11 +962,13 @@ func (rg *RegisterController) Detail(c *gin.Context) {
 	result.InvoiceList = make([]*fms.ContractInvoiceItem, 0)
 	result.PaymentList = make([]*fms.ContractInvoiceItem, 0)
 	for i := range invoiceList {
-		if invoiceList[i].InvoiceType == fms.ContractInvoiceTypeMake {
+		if invoiceList[i].InvoiceType == fms.ContractInvoiceTypeMake  || invoiceList[i].InvoiceType == fms.ContractInvoiceTypePreMake{
+			invoiceList[i].InvoiceType = 1
 			result.InvoiceList = append(result.InvoiceList, invoiceList[i])
 			continue
 		}
-		if invoiceList[i].InvoiceType == fms.ContractInvoiceTypePay {
+		if invoiceList[i].InvoiceType == fms.ContractInvoiceTypePay || invoiceList[i].InvoiceType == fms.ContractInvoiceTypePrePay{
+			invoiceList[i].InvoiceType = 2
 			result.PaymentList = append(result.PaymentList, invoiceList[i])
 		}
 	}
@@ -2302,15 +2304,15 @@ func (rg *RegisterController) Import(c *gin.Context) {
 
 	//权益行业套餐名称
 	raiIndustryMap := map[int]string{
-		40: "医药",
-		41: "医药",
-		42: "消费",
-		43: "消费",
-		44: "科技",
-		45: "科技",
-		46: "智造",
+		42: "医药",
+		43: "医药",
+		44: "消费",
+		45: "消费",
+		46: "科技",
+		47: "科技",
 		48: "智造",
-		49: "策略",
+		49: "智造",
+		50: "策略",
 	}
 
 	// 获取货币列表及汇率(汇率为导入日的汇率)
@@ -2631,6 +2633,8 @@ func (rg *RegisterController) Import(c *gin.Context) {
 								rootName := "行业套餐"
 								// 新增三条套餐信息
 								parentName, _ := raiIndustryMap[k]
+								fmt.Println("raiIndustryMap:", raiIndustryMap)
+								fmt.Println("titleMap:", titleMap)
 								childName := titleMap[k]
 								fullName := childName + "_" + parentName + "_" + rootName
 								if fullName != "" {

+ 1 - 0
models/fms/contract_invoice.go

@@ -344,6 +344,7 @@ type InvoicePaymentCensusItem struct {
 	StartDate          string                      `json:"start_date" description:"合同开始日期"`
 	EndDate            string                      `json:"end_date" description:"合同结束日期"`
 	ServicesName       string                      `json:"services_name" description:"套餐信息字符串拼接"`
+	ContractType       int                         `json:"contract_type" description:"合同类型: 0-无 1-新签; 2-续约"`
 	InvoicePaymentList []*InvoicePaymentCensusInfo `json:"invoice_payment_list" description:"开票到款列表"`
 }
 

+ 19 - 2
models/fms/contract_register.go

@@ -721,9 +721,8 @@ func UpdateContractRegisterPre(item *ContractRegister, updateCols []string, serv
 		StartDate:          item.StartDate,
 		EndDate:            item.EndDate,
 		CurrencyUnit:       item.CurrencyUnit,
-		ServiceProductId:   productId,
 	}
-	tx.Model(&invoiceItem).Select([]string{"StartDate", "EndDate", "CurrencyUnit"}).Where("ContractRegisterId", item.ContractRegisterId).Updates(invoiceItem)
+	tx.Model(&invoiceItem).Select([]string{"StartDate", "EndDate", "CurrencyUnit"}).Where("contract_register_id", item.ContractRegisterId).Updates(invoiceItem)
 
 	// 开票到款操作类型: 0-无; 1-更新; 2-新增;
 	if invoiceHandleType == 2 {
@@ -759,6 +758,24 @@ func UpdateContractRegisterPre(item *ContractRegister, updateCols []string, serv
 			}
 		}
 	}
+
+	pp := &ContractPreRegister{}
+	ppItem, e := pp.Fetch(ppList[0].PreRegisterId)
+	if e != nil {
+		err = e
+	}
+	//更新同一预登记记录下的productid
+	otherInvoiceItem := ContractInvoice{
+		ServiceProductId: productId,
+	}
+	if ppList[0].InvoiceType == 3 {
+		otherInvoiceItem.ContractInvoiceId = ppItem.ArriveId
+	} else {
+		otherInvoiceItem.ContractInvoiceId = ppItem.InvoiceId
+	}
+
+	tx.Model(&otherInvoiceItem).Select([]string{"ServiceProductId"}).Where("contract_invoice_id", otherInvoiceItem.ContractInvoiceId).Updates(otherInvoiceItem)
+
 	return
 }