Commit 479d9f13 by jianshuqin

修改功能:减:营业外收入 增加存货报损

parent 9d40991c
...@@ -992,46 +992,7 @@ ON s2.id = s1.order_fee_config_id WHERE s1.month = @month "); ...@@ -992,46 +992,7 @@ ON s2.id = s1.order_fee_config_id WHERE s1.month = @month ");
} }
if (isSum) if (isSum)
{ {
sql.Append(" GROUP BY s1.platform,s1.website "); sql.Append(" GROUP BY s1.platform,s1.website");
sql.Append(@"UNION ALL
SELECT
'存货报损' as platform_type
,'' as website
,SUM( t1.cost_product ) AS original_amount
,SUM( t1.cost_product ) AS total_amount_sales
,COUNT(*) AS total_order
FROM
order_fee_damaged t1
WHERE
t1.`month` = @month
AND isdelete = 0
AND status_name = '盘亏'");
}
else if (string.IsNullOrWhiteSpace(input.PlatformType) || input.PlatformType == "存货报损")
{
sql.Append($@"UNION ALL
SELECT
'存货报损' AS PlatForm
,'' AS WebSite
,bailun_sku_original AS Orderno
,operation_time AS DataTime
,cost_product AS AmountVal
,'营业外支出' AS FeeType
,'' AS Subjectcode
,'' AS ProjectCode
,'' AS FinanceCategory
,'营业外支出' AS DatacenterCol
,'人民币' AS Currency
,'人民币' AS EbayCurrency
,'1.000000' AS ExchangeRate
,cost_product AS AmountValRmb
,`MONTH` AS `MONTH`
FROM
order_fee_damaged t1
WHERE
t1.`month` = @month
AND isdelete = 0
AND status_name = '盘亏'");
} }
return sql.ToString(); return sql.ToString();
} }
...@@ -1157,26 +1118,6 @@ AND s2.datacenter_col like '%{input.FeeName}' group by s2.platform,s1.website "; ...@@ -1157,26 +1118,6 @@ AND s2.datacenter_col like '%{input.FeeName}' group by s2.platform,s1.website ";
return data.Sum(x => x.total); return data.Sum(x => x.total);
} }
public decimal GetMonthFeeDamagedSummary(string month)
{
decimal? damaged = default(decimal?);
var parameters = new DynamicParameters();
var sql = $@"SELECT SUM(t1.cost_product) as cost_product
from order_fee_damaged t1
WHERE t1.`month` = @month and isdelete = 0 and status_name = '盘亏'";
parameters.Add("month", month);
using (var db = new MySqlConnection(GlobalConfig.ConnectionString_DW))
{
if (db.State == ConnectionState.Closed)
{
db.Open();
}
damaged = db.QueryFirstOrDefault<decimal?>(sql, parameters);
}
return damaged ?? 0;
}
/// <summary> /// <summary>
/// 退款分页明细 /// 退款分页明细
/// </summary> /// </summary>
...@@ -1616,8 +1557,8 @@ t1.exchange_rate AS ExchangeRate,t1.amountval_rmb AS AmountValRmb,t1.month AS Mo ...@@ -1616,8 +1557,8 @@ t1.exchange_rate AS ExchangeRate,t1.amountval_rmb AS AmountValRmb,t1.month AS Mo
// new GetMonthProfitPlatformDetailInput { Month = time, FeeName = "营业外收入" }), 2); // new GetMonthProfitPlatformDetailInput { Month = time, FeeName = "营业外收入" }), 2);
//减:营业外支出 //减:营业外支出
oldData.pay_non_operating = Math.Round(Math.Abs(SyncMonthProfitFeePlatformFeeSummary( oldData.pay_non_operating = Math.Abs(Math.Round((SyncMonthProfitFeePlatformFeeSummary(
new GetMonthProfitPlatformDetailInput { Month = time, FeeName = "营业外支出" })) + Math.Abs(groupMx) + Math.Abs(GetMonthFeeDamagedSummary(time)), 2) * (-1); new GetMonthProfitPlatformDetailInput { Month = time, FeeName = "营业外支出" }) + Math.Abs(groupMx)), 2)) * (-1);
//销售费用-税金 //销售费用-税金
......
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