zwxi 1 年之前
父节点
当前提交
c4b1981346
共有 2 个文件被更改,包括 14 次插入0 次删除
  1. 12 0
      controller/census/seller.go
  2. 2 0
      models/fms/contract_invoice.go

+ 12 - 0
controller/census/seller.go

@@ -302,6 +302,9 @@ func (ct *SellerController) InvoiceList(c *gin.Context) {
 		totalCond += ` AND group_id IN (?) `
 		totalPars = append(totalPars, groupIds)
 	}
+
+
+
 	sumCond := ` (invoice_type = ? OR invoice_type = ? ) AND a.is_deleted = 0 AND a.seller_id != 0 `
 	sumPars := make([]interface{}, 0)
 	sumPars = append(sumPars, fms.ContractInvoiceTypeMake, fms.ContractInvoiceTypePreMake)
@@ -309,6 +312,15 @@ func (ct *SellerController) InvoiceList(c *gin.Context) {
 	inCond := ` (invoice_type = %d OR invoice_type = %d) AND is_deleted = 0 AND seller_id != 0 `
 	cond = fmt.Sprintf(cond, fms.ContractInvoiceTypeMake, fms.ContractInvoiceTypePreMake)
 	inCond = fmt.Sprintf(inCond, fms.ContractInvoiceTypeMake, fms.ContractInvoiceTypePreMake)
+
+	if req.CompanyType == 1 {
+		cond += ` AND b.contract_type = 1 `
+		//historyCond += ` AND new_company = 1 `
+	} else if req.CompanyType == 2 {
+		cond += ` AND b.contract_type IN (2,3,4) `
+		//historyCond += ` AND new_company = 0 `
+	}
+
 	// 开票日期
 	if req.StartDate != "" && req.EndDate != "" {
 		st := fmt.Sprint(req.StartDate, " 00:00:00")

+ 2 - 0
models/fms/contract_invoice.go

@@ -451,6 +451,7 @@ type CensusSellerInvoiceListReq struct {
 	IsExport   int    `json:"is_export" form:"is_export" description:"是否导出: 0-否; 1-是"`
 	SellerType int    `json:"seller_type" form:"seller_type" description:"销售类型:1ficc销售,2权益销售"`
 	ShowResign bool   `json:"show_resign" form:"show_resign" description:"是否显示离职销售"`
+	CompanyType int    `json:"company_type" form:"company_type" description:"客户类型 0全部 1新客户 2老客户"`
 	base.PageReq
 }
 
@@ -767,6 +768,7 @@ func GetCensusSellerInvoicePageListV2(page base.IPage, adminStr, inCond, conditi
 				) AS group_rate,
 				SUM(c.amount) / %f AS seller_rate
 				FROM contract_invoice AS c 
+				INNER JOIN contract_register AS b ON c.contract_register_id = b.contract_register_id 
 				WHERE %s
 				AND c.seller_id IN (` + adminStr + `)
 				GROUP BY c.seller_id ORDER BY %s LIMIT %d,%d `