ziwen 2 years ago
parent
commit
dfcff0209a

+ 2 - 1
controller/contract/pre_register.go

@@ -187,6 +187,7 @@ func (rg *PreRegisterController) Add(c *gin.Context) {
 	ob.ProductIds = req.ProductIds
 	ob.StartDate = startDate
 	ob.EndDate = endDate
+	ob.HasInvoice = 1
 	ob.Set()
 	ob.CurrencyUnit = currencyUnit
 	if req.RegisterType == fms.ContractInvoiceTypePreMake {
@@ -562,7 +563,7 @@ func (rg *PreRegisterController) Edit(c *gin.Context) {
 			//到款
 			pp.ArriveRemark = r.Remark
 			pp.ArriveDate = registerDate
-			pp.ArriveId = v.ContractRegisterId
+			pp.ArriveId = v.ContractInvoiceId
 			pp.ArriveOriginAmount = r.Amount
 			a, _ := strconv.ParseFloat(fmt.Sprintf("%.2f", pp.ArriveOriginAmount/rate), 64)
 			pp.ArriveAmount = a

+ 1 - 3
controller/contract/register.go

@@ -54,7 +54,7 @@ func (rg *RegisterController) List(c *gin.Context) {
 
 	cond := `1 = 1`
 	pars := make([]interface{}, 0)
-	// 合同编号/客户姓名/销售/实际使用
+	// 合同编号/客户姓名/销售/代付
 	if req.Keyword != "" {
 		kw := "%" + req.Keyword + "%"
 		cond += ` AND (company_name LIKE ? OR contract_code LIKE ? OR seller_name LIKE ? OR rai_seller_name LIKE ? OR actual_company_name LIKE ?)`
@@ -963,12 +963,10 @@ func (rg *RegisterController) Detail(c *gin.Context) {
 	result.PaymentList = make([]*fms.ContractInvoiceItem, 0)
 	for i := range invoiceList {
 		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 || invoiceList[i].InvoiceType == fms.ContractInvoiceTypePrePay{
-			invoiceList[i].InvoiceType = 2
 			result.PaymentList = append(result.PaymentList, invoiceList[i])
 		}
 	}

+ 1 - 1
models/fms/contract_register.go

@@ -774,7 +774,7 @@ func UpdateContractRegisterPre(item *ContractRegister, updateCols []string, serv
 		otherInvoiceItem.ContractInvoiceId = ppItem.InvoiceId
 	}
 
-	tx.Model(&otherInvoiceItem).Select([]string{"ServiceProductId"}).Where("contract_invoice_id", otherInvoiceItem.ContractInvoiceId).Updates(otherInvoiceItem)
+	tx.Model(&otherInvoiceItem).Select([]string{"ServiceProductId"}).Updates(otherInvoiceItem)
 
 	return
 }