varsql="select tb.platform_type,count(tb.bailun_order_id) order_count,sum(tb.amount_sales*"+(isUSD?"tb.order_to_usd_exchange_rate":"tb.seller_order_exchange_rate")+") as amount_sales,sum(tb.cost_platform_fee*(if(tb.platform_type='Ebay',"+(isUSD?"tb.other_to_usd_exchange_rate":"tb.seller_other_exchange_rate")+","+(isUSD?"tb.order_to_usd_exchange_rate":"tb.seller_order_exchange_rate")+"))) as cost_platform_fee,sum(cost_first*"+(isUSD?"tb.cny_to_usd_exchange_rate":"1")+") as cost_first,sum(cost_tail*"+(isUSD?"tb.cny_to_usd_exchange_rate":"1")+") cost_tail,sum(cost_handle_bailun*"+(isUSD?"tb.cny_to_usd_exchange_rate":"1")+") cost_handle_bailun,sum(cost_handle_platform*"+(isUSD?"tb.cny_to_usd_exchange_rate":"1")+") cost_handle_platform,sum(amount_refund*"+(isUSD?"tb.order_to_usd_exchange_rate":"tb.seller_order_exchange_rate")+") amount_refund,sum(cost_product*"+(isUSD?"tb.cny_to_usd_exchange_rate":"1")+") cost_product,sum(profit_total*"+(isUSD?"tb.cny_to_usd_exchange_rate":"1")+") profit_total,(sum(profit_total*"+(isUSD?"tb.cny_to_usd_exchange_rate":"1")+")/sum(tb.amount_sales*"+(isUSD?"tb.order_to_usd_exchange_rate":"tb.seller_order_exchange_rate")+")) profit_rate,count(amount_prepaid>0 or null) as noshippingcount,sum(amount_prepaid*"+(isUSD?"tb.cny_to_usd_exchange_rate":"1")+") amount_prepaid from dc_base_oms_order tb ";
...
...
@@ -997,7 +997,8 @@ namespace Bailun.DC.Services
sql+=" left join dc_base_oms_pick t1 on tb.bailun_order_id =t1.bailun_order_id ";
}
sql+=" where tb.bailun_order_status!='Canceled' and tb.bailun_order_status!='CantHandle' and tb.has_scalp=0 and tb.has_innersale=0";
sql+=" where tb.bailun_order_status!='Canceled' and tb.bailun_order_status!='CantHandle' and tb.has_scalp=0 and tb.has_innersale=0 ";
//sql += " and tb.company_id=" + companyid; //按公司区分
varsql="select tb.platform_type,count(tb.bailun_order_id) order_count,sum(tb.amount_sales*"+(isUSD?"tb.order_to_usd_exchange_rate":"tb.seller_order_exchange_rate")+") as amount_sales,sum(tb.cost_platform_fee*(if(tb.platform_type='Ebay',"+(isUSD?"tb.other_to_usd_exchange_rate":"tb.seller_other_exchange_rate")+","+(isUSD?"tb.order_to_usd_exchange_rate":"tb.seller_order_exchange_rate")+"))) as cost_platform_fee,sum(cost_first*"+(isUSD?"tb.cny_to_usd_exchange_rate":"1")+") as cost_first,sum(cost_tail*"+(isUSD?"tb.cny_to_usd_exchange_rate":"1")+") cost_tail,sum(cost_handle_bailun*"+(isUSD?"tb.cny_to_usd_exchange_rate":"1")+") cost_handle_bailun,sum(cost_handle_platform*"+(isUSD?"tb.cny_to_usd_exchange_rate":"1")+") cost_handle_platform,sum(amount_refund*"+(isUSD?"tb.order_to_usd_exchange_rate":"tb.seller_order_exchange_rate")+") amount_refund,sum(cost_product*"+(isUSD?"tb.cny_to_usd_exchange_rate":"1")+") cost_product,sum(profit_total*"+(isUSD?"tb.cny_to_usd_exchange_rate":"1")+") profit_total,(sum(profit_total*"+(isUSD?"tb.cny_to_usd_exchange_rate":"1")+")/sum(tb.amount_sales*"+(isUSD?"tb.order_to_usd_exchange_rate":"tb.seller_order_exchange_rate")+")) profit_rate,count(amount_prepaid>0 or null) as noshippingcount,sum(amount_prepaid*"+(isUSD?"tb.cny_to_usd_exchange_rate":"1")+") amount_prepaid from dc_base_oms_order tb ";
sql+=" and shipping_time<'"+shipend.Value.AddDays(1).ToString("yyyy-MM-dd")+"'";
}
sql+=" group by bailun_order_id) t2 on tb.bailun_order_id=t2.bailun_order_id ";
//sql += " company_id="+companyid; //按公司区分
sql+=" group by bailun_order_id ";
sql+=" ) t2 on tb.bailun_order_id=t2.bailun_order_id ";
sql+=" where tb.bailun_order_status!='Canceled' and tb.has_scalp=0 and tb.bailun_order_status!='CantHandle' and tb.has_scalp=0 and tb.has_innersale=0 ";
//sql += " and tb.company_id=" + companyid; //按公司区分