ziwen 1 year ago
parent
commit
b513aef0ff
1 changed files with 11 additions and 0 deletions
  1. 11 0
      controller/contract/register.go

+ 11 - 0
controller/contract/register.go

@@ -497,6 +497,7 @@ func (rg *RegisterController) Add(c *gin.Context) {
 					TeamName:   ppItem.SellerTeamName,
 				}
 				j++
+				ob.InvoicedAmount += ppItem.Amount
 			} else if ppItem.InvoiceType == 4 {
 				v.InvoiceType = 2
 				if sellerItem, ok := sellerItemMap[k]; ok {
@@ -508,6 +509,7 @@ func (rg *RegisterController) Add(c *gin.Context) {
 					v.SellerTeamName = sellerItem.TeamName
 				}
 				k++
+				ob.PaymentAmount += ppItem.Amount
 			}
 			v.Set()
 			// 到款登记-付款方式
@@ -577,6 +579,7 @@ func (rg *RegisterController) Add(c *gin.Context) {
 				}
 				if ppItem.InvoiceType == 3 {
 					v.InvoiceType = 1
+					ob.InvoicedAmount += ppItem.Amount
 				} else if ppItem.InvoiceType == 4 {
 					v.InvoiceType = 2
 					if sellerItem, ok := sellerItemMap[j]; ok {
@@ -588,6 +591,7 @@ func (rg *RegisterController) Add(c *gin.Context) {
 						v.SellerTeamName = sellerItem.TeamName
 					}
 					j++
+					ob.PaymentAmount += ppItem.Amount
 				}
 				v.Set()
 				// 到款登记-付款方式
@@ -757,6 +761,7 @@ func (rg *RegisterController) Add(c *gin.Context) {
 				}
 				if ppItem.InvoiceType == 3 {
 					v.InvoiceType = 1
+					ob.InvoicedAmount += ppItem.Amount
 				} else if ppItem.InvoiceType == 4 {
 					v.InvoiceType = 2
 					if sellerItem, ok := sellerItemMap[j]; ok{
@@ -769,6 +774,7 @@ func (rg *RegisterController) Add(c *gin.Context) {
 
 						j++
 					}
+					ob.PaymentAmount += ppItem.Amount
 				}
 				v.Set()
 				// 到款登记-付款方式
@@ -830,6 +836,11 @@ func (rg *RegisterController) Add(c *gin.Context) {
 				}
 			}
 		}
+		updateCols := []string{"InvoicedAmount", "PaymentAmount"}
+		if e = ob.Update(updateCols); e != nil {
+			resp.FailMsg("操作失败", "更新合同登记失败, Err:"+e.Error(), c)
+			return
+		}
 		// 操作日志
 		go func() {
 			logOB := new(fms.ContractRegisterLog)