Commit bcf7cc59 by guanzhenshan

增加sku来源利润统计报表

parent 88f097fb
......@@ -560,5 +560,10 @@ namespace Bailun.DC.Models.Orders
/// 产品类型
/// </summary>
public string product_type_desc { get; set; }
/// <summary>
/// sku来源
/// </summary>
public int source { get; set; }
}
}
......@@ -1528,7 +1528,7 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
/// 平台利润统计
/// </summary>
/// <returns></returns>
public ActionResult PlatformProfitCount()
public ActionResult PlatformProfitCount(int statistictype = 0)
{
var _skuService = new Services.SkuInfoServices();
......@@ -1559,6 +1559,7 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
ViewBag.listSkuType = list;
ViewBag.listSource = _skuService.ListSkuSource().Where(a=>a==1||a==3||a==6||a==7).ToList(); //精准开发,线下美容,普货供应商推荐,服务供应商推荐
ViewBag.statistictype = statistictype;
return View();
}
......@@ -1569,10 +1570,12 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
/// <param name="platform">平台类型</param>
/// <param name="start">付款开始时间</param>
/// <param name="end">付款结束时间</param>
/// <param name="skunewcategory">Sku品类</param>
/// <param name="statistictype">统计方式,0:平台类型,1:sku品类,2:sku来源</param>
/// <returns></returns>
[BailunAuthentication(LoginMode.Enforce)]
[HttpPost]
public JsonResult PlatformProfitCountJson(string platform,string website, DateTime? start, DateTime? end, DateTime? shipstart, DateTime? shipend, string currency, string skucategoryids,string product_type,int? skusource,int? shippingstrategy)
public JsonResult PlatformProfitCountJson(string platform,string website, DateTime? start, DateTime? end, DateTime? shipstart, DateTime? shipend, string currency, string skucategoryids,string product_type,int? skusource,int? shippingstrategy,string skunewcategory,int statistictype=0)
{
var _service = new Services.OrdersServices();
var companyid = HttpContextHelper.Current?.User?.GetCompanyId().ToInt32();
......@@ -1626,14 +1629,14 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
{
if (shipstart.HasValue || shipend.HasValue)
{
result = _service.ListPlatformProfitByShipTime(platform, website, start, end, shipstart, shipend, currency.ToUpper() == "USD", companyid, skucategoryids, producttype, skusource, shippingstrategy);
result = _service.ListPlatformProfitByShipTime(platform, website, start, end, shipstart, shipend, currency.ToUpper() == "USD", companyid, skucategoryids, producttype, skusource, shippingstrategy,statistictype);
var fbaResult = _service.ListPlatformProfit(string.IsNullOrEmpty(platform) ? "FBA" : "", website, null, null, null, null, currency.ToUpper() == "USD", companyid, skucategoryids, producttype, skusource, shippingstrategy, shipstart, shipend);
var fbaResult = _service.ListPlatformProfit(string.IsNullOrEmpty(platform) ? "FBA" : "", website, null, null, null, null, currency.ToUpper() == "USD", companyid, skucategoryids, producttype, skusource, shippingstrategy,statistictype,shipstart, shipend);
dtstart = shipstart;
dtend = shipend;
listRefund = _service.ListPlatformRefund(dtstart, dtend, companyid, platform, website, currency.ToUpper() == "USD", false, producttype, skusource, shippingstrategy); //不包含未发货的退款金额
listRefund = _service.ListPlatformRefund(dtstart, dtend, companyid, platform, website, currency.ToUpper() == "USD", false, producttype, skusource, shippingstrategy,statistictype); //不包含未发货的退款金额
//针对SKU FJH-L-2 做特殊处理
if (producttype.Length > 0)
......@@ -1704,8 +1707,8 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
}
else
{
result = _service.ListPlatformProfit(platform, website, start, end, shipstart, shipend, currency.ToUpper() == "USD", companyid, skucategoryids, producttype, skusource, shippingstrategy);
listRefund = _service.ListPlatformRefund(dtstart, dtend, companyid, platform, website, currency.ToUpper() == "USD", true, producttype, skusource, shippingstrategy); //包含未发货的退款金额
result = _service.ListPlatformProfit(platform, website, start, end, shipstart, shipend, currency.ToUpper() == "USD", companyid, skucategoryids, producttype, skusource, shippingstrategy,statistictype);
listRefund = _service.ListPlatformRefund(dtstart, dtend, companyid, platform, website, currency.ToUpper() == "USD", true, producttype, skusource, shippingstrategy,statistictype); //包含未发货的退款金额
//针对SKU FJH-L-2 做特殊处理
if (producttype.Length > 0)
......@@ -1748,13 +1751,17 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
}
ebayADFee = _service.EbayFeeCount(companyid, dtstart, dtend, ADfeeType, "", "", currency.ToUpper() == "USD", "",producttype,skusource,shippingstrategy);
ebayPutAway = _service.EbayFeeCount(companyid, dtstart, dtend, PutAwayFeeType, "", "", currency.ToUpper() == "USD", "",producttype,skusource,shippingstrategy);
if (statistictype == 0)
{
ebayADFee = _service.EbayFeeCount(companyid, dtstart, dtend, ADfeeType, "", "", currency.ToUpper() == "USD", "", producttype, skusource, shippingstrategy);
ebayPutAway = _service.EbayFeeCount(companyid, dtstart, dtend, PutAwayFeeType, "", "", currency.ToUpper() == "USD", "", producttype, skusource, shippingstrategy);
amazonAD = _service.ListAmazonADSkuCount("", dtstart, dtend, companyid, currency.ToUpper() == "USD",producttype,skusource,shippingstrategy);
amazonAD = _service.ListAmazonADSkuCount("", dtstart, dtend, companyid, currency.ToUpper() == "USD", producttype, skusource, shippingstrategy);
aliexpressAD = _service.ListAliexpressADCount(companyid, "", dtstart, dtend, currency.ToUpper() == "USD");
wishAD = _service.ListWishADCount(companyid, null, dtstart, dtend, currency.ToUpper() == "USD");
}
//aliexpressAD = _service.ListAliexpressADCount(companyid, "", dtstart, dtend, currency.ToUpper() == "USD");
}
......@@ -1762,7 +1769,7 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
{
if (shipstart.HasValue || shipend.HasValue)
{
result = _service.ListPlatformProfitByShipTime(platform, website, start, end, shipstart, shipend, currency.ToUpper() == "USD", companyid, skucategoryids, null, null, null);
result = _service.ListPlatformProfitByShipTime(platform, website, start, end, shipstart, shipend, currency.ToUpper() == "USD", companyid, skucategoryids, null, null, null,statistictype);
var fbaResult = _service.ListPlatformProfit(string.IsNullOrEmpty(platform) ? "FBA" : "", website, null, null, null, null, currency.ToUpper() == "USD", companyid, skucategoryids, shipstart, shipend);
......@@ -1770,12 +1777,12 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
dtstart = shipstart;
dtend = shipend;
listRefund = _service.ListPlatformRefund(dtstart, dtend, companyid, platform, website, currency.ToUpper() == "USD", false, null, null, null); //不包含未发货的退款金额
listRefund = _service.ListPlatformRefund(dtstart, dtend, companyid, platform, website, currency.ToUpper() == "USD", false, null, null, null,statistictype); //不包含未发货的退款金额
}
else
{
result = _service.ListPlatformProfit(platform, website, start, end, shipstart, shipend, currency.ToUpper() == "USD", companyid, skucategoryids);
listRefund = _service.ListPlatformRefund(dtstart, dtend, companyid, platform, website, currency.ToUpper() == "USD", true, null, null, null); //包含未发货的退款金额
result = _service.ListPlatformProfit(platform, website, start, end, shipstart, shipend, currency.ToUpper() == "USD", companyid, skucategoryids,null,null,null,statistictype);
listRefund = _service.ListPlatformRefund(dtstart, dtend, companyid, platform, website, currency.ToUpper() == "USD", true, null, null, null,statistictype); //包含未发货的退款金额
}
ebayADFee = _service.EbayFeeCount(companyid, dtstart, dtend, ADfeeType, "", "", currency.ToUpper() == "USD", "",null,null,null);
......@@ -1789,6 +1796,11 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
foreach (var item in result)
{
if (statistictype == 2)
{
item.platform_type = Enum.GetName(typeof(SkuSource), int.Parse(item.platform_type));
}
item.adfee = 0;
item.putawayfee = 0;
......@@ -1837,6 +1849,7 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
item.profit_total = (item.profit_total - item.amount_refund);
item.profit_rate = item.amount_sales!=0?Math.Round((item.profit_total / item.amount_sales), 2):0;
}
if (result.Count > 0)
......
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