Commit 4564d742 by DESKTOP-732ATD8\BLT

增加功能:Shopify 广告费

parent f12427d9
...@@ -6604,18 +6604,23 @@ namespace Bailun.DC.Services ...@@ -6604,18 +6604,23 @@ namespace Bailun.DC.Services
public decimal ShopifyAD(DateTime? start, DateTime? end, bool isUSD) public decimal ShopifyAD(DateTime? start, DateTime? end, bool isUSD)
{ {
var sqlparam = new DynamicParameters(); var sqlparam = new DynamicParameters();
TimeZoneInfo easternZone = TimeZoneInfo.FindSystemTimeZoneById("Eastern Standard Time");
var sql = $" select round(sum(fee * {(isUSD ? "1" : "cny_exchange_rate")}),2) as fee from dc_base_finance_shopify_fee where status = 0"; var sql = $" select round(sum(fee * {(isUSD ? "1" : "cny_exchange_rate")}),2) as fee from dc_base_finance_shopify_fee where status = 0";
if (start.HasValue) if (start.HasValue)
{ {
//转美东时间
start = TimeZoneInfo.ConvertTimeFromUtc(start.Value.Date.ToUniversalTime(), easternZone);
sql += " and bdate >= @bdate"; sql += " and bdate >= @bdate";
sqlparam.Add("bdate", start.Value.Date); sqlparam.Add("bdate", start.Value);
} }
if (end.HasValue) if (end.HasValue)
{ {
//转美东时间
end = TimeZoneInfo.ConvertTimeFromUtc(end.Value.Date.AddDays(1).ToUniversalTime(), easternZone);
sql += " and edate < @edate"; sql += " and edate < @edate";
sqlparam.Add("edate", end.Value.Date.AddDays(1)); sqlparam.Add("edate", end.Value);
} }
using (var cn = new MySqlConnection(Common.GlobalConfig.ConnectionString_read)) using (var cn = new MySqlConnection(Common.GlobalConfig.ConnectionString_read))
......
...@@ -2062,6 +2062,8 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers ...@@ -2062,6 +2062,8 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
else if (item.platform_type.ToLower() == "shopify") //Shopify广告费 else if (item.platform_type.ToLower() == "shopify") //Shopify广告费
{ {
item.adfee = shopifyFee; item.adfee = shopifyFee;
item.profit_total = (item.profit_total - item.adfee ?? 0);
item.profit_rate = (item.amount_sales - item.amount_prepaid) != 0 ? Math.Round((item.profit_total / (item.amount_sales - item.amount_prepaid)), 2) : 0;
} }
} }
else if (statistictype == 1) else if (statistictype == 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