This commit is contained in:
苏尹岚
2021-03-19 11:40:54 +08:00
parent b4efae54a1
commit 9ae3335206

View File

@@ -96,14 +96,14 @@ func GetStatisticsReportForOrders(db *DaoDB, storeIDs []int, fromDate time.Time,
SUM(IF(a.vendor_id = a.waybill_vendor_id,waybill_tip_money,0)) waybill_tip_money, SUM(IF(a.vendor_id = a.waybill_vendor_id,waybill_tip_money,0)) waybill_tip_money,
SUM(total_shop_money) total_shop_money, SUM(total_shop_money) total_shop_money,
SUM(pm_subsidy_money) pm_subsidy_money, SUM(pm_subsidy_money) pm_subsidy_money,
SUM(earning_price) earning_price, SUM(new_earning_price) earning_price,
SUM(total_shop_money-earning_price-desired_fee-distance_freight_money-waybill_tip_money-80) total_gross_profit SUM(total_shop_money-new_earning_price-desired_fee-distance_freight_money-waybill_tip_money-80) total_gross_profit
FROM goods_order a FROM goods_order a
LEFT JOIN waybill b ON IF(a.waybill_vendor_id = -1,a.vendor_order_id,a.vendor_waybill_id) = b.vendor_waybill_id LEFT JOIN waybill b ON IF(a.waybill_vendor_id = -1,a.vendor_order_id,a.vendor_waybill_id) = b.vendor_waybill_id
WHERE a.status <> ? WHERE a.status = ?
` `
sqlParams := []interface{}{ sqlParams := []interface{}{
model.OrderStatusCanceled, //排除已取消的订单 model.OrderStatusFinished,
} }
if !utils.IsTimeZero(fromDate) && !utils.IsTimeZero(toDate) { if !utils.IsTimeZero(fromDate) && !utils.IsTimeZero(toDate) {
sql += ` AND a.order_created_at BETWEEN ? AND ?` sql += ` AND a.order_created_at BETWEEN ? AND ?`