|
@@ -962,11 +962,11 @@ 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 || invoiceList[i].InvoiceType == fms.ContractInvoiceTypePreMake{
|
|
|
+ if invoiceList[i].InvoiceType == fms.ContractInvoiceTypeMake || invoiceList[i].InvoiceType == fms.ContractInvoiceTypePreMake {
|
|
|
result.InvoiceList = append(result.InvoiceList, invoiceList[i])
|
|
|
continue
|
|
|
}
|
|
|
- if invoiceList[i].InvoiceType == fms.ContractInvoiceTypePay || invoiceList[i].InvoiceType == fms.ContractInvoiceTypePrePay{
|
|
|
+ if invoiceList[i].InvoiceType == fms.ContractInvoiceTypePay || invoiceList[i].InvoiceType == fms.ContractInvoiceTypePrePay {
|
|
|
result.PaymentList = append(result.PaymentList, invoiceList[i])
|
|
|
}
|
|
|
}
|
|
@@ -1091,6 +1091,7 @@ func (rg *RegisterController) Invoice(c *gin.Context) {
|
|
|
|
|
|
noChangeInvoiceIds := make([]int, 0)
|
|
|
newInvoice := make([]*fms.ContractInvoice, 0)
|
|
|
+ sellerMap := make(map[int]*crm.SellerAdminWithGroupTeam)
|
|
|
if len(req.AmountList) > 0 {
|
|
|
// 合同有效时长(计算付款方式)
|
|
|
dayDiff := item.EndDate.Sub(item.StartDate).Hours() / 24
|
|
@@ -1101,7 +1102,6 @@ func (rg *RegisterController) Invoice(c *gin.Context) {
|
|
|
resp.FailData("获取销售失败", "Err:"+e.Error(), c)
|
|
|
return
|
|
|
}
|
|
|
- sellerMap := make(map[int]*crm.SellerAdminWithGroupTeam)
|
|
|
for i := range sellerList {
|
|
|
sellerMap[sellerList[i].SellerId] = sellerList[i]
|
|
|
}
|
|
@@ -1255,6 +1255,31 @@ func (rg *RegisterController) Invoice(c *gin.Context) {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
+ //如果是开票,强制修改到款记录的销售
|
|
|
+ if len(newInvoice) > 0 && req.InvoiceType == fms.ContractInvoiceTypeMake {
|
|
|
+ invoiceItem, err := fms.GetContractInvoiceByRegisterIdAndType(req.ContractRegisterId)
|
|
|
+ if err != nil {
|
|
|
+ resp.FailMsg("获取到款数据失败", "获取到款数据失败, Err: "+err.Error(), c)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ sellerItem := sellerMap[newInvoice[0].SellerId]
|
|
|
+ if sellerItem == nil {
|
|
|
+ resp.Fail("销售信息异常", c)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ invoiceItem.SellerId = sellerItem.SellerId
|
|
|
+ invoiceItem.SellerName = sellerItem.SellerName
|
|
|
+ invoiceItem.SellerGroupId = sellerItem.GroupId
|
|
|
+ invoiceItem.SellerGroupName = sellerItem.GroupName
|
|
|
+ invoiceItem.SellerTeamId = sellerItem.TeamId
|
|
|
+ invoiceItem.SellerTeamName = sellerItem.TeamName
|
|
|
+ e = invoiceItem.Update([]string{"SellerId","SellerName","SellerGroupId","SellerGroupName","SellerTeamId","SellerTeamName"})
|
|
|
+ if e != nil {
|
|
|
+ resp.FailMsg("更新到款销售失败", "更新到款销售失败, Err: "+e.Error(), c)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
// todo 判断是否符合均分金额的条件,如果符合,需要生成金额分配记录表
|
|
|
if req.InvoiceType == fms.ContractInvoiceTypePay {
|
|
|
err = fmsService.CalculatePaymentServiceAmount(req.ContractRegisterId)
|
|
@@ -1693,7 +1718,7 @@ func (rg *RegisterController) Export(c *gin.Context) {
|
|
|
row3Title := make([]string, 0)
|
|
|
row3TitleParent := make([]string, 0)
|
|
|
row3Title = append(row3Title, "客户名称", "新客户\n0-是\n1-否", "合同类型\n0-自付合同\n1-代付合同",
|
|
|
- "合同子类型\n续约-0\n新签-1\n补充协议-2", "合同所属方", "代付方" ,"关联主合同(补充协议)", "关联合同(代付合同)")
|
|
|
+ "合同子类型\n续约-0\n新签-1\n补充协议-2", "合同所属方", "代付方", "关联主合同(补充协议)", "关联合同(代付合同)")
|
|
|
if req.ListParam == 0 {
|
|
|
row3Title = append(row3Title, "FICC销售", "权益销售", "FICC大套餐")
|
|
|
for i := range permissionList {
|
|
@@ -1814,16 +1839,15 @@ func (rg *RegisterController) Export(c *gin.Context) {
|
|
|
dataRow.AddCell().SetString(v.ActualPayCompanies)
|
|
|
dataRow.AddCell().SetString(v.RelateContractMainCode)
|
|
|
dataRow.AddCell().SetString(v.RelateContractCode)
|
|
|
- if req.ListParam == 0{
|
|
|
+ if req.ListParam == 0 {
|
|
|
dataRow.AddCell().SetString(v.SellerName)
|
|
|
dataRow.AddCell().SetString(v.RaiSellerName)
|
|
|
- } else if req.ListParam == 1{
|
|
|
+ } else if req.ListParam == 1 {
|
|
|
dataRow.AddCell().SetString(v.SellerName)
|
|
|
} else {
|
|
|
dataRow.AddCell().SetString(v.RaiSellerName)
|
|
|
}
|
|
|
|
|
|
-
|
|
|
if req.ListParam != 0 {
|
|
|
k += 10
|
|
|
} else {
|
|
@@ -1890,13 +1914,13 @@ func (rg *RegisterController) Export(c *gin.Context) {
|
|
|
dataRow.AddCell().SetString(v.CurrencyUnit) // 货币单位
|
|
|
if ficcAmount != nil {
|
|
|
dataRow.AddCell().SetString(fmt.Sprint("¥", ficcAmount.ServiceAmount)) // FICC套餐总金额
|
|
|
- if raiAmount == nil{
|
|
|
- dataRow.AddCell().SetString("") // 权益套餐总金额
|
|
|
+ if raiAmount == nil {
|
|
|
+ dataRow.AddCell().SetString("") // 权益套餐总金额
|
|
|
}
|
|
|
}
|
|
|
if raiAmount != nil {
|
|
|
- if ficcAmount == nil{
|
|
|
- dataRow.AddCell().SetString("") // 权益套餐总金额
|
|
|
+ if ficcAmount == nil {
|
|
|
+ dataRow.AddCell().SetString("") // 权益套餐总金额
|
|
|
}
|
|
|
dataRow.AddCell().SetString(fmt.Sprint("¥", raiAmount.ServiceAmount)) // FICC套餐总金额
|
|
|
}
|
|
@@ -2383,6 +2407,7 @@ func (rg *RegisterController) Import(c *gin.Context) {
|
|
|
for _, sheet := range xlFile.Sheets {
|
|
|
// 遍历行读取
|
|
|
maxRow := sheet.MaxRow
|
|
|
+ fmt.Println("maxRow", maxRow)
|
|
|
for i := 0; i < maxRow; i++ {
|
|
|
// 第三行开始读取表头
|
|
|
if i == 2 {
|
|
@@ -2529,7 +2554,7 @@ func (rg *RegisterController) Import(c *gin.Context) {
|
|
|
continue
|
|
|
}
|
|
|
if k == 4 {
|
|
|
- if rowRegister.HasPayment == 1{
|
|
|
+ if rowRegister.HasPayment == 1 {
|
|
|
if v == "0" {
|
|
|
//所属方为实际使用方,不走开票到款流程
|
|
|
rowRegister.HasInvoice = 0
|
|
@@ -2835,11 +2860,7 @@ func (rg *RegisterController) Import(c *gin.Context) {
|
|
|
// FICC 套餐总金额
|
|
|
if k == 62 {
|
|
|
amountStr := v
|
|
|
- amount, e := strconv.ParseFloat(amountStr, 64)
|
|
|
- if e != nil {
|
|
|
- resp.Fail(fmt.Sprintf("第%d行FICC套餐总金额有误, 请按模板导入", i+1), c)
|
|
|
- return
|
|
|
- }
|
|
|
+ amount, _ := strconv.ParseFloat(amountStr, 64)
|
|
|
if amount > 0 {
|
|
|
tmp := &fms.ContractServiceAmount{
|
|
|
ProductId: crm.CompanyProductFicc,
|
|
@@ -2854,11 +2875,7 @@ func (rg *RegisterController) Import(c *gin.Context) {
|
|
|
// 权益套餐总金额
|
|
|
if k == 63 {
|
|
|
amountStr := v
|
|
|
- amount, e := strconv.ParseFloat(amountStr, 64)
|
|
|
- if e != nil {
|
|
|
- resp.Fail(fmt.Sprintf("第%d行权益套餐总金额有误, 请按模板导入", i+1), c)
|
|
|
- return
|
|
|
- }
|
|
|
+ amount, _ := strconv.ParseFloat(amountStr, 64)
|
|
|
if amount > 0 {
|
|
|
tmp := &fms.ContractServiceAmount{
|
|
|
ProductId: crm.CompanyProductRai,
|
|
@@ -3278,7 +3295,6 @@ func (rg *RegisterController) CheckContractName(c *gin.Context) {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
-
|
|
|
// CheckContract
|
|
|
// @Title 货币单位列表
|
|
|
// @Description 货币单位列表
|