|
@@ -584,9 +584,18 @@ func (ct *InvoicePaymentController) List(c *gin.Context) {
|
|
|
} else if req.StartDate != "" && req.EndDate != "" {
|
|
|
st := fmt.Sprint(req.StartDate, " 00:00:00")
|
|
|
ed := fmt.Sprint(req.EndDate, " 23:59:59")
|
|
|
- cond += ` AND ((a.invoice_id <> 0 AND c.invoice_time BETWEEN ? AND ?)`
|
|
|
- cond += `OR (a.payment_id <> 0 AND a.invoice_id = 0 AND d.invoice_time BETWEEN ? AND ?))`
|
|
|
- pars = append(pars, st, ed, st, ed)
|
|
|
+ if req.SellerIds != "" {
|
|
|
+ sellerIds := strings.Split(req.SellerIds, ",")
|
|
|
+ cond += ` AND (c.seller_id in ? OR d.seller_id in ?)`
|
|
|
+ pars = append(pars, sellerIds, sellerIds)
|
|
|
+ cond += ` AND ((c.seller_id in ? AND a.invoice_id <> 0 AND c.invoice_time BETWEEN ? AND ?)`
|
|
|
+ cond += `OR (d.seller_id in ? AND a.payment_id <> 0 AND a.invoice_id = 0 AND d.invoice_time BETWEEN ? AND ?))`
|
|
|
+ pars = append(pars, sellerIds, st, ed, sellerIds, st, ed)
|
|
|
+ } else {
|
|
|
+ cond += ` AND ((a.invoice_id <> 0 AND c.invoice_time BETWEEN ? AND ?)`
|
|
|
+ cond += `OR (a.payment_id <> 0 AND a.invoice_id = 0 AND d.invoice_time BETWEEN ? AND ?))`
|
|
|
+ pars = append(pars, st, ed, st, ed)
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
if req.HasInvoice == "1" {
|
|
@@ -1187,9 +1196,16 @@ func getCensusIncomeListV2(ch chan models.CensusIncomeChartResp, req fms.IncomeL
|
|
|
amountCond := `a.id IN ? `
|
|
|
amountPars := make([]interface{}, 0)
|
|
|
amountPars = append(amountPars, summaryIds)
|
|
|
- amountCond += ` AND ((a.invoice_id <> 0 AND b.invoice_time BETWEEN ? AND ?)`
|
|
|
- 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.SellerIds != "" {
|
|
|
+ sellerIds := strings.Split(req.SellerIds, ",")
|
|
|
+ amountCond += ` AND ((c.seller_id in ? AND a.invoice_id <> 0 AND c.invoice_time BETWEEN ? AND ?)`
|
|
|
+ amountCond += `OR (d.seller_id in ? AND a.payment_id <> 0 AND a.invoice_id = 0 AND d.invoice_time BETWEEN ? AND ?))`
|
|
|
+ amountPars = append(amountPars, sellerIds, st, ed, sellerIds, st, ed)
|
|
|
+ } else {
|
|
|
+ amountCond += ` AND ((a.invoice_id <> 0 AND b.invoice_time BETWEEN ? AND ?)`
|
|
|
+ amountCond += `OR (a.payment_id <> 0 AND a.invoice_id = 0 AND d.invoice_time BETWEEN ? AND ?))`
|
|
|
+ amountPars = append(amountPars, st, ed, st, ed)
|
|
|
+ }
|
|
|
results, e := fms.GetContractSummaryIncomeAmount(amountCond, amountPars)
|
|
|
if e != nil {
|
|
|
err = fmt.Errorf("获取汇总数据失败, Err: %s", e.Error())
|
|
@@ -1286,9 +1302,16 @@ func getCensusIncomeListV2(ch chan models.CensusIncomeChartResp, req fms.IncomeL
|
|
|
amountCond := `a.id IN ? `
|
|
|
amountPars := make([]interface{}, 0)
|
|
|
amountPars = append(amountPars, prevSummaryIds)
|
|
|
- amountCond += ` AND ((a.invoice_id <> 0 AND b.invoice_time BETWEEN ? AND ?)`
|
|
|
- amountCond += `OR (a.payment_id <> 0 AND a.invoice_id = 0 AND d.invoice_time BETWEEN ? AND ?))`
|
|
|
- amountPars = append(amountPars, prevSt, prevEd)
|
|
|
+ if req.SellerIds != "" {
|
|
|
+ sellerIds := strings.Split(req.SellerIds, ",")
|
|
|
+ amountCond += ` AND ((c.seller_id in ? AND a.invoice_id <> 0 AND c.invoice_time BETWEEN ? AND ?)`
|
|
|
+ amountCond += `OR (d.seller_id in ? AND a.payment_id <> 0 AND a.invoice_id = 0 AND d.invoice_time BETWEEN ? AND ?))`
|
|
|
+ amountPars = append(amountPars, sellerIds, prevSt, prevEd, sellerIds, prevSt, prevEd)
|
|
|
+ } else {
|
|
|
+ amountCond += ` AND ((a.invoice_id <> 0 AND b.invoice_time BETWEEN ? AND ?)`
|
|
|
+ amountCond += `OR (a.payment_id <> 0 AND a.invoice_id = 0 AND d.invoice_time BETWEEN ? AND ?))`
|
|
|
+ amountPars = append(amountPars, prevSt, prevEd)
|
|
|
+ }
|
|
|
results, e := fms.GetContractSummaryIncomeAmount(amountCond, amountPars)
|
|
|
if e != nil {
|
|
|
err = fmt.Errorf("获取汇总数据失败, Err: %s", e.Error())
|