Commit 963161ce by guanzhenshan

非FBA销售统计增加处理费用字段显示,平台利润统计明细增加导出功能

parent 5696bbf3
...@@ -6,6 +6,7 @@ using Bailun.DC.DB; ...@@ -6,6 +6,7 @@ using Bailun.DC.DB;
using Dapper; using Dapper;
using MySql.Data.MySqlClient; using MySql.Data.MySqlClient;
using Bailun.DC.Models.Stock; using Bailun.DC.Models.Stock;
using MySql.Data;
namespace Bailun.DC.Services namespace Bailun.DC.Services
{ {
...@@ -153,6 +154,7 @@ namespace Bailun.DC.Services ...@@ -153,6 +154,7 @@ namespace Bailun.DC.Services
} }
var liststock = cn.Query<Models.Warehouse.mStock>("select bailun_sku,warehouse_code,usable_stock from dc_base_stock"); var liststock = cn.Query<Models.Warehouse.mStock>("select bailun_sku,warehouse_code,usable_stock from dc_base_stock");
var tb = new System.Data.DataTable();
foreach (var item in liststock) foreach (var item in liststock)
{ {
try try
...@@ -217,13 +219,52 @@ namespace Bailun.DC.Services ...@@ -217,13 +219,52 @@ namespace Bailun.DC.Services
m.createtime = DateTime.Now; m.createtime = DateTime.Now;
m.day = DateTime.Now.AddDays(-1); m.day = DateTime.Now.AddDays(-1);
cn.Insert<Models.Warehouse.dc_mid_skuwarehouse_redundancy>(m); //MySqlBulkLoader loader = new MySqlBulkLoader(cn);
var row = tb.NewRow();
row["bailun_sku"] = item.bailun_sku;
row["bailun_sku_name"] = objsku.sku_title_cn;
row["warehouse_code"] = item.warehouse_code;
row["warehouse_name"] = objWarehouse.warehouse_name;
row["productcount"] = item.usable_stock;
row["amount_total"] = item.usable_stock * objsku.unit_price;
row["daily_productsale_count"] = obj7SaleAvg ?? 0;
row["dailysale_amount"] = (obj7SaleAvg ?? 0) * objsku.unit_price;
row["productsale_rate"] = item.usable_stock > 0 ? (obj7SaleAvg ?? 0) / item.usable_stock * 7 : 0;
row["saleamount_rate"] = item.usable_stock > 0 ? (obj7SaleAvg ?? 0) / item.usable_stock * 7 : 0;
row["redundancy_product_count"] = objRedundancy ?? 0;
row["redundancy_product_rate"] = item.usable_stock > 0 ? (objRedundancy ?? 0) / item.usable_stock : 0;
row["redundancy_amount"] = (objRedundancy ?? 0) * objsku.unit_price;
row["redundancy_amount_rate"] = item.usable_stock > 0 ? (objRedundancy ?? 0) / item.usable_stock : 0;
row["yesterdaysale_amount"] = (objYesterdaySale ?? 0) * objsku.unit_price;
row["yesterdaysale_count"] = (objYesterdaySale ?? 0);
row["sale_3d_avg"] = (obj3SaleAvg ?? 0) / 3;
row["sale_7d_avg"] = (obj7SaleAvg ?? 0) / 7;
row["sale_14d_avg"] = (obj14SaleAvg ?? 0) / 14;
row["sale_30d_avg"] = (obj30SaleAvg ?? 0) / 30;
row["day_turnover_rate"] = item.usable_stock > 0 ? objYesterdaySale ?? 0 / item.usable_stock : 0;
row["week_turnover_rate"] = item.usable_stock > 0 ? (obj7SaleAvg ?? 0) / item.usable_stock * 7 : 0;
row["month_turnover_rate"] = item.usable_stock > 0 ? (obj30SaleAvg ?? 0) / item.usable_stock * 30 : 0;
row["stockout"] = objStockout ?? 0;
row["createtime"] = DateTime.Now;
row["day"] = DateTime.Now.AddDays(-1);
tb.Rows.Add(row);
} }
catch (Exception ex) catch (Exception ex)
{ {
} }
} }
} }
return ""; return "";
......
...@@ -166,11 +166,11 @@ namespace Bailun.DC.Services ...@@ -166,11 +166,11 @@ namespace Bailun.DC.Services
/// <param name="end">付款结束时间</param> /// <param name="end">付款结束时间</param>
/// <param name="total">符合条件的记录数</param> /// <param name="total">符合条件的记录数</param>
/// <returns></returns> /// <returns></returns>
public List<Models.Orders.mAmazonStatistics> ListAmazonStatistics(BtTableParameter parameter, string account, string website, DateTime start, DateTime end,string warehoursetype,string warehousecode, ref int total) public List<dc_base_oms_order> ListAmazonStatistics(BtTableParameter parameter, string account, string website, DateTime start, DateTime end,string warehoursetype,string warehousecode, ref int total)
{ {
var sqlparam = new DynamicParameters(); var sqlparam = new DynamicParameters();
var sql = @"select platform_type,seller_account,website,sum(amount_sales*seller_order_exchange_rate) 'amount_product',sum(cost_product) 'cost_product',sum(cost_platform_fee*seller_order_exchange_rate) 'platform_fee',sum(cost_first) 'head_fee',count(t1.id) 'order_count',sum(cost_total) 'cost_count',sum(cost_tail) 'nofba_logisticsfee',sum(profit_total) 'profit_count',(sum(profit_total)/sum(amount_sales*seller_order_exchange_rate)) 'profit_rate',sum(amount_prepaid) amount_prepaid,sum(amount_refund*seller_order_exchange_rate) amount_refund,count(amount_prepaid>0 or null) as noshippingcount from dc_base_oms_order t1"; var sql = @"select platform_type,seller_account,website,sum(amount_sales*seller_order_exchange_rate) 'amount_sales',sum(cost_product) 'cost_product',sum(cost_platform_fee*seller_order_exchange_rate) 'cost_platform_fee',sum(cost_first) 'cost_first',count(t1.id) 'order_count',sum(cost_total) 'cost_total',sum(cost_logistics) 'cost_logistics',sum(profit_total) 'profit_total',(sum(profit_total)/sum(amount_sales*seller_order_exchange_rate)) 'profit_rate',sum(amount_prepaid) amount_prepaid,sum(amount_refund*seller_order_exchange_rate) amount_refund,count(amount_prepaid>0 or null) as noshippingcount,sum(cost_handle_bailun) cost_handle_bailun,sum(cost_handle_platform) cost_handle_platform from dc_base_oms_order t1";
var presql = "select platform_type,seller_account,website,sum(amount_prepaid) as amount_prepaid from dc_base_oms_sku t1 "; var presql = "select platform_type,seller_account,website,sum(amount_prepaid) as amount_prepaid from dc_base_oms_sku t1 ";
if (!string.IsNullOrEmpty(warehoursetype)) if (!string.IsNullOrEmpty(warehoursetype))
...@@ -225,26 +225,26 @@ namespace Bailun.DC.Services ...@@ -225,26 +225,26 @@ namespace Bailun.DC.Services
cn.Open(); cn.Open();
} }
var obj = cn.Page<Models.Orders.mAmazonStatistics>(parameter.pageIndex, parameter.limit, sql+fromsql, ref total, sqlparam); var obj = cn.Page<dc_base_oms_order>(parameter.pageIndex, parameter.limit, sql+fromsql, ref total, sqlparam);
//另外计算预收款金额 //另外计算预收款金额
var list = obj.AsList(); //var list = obj.AsList();
prefromsql+= " and bailun_sku_quantity_shipped<=0"; //prefromsql+= " and bailun_sku_quantity_shipped<=0";
prefromsql += " and seller_account in ('" + string.Join("','", list.Select(a => a.seller_account)) + "') and website in ('" + string.Join("','", list.Select(a => a.website)) + "')"; //prefromsql += " and seller_account in ('" + string.Join("','", list.Select(a => a.seller_account)) + "') and website in ('" + string.Join("','", list.Select(a => a.website)) + "')";
prefromsql += " group by seller_account,website,platform_type"; //prefromsql += " group by seller_account,website,platform_type";
var obj1 = cn.Query<Models.Orders.mAmazonStatistics>(presql+prefromsql,sqlparam); //var obj1 = cn.Query<Models.Orders.mAmazonStatistics>(presql+prefromsql,sqlparam);
foreach (var item in list) //foreach (var item in list)
{ //{
var temp = obj1.Where(a => a.seller_account == item.seller_account && a.website == item.website && a.platform_type == item.platform_type).FirstOrDefault(); // var temp = obj1.Where(a => a.seller_account == item.seller_account && a.website == item.website && a.platform_type == item.platform_type).FirstOrDefault();
if (temp != null) // if (temp != null)
{ // {
item.amount_prepaid = temp.amount_prepaid; // item.amount_prepaid = temp.amount_prepaid;
} // }
} //}
return list; return obj.ToList();
} }
} }
...@@ -259,12 +259,12 @@ namespace Bailun.DC.Services ...@@ -259,12 +259,12 @@ namespace Bailun.DC.Services
/// <param name="end">付款结束时间</param> /// <param name="end">付款结束时间</param>
/// <param name="total">符合条件的记录数</param> /// <param name="total">符合条件的记录数</param>
/// <returns></returns> /// <returns></returns>
public Models.Orders.mAmazonStatistics ListAmazonStatisticsCount(string account, string website, DateTime start, DateTime end,string warehoursetype,string warehousecode) public dc_base_oms_order ListAmazonStatisticsCount(string account, string website, DateTime start, DateTime end,string warehoursetype,string warehousecode)
{ {
var sqlparam = new DynamicParameters(); var sqlparam = new DynamicParameters();
var presql = "select sum(amount_prepaid) as amount_prepaid from dc_base_oms_sku t1 "; var presql = "select sum(amount_prepaid) as amount_prepaid from dc_base_oms_sku t1 ";
var sql = "select sum(amount_sales*seller_order_exchange_rate) 'amount_product',sum(cost_product) 'cost_product',sum(cost_platform_fee*seller_order_exchange_rate) 'platform_fee',sum(cost_first) 'head_fee',count(t1.id) 'order_count',sum(cost_total) 'cost_count',sum(cost_tail) 'nofba_logisticsfee',sum(profit_total) 'profit_count',(sum(profit_total)/sum(amount_sales*seller_order_exchange_rate)) 'profit_rate',sum(amount_prepaid) amount_prepaid,sum(amount_refund*seller_order_exchange_rate) amount_refund,count(amount_prepaid>0 or null) as noshippingcount from dc_base_oms_order t1 "; var sql = "select sum(amount_sales*seller_order_exchange_rate) 'amount_sales',sum(cost_product) 'cost_product',sum(cost_platform_fee*seller_order_exchange_rate) 'cost_platform_fee',sum(cost_first) 'cost_first',count(t1.id) 'order_count',sum(cost_total) 'cost_total',sum(cost_logistics) 'cost_logistics',sum(profit_total) 'profit_total',(sum(profit_total)/sum(amount_sales*seller_order_exchange_rate)) 'profit_rate',sum(amount_prepaid) amount_prepaid,sum(amount_refund*seller_order_exchange_rate) amount_refund,count(amount_prepaid>0 or null) as noshippingcount,sum(cost_handle_bailun) cost_handle_bailun,sum(cost_handle_platform) cost_handle_platform from dc_base_oms_order t1 ";
if (!string.IsNullOrEmpty(warehoursetype)) if (!string.IsNullOrEmpty(warehoursetype))
{ {
...@@ -314,22 +314,14 @@ namespace Bailun.DC.Services ...@@ -314,22 +314,14 @@ namespace Bailun.DC.Services
try try
{ {
var obj = cn.QueryFirst<Models.Orders.mAmazonStatistics>(sql+fromsql, sqlparam); var obj = cn.QueryFirst<dc_base_oms_order>(sql+fromsql, sqlparam);
prefromsql += " and bailun_sku_quantity_shipped<=0";
var obj1 = cn.QueryFirst<Models.Orders.mAmazonStatistics>(presql + prefromsql, sqlparam);
if (obj1 != null && obj!=null)
{
obj.amount_prepaid = obj1.amount_prepaid;
}
return obj; return obj;
} }
catch (Exception ex) catch (Exception ex)
{ {
return new Models.Orders.mAmazonStatistics(); return new Models.Orders.dc_base_oms_order();
} }
} }
} }
......
...@@ -5,12 +5,20 @@ using System.Threading.Tasks; ...@@ -5,12 +5,20 @@ using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Bailun.DC.Models; using Bailun.DC.Models;
using Newtonsoft.Json; using Newtonsoft.Json;
using Microsoft.AspNetCore.Hosting;
namespace Bailun.DC.Web.Areas.Reports.Controllers namespace Bailun.DC.Web.Areas.Reports.Controllers
{ {
[Area("Reports")] [Area("Reports")]
public class OrdersController : Controller public class OrdersController : Base.BaseController
{ {
private readonly IHostingEnvironment _hostingEnvironment;
public OrdersController(IHostingEnvironment hostingEnvironment)
{
_hostingEnvironment = hostingEnvironment;
}
public IActionResult Index() public IActionResult Index()
{ {
return View(); return View();
...@@ -128,68 +136,63 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers ...@@ -128,68 +136,63 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
var countM = service.ListAmazonStatisticsCount(sellaccount, website, start, end,warehousetype,warehousecode); var countM = service.ListAmazonStatisticsCount(sellaccount, website, start, end,warehousetype,warehousecode);
countM.website = "总计:"; countM.website = "总计:";
countM.amount_product = Math.Round(countM.amount_product, 2, MidpointRounding.AwayFromZero); countM.amount_sales = Math.Round(countM.amount_sales, 2, MidpointRounding.AwayFromZero);
countM.cost_count = Math.Round(countM.cost_count, 2, MidpointRounding.AwayFromZero);
countM.cost_product = Math.Round(countM.cost_product, 2, MidpointRounding.AwayFromZero); countM.cost_product = Math.Round(countM.cost_product, 2, MidpointRounding.AwayFromZero);
countM.fba_fee = Math.Round(countM.fba_fee, 2, MidpointRounding.AwayFromZero); countM.cost_platform_fee = Math.Round(countM.cost_platform_fee, 2, MidpointRounding.AwayFromZero);
countM.fba_profit = Math.Round(countM.fba_profit, 2, MidpointRounding.AwayFromZero); countM.cost_first = Math.Round(countM.cost_first, 2, MidpointRounding.AwayFromZero);
countM.forecast_profit_count = Math.Round(countM.forecast_profit_count, 2, MidpointRounding.AwayFromZero);
countM.head_fee = Math.Round(countM.head_fee, 2, MidpointRounding.AwayFromZero);
//countM.nofba_forecast_logisticsfee = Math.Round(countM.nofba_forecast_logisticsfee, 2, MidpointRounding.AwayFromZero);
//countM.nofba_forecast_profit = Math.Round(countM.nofba_forecast_profit, 2, MidpointRounding.AwayFromZero);
countM.nofba_logisticsfee = Math.Round(countM.nofba_logisticsfee, 2, MidpointRounding.AwayFromZero);
countM.nofba_profit = Math.Round(countM.nofba_profit, 2, MidpointRounding.AwayFromZero);
countM.platform_fee = Math.Round(countM.platform_fee, 2, MidpointRounding.AwayFromZero);
countM.profit_count = Math.Round(countM.profit_count, 2, MidpointRounding.AwayFromZero);
countM.amount_prepaid = Math.Round(countM.amount_prepaid, 2, MidpointRounding.AwayFromZero);
countM.amount_refund = Math.Round(countM.amount_refund, 2, MidpointRounding.AwayFromZero);
countM.loss_withdrawal = countM.amount_product * (objwithdraw == null ? 0 : objwithdraw.Loss_withdrawal_percent ?? 0); countM.loss_withdrawal = countM.amount_product * (objwithdraw == null ? 0 : objwithdraw.Loss_withdrawal_percent ?? 0);
countM.profit_rate = countM.amount_product>0?Math.Round((countM.profit_count / countM.amount_product), 2, MidpointRounding.AwayFromZero):0; countM.cost_total = Math.Round(countM.cost_total, 2, MidpointRounding.AwayFromZero);
countM.cost_logistics = Math.Round(countM.cost_logistics, 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.cost_handle_bailun = Math.Round(countM.cost_handle_bailun, 2, MidpointRounding.AwayFromZero);
countM.cost_handle_platform = Math.Round(countM.cost_handle_platform, 2, MidpointRounding.AwayFromZero);
countM.profit_rate = countM.amount_product>0?Math.Round((countM.profit_total / countM.amount_product), 2, MidpointRounding.AwayFromZero):0;
var obj = list.Select(p => new var obj = list.Select(p => new
{ {
p.platform_type, p.platform_type,
p.seller_account, p.seller_account,
p.website, p.website,
amount_product = p.amount_product.ToString("N2"), amount_sales = p.amount_sales.ToString("N2"),
cost_product = p.cost_product.ToString("N2"), cost_product = p.cost_product.ToString("N2"),
platform_fee = p.platform_fee.ToString("N2"),
head_fee = p.head_fee>0?p.head_fee.ToString("N2"):"0",
order_count = p.order_count.ToString("N0"), order_count = p.order_count.ToString("N0"),
cost_platform_fee = p.cost_platform_fee.ToString("N2"),
cost_first = p.cost_first.ToString("N2"),
loss_withdrawal = (p.amount_product * (objwithdraw == null ? 0 : objwithdraw.Loss_withdrawal_percent ?? 0))>0? (p.amount_product * (objwithdraw == null ? 0 : objwithdraw.Loss_withdrawal_percent ?? 0)).ToString("N2"):"0", loss_withdrawal = (p.amount_product * (objwithdraw == null ? 0 : objwithdraw.Loss_withdrawal_percent ?? 0))>0? (p.amount_product * (objwithdraw == null ? 0 : objwithdraw.Loss_withdrawal_percent ?? 0)).ToString("N2"):"0",
cost_count = p.cost_count.ToString("N2"), cost_total = p.cost_total.ToString("N2"),
forecast_profit_count = p.forecast_profit_count.ToString("N2"), cost_logistics = p.cost_logistics.ToString("N2"),
nofba_logisticsfee = p.nofba_logisticsfee>0?p.nofba_logisticsfee.ToString("N2"):"0", amount_refund = p.amount_refund > 0 ? p.amount_refund.ToString("N2") : "0",
nofba_forecast_logisticsfee = p.nofba_forecast_logisticsfee.ToString("N2"),
forecast_profit_rate = (100*p.forecast_profit_rate).ToString("N2"),
profit_count = p.profit_count.ToString("N2"),
profit_rate = (100*p.profit_rate).ToString("N2"),
p.order_currency,
amount_prepaid = p.amount_prepaid.ToString("N2"), amount_prepaid = p.amount_prepaid.ToString("N2"),
amount_refund = p.amount_refund>0?p.amount_refund.ToString("N2"):"0", noshippingcount = p.noshippingcount.ToString("N0"),
noshippingcount = p.noshippingcount.ToString("N0") profit_total = p.profit_total.ToString("N2"),
profit_rate = (100 * p.profit_rate).ToString("N2"),
cost_handle_bailun = p.cost_handle_bailun.ToString("N2"),
cost_handle_platform = p.cost_handle_platform.ToString("N2")
}); });
return JsonConvert.SerializeObject(new { total = total, rows = obj,count_row=new { return JsonConvert.SerializeObject(new { total = total, rows = obj,count_row=new {
countM.website, countM.website,
amount_product = countM.amount_product.ToString("N2"), amount_sales = countM.amount_sales.ToString("N2"),
cost_product = countM.cost_product.ToString("N2"), cost_product = countM.cost_product.ToString("N2"),
platform_fee = countM.platform_fee.ToString("N2"), cost_platform_fee = countM.cost_platform_fee.ToString("N2"),
head_fee = countM.head_fee.ToString("N2"), cost_first = countM.cost_first.ToString("N2"),
countM.order_count, countM.order_count,
loss_withdrawal = countM.loss_withdrawal>0? countM.loss_withdrawal.ToString("N2"):"0", loss_withdrawal = countM.loss_withdrawal>0? countM.loss_withdrawal.ToString("N2"):"0",
cost_count = countM.cost_count.ToString("N2"), cost_total = countM.cost_total.ToString("N2"),
forecast_profit_count = countM.forecast_profit_count.ToString("N2"), cost_logistics = countM.cost_logistics.ToString("N2"),
nofba_logisticsfee = countM.nofba_logisticsfee.ToString("N2"),
nofba_forecast_logisticsfee = countM.nofba_forecast_logisticsfee.ToString("N2"), profit_total = countM.profit_total.ToString("N2"),
forecast_profit_rate = (100 * countM.forecast_profit_rate).ToString("N2"),
profit_count = countM.profit_count.ToString("N2"),
profit_rate = (100 * countM.profit_rate).ToString("N2"), profit_rate = (100 * countM.profit_rate).ToString("N2"),
countM.order_currency, countM.order_currency,
amount_prepaid = countM.amount_prepaid.ToString("N2"), amount_prepaid = countM.amount_prepaid.ToString("N2"),
amount_refund = countM.amount_refund > 0 ? countM.amount_refund.ToString("N2") : "0", amount_refund = countM.amount_refund > 0 ? countM.amount_refund.ToString("N2") : "0",
noshippingcount = countM.noshippingcount.ToString("N0") noshippingcount = countM.noshippingcount.ToString("N0"),
cost_handle_bailun = countM.cost_handle_bailun.ToString("N2"),
cost_handle_platform = countM.cost_handle_platform.ToString("N2")
} }
}); });
} }
...@@ -832,6 +835,82 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers ...@@ -832,6 +835,82 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
} }
public ActionResult ExportListOrderDetail(string platform, string website, string account, DateTime? start, DateTime? end, string orderno, DateTime? shipstart, DateTime? shipend)
{
var total = 0;
var service = new Services.OrdersServices();
var obj = service.ListPlatformProfitOrders(new BtTableParameter { offset=1,limit=500000}, platform, website, account, start, end, shipstart, shipend, orderno, ref total);
var list = obj.Select(p => new
{
p.origin_order_id,
p.bailun_order_id,
p.platform_type,
p.website,
p.seller_account,
p.order_currency,
amount_total = p.amount_total.ToString("N2"),
amount_sales = p.amount_sales.ToString("N2"),
amount_product = p.amount_product.ToString("N2"),
amount_shipping = p.amount_shipping.ToString("N2"),
amount_tax = p.amount_tax.ToString("N2"),
amount_adjustment = p.amount_adjustment.ToString("N2"),
amount_gift_wrap = p.amount_gift_wrap.ToString("N2"),
amount_refund = p.amount_refund.ToString("N2"),
cost_total = p.cost_total.ToString("N2"),
cost_promotion = p.cost_promotion.ToString("N2"),
cost_platform_fee = p.cost_platform_fee.ToString("N2"),
cost_product = p.cost_product.ToString("N2"),
cost_shipping = p.cost_shipping.ToString("N2"),
cost_package = p.cost_package.ToString("N2"),
cost_fba_fee = p.cost_fba_fee.ToString("N2"),
cost_paypal_fee = p.cost_paypal_fee.ToString("N2"),
cost_refund_commisson = p.cost_refund_commisson.ToString("N2"),
cost_handle_bailun = p.cost_handle_bailun.ToString("N2"),
cost_handle_platform = p.cost_handle_platform.ToString("N2"),
cost_first = p.cost_first.ToString("N2"),
cost_tail = p.cost_tail.ToString("N2"),
profit_total = p.profit_total.ToString("N2"),
profit_rate = (p.profit_rate * 100).ToString("N2"),
amount_prepaid = p.amount_prepaid.ToString("N2"),
create_time = p.create_time.ToString("yyyy-MM-dd HH:mm:ss"),
paid_time = p.paid_time.ToString("yyyy-MM-dd HH:mm:ss"),
cost_logistics = p.cost_logistics.ToString("N2"),
});
var colNames = new List<string> {"平台订单号","订单号","平台", "站点", "销售账户",
"销售额", "产品收入","运费收入","税费收入","调整金额"
,"礼品包装金额","退款金额","总支出","促销费用","平台费用"
,"产品成本","包装费用","FBA费用","Paypal费用","退款佣金费用"
,"处理费(百伦)","平台操作费","头程费","尾程费","利润"
,"利润率","预收款","下单时间","付款时间"
};
var listVal = new List<string>();
foreach (var item in list)
{
listVal.Add(
item.origin_order_id+"|"+item.bailun_order_id+"|"+item.platform_type+"|"+item.website+"|"+item.seller_account+"|"+
item.amount_sales+"|"+item.amount_product+"|"+item.amount_shipping+"|"+item.amount_tax+"|"+item.amount_adjustment+"|"+
item.amount_gift_wrap+"|"+item.amount_refund+"|"+item.cost_total+"|"+item.cost_promotion+"|"+item.cost_platform_fee+"|"+
item.cost_product+"|"+item.cost_package+"|"+item.cost_fba_fee+"|"+item.cost_paypal_fee+"|"+item.cost_refund_commisson+"|"+
item.cost_handle_bailun+"|"+item.cost_handle_platform+"|"+item.cost_first+"|"+item.cost_logistics+"|"+item.profit_total+"|"+
item.profit_rate+"|"+item.amount_prepaid+"|"+item.create_time+"|"+item.paid_time
);
}
var filename = platform+"订单明细导出" + DateTime.Now.ToString("yyyyMMddHHmmss");
var filepath = _hostingEnvironment.WebRootPath + "\\Files\\Report\\" + DateTime.Now.ToString("yyyy-MM-dd") + "\\";
ToCSV(listVal, colNames, filename, filepath);
return File("~/Files/Report/" + DateTime.Now.ToString("yyyy-MM-dd") + "/" + filename + ".csv", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", filename + ".csv");
}
/// <summary> /// <summary>
/// 非FBA销售订单 /// 非FBA销售订单
/// </summary> /// </summary>
......
...@@ -104,8 +104,8 @@ ...@@ -104,8 +104,8 @@
}, },
{ field: 'website', title: '站点', width: '80', sortable: false, iscount: true }, { field: 'website', title: '站点', width: '80', sortable: false, iscount: true },
{ {
field: 'amount_product', title: '销售额', width: '100', sortable: true, iscount: true, formatter: function (idx, data) { 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_product\',1)">' + data.amount_product + '</span>'; return '<span class="alink" onclick="ShowDetail(\'' + data.platform_type + '\',\'' + data.website + '\',\'' + data.seller_account + '\',\'销售额\',\'amount_sales\',1)">' + data.amount_sales + '</span>';
} }
}, },
{ {
...@@ -119,24 +119,34 @@ ...@@ -119,24 +119,34 @@
} }
}, },
{ {
field: 'platform_fee', title: '平台佣金费', width: '110', sortable: true, iscount: true, formatter: function (idx, data) { 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.platform_fee + '</span>'; return '<span class="alink" onclick="ShowDetail(\'' + data.platform_type + '\',\'' + data.website + '\',\'' + data.seller_account + '\',\'平台佣金费\',\'cost_platform_fee\',1)">' + data.cost_platform_fee + '</span>';
} }
}, },
{ {
field: 'head_fee', title: '头程费', width: '100', sortable: true, iscount: true, formatter: function (idx, data) { 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.head_fee + '</span>'; return '<span class="alink" onclick="ShowDetail(\'' + data.platform_type + '\',\'' + data.website + '\',\'' + data.seller_account + '\',\'头程费\',\'cost_first\',1)">' + data.cost_first + '</span>';
} }
}, },
{ field: 'loss_withdrawal', title: '提现损耗', width: '100', sortable: false, iscount: true }, { field: 'loss_withdrawal', title: '提现损耗', width: '100', sortable: false, iscount: true },
{ {
field: 'cost_count', title: '总支出', width: '110', sortable: true, iscount: true, formatter: function (idx, data) { field: 'cost_logistics', 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_count + '</span>'; return '<span class="alink" onclick="ShowDetail(\'' + data.platform_type + '\',\'' + data.website + '\',\'' + data.seller_account + '\',\'尾程费\',\'cost_logistics\',1)">' + data.cost_logistics + '</span>';
} }
}, },
{ {
field: 'nofba_logisticsfee', title: '实际物流费', width: '110', sortable: true, iscount: true, formatter: function (idx, data) { field: 'cost_handle_bailun', title: '处理费(百伦)', width: '130', sortable: true, iscount: true, formatter: function (idx, data) {
return '<span class="alink" onclick="ShowDetail(\'' + data.platform_type + '\',\'' + data.website + '\',\'' + data.seller_account + '\',\'实际物流费\',\'cost_shipping\',1)">' + data.nofba_logisticsfee + '</span>'; return '<span class="alink" onclick="ShowDetail(\'' + data.platform_type + '\',\'' + data.website + '\',\'' + data.seller_account + '\',\'处理费(百伦)\',\'cost_handle_bailun\',1)">' + data.cost_handle_bailun + '</span>';
}
},
{
field: 'cost_handle_platform', title: '平台操作费', width: '130', sortable: true, iscount: true, formatter: function (idx, data) {
return '<span class="alink" onclick="ShowDetail(\'' + data.platform_type + '\',\'' + data.website + '\',\'' + data.seller_account + '\',\'平台操作费\',\'cost_handle_platform\',1)">' + data.cost_handle_platform + '</span>';
}
},
{
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>';
} }
}, },
{ {
...@@ -154,8 +164,8 @@ ...@@ -154,8 +164,8 @@
}, },
//{ field: 'forecast_profit_rate', title: '预测利润率%', width: '120', sortable: true }, //{ field: 'forecast_profit_rate', title: '预测利润率%', width: '120', sortable: true },
{ {
field: 'profit_count', title: '实际利润', width: '120', sortable: true, iscount: true, formatter: function (idx, data) { 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_count + '</span>'; return '<span class="alink" onclick="ShowDetail(\'' + data.platform_type + '\',\'' + data.website + '\',\'' + data.seller_account + '\',\'实际利润\',\'profit_total\',1)">' + data.profit_total + '</span>';
} }
}, },
{ field: 'profit_rate', title: '总实际利润率%', width: '130', sortable: true, iscount: true }, { field: 'profit_rate', title: '总实际利润率%', width: '130', sortable: true, iscount: true },
......
...@@ -47,6 +47,7 @@ ...@@ -47,6 +47,7 @@
<div class="form-group"> <div class="form-group">
<label>&nbsp;</label> <label>&nbsp;</label>
<button type="button" class="btn btn-primary" onclick="list();"><i class="fa fa-search"></i>&nbsp;查询</button> <button type="button" class="btn btn-primary" onclick="list();"><i class="fa fa-search"></i>&nbsp;查询</button>
<button type="button" class="btn btn-success" onclick="exportxls();">导出</button>
</div> </div>
</div> </div>
</form> </form>
...@@ -70,6 +71,8 @@ ...@@ -70,6 +71,8 @@
<script src="~/js/bootstrap-table-fixed-columns.js" type="text/javascript"></script> <script src="~/js/bootstrap-table-fixed-columns.js" type="text/javascript"></script>
<script type="text/javascript"> <script type="text/javascript">
var tb; var tb;
var isdoneplatform = false, isdoneaccount = false, isdonewebsite = false;
var objTime;
$(document).ready(function () { $(document).ready(function () {
laydate.render({ elem: '#start' }); laydate.render({ elem: '#start' });
laydate.render({ elem: '#end' }); laydate.render({ elem: '#end' });
...@@ -79,9 +82,16 @@ ...@@ -79,9 +82,16 @@
var height = document.body.clientHeight; var height = document.body.clientHeight;
$("#roletable").attr("data-height", (height - 170)); $("#roletable").attr("data-height", (height - 170));
listAccount();
listPlatform(); listPlatform();
objTime = setInterval(function () {
if (isdoneaccount && isdoneplatform && isdonewebsite) {
list();
clearInterval(objTime);
}
}, 1000);
}) })
function list() { function list() {
...@@ -178,8 +188,9 @@ ...@@ -178,8 +188,9 @@
} }
$('#platform').val('@ViewBag.platform'); $('#platform').val('@ViewBag.platform');
listWebsite(); listWebsite();
listAccount();
isdoneplatform = true;
} }
} }
}) })
...@@ -200,8 +211,7 @@ ...@@ -200,8 +211,7 @@
} }
$('#website').val('@ViewBag.website'); $('#website').val('@ViewBag.website');
isdonewebsite = true;
listAccount();
} }
} }
}) })
...@@ -220,13 +230,16 @@ ...@@ -220,13 +230,16 @@
} }
$('#account').val('@ViewBag.account'); $('#account').val('@ViewBag.account');
isdoneaccount = true;
list();
} }
} }
}) })
} }
function exportxls() {
window.open('@Url.Content("~/Reports/Orders/ExportListOrderDetail?")' + $("#toolbar").serialize(), '_blank');
}
</script> </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