Commit 50af1373 by guanzhenshan

新月销售利润报表增加查看订单明细功能

parent a807106f
......@@ -147,6 +147,10 @@ namespace Bailun.DC.Models
public DateTime createtime { get; set; }
public string origin_order_id { get; set; }
public string bailun_order_id { get; set; }
public decimal sale_profit { get; set; }
}
}
......@@ -6499,6 +6499,43 @@ group by currency";
}
}
/// <summary>
/// 获取订单明细信息
/// </summary>
/// <param name="parameter"></param>
/// <param name="month"></param>
/// <param name="financecategory"></param>
/// <param name="total"></param>
/// <returns></returns>
public List<dc_month_sales_profit_orderdetail> ListMonthProfitOrderDetail(BtTableParameter parameter,string month,string financecategory,ref int total)
{
var sql = $"select t1.*,t2.origin_order_id,t2.bailun_order_id from dc_month_sales_profit_orderdetail t1 join dc_base_oms_sku t2 on t1.orderskuid=t2.id where t1.month='{month}' ";
if(!string.IsNullOrEmpty(financecategory))
{
sql += $" and t1.financecategoryname='{financecategory}' ";
}
using (var cn = new MySqlConnection(Common.GlobalConfig.ConnectionString_read))
{
if(cn.State== ConnectionState.Closed)
{
cn.Open();
}
if(parameter.limit>0)
{
var obj = cn.Page<dc_month_sales_profit_orderdetail>(parameter.pageIndex, parameter.limit, sql, ref total);
return obj.ToList();
}
else
{
return cn.Query<dc_month_sales_profit_orderdetail>(sql).ToList();
}
}
}
#endregion
......
......@@ -9592,8 +9592,6 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
rows = list,
isexport = Services.UserAuthorityServices.checkUserExportAuthority("ExportAdministrativeCost", HttpContextHelper.Current.User.GetUserName()),
});
}
/// <summary>
......@@ -9643,6 +9641,60 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
}
public ActionResult MonthSaleProfitNew_OrderDetail(string month,string financecategory)
{
ViewBag.month = month;
ViewBag.financecategory = financecategory;
return View();
}
[BailunAuthentication(LoginMode.Enforce)]
public string MonthSaleProfitNew_OrderDetailJson(BtTableParameter parameter,string month,string financecategory)
{
var total = 0;
var _service = new Services.FinanceReportServices();
var obj = _service.ListMonthProfitOrderDetail(parameter, 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,
}).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;
}
return JsonConvert.SerializeObject(new
{
total = total,
rows = list,
isexport = Services.UserAuthorityServices.checkUserExportAuthority("ExportMonthSaleProfitOrderDetail", HttpContextHelper.Current.User.GetUserName()),
});
}
#endregion
......
......@@ -7,8 +7,8 @@
<div class="row">
<div class="col-sm-12">
<div class="alert alert-warning" style="display:none;">
说明:数据从2019年9月份开始
<div class="alert alert-warning">
说明:数据从每月的5号当天取数;2021年1月份开始才能查看订单明细数据
</div>
<div class="ibox-content m-b-sm border-bottom">
<form id="toolbar">
......@@ -205,6 +205,63 @@
})
}
//订单相关
else if (_this.hasClass('amount_sales_jingyou') || _this.hasClass('amount_sales_dianzi') || _this.hasClass('amount_sales_jiaju') || _this.hasClass('amount_sales_meirongmj') || _this.hasClass('amount_sales_fuzhuang') || _this.hasClass('amount_sales_other') || _this.hasClass('cost_jingyou') || _this.hasClass('cost_dianzi') || _this.hasClass('cost_jiaju') || _this.hasClass('cost_meirongmj') || _this.hasClass('cost_fuzhuang') || _this.hasClass('cost_other')) {
_this.css('cursor', 'pointer');
_this.click(function () {
ShowOrderDetail(_this.attr('val'), _this.attr('valname'));
})
}
//else if (_this.hasClass('fee_logistics_storage')) {
// _this.css('cursor', 'pointer');
// _this.click(function () {
// ShowOrderDetail(_this.attr('val'), '','物流仓储费用');
// })
//}
//else if (_this.hasClass('fee_logistics_direct')) {
// _this.css('cursor', 'pointer');
// _this.click(function () {
// ShowOrderDetail(_this.attr('val'), '', '直邮物流费用');
// })
//}
//else if (_this.hasClass('fee_logistics_tail')) {
// _this.css('cursor', 'pointer');
// _this.click(function () {
// ShowOrderDetail(_this.attr('val'), '', '尾程费费用');
// })
//}
else if (_this.hasClass('fee_storage')) {
_this.css('cursor', 'pointer');
_this.click(function () {
ShowOrderDetail(_this.attr('val'), '', '海外仓储费');
})
}
else if (_this.hasClass('fee_platform')) {
_this.css('cursor', 'pointer');
_this.click(function () {
ShowOrderDetail(_this.attr('val'), '', '平台费');
})
}
else if (_this.hasClass('fee_fba')) {
_this.css('cursor', 'pointer');
_this.click(function () {
ShowOrderDetail(_this.attr('val'), '', 'FBA费');
})
}
else if (_this.hasClass('profit_sales')) {
_this.css('cursor', 'pointer');
_this.click(function () {
ShowOrderDetail(_this.attr('val'), '', '销售利润');
})
}
})
}
else {
......@@ -290,6 +347,10 @@
layer_show(month + ' ' + name + "的明细", '@Url.Content("~/Reports/Finance/MonthSaleProfitNew_FeeOrderDetail")' + '?month=' + month + '&col=' + col, '95%', '95%');
}
function ShowOrderDetail(month, category, title) {
layer_show(month + ' ' + (title != undefined?title:category) + "的订单明细", '@Url.Content("~/Reports/Finance/MonthSaleProfitNew_OrderDetail")' + '?month=' + month + '&financecategory=' + category, '95%', '95%');
}
function clearHtml(s) {
// 去除 富文本格式
s = s.replace(/(\n)/g, "");
......

@{
ViewData["Title"] = "OMS订单明细";
Layout = "~/Pages/Shared/_MainLayout.cshtml";
}
<div class="row">
<div class="col-sm-12">
<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="month" name="month" class="form-control" style="width:130px;" placeholder="年.月" value="@(ViewBag.month)" />
</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>
<button id="btnexport" style="display:none;" type="button" class="btn btn-success" onclick="ExportCSV()">导出</button>
</div>
</div>
</form>
</div>
<div class="ibox-content m-b-sm border-bottom">
<table id="roletable" style="table-layout:fixed;"></table>
</div>
</div>
</div>
@section scripts{
<script type="text/javascript">
var tb;
$(document).ready(function () {
laydate.render({ elem: '#month', type: 'month' });
list();
})
function list() {
var month = $('#month').val();
var columns = [
{ field: 'financecategoryname', title: '财务分类' },
{ field: 'platform_type', title: '平台类型' },
{ field: 'origin_order_id', title: '平台订单号', },
{ field: 'bailun_sku', title: 'SKU' },
{ field: 'amount_sales',title: '销售额' },
{ field: 'cost_product', title: '产品成本' },
{ field: 'cost_platform_fee', title: '平台费' },
{ field: 'cost_paypal_fee', title: 'paypal费' },
{ field: 'cost_fba_fee', title: 'FBA费' },
{ field: 'cost_first', title: '头程费' },
{ field: 'cost_logistics', title: '尾程费' },
{ field: 'total_fee', title: '仓储费' },
{ field: 'cost_handle_platform', title: '平台操作费' },
{ field: 'sale_profit', title: '销售利润' },
{ field: 'quantity_shipped', title: '发货数量' },
{ field: 'shipping_time', title: '发货时间' },
];
var url = '@Url.Content("~/Reports/Finance/MonthSaleProfitNew_OrderDetailJson")' + '?month=' + month +'&financecategory=@(ViewBag.financecategory)';
if (tb == undefined) {
tb = OnlyTable("roletable", columns, url, "", {
loadsuccess: function (d) {
if (d.isexport == 1) {
$('#btnexport').show();
}
}
});
}
else {
tb.bootstrapTable('refresh', { url: url });
}
}
function ExportCSV() {
var month = $('#month').val();
window.open('@Url.Content("~/Reports/Finance/ExportMonthSaleProfitNewFeeOrderDetail")' + '?month=' + month + '&col=@(ViewBag.col)', '_blank');
}
</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