1
This commit is contained in:
@@ -3,7 +3,6 @@ package dao
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"git.rosy.net.cn/jx-callback/globals"
|
||||
"sort"
|
||||
"strings"
|
||||
"time"
|
||||
@@ -1664,7 +1663,7 @@ func StatisticsAfsOrderInfo(db *DaoDB, startTime, endTime time.Time, storeId int
|
||||
func StatisticsIncome(db *DaoDB, startTime, endTime time.Time, storeId int, brandId, vendorId, storeList []int) ([]*StatisticsIncomeInfo, error) {
|
||||
parma := []interface{}{}
|
||||
sql := `
|
||||
SELECT t1.jx_store_id id,t3.name,
|
||||
SELECT t1.jx_store_id id,t1.vendor_order_id,t3.name,
|
||||
SUM(ROUND(IF(t1.earning_type = 1, t1.total_shop_money-t1.earning_price-IFNULL(t2.desired_fee,0), t1.total_shop_money *(t1.order_pay_percentage/2)/100),3)) total_income,
|
||||
SUM(ROUND(IF(t1.earning_type = 1, t1.total_shop_money-t1.earning_price-IFNULL(t2.desired_fee,0), t1.total_shop_money *(t1.order_pay_percentage/2)/100) * (t3.jx_brand_fee_factor/10),3)) jx_income,
|
||||
SUM(ROUND(IF(t1.earning_type = 1, t1.total_shop_money-t1.earning_price-IFNULL(t2.desired_fee,0), t1.total_shop_money *(t1.order_pay_percentage/2)/100) * (t3.market_add_fee_factor/10),3)) market_income,
|
||||
@@ -1693,12 +1692,13 @@ func StatisticsIncome(db *DaoDB, startTime, endTime time.Time, storeId int, bran
|
||||
parma = append(parma, vendorId)
|
||||
}
|
||||
|
||||
sql += ` GROUP BY t1.jx_store_id`
|
||||
sql += ` GROUP BY t1.jx_store_id,t1.vendor_order_id`
|
||||
|
||||
sql2 := ` select settle.id,count(settle.vendor_order_id) order_count,settle.name name,sum(settle.total_income) total_income,sum(settle.jx_income) jx_income,sum(settle.market_income) market_income, sum(settle.order_sku_price) order_sku_price from ( ` + sql + `) AS settle GROUP BY id ORDER BY order_count desc`
|
||||
sql2 := ` SELECT settle.id,COUNT(settle.vendor_order_id) order_count,settle.name name,
|
||||
SUM(settle.total_income) total_income,SUM(settle.jx_income) jx_income,
|
||||
SUM(settle.market_income) market_income, SUM(settle.order_sku_price) order_sku_price
|
||||
FROM ( ` + sql + `) AS settle GROUP BY id ORDER BY order_count DESC`
|
||||
|
||||
globals.SugarLogger.Debugf("-----sql := %s", sql2)
|
||||
globals.SugarLogger.Debugf("-----parma := %s", utils.Format4Output(parma, false))
|
||||
incomeInfo := make([]*StatisticsIncomeInfo, 0, 0)
|
||||
if err := GetRows(db, &incomeInfo, sql2, parma...); err != nil {
|
||||
return nil, err
|
||||
|
||||
Reference in New Issue
Block a user