Commit 0ef07f16 by guanzhenshan

月销售利润查看订单明细增加导出功能

parent 9c9feceb
...@@ -9717,6 +9717,9 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers ...@@ -9717,6 +9717,9 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
total_fee = (a.total_fee - a.shipping) * a.wms_to_cny_exchange_rate * a.quantity_shipped, //仓储费 total_fee = (a.total_fee - a.shipping) * a.wms_to_cny_exchange_rate * a.quantity_shipped, //仓储费
sale_profit = 0, sale_profit = 0,
shipping_time = a.shipping_time,
}).ToList(); }).ToList();
foreach(var item in list) foreach(var item in list)
...@@ -9729,10 +9732,80 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers ...@@ -9729,10 +9732,80 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
{ {
total = total, total = total,
rows = list, rows = list,
isexport = Services.UserAuthorityServices.checkUserExportAuthority("ExportMonthSaleProfitOrderDetail", HttpContextHelper.Current.User.GetUserName()), isexport = 1,
}); });
} }
public ActionResult ExportMonthSaleProfitNew_OrderDetail(string month, string financecategory)
{
var total = 0;
var _service = new Services.FinanceReportServices();
var obj = _service.ListMonthProfitOrderDetail(new BtTableParameter { offset=0,limit=0}, month, financecategory, ref total);
var list = obj.Select(a => new dc_month_sales_profit_orderdetail
{
financecategoryname = a.financecategoryname,
platform_type = a.platform_type,
bailun_sku = a.bailun_sku,
origin_order_id = a.origin_order_id,
bailun_order_id = a.bailun_order_id,
quantity_shipped = a.quantity_shipped,
amount_sales = a.amount_sales * a.quantity_shipped * a.seller_order_exchange_rate,
cost_fba_fee = a.cost_fba_fee * a.quantity_shipped * a.seller_order_exchange_rate,
cost_first = a.cost_first * a.quantity_shipped,
cost_handle_platform = a.cost_handle_platform * a.quantity_shipped,
cost_logistics = a.cost_logistics * a.quantity_shipped,
cost_paypal_fee = a.cost_paypal_fee * a.quantity_shipped * a.seller_order_exchange_rate,
cost_platform_fee = a.cost_platform_fee * (a.platform_type.ToLower() == "ebay" ? a.seller_other_exchange_rate : a.seller_order_exchange_rate) * a.quantity_shipped,
cost_product = a.cost_product * a.quantity_shipped,
total_fee = (a.total_fee - a.shipping) * a.wms_to_cny_exchange_rate * a.quantity_shipped, //仓储费
sale_profit = 0,
shipping_time = a.shipping_time,
}).ToList();
foreach (var item in list)
{
item.sale_profit = item.amount_sales - item.cost_fba_fee - item.cost_first - item.cost_handle_platform - item.cost_logistics - item.cost_paypal_fee - item.cost_platform_fee - item.cost_product - item.total_fee;
}
var colNames = new List<string> {"财务分类","平台类型","平台订单号","SKU", "销售额",
"产品成本","平台费", "Paypal费","FBA费","头程费",
"尾程费","仓储费","平台操作费","销售利润","发货数量",
"发货时间" };
var listval = new List<string>();
foreach (var item in obj)
{
listval.Add(item.financecategoryname + "|" + item.platform_type + "|" + item.origin_order_id + "|" + item.bailun_sku + "|" + item.amount_sales + "|" +
item.cost_product + "|" + item.cost_platform_fee + "|" + item.cost_paypal_fee + "|" + item.cost_fba_fee + "|" + item.cost_first + "|" +
item.cost_logistics + "|" + item.total_fee + "|" + item.cost_handle_platform + "|" + item.sale_profit + "|" + item.quantity_shipped + "|" +
item.shipping_time.ToString("yyyy-MM-dd HH:mm:ss")
);
}
var guid = Guid.NewGuid().ToString();
var filename = " 订单明细" + DateTime.Now.ToString("yyyyMMddHHmmss");
var filepath = _hostingEnvironment.WebRootPath + "\\Files\\Report\\" + DateTime.Now.ToString("yyyy-MM-dd") + "\\";
ToCSV(listval, colNames, guid, filepath);
var ms = new System.IO.MemoryStream();
using (var f = new System.IO.FileStream(filepath + guid + ".csv", System.IO.FileMode.Open))
{
f.CopyTo(ms);
}
ms.Position = 0;
return File(ms, "text/csv", filename + ".csv");
}
/// <summary> /// <summary>
/// 新月销售利润-广告类型选择页面 /// 新月销售利润-广告类型选择页面
......
...@@ -81,7 +81,7 @@ ...@@ -81,7 +81,7 @@
function ExportCSV() { function ExportCSV() {
var month = $('#month').val(); var month = $('#month').val();
window.open('@Url.Content("~/Reports/Finance/ExportMonthSaleProfitNewFeeOrderDetail")' + '?month=' + month + '&col=@(ViewBag.col)', '_blank'); window.open('@Url.Content("~/Reports/Finance/ExportMonthSaleProfitNew_OrderDetail")' + '?month=' + month +'&financecategory=@(ViewBag.financecategory)', '_blank');
} }
......
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