Commit b8ab1ac2 by guanzhenshan

增加平台的销售统计报表

parent 5fe02029
...@@ -18,11 +18,11 @@ namespace Bailun.DC.Services ...@@ -18,11 +18,11 @@ namespace Bailun.DC.Services
var list = new List<dc_menu>(); var list = new List<dc_menu>();
var obj = new List<dc_menu>(); var obj = new List<dc_menu>();
var sql = $@"select t1.* from dc_menu t1 var sql = $@"select * from (select t1.id,t1.parentid,t1.icon,t1.`name`,t1.path,t1.sort from dc_menu t1
join dc_menu_permission t2 on t1.id = t2.menuid and t2.delstatus = 0 and t2.username = '{username}' join dc_menu_permission t2 on t1.id=t2.menuid and t2.delstatus=0 and t2.username='{username}'
where t1.delstatus = 0 where t1.delstatus=0 and t1.name='库存'
union all union all
select* from dc_menu where 1 = (select isall from dc_menu_permission where username = '{username}' and isall = 1 and delstatus = 0)"; select t1.id,t1.parentid,t1.icon,t1.`name`,t1.path,t1.sort from dc_menu t1 where 1 = (select isall from dc_menu_permission where username='{username}' and isall=1 and delstatus=0)) tb order by parentid,sort";
using (var cn = new MySqlConnection(Common.GlobalConfig.ConnectionString)) using (var cn = new MySqlConnection(Common.GlobalConfig.ConnectionString))
{ {
if (cn.State == System.Data.ConnectionState.Closed) if (cn.State == System.Data.ConnectionState.Closed)
......
...@@ -3285,6 +3285,249 @@ namespace Bailun.DC.Services ...@@ -3285,6 +3285,249 @@ namespace Bailun.DC.Services
#endregion #endregion
#region Platform Common
/// <summary>
/// 平台 销售统计记录
/// </summary>
/// <param name="parameter">分页信息</param>
/// <param name="website">站点信息</param>
/// <param name="account">帐号信息</param>
/// <param name="start">付款开始时间</param>
/// <param name="end">付款结束时间</param>
/// <param name="warehousetype">发货仓库类型</param>
/// <param name="warehousecode">发货仓库编码</param>
/// <param name="total"></param>
/// <returns></returns>
public List<Models.Orders.dc_base_oms_order> ListPlatformStatistics(BtTableParameter parameter, string platform,string website, string account, DateTime? start, DateTime? end, string warehousetype, string warehousecode, int? companyid, ref int total, string skucategoryids)
{
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";
if (!string.IsNullOrEmpty(warehousetype))
{
sql += " join dc_base_warehouse t2 on t1.warehouse_code=t2.warehouse_code and t2.warehouse_type_ex=@warehoursetype";
sqlparam.Add("warehoursetype", warehousetype);
}
if (!string.IsNullOrEmpty(warehousecode))
{
if (!string.IsNullOrEmpty(warehousetype))
{
sql += " and t2.warehouse_code=@warehouse_code";
sqlparam.Add("warehouse_code", warehousecode);
}
else
{
sql += " join dc_base_warehouse t2 on t1.warehouse_code=t2.warehouse_code and t2.warehouse_code=@warehouse_code";
sqlparam.Add("warehouse_code", warehousecode);
}
}
if (!string.IsNullOrWhiteSpace(skucategoryids))
{
sql += @" join dc_base_oms_sku t3 on t1.bailun_order_id=t3.bailun_order_id
join dc_base_sku t4 on t3.bailun_sku=t4.bailun_sku
";
var arr = skucategoryids.Split('|').Where(a => !string.IsNullOrEmpty(a)).ToList();
if (arr.Count > 0)
{
//获取选中分类下所有的分类
//var AllCategory = Services.CommonServices.GetCategoryList(0);
//var listcategory = new List<Models.Common.CategoryDto>();
//foreach (var item in arr)
//{
// listcategory.AddRange(Services.CommonServices.GetCategoryListAll(AllCategory, int.Parse(item)));
//}
var s = string.Join(",", arr);
if (!string.IsNullOrEmpty(s))
{
sql += " and t4.category_simple_id in (" + s + ") ";
}
}
}
var fromsql = " where t1.bailun_order_status!='Canceled' and t1.bailun_order_status!='CantHandle' and t1.has_scalp=0 and t1.has_innersale=0 and t1.bailun_interception_status in ('None','Failed') ";
if (!string.IsNullOrWhiteSpace(platform))
{
fromsql += " and t1.platform_type = @platform";
sqlparam.Add("platform", platform);
}
if (companyid.HasValue && companyid.Value > 0)
{
fromsql += " and t1.company_id=" + companyid.Value; //增加公司id过滤
}
if (!string.IsNullOrWhiteSpace(account))
{
fromsql += " and t1.seller_account=@seller_account";
sqlparam.Add("seller_account", account);
}
if (!string.IsNullOrWhiteSpace(website))
{
fromsql += " and t1.website=@website";
sqlparam.Add("website", website);
}
if (start.HasValue)
{
fromsql += " and t1.paid_time>='" + start.Value.ToString("yyyy-MM-dd") + "'";
}
if (end.HasValue)
{
fromsql += " and t1.paid_time<'" + end.Value.AddDays(1).ToString("yyyy-MM-dd") + "'";
}
var prefromsql = fromsql;
fromsql += " group by t1.seller_account,t1.website,t1.platform_type";
if (!string.IsNullOrWhiteSpace(parameter.sort))
{
fromsql += " order by " + parameter.sort + " " + parameter.order;
}
using (var cn = new MySqlConnection(Common.GlobalConfig.ConnectionString))
{
if (cn.State == System.Data.ConnectionState.Closed)
{
cn.Open();
}
var obj = cn.Page<Models.Orders.dc_base_oms_order>(parameter.pageIndex, parameter.limit, sql + fromsql, ref total, sqlparam);
return obj.AsList();
}
}
/// <summary>
/// 平台销售统计记录 统计
/// </summary>
/// <param name="website"></param>
/// <param name="account"></param>
/// <param name="start"></param>
/// <param name="end"></param>
/// <param name="warehousetype"></param>
/// <param name="warehousecode"></param>
/// <returns></returns>
public Models.Orders.dc_base_oms_order ListPlatformStatisticsCount(string platform, string website, string account, DateTime? start, DateTime? end, string warehousetype, string warehousecode, int? companyid, string skucategoryids)
{
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";
if (!string.IsNullOrWhiteSpace(skucategoryids))
{
sql += @" join dc_base_oms_sku t3 on t1.bailun_order_id=t3.bailun_order_id
join dc_base_sku t4 on t3.bailun_sku=t4.bailun_sku
";
var arr = skucategoryids.Split('|').Where(a => !string.IsNullOrEmpty(a)).ToList();
if (arr.Count > 0)
{
//获取选中分类下所有的分类
//var AllCategory = Services.CommonServices.GetCategoryList(0);
//var listcategory = new List<Models.Common.CategoryDto>();
//foreach (var item in arr)
//{
// listcategory.AddRange(Services.CommonServices.GetCategoryListAll(AllCategory, int.Parse(item)));
//}
var s = string.Join(",", arr);
if (!string.IsNullOrEmpty(s))
{
sql += " and t4.category_simple_id in (" + s + ") ";
}
}
}
var sqlwhere = " where t1.bailun_order_status!='Canceled' and t1.has_scalp=0 and t1.has_innersale=0 and t1.bailun_interception_status in ('None','Failed') ";
if (companyid.HasValue && companyid.Value > 0)
{
sqlwhere += " and t1.company_id=" + companyid.Value; //增加公司id过滤
}
if (!string.IsNullOrEmpty(platform))
{
if (platform.ToUpper().Trim() != "FBA")
{
sqlwhere += " and t1.bailun_order_status!='CantHandle' ";
}
sqlwhere += " and t1.platform_type=@platform ";
sqlparam.Add("platform", platform);
}
if (!string.IsNullOrEmpty(warehousetype) || (!string.IsNullOrEmpty(warehousetype) && !string.IsNullOrEmpty(warehousecode)))
{
sql += " join dc_base_oms_pick t2 on t1.origin_order_id=t2.origin_order_id " + (!string.IsNullOrEmpty(warehousecode) ? " and t2.warehouse_code=@warehousecode" : "");
sql += " join dc_base_warehouse t3 on t2.warehouse_code =t3.warehouse_code and hq_type=@warehousetype";
sqlparam.Add("warehousetype", warehousetype);
if (!string.IsNullOrEmpty(warehousecode))
{
sqlparam.Add("warehousecode", warehousecode);
}
}
else if (!string.IsNullOrEmpty(warehousecode))
{
sql += " join dc_base_oms_pick t2 on t1.origin_order_id=t2.origin_order_id and t2.warehouse_code=@warehousecode";
sqlparam.Add("warehousecode", warehousecode);
}
if (!string.IsNullOrWhiteSpace(account))
{
sqlwhere += " and t1.seller_account=@seller_account";
sqlparam.Add("seller_account", account);
}
if (!string.IsNullOrWhiteSpace(website))
{
sqlwhere += " and t1.website=@website";
sqlparam.Add("website", website);
}
if (start.HasValue)
{
sqlwhere += " and t1.paid_time>='" + start.Value.ToString("yyyy-MM-dd") + "'";
}
if (end.HasValue)
{
sqlwhere += " and t1.paid_time<'" + end.Value.AddDays(1).ToString("yyyy-MM-dd") + "'";
}
var prefromsql = sqlwhere;
using (var cn = new MySqlConnection(Common.GlobalConfig.ConnectionString))
{
if (cn.State == System.Data.ConnectionState.Closed)
{
cn.Open();
}
var obj = cn.QueryFirstOrDefault<Models.Orders.dc_base_oms_order>(sql + sqlwhere, sqlparam);
return obj;
}
}
#endregion
#region (作废)退款单 #region (作废)退款单
/// <summary> /// <summary>
......
...@@ -2862,7 +2862,7 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers ...@@ -2862,7 +2862,7 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
#region 共用统计 #region 共用统计
/// <summary> /// <summary>
/// 平台销售统计 /// 平台销售统计 按站点
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
public ActionResult StatisticsByWebsite(string platform) public ActionResult StatisticsByWebsite(string platform)
...@@ -2873,7 +2873,7 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers ...@@ -2873,7 +2873,7 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
} }
/// <summary> /// <summary>
/// 平台销售统计 /// 平台销售统计 按站点
/// </summary> /// </summary>
/// <param name="request"></param> /// <param name="request"></param>
/// <param name="platform"></param> /// <param name="platform"></param>
...@@ -2982,6 +2982,129 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers ...@@ -2982,6 +2982,129 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
}); });
} }
/// <summary>
/// 平台销售统计
/// </summary>
/// <returns></returns>
public ActionResult PlatformSaleStatistics(string platform)
{
ViewBag.platform = platform;
return View();
}
/// <summary>
/// 平台销售统计 Json
/// </summary>
/// <param name="parameter">分页信息</param>
/// <param name="platform">平台类型</param>
/// <param name="selleraccount">销售帐号</param>
/// <param name="website">站点</param>
/// <param name="start">开始时间</param>
/// <param name="end">结束时间</param>
/// <param name="warehousetype">仓库类型</param>
/// <param name="warehousecode">仓库编码</param>
/// <returns></returns>
[BailunAuthentication(LoginMode.Enforce)]
public string PlatformSaleStatisticsJson(BtTableParameter parameter, string platform,string selleraccount, string website, DateTime start, DateTime end, string warehousetype, string warehousecode, string skucategoryids)
{
var companyid = HttpContextHelper.Current?.User?.GetCompanyId().ToInt32();
var total = 0;
var services = new Services.OrdersServices();
var objwithdraw = new Services.PlatformSiteServices().GetPlatformLossWithdraw().Where(a => a.english_name == platform).FirstOrDefault();
var withdrawpercent = 0.0000M;
if (objwithdraw != null && objwithdraw.Loss_withdrawal_percent.HasValue)
{
withdrawpercent = objwithdraw.Loss_withdrawal_percent.Value;
}
//withdrawpercent = 0.025m;
var list = services.ListPlatformStatistics(parameter, platform,website, selleraccount, start, end, warehousetype, warehousecode, companyid, ref total, skucategoryids);
var countM = services.ListEbayStatisticsCount(platform, website, selleraccount, start, end, warehousetype, warehousecode, companyid, skucategoryids);
countM.seller_account = "总计:";
countM.amount_sales = Math.Round(countM.amount_sales, 2, MidpointRounding.AwayFromZero);
countM.amount_product = Math.Round(countM.amount_product, 2, MidpointRounding.AwayFromZero);
countM.cost_product = Math.Round(countM.cost_product, 2, MidpointRounding.AwayFromZero);
countM.cost_platform_fee = Math.Round(countM.cost_platform_fee, 2, MidpointRounding.AwayFromZero);
countM.cost_package = Math.Round(countM.cost_package, 2, MidpointRounding.AwayFromZero);
countM.cost_paypal_fee = Math.Round(countM.cost_paypal_fee, 2, MidpointRounding.AwayFromZero);
countM.cost_first = Math.Round(countM.cost_first, 2, MidpointRounding.AwayFromZero);
countM.loss_withdrawal = countM.amount_sales * (withdrawpercent);
countM.cost_total = Math.Round(countM.cost_total, 2, MidpointRounding.AwayFromZero);
countM.cost_shipping = Math.Round(countM.cost_shipping, 2, MidpointRounding.AwayFromZero);
countM.amount_refund = Math.Round(countM.amount_refund, 2, MidpointRounding.AwayFromZero);
countM.amount_prepaid = Math.Round(countM.amount_prepaid, 2, MidpointRounding.AwayFromZero);
countM.profit_total = Math.Round(countM.profit_total, 2, MidpointRounding.AwayFromZero);
countM.profit_rate = countM.amount_product > 0 ? Math.Round((countM.profit_total / countM.amount_product), 2, MidpointRounding.AwayFromZero) : 0;
countM.cost_tail = Math.Round(countM.cost_tail, 2, MidpointRounding.AwayFromZero);
countM.cost_handle_bailun = Math.Round(countM.cost_handle_bailun, 2, MidpointRounding.AwayFromZero);
countM.cost_logistics = Math.Round(countM.cost_logistics, 2, MidpointRounding.AwayFromZero);
var obj = list.Select(p => new
{
p.platform_type,
p.seller_account,
p.website,
amount_sales = p.amount_sales.ToString("N2"),
amount_product = p.amount_product.ToString("N2"),
cost_product = p.cost_product.ToString("N2"),
cost_platform_fee = p.cost_platform_fee.ToString("N2"),
cost_package = p.cost_package.ToString("N2"),
cost_paypal_fee = p.cost_paypal_fee.ToString("N2"),
cost_first = p.cost_first.ToString("N2"),
p.order_count,
loss_withdrawal = (p.amount_sales * withdrawpercent).ToString("N2"),
cost_total = p.cost_total.ToString("N2"),
cost_shipping = p.cost_shipping.ToString("N2"),
amount_refund = p.amount_refund.ToString("N2"),
amount_prepaid = p.amount_prepaid.ToString("N2"),
profit_total = p.profit_total.ToString("N2"),
profit_rate = (100 * p.profit_rate).ToString("N2"),
cost_tail = p.cost_tail.ToString("N2"),
cost_handle_bailun = p.cost_handle_bailun.ToString("N2"),
noshippingcount = p.noshippingcount.ToString("N0"),
cost_logistics = p.cost_logistics.ToString("N2"),
});
return JsonConvert.SerializeObject(new
{
total = total,
rows = obj,
count_row = new
{
countM.platform_type,
countM.seller_account,
countM.website,
amount_sales = countM.amount_sales.ToString("N2"),
amount_product = countM.amount_product.ToString("N2"),
cost_product = countM.cost_product.ToString("N2"),
cost_platform_fee = countM.cost_platform_fee.ToString("N2"),
cost_package = countM.cost_package.ToString("N2"),
cost_paypal_fee = countM.cost_paypal_fee.ToString("N2"),
cost_first = countM.cost_first.ToString("N2"),
countM.order_count,
loss_withdrawal = countM.loss_withdrawal.ToString("N2"),
cost_total = countM.cost_total.ToString("N2"),
cost_shipping = countM.cost_shipping.ToString("N2"),
amount_refund = countM.amount_refund.ToString("N2"),
amount_prepaid = countM.amount_prepaid.ToString("N2"),
profit_total = countM.profit_total.ToString("N2"),
profit_rate = (100 * countM.profit_rate).ToString("N2"),
cost_tail = countM.cost_tail.ToString("N2"),
cost_handle_bailun = countM.cost_handle_bailun.ToString("N2"),
noshippingcount = countM.noshippingcount.ToString("N0"),
cost_logistics = countM.cost_logistics.ToString("N2"),
}
});
}
#endregion #endregion
#region Common #region Common
......

@{
ViewData["Title"] = "PlatformSaleStatistics";
Layout = "~/Pages/Shared/_MainLayout.cshtml";
ViewBag.Nav = new string[] { "统计", ViewBag.platform, ViewBag.platform + "销售统计" };
}
<div class="row">
<div class="col-sm-12">
<div id="leftcontain" style="position:relative;float:left;width:215px;margin-right:-220px;background-color:#fff;height:780px;border-top:solid 1px #E7EAEC;display:none;">
<div id="ztree" class="ztree" style="margin:5px 10px;max-height: 800px;overflow: auto;">
</div>
</div>
<div style="float:right;width:100%;">
<div id="rightcontain">
<div class="ibox-content m-b-sm border-bottom">
<form id="toolbar">
<div class="form-inline" style="line-height:40px;">
<div class="form-group">
<label>&nbsp;</label>
<button type="button" class="btn btn-success" onclick="showleft();">分类筛选</button>
</div>
<div class="form-group">
<label>销售帐号:</label>
<select id="selleraccount" name="selleraccount" class="form-control" style="width:160px;">
<option value="">选择帐号</option>
</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>
<select id="warehousetype" name="warehousetype" class="form-control">
<option value="">选择仓库类型</option>
<option value="自发货仓">自发货仓</option>
<option value="第三方仓">第三方仓</option>
</select>
</div>
<div class="form-group">
<label>&nbsp;</label>
<select id="warehousecode" name="warehousecode" 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"))" />
<span>至</span>
<input id="end" name="end" type="text" class="form-control" style="width:130px;" value="@(DateTime.Now.ToString("yyyy-MM-dd"))" />
</div>
<div class="form-group">
<label>&nbsp;</label>
<button type="button" class="btn btn-primary" onclick="list();"><i class="fa fa-search"></i>&nbsp;查询</button>
</div>
</div>
</form>
</div>
<div class="ibox-content m-b-sm border-bottom">
<table id="roletable" style="table-layout:fixed;"></table>
</div>
</div>
</div>
</div>
</div>
@section css{
<link href="~/css/zTreeStyle/zTreeStyle.css" rel="stylesheet" type="text/css" />
<style>
.mules {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.alink {
color: cornflowerblue;
cursor: pointer;
}
</style>
}
@section scripts{
<script src="~/js/jquery.ztree.core.min.js"></script>
<script src="~/js/jquery.ztree.excheck.min.js"></script>
<script type="text/javascript">
var tb;
$(document).ready(function () {
laydate.render({ elem: '#start' });
laydate.render({ elem: '#end' });
var height = document.body.clientHeight;
$("#roletable").attr("data-height", (height - 160));
list();
listAccount();
listWebsite();
//listwarehousetype();
listwarehouse();
$('#warehousetype').change(function () {
listwarehouse();
});
//listcategory12();
listsimplecategory();
})
function list() {
var columns = [
{ field: 'platform_type', title: '平台', width: '100', sortable: false },
{
field: 'seller_account', title: '销售帐号', width: '130', sortable: false, iscount: true, formatter: function (idx, data) {
var str = '<p class="mules" title="' + data.seller_account + '">' + data.seller_account + '</p>';
return str;
}
},
//{ field: 'website', title: '站点', width: '80', sortable: false, iscount: true },
{
field: 'order_count', title: '订单数量', width: '100', sortable: true, iscount: true, formatter: function (idx, data) {
return '<span class="alink" onclick="ShowDetail(\'' + data.platform_type + '\',\'' + data.website + '\',\'' + data.seller_account + '\',\'订单数量\',\'\',0)">' + data.order_count + '</span><img style="width:16px;margin-left:3px;cursor:pointer;" src="@Url.Content("~/img/chart-icon.png")" onclick="ShowChart(\'' + data.platform_type + '\',\'' + data.website + '\',\'' + data.seller_account +'\',\'order_count\',\'订单数\');" title="点击查看曲线图">';
}
},
{
field: 'amount_sales', title: '销售额', width: '100', sortable: true, iscount: true, formatter: function (idx, data) {
return '<span class="alink" onclick="ShowDetail(\'' + data.platform_type + '\',\'' + data.website + '\',\'' + data.seller_account + '\',\'销售额\',\'amount_sales\',1)">' + data.amount_sales + '</span><img style="width:16px;margin-left:3px;cursor:pointer;" src="@Url.Content("~/img/chart-icon.png")" onclick="ShowChart(\'' + data.platform_type + '\',\'' + data.website + '\',\'' + data.seller_account +'\',\'amount_sales\',\'销售额\');" title="点击查看曲线图">';
}
},
{
field: 'cost_product', title: '产品成本', width: '100', sortable: true, iscount: true, formatter: function (idx, data) {
return '<span class="alink" onclick="ShowDetail(\'' + data.platform_type + '\',\'' + data.website + '\',\'' + data.seller_account + '\',\'产品成本\',\'cost_product\',1)">' + data.cost_product + '</span>';
}
},
{
field: 'cost_platform_fee', title: '平台费', width: '110', sortable: true, iscount: true, formatter: function (idx, data) {
return '<span class="alink" onclick="ShowDetail(\'' + data.platform_type + '\',\'' + data.website + '\',\'' + data.seller_account + '\',\'平台费\',\'cost_platform_fee\',1)">' + data.cost_platform_fee + '</span>';
}
},
{
field: 'cost_paypal_fee', title: 'paypal费用', width: '110', sortable: true, iscount: true, formatter: function (idx, data) {
return '<span class="alink" onclick="ShowDetail(\'' + data.platform_type + '\',\'' + data.website + '\',\'' + data.seller_account + '\',\'paypal费用\',\'cost_paypal_fee\',1)">' + data.cost_paypal_fee + '</span>';
}
},
{
field: 'cost_first', title: '头程费', width: '100', sortable: true, iscount: true, formatter: function (idx, data) {
return '<span class="alink" onclick="ShowDetail(\'' + data.platform_type + '\',\'' + data.website + '\',\'' + data.seller_account + '\',\'头程费\',\'cost_first\',1)">' + data.cost_first + '</span>';
}
},
//{
// field: 'cost_tail', title: '尾程费', width: '100', sortable: true, iscount: true, formatter: function (idx, data) {
// return '<span class="alink" onclick="ShowDetail(\'' + data.platform_type + '\',\'' + data.website + '\',\'' + data.seller_account + '\',\'尾程费\',\'cost_tail\',1)">' + data.cost_tail + '</span>';
// }
//},
{
field: 'cost_logistics', title: '尾程费(估算)', width: '120', sortable: true, iscount: true, formatter: function (idx, data) {
return '<span class="alink" onclick="ShowDetail(\'' + data.platform_type + '\',\'' + data.website + '\',\'' + data.seller_account + '\',\'尾程费(估算)\',\'cost_logistics\',1)">' + data.cost_logistics + '</span>';
}
},
{
field: 'cost_handle_bailun', title: '处理费', width: '100', sortable: true, iscount: true, formatter: function (idx, data) {
return '<span class="alink" onclick="ShowDetail(\'' + data.platform_type + '\',\'' + data.website + '\',\'' + data.seller_account + '\',\'处理费\',\'cost_first\',1)">' + data.cost_handle_bailun + '</span>';
}
},
{ field: 'loss_withdrawal', title: '提现损耗', width: '100', sortable: false, iscount: true },
{
field: 'cost_total', title: '总支出', width: '110', sortable: true, iscount: true, formatter: function (idx, data) {
return '<span class="alink" onclick="ShowDetail(\'' + data.platform_type + '\',\'' + data.website + '\',\'' + data.seller_account + '\',\'总支出\',\'cost_total\',1)">' + data.cost_total + '</span>';
}
},
{
field: 'amount_refund', title: '退款金额', width: '110', sortable: true, iscount: true, formatter: function (idx, data) {
return '<span class="alink" onclick="ShowDetail(\'' + data.platform_type + '\',\'' + data.website + '\',\'' + data.seller_account + '\',\'退款金额\',\'amount_refund\',1)">' + data.amount_refund + '</span>';
}
},
{
field: 'amount_prepaid', title: '预收金额', width: '120', sortable: true, iscount: true, formatter: function (idx, data) {
return '<span class="alink" onclick="ShowDetail(\'' + data.platform_type + '\',\'' + data.website + '\',\'' + data.seller_account + '\',\'预收金额\',\'amount_prepaid\',1)">' + data.amount_prepaid + '</span>';
}
},
{
field: 'noshippingcount', title: '预收订单数', width: '120', sortable: true, iscount: true
},
//{ field: 'forecast_profit_rate', title: '预测利润率%', width: '120', sortable: true },
{
field: 'profit_total', title: '实际利润', width: '120', sortable: true, iscount: true, formatter: function (idx, data) {
return '<span class="alink" onclick="ShowDetail(\'' + data.platform_type + '\',\'' + data.website + '\',\'' + data.seller_account + '\',\'实际利润\',\'profit_total\',1)">' + data.profit_total + '</span><img style="width:16px;margin-left:3px;cursor:pointer;" src="@Url.Content("~/img/chart-icon.png")" onclick="ShowChart(\'' + data.platform_type + '\',\'' + data.website + '\',\'' + data.seller_account +'\',\'profit_total\',\'利润\');" title="点击查看曲线图">';
}
},
{ field: 'profit_rate', title: '总实际利润率%', width: '130', sortable: true, iscount: true },
];
var s = '';
try {
s = getChkNode();
} catch (e) {
s = '';
}
var url = '@Url.Content("~/Reports/Orders/PlatformSaleStatisticsJson")' + '?' + $("#toolbar").serialize() + '&skucategoryids=' + s +'&platform=@(ViewBag.platform)';
if (tb == undefined) {
tb = OnlyTable("roletable", columns, url, "", { showfooter: true, showCount: true });
}
else {
tb.bootstrapTable('refresh', { url: url });
}
}
function listAccount() {
$.submit({
url: '@Url.Content("~/Reports/Orders/ListAccount")',
type:'POST',
paramData: 'platform=@(ViewBag.platform)',
func: function (result) {
if (result != null && result != undefined) {
$('#selleraccount').html('<option value="">选择帐号</option>');
for (var i = 0; i < result.length; i++) {
if (result[i] != '') {
$('#selleraccount').append('<option value="' + result[i] + '">' + result[i] + '</option>');
}
}
}
}
})
}
function listWebsite() {
$.submit({
url: '@Url.Content("~/Reports/Orders/ListWebSite")',
type:'POST',
paramData: 'platform=@(ViewBag.platform)',
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 listwarehousetype() {
$.submit({
url: '@Url.Content("~/Home/ListWarehouseType")',
type: 'POST',
paramData: '',
func: function (result) {
if (result != null && result != undefined) {
$('#warehousetype').html('<option value="">选择仓库类型</option>');
for (var i in result) {
if (result[i].indexOf('FBA') < 0) {
$('#warehousetype').append('<option value="' + result[i] + '">' + result[i] + '</option>');
}
}
}
}
})
}
function listwarehouse() {
var type = $('#warehousetype').val();
if (type == '') {
$('#warehousecode').html('<option value="">请选择仓库</option>');
return false;
}
$.submit({
url: '@Url.Content("~/Home/ListWarehouseByExtType")',
type: 'POST',
paramData: 'type=' + type,
func: function (result) {
if (result != null && result != undefined) {
$('#warehousecode').html('<option value="">请选择仓库</option>');
for (var i = 0; i < result.length; i++) {
$('#warehousecode').append('<option value="' + result[i].code + '">' + result[i].name + '</option>');
}
}
}
})
}
function ShowDetail(platform, website, account, coltitle, colval, single) {
layer_show(platform + " " + website + " " + $('#start').val() + "至" + $('#end').val() + ' 订单明细', '@Url.Content("~/Reports/Orders/ListOrderDetail?platform=")' + platform + '&website=' + website + '&account=' + account + '&start=' + $('#start').val() + '&end=' + $('#end').val() + '&col=' + colval + '&coltitle=' + coltitle + '&showsingle=' + single, '90%', '90%');
}
function showleft() {
var c = $('#leftcontain').css('display');
if (c == 'none') {
$('#leftcontain').css('display', 'inline');
$("#rightcontain").animate({ marginLeft: "220px" });
}
else {
$('#leftcontain').css('display', 'none');
$("#rightcontain").animate({ marginLeft: "0px" });
}
}
function listcategory12() {
$.submit({
url: '@Url.Content("~/Reports/Orders/ListSkuCategoryOneAndSecondLevel")',
paramData: '',
type: 'POST',
func: function (result) {
var setting = {
check: {
chkStyle:'checkbox',
enable: true
}
};
zTreeObj = $.fn.zTree.init($("#ztree"), setting, eval('('+result+')'));
}
})
}
function listsimplecategory() {
$.submit({
url: '@Url.Content("~/Home/ListSimpleCategory")',
paramData: '',
type: 'POST',
func: function (result) {
var setting = {
check: {
chkStyle: 'checkbox',
enable: true
}
};
zTreeObj = $.fn.zTree.init($("#ztree"), setting, result);
}
})
}
function getChkNode() {
var s = '';
var o = $.fn.zTree.getZTreeObj("ztree");
var nodes = o.getCheckedNodes();
for (var i in nodes) {
if (nodes[i].children == null || nodes[i].children.length <= 0) {
s += (nodes[i].id) + '|';
}
}
return s;
}
function ShowChart(platform, website, account, colval,title)
{
var warehousetype = $('#warehousetype').val();
var warehousecode = $('#warehousecode').val();
layer_show(platform + " " + website + " " + account + ' 曲线图', '@Url.Content("~/Reports/Orders/OrderSalesGraph?platform=")' + platform + '&website=' + website + '&sellaccount=' + account + '&start=' + $('#start').val() + '&end=' + $('#end').val() + '&col=' + colval + '&titlename=' + title + '&warehousetype=' + warehousetype + '&warehousecode=' + warehousecode, '90%', '90%');
}
</script>
}
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