|
@@ -463,7 +463,7 @@ func (rg *RegisterController) Add(c *gin.Context) {
|
|
|
}
|
|
|
}
|
|
|
for _, ppItem := range invoiceList {
|
|
|
- j,k := 0,0
|
|
|
+ j, k := 0, 0
|
|
|
v := &fms.ContractInvoice{
|
|
|
ContractRegisterId: ob.ContractRegisterId,
|
|
|
ContractCode: ob.ContractCode,
|
|
@@ -759,7 +759,7 @@ func (rg *RegisterController) Add(c *gin.Context) {
|
|
|
v.InvoiceType = 1
|
|
|
} else if ppItem.InvoiceType == 4 {
|
|
|
v.InvoiceType = 2
|
|
|
- if sellerItem, ok := sellerItemMap[j]; ok{
|
|
|
+ if sellerItem, ok := sellerItemMap[j]; ok {
|
|
|
v.SellerId = sellerItem.SellerId
|
|
|
v.SellerName = sellerItem.SellerName
|
|
|
v.SellerGroupId = sellerItem.GroupId
|
|
@@ -1441,6 +1441,40 @@ func (rg *RegisterController) Invoice(c *gin.Context) {
|
|
|
return
|
|
|
}
|
|
|
if req.AmountList[i].InvoiceId > 0 {
|
|
|
+ v := &fms.ContractInvoice{
|
|
|
+ ContractInvoiceId: req.AmountList[i].InvoiceId,
|
|
|
+ Amount: req.AmountList[i].Amount,
|
|
|
+ OriginAmount: req.AmountList[i].OriginAmount,
|
|
|
+ CurrencyUnit: item.CurrencyUnit,
|
|
|
+ ServiceProductId: req.AmountList[i].ServiceProductId,
|
|
|
+ InvoiceDate: t,
|
|
|
+ AdminId: int(adminInfo.AdminId),
|
|
|
+ AdminName: adminInfo.RealName,
|
|
|
+ Remark: req.AmountList[i].Remark,
|
|
|
+ }
|
|
|
+ v.Set()
|
|
|
+ sellerItem := sellerMap[req.AmountList[i].SellerId]
|
|
|
+ if sellerItem == nil {
|
|
|
+ resp.Fail("销售信息异常", c)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if req.AmountList[i].ServiceProductId == crm.CompanyProductRai && sellerItem.DepartmentId != crm.RaiSellerDepartmentId {
|
|
|
+ resp.Fail("销售类型和所选套餐类型不一致", c)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ v.SellerId = sellerItem.SellerId
|
|
|
+ v.SellerName = sellerItem.SellerName
|
|
|
+ v.SellerGroupId = sellerItem.GroupId
|
|
|
+ v.SellerGroupName = sellerItem.GroupName
|
|
|
+ v.SellerTeamId = sellerItem.TeamId
|
|
|
+ v.SellerTeamName = sellerItem.TeamName
|
|
|
+ v.PayType = fmsService.CalculateContractPaymentType(req.AmountList[i].Amount, item.ContractAmount, dayDiff)
|
|
|
+
|
|
|
+ if e = v.Update([]string{"Amount", "OriginAmount", "CurrencyUnit", "ServiceProductId", "InvoiceDate",
|
|
|
+ "AdminId", "AdminName", "Remark", "SellerId", "SellerName", "SellerGroupId", "SellerGroupName", "SellerTeamId", "SellerTeamName"}); e != nil {
|
|
|
+ resp.FailMsg("操作失败", "更新到款登记失败, Err:"+e.Error(), c)
|
|
|
+ return
|
|
|
+ }
|
|
|
noChangeInvoiceIds = append(noChangeInvoiceIds, req.AmountList[i].InvoiceId)
|
|
|
continue
|
|
|
}
|
|
@@ -3580,7 +3614,7 @@ func (rg *RegisterController) Import(c *gin.Context) {
|
|
|
v.InvoiceType = 1
|
|
|
} else if ppItem.InvoiceType == 4 {
|
|
|
v.InvoiceType = 2
|
|
|
- if sellerItem, ok := sellerItemMap[j]; ok{
|
|
|
+ if sellerItem, ok := sellerItemMap[j]; ok {
|
|
|
v.SellerId = sellerItem.SellerId
|
|
|
v.SellerName = sellerItem.SellerName
|
|
|
v.SellerGroupId = sellerItem.GroupId
|
|
@@ -3655,7 +3689,6 @@ func (rg *RegisterController) Import(c *gin.Context) {
|
|
|
go fmsService.CalculatePaymentServiceAmount(newId)
|
|
|
newIds = append(newIds, newId)
|
|
|
|
|
|
-
|
|
|
}
|
|
|
}
|
|
|
}
|