Commit 7ad5af44 by guanzhenshan

平台利润统计增加站点搜索

parent 60cce96b
......@@ -1369,7 +1369,7 @@ namespace Bailun.DC.Services
/// <param name="start">付款开始时间</param>
/// <param name="end">付款结束时间</param>
/// <returns></returns>
public List<Models.Orders.dc_base_oms_sku> ListPlatformProfit(string platform, 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)
{
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_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 or null) as noshippingcount,sum(tb.amount_prepaid*" + (isUSD ? "tb.cny_to_usd_exchange_rate" : "1") + ") amount_prepaid from dc_base_oms_order tb ";
......@@ -1416,6 +1416,13 @@ namespace Bailun.DC.Services
sql += " and tb.platform_type=@platform_type";
sqlparam.Add("platform_type", platform);
}
if (!string.IsNullOrWhiteSpace(website))
{
sql += " and tb.website=@website";
sqlparam.Add("website", website);
}
if (start.HasValue)
{
sql += " and tb.paid_time>=@paid_time_start";
......@@ -1463,7 +1470,7 @@ namespace Bailun.DC.Services
/// <param name="shipstart">发货开始时间</param>
/// <param name="shipend">发货结束时间</param>
/// <returns></returns>
public List<Models.Orders.dc_base_oms_sku> ListPlatformProfitByShipTime(string platform, DateTime? start, DateTime? end, DateTime? shipstart, DateTime? shipend, bool isUSD, int? companyid, string skucategoryids)
public List<Models.Orders.dc_base_oms_sku> ListPlatformProfitByShipTime(string platform,string website, DateTime? start, DateTime? end, DateTime? shipstart, DateTime? shipend, bool isUSD, int? companyid, string skucategoryids)
{
var sqlparam = new DynamicParameters();
var sql = @"select t2.platform_type,count(DISTINCT t2.bailun_order_id) order_count,sum(t2.amount_sales*" + (isUSD ? "t2.order_to_usd_exchange_rate" : "t2.seller_order_exchange_rate") + "*t1.quantity_shipped) as amount_sales,sum(t2.cost_platform_fee*(if(t2.platform_type='Ebay'," + (isUSD ? "t2.other_to_usd_exchange_rate" : "t2.seller_other_exchange_rate") + "," + (isUSD ? "t2.order_to_usd_exchange_rate" : "t2.seller_order_exchange_rate") + "))*t1.quantity_shipped) as cost_platform_fee,sum(t2.cost_first*" + (isUSD ? "t2.cny_to_usd_exchange_rate" : "1") + "*t1.quantity_shipped) as cost_first,sum(t2.cost_tail*" + (isUSD ? "t2.cny_to_usd_exchange_rate" : "1") + "*t1.quantity_shipped) cost_tail,sum(t2.cost_handle_bailun*" + (isUSD ? "t2.cny_to_usd_exchange_rate" : "1") + "*t1.quantity_shipped) cost_handle_bailun,sum(t2.cost_handle_platform*" + (isUSD ? "t2.cny_to_usd_exchange_rate" : "1") + "*t1.quantity_shipped) cost_handle_platform,sum(t2.amount_refund*" + (isUSD ? "t2.order_to_usd_exchange_rate" : "t2.seller_order_exchange_rate") + "*t1.quantity_shipped) amount_refund,sum(t2.cost_product*" + (isUSD ? "t2.cny_to_usd_exchange_rate" : "1") + "*t1.quantity_shipped) cost_product,sum(t2.profit_total*" + (isUSD ? "t2.cny_to_usd_exchange_rate" : "1") + "*t1.quantity_shipped) profit_total,(sum(t2.profit_total*" + (isUSD ? "t2.cny_to_usd_exchange_rate" : "1") + "*t1.quantity_shipped)/sum(t2.amount_sales*" + (isUSD ? "t2.order_to_usd_exchange_rate" : "t2.seller_order_exchange_rate") + "*t1.quantity_shipped)) profit_rate,count(t2.amount_prepaid>0 or null) as noshippingcount,sum(t2.amount_prepaid*" + (isUSD ? "t2.cny_to_usd_exchange_rate" : "1") + "*t1.quantity_shipped) amount_prepaid from dc_base_oms_pick t1";
......@@ -1520,6 +1527,14 @@ namespace Bailun.DC.Services
sql += " and t2.platform_type=@platform_type";
sqlparam.Add("platform_type", platform);
}
if(!string.IsNullOrWhiteSpace(website))
{
sql += " and t2.website=@website";
sqlparam.Add("website", website);
}
if (start.HasValue)
{
sql += " and t2.paid_time>=@paid_time_start";
......
......@@ -1225,7 +1225,7 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
/// <returns></returns>
[BailunAuthentication(LoginMode.Enforce)]
[HttpPost]
public JsonResult PlatformProfitCountJson(string platform, DateTime? start, DateTime? end, DateTime? shipstart, DateTime? shipend, string currency, string skucategoryids)
public JsonResult PlatformProfitCountJson(string platform,string website, DateTime? start, DateTime? end, DateTime? shipstart, DateTime? shipend, string currency, string skucategoryids)
{
var companyid = HttpContextHelper.Current?.User?.GetCompanyId().ToInt32();
......@@ -1233,15 +1233,15 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
if (shipstart.HasValue || shipend.HasValue)
{
result = new Services.OrdersServices().ListPlatformProfitByShipTime(platform, start, end, shipstart, shipend, currency.ToUpper() == "USD", companyid, skucategoryids);
result = new Services.OrdersServices().ListPlatformProfitByShipTime(platform,website, start, end, shipstart, shipend, currency.ToUpper() == "USD", companyid, skucategoryids);
var fbaResult = new Services.OrdersServices().ListPlatformProfit(string.IsNullOrEmpty(platform) ? "FBA" : "", shipstart, shipend, null, null, currency.ToUpper() == "USD", companyid, skucategoryids);
var fbaResult = new Services.OrdersServices().ListPlatformProfit(string.IsNullOrEmpty(platform) ? "FBA" : "",website, shipstart, shipend, null, null, currency.ToUpper() == "USD", companyid, skucategoryids);
result.AddRange(fbaResult);
}
else
{
result = new Services.OrdersServices().ListPlatformProfit(platform, start, end, shipstart, shipend, currency.ToUpper() == "USD", companyid, skucategoryids);
result = new Services.OrdersServices().ListPlatformProfit(platform,website,start, end, shipstart, shipend, currency.ToUpper() == "USD", companyid, skucategoryids);
}
if (result.Count > 0)
......
......@@ -35,6 +35,12 @@
</select>
</div>
<div class="form-group">
<label>站点:</label>
<select id="website" name="website" class="form-control">
<option value="">选择站点</option>
</select>
</div>
<div class="form-group">
<label>付款时间</label>
<input id="start" name="start" type="text" class="form-control" style="width:130px;" value="@(DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd"))" placeholder="付款开始时间" />
<span>至</span>
......@@ -134,6 +140,10 @@
listPlatform();
listcategory12();
$('#platform').change(function () {
listwebsite();
})
})
function list() {
......@@ -237,6 +247,29 @@
})
}
function listwebsite()
{
var p = $('#platform').val();
if (p == '') {
$('#website').html('<option value="">选择站点</option>');
return false;
}
$.submit({
url: '@Url.Content("~/Reports/Orders/ListWebSite")',
type:'POST',
paramData: 'platform=' + p,
func: function (result) {
if (result != null && result != undefined) {
$('#website').html('<option value="">选择站点</option>');
for (var i = 0; i < result.length; i++) {
$('#website').append('<option value="' + result[i] + '">' + result[i]+'</option>');
}
}
}
})
}
function ShowWebsite(platform) {
if (platform == '总计') {
return false;
......
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