This commit is contained in:
苏尹岚
2021-03-19 15:11:08 +08:00
parent bd2c116afe
commit e184f7a856

View File

@@ -67,7 +67,7 @@ func GetStatisticsReportForOrders(db *DaoDB, storeIDs, vendorIDs []int, fromDate
s.total_shop_money,
s.pm_subsidy_money,
s.earning_price,
s.total_gross_profit,
s.total_gross_profit1 - s.afs_price total_gross_profit,
IF(c.jx_brand_fee_factor = 0 AND c.market_add_fee_factor = 0,total_gross_profit,(total_gross_profit*c.jx_brand_fee_factor)/(c.jx_brand_fee_factor+market_add_fee_factor)) com_gross_profit,
IF(c.jx_brand_fee_factor = 0 AND c.market_add_fee_factor = 0,0,(total_gross_profit*c.market_add_fee_factor)/(c.jx_brand_fee_factor+market_add_fee_factor)) city_manager_gross_profit,
c.status, c.tel1,
@@ -97,12 +97,16 @@ func GetStatisticsReportForOrders(db *DaoDB, storeIDs, vendorIDs []int, fromDate
SUM(total_shop_money) total_shop_money,
SUM(pm_subsidy_money) pm_subsidy_money,
SUM(IF(a.earning_type = 1, earning_price, new_earning_price)) earning_price,
SUM(IF(a.order_type = 0,total_shop_money-IF(a.earning_type = 1, earning_price, new_earning_price)-desired_fee-distance_freight_money-waybill_tip_money, 80)) total_gross_profit
SUM(IF(a.order_type = 0,total_shop_money-IF(a.earning_type = 1, earning_price, new_earning_price)-desired_fee-distance_freight_money-waybill_tip_money, 80)) total_gross_profit1,
SUM(d.shop_price) afs_price
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 afs_order c ON c.vendor_order_id = a.vendor_order_id
LEFT JOIN order_sku_financial d ON d.afs_order_id = c.afs_order_id AND d.is_afs_order = ?
WHERE a.status = ?
`
sqlParams := []interface{}{
model.YES,
model.OrderStatusFinished,
}
if !utils.IsTimeZero(fromDate) && !utils.IsTimeZero(toDate) {