Commit 6c34f38b by guanzhenshan

解决帐号余额期初数不会的问题

parent ef7e3b8d
...@@ -379,45 +379,39 @@ namespace Bailun.DC.Services ...@@ -379,45 +379,39 @@ namespace Bailun.DC.Services
{ {
foreach (var item in list) foreach (var item in list)
{ {
if (item.id <= 0) var m = cn.QueryFirstOrDefault<dc_platform_balance>($"select * from dc_platform_balance where platformcode='{item.platformcode}' and currency='{item.currency}' and delstatus=0 and `day` <'{item.day.ToString("yyyy-MM-dd")}' order by day desc limit 1");
{
var m = cn.QueryFirstOrDefault<dc_platform_balance>($"select * from dc_platform_balance where platformcode='{item.platformcode}' and currency='{item.currency}' and delstatus=0 order by day desc limit 1");
if (item.platformcode.ToUpper() != "EBAY" && item.platformcode.ToUpper() != "ALIEXPRESS") if (item.platformcode.ToUpper() != "EBAY" && item.platformcode.ToUpper() != "ALIEXPRESS")
{
if (m != null && m.userable_amount == item.userable_amount)
{ {
if (m != null && m.userable_amount == item.userable_amount) //item.amount = m.amount + item.amount_sales - item.withdraw_amount; //本期期末=上一期期末+本期销售额-本期提现额
{ //item.amount_rmb = item.amount * item.exchangerate;
//item.amount = m.amount + item.amount_sales - item.withdraw_amount; //本期期末=上一期期末+本期销售额-本期提现额 item.before_balance = m.userable_amount+m.amount_sales-m.withdraw_amount;
//item.amount_rmb = item.amount * item.exchangerate;
item.before_balance = m.amount;
}
else if (m != null && m.userable_amount != item.userable_amount)
{
//item.amount = item.userable_amount + item.amount_sales - item.withdraw_amount;
//item.amount_rmb = item.amount * item.exchangerate;
item.before_balance = item.userable_amount;
}
else if (m == null && m.userable_amount == item.userable_amount)
{
//item.amount = 0 + item.amount_sales - item.withdraw_amount; //本期期末=上一期期末+本期销售额-本期提现额
//item.amount_rmb = item.amount * item.exchangerate;
item.before_balance = 0;
}
else if (m == null && m.userable_amount != item.userable_amount)
{
//item.amount = item.userable_amount + item.amount_sales - item.withdraw_amount;
//item.amount_rmb = item.amount * item.exchangerate;
item.before_balance = item.userable_amount;
}
} }
else else if (m != null && m.userable_amount != item.userable_amount)
{ {
//item.amount = item.userable_amount; //item.amount = item.userable_amount + item.amount_sales - item.withdraw_amount;
//item.amount_rmb = item.userable_amount * item.exchangerate; //item.amount_rmb = item.amount * item.exchangerate;
item.before_balance = m.userable_amount; item.before_balance = item.userable_amount;
} }
else if (m == null)
{
//item.amount = 0 + item.amount_sales - item.withdraw_amount; //本期期末=上一期期末+本期销售额-本期提现额
//item.amount_rmb = item.amount * item.exchangerate;
item.before_balance = 0;
}
}
else
{
//item.amount = item.userable_amount;
//item.amount_rmb = item.userable_amount * item.exchangerate;
item.before_balance = m.userable_amount;
}
if (item.id <= 0)
{
cn.Insert<dc_platform_balance>(item); cn.Insert<dc_platform_balance>(item);
} }
else else
...@@ -437,6 +431,22 @@ namespace Bailun.DC.Services ...@@ -437,6 +431,22 @@ namespace Bailun.DC.Services
} }
} }
public string ListPlatformBalance(DateTime start)
{
using (var cn = new MySqlConnection(Common.GlobalConfig.ConnectionString))
{
if (cn.State == ConnectionState.Closed)
{
cn.Open();
}
var list = cn.Query<dc_platform_balance>("select * from dc_platform_balance where delstatus=0 and day>='"+start.ToString("yyyy-MM-dd")+"' order by day ").AsList();
AddPlatformBalances(list);
}
return "";
}
/// <summary> /// <summary>
/// 获取平台余额详情 /// 获取平台余额详情
/// </summary> /// </summary>
......
...@@ -1177,7 +1177,7 @@ namespace Bailun.DC.Services ...@@ -1177,7 +1177,7 @@ namespace Bailun.DC.Services
cn.Open(); cn.Open();
} }
var obj = cn.Page<Models.Orders.dc_base_oms_order>(parameter.pageIndex, parameter.limit, sql, ref total, sqlparam); var obj = cn.Query<Models.Orders.dc_base_oms_order>(sql, sqlparam); //cn.Page<Models.Orders.dc_base_oms_order>(parameter.pageIndex, parameter.limit, sql, ref total, sqlparam);
return obj.AsList(); return obj.AsList();
} }
......
...@@ -1054,6 +1054,13 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers ...@@ -1054,6 +1054,13 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
} }
} }
public string UpdateBalanceTest()
{
var result = new Services.FinanceReportServices().ListPlatformBalance(DateTime.Parse("2019-03-05"));
return result;
}
/// <summary> /// <summary>
/// 平台账号余额明细页面 /// 平台账号余额明细页面
/// </summary> /// </summary>
......
...@@ -538,7 +538,7 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers ...@@ -538,7 +538,7 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
p.seller_account, p.seller_account,
amount_product = p.amount_product>0? p.amount_product.ToString("N2") :"0", amount_product = p.amount_product>0? p.amount_product.ToString("N2") :"0",
cost_platform_fee = p.cost_platform_fee>0? p.cost_platform_fee.ToString("N2") :"0", cost_platform_fee = p.cost_platform_fee>0? p.cost_platform_fee.ToString("N2") :"0",
platform_fee_rate = p.platform_fee_rate>0? (p.platform_fee_rate*100).ToString("N2") :"0", platform_fee_rate = p.platform_fee_rate>0? (p.platform_fee_rate*100).ToString("N0") :"0",
p.platform_type, p.platform_type,
p.website, p.website,
create_time = p.create_time.ToString("yyyy-MM-dd HH:mm:ss") create_time = p.create_time.ToString("yyyy-MM-dd HH:mm:ss")
......
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