浏览代码

开票搜索

xiziwen 3 月之前
父节点
当前提交
c1324cec28
共有 2 个文件被更改,包括 33 次插入5 次删除
  1. 32 0
      controller/census/income_list.go
  2. 1 5
      models/fms/contract_income_history.go

+ 32 - 0
controller/census/income_list.go

@@ -1377,6 +1377,11 @@ func getCensusIncomeList(ch chan base.BaseData, req fms.IncomeListReq) (baseData
 					page.AddOrderItem(base.OrderItem{Column: "invoice_time", Asc: false})
 				}
 
+				if req.Keyword != "" {
+					cond += ` AND company_name LIKE ?`
+					pars = append(pars, "%"+req.Keyword+"%")
+				}
+
 				results, total, e := fms.GetIncomeHistoryPage(histrtyCond, historyPars, page)
 				if e != nil {
 					err = fmt.Errorf("获取汇总数据失败, Err: %s", e.Error())
@@ -1446,6 +1451,11 @@ func getCensusIncomeList(ch chan base.BaseData, req fms.IncomeListReq) (baseData
 						page.AddOrderItem(base.OrderItem{Column: "d.invoice_time", Asc: false})
 					}
 
+					if req.Keyword != "" {
+						cond += ` AND c.company_name LIKE ?`
+						pars = append(pars, "%"+req.Keyword+"%")
+					}
+
 					results, total, e := fms.GetContractSummaryPaymentIncomeAmountPage(amountCond, amountPars, page)
 					if e != nil {
 						err = fmt.Errorf("获取汇总数据失败, Err: %s", e.Error())
@@ -1492,6 +1502,11 @@ func getCensusIncomeList(ch chan base.BaseData, req fms.IncomeListReq) (baseData
 				histrtyCond += ` AND (invoice_time BETWEEN ? AND ? )`
 				historyPars = append(historyPars, st, ed)
 
+				if req.Keyword != "" {
+					cond += ` AND company_name LIKE ?`
+					pars = append(pars, "%"+req.Keyword+"%")
+				}
+
 				results, e := fms.GetIncomeHistory(histrtyCond, historyPars)
 				if e != nil {
 					err = fmt.Errorf("获取汇总数据失败, Err: %s", e.Error())
@@ -1521,6 +1536,12 @@ func getCensusIncomeList(ch chan base.BaseData, req fms.IncomeListReq) (baseData
 						amountCond += `OR (a.payment_id <> 0 AND a.invoice_id = 0 AND d.invoice_time BETWEEN ? AND ?)`
 						amountPars = append(amountPars, st, ed, st, ed)
 					}
+
+					if req.Keyword != "" {
+						cond += ` AND c.company_name LIKE ?`
+						pars = append(pars, "%"+req.Keyword+"%")
+					}
+
 					results, e := fms.GetContractSummaryIncomeAmount(amountCond, amountPars)
 					if e != nil {
 						err = fmt.Errorf("获取汇总数据失败, Err: %s", e.Error())
@@ -1572,6 +1593,11 @@ func getCensusIncomeList(ch chan base.BaseData, req fms.IncomeListReq) (baseData
 			resultList := make(fms.IncomeSummaryItemList, 0)
 			//旧查询
 
+			if req.Keyword != "" {
+				cond += ` AND company_name LIKE ?`
+				pars = append(pars, "%"+req.Keyword+"%")
+			}
+
 			results, e := fms.GetIncomeHistory(histrtyCond, historyPars)
 			if e != nil {
 				err = fmt.Errorf("获取汇总数据失败, Err: %s", e.Error())
@@ -1603,6 +1629,12 @@ func getCensusIncomeList(ch chan base.BaseData, req fms.IncomeListReq) (baseData
 					amountCond += `OR (a.payment_id <> 0 AND a.invoice_id = 0 AND d.invoice_time > ?))`
 					amountPars = append(amountPars, st, st)
 				}
+
+				if req.Keyword != "" {
+					cond += ` AND c.company_name LIKE ?`
+					pars = append(pars, "%"+req.Keyword+"%")
+				}
+
 				results, e := fms.GetContractSummaryIncomeAmount(amountCond, amountPars)
 				if e != nil {
 					err = fmt.Errorf("获取汇总数据失败, Err: %s", e.Error())

+ 1 - 5
models/fms/contract_income_history.go

@@ -66,12 +66,8 @@ FROM
 
 // GetIncomeHistoryPage
 func GetIncomeHistoryPage(condition string, pars []interface{}, page *base.Page) (results []*IncomeSummaryItem, count int64, err error) {
-	sql := `SELECT amount,seller_name,new_company AS contract_type,company_name,invoice_time AS invoice_date,
-	seller_id as final_seller_id,group_id AS seller_group_id,'CNY' AS currency_unit FROM contract_income_history WHERE  `
-	sql += condition
-
 	query := global.DEFAULT_MYSQL.Table("contract_income_history").
-		Select("amount,seller_name,new_company AS contract_type,company_name,"+
+		Select("amount,amount AS origin_amount, seller_name,new_company AS contract_type,company_name,"+
 			"invoice_time AS invoice_date, seller_id as final_seller_id,group_id AS seller_group_id,"+
 			"'CNY' AS currency_unit").Where(condition, pars...)
 	if len(page.GetOrderItemsString()) > 0 {