Commit 5ec8b06e by guanzhenshan

平台利润统计报表按发货时间统计时,FBA 平台的数据按下单时间统计

parent 5bf6a75c
...@@ -1514,7 +1514,7 @@ namespace Bailun.DC.Services ...@@ -1514,7 +1514,7 @@ namespace Bailun.DC.Services
/// <param name="start">付款开始时间</param> /// <param name="start">付款开始时间</param>
/// <param name="end">付款结束时间</param> /// <param name="end">付款结束时间</param>
/// <returns></returns> /// <returns></returns>
public List<Models.Orders.dc_base_oms_sku> ListPlatformProfit(string platform, string website, DateTime? start, DateTime? end, DateTime? shipstart, DateTime? shipend, bool isUSD, int? companyid, string skucategoryids) public List<Models.Orders.dc_base_oms_sku> ListPlatformProfit(string platform, string website, DateTime? start, DateTime? end, DateTime? shipstart, DateTime? shipend, bool isUSD, int? companyid, string skucategoryids,DateTime? createstart=null,DateTime? createend=null)
{ {
var sqlparam = new DynamicParameters(); var sqlparam = new DynamicParameters();
var sql = "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(tb.cost_first*" + (isUSD ? "tb.cny_to_usd_exchange_rate" : "1") + ") as cost_first,sum(tb.cost_tail*" + (isUSD ? "tb.cny_to_usd_exchange_rate" : "1") + ") cost_tail,sum(tb.cost_handle_bailun*" + (isUSD ? "tb.cny_to_usd_exchange_rate" : "1") + ") cost_handle_bailun,sum(tb.cost_handle_platform*" + (isUSD ? "tb.cny_to_usd_exchange_rate" : "1") + ") cost_handle_platform,sum(tb.amount_refund*" + (isUSD ? "tb.order_to_usd_exchange_rate" : "tb.seller_order_exchange_rate") + ") amount_refund,sum(tb.cost_fba_fee*" + (isUSD ? "tb.order_to_usd_exchange_rate" : "tb.seller_order_exchange_rate") + ") cost_fba_fee,sum(tb.cost_paypal_fee*" + (isUSD ? "tb.order_to_usd_exchange_rate" : "tb.seller_order_exchange_rate") + ") cost_paypal_fee,sum(tb.amount_shipping*" + (isUSD ? "tb.order_to_usd_exchange_rate" : "tb.seller_order_exchange_rate") + ") amount_shipping,sum(tb.cost_promotion*" + (isUSD ? "tb.order_to_usd_exchange_rate" : "tb.seller_order_exchange_rate") + ") cost_promotion,sum(tb.cost_product*" + (isUSD ? "tb.cny_to_usd_exchange_rate" : "1") + ") cost_product,sum(tb.profit_total*" + (isUSD ? "tb.cny_to_usd_exchange_rate" : "1") + ") profit_total,(sum(tb.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((tb.amount_prepaid>0 and tb.bailun_order_status!='Finished') or null) as noshippingcount,sum(tb.amount_prepaid*" + (isUSD ? "tb.cny_to_usd_exchange_rate" : "1") + ") amount_prepaid from dc_base_oms_order tb "; var sql = "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(tb.cost_first*" + (isUSD ? "tb.cny_to_usd_exchange_rate" : "1") + ") as cost_first,sum(tb.cost_tail*" + (isUSD ? "tb.cny_to_usd_exchange_rate" : "1") + ") cost_tail,sum(tb.cost_handle_bailun*" + (isUSD ? "tb.cny_to_usd_exchange_rate" : "1") + ") cost_handle_bailun,sum(tb.cost_handle_platform*" + (isUSD ? "tb.cny_to_usd_exchange_rate" : "1") + ") cost_handle_platform,sum(tb.amount_refund*" + (isUSD ? "tb.order_to_usd_exchange_rate" : "tb.seller_order_exchange_rate") + ") amount_refund,sum(tb.cost_fba_fee*" + (isUSD ? "tb.order_to_usd_exchange_rate" : "tb.seller_order_exchange_rate") + ") cost_fba_fee,sum(tb.cost_paypal_fee*" + (isUSD ? "tb.order_to_usd_exchange_rate" : "tb.seller_order_exchange_rate") + ") cost_paypal_fee,sum(tb.amount_shipping*" + (isUSD ? "tb.order_to_usd_exchange_rate" : "tb.seller_order_exchange_rate") + ") amount_shipping,sum(tb.cost_promotion*" + (isUSD ? "tb.order_to_usd_exchange_rate" : "tb.seller_order_exchange_rate") + ") cost_promotion,sum(tb.cost_product*" + (isUSD ? "tb.cny_to_usd_exchange_rate" : "1") + ") cost_product,sum(tb.profit_total*" + (isUSD ? "tb.cny_to_usd_exchange_rate" : "1") + ") profit_total,(sum(tb.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((tb.amount_prepaid>0 and tb.bailun_order_status!='Finished') or null) as noshippingcount,sum(tb.amount_prepaid*" + (isUSD ? "tb.cny_to_usd_exchange_rate" : "1") + ") amount_prepaid from dc_base_oms_order tb ";
...@@ -1618,6 +1618,17 @@ namespace Bailun.DC.Services ...@@ -1618,6 +1618,17 @@ namespace Bailun.DC.Services
sqlparam.Add("shipend", shipend.Value.AddDays(1)); sqlparam.Add("shipend", shipend.Value.AddDays(1));
} }
if (createstart.HasValue)
{
sql += " and tb.create_time>=@createstart";
sqlparam.Add("createstart", createstart.Value);
}
if (createend.HasValue)
{
sql += " and tb.create_time<@createend";
sqlparam.Add("createend", createend.Value.AddDays(1));
}
sql += " group by tb.platform_type"; sql += " group by tb.platform_type";
......
...@@ -1382,7 +1382,7 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers ...@@ -1382,7 +1382,7 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
{ {
result = _service.ListPlatformProfitByShipTime(platform,website, start, end, shipstart, shipend, currency.ToUpper() == "USD", companyid, skucategoryids); result = _service.ListPlatformProfitByShipTime(platform,website, start, end, shipstart, shipend, currency.ToUpper() == "USD", companyid, skucategoryids);
var fbaResult = _service.ListPlatformProfit(string.IsNullOrEmpty(platform) ? "FBA" : "",website, shipstart, shipend, null, null, currency.ToUpper() == "USD", companyid, skucategoryids); var fbaResult = _service.ListPlatformProfit(string.IsNullOrEmpty(platform) ? "FBA" : "",website, null,null,null, null, currency.ToUpper() == "USD", companyid, skucategoryids, shipstart, shipend);
result.AddRange(fbaResult); result.AddRange(fbaResult);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment