Commit abeccd91 by guanzhenshan

123

parent e2e8e19a
......@@ -122,7 +122,7 @@ namespace Bailun.DC.Models.Orders
/// <summary>
/// 币种
/// </summary>
public string currency { get; set; }
public string order_currency { get; set; }
/// <summary>
/// 预收款(已经收款未发货的这部分订单)
......
......@@ -88,5 +88,10 @@ namespace Bailun.DC.Models
/// </summary>
public int warehouse_id { get; set; }
/// <summary>
/// 仓库属性:(自发货仓,第三方仓)
/// </summary>
public string warehouse_type_ex { get; set; }
}
}
......@@ -6,11 +6,96 @@ using Bailun.DC.DB;
using Dapper;
using MySql.Data.MySqlClient;
using System.Linq;
using Bailun.DC.Models.Orders;
namespace Bailun.DC.Services
{
public class OrdersServices
{
#region
/// <summary>
/// 平台费用流水
/// </summary>
/// <param name="parameter"></param>
/// <param name="platform"></param>
/// <param name="start"></param>
/// <param name="end"></param>
/// <param name="total"></param>
/// <returns></returns>
public List<dc_base_oms_order> ListPlatformCost(BtTableParameter parameter,string platform,DateTime? start,DateTime? end,ref int total)
{
var sql = "select * from dc_base_oms_order where bailun_order_status!='Canceled' ";
var sqlparam = new DynamicParameters();
if (!string.IsNullOrEmpty(platform))
{
sql += " and platform_type=@platform_type";
sqlparam.Add("platform_type", platform);
}
if (start.HasValue)
{
sql += " and paid_time>=@paidtimestart";
sqlparam.Add("paidtimestart", start.Value.ToString("yyyy-MM-dd"));
}
if (end.HasValue)
{
sql += " and paid_time<@paidtimeend";
sqlparam.Add("paidtimeend", end.Value.AddDays(1).ToString("yyyy-MM-dd"));
}
using (var cn = new MySqlConnection(Common.GlobalConfig.ConnectionString))
{
if (cn.State == System.Data.ConnectionState.Closed)
{
cn.Open();
}
var obj = cn.Page<dc_base_oms_order>(parameter.pageIndex, parameter.limit, sql, ref total, sqlparam);
return obj.AsList();
}
}
public dc_base_oms_order ListPlatformCostCount(string platform, DateTime? start, DateTime? end)
{
var sql = "select sum(amount_sales*seller_order_exchange_rate) amount_sales,sum(cost_platform_fee*seller_order_exchange_rate) as cost_platform_fee,sum(cost_fba_fee*seller_order_exchange_rate) cost_fba_fee,sum(cost_promotion*seller_order_exchange_rate) cost_promotion,sum(cost_paypal_fee*seller_order_exchange_rate) cost_paypal_fee,sum(cost_tail) cost_tail,sum(cost_handle_bailun) cost_handle_bailun from dc_base_oms_order where bailun_order_status!='Canceled' ";
var sqlparam = new DynamicParameters();
if (!string.IsNullOrEmpty(platform))
{
sql += " and platform_type=@platform_type";
sqlparam.Add("platform_type", platform);
}
if (start.HasValue)
{
sql += " and paid_time>=@paidtimestart";
sqlparam.Add("paidtimestart", start.Value.ToString("yyyy-MM-dd"));
}
if (end.HasValue)
{
sql += " and paid_time<@paidtimeend";
sqlparam.Add("paidtimeend", end.Value.AddDays(1).ToString("yyyy-MM-dd"));
}
using (var cn = new MySqlConnection(Common.GlobalConfig.ConnectionString))
{
if (cn.State == System.Data.ConnectionState.Closed)
{
cn.Open();
}
var obj = cn.QueryFirst<dc_base_oms_order>(sql, sqlparam);
return obj;
}
}
#endregion
#region 亚马逊
/// <summary>
/// 获取亚马逊的销售统计数据(非FBA)
......@@ -22,30 +107,56 @@ namespace Bailun.DC.Services
/// <param name="end">付款结束时间</param>
/// <param name="total">符合条件的记录数</param>
/// <returns></returns>
public List<Models.Orders.mAmazonStatistics> ListAmazonStatistics(BtTableParameter parameter, string account, string website, DateTime start, DateTime end, ref int total)
public List<Models.Orders.mAmazonStatistics> ListAmazonStatistics(BtTableParameter parameter, string account, string website, DateTime start, DateTime end,string warehoursetype,string warehousecode, ref int total)
{
var sqlparam = new DynamicParameters();
var sql = @"select platform_type,seller_account,website,sum(amount_product*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(id) 'order_count',sum(cost_total) 'cost_count',sum(cost_shipping) '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 from dc_base_oms_order where paid_time>='" + start.ToString("yyyy-MM-dd") + "' and paid_time<'" + end.AddDays(1).ToString("yyyy-MM-dd") + "' and platform_type='Amazon' and bailun_order_status!='Canceled' ";
var sql = @"select platform_type,seller_account,website,order_currency,sum(amount_sales*seller_order_exchange_rate*bailun_sku_quantity_shipped) 'amount_product',sum(cost_product*bailun_sku_quantity_shipped) 'cost_product',sum(cost_platform_fee*seller_order_exchange_rate*bailun_sku_quantity_shipped) 'platform_fee',sum(cost_first*bailun_sku_quantity_shipped) 'head_fee',count(t1.id) 'order_count',sum(cost_total*bailun_sku_quantity_shipped) 'cost_count',sum(cost_tail*bailun_sku_quantity_shipped) 'nofba_logisticsfee',sum(profit_total*bailun_sku_quantity_shipped) 'profit_count',(sum(profit_total*bailun_sku_quantity_shipped)/sum(amount_sales*seller_order_exchange_rate*bailun_sku_quantity_shipped)) 'profit_rate',sum(amount_prepaid) amount_prepaid,sum(amount_refund*seller_order_exchange_rate*bailun_sku_quantity_shipped) amount_refund from dc_base_oms_sku t1";
var presql = "select platform_type,seller_account,website,order_currency,sum(amount_prepaid) as amount_prepaid from dc_base_oms_sku t1 ";
if (!string.IsNullOrEmpty(warehoursetype))
{
sql += " join dc_base_warehouse t2 on t1.warehouse_code=t2.warehouse_code and t2.warehouse_type_ex=@warehoursetype";
presql += " join dc_base_warehouse t2 on t1.warehouse_code=t2.warehouse_code and t2.warehouse_type_ex=@warehoursetype";
sqlparam.Add("warehoursetype", warehoursetype);
}
if (!string.IsNullOrEmpty(warehousecode))
{
if (!string.IsNullOrEmpty(warehoursetype))
{
sql += " and t2.warehouse_code=@warehouse_code";
presql += " and t2.warehouse_code=@warehouse_code";
sqlparam.Add("warehouse_code", warehousecode);
}
else
{
sql += " join dc_base_warehouse t2 on t1.warehouse_code=t2.warehouse_code and t2.warehouse_code=@warehouse_code";
presql += " join dc_base_warehouse t2 on t1.warehouse_code=t2.warehouse_code and t2.warehouse_code=@warehouse_code";
sqlparam.Add("warehouse_code", warehousecode);
}
}
var fromsql = " where paid_time>='" + start.ToString("yyyy-MM-dd") + "' and paid_time<'" + end.AddDays(1).ToString("yyyy-MM-dd") + "' and platform_type='Amazon' and bailun_order_status!='Canceled' ";
if (!string.IsNullOrWhiteSpace(account))
{
sql += " and seller_account=@seller_account";
fromsql += " and seller_account=@seller_account";
sqlparam.Add("seller_account", account);
}
if (!string.IsNullOrWhiteSpace(website))
{
sql += " and website=@website";
fromsql += " and website=@website";
sqlparam.Add("website", website);
}
sql += " group by seller_account,website,order_currency,platform_type";
var prefromsql = fromsql;
fromsql += " and bailun_sku_quantity_shipped>0";
fromsql += " group by seller_account,website,order_currency,platform_type";
if (!string.IsNullOrWhiteSpace(parameter.sort))
{
sql += " order by "+parameter.sort +" "+parameter.order;
fromsql += " order by "+parameter.sort +" "+parameter.order;
}
using (var cn = new MySqlConnection(Common.GlobalConfig.ConnectionString))
......@@ -55,9 +166,26 @@ namespace Bailun.DC.Services
cn.Open();
}
var obj = cn.Page<Models.Orders.mAmazonStatistics>(parameter.pageIndex, parameter.limit, sql, ref total, sqlparam);
var obj = cn.Page<Models.Orders.mAmazonStatistics>(parameter.pageIndex, parameter.limit, sql+fromsql, ref total, sqlparam);
return obj.AsList();
//另外计算预收款金额
var list = obj.AsList();
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)) + "') and order_currency in ('" + string.Join("','", list.Select(a => a.order_currency)) + "')";
prefromsql += " group by seller_account,website,order_currency,platform_type";
var obj1 = cn.Query<Models.Orders.mAmazonStatistics>(presql+prefromsql,sqlparam);
foreach (var item in list)
{
var temp = obj1.Where(a => a.seller_account == item.seller_account && a.website == item.website && a.order_currency == item.order_currency && a.platform_type == item.platform_type).FirstOrDefault();
if (temp != null)
{
item.amount_prepaid = temp.amount_prepaid;
}
}
return list;
}
}
......@@ -72,23 +200,51 @@ namespace Bailun.DC.Services
/// <param name="end">付款结束时间</param>
/// <param name="total">符合条件的记录数</param>
/// <returns></returns>
public Models.Orders.mAmazonStatistics ListAmazonStatisticsCount(string account, string website, DateTime start, DateTime end)
public Models.Orders.mAmazonStatistics ListAmazonStatisticsCount(string account, string website, DateTime start, DateTime end,string warehoursetype,string warehousecode)
{
var sqlparam = new DynamicParameters();
var sql = @"select sum(amount_product*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(id) 'order_count',sum(cost_total) 'cost_count',sum(cost_shipping) '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 from dc_base_oms_order where paid_time>='" + start.ToString("yyyy-MM-dd") + "' and paid_time<'" + end.AddDays(1).ToString("yyyy-MM-dd") + "' and platform_type='Amazon' and bailun_order_status!='Canceled' ";
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*bailun_sku_quantity_shipped) 'amount_product',sum(cost_product*bailun_sku_quantity_shipped) 'cost_product',sum(cost_platform_fee*seller_order_exchange_rate*bailun_sku_quantity_shipped) 'platform_fee',sum(cost_first*bailun_sku_quantity_shipped) 'head_fee',count(t1.id) 'order_count',sum(cost_total*bailun_sku_quantity_shipped) 'cost_count',sum(cost_tail*bailun_sku_quantity_shipped) 'nofba_logisticsfee',sum(profit_total*bailun_sku_quantity_shipped) 'profit_count',(sum(profit_total*bailun_sku_quantity_shipped)/sum(amount_sales*seller_order_exchange_rate*bailun_sku_quantity_shipped)) 'profit_rate',sum(amount_prepaid) amount_prepaid,sum(amount_refund*seller_order_exchange_rate*bailun_sku_quantity_shipped) amount_refund from dc_base_oms_sku t1 ";
if (!string.IsNullOrEmpty(warehoursetype))
{
sql += " join dc_base_warehouse t2 on t1.warehouse_code=t2.warehouse_code and t2.warehouse_type_ex=@warehoursetype";
presql += " join dc_base_warehouse t2 on t1.warehouse_code=t2.warehouse_code and t2.warehouse_type_ex=@warehoursetype";
sqlparam.Add("warehoursetype", warehoursetype);
}
if (!string.IsNullOrEmpty(warehousecode))
{
if (!string.IsNullOrEmpty(warehoursetype))
{
sql += " and t2.warehouse_code=@warehouse_code";
presql += " and t2.warehouse_code=@warehouse_code";
sqlparam.Add("warehouse_code", warehousecode);
}
else
{
sql += " join dc_base_warehouse t2 on t1.warehouse_code=t2.warehouse_code and t2.warehouse_code=@warehouse_code";
presql += " join dc_base_warehouse t2 on t1.warehouse_code=t2.warehouse_code and t2.warehouse_code=@warehouse_code";
sqlparam.Add("warehouse_code", warehousecode);
}
}
var fromsql = " where paid_time>='" + start.ToString("yyyy-MM-dd") + "' and paid_time<'" + end.AddDays(1).ToString("yyyy-MM-dd") + "' and platform_type='Amazon' and bailun_order_status!='Canceled' ";
if (!string.IsNullOrWhiteSpace(account))
{
sql += " and seller_account=@seller_account";
fromsql += " and seller_account=@seller_account";
sqlparam.Add("seller_account", account);
}
if (!string.IsNullOrWhiteSpace(website))
{
sql += " and website=@website";
fromsql += " and website=@website";
sqlparam.Add("website", website);
}
var prefromsql = fromsql;
fromsql += " and bailun_sku_quantity_shipped>0";
using (var cn = new MySqlConnection(Common.GlobalConfig.ConnectionString))
{
......@@ -99,7 +255,14 @@ namespace Bailun.DC.Services
try
{
var obj = cn.QueryFirst<Models.Orders.mAmazonStatistics>(sql, sqlparam);
var obj = cn.QueryFirst<Models.Orders.mAmazonStatistics>(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;
}
......@@ -394,6 +557,7 @@ namespace Bailun.DC.Services
}
}
/// <summary>
/// 平台财务费用
/// </summary>
......@@ -1394,6 +1558,7 @@ namespace Bailun.DC.Services
}
#endregion
#region Ebay
......@@ -1552,4 +1717,5 @@ namespace Bailun.DC.Services
#endregion
}
}
......@@ -256,5 +256,34 @@ namespace Bailun.DC.Services
}
}
/// <summary>
/// 根据仓库设置属性获取仓库列表
/// </summary>
/// <param name="type"></param>
/// <returns></returns>
public List<dc_base_warehouse> ListWarehouseByExtType(string type)
{
var param = new DynamicParameters();
using (var cn = new MySqlConnection(Common.GlobalConfig.ConnectionString))
{
if (cn.State == System.Data.ConnectionState.Closed)
{
cn.Open();
}
var sql = "select * from dc_base_warehouse ";
if (!string.IsNullOrWhiteSpace(type))
{
sql += " where warehouse_type_ex=@type";
param.Add("type", type);
}
return cn.Query<dc_base_warehouse>(sql, param).AsList();
}
}
}
}
......@@ -16,7 +16,85 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
return View();
}
#region 平台费用流水
public ActionResult ListPlatformCost(string p)
{
ViewBag.platform = p;
return View();
}
/// <summary>
/// 平台费用流水
/// </summary>
/// <param name="parameter"></param>
/// <param name="platform"></param>
/// <param name="start"></param>
/// <param name="end"></param>
/// <returns></returns>
public string ListPlatformCostJson(BtTableParameter parameter, string platform, DateTime? start, DateTime? end)
{
var total = 0;
var obj = new Services.OrdersServices().ListPlatformCost(parameter, platform, start, end, ref total);
var countM = new Services.OrdersServices().ListPlatformCostCount(platform, start, end);
var list = obj.Select(p => new {
p.bailun_order_id,
p.platform_type,
p.website,
p.seller_account,
amount_sales = (p.amount_sales*p.seller_order_exchange_rate).ToString("N2"),
amount_refund = (p.amount_refund*p.seller_order_exchange_rate).ToString("N2"),
amount_prepaid = p.amount_prepaid.ToString("N2"),
cost_promotion = (p.cost_promotion*p.seller_order_exchange_rate).ToString("N2"),
cost_platform_fee = (p.cost_platform_fee*p.seller_order_exchange_rate).ToString("N2"),
cost_product = p.cost_product.ToString("N2"),
cost_package = p.cost_package.ToString("N2"),
cost_fba_fee = (p.cost_fba_fee*p.seller_order_exchange_rate).ToString("N2"),
cost_paypal_fee = (p.cost_paypal_fee*p.seller_order_exchange_rate).ToString("N2"),
cost_refund_commisson = (p.cost_refund_commisson*p.seller_order_exchange_rate).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"),
paid_time = p.paid_time.ToString("yyyy-MM-dd HH:mm:ss"),
});
return JsonConvert.SerializeObject(new
{
total = total,
rows = list,
count_row = new {
bailun_order_id = "总计",
amount_sales = countM.amount_sales.ToString("N2"),
amount_refund = (countM.amount_refund).ToString("N2"),
amount_prepaid = countM.amount_prepaid.ToString("N2"),
cost_promotion = (countM.cost_promotion).ToString("N2"),
cost_platform_fee = (countM.cost_platform_fee).ToString("N2"),
cost_product = countM.cost_product.ToString("N2"),
cost_package = countM.cost_package.ToString("N2"),
cost_fba_fee = (countM.cost_fba_fee).ToString("N2"),
cost_paypal_fee = (countM.cost_paypal_fee).ToString("N2"),
cost_refund_commisson = (countM.cost_refund_commisson).ToString("N2"),
cost_handle_bailun = countM.cost_handle_bailun.ToString("N2"),
cost_handle_platform = countM.cost_handle_platform.ToString("N2"),
cost_first = countM.cost_first.ToString("N2"),
cost_tail = countM.cost_tail.ToString("N2"),
profit_total = countM.profit_total.ToString("N2"),
profit_rate = ((countM.profit_total/ countM.amount_sales) * 100).ToString("N2"),
}
});
}
#endregion
#region 亚马逊 FBA+FBA
/// <summary>
/// 亚马逊销售统计
/// </summary>
......@@ -35,7 +113,7 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
/// <param name="start">付款开始时间</param>
/// <param name="end">付款结束时间</param>
/// <returns></returns>
public string ListAmazonSaleStatisticsJson(BtTableParameter parameter, string sellaccount, string website, DateTime start, DateTime end)
public string ListAmazonSaleStatisticsJson(BtTableParameter parameter, string sellaccount, string website, DateTime start, DateTime end,string warehousetype, string warehousecode)
{
var total = 0;
var service = new Services.OrdersServices();
......@@ -43,9 +121,9 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
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 list = service.ListAmazonStatistics(parameter, sellaccount, website, start, end, warehousetype,warehousecode, ref total);
var countM = service.ListAmazonStatisticsCount(sellaccount, website, start, end);
var countM = service.ListAmazonStatisticsCount(sellaccount, website, start, end,warehousetype,warehousecode);
countM.website = "总计:";
countM.amount_product = Math.Round(countM.amount_product, 2, MidpointRounding.AwayFromZero);
countM.cost_count = Math.Round(countM.cost_count, 2, MidpointRounding.AwayFromZero);
......@@ -85,7 +163,7 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
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.currency,
p.order_currency,
amount_prepaid = p.amount_prepaid.ToString("N2"),
amount_refund = p.amount_refund>0?p.amount_refund.ToString("N2"):"0",
});
......@@ -105,7 +183,7 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
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"),
countM.currency,
countM.order_currency,
amount_prepaid = countM.amount_prepaid.ToString("N2"),
amount_refund = countM.amount_refund > 0 ? countM.amount_refund.ToString("N2") : "0",
}
......@@ -205,7 +283,7 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
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"),
countM.currency,
countM.order_currency,
amount_prepaid = countM.amount_prepaid.ToString("N2"),
amount_refund = countM.amount_refund > 0 ? countM.amount_refund.ToString("N2") : "0",
cost_fba_fee = countM.cost_fba_fee > 0 ? countM.cost_fba_fee.ToString("N2") : "0",
......@@ -777,6 +855,8 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
return JsonConvert.SerializeObject(new { total = total, rows = obj,count_row = countM });
}
#endregion
#region Ebay
/// <summary>
......
......@@ -8,9 +8,25 @@
<div class="row">
<div class="col-sm-12">
<div class="ibox-content m-b-sm border-bottom">
<div class="alert alert-warning">提示:1、因WMS接口原因,头程费还取不到,导致利润偏高;2、报表的收入、费用和利润都是取已发货部分的金额;3、预收款取的是未发货部分的销售额;4、所有金额和费用都是按sku维度获取的</div>
<form id="toolbar">
<div class="form-inline" style="line-height:40px;">
<div class="form-group">
<label>仓库类型</label>
<select id="warehousetype" name="warehousetype" class="form-control">
<option value="">请选择仓库类型</option>
<option value="自发货仓">自发货仓</option>
<option value="第三方仓">第三方仓</option>
</select>
</div>
<div class="form-group">
<label>&nbsp;</label>
<select id="warehousecode" name="warehousecode" class="form-control">
<option value="">请选择仓库</option>
</select>
</div>
<div class="form-group">
<label>销售帐号:</label>
<select id="saleaccount" name="saleaccount" class="form-control" style="width:160px;">
<option value="">选择帐号</option>
......@@ -69,6 +85,12 @@
listAccount();
listWebsite();
listWarehouse();
$('#warehousetype').change(function () {
listWarehouse();
})
})
function list() {
......@@ -82,7 +104,7 @@
},
{ 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_product', 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>';
}
},
......@@ -123,7 +145,7 @@
}
},
{
field: 'amount_prepaid', title: '预收金额', width: '120', sortable: true, iscount: true, formatter: function (idx, data) {
field: 'amount_prepaid', title: '预收金额', width: '120', sortable: false, iscount: true, formatter: function (idx, data) {
return '<span class="alink" onclick="ShowDetail(\'' + data.platform_type + '\',\'' + data.website + '\',\'' + data.seller_account + '\',\'预收金额\',\'amount_prepaid\',1)">' + data.amount_prepaid + '</span>';
}
},
......@@ -182,6 +204,32 @@
layer_show(platform + " " + website + " " + $('#start').val() + "至" + $('#end').val() + ' 订单明细', '@Url.Content("~/Reports/Orders/ListOrderDetail?platform=")' + platform + '&website=' + website + '&account=' + account + '&start=' + $('#start').val() + '&end=' + $('#end').val() + '&col=' + colval + '&coltitle=' + coltitle + '&showsingle=' + single, '90%', '90%');
}
function listWarehouse() {
var type = $('#warehousetype').val();
if (type == '') {
$('#warehousecode').html('<option value="">请选择仓库</option>');
return false;
}
$.submit({
url: '@Url.Content("~/Home/ListWarehouseByExtType")',
type: 'POST',
paramData: 'type=' + type,
func: function (result) {
if (result != null && result != undefined) {
$('#warehousecode').html('<option value="">请选择仓库</option>');
for (var i = 0; i < result.length; i++) {
$('#warehousecode').append('<option value="' + result[i].code + '">' + result[i].name + '</option>');
}
}
}
})
}
</script>
}
......@@ -114,11 +114,6 @@
}
},
{
field: 'cost_paypal_fee', title: 'paypal费用', width: '110', sortable: true, iscount: true, formatter: function (idx, data) {
return '<span class="alink" onclick="ShowDetail(\'' + data.platform_type + '\',\'' + data.website + '\',\'' + data.seller_account + '\',\'paypal费用\',\'cost_paypal_fee\',1)">' + data.cost_paypal_fee + '</span>';
}
},
{
field: 'head_fee', 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>';
}
......

@{
ViewData["Title"] = "平台费用流水";
Layout = "~/Pages/Shared/_MainLayout.cshtml";
ViewBag.Nav = new string[] { "平台费用流水", ViewBag.platform };
}
<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;">
<input type="hidden" id="platform" name="platform" value="@ViewBag.platform" />
<div class="form-group">
<label>付款时间</label>
<input id="start" name="start" type="text" class="form-control" style="width:130px;" value="@(DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd"))" />
<span>至</span>
<input id="end" name="end" type="text" class="form-control" style="width:130px;" value="@(DateTime.Now.ToString("yyyy-MM-dd"))" />
</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" style="table-layout:fixed;"></table>
</div>
</div>
</div>
@section css{
<style>
.mules {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.alink {
color: cornflowerblue;
cursor: pointer;
}
</style>
}
@section scripts{
<script type="text/javascript">
var tb;
$(document).ready(function () {
laydate.render({ elem: '#start' });
laydate.render({ elem: '#end' });
var height = document.body.clientHeight;
$("#roletable").attr("data-height", (height - 160));
list();
listAccount();
listWebsite();
listWarehouse();
$('#warehousetype').change(function () {
listWarehouse();
})
})
function list() {
var columns = [
{ field: 'bailun_order_id', title: '订单号', width: '220' },
{ field: 'platform_type', title: '平台名称', width: '100' },
{ field: 'website', title: '平台站点', width: '90' },
{
field: 'seller_account', title: '卖家帐号', width: '160', formatter: function (idx, data) {
return '<div class="mules" title="' + data.seller_account + '">' + data.seller_account + '</div>';
}
},
{ field: 'amount_sales', title: '销售额', width: '120', sortable: true, iscount: true },
{ field: 'cost_platform_fee', title: '平台费', width: '100', sortable: true, iscount: true },
//{ field: 'cost_package', title: '包装费', width: '100', sortable: false, iscount: true },
@if (ViewBag.platform == "FBA")
{
@Html.Raw("{ field: 'cost_fba_fee', title: 'FBA费用', width: '100', sortable: true, iscount: true },")
}
@if (ViewBag.platform == "FBA" || ViewBag.platform == "Amazon")
{
@Html.Raw("{ field: 'cost_promotion', title: '促销费', width: '100', sortable: true, iscount: true },")
}
@if (ViewBag.platform == "Ebay")
{
@Html.Raw("{ field: 'cost_paypal_fee', title: 'Paypal费用', width: '120', sortable: true, iscount: true },")
}
@if (ViewBag.platform != "FBA")
{
@Html.Raw("{ field: 'cost_tail', title: '尾程费', width: '120', sortable: true, iscount: true },{ field: 'cost_handle_bailun', title: '第三方仓处理费', width: '160', sortable: true, iscount: true},")
}
//{ field: 'cost_refund_commisson', title: '退款佣金', width: '120', sortable: true, iscount: true },
//{ field: 'cost_handle_platform', title: '操作费', width: '120', sortable: true, iscount: true },
{ field: 'cost_product', title: '产品成本', width: '100', sortable: true, iscount: true },
{ field: 'cost_first', title: '头程费', width: '120', sortable: true, iscount: true },
{ field: 'amount_prepaid', title: '预收款金额', width: '130', sortable: true, iscount: true },
{ field: 'profit_total', title: '利润', width: '120', sortable: true, iscount: true },
{ field: 'profit_rate', title: '利润率', width: '120', sortable: true, iscount: true },
{ field: 'amount_refund', title: '退款金额', width: '110', sortable: true, iscount: true },
{ field: 'paid_time', title: '付款时间', width: '160', sortable: true, iscount: true },
];
var url = '@Url.Content("~/Reports/Orders/ListPlatformCostJson")' + '?' + $("#toolbar").serialize();
if (tb == undefined) {
tb = OnlyTable("roletable", columns, url, "", {showfooter: true, showCount: true});
}
else {
tb.bootstrapTable('refresh', { url: url });
}
}
function listAccount() {
$.submit({
url: '@Url.Content("~/Reports/Orders/ListAccount")',
type:'POST',
paramData: 'platform=Amazon',
func: function (result) {
if (result != null && result != undefined) {
$('#saleaccount').html('<option value="">选择帐号</option>');
for (var i = 0; i < result.length; i++) {
$('#saleaccount').append('<option value="' + result[i] + '">' + result[i]+'</option>');
}
}
}
})
}
function listWebsite() {
$.submit({
url: '@Url.Content("~/Reports/Orders/ListWebSite")',
type:'POST',
paramData: 'platform=Amazon',
func: function (result) {
if (result != null && result != undefined) {
$('#website').html('<option value="">选择站点</option>');
for (var i = 0; i < result.length; i++) {
$('#website').append('<option value="' + result[i] + '">' + result[i]+'</option>');
}
}
}
})
}
function ShowDetail(platform, website, account, coltitle, colval, single) {
layer_show(platform + " " + website + " " + $('#start').val() + "至" + $('#end').val() + ' 订单明细', '@Url.Content("~/Reports/Orders/ListOrderDetail?platform=")' + platform + '&website=' + website + '&account=' + account + '&start=' + $('#start').val() + '&end=' + $('#end').val() + '&col=' + colval + '&coltitle=' + coltitle + '&showsingle=' + single, '90%', '90%');
}
function listWarehouse() {
var type = $('#warehousetype').val();
if (type == '') {
$('#warehousecode').html('<option value="">请选择仓库</option>');
return false;
}
$.submit({
url: '@Url.Content("~/Home/ListWarehouseByExtType")',
type: 'POST',
paramData: 'type=' + type,
func: function (result) {
if (result != null && result != undefined) {
$('#warehousecode').html('<option value="">请选择仓库</option>');
for (var i = 0; i < result.length; i++) {
$('#warehousecode').append('<option value="' + result[i].code + '">' + result[i].name + '</option>');
}
}
}
})
}
</script>
}
......@@ -48,5 +48,23 @@ namespace Bailun.DC.Web.Controllers
var result = new Services.SkuInfoServices().ListSkuCategory();
return Json(result);
}
/// <summary>
/// 根据仓库自设置属性获取仓库列表
/// </summary>
/// <param name="type">自发货仓或第三方仓</param>
/// <returns></returns>
[HttpPost]
public JsonResult ListWarehouseByExtType(string type)
{
var result = new Services.WareHouseServices().ListWarehouseByExtType(type);
var list = result.Select(p => new {
code = p.warehouse_code,
name = p.warehouse_name
});
return Json(list);
}
}
}
\ No newline at end of file
......@@ -170,6 +170,16 @@
<span>平台费异常订单</span>
</a>
</li>
<li>
<a class="J_menuItem" href="@Url.Content("~/Reports/Orders/ListPlatformCost?p=Amazon")" data-index="0" style="padding-left:74px;">
<span>自发货平台费用流水</span>
</a>
</li>
<li>
<a class="J_menuItem" href="@Url.Content("~/Reports/Orders/ListPlatformCost?p=FBA")" data-index="0" style="padding-left:74px;">
<span>FBA平台费用流水</span>
</a>
</li>
</ul>
</li>
<li>
......@@ -189,6 +199,11 @@
<span>订单流水</span>
</a>
</li>
<li>
<a class="J_menuItem" href="@Url.Content("~/Reports/Orders/ListPlatformCost?p=Ebay")" data-index="0" style="padding-left:74px;">
<span>Ebay平台费用流水</span>
</a>
</li>
</ul>
</li>
<li>
......
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