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)
......
...@@ -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
......
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