Bläddra i källkod

到款登记列表修改

xiexiaoyuan 2 år sedan
förälder
incheckning
27f4864409

+ 7 - 5
controller/census/invoice_payment.go

@@ -452,12 +452,13 @@ func (ct *InvoicePaymentController) List(c *gin.Context) {
 	// 客户姓名/销售
 	if req.Keyword != "" {
 		kw := "%" + req.Keyword + "%"
-		cond += ` AND b.company_name LIKE ? OR c.seller_name LIKE ?`
-		pars = append(pars, kw, kw)
+		cond += ` AND b.company_name LIKE ?`
+		pars = append(pars, kw)
 	}
-	if req.SellGroupId > 0 {
-		cond += ` AND c.seller_group_id = ?`
-		pars = append(pars, req.SellGroupId)
+	if req.SellerIds != "" {
+		sellerIds := strings.Split(req.SellerIds, ",")
+		cond += ` AND (c.seller_id in ?)`
+		pars = append(pars, sellerIds)
 	}
 	// 套餐筛选
 	if req.ServiceTypes != "" {
@@ -615,6 +616,7 @@ func (ct *InvoicePaymentController) List(c *gin.Context) {
 				v.SellerName = summaryList[i].SellerName
 				v.SellerGroupId = summaryList[i].SellerGroupId
 				v.SellerGroupName = summaryList[i].SellerGroupName
+				v.SellerType = summaryList[i].ServiceProductId
 				v.PaymentId = summaryList[i].PaymentId
 				v.PaymentDate = utils.TimeTransferString(utils.FormatDate, summaryList[i].PaymentDate)
 				v.PaymentAmount = summaryList[i].PaymentAmount

+ 16 - 1
controller/contract/register.go

@@ -843,6 +843,14 @@ func (rg *RegisterController) Invoice(c *gin.Context) {
 						resp.Fail("销售信息异常", c)
 						return
 					}
+					if req.AmountList[i].ServiceProductId == crm.CompanyProductFicc && sellerItem.DepartmentId != crm.SellerDepartmentId {
+						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
@@ -1523,10 +1531,11 @@ func (rg *RegisterController) InvoiceList(c *gin.Context) {
 		pars = append(pars, kw)
 		// 开票列表同时模糊查询销售名称
 		if req.InvoiceType == fms.ContractInvoiceTypeMake {
-			cond += ` AND (contract_code LIKE ? OR seller_name LIKE ?)`
+			cond += ` AND (contract_code LIKE ? )`
 			pars = append(pars, kw)
 		} else {
 			cond += ` AND contract_code LIKE ?`
+			pars = append(pars, kw)
 		}
 	}
 	if req.StartDate != "" && req.EndDate != "" {
@@ -1544,6 +1553,12 @@ func (rg *RegisterController) InvoiceList(c *gin.Context) {
 		pars = append(pars, req.MaxAmount)
 	}
 
+	// 套餐类型
+	if req.ServiceProductId > 0 {
+		cond += ` AND service_product_id = ?`
+		pars = append(pars, req.ServiceProductId)
+	}
+
 	// 货币列表
 	currencyOB := new(fms.CurrencyUnit)
 	currencyCond := `enable = 1`

+ 7 - 6
models/crm/company_seller.go

@@ -29,12 +29,13 @@ func GetCompanySellerByRoleCodes(condition string, pars []interface{}) (results
 
 // SellerAdminWithGroupTeam 系统销售(包含大小分组)
 type SellerAdminWithGroupTeam struct {
-	SellerId   int    `json:"seller_id" description:"销售ID"`
-	SellerName string `json:"seller_name" description:"销售名称"`
-	GroupId    int    `json:"group_id" description:"分组ID"`
-	GroupName  string `json:"group_name" description:"分组名称"`
-	TeamId     int    `json:"team_id" description:"小组ID"`
-	TeamName   string `json:"team_name" description:"小组名称"`
+	SellerId     int    `json:"seller_id" description:"销售ID"`
+	SellerName   string `json:"seller_name" description:"销售名称"`
+	GroupId      int    `json:"group_id" description:"分组ID"`
+	GroupName    string `json:"group_name" description:"分组名称"`
+	TeamId       int    `json:"team_id" description:"小组ID"`
+	TeamName     string `json:"team_name" description:"小组名称"`
+	DepartmentId int    `json:"department_id" description:"部分ID"`
 }
 
 // SellerAdminWithGroupList 系统销售(包含大分组)

+ 12 - 9
models/fms/contract_invoice.go

@@ -202,13 +202,14 @@ func formatContractInvoice2ItemList(list []*ContractInvoice) (itemList []*Contra
 
 // ContractInvoiceListReq 合同开票/到款登记列表请求体
 type ContractInvoiceListReq struct {
-	InvoiceType  int     `json:"invoice_type" form:"invoice_type" binding:"oneof=1 2" description:"类型: 1-开票登记; 2-到款登记"`
-	ContractCode string  `json:"contract_code" form:"contract_code" binding:"omitempty" description:"合同编号"`
-	StartDate    string  `json:"start_date" form:"start_date" binding:"omitempty,datetime=2006-01-02" description:"开始日期"`
-	EndDate      string  `json:"end_date" form:"end_date" binding:"omitempty,datetime=2006-01-02" description:"结束日期"`
-	MinAmount    float64 `json:"min_amount" form:"min_amount" description:"开票金额区间-最小值"`
-	MaxAmount    float64 `json:"max_amount" form:"max_amount" description:"开票金额区间-最大值"`
-	IsExport     int     `json:"is_export" form:"is_export" description:"是否导出: 0-否; 1-是"`
+	InvoiceType      int     `json:"invoice_type" form:"invoice_type" binding:"oneof=1 2" description:"类型: 1-开票登记; 2-到款登记"`
+	ContractCode     string  `json:"contract_code" form:"contract_code" binding:"omitempty" description:"合同编号"`
+	StartDate        string  `json:"start_date" form:"start_date" binding:"omitempty,datetime=2006-01-02" description:"开始日期"`
+	EndDate          string  `json:"end_date" form:"end_date" binding:"omitempty,datetime=2006-01-02" description:"结束日期"`
+	MinAmount        float64 `json:"min_amount" form:"min_amount" description:"开票金额区间-最小值"`
+	MaxAmount        float64 `json:"max_amount" form:"max_amount" description:"开票金额区间-最大值"`
+	IsExport         int     `json:"is_export" form:"is_export" description:"是否导出: 0-否; 1-是"`
+	ServiceProductId int     `json:"service_product_id" form:"service_product_id" description:"套餐类型:1ficc套餐,2权益套餐"`
 	base.PageReq
 }
 
@@ -260,8 +261,9 @@ func DeleteContractInvoicesByRegisterId(registerId int) (err error) {
 
 // InvoicePaymentCensusListReq 商品到款统计列表请求体
 type InvoicePaymentCensusListReq struct {
-	Keyword      string `json:"keyword" form:"keyword" binding:"omitempty" description:"关键词"`
-	SellGroupId  int    `json:"sell_group_id" form:"sell_group_id" description:"销售组别ID"`
+	Keyword string `json:"keyword" form:"keyword" binding:"omitempty" description:"关键词"`
+	//SellGroupId  int    `json:"sell_group_id" form:"sell_group_id" description:"销售组别ID"`
+	SellerIds    string `json:"seller_ids" form:"seller_ids" description:"销售ID,多个ID之间用逗号拼接"`
 	ServiceTypes string `json:"service_types" form:"service_types" description:"套餐类型"`
 	StartDate    string `json:"start_date" form:"start_date" binding:"omitempty,datetime=2006-01-02" description:"开始日期"`
 	EndDate      string `json:"end_date" form:"end_date" binding:"omitempty,datetime=2006-01-02" description:"结束日期"`
@@ -332,6 +334,7 @@ type InvoicePaymentCensusInfo struct {
 	PaymentAmount     float64                             `json:"payment_amount" description:"到款金额"`
 	PayType           int                                 `json:"pay_type" description:"付款方式:0-无;1-年付;2-半年付;3-季付;4-次付;5-异常"`
 	ServiceAmountList []*ContractPaymentServiceAmountItem `json:"service_amount_list" description:"到款套餐金额分配信息"`
+	SellerType        int                                 `json:"seller_type" description:"销售类型:1ficc销售,2权益销售"`
 }
 
 // ContractInvoiceAmountTotal 开票到款金额合计信息

+ 19 - 18
models/fms/invoice_payment_summary.go

@@ -72,28 +72,29 @@ func GetInvoicePaymentCensusPageList(page base.IPage, condition string, pars []i
 }
 
 type InvoicePaymentSummaryItem struct {
-	SummaryId       int       `json:"summary_id" description:"汇总ID"`
-	RegisterId      int       `json:"register_id" description:"登记ID"`
-	CompanyName     string    `json:"company_name" description:"客户名称"`
-	NewCompany      int       `json:"new_company" description:"是否为新客户: 0-否; 1-是"`
-	StartDate       time.Time `json:"start_date" description:"合同开始日期"`
-	EndDate         time.Time `json:"end_date" description:"合同结束日期"`
-	InvoiceId       int       `json:"invoice_id" description:"开票ID"`
-	InvoiceDate     time.Time `json:"invoice_time" description:"开票日期"`
-	InvoiceAmount   float64   `json:"invoice_amount" description:"开票金额"`
-	SellerId        int       `json:"seller_id" description:"销售ID"`
-	SellerName      string    `json:"seller_name" description:"销售名称"`
-	SellerGroupId   int       `json:"seller_group_id" description:"销售组别ID"`
-	SellerGroupName string    `json:"seller_group_name" description:"销售组别名称"`
-	PaymentId       int       `json:"payment_id" description:"到款ID"`
-	PaymentDate     time.Time `json:"payment_date" description:"到款日期"`
-	PaymentAmount   float64   `json:"payment_amount" description:"到款金额"`
-	PayType         int       `json:"pay_type" description:"付款方式:0-无;1-年付;2-半年付;3-季付;4-次付;5-异常"`
+	SummaryId        int       `json:"summary_id" description:"汇总ID"`
+	RegisterId       int       `json:"register_id" description:"登记ID"`
+	CompanyName      string    `json:"company_name" description:"客户名称"`
+	NewCompany       int       `json:"new_company" description:"是否为新客户: 0-否; 1-是"`
+	StartDate        time.Time `json:"start_date" description:"合同开始日期"`
+	EndDate          time.Time `json:"end_date" description:"合同结束日期"`
+	InvoiceId        int       `json:"invoice_id" description:"开票ID"`
+	InvoiceDate      time.Time `json:"invoice_time" description:"开票日期"`
+	InvoiceAmount    float64   `json:"invoice_amount" description:"开票金额"`
+	SellerId         int       `json:"seller_id" description:"销售ID"`
+	SellerName       string    `json:"seller_name" description:"销售名称"`
+	SellerGroupId    int       `json:"seller_group_id" description:"销售组别ID"`
+	SellerGroupName  string    `json:"seller_group_name" description:"销售组别名称"`
+	PaymentId        int       `json:"payment_id" description:"到款ID"`
+	PaymentDate      time.Time `json:"payment_date" description:"到款日期"`
+	PaymentAmount    float64   `json:"payment_amount" description:"到款金额"`
+	PayType          int       `json:"pay_type" description:"付款方式:0-无;1-年付;2-半年付;3-季付;4-次付;5-异常"`
+	ServiceProductId int       `json:"service_product_id" description:"套餐类型:1ficc套餐,2权益套餐"`
 }
 
 // GetInvoicePaymentCensusSummaryData 获取商品到款统计列表-汇总数据
 func GetInvoicePaymentCensusSummaryData(condition string, pars []interface{}) (results []*InvoicePaymentSummaryItem, err error) {
-	fields := []string{"a.id AS summary_id", "a.register_id", "a.invoice_id", "a.payment_id", "b.company_name", "b.start_date", "b.end_date",
+	fields := []string{"a.id AS summary_id", "a.register_id", "a.invoice_id", "a.payment_id", "a.service_product_id", "b.company_name", "b.start_date", "b.end_date",
 		"c.origin_amount AS invoice_amount", "c.invoice_time AS invoice_date", "c.seller_id", "c.seller_name", "c.seller_group_id",
 		"c.seller_group_name", "d.origin_amount AS payment_amount", "d.invoice_time AS payment_date", "d.pay_type",
 	}

+ 1 - 0
services/crm/company_seller.go

@@ -38,6 +38,7 @@ func GetSellerDepartmentListWithGroupAndTeam() (sellerList []*crm.SellerAdminWit
 	// 销售列表
 	for i := range adminList {
 		v := new(crm.SellerAdminWithGroupTeam)
+		v.DepartmentId = adminList[i].DepartmentId
 		v.SellerId = adminList[i].AdminId
 		v.SellerName = adminList[i].RealName
 		g := groupMap[adminList[i].GroupId]