Commit 340fb341 by guanzhenshan

解决尾程费统计不准的问题

parent 0ec69b21
......@@ -22,7 +22,7 @@ namespace Bailun.DC.HappenAmount
//static void Main(string[] args)
//{
// var start = DateTime.Parse("2020-04-06");
// var start = DateTime.Parse("2020-04-19");
// while (start.AddDays(1) < DateTime.Now)
// {
// new Services().Init(start, start.AddDays(1));
......
......@@ -184,8 +184,8 @@ namespace Bailun.DC.HappenAmount
m.tl_amount_pay = m.hl_amount_pay;
//发生额
sqlhappen = $@"select sum(t2.cost_tail*t1.quantity_shipped) from dc_base_oms_pick t1
join dc_base_oms_sku t2 on t1.bailun_sku = t2.bailun_sku and t1.origin_order_id = t2.origin_order_id and t2.bailun_order_status != 'Canceled' and t2.has_scalp = 0 and t2.has_delete = 0 and t2.has_innersale = 0 and t2.company_id = 1 and t2.cost_tail > 0
sqlhappen = $@"select sum(t2.cost_logistics*t1.quantity_shipped) from dc_base_oms_pick t1
join dc_base_oms_sku t2 on t1.bailun_sku = t2.bailun_sku and t1.origin_order_id = t2.origin_order_id and t2.bailun_order_status != 'Canceled' and t2.has_scalp = 0 and t2.has_delete = 0 and t2.has_innersale = 0 and t2.company_id = 1 and t2.cost_logistics > 0
where t1.shipping_time >= '{start.ToString("yyyy-MM-dd HH:mm:ss")}' and t1.shipping_time < '{end.ToString("yyyy-MM-dd HH:mm:ss")}' and t1.has_delete = 0 and t1.company_id = 1 and t1.shipping_status = 'TotalShipping'";
m.tl_amount_happen += cn.QueryFirstOrDefault<decimal?>(sqlhappen,null,null,2*60)??0;
......
......@@ -37,7 +37,7 @@ namespace Bailun.DC.MonthSaleProfit
Console.WriteLine("任务运行完成 " + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
}
else if (now.Minute == 59)
else if (now.Hour%6==0 && now.Minute == 59)
{
Console.WriteLine("开始启动更新服务" + DateTime.Now);
Update(DateTime.Now);
......
......@@ -2373,8 +2373,8 @@ namespace Bailun.DC.Services
/// <returns></returns>
public List<dc_base_oms_pick> ListTailLogisticHappen(BtTableParameter parameter, DateTime start, DateTime end, ref int total)
{
var sql = $@"select t1.origin_order_id,pick_order_id,tracking_order_id,t1.bailun_sku,(t2.cost_tail*t1.quantity_shipped) cost_tail,shipping_time from dc_base_oms_pick t1
join dc_base_oms_sku t2 on t1.bailun_sku = t2.bailun_sku and t1.origin_order_id = t2.origin_order_id and t2.bailun_order_status != 'Canceled' and t2.has_scalp = 0 and t2.has_delete = 0 and t2.has_innersale = 0 and t2.company_id = 1 and t2.cost_tail > 0
var sql = $@"select t1.origin_order_id,pick_order_id,tracking_order_id,t1.bailun_sku,(t2.cost_logistics*t1.quantity_shipped) cost_tail,shipping_time from dc_base_oms_pick t1
join dc_base_oms_sku t2 on t1.bailun_sku = t2.bailun_sku and t1.origin_order_id = t2.origin_order_id and t2.bailun_order_status != 'Canceled' and t2.has_scalp = 0 and t2.has_delete = 0 and t2.has_innersale = 0 and t2.company_id = 1 and t2.cost_logistics > 0
where t1.shipping_time >= '{start.ToString("yyyy-MM-dd HH:mm:ss")}' and t1.shipping_time < '{end.AddDays(1).ToString("yyyy-MM-dd HH:mm:ss")}' and t1.has_delete = 0 and t1.company_id = 1 and t1.shipping_status = 'TotalShipping'";
using (var cn = new MySqlConnection(Common.GlobalConfig.ConnectionString))
......@@ -2407,8 +2407,8 @@ namespace Bailun.DC.Services
/// <returns></returns>
public dc_base_oms_pick ListTailLogisticHappenCount(DateTime start, DateTime end)
{
var sql = $@"select sum(t2.cost_tail*t1.quantity_shipped) cost_tail from dc_base_oms_pick t1
join dc_base_oms_sku t2 on t1.bailun_sku = t2.bailun_sku and t1.origin_order_id = t2.origin_order_id and t2.bailun_order_status != 'Canceled' and t2.has_scalp = 0 and t2.has_delete = 0 and t2.has_innersale = 0 and t2.company_id = 1 and t2.cost_tail > 0
var sql = $@"select sum(t2.cost_logistics*t1.quantity_shipped) cost_tail from dc_base_oms_pick t1
join dc_base_oms_sku t2 on t1.bailun_sku = t2.bailun_sku and t1.origin_order_id = t2.origin_order_id and t2.bailun_order_status != 'Canceled' and t2.has_scalp = 0 and t2.has_delete = 0 and t2.has_innersale = 0 and t2.company_id = 1 and t2.cost_logistics > 0
where t1.shipping_time >= '{start.ToString("yyyy-MM-dd HH:mm:ss")}' and t1.shipping_time < '{end.AddDays(1).ToString("yyyy-MM-dd HH:mm:ss")}' and t1.has_delete = 0 and t1.company_id = 1 and t1.shipping_status = 'TotalShipping'";
using (var cn = new MySqlConnection(Common.GlobalConfig.ConnectionString))
......@@ -2434,7 +2434,7 @@ namespace Bailun.DC.Services
/// <returns></returns>
public List<Models.Orders.dc_base_oms_sku> ListTailLogisticSale(BtTableParameter parameter, DateTime start, DateTime end, ref int total)
{
var sql = $"select platform_type,origin_order_id,bailun_sku,(cost_tail*bailun_sku_quantity_ordered) as cost_tail,paid_time from dc_base_oms_sku t1 where paid_time>='{start.ToString("yyyy-MM-dd HH:mm:ss")}' and paid_time<'{end.AddDays(1).ToString("yyyy-MM-dd HH:mm:ss")}' and bailun_order_status!='Canceled' and has_scalp=0 and has_delete=0 and has_innersale=0 and company_id=1 and cost_logistics>0";
var sql = $"select platform_type,origin_order_id,bailun_sku,(cost_logistics*bailun_sku_quantity_ordered) as cost_tail,paid_time from dc_base_oms_sku t1 where paid_time>='{start.ToString("yyyy-MM-dd HH:mm:ss")}' and paid_time<'{end.AddDays(1).ToString("yyyy-MM-dd HH:mm:ss")}' and bailun_order_status!='Canceled' and has_scalp=0 and has_delete=0 and has_innersale=0 and company_id=1 and cost_logistics>0";
using (var cn = new MySqlConnection(Common.GlobalConfig.ConnectionString))
{
......
......@@ -1514,7 +1514,7 @@ namespace Bailun.DC.Services
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 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_logistics*" + (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 ";
if (shipstart.HasValue || shipend.HasValue)
{
......@@ -1666,7 +1666,7 @@ namespace Bailun.DC.Services
}
var sqlparam = new DynamicParameters();
var sql = $"select {str_statistic_col},count(distinct tb.bailun_order_id) order_count,sum(tb.amount_sales*" + (isUSD ? "tb.order_to_usd_exchange_rate" : "tb.seller_order_exchange_rate") + "* tb.bailun_sku_quantity_ordered) 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") + "))*tb.bailun_sku_quantity_ordered) as cost_platform_fee,sum(tb.cost_first*" + (isUSD ? "tb.cny_to_usd_exchange_rate" : "1") + "*tb.bailun_sku_quantity_ordered) as cost_first,sum(tb.cost_tail*" + (isUSD ? "tb.cny_to_usd_exchange_rate" : "1") + "*tb.bailun_sku_quantity_ordered) cost_tail,sum(tb.cost_handle_bailun*" + (isUSD ? "tb.cny_to_usd_exchange_rate" : "1") + "*tb.bailun_sku_quantity_ordered) cost_handle_bailun,sum(tb.cost_handle_platform*" + (isUSD ? "tb.cny_to_usd_exchange_rate" : "1") + "*tb.bailun_sku_quantity_ordered) cost_handle_platform,sum(tb.amount_refund*" + (isUSD ? "tb.order_to_usd_exchange_rate" : "tb.seller_order_exchange_rate") + "*tb.bailun_sku_quantity_ordered) amount_refund,sum(tb.cost_fba_fee*" + (isUSD ? "tb.order_to_usd_exchange_rate" : "tb.seller_order_exchange_rate") + "*tb.bailun_sku_quantity_ordered) cost_fba_fee,sum(tb.cost_paypal_fee*" + (isUSD ? "tb.order_to_usd_exchange_rate" : "tb.seller_order_exchange_rate") + "*tb.bailun_sku_quantity_ordered) cost_paypal_fee,sum(tb.amount_shipping*" + (isUSD ? "tb.order_to_usd_exchange_rate" : "tb.seller_order_exchange_rate") + "*tb.bailun_sku_quantity_ordered) amount_shipping,sum(tb.cost_promotion*" + (isUSD ? "tb.order_to_usd_exchange_rate" : "tb.seller_order_exchange_rate") + "*tb.bailun_sku_quantity_ordered) cost_promotion,sum(tb.cost_product*" + (isUSD ? "tb.cny_to_usd_exchange_rate" : "1") + "*tb.bailun_sku_quantity_ordered) cost_product,sum(tb.profit_total*" + (isUSD ? "tb.cny_to_usd_exchange_rate" : "1") + "*tb.bailun_sku_quantity_ordered) 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") + "*tb.bailun_sku_quantity_ordered) amount_prepaid from dc_base_oms_sku tb ";
var sql = $"select {str_statistic_col},count(distinct tb.bailun_order_id) order_count,sum(tb.amount_sales*" + (isUSD ? "tb.order_to_usd_exchange_rate" : "tb.seller_order_exchange_rate") + "* tb.bailun_sku_quantity_ordered) 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") + "))*tb.bailun_sku_quantity_ordered) as cost_platform_fee,sum(tb.cost_first*" + (isUSD ? "tb.cny_to_usd_exchange_rate" : "1") + "*tb.bailun_sku_quantity_ordered) as cost_first,sum(tb.cost_logistics*" + (isUSD ? "tb.cny_to_usd_exchange_rate" : "1") + "*tb.bailun_sku_quantity_ordered) cost_tail,sum(tb.cost_handle_bailun*" + (isUSD ? "tb.cny_to_usd_exchange_rate" : "1") + "*tb.bailun_sku_quantity_ordered) cost_handle_bailun,sum(tb.cost_handle_platform*" + (isUSD ? "tb.cny_to_usd_exchange_rate" : "1") + "*tb.bailun_sku_quantity_ordered) cost_handle_platform,sum(tb.amount_refund*" + (isUSD ? "tb.order_to_usd_exchange_rate" : "tb.seller_order_exchange_rate") + "*tb.bailun_sku_quantity_ordered) amount_refund,sum(tb.cost_fba_fee*" + (isUSD ? "tb.order_to_usd_exchange_rate" : "tb.seller_order_exchange_rate") + "*tb.bailun_sku_quantity_ordered) cost_fba_fee,sum(tb.cost_paypal_fee*" + (isUSD ? "tb.order_to_usd_exchange_rate" : "tb.seller_order_exchange_rate") + "*tb.bailun_sku_quantity_ordered) cost_paypal_fee,sum(tb.amount_shipping*" + (isUSD ? "tb.order_to_usd_exchange_rate" : "tb.seller_order_exchange_rate") + "*tb.bailun_sku_quantity_ordered) amount_shipping,sum(tb.cost_promotion*" + (isUSD ? "tb.order_to_usd_exchange_rate" : "tb.seller_order_exchange_rate") + "*tb.bailun_sku_quantity_ordered) cost_promotion,sum(tb.cost_product*" + (isUSD ? "tb.cny_to_usd_exchange_rate" : "1") + "*tb.bailun_sku_quantity_ordered) cost_product,sum(tb.profit_total*" + (isUSD ? "tb.cny_to_usd_exchange_rate" : "1") + "*tb.bailun_sku_quantity_ordered) 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") + "*tb.bailun_sku_quantity_ordered) amount_prepaid from dc_base_oms_sku tb ";
if (shipstart.HasValue || shipend.HasValue)
{
......@@ -2085,7 +2085,7 @@ namespace Bailun.DC.Services
var sqlparam = new DynamicParameters();
//var precolumn = "select website,platform_type as platform,sum(amount_prepaid) amount_prepaid from dc_base_oms_sku where bailun_order_status!='Canceled' and bailun_order_status!='CantHandle' ";
var sql = "select t1.platform_type as platform,t1.website,sum(t1.amount_sales*t1.seller_order_exchange_rate) saleamount,count(t1.bailun_order_id) ordercount,sum(t1.cost_platform_fee*t1.seller_order_exchange_rate) platformfee,(sum(t1.amount_sales*t1.seller_order_exchange_rate)/count(t1.bailun_order_id)) customerprice,sum(t1.profit_total) profit,(sum(t1.profit_total)/sum(t1.amount_sales*t1.seller_order_exchange_rate)) profitrate,sum(t1.amount_refund*t1.seller_order_exchange_rate) returnamount,(sum(t1.amount_refund)/sum(t1.amount_sales)) returnamountrate,sum(t1.cost_first) cost_first,sum(t1.cost_tail) cost_tail,sum(t1.cost_handle_bailun) cost_handle_bailun,sum(t1.cost_handle_platform) cost_handle_platform,sum(t1.amount_prepaid) amount_prepaid from dc_base_oms_order t1 ";
var sql = "select t1.platform_type as platform,t1.website,sum(t1.amount_sales*t1.seller_order_exchange_rate) saleamount,count(t1.bailun_order_id) ordercount,sum(t1.cost_platform_fee*t1.seller_order_exchange_rate) platformfee,(sum(t1.amount_sales*t1.seller_order_exchange_rate)/count(t1.bailun_order_id)) customerprice,sum(t1.profit_total) profit,(sum(t1.profit_total)/sum(t1.amount_sales*t1.seller_order_exchange_rate)) profitrate,sum(t1.amount_refund*t1.seller_order_exchange_rate) returnamount,(sum(t1.amount_refund)/sum(t1.amount_sales)) returnamountrate,sum(t1.cost_first) cost_first,sum(t1.cost_logistics) cost_tail,sum(t1.cost_handle_bailun) cost_handle_bailun,sum(t1.cost_handle_platform) cost_handle_platform,sum(t1.amount_prepaid) amount_prepaid from dc_base_oms_order t1 ";
sql += " where t1.bailun_order_status!='Canceled' and ((t1.platform_type!='FBA' and t1.bailun_order_status!='CantHandle') or t1.platform_type='FBA') and t1.has_scalp=0 and t1.has_innersale=0 and t1.bailun_interception_status in ('None','Failed') ";
......@@ -2143,7 +2143,7 @@ namespace Bailun.DC.Services
public Models.Orders.mPlatformProfit ListPlatformProfitByWebSiteCount(string platform, DateTime? start, DateTime? end, BtTableParameter parameter, int? companyid, ref int total)
{
var sqlparam = new DynamicParameters();
var sql = "select sum(t1.amount_sales*t1.seller_order_exchange_rate) saleamount,count(t1.bailun_order_id) ordercount,sum(t1.cost_platform_fee*t1.seller_order_exchange_rate) platformfee,(sum(t1.amount_sales*t1.seller_order_exchange_rate)/count(t1.bailun_order_id)) customerprice,sum(t1.profit_total) profit,(sum(t1.profit_total)/sum(t1.amount_sales*t1.seller_order_exchange_rate)) profitrate,sum(t1.amount_refund*t1.seller_order_exchange_rate) returnamount,(sum(t1.amount_refund)/sum(t1.amount_sales)) returnamountrate,sum(t1.cost_first) cost_first,sum(t1.cost_tail) cost_tail,sum(t1.cost_handle_bailun) cost_handle_bailun,sum(t1.cost_handle_platform) cost_handle_platform,sum(t1.amount_prepaid) amount_prepaid from dc_base_oms_order t1 ";
var sql = "select sum(t1.amount_sales*t1.seller_order_exchange_rate) saleamount,count(t1.bailun_order_id) ordercount,sum(t1.cost_platform_fee*t1.seller_order_exchange_rate) platformfee,(sum(t1.amount_sales*t1.seller_order_exchange_rate)/count(t1.bailun_order_id)) customerprice,sum(t1.profit_total) profit,(sum(t1.profit_total)/sum(t1.amount_sales*t1.seller_order_exchange_rate)) profitrate,sum(t1.amount_refund*t1.seller_order_exchange_rate) returnamount,(sum(t1.amount_refund)/sum(t1.amount_sales)) returnamountrate,sum(t1.cost_first) cost_first,sum(t1.cost_logistics) cost_tail,sum(t1.cost_handle_bailun) cost_handle_bailun,sum(t1.cost_handle_platform) cost_handle_platform,sum(t1.amount_prepaid) amount_prepaid from dc_base_oms_order t1 ";
sql += " where t1.bailun_order_status!='Canceled' and ((t1.platform_type!='FBA' and t1.bailun_order_status!='CantHandle') or t1.platform_type='FBA') and t1.has_scalp=0 and t1.has_innersale=0 and t1.bailun_interception_status in ('None','Failed') ";
......@@ -2196,7 +2196,7 @@ namespace Bailun.DC.Services
public List<Models.Orders.dc_base_oms_order> ListPlatformProfitOrders(BtTableParameter parameter, string platform, string website, string account, DateTime? start, DateTime? end, DateTime? shipstart, DateTime? shipend, string orderno, int? companyid, ref int total, decimal? rate_start, decimal? rate_end)
{
var sqlparam = new DynamicParameters();
var sql = "select t1.platform_type,t1.website,t1.origin_order_id,t1.bailun_order_id,t1.seller_account,t1.order_currency,(t1.amount_sales*t1.seller_order_exchange_rate) amount_sales,(t1.amount_product*t1.seller_order_exchange_rate) amount_product,(t1.amount_shipping*t1.seller_order_exchange_rate) amount_shipping,(t1.amount_tax*t1.seller_order_exchange_rate) amount_tax,(t1.amount_adjustment*t1.seller_order_exchange_rate) amount_adjustment,(t1.amount_gift_wrap*t1.seller_order_exchange_rate) amount_gift_wrap,(t1.amount_refund*t1.seller_order_exchange_rate) amount_refund,(t1.cost_total) cost_total,(t1.cost_promotion*t1.seller_order_exchange_rate) cost_promotion,(t1.cost_platform_fee*t1.seller_order_exchange_rate) cost_platform_fee,(t1.cost_product) cost_product,(t1.cost_shipping) cost_shipping,(t1.cost_package*t1.seller_order_exchange_rate) cost_package,(t1.cost_fba_fee*t1.seller_order_exchange_rate) cost_fba_fee,(t1.cost_paypal_fee*t1.seller_order_exchange_rate) cost_paypal_fee,(t1.cost_refund_commisson*t1.seller_order_exchange_rate) cost_refund_commisson,(t1.cost_handle_bailun) cost_handle_bailun,(t1.cost_handle_platform) cost_handle_platform,(t1.cost_tail) cost_tail,(t1.cost_first) cost_first,(t1.profit_total) profit_total,((t1.profit_total)/(t1.amount_sales*t1.seller_order_exchange_rate)) profit_rate,t1.create_time,t1.paid_time,t1.seller_order_exchange_rate,t1.seller_other_exchange_rate,(t1.amount_prepaid) amount_prepaid,t1.cost_logistics from dc_base_oms_order t1 ";
var sql = "select t1.platform_type,t1.website,t1.origin_order_id,t1.bailun_order_id,t1.seller_account,t1.order_currency,(t1.amount_sales*t1.seller_order_exchange_rate) amount_sales,(t1.amount_product*t1.seller_order_exchange_rate) amount_product,(t1.amount_shipping*t1.seller_order_exchange_rate) amount_shipping,(t1.amount_tax*t1.seller_order_exchange_rate) amount_tax,(t1.amount_adjustment*t1.seller_order_exchange_rate) amount_adjustment,(t1.amount_gift_wrap*t1.seller_order_exchange_rate) amount_gift_wrap,(t1.amount_refund*t1.seller_order_exchange_rate) amount_refund,(t1.cost_total) cost_total,(t1.cost_promotion*t1.seller_order_exchange_rate) cost_promotion,(t1.cost_platform_fee*t1.seller_order_exchange_rate) cost_platform_fee,(t1.cost_product) cost_product,(t1.cost_shipping) cost_shipping,(t1.cost_package*t1.seller_order_exchange_rate) cost_package,(t1.cost_fba_fee*t1.seller_order_exchange_rate) cost_fba_fee,(t1.cost_paypal_fee*t1.seller_order_exchange_rate) cost_paypal_fee,(t1.cost_refund_commisson*t1.seller_order_exchange_rate) cost_refund_commisson,(t1.cost_handle_bailun) cost_handle_bailun,(t1.cost_handle_platform) cost_handle_platform,(t1.cost_logistics) cost_tail,(t1.cost_first) cost_first,(t1.profit_total) profit_total,((t1.profit_total)/(t1.amount_sales*t1.seller_order_exchange_rate)) profit_rate,t1.create_time,t1.paid_time,t1.seller_order_exchange_rate,t1.seller_other_exchange_rate,(t1.amount_prepaid) amount_prepaid,t1.cost_logistics from dc_base_oms_order t1 ";
if (shipstart.HasValue || shipend.HasValue)
{
......@@ -2300,7 +2300,7 @@ namespace Bailun.DC.Services
public Models.Orders.dc_base_oms_order ListPlatformProfitOrdersCount(string platform, string website, string account, DateTime? start, DateTime? end, DateTime? shipstart, DateTime? shipend, string orderno, int? companyid, decimal? rate_start, decimal? rate_end)
{
var sqlparam = new DynamicParameters();
var sql = "select sum(t1.amount_sales*t1.seller_order_exchange_rate) amount_sales,sum(t1.amount_product*t1.seller_order_exchange_rate) amount_product,sum(t1.amount_shipping*t1.seller_order_exchange_rate) amount_shipping,sum(t1.amount_tax*t1.seller_order_exchange_rate) amount_tax,sum(t1.amount_adjustment*t1.seller_order_exchange_rate) amount_adjustment,sum(t1.amount_gift_wrap*t1.seller_order_exchange_rate) amount_gift_wrap,sum(t1.amount_refund*t1.seller_order_exchange_rate) amount_refund,sum(t1.cost_total) cost_total,sum(t1.cost_promotion*t1.seller_order_exchange_rate) cost_promotion,sum(t1.cost_platform_fee*t1.seller_order_exchange_rate) cost_platform_fee,sum(t1.cost_product) cost_product,sum(t1.cost_shipping) cost_shipping,sum(t1.cost_package*t1.seller_order_exchange_rate) cost_package,sum(t1.cost_fba_fee*t1.seller_order_exchange_rate) cost_fba_fee,sum(t1.cost_paypal_fee*t1.seller_order_exchange_rate) cost_paypal_fee,sum(t1.cost_refund_commisson*t1.seller_order_exchange_rate) cost_refund_commisson,sum(t1.cost_handle_bailun) cost_handle_bailun,sum(t1.cost_handle_platform) cost_handle_platform,sum(t1.cost_tail) cost_tail,sum(t1.cost_first) cost_first,sum(t1.profit_total) profit_total,(sum(t1.profit_total)/sum(t1.amount_sales*t1.seller_order_exchange_rate)) profit_rate,sum(t1.amount_prepaid) amount_prepaid,sum(t1.cost_logistics) cost_logistics from dc_base_oms_order t1 ";
var sql = "select sum(t1.amount_sales*t1.seller_order_exchange_rate) amount_sales,sum(t1.amount_product*t1.seller_order_exchange_rate) amount_product,sum(t1.amount_shipping*t1.seller_order_exchange_rate) amount_shipping,sum(t1.amount_tax*t1.seller_order_exchange_rate) amount_tax,sum(t1.amount_adjustment*t1.seller_order_exchange_rate) amount_adjustment,sum(t1.amount_gift_wrap*t1.seller_order_exchange_rate) amount_gift_wrap,sum(t1.amount_refund*t1.seller_order_exchange_rate) amount_refund,sum(t1.cost_total) cost_total,sum(t1.cost_promotion*t1.seller_order_exchange_rate) cost_promotion,sum(t1.cost_platform_fee*t1.seller_order_exchange_rate) cost_platform_fee,sum(t1.cost_product) cost_product,sum(t1.cost_shipping) cost_shipping,sum(t1.cost_package*t1.seller_order_exchange_rate) cost_package,sum(t1.cost_fba_fee*t1.seller_order_exchange_rate) cost_fba_fee,sum(t1.cost_paypal_fee*t1.seller_order_exchange_rate) cost_paypal_fee,sum(t1.cost_refund_commisson*t1.seller_order_exchange_rate) cost_refund_commisson,sum(t1.cost_handle_bailun) cost_handle_bailun,sum(t1.cost_handle_platform) cost_handle_platform,sum(t1.cost_logistics) cost_tail,sum(t1.cost_first) cost_first,sum(t1.profit_total) profit_total,(sum(t1.profit_total)/sum(t1.amount_sales*t1.seller_order_exchange_rate)) profit_rate,sum(t1.amount_prepaid) amount_prepaid,sum(t1.cost_logistics) cost_logistics from dc_base_oms_order t1 ";
if (shipstart.HasValue || shipend.HasValue)
{
......@@ -2854,7 +2854,7 @@ namespace Bailun.DC.Services
{
var sqlparam = new DynamicParameters();
var sql = @"select t1.platform_type,t1.seller_account,t1.website,sum(t1.amount_sales*t1.seller_order_exchange_rate) 'amount_sales',sum(t1.cost_product) 'cost_product',sum(t1.cost_platform_fee*t1.seller_other_exchange_rate) 'cost_platform_fee',sum(t1.cost_paypal_fee*t1.seller_order_exchange_rate) as cost_paypal_fee,sum(t1.cost_first) 'cost_first',count(t1.bailun_order_id) 'order_count',sum(t1.cost_total) 'cost_total',sum(t1.cost_tail) 'cost_tail',sum(t1.profit_total) 'profit_total',(sum(t1.profit_total)/sum(t1.amount_sales*t1.seller_order_exchange_rate)) 'profit_rate',sum(t1.amount_prepaid) amount_prepaid,sum(t1.amount_refund*t1.seller_order_exchange_rate) amount_refund,sum(t1.cost_handle_bailun) cost_handle_bailun,sum(t1.cost_handle_platform) cost_handle_platform,count(t1.amount_prepaid>0 or null) as noshippingcount,sum(t1.cost_logistics) cost_logistics from dc_base_oms_order t1";
var sql = @"select t1.platform_type,t1.seller_account,t1.website,sum(t1.amount_sales*t1.seller_order_exchange_rate) 'amount_sales',sum(t1.cost_product) 'cost_product',sum(t1.cost_platform_fee*t1.seller_other_exchange_rate) 'cost_platform_fee',sum(t1.cost_paypal_fee*t1.seller_order_exchange_rate) as cost_paypal_fee,sum(t1.cost_first) 'cost_first',count(t1.bailun_order_id) 'order_count',sum(t1.cost_total) 'cost_total',sum(t1.cost_logistics) 'cost_tail',sum(t1.profit_total) 'profit_total',(sum(t1.profit_total)/sum(t1.amount_sales*t1.seller_order_exchange_rate)) 'profit_rate',sum(t1.amount_prepaid) amount_prepaid,sum(t1.amount_refund*t1.seller_order_exchange_rate) amount_refund,sum(t1.cost_handle_bailun) cost_handle_bailun,sum(t1.cost_handle_platform) cost_handle_platform,count(t1.amount_prepaid>0 or null) as noshippingcount,sum(t1.cost_logistics) cost_logistics from dc_base_oms_order t1";
if (!string.IsNullOrEmpty(warehousetype))
{
......@@ -2967,7 +2967,7 @@ namespace Bailun.DC.Services
{
var sqlparam = new DynamicParameters();
var sql = @"select sum(t1.amount_sales*t1.seller_order_exchange_rate) 'amount_sales',sum(t1.cost_paypal_fee*t1.seller_order_exchange_rate) 'cost_paypal_fee',sum(t1.cost_product) 'cost_product',sum(t1.cost_platform_fee*t1.seller_other_exchange_rate) 'cost_platform_fee',sum(t1.cost_first) 'cost_first',count(t1.bailun_order_id) 'order_count',sum(t1.cost_total) 'cost_total',sum(t1.cost_tail) 'cost_tail',sum(t1.profit_total) 'profit_total',(sum(t1.profit_total)/sum(t1.amount_sales*t1.seller_order_exchange_rate)) 'profit_rate',sum(t1.amount_prepaid) amount_prepaid,sum(t1.amount_refund*t1.seller_order_exchange_rate) amount_refund,sum(t1.cost_handle_bailun) cost_handle_bailun,sum(t1.cost_handle_platform) cost_handle_platform,count(t1.amount_prepaid>0 or null) as noshippingcount,sum(t1.cost_logistics) cost_logistics from dc_base_oms_order t1";
var sql = @"select sum(t1.amount_sales*t1.seller_order_exchange_rate) 'amount_sales',sum(t1.cost_paypal_fee*t1.seller_order_exchange_rate) 'cost_paypal_fee',sum(t1.cost_product) 'cost_product',sum(t1.cost_platform_fee*t1.seller_other_exchange_rate) 'cost_platform_fee',sum(t1.cost_first) 'cost_first',count(t1.bailun_order_id) 'order_count',sum(t1.cost_total) 'cost_total',sum(t1.cost_logistics) 'cost_tail',sum(t1.profit_total) 'profit_total',(sum(t1.profit_total)/sum(t1.amount_sales*t1.seller_order_exchange_rate)) 'profit_rate',sum(t1.amount_prepaid) amount_prepaid,sum(t1.amount_refund*t1.seller_order_exchange_rate) amount_refund,sum(t1.cost_handle_bailun) cost_handle_bailun,sum(t1.cost_handle_platform) cost_handle_platform,count(t1.amount_prepaid>0 or null) as noshippingcount,sum(t1.cost_logistics) cost_logistics from dc_base_oms_order t1";
if (!string.IsNullOrWhiteSpace(skucategoryids))
{
......@@ -3085,7 +3085,7 @@ namespace Bailun.DC.Services
{
var sqlparam = new DynamicParameters();
var sql = @"select t1.platform_type,t1.website,sum(t1.amount_sales*t1.seller_order_exchange_rate) 'amount_sales',sum(t1.cost_product) 'cost_product',sum(t1.cost_platform_fee*t1.seller_other_exchange_rate) 'cost_platform_fee',sum(t1.cost_paypal_fee*t1.seller_order_exchange_rate) as cost_paypal_fee,sum(t1.cost_first) 'cost_first',count(t1.bailun_order_id) 'order_count',sum(t1.cost_total) 'cost_total',sum(t1.cost_tail) 'cost_tail',sum(t1.profit_total) 'profit_total',(sum(t1.profit_total)/sum(t1.amount_sales*t1.seller_order_exchange_rate)) 'profit_rate',sum(t1.amount_prepaid) amount_prepaid,sum(t1.amount_refund*t1.seller_order_exchange_rate) amount_refund,sum(t1.cost_handle_bailun) cost_handle_bailun,sum(t1.cost_handle_platform) cost_handle_platform,count(t1.amount_prepaid>0 or null) as noshippingcount from dc_base_oms_order t1";
var sql = @"select t1.platform_type,t1.website,sum(t1.amount_sales*t1.seller_order_exchange_rate) 'amount_sales',sum(t1.cost_product) 'cost_product',sum(t1.cost_platform_fee*t1.seller_other_exchange_rate) 'cost_platform_fee',sum(t1.cost_paypal_fee*t1.seller_order_exchange_rate) as cost_paypal_fee,sum(t1.cost_first) 'cost_first',count(t1.bailun_order_id) 'order_count',sum(t1.cost_total) 'cost_total',sum(t1.cost_logistics) 'cost_tail',sum(t1.profit_total) 'profit_total',(sum(t1.profit_total)/sum(t1.amount_sales*t1.seller_order_exchange_rate)) 'profit_rate',sum(t1.amount_prepaid) amount_prepaid,sum(t1.amount_refund*t1.seller_order_exchange_rate) amount_refund,sum(t1.cost_handle_bailun) cost_handle_bailun,sum(t1.cost_handle_platform) cost_handle_platform,count(t1.amount_prepaid>0 or null) as noshippingcount from dc_base_oms_order t1";
if (!string.IsNullOrEmpty(warehousetype))
{
......@@ -4105,7 +4105,7 @@ namespace Bailun.DC.Services
{
var sqlparam = new DynamicParameters();
var sql = @"select t1.platform_type,t1.seller_account,t1.website,sum(t1.amount_sales*t1.seller_order_exchange_rate) 'amount_sales',sum(t1.cost_product) 'cost_product',sum(t1.cost_platform_fee*t1.seller_order_exchange_rate) 'cost_platform_fee',sum(t1.cost_paypal_fee*t1.seller_order_exchange_rate) as cost_paypal_fee,sum(t1.cost_first) 'cost_first',count(t1.bailun_order_id) 'order_count',sum(t1.cost_total) 'cost_total',sum(t1.cost_tail) 'cost_tail',sum(t1.profit_total) 'profit_total',(sum(t1.profit_total)/sum(t1.amount_sales*t1.seller_order_exchange_rate)) 'profit_rate',sum(t1.amount_prepaid) amount_prepaid,sum(t1.amount_refund*t1.seller_order_exchange_rate) amount_refund,sum(t1.cost_handle_bailun) cost_handle_bailun,sum(t1.cost_handle_platform) cost_handle_platform,count(t1.amount_prepaid>0 or null) as noshippingcount,sum(t1.cost_logistics) cost_logistics from dc_base_oms_order t1";
var sql = @"select t1.platform_type,t1.seller_account,t1.website,sum(t1.amount_sales*t1.seller_order_exchange_rate) 'amount_sales',sum(t1.cost_product) 'cost_product',sum(t1.cost_platform_fee*t1.seller_order_exchange_rate) 'cost_platform_fee',sum(t1.cost_paypal_fee*t1.seller_order_exchange_rate) as cost_paypal_fee,sum(t1.cost_first) 'cost_first',count(t1.bailun_order_id) 'order_count',sum(t1.cost_total) 'cost_total',sum(t1.cost_logistics) 'cost_tail',sum(t1.profit_total) 'profit_total',(sum(t1.profit_total)/sum(t1.amount_sales*t1.seller_order_exchange_rate)) 'profit_rate',sum(t1.amount_prepaid) amount_prepaid,sum(t1.amount_refund*t1.seller_order_exchange_rate) amount_refund,sum(t1.cost_handle_bailun) cost_handle_bailun,sum(t1.cost_handle_platform) cost_handle_platform,count(t1.amount_prepaid>0 or null) as noshippingcount,sum(t1.cost_logistics) cost_logistics from dc_base_oms_order t1";
if (!string.IsNullOrEmpty(warehousetype))
{
......@@ -4224,7 +4224,7 @@ namespace Bailun.DC.Services
{
var sqlparam = new DynamicParameters();
var sql = @"select sum(t1.amount_sales*t1.seller_order_exchange_rate) 'amount_sales',sum(t1.cost_paypal_fee*t1.seller_order_exchange_rate) 'cost_paypal_fee',sum(t1.cost_product) 'cost_product',sum(t1.cost_platform_fee*t1.seller_other_exchange_rate) 'cost_platform_fee',sum(t1.cost_first) 'cost_first',count(t1.bailun_order_id) 'order_count',sum(t1.cost_total) 'cost_total',sum(t1.cost_tail) 'cost_tail',sum(t1.profit_total) 'profit_total',(sum(t1.profit_total)/sum(t1.amount_sales*t1.seller_order_exchange_rate)) 'profit_rate',sum(t1.amount_prepaid) amount_prepaid,sum(t1.amount_refund*t1.seller_order_exchange_rate) amount_refund,sum(t1.cost_handle_bailun) cost_handle_bailun,sum(t1.cost_handle_platform) cost_handle_platform,count(t1.amount_prepaid>0 or null) as noshippingcount,sum(t1.cost_logistics) cost_logistics from dc_base_oms_order t1";
var sql = @"select sum(t1.amount_sales*t1.seller_order_exchange_rate) 'amount_sales',sum(t1.cost_paypal_fee*t1.seller_order_exchange_rate) 'cost_paypal_fee',sum(t1.cost_product) 'cost_product',sum(t1.cost_platform_fee*t1.seller_other_exchange_rate) 'cost_platform_fee',sum(t1.cost_first) 'cost_first',count(t1.bailun_order_id) 'order_count',sum(t1.cost_total) 'cost_total',sum(t1.cost_logistics) 'cost_tail',sum(t1.profit_total) 'profit_total',(sum(t1.profit_total)/sum(t1.amount_sales*t1.seller_order_exchange_rate)) 'profit_rate',sum(t1.amount_prepaid) amount_prepaid,sum(t1.amount_refund*t1.seller_order_exchange_rate) amount_refund,sum(t1.cost_handle_bailun) cost_handle_bailun,sum(t1.cost_handle_platform) cost_handle_platform,count(t1.amount_prepaid>0 or null) as noshippingcount,sum(t1.cost_logistics) cost_logistics from dc_base_oms_order t1";
if (!string.IsNullOrWhiteSpace(skucategoryids))
{
......@@ -4477,8 +4477,8 @@ namespace Bailun.DC.Services
public List<dc_base_oms_order> ListDepositReceived(BtTableParameter request, string platform, string website, string account, DateTime? start, DateTime? end, int? companyid, ref int total, ref dc_base_oms_order m)
{
var sqlparam = new DynamicParameters();
var sql = "select origin_order_id,bailun_order_id,platform_type,website,seller_account,paid_time,(amount_sales*seller_order_exchange_rate) amount_sales,(amount_shipping*seller_order_exchange_rate) amount_shipping,(amount_product*seller_order_exchange_rate) amount_product,(amount_tax*seller_order_exchange_rate) amount_tax,(amount_adjustment*seller_order_exchange_rate) amount_adjustment,(amount_gift_wrap*seller_order_exchange_rate) amount_gift_wrap,(amount_refund*seller_order_exchange_rate) amount_refund,amount_prepaid,(cost_promotion*seller_order_exchange_rate) cost_promotion,(cost_platform_fee*seller_order_exchange_rate) cost_platform_fee,cost_product,cost_shipping,cost_package,(cost_fba_fee*seller_order_exchange_rate) cost_fba_fee,(cost_paypal_fee*seller_order_exchange_rate) cost_paypal_fee,(cost_refund_commisson*seller_order_exchange_rate) cost_refund_commisson,cost_handle_bailun,cost_handle_platform,cost_tail,cost_first,profit_total,profit_rate,(cost_total) cost_total from dc_base_oms_order where bailun_order_status='Handling' and bailun_shipping_status!='TotalShipping' and amount_prepaid>0 and has_scalp=0 and has_innersale=0 and bailun_interception_status in ('None','Failed') ";
var sqlcount = "select sum(amount_sales*seller_order_exchange_rate) amount_sales,sum(amount_shipping*seller_order_exchange_rate) amount_shipping,sum(amount_product*seller_order_exchange_rate) amount_product,sum(amount_tax*seller_order_exchange_rate) amount_tax,sum(amount_adjustment*seller_order_exchange_rate) amount_adjustment,sum(amount_gift_wrap*seller_order_exchange_rate) amount_gift_wrap,sum(amount_refund*seller_order_exchange_rate) amount_refund,sum(amount_prepaid) amount_prepaid,sum(cost_promotion*seller_order_exchange_rate) cost_promotion,sum(cost_platform_fee*seller_order_exchange_rate) cost_platform_fee,sum(cost_product) cost_product,sum(cost_shipping) cost_shipping,sum(cost_package) cost_package,sum(cost_fba_fee*seller_order_exchange_rate) cost_fba_fee,sum(cost_paypal_fee*seller_order_exchange_rate) cost_paypal_fee,sum(cost_refund_commisson*seller_order_exchange_rate) cost_refund_commisson,sum(cost_handle_bailun) cost_handle_bailun,sum(cost_handle_platform) cost_handle_platform,sum(cost_tail) cost_tail,sum(cost_first) cost_first,sum(profit_total) profit_total,sum(cost_total) cost_total from dc_base_oms_order where bailun_order_status='Handling' and bailun_shipping_status!='TotalShipping' and has_scalp=0 and has_innersale=0 and amount_prepaid>0 and bailun_interception_status in ('None','Failed') ";
var sql = "select origin_order_id,bailun_order_id,platform_type,website,seller_account,paid_time,(amount_sales*seller_order_exchange_rate) amount_sales,(amount_shipping*seller_order_exchange_rate) amount_shipping,(amount_product*seller_order_exchange_rate) amount_product,(amount_tax*seller_order_exchange_rate) amount_tax,(amount_adjustment*seller_order_exchange_rate) amount_adjustment,(amount_gift_wrap*seller_order_exchange_rate) amount_gift_wrap,(amount_refund*seller_order_exchange_rate) amount_refund,amount_prepaid,(cost_promotion*seller_order_exchange_rate) cost_promotion,(cost_platform_fee*seller_order_exchange_rate) cost_platform_fee,cost_product,cost_shipping,cost_package,(cost_fba_fee*seller_order_exchange_rate) cost_fba_fee,(cost_paypal_fee*seller_order_exchange_rate) cost_paypal_fee,(cost_refund_commisson*seller_order_exchange_rate) cost_refund_commisson,cost_handle_bailun,cost_handle_platform,cost_logistics as cost_tail,cost_first,profit_total,profit_rate,(cost_total) cost_total from dc_base_oms_order where bailun_order_status='Handling' and bailun_shipping_status!='TotalShipping' and amount_prepaid>0 and has_scalp=0 and has_innersale=0 and bailun_interception_status in ('None','Failed') ";
var sqlcount = "select sum(amount_sales*seller_order_exchange_rate) amount_sales,sum(amount_shipping*seller_order_exchange_rate) amount_shipping,sum(amount_product*seller_order_exchange_rate) amount_product,sum(amount_tax*seller_order_exchange_rate) amount_tax,sum(amount_adjustment*seller_order_exchange_rate) amount_adjustment,sum(amount_gift_wrap*seller_order_exchange_rate) amount_gift_wrap,sum(amount_refund*seller_order_exchange_rate) amount_refund,sum(amount_prepaid) amount_prepaid,sum(cost_promotion*seller_order_exchange_rate) cost_promotion,sum(cost_platform_fee*seller_order_exchange_rate) cost_platform_fee,sum(cost_product) cost_product,sum(cost_shipping) cost_shipping,sum(cost_package) cost_package,sum(cost_fba_fee*seller_order_exchange_rate) cost_fba_fee,sum(cost_paypal_fee*seller_order_exchange_rate) cost_paypal_fee,sum(cost_refund_commisson*seller_order_exchange_rate) cost_refund_commisson,sum(cost_handle_bailun) cost_handle_bailun,sum(cost_handle_platform) cost_handle_platform,sum(cost_logistics) cost_tail,sum(cost_first) cost_first,sum(profit_total) profit_total,sum(cost_total) cost_total from dc_base_oms_order where bailun_order_status='Handling' and bailun_shipping_status!='TotalShipping' and has_scalp=0 and has_innersale=0 and amount_prepaid>0 and bailun_interception_status in ('None','Failed') ";
if (!string.IsNullOrEmpty(platform))
{
......@@ -6762,7 +6762,7 @@ namespace Bailun.DC.Services
public List<Models.Orders.dc_base_oms_sku> ListSkuProfit_FJH_L_2(string platform, string website, DateTime? start, DateTime? end, DateTime? shipstart, DateTime? shipend, bool isUSD, int? companyid, string skucategoryids, int[] producttype, int? skusource, int? shippingstrategy, DateTime? createstart = null, DateTime? createend = null)
{
var sqlparam = new DynamicParameters();
var sql = "select tb.platform_type,count(distinct tb.bailun_order_id) order_count,sum(tb.amount_sales*" + (isUSD ? "tb.order_to_usd_exchange_rate" : "tb.seller_order_exchange_rate") + "* tb.bailun_sku_quantity_ordered) 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") + "))*tb.bailun_sku_quantity_ordered) as cost_platform_fee,sum(tb.cost_first*" + (isUSD ? "tb.cny_to_usd_exchange_rate" : "1") + "*tb.bailun_sku_quantity_ordered) as cost_first,sum(tb.cost_tail*" + (isUSD ? "tb.cny_to_usd_exchange_rate" : "1") + "*tb.bailun_sku_quantity_ordered) cost_tail,sum(tb.cost_handle_bailun*" + (isUSD ? "tb.cny_to_usd_exchange_rate" : "1") + "*tb.bailun_sku_quantity_ordered) cost_handle_bailun,sum(tb.cost_handle_platform*" + (isUSD ? "tb.cny_to_usd_exchange_rate" : "1") + "*tb.bailun_sku_quantity_ordered) cost_handle_platform,sum(tb.amount_refund*" + (isUSD ? "tb.order_to_usd_exchange_rate" : "tb.seller_order_exchange_rate") + "*tb.bailun_sku_quantity_ordered) amount_refund,sum(tb.cost_fba_fee*" + (isUSD ? "tb.order_to_usd_exchange_rate" : "tb.seller_order_exchange_rate") + "*tb.bailun_sku_quantity_ordered) cost_fba_fee,sum(tb.cost_paypal_fee*" + (isUSD ? "tb.order_to_usd_exchange_rate" : "tb.seller_order_exchange_rate") + "*tb.bailun_sku_quantity_ordered) cost_paypal_fee,sum(tb.amount_shipping*" + (isUSD ? "tb.order_to_usd_exchange_rate" : "tb.seller_order_exchange_rate") + "*tb.bailun_sku_quantity_ordered) amount_shipping,sum(tb.cost_promotion*" + (isUSD ? "tb.order_to_usd_exchange_rate" : "tb.seller_order_exchange_rate") + "*tb.bailun_sku_quantity_ordered) cost_promotion,sum(tb.cost_product*" + (isUSD ? "tb.cny_to_usd_exchange_rate" : "1") + "*tb.bailun_sku_quantity_ordered) cost_product,sum(tb.profit_total*" + (isUSD ? "tb.cny_to_usd_exchange_rate" : "1") + "*tb.bailun_sku_quantity_ordered) 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") + "*tb.bailun_sku_quantity_ordered) amount_prepaid from dc_base_oms_sku tb ";
var sql = "select tb.platform_type,count(distinct tb.bailun_order_id) order_count,sum(tb.amount_sales*" + (isUSD ? "tb.order_to_usd_exchange_rate" : "tb.seller_order_exchange_rate") + "* tb.bailun_sku_quantity_ordered) 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") + "))*tb.bailun_sku_quantity_ordered) as cost_platform_fee,sum(tb.cost_first*" + (isUSD ? "tb.cny_to_usd_exchange_rate" : "1") + "*tb.bailun_sku_quantity_ordered) as cost_first,sum(tb.cost_logistics*" + (isUSD ? "tb.cny_to_usd_exchange_rate" : "1") + "*tb.bailun_sku_quantity_ordered) cost_tail,sum(tb.cost_handle_bailun*" + (isUSD ? "tb.cny_to_usd_exchange_rate" : "1") + "*tb.bailun_sku_quantity_ordered) cost_handle_bailun,sum(tb.cost_handle_platform*" + (isUSD ? "tb.cny_to_usd_exchange_rate" : "1") + "*tb.bailun_sku_quantity_ordered) cost_handle_platform,sum(tb.amount_refund*" + (isUSD ? "tb.order_to_usd_exchange_rate" : "tb.seller_order_exchange_rate") + "*tb.bailun_sku_quantity_ordered) amount_refund,sum(tb.cost_fba_fee*" + (isUSD ? "tb.order_to_usd_exchange_rate" : "tb.seller_order_exchange_rate") + "*tb.bailun_sku_quantity_ordered) cost_fba_fee,sum(tb.cost_paypal_fee*" + (isUSD ? "tb.order_to_usd_exchange_rate" : "tb.seller_order_exchange_rate") + "*tb.bailun_sku_quantity_ordered) cost_paypal_fee,sum(tb.amount_shipping*" + (isUSD ? "tb.order_to_usd_exchange_rate" : "tb.seller_order_exchange_rate") + "*tb.bailun_sku_quantity_ordered) amount_shipping,sum(tb.cost_promotion*" + (isUSD ? "tb.order_to_usd_exchange_rate" : "tb.seller_order_exchange_rate") + "*tb.bailun_sku_quantity_ordered) cost_promotion,sum(tb.cost_product*" + (isUSD ? "tb.cny_to_usd_exchange_rate" : "1") + "*tb.bailun_sku_quantity_ordered) cost_product,sum(tb.profit_total*" + (isUSD ? "tb.cny_to_usd_exchange_rate" : "1") + "*tb.bailun_sku_quantity_ordered) 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") + "*tb.bailun_sku_quantity_ordered) amount_prepaid from dc_base_oms_sku tb ";
if (shipstart.HasValue || shipend.HasValue)
{
......
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