Commit 6fa7e3f5 by guanzhenshan

处理非FBA销售统计提出修改的需求

parent a9484837
......@@ -123,6 +123,17 @@ namespace Bailun.DC.Models.Orders
/// 币种
/// </summary>
public string currency { get; set; }
/// <summary>
/// 预收款(已经收款未发货的这部分订单)
/// </summary>
public decimal amount_prepaid { get; set; }
/// <summary>
/// 退款金额
/// </summary>
public decimal amount_refund { get; set; }
}
......
......@@ -92,5 +92,7 @@ namespace Bailun.DC.Models
/// 币种名称
/// </summary>
public string currency_name { get; set; }
public decimal? Loss_withdrawal_percent { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Text;
using Bailun.DC.Models;
using Dapper;
namespace Bailun.DC.Services
{
public class PlatformSiteServices
{
/// <summary>
/// 获取平台提现损耗的比例
/// </summary>
/// <returns></returns>
public List<dc_platform_and_site> GetPlatformLossWithdraw()
{
using (var cn = new MySql.Data.MySqlClient.MySqlConnection(Common.GlobalConfig.ConnectionString))
{
if (cn.State == System.Data.ConnectionState.Closed)
{
cn.Open();
}
return cn.Query<dc_platform_and_site>("select english_name,Loss_withdrawal_percent from dc_platform_and_site where type=1").AsList();
}
}
}
}
......@@ -39,6 +39,10 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
{
var total = 0;
var service = new Services.OrdersServices();
var objwithdraw = new Services.PlatformSiteServices().GetPlatformLossWithdraw().Where(a => a.english_name == "Amazon").FirstOrDefault();
var list = service.ListAmazonStatistics(parameter, sellaccount, website, start, end, ref total);
var countM = service.ListAmazonStatisticsCount(sellaccount, website, start, end);
......@@ -50,14 +54,17 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
countM.fba_profit = Math.Round(countM.fba_profit, 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_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);
var obj = list.Select(p => new
{
......@@ -67,20 +74,41 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
amount_product = p.amount_product.ToString("###,###.##"),
cost_product = p.cost_product.ToString("###,###.##"),
platform_fee = p.platform_fee.ToString("###,###.##"),
head_fee = p.head_fee.ToString("###,###.##"),
head_fee = p.head_fee>0?p.head_fee.ToString("###,###.##"):"0",
p.order_count,
loss_withdrawal = p.loss_withdrawal,
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("###,###.##"):"0",
cost_count = p.cost_count.ToString("###,###.##"),
forecast_profit_count = p.forecast_profit_count.ToString("###,###.##"),
nofba_logisticsfee = p.nofba_logisticsfee.ToString("###,###.##"),
nofba_logisticsfee = p.nofba_logisticsfee>0?p.nofba_logisticsfee.ToString("###,###.##"):"0",
nofba_forecast_logisticsfee = p.nofba_forecast_logisticsfee.ToString("###,###.##"),
forecast_profit_rate = (100*p.forecast_profit_rate).ToString("###,###.##"),
profit_count = p.profit_count.ToString("###,###.##"),
profit_rate = (100*p.profit_rate).ToString("###,###.##"),
p.currency
p.currency,
amount_prepaid = p.amount_prepaid.ToString("###,###.##"),
amount_refund = p.amount_refund>0?p.amount_refund.ToString("###,###.##"):"0",
});
return JsonConvert.SerializeObject(new { total = total, rows = obj,count_row=countM });
return JsonConvert.SerializeObject(new { total = total, rows = obj,count_row=new {
countM.website,
amount_product = countM.amount_product.ToString("###,###.##"),
cost_product = countM.cost_product.ToString("###,###.##"),
platform_fee = countM.platform_fee.ToString("###,###.##"),
head_fee = countM.head_fee.ToString("###,###.##"),
countM.order_count,
loss_withdrawal = countM.loss_withdrawal>0? countM.loss_withdrawal.ToString("###,###.##"):"0",
cost_count = countM.cost_count.ToString("###,###.##"),
forecast_profit_count = countM.forecast_profit_count.ToString("###,###.##"),
nofba_logisticsfee = countM.nofba_logisticsfee.ToString("###,###.##"),
nofba_forecast_logisticsfee = countM.nofba_forecast_logisticsfee.ToString("###,###.##"),
forecast_profit_rate = (100 * countM.forecast_profit_rate).ToString("###,###.##"),
profit_count = countM.profit_count.ToString("###,###.##"),
profit_rate = (100 * countM.profit_rate).ToString("###,###.##"),
countM.currency,
amount_prepaid = countM.amount_prepaid.ToString("###,###.##"),
amount_refund = countM.amount_refund > 0 ? countM.amount_refund.ToString("###,###.##") : "0",
}
});
}
/// <summary>
......
......@@ -76,50 +76,33 @@
function list() {
var columns = [
{ field: 'platform_type', title: '平台',width:'100',sortable:true },
{ field: 'platform_type', title: '平台', width: '100', sortable: false },
{
field: 'seller_account', title: '销售帐号', width: '130', sortable: true, formatter: function (idx, data) {
field: 'seller_account', title: '销售帐号', width: '130', sortable: false, formatter: function (idx, data) {
var str = '<p class="mules" title="' + data.seller_account + '">' + data.seller_account + '</p>';
return str;
}
},
{ field: 'website', title: '站点', width: '80', sortable: true, iscount: true },
{ field: 'website', title: '站点', width: '80', sortable: false, iscount: true },
{ field: 'amount_product', title: '商品收入', width: '100', sortable: true, iscount: true },
{ field: 'cost_product', title: '产品成本', width: '100', sortable: true, iscount: true },
{ field: 'platform_fee', title: '平台佣金费', width: '110', sortable: true, iscount: true },
{ field: 'head_fee', title: '头程费', width: '100', sortable: true, iscount: true },
{ field: 'order_count', title: '销售数量', width: '100', sortable: true, iscount: true },
{ field: 'loss_withdrawal', title: '提现损耗', width: '100', sortable: true, iscount: true },
{ field: 'loss_withdrawal', title: '提现损耗', width: '100', sortable: false, iscount: true },
{ field: 'cost_count', title: '总支出', width: '110', sortable: true, iscount: true },
{ field: 'nofba_forecast_logisticsfee', title: '预测物流费', width: '110', sortable: true, iscount: true },
{ field: 'nofba_logisticsfee', title: '实际物流费', width: '110', sortable: true, iscount: true },
{ field: 'forecast_profit_count', title: '预测利润', width: '110', sortable: true, iscount: true },
{ field: 'forecast_profit_rate', title: '预测利润率%', width: '120', sortable: true },
{ field: 'amount_refund', title: '退款金额', width: '110', sortable: true, iscount: true },
{ field: 'amount_prepaid', title: '预收金额', width: '120', sortable: true, iscount: true },
//{ field: 'forecast_profit_rate', title: '预测利润率%', width: '120', sortable: true },
{ field: 'profit_count', title: '实际利润', width: '120', sortable: true, iscount: true },
{ field: 'profit_rate', title: '总实际利润率%', width: '130', sortable: true },
{ field: 'currency', title: '币种', width: '80' },
];
var url = '@Url.Content("~/Reports/Orders/ListAmazonSaleStatisticsJson")' + '?' + $("#toolbar").serialize();
if (tb == undefined) {
tb = OnlyTable("roletable", columns, url, "", {
showfooter: true, loadsuccess: function (d) {
//替换汇总行的相关列值
var tr = $('.fixed-table-footer').find('tr');
for (var c in columns) {
var key = columns[c].field;
if (columns[c].iscount) {
for (var v in d.count_row) {
if (key == v) {
tr.find('td').eq(c).children('div').first().html(d.count_row[v]);
break;
}
}
}
}
}
});
tb = OnlyTable("roletable", columns, url, "", {showfooter: true, showCount: true});
}
else {
tb.bootstrapTable('refresh', { url: url });
......
......@@ -103,7 +103,7 @@
{ field: 'cost_paypal_fee', title: 'Paypal费用', width: '120', sortable: true, iscount: true },
{ field: 'cost_refund_commisson', title: '退款佣金费用', width: '130', sortable: true, iscount: true },
{ field: 'cost_handle_bailun', title: '处理费(百伦)', width: '130', sortable: true, iscount: true },
{ field: 'cost_handle_platform', title: '处理费(平台)', width: '130', sortable: true, iscount: true },
{ field: 'cost_handle_platform', title: '平台操作费', width: '130', sortable: true, iscount: true },
{ field: 'cost_first', title: '头程费', width: '100', sortable: true, iscount: true },
{ field: 'cost_tail', title: '尾程费', width: '100', sortable: true, iscount: true },
{ field: 'profit_total', title: '利润', width: '100', sortable: true, iscount: true },
......
......@@ -41,7 +41,7 @@
<th>头程费</th>
<th>尾程费</th>
<th>处理费(百伦)</th>
<th>处理费(平台)</th>
<th>平台操作费</th>
<th>预收金额</th>
<th>利润</th>
<th>利润率%</th>
......
......@@ -95,7 +95,7 @@
}
},
{
field: 'cost_handle_platform', title: '处理费(平台)', width: '120', sortable: true, iscount: true, formatter: function (idx, data) {
field: 'cost_handle_platform', title: '平台操作费', width: '120', sortable: true, iscount: true, formatter: function (idx, data) {
return '<span onclick="ShowDetail(\'' + data.website + '\')" style="cursor:pointer;">' + data.cost_handle_platform + '</span>';
}
},
......

@{
ViewData["Title"] = "";
ViewData["Title"] = "非FBA销售订单";
Layout = "~/Pages/Shared/_MainLayout.cshtml";
ViewBag.Nav = new string[] { "订单", ("非fba销售订单") };
}
......@@ -89,65 +89,73 @@
function list() {
var columns = [
{ field: 'transaction_id', title: '交易号',width:'200',sortable:true },
{ field: 'transaction_id', title: '交易号', width: '200', sortable: false },
{
field: 'bailun_order_id', title: '订单编号', width: '200', sortable: true, formatter: function (idx, data) {
field: 'bailun_order_id', title: '订单编号', width: '200', sortable: false, formatter: function (idx, data) {
return '<div class="mules" title="' + data.bailun_order_id + '">' + data.bailun_order_id + '</div>';
}
},
{
field: 'origin_order_id', title: '平台订单号', width: '190', sortable: true, formatter: function (idx, data) {
field: 'origin_order_id', title: '平台订单号', width: '190', sortable: false, formatter: function (idx, data) {
return '<div class="mules" title="' + data.origin_order_id + '">' + data.origin_order_id + '</div>';
}
},
{
field: 'bailun_sku', title: 'sku编码', width: '130', sortable: true, iscount: true, formatter: function (idx, data) {
field: 'bailun_sku', title: 'sku编码', width: '130', sortable: true, iscount: false, formatter: function (idx, data) {
return '<div class="mules" title="' + data.bailun_sku + '">' + data.bailun_sku+'</div>';
}
},
{ field: '', title: '刊登sku编码', width: '130', sortable: true },
{ field: '', title: '刊登sku编码', width: '130', sortable: false },
{
field: 'sku_image', title: '主图', width: '100', sortable: true, iscount: true, formatter: function (idx, data) {
field: 'sku_image', title: '主图', width: '100', sortable: false, iscount: true, formatter: function (idx, data) {
return '<img src="' + data.sku_image + '" style="width:60px" />';
}
},
{
field: 'category_name', title: '分类名称', width: '150', sortable: true, formatter: function (idx, data) {
field: 'category_name', title: '分类名称', width: '150', sortable: false, formatter: function (idx, data) {
return '<div class="mules" title="' + data.category_name + '">' + data.category_name + '</div>';
}
},
{
field: 'sku_title_en', title: '英文标题', width: '130', sortable: true, formatter: function (idx, data) {
field: 'sku_title_en', title: '英文标题', width: '130', sortable: false, formatter: function (idx, data) {
return '<div class="mules" title="' + data.sku_title_en + '">' + data.sku_title_en + '</div>';
}
},
{
field: 'sku_title_cn', title: '中文标题', width: '130', sortable: true, formatter: function (idx, data) {
field: 'sku_title_cn', title: '中文标题', width: '130', sortable: false, formatter: function (idx, data) {
return '<div class="mules" title="' + data.sku_title_cn + '">' + data.sku_title_cn + '</div>';
}
},
{ field: 'color', title: '颜色', width: '90', sortable: true },
{ field: 'character', title: '规格', width: '90', sortable: true },
{ field: 'color', title: '颜色', width: '90', sortable: false },
{ field: 'character', title: '规格', width: '90', sortable: false },
{ field: 'price', title: '价格', width: '100', sortable: true },
{ field: 'bailun_sku_quantity_ordered', title: '订购数量', width: '110', sortable: true },
{ field: 'amount_product', title: '合计金额', width: '100', sortable: true, iscount: true },
{ field: 'order_currency', title: '币种', width: '90', sortable: true },
{ field: '', title: '币种(中)', width: '100', sortable: true },
{ field: 'platform_type', title: '平台', width: '100', sortable: true },
{ field: 'website', title: '站点', width: '90', sortable: true },
{ field: 'seller_account', title: '销售帐号', width: '90', sortable: true },
{ field: 'seller_name', title: '销售员', width: '90', sortable: true },
{ field: 'order_currency', title: '币种', width: '90', sortable: false },
{ field: '', title: '币种(中)', width: '100', sortable: false },
{ field: 'platform_type', title: '平台', width: '100', sortable: false },
{ field: 'website', title: '站点', width: '90', sortable: false },
{
field: 'seller_account', title: '销售帐号', width: '110', sortable: false, formatter: function (idx, data) {
return '<div class="mules" title="' + data.seller_account + '">' + data.seller_account + '</div>';
}
},
{
field: 'seller_name', title: '销售员', width: '110', sortable: false, formatter: function (idx, data) {
return '<div class="mules" title="' + data.seller_name + '">' + data.seller_name + '</div>';
}
},
{
field: 'salecount', title: 'fba订单', width: '100', sortable: false, formatter: function (idx, data) {
return data.isfba == 1 ? "是" : "否";
}
},
{ field: 'bailun_order_status', title: '订单状态', width: '100', sortable: true },
{ field: 'warehouse_name', title: '发货仓库', width: '110', sortable: true },
{ field: 'shipping_status', title: '发货状态', width: '140', sortable: true },
{ field: 'create_time', title: '创建时间', width: '140', sortable: true },
{ field: 'order_update_time', title: '更新时间', width: '140', sortable: true },
{ field: 'gmt_modified', title: '同步时间', width: '140', sortable: true },
{ field: 'bailun_order_status', title: '订单状态', width: '100', sortable: false },
{ field: 'warehouse_name', title: '发货仓库', width: '110', sortable: false },
{ field: 'shipping_status', title: '发货状态', width: '140', sortable: false },
{ field: 'create_time', title: '创建时间', width: '160', sortable: true },
{ field: 'order_update_time', title: '更新时间', width: '160', sortable: true },
{ field: 'gmt_modified', title: '同步时间', width: '160', sortable: true },
];
var url = '@Url.Content("~/Reports/Orders/SkuOrderListJson")' + '?' + $("#toolbar").serialize();
......
......@@ -83,7 +83,7 @@
<!--下拉选择搜索控件-->
<script src="/css/bootstrap-select-1.12.4/js/bootstrap-select.js"></script>
<!--常用js方法-->
<script src="/js/common.js?=201902260912"></script>
<script src="/js/common.js?=201902280912"></script>
@RenderSection("scripts", required: false)
<script type="text/javascript">
......
......@@ -43,6 +43,22 @@ function OnlyTable(tableId, aoColumn, actionUrl, serverParams,tbParams) {
paginationNextText: "下一页",
paginationLastText: "最后页",
onLoadSuccess: function (data) {
if (tbParams.showCount) {
//替换汇总行的相关列值
var tr = $('.fixed-table-footer').find('tr');
for (var c in aoColumn) {
var key = aoColumn[c].field;
if (aoColumn[c].iscount) {
for (var v in data.count_row) {
if (key == v) {
tr.find('td').eq(c).children('div').first().html(data.count_row[v]);
break;
}
}
}
}
}
if (tbParams != undefined && tbParams.loadsuccess) {
tbParams.loadsuccess(data);
}
......
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