sql.Append("SELECT t1.platform_type, SUM(t1.amount_sales)AS total_amount_sales,COUNT(0)AS total_order FROM dc_month_sales_profit_orderdetail AS t1 ");
if(isCost)
{
sql.Append(@"SELECT t1.platform_type, SUM(t1.cost_product) AS original_amount,
SUM(t1.cost_product * t1.quantity_shipped) AS total_amount_sales,COUNT(0) total_order FROM dc_month_sales_profit_orderdetail AS t1 ");
}
else
{
sql.Append(@"SELECT t1.platform_type, SUM(t1.amount_sales) AS original_amount,
SUM(t1.amount_sales * t1.seller_order_exchange_rate * t1.quantity_shipped) AS total_amount_sales,COUNT(0)AS total_order FROM dc_month_sales_profit_orderdetail AS t1 ");
}
sql.Append("INNER JOIN dc_base_oms_sku AS t2 ON t1.orderskuid = t2.id ");