|
@@ -898,12 +898,6 @@ func (this *SellerController) GroupInvoiceListV2(c *gin.Context) {
|
|
|
resp.FailData("参数解析失败", err.Translate(global.Trans), c)
|
|
|
return
|
|
|
}
|
|
|
- //收入统计
|
|
|
- //获取最新的开票到款日期
|
|
|
- cond1 := ``
|
|
|
- historyCond := ``
|
|
|
- //pars1 := make([]interface{}, 0)
|
|
|
- //historyPars1 := make([]interface{}, 0)
|
|
|
|
|
|
//if req.SellerIds != "" {
|
|
|
// sellerIds := strings.Split(req.SellerIds, ",")
|
|
@@ -912,25 +906,11 @@ func (this *SellerController) GroupInvoiceListV2(c *gin.Context) {
|
|
|
// pars = append(pars, sellerIds)
|
|
|
// historyPars = append(historyPars, sellerIds)
|
|
|
//}
|
|
|
- if req.CompanyType == 1 {
|
|
|
- cond1 += ` AND b.contract_type = 1 `
|
|
|
- historyCond += ` AND new_company = 1 `
|
|
|
- } else if req.CompanyType == 2 {
|
|
|
- cond1 += ` AND b.contract_type IN (2,3,4) `
|
|
|
- historyCond += ` AND new_company = 0 `
|
|
|
- }
|
|
|
+
|
|
|
|
|
|
var totalMoneySlice []float64
|
|
|
- var reqStartDate, reqEndDate time.Time
|
|
|
historyTime, _ := time.Parse(utils.FormatDate, "2023-04-01")
|
|
|
|
|
|
- if req.StartDate != "" && req.EndDate != "" {
|
|
|
- st := fmt.Sprint(req.StartDate, "-01 00:00:00")
|
|
|
- ed := fmt.Sprint(req.EndDate, "-01 23:59:59")
|
|
|
- reqStartDate, _ = time.Parse(utils.FormatDateTime, st)
|
|
|
- reqEndDate, _ = time.Parse(utils.FormatDateTime, ed)
|
|
|
- }
|
|
|
-
|
|
|
// 累计值
|
|
|
var accumulate float64
|
|
|
//dataList := make([]*fms.IncomeSummaryItem, 0)
|
|
@@ -938,34 +918,29 @@ func (this *SellerController) GroupInvoiceListV2(c *gin.Context) {
|
|
|
|
|
|
//timeNow, _ := time.Parse("2006-01", time.Now().Format("2006-01"))
|
|
|
|
|
|
- var prevStartDate string
|
|
|
var startDate, endDate string
|
|
|
+
|
|
|
//开始日期
|
|
|
if req.StartDate != "" && req.EndDate != "" {
|
|
|
- startDate = reqStartDate.Format("2006-01")
|
|
|
- prevStartDate = reqStartDate.Format("2006-01")
|
|
|
+ startDate = fmt.Sprint(req.StartDate, " 00:00:00")
|
|
|
+ endDate = fmt.Sprint(req.EndDate, " 23:59:59")
|
|
|
}
|
|
|
- startDate = fmt.Sprint(startDate, "-01")
|
|
|
- prevStartDate = fmt.Sprint(prevStartDate, "-01")
|
|
|
startDateTime, _ := time.Parse(utils.FormatDate, startDate)
|
|
|
endDateTime, _ := time.Parse(utils.FormatDate, endDate)
|
|
|
|
|
|
- //结束日期
|
|
|
- if req.StartDate != "" && req.EndDate != "" {
|
|
|
- endDate = reqEndDate.Format("2006-01")
|
|
|
- }
|
|
|
+
|
|
|
|
|
|
cond := `1 = 1`
|
|
|
- histrtyCond := `1 = 1`
|
|
|
+ histortyCond := `1 = 1`
|
|
|
pars := make([]interface{}, 0)
|
|
|
historyPars := make([]interface{}, 0)
|
|
|
|
|
|
if req.CompanyType == 1 {
|
|
|
cond += ` AND b.contract_type = 1 `
|
|
|
- histrtyCond += ` AND new_company = 1 `
|
|
|
+ histortyCond += ` AND new_company = 1 `
|
|
|
} else if req.CompanyType == 2 {
|
|
|
cond += ` AND b.contract_type IN (2,3,4) `
|
|
|
- histrtyCond += ` AND new_company = 0 `
|
|
|
+ histortyCond += ` AND new_company = 0 `
|
|
|
}
|
|
|
|
|
|
//if req.SellerIds != "" {
|
|
@@ -1027,7 +1002,7 @@ func (this *SellerController) GroupInvoiceListV2(c *gin.Context) {
|
|
|
accumulate += amountTotal
|
|
|
|
|
|
//var amountTotal float64
|
|
|
- results, e = fms.GetIncomeHistory(histrtyCond, historyPars)
|
|
|
+ results, e = fms.GetIncomeHistory(histortyCond, historyPars)
|
|
|
if e != nil {
|
|
|
resp.FailMsg("查询错误", fmt.Sprintf("获取汇总数据失败, Err: %s", e.Error()), c)
|
|
|
return
|
|
@@ -1098,14 +1073,14 @@ func (this *SellerController) GroupInvoiceListV2(c *gin.Context) {
|
|
|
//fmt.Println("st:",st)
|
|
|
//fmt.Println("ed:",ed)
|
|
|
if st != "" && ed != "" {
|
|
|
- histrtyCond += ` AND (invoice_time BETWEEN ? AND ? )`
|
|
|
+ histortyCond += ` AND (invoice_time BETWEEN ? AND ? )`
|
|
|
historyPars = append(historyPars, st, ed)
|
|
|
}
|
|
|
//fmt.Println("st:",st)
|
|
|
//fmt.Println("ed:",ed)
|
|
|
// 开票到款金额合计(换算后)
|
|
|
var amountTotal float64
|
|
|
- results, e := fms.GetIncomeHistory(histrtyCond, historyPars)
|
|
|
+ results, e := fms.GetIncomeHistory(histortyCond, historyPars)
|
|
|
if e != nil {
|
|
|
resp.FailMsg("查询错误", fmt.Sprintf("获取汇总数据失败, Err: %s", e.Error()), c)
|
|
|
return
|