Commit 4a7cf88f by zhouminghui

营业外收入的mx站点数值小于0的话,就放入营业外支出

parent 0f445433
......@@ -902,6 +902,10 @@ or (is_lend=2 and cost_form=1)) and pay_time>= @start and pay_time< @end ");
return x;
}).ToList();
}
if (input.FeeName.Contains("加:营业外收入"))
{
data.Remove(data.Where(x => x.platform_type == "亚马逊" && x.website.ToLower() == "mx" && x.original_amount < 0).FirstOrDefault());
}
data = data.Select(x =>
{
if (x.platform_type.Contains("万邑通") || x.platform_type.Contains("速卖通"))
......@@ -963,7 +967,8 @@ ON s2.id = s1.order_fee_config_id WHERE s1.month = @month ");
}
else if (input.FeeName.Contains("减:营业外支出"))
{
sql.Append("AND s2.datacenter_col LIKE '%营业外支出'");
//2021-09-23陈文静提出需求 营业外收入的mx站点数值小于0的话,就放入营业外支出
sql.Append("AND s2.datacenter_col LIKE '%营业外支出' or (s2.datacenter_col LIKE '%营业外收入' and s1.platform = '亚马逊' and LOWER(s1.website) = 'mx' and amountval_rmb < 0)");
}
else
{
......@@ -1037,6 +1042,10 @@ ON s2.id = s1.order_fee_config_id WHERE s1.month = @month ");
return x;
}).ToList();
}
if (input.FeeName.Contains("加:营业外收入"))
{
data.Remove(data.Where(x => x.PlatForm == "亚马逊" && x.WebSite.ToLower() == "mx" && x.AmountVal < 0).FirstOrDefault());
}
data = data.Select(x =>
{
if (x.PlatForm.Contains("万邑通") || x.PlatForm.Contains("速卖通"))
......@@ -1509,24 +1518,6 @@ t1.exchange_rate AS ExchangeRate,t1.amountval_rmb AS AmountValRmb,t1.month AS Mo
oldData.fee_ohtre = Math.Abs(Math.Round(SyncMonthProfitFeePlatformFeeSummary(
new GetMonthProfitPlatformDetailInput { Month = time, FeeName = "佣金及平台费-其他平台" }), 2)) * (-1);
//oldData.fee_ad = Math.Abs(Math.Round(SyncMonthProfitFeePlatformFeeSummary(
// new GetMonthProfitPlatformDetailInput { Month = time, FeeName = "广告及宣传费" }), 2)) * (-1);
//Console.WriteLine("开始统计平台费用");
//oldData.fee_ad = Math.Abs(Math.Round(ExportMonthProfitFeePlatformFeeDetail(
// new GetMonthProfitPlatformDetailInput { Month = time, FeeName = "广告及宣传费" })
// .Where(m => m.AmountValRmb.HasValue).Sum(x => x.AmountValRmb.Value), 2)) * (-1);
//oldData.fee_fba = Math.Abs(Math.Round(ExportMonthProfitFeePlatformFeeDetail(
// new GetMonthProfitPlatformDetailInput { Month = time, FeeName = "佣金及平台费-亚马逊FBA" })
// .Where(m => m.AmountValRmb.HasValue).Sum(x => x.AmountValRmb.Value), 2)) * (-1);
//oldData.fee_nofba = Math.Abs(Math.Round(ExportMonthProfitFeePlatformFeeDetail(
// new GetMonthProfitPlatformDetailInput { Month = time, FeeName = "佣金及平台费-亚马逊非FBA" })
// .Where(m => m.AmountValRmb.HasValue).Sum(x => x.AmountValRmb.Value), 2)) * (-1);
//oldData.fee_ebay = Math.Abs(Math.Round(ExportMonthProfitFeePlatformFeeDetail(
// new GetMonthProfitPlatformDetailInput { Month = time, FeeName = "佣金及平台费-Ebay" })
// .Where(m => m.AmountValRmb.HasValue).Sum(x => x.AmountValRmb.Value), 2)) * (-1);
//oldData.fee_ohtre = Math.Abs(Math.Round(ExportMonthProfitFeePlatformFeeDetail(
// new GetMonthProfitPlatformDetailInput { Month = time, FeeName = "佣金及平台费-其他平台" })
// .Where(m => m.AmountValRmb.HasValue).Sum(x => x.AmountValRmb.Value), 2)) * (-1);
//总平台费
oldData.fee_platform = Math.Round(oldData.fee_ad + oldData.fee_fba + oldData.fee_nofba + oldData.fee_ebay + oldData.fee_ohtre, 2);
//物流仓储费用
......@@ -1547,51 +1538,33 @@ t1.exchange_rate AS ExchangeRate,t1.amountval_rmb AS AmountValRmb,t1.month AS Mo
new GetMonthProfitPlatformDetailInput { Month = time, FeeName = "仓储费-平台" }), 2)) * (-1);
oldData.fee_nostorage = Math.Abs(Math.Round(SyncMonthProfitFeePlatformFeeSummary(
new GetMonthProfitPlatformDetailInput { Month = time, FeeName = "仓储费-非平台" }), 2)) * (-1);
//oldData.fee_logistics_first = Math.Abs(Math.Round(ExportMonthProfitFeePlatformFeeDetail(
// new GetMonthProfitPlatformDetailInput { Month = time, FeeName = "头程运输-平台" })
// .Where(m => m.AmountValRmb.HasValue).Sum(x => x.AmountValRmb.Value), 2)) * (-1);
//oldData.fee_nologistics_first = Math.Abs(Math.Round(ExportMonthProfitFeePlatformFeeDetail(
// new GetMonthProfitPlatformDetailInput { Month = time, FeeName = "头程运输-非平台" })
// .Where(m => m.AmountValRmb.HasValue).Sum(x => x.AmountValRmb.Value), 2)) * (-1);
//oldData.fee_logistics_tail = Math.Abs(Math.Round(ExportMonthProfitFeePlatformFeeDetail(
// new GetMonthProfitPlatformDetailInput { Month = time, FeeName = "尾程物流费-平台" })
// .Where(m => m.AmountValRmb.HasValue).Sum(x => x.AmountValRmb.Value), 2)) * (-1);
//oldData.fee_nologistics_tail = Math.Abs(Math.Round(ExportMonthProfitFeePlatformFeeDetail(
// new GetMonthProfitPlatformDetailInput { Month = time, FeeName = "尾程物流费-非平台" })
// .Where(m => m.AmountValRmb.HasValue).Sum(x => x.AmountValRmb.Value), 2)) * (-1);
//oldData.fee_logistics_direct = Math.Abs(Math.Round(ExportMonthProfitFeePlatformFeeDetail(
// new GetMonthProfitPlatformDetailInput { Month = time, FeeName = "直邮物流费-平台" })
// .Where(m => m.AmountValRmb.HasValue).Sum(x => x.AmountValRmb.Value), 2)) * (-1);
//oldData.fee_nologistics_direct = Math.Abs(Math.Round(ExportMonthProfitFeePlatformFeeDetail(
// new GetMonthProfitPlatformDetailInput { Month = time, FeeName = "直邮物流费-非平台" })
// .Where(m => m.AmountValRmb.HasValue).Sum(x => x.AmountValRmb.Value), 2)) * (-1);
//oldData.fee_storage = Math.Abs(Math.Round(ExportMonthProfitFeePlatformFeeDetail(
// new GetMonthProfitPlatformDetailInput { Month = time, FeeName = "仓储费-平台" })
// .Where(m => m.AmountValRmb.HasValue).Sum(x => x.AmountValRmb.Value), 2)) * (-1);
//oldData.fee_nostorage = Math.Abs(Math.Round(ExportMonthProfitFeePlatformFeeDetail(
// new GetMonthProfitPlatformDetailInput { Month = time, FeeName = "仓储费-非平台" })
// .Where(m => m.AmountValRmb.HasValue).Sum(x => x.AmountValRmb.Value), 2)) * (-1);
//总物流仓储费
oldData.fee_logistics_storage = Math.Round(oldData.fee_logistics_first + oldData.fee_nologistics_first + oldData.fee_logistics_tail + oldData.fee_nologistics_tail
+ oldData.fee_logistics_direct + oldData.fee_nologistics_direct + oldData.fee_storage + oldData.fee_nostorage, 2);
Console.WriteLine("开始统计加:营业外收入");
//2021-09-23陈文静提出需求 营业外收入的mx站点数值小于0的话,就放入营业外支出
//加:营业外收入
oldData.incoming_non_operating = Math.Round(SyncMonthProfitFeePlatformFeeSummary(
new GetMonthProfitPlatformDetailInput { Month = time, FeeName = "营业外收入" }), 2);
var nonOperatingList = ExportMonthProfitFeePlatformFeeDetail(new GetMonthProfitPlatformDetailInput { Month = time, FeeName = "营业外收入" });
var group = nonOperatingList.GroupBy(x => new { x.PlatForm, x.WebSite }, (m, y) => new
{
platform = m.PlatForm,
site = m.WebSite,
sumRmb = y.Sum(s => s.AmountValRmb),
}).ToList();
var sum = group.Sum(x => x.sumRmb);
var groupMx = group.Where(x => x.platform == "亚马逊" && x.site.ToLower() == "mx" && x.sumRmb < 0).Select(x => x.sumRmb).FirstOrDefault();
oldData.incoming_non_operating = Math.Round(sum.Value - groupMx.Value, 2);
//oldData.incoming_non_operating = Math.Round(ExportMonthProfitFeePlatformFeeDetail(
// new GetMonthProfitPlatformDetailInput { Month = time, FeeName = "营业外收入" })
// .Where(m => m.AmountValRmb.HasValue).Sum(x => x.AmountValRmb.Value), 2);
//oldData.incoming_non_operating = Math.Round(SyncMonthProfitFeePlatformFeeSummary(
// new GetMonthProfitPlatformDetailInput { Month = time, FeeName = "营业外收入" }), 2);
//减:营业外支出
oldData.pay_non_operating = Math.Abs(Math.Round(SyncMonthProfitFeePlatformFeeSummary(
new GetMonthProfitPlatformDetailInput { Month = time, FeeName = "营业外支出" }), 2)) * (-1);
oldData.pay_non_operating = Math.Abs(Math.Round((SyncMonthProfitFeePlatformFeeSummary(
new GetMonthProfitPlatformDetailInput { Month = time, FeeName = "营业外支出" }) + Math.Abs(groupMx.Value)), 2)) * (-1);
//oldData.pay_non_operating = Math.Abs(Math.Round(ExportMonthProfitFeePlatformFeeDetail(
// new GetMonthProfitPlatformDetailInput { Month = time, FeeName = "营业外支出" })
// .Where(m => m.AmountValRmb.HasValue).Sum(x => x.AmountValRmb.Value), 2)) * (-1);
//销售费用-税金
//oldData.fee_sales_taxes = Math.Abs(Math.Round(ExportMonthProfitFeePlatformFeeDetail(
......
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