Commit dcc4bea6 by guanzhenshan

增加sku利润报表

parent ff8e5e10
using System;
using System.Collections.Generic;
using System.Text;
namespace Bailun.DC.Models.Orders
{
/// <summary>
/// 按Sku百伦简短分类显示
/// </summary>
public class mSkuCategoryProfit
{
/// <summary>
/// 汇总数
/// </summary>
public decimal count { get; set; }
/// <summary>
/// 平台
/// </summary>
public string platform_type { get; set; }
/// <summary>
/// 百伦简短分类id
/// </summary>
public int category_simple_id { get; set; }
/// <summary>
/// 百伦简短分类名称
/// </summary>
public string category_simple_name { get; set; }
}
}
......@@ -2256,6 +2256,63 @@ namespace Bailun.DC.Services
}
/// <summary>
/// 获取Sku分类利润
/// </summary>
/// <param name="start">开始日期</param>
/// <param name="end">结束日期</param>
/// <param name="colname">需要统计的字段</param>
/// <returns></returns>
public List<mSkuCategoryProfit> ListSkuCategoryProfit(string platform,DateTime start, DateTime end, string colname,string skucategoryids)
{
using (var cn = new MySqlConnection(Common.GlobalConfig.ConnectionString))
{
if (cn.State == System.Data.ConnectionState.Closed)
{
cn.Open();
}
var sqlwhere = "";
var sqlparam = new DynamicParameters();
var showcol = "";
var selcol = "";
if (colname.Trim() == "amount_sales" || colname.Trim() == "cost_platform_fee")
{
showcol = $"sum(t0.{colname.Trim()})";
selcol = $"(t1.{colname.Trim()}*t1.bailun_sku_quantity_shipped*t1.seller_order_exchange_rate) as {colname.Trim()}";
}
else if (colname.Trim() == "order_count")
{
showcol = $"count(distinct t0.bailun_order_id)";
selcol = $"t1.bailun_order_id";
}
else if (colname.Trim() == "noshippingcount")
{
showcol = $"count(amount_prepaid)";
selcol = "(if(t1.amount_prepaid>0,t1.amount_prepaid,null)) amount_prepaid";
}
else
{
showcol = $"sum(t0.{colname.Trim()})";
selcol = $"t1.{colname.Trim()}";
}
if (!string.IsNullOrEmpty(platform))
{
sqlwhere += " and t1.platform_type=@platform_type";
sqlparam.Add("platform_type", platform);
}
var sql = $@"select {showcol} as count,t0.platform_type,t2.category_simple_id,t2.category_simple_name from (select t1.bailun_sku,{selcol},platform_type from dc_base_oms_sku t1 where t1.has_scalp=0 and t1.has_delete=0 and t1.has_innersale=0 and t1.bailun_order_status!='Canceled' and t1.has_innersale=0 and t1.bailun_interception_status in ('None','Failed') and t1.company_id=1 and ((t1.platform_type!='FBA' and t1.bailun_order_status!='CantHandle') or t1.platform_type='FBA')
and t1.paid_time >= '{start.ToString("yyyy-MM-dd HH:mm:ss")}' and t1.paid_time < '{end.AddDays(1).ToString("yyyy-MM-dd HH:mm:ss")}' {sqlwhere}) t0
left join dc_base_sku t2 on t0.bailun_sku = t2.bailun_sku
group by t0.platform_type,t2.category_simple_id";
var obj = cn.Query<mSkuCategoryProfit>(sql, sqlparam, null, true, 2 * 60).AsList();
return obj;
}
}
#endregion
......@@ -3386,7 +3443,7 @@ namespace Bailun.DC.Services
/// <returns></returns>
public List<dc_base_oms_sku> ListOrderSkuProfit(int page, int pagesize, DateTime start, DateTime end)
{
var sql = $@"select t1.id,t2.warehouse_code,((((t1.amount_product-t1.cost_platform_fee)*t1.seller_order_exchange_rate)-t1.cost_logistics-t1.cost_handle_bailun)*t2.quantity_shipped) as productvalue, t1.platform_type,t1.seller_account,t1.bailun_account_id,t1.website,t1.bailun_order_id,t1.origin_order_id,t1.transaction_id,t1.paid_time,t1.gmt_modified,t1.bailun_sku,(t1.amount_sales*t1.seller_order_exchange_rate*t2.quantity_shipped) amount_sales,t1.profit_total,t2.quantity_shipped as platform_sku_quantity_shipped,t1.company_id,t2.pick_order_id,t2.shipping_time,t2.has_delete
var sql = $@"select t1.id,t2.warehouse_code,((((t1.amount_product-t1.cost_platform_fee)*t1.seller_order_exchange_rate)-t1.cost_logistics-t1.cost_handle_bailun)*t2.quantity_shipped) as productvalue, t1.platform_type,t1.seller_account,t1.bailun_account_id,t1.website,t1.bailun_order_id,t1.origin_order_id,t1.transaction_id,t1.paid_time,t1.gmt_modified,t1.bailun_sku,(t1.amount_sales*t1.seller_order_exchange_rate*t2.quantity_shipped) amount_sales,(t1.profit_total*t2.quantity_shipped) profit_total,t2.quantity_shipped as platform_sku_quantity_shipped,t1.company_id,t2.pick_order_id,t2.shipping_time,t2.has_delete
from dc_base_oms_sku t1
join dc_base_oms_pick t2 on t1.bailun_order_id = t2.bailun_order_id and t1.bailun_sku = t2.bailun_sku and t2.shipping_time >= '{start.ToString("yyyy-MM-dd HH:mm:ss")}' and t2.shipping_time < '{end.ToString("yyyy-MM-dd HH:mm:ss")}' and t2.shipping_status = 'TotalShipping' and t2.company_id = 1
where t1.bailun_order_status != 'Canceled' and t1.has_scalp = 0 and t1.bailun_order_status != 'CantHandle' and t1.has_scalp = 0 and t1.has_innersale = 0 and t1.company_id = 1 and t1.has_delete = 0 and t1.bailun_interception_status in ('None','Failed') ";
......
......@@ -7,23 +7,23 @@ namespace Bailun.DC.SkuProfitService
{
class Program
{
static async Task Main(string[] args)
{
Console.WriteLine("启动服务 " + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
var builder = new HostBuilder().ConfigureServices((hostContext, services) =>
{
services.AddHostedService<Services>();
});
await builder.RunConsoleAsync();
}
//static void Main(string[] args)
//static async Task Main(string[] args)
//{
// Console.WriteLine("启动服务 " + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
// var builder = new HostBuilder().ConfigureServices((hostContext, services) =>
// {
// services.AddHostedService<Services>();
// });
// var _service = new Services();
// _service.Save();
// await builder.RunConsoleAsync();
//}
static void Main(string[] args)
{
Console.WriteLine("启动服务 " + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
var _service = new Services();
_service.Save();
}
}
}
......@@ -1648,6 +1648,95 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
}
/// <summary>
/// 获取sku分类利润
/// </summary>
/// <param name="start">开始时间</param>
/// <param name="end">结束时间</param>
/// <param name="colname">计算列</param>
/// <param name="skucategoryids">sku分类</param>
/// <returns></returns>
public ActionResult SkuCategoryProfit(DateTime start,DateTime end,string colname,string coltitle,string skucategoryids,string platform)
{
var obj = new Services.OrdersServices().ListSkuCategoryProfit(platform,start, end, colname, skucategoryids);
var listplatform = obj.Select(a => a.platform_type).Distinct().ToList();
var listcategory = obj.Select(a => a.category_simple_name).Distinct().OrderBy(a=>a).ToArray();
var listval = new List<Tuple<string,List<decimal>>>();
foreach (var item in obj)
{
var val_item = listval.Where(a => a.Item1 == item.platform_type).FirstOrDefault();
if (val_item == null)
{
var itemvals = new List<decimal>();
foreach (var i in listcategory)
{
itemvals.Add(0);
}
val_item = new Tuple<string, List<decimal>>(item.platform_type, itemvals);
}
for (var i = 0; i < listcategory.Count(); i++)
{
if (item.category_simple_name == listcategory[i])
{
val_item.Item2[i] += item.count;
}
}
listval.Remove(val_item);
listval.Add(val_item);
}
var countval = new List<decimal>();
foreach (var i in listcategory)
{
countval.Add(0);
}
foreach (var item in listval)
{
for (var i = 0; i < item.Item2.Count; i++)
{
countval[i] += item.Item2[i];
}
}
var countitem = new Tuple<string, List<decimal>>("合计", countval);
//格式化数字
foreach (var item in listval)
{
for (var i=0;i<item.Item2.Count;i++)
{
item.Item2[i] = Math.Round(item.Item2[i], 2);
}
}
for (var i= 0;i<countitem.Item2.Count;i++)
{
countitem.Item2[i] = Math.Round(countitem.Item2[i], 2);
}
ViewBag.header = listcategory;
ViewBag.vals = listval;
ViewBag.count = countitem;
ViewBag.start = start;
ViewBag.end = end;
ViewBag.colname = colname;
ViewBag.skucategoryids = skucategoryids;
ViewBag.platform = platform;
ViewBag.coltitle = coltitle;
ViewBag.single = (colname == "order_count" || colname == "amount_sales" ? 0 : 1);
return View();
}
#endregion
......
......@@ -570,7 +570,7 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
quantity_purchase = a.quantity_purchase.ToString("N0"),
quantity_purchase_amount = a.quantity_purchase_amount.ToString("N2"),
quantity_transfer = a.quantity_transfer.ToString("N0"),
quantity_transfer_amount = (a.quantity_transfer_amount * 100).ToString("N2"),
quantity_transfer_amount = (a.quantity_transfer_amount).ToString("N2"),
usable_stock = a.usable_stock.ToString("N0"),
usable_stock_amount = (a.usable_stock_amount).ToString("N2"),
yd_grossprofit = (a.yd_grossprofit).ToString("N2"),
......@@ -607,7 +607,7 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
quantity_purchase = countObj.quantity_purchase.ToString("N0"),
quantity_purchase_amount = countObj.quantity_purchase_amount.ToString("N2"),
quantity_transfer = countObj.quantity_transfer.ToString("N0"),
quantity_transfer_amount = (countObj.quantity_transfer_amount * 100).ToString("N2"),
quantity_transfer_amount = (countObj.quantity_transfer_amount).ToString("N2"),
usable_stock = countObj.usable_stock.ToString("N0"),
usable_stock_amount = (countObj.usable_stock_amount).ToString("N2"),
yd_grossprofit = (countObj.yd_grossprofit).ToString("N2"),
......
......@@ -112,6 +112,8 @@
cursor: pointer;
}
.skuprofit{color:#1D84C6;cursor: pointer;}
.tablesorter-headerDesc {
background-position: right;
background-repeat: no-repeat;
......@@ -187,28 +189,28 @@
$('#tb').html('');
$('#footer').html('');
for (var i = 0; i < result.length-1; i++) {
var s = '<tr><td class="platform"><a href="javascript:;" onclick="ShowWebsite(\'' + result[i].platform_type + '\');">' + result[i].platform_type + '</a></td>';
s += '<td class="alink"><a href="javascript:;" onclick="ShowDetail(\'' + result[i].platform_type + '\',\'订单数\',\'\',0)" >' + result[i].order_count + '</a></td>';
var s = '<tr><td class="platform"><a href="javascript:;" onclick="ShowWebsite(\'' + result[i].platform_type + '\');" title="查看订单明细">' + result[i].platform_type + '</a></td>';
s += '<td class="skuprofit" onclick="ShowSkuProfit(\'' + result[i].platform_type + '\',\'订单数\',\'order_count\',0)" title="查看sku分类利润">' + result[i].order_count + '</td>';
s += '<td><img style="width:16px;margin-left:3px" src="@Url.Content("~/img/chart-icon.png")" onclick="ShowChart(\'' + result[i].platform_type + '\',\'订单数\',\'order_count\');" title="点击查看订单数曲线图"></td>';
s += '<td class="alink"><a href="javascript:;" onclick="ShowDetail(\'' + result[i].platform_type + '\',\'销售额\',\'amount_sales\',0)"> ' + result[i].amount_sales + '</a></td>';
s += '<td class="skuprofit" onclick="ShowSkuProfit(\'' + result[i].platform_type + '\',\'销售额\',\'amount_sales\',0)" title="查看sku分类利润"> ' + result[i].amount_sales + '</td>';
s += '<td><img style="width:16px;margin-left:3px" src="@Url.Content("~/img/chart-icon.png")" onclick="ShowChart(\'' + result[i].platform_type + '\',\'销售额\',\'amount_sales\');" title="点击查看销售额曲线图"></td>';
s += '<td class="alink" onclick="ShowDetail(\'' + result[i].platform_type + '\',\'产品成本\',\'cost_product\',1)">' + result[i].cost_product + '</td>';
s += '<td class="skuprofit" onclick="ShowSkuProfit(\'' + result[i].platform_type + '\',\'产品成本\',\'cost_product\',1)" title="查看sku分类利润">' + result[i].cost_product + '</td>';
s += '<td>' + result[i].customerprice + '</td>';
s += '<td class="alink" onclick="ShowDetail(\'' + result[i].platform_type + '\',\'平台费用\',\'cost_platform_fee\',1)">' + result[i].cost_platform_fee + '</td>';
s += '<td class="alink" onclick="ShowDetail(\'' + result[i].platform_type + '\',\'FBA费\',\'cost_fba_fee\',1)">' + result[i].cost_fba_fee + '</td>';
s += '<td class="alink" onclick="ShowDetail(\'' + result[i].platform_type + '\',\'PayPal费\',\'cost_paypal_fee\',1)">' + result[i].cost_paypal_fee + '</td>';
s += '<td class="alink" onclick="ShowDetail(\'' + result[i].platform_type + '\',\'头程费\',\'cost_first\',1)">' + result[i].cost_first + '</td>';
s += '<td class="alink" onclick="ShowDetail(\'' + result[i].platform_type + '\',\'尾程费\',\'cost_tail\',1)">' + result[i].cost_tail + '</td>';
s += '<td class="alink" onclick="ShowDetail(\'' + result[i].platform_type + '\',\'处理费\',\'cost_handle_bailun\',1)">' + result[i].cost_handle_bailun + '</td>';
s += '<td class="alink" onclick="ShowDetail(\'' + result[i].platform_type + '\',\'平台操作费\',\'cost_handle_platform\',1)">' + result[i].cost_handle_platform + '</td>';
s += '<td class="skuprofit" onclick="ShowSkuProfit(\'' + result[i].platform_type + '\',\'平台费用\',\'cost_platform_fee\',1)" title="查看sku分类利润">' + result[i].cost_platform_fee + '</td>';
s += '<td class="alink" onclick="ShowDetail(\'' + result[i].platform_type + '\',\'FBA费\',\'cost_fba_fee\',1)" title="查看订单明细">' + result[i].cost_fba_fee + '</td>';
s += '<td class="alink" onclick="ShowDetail(\'' + result[i].platform_type + '\',\'PayPal费\',\'cost_paypal_fee\',1)" title="查看订单明细">' + result[i].cost_paypal_fee + '</td>';
s += '<td class="skuprofit" onclick="ShowSkuProfit(\'' + result[i].platform_type + '\',\'头程费\',\'cost_first\',1)" title="查看sku分类利润">' + result[i].cost_first + '</td>';
s += '<td class="skuprofit" onclick="ShowSkuProfit(\'' + result[i].platform_type + '\',\'尾程费\',\'cost_tail\',1)" title="查看sku分类利润">' + result[i].cost_tail + '</td>';
s += '<td class="alink" onclick="ShowDetail(\'' + result[i].platform_type + '\',\'处理费\',\'cost_handle_bailun\',1)" title="查看订单明细">' + result[i].cost_handle_bailun + '</td>';
s += '<td class="alink" onclick="ShowDetail(\'' + result[i].platform_type + '\',\'平台操作费\',\'cost_handle_platform\',1)" title="查看订单明细">' + result[i].cost_handle_platform + '</td>';
s += '<td>' + result[i].adfee + '</td>';
s += '<td>' + result[i].putawayfee + '</td>';
s += '<td class="alink" onclick="ShowDetail(\'' + result[i].platform_type + '\',\'预收款\',\'amount_prepaid\',1)">' + result[i].amount_prepaid + '</td>';
s += '<td class="alink">' + result[i].noshippingcount + '</td>';
s += '<td class="alink"><a href="javascript:;" onclick="ShowDetail(\'' + result[i].platform_type + '\',\'利润\',\'profit_total\',1)">' + result[i].profit_total + '</a></td>';
s += '<td class="skuprofit" onclick="ShowSkuProfit(\'' + result[i].platform_type + '\',\'预收款\',\'amount_prepaid\',1)" title="查看sku分类利润">' + result[i].amount_prepaid + '</td>';
s += '<td class="skuprofit" onclick="ShowSkuProfit(\'' + result[i].platform_type + '\',\'预收订单数\',\'noshippingcount\',1)" title="查看sku分类利润">' + result[i].noshippingcount + '</td>';
s += '<td class="skuprofit" onclick="ShowSkuProfit(\'' + result[i].platform_type + '\',\'利润\',\'profit_total\',1)" title="查看sku分类利润">' + result[i].profit_total + '</td>';
s += '<td><img style="width:16px;margin-left:3px" src="@Url.Content("~/img/chart-icon.png")" onclick="ShowChart(\'' + result[i].platform_type + '\',\'利润\',\'profit_total\');" title="点击查看利润曲线图"></td>';
s += '<td>' + result[i].profit_rate + '</td>';
s += '<td class="alink" onclick="ShowDetail(\'' + result[i].platform_type + '\',\'退款金额\',\'amount_refund\',1)">' + result[i].amount_refund + '</td>';
s += '<td class="alink" onclick="ShowDetail(\'' + result[i].platform_type + '\',\'退款金额\',\'amount_refund\',1)" title="查看订单明细">' + result[i].amount_refund + '</td>';
s += '<td>' + result[i].amount_refund_rate + '</td>';
$('#tb').append(s);
}
......@@ -218,28 +220,29 @@
var i = result.length - 1;
var foot_s = '<tr><td class="platform"><a href="javascript:;" onclick="ShowWebsite(\'' + result[i].platform_type + '\');">' + result[i].platform_type + '</a></td>';
foot_s += '<td class="alink"><a href="javascript:;" onclick="ShowDetail(\'' + result[i].platform_type + '\',\'订单数\',\'\',0)" >' + result[i].order_count + '</a></td>';
foot_s += '<td class="skuprofit" onclick="ShowSkuProfit(\'\',\'订单数\',\'order_count\',0)" title="查看sku分类利润">' + result[i].order_count + '</td>';
foot_s += '<td><img style="width:16px;margin-left:3px" src="@Url.Content("~/img/chart-icon.png")" onclick="ShowChart(\'\',\'订单数\',\'order_count\');" title="点击查看曲线图"></td>';
foot_s += '<td class="alink"><a href="javascript:;" onclick="ShowDetail(\'' + result[i].platform_type + '\',\'销售额\',\'amount_sales\',0)"> ' + result[i].amount_sales + '</a></td>';
foot_s += '<td class="skuprofit" onclick="ShowSkuProfit(\'\',\'销售额\',\'amount_sales\',0)" title="查看sku分类利润"> ' + result[i].amount_sales + '</td>';
foot_s += '<td><img style="width:16px;margin-left:3px" src="@Url.Content("~/img/chart-icon.png")" onclick="ShowChart(\'\',\'销售额\',\'amount_sales\');" title="点击查看曲线图"></td>';
foot_s += '<td class="alink" onclick="ShowDetail(\'' + result[i].platform_type + '\',\'产品成本\',\'cost_product\',1)">' + result[i].cost_product + '</td>';
foot_s += '<td class="skuprofit" onclick="ShowSkuProfit(\'\',\'产品成本\',\'cost_product\',1)" title="查看sku分类利润">' + result[i].cost_product + '</td>';
foot_s += '<td>' + result[i].customerprice + '</td>';
foot_s += '<td class="alink" onclick="ShowDetail(\'' + result[i].platform_type + '\',\'平台费用\',\'cost_platform_fee\',1)">' + result[i].cost_platform_fee + '</td>';
foot_s += '<td class="skuprofit" onclick="ShowSkuProfit(\'\',\'平台费用\',\'cost_platform_fee\',1)" title="查看sku分类利润">' + result[i].cost_platform_fee + '</td>';
foot_s += '<td class="alink" onclick="ShowDetail(\'' + result[i].platform_type + '\',\'FBA费\',\'cost_fba_fee\',1)">' + result[i].cost_fba_fee + '</td>';
foot_s += '<td class="alink" onclick="ShowDetail(\'' + result[i].platform_type + '\',\'PayPal费\',\'cost_paypal_fee\',1)">' + result[i].cost_paypal_fee + '</td>';
foot_s += '<td class="alink" onclick="ShowDetail(\'' + result[i].platform_type + '\',\'头程费\',\'cost_first\',1)">' + result[i].cost_first + '</td>';
foot_s += '<td class="alink" onclick="ShowDetail(\'' + result[i].platform_type + '\',\'尾程费\',\'cost_tail\',1)">' + result[i].cost_tail + '</td>';
foot_s += '<td class="skuprofit" onclick="ShowSkuProfit(\'\',\'头程费\',\'cost_first\',1)" title="查看sku分类利润">' + result[i].cost_first + '</td>';
foot_s += '<td class="skuprofit" onclick="ShowSkuProfit(\'\',\'尾程费\',\'cost_tail\',1)" title="查看sku分类利润">' + result[i].cost_tail + '</td>';
foot_s += '<td class="alink" onclick="ShowDetail(\'' + result[i].platform_type + '\',\'处理费\',\'cost_handle_bailun\',1)">' + result[i].cost_handle_bailun + '</td>';
foot_s += '<td class="alink" onclick="ShowDetail(\'' + result[i].platform_type + '\',\'平台操作费\',\'cost_handle_platform\',1)">' + result[i].cost_handle_platform + '</td>';
foot_s += '<td>' + result[i].adfee + '</td>';
foot_s += '<td>' + result[i].putawayfee + '</td>';
foot_s += '<td class="alink" onclick="ShowDetail(\'' + result[i].platform_type + '\',\'预收款\',\'amount_prepaid\',1)">' + result[i].amount_prepaid + '</td>';
foot_s += '<td class="alink">' + result[i].noshippingcount + '</td>';
foot_s += '<td class="alink"><a href="javascript:;" onclick="ShowDetail(\'' + result[i].platform_type + '\',\'利润\',\'profit_total\',1)">' + result[i].profit_total + '</a></td>';
foot_s += '<td class="skuprofit" onclick="ShowSkuProfit(\'\',\'预收款\',\'amount_prepaid\',1)" title="查看sku分类利润">' + result[i].amount_prepaid + '</td>';
foot_s += '<td class="skuprofit" onclick="ShowSkuProfit(\'\',\'预收订单数\',\'noshippingcount\',1)" title="查看sku分类利润">' + result[i].noshippingcount + '</td>';
foot_s += '<td class="skuprofit" onclick="ShowDetail(\'' + result[i].platform_type + '\',\'利润\',\'profit_total\',1)">' + result[i].profit_total + '</td>';
foot_s += '<td><img style="width:16px;margin-left:3px" src="@Url.Content("~/img/chart-icon.png")" onclick="ShowChart(\'\',\'利润\',\'profit_total\');" title="点击查看曲线图"></td>';
foot_s += '<td>' + result[i].profit_rate + '</td>';
foot_s += '<td class="alink" onclick="ShowDetail(\'' + result[i].platform_type + '\',\'退款金额\',\'amount_refund\',1)">' + result[i].amount_refund + '</td>';
foot_s += '<td>' + result[i].amount_refund_rate + '</td>';
foot_s += '</tr>';
$('#footer').append(foot_s);
}
else {
......@@ -307,6 +310,12 @@
layer_show(platform + " " + $('#start').val() + "至" + $('#end').val() + ' 订单明细', '@Url.Content("~/Reports/Orders/ListOrderDetail?platform=")' + platform + '&start=' + $('#start').val() + '&end=' + $('#end').val() + '&col=' + colval + '&coltitle=' + coltitle + '&showsingle=' + single + '&shipstart=' + $('#shipstart').val() + '&shipend=' + $('#shipend').val(), '90%', '90%');
}
function ShowSkuProfit(platform, coltitle, colval) {
var start = $('#start').val();
var end = $('#end').val();
layer_show(platform + " " + coltitle + " " + $('#start').val() + "至" + $('#end').val() + ' 的SKU分类利润', '@Url.Content("~/Reports/Orders/SkuCategoryProfit?start=")' + start + '&end=' + end + '&colname=' + colval + '&platform=' + platform + '&coltitle=' + coltitle, '95%', '95%');
}
function showleft() {
var c = $('#leftcontain').css('display');
......

@{
ViewData["Title"] = "SKU分类统计";
Layout = "~/Pages/Shared/_MainLayout.cshtml";
ViewBag.Nav = new string[] { "统计", "平台利润统计", "Sku分类利润统计" };
}
<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>付款时间</label>
<input id="start" name="start" type="text" class="form-control" style="width:130px;" value="@(ViewBag.start.ToString("yyyy-MM-dd"))" placeholder="付款开始时间" />
<span>至</span>
<input id="end" name="end" type="text" class="form-control" style="width:130px;" value="@(ViewBag.end.ToString("yyyy-MM-dd"))" placeholder="付款结束时间" />
</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" class="table table-hover table-bordered table-condensed table-striped">
<thead>
<tr>
@if (ViewBag.header.Length > 0)
{
<th>平台类型</th>
foreach (var item in ViewBag.header)
{
<th>@(item==""?"无分类":item)</th>
}
}
</tr>
</thead>
<tbody id="tb">
@if (ViewBag.vals.Count > 0)
{
foreach (var item in ViewBag.vals)
{
<tr>
<td>@item.Item1</td>
@foreach (var i in item.Item2)
{
<td class="alink" onclick="ShowDetail('@item.Item1')">@i.ToString("N2")</td>
}
</tr>
}
}
</tbody>
<tfoot id="footer">
<tr>
@if (ViewBag.count != null)
{
<td>@(ViewBag.count.Item1)</td>
@foreach (var i in ViewBag.count.Item2)
{
<td class="alink" onclick="ShowDetail('@ViewBag.count.Item1')">@i.ToString("N2")</td>
}
}
</tr>
</tfoot>
</table>
</div>
@section css{
<style>
.mules {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.alink {
color: cornflowerblue;
cursor: pointer;
}
thead tr .tablesorter-headerDesc {
background-position: right;
background-repeat: no-repeat;
padding-right: 30px;
background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABMAAAATCAYAAAByUDbMAAAAZUlEQVQ4y2NgGAWjYBSggaqGu5FA/BOIv2PBIPFEUgxjB+IdQPwfC94HxLykus4GiD+hGfQOiB3J8SojEE9EM2wuSJzcsFMG4ttQgx4DsRalkZENxL+AuJQaMcsGxBOAmGvopk8AVz1sLZgg0bsAAAAASUVORK5CYII=' );
}
thead tr .tablesorter-headerAsc {
background-position: right;
background-repeat: no-repeat;
padding-right: 30px;
background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABMAAAATCAYAAAByUDbMAAAAZ0lEQVQ4y2NgGLKgquEuFxBPAGI2ahhWCsS/gDibUoO0gPgxEP8H4ttArEyuQYxAPBdqEAxPBImTY5gjEL9DM+wTENuQahAvEO9DMwiGdwAxOymGJQLxTyD+jgWDxCMZRsEoGAVoAADeemwtPcZI2wAAAABJRU5ErkJggg==');
}
</style>
}
@section scripts{
<script src="~/js/jquery.ztree.core.min.js"></script>
<script src="~/js/jquery.ztree.excheck.min.js"></script>
<script src="~/js/jquery.tablesorter.min.js" type="text/javascript"></script>
<script type="text/javascript">
var tb;
$(document).ready(function () {
laydate.render({ elem: '#start' });
laydate.render({ elem: '#end' });
$("#roletable").trigger("destroy");
$("#roletable").tablesorter();
})
function list() {
var start = $('#start').val();
var end = $('#end').val();
if (start == '' || end == '') {
layer.alert('付款时间不能为空!');
return false;
}
window.location = '@Url.Content("~/Reports/Orders/SkuCategoryProfit?colname="+ViewBag.colname+ "&skucategoryids="+ ViewBag.skucategoryids+ "&start=")' + start + '&end=' + end +'&platform=@(ViewBag.platform)';
}
function ShowDetail(platform) {
layer_show(platform + " " + $('#start').val() + "至" + $('#end').val() + ' 订单明细', '@Url.Content("~/Reports/Orders/ListOrderDetail?platform="+ViewBag.platform)' + '&start=' + $('#start').val() + '&end=' + $('#end').val() + '&col=@(ViewBag.colname)' + '&coltitle=@(ViewBag.coltitle)&showsingle=@(ViewBag.single)', '90%', '90%');
}
</script>
}
......@@ -15,6 +15,9 @@
<div style="float:right;width:100%;">
<div id="rightcontain">
<div class="ibox-content m-b-sm border-bottom">
<div class="alert alert-success">
1、成本毛利率=毛利/销售库存金额;2、库存金额周转率=销量金额/(在库金额+采购在途金额+调拨在途金额);3、金额销进比=(卖出数*采购价)/(采购入库金额+调拨入库金额);4、件数库存周转率=销量/(在库库存+采购在途+调拨在途);5、件数销进比=销量/(采购入库+调拨入库);6、30天金额可售天数=当前库存金额*30/30天总销量库存金额;7、30天件数可售天数=(当前库存*30)/30天总销量;
</div>
<form id="toolbar">
<div class="form-inline" style="line-height:40px;">
<div class="form-group">
......
......@@ -239,7 +239,7 @@ namespace Bailun.DC.Web.Controllers
a.bailun_account_id,
a.shipping_time,
a.has_delete,
quantity_shipped = a.bailun_sku_quantity_shipped,
quantity_shipped = a.platform_sku_quantity_shipped,
a.warehouse_code,
a.id,
a.productvalue,
......
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