资金划转,金额保留2位小数

This commit is contained in:
吴方海
2025-09-09 16:45:25 +08:00
parent ffd547efcd
commit f15ca632c3
3 changed files with 18 additions and 7 deletions
@@ -708,15 +708,18 @@ namespace YLErp.Modules.ClientModule
}
var money = r.Money ?? 0;
money=isAddNew? money: money-(originalMoney??0);
if (r.TransferOutAccount == "初保账户" && money > clientbalance.NetFundAll)
var netFundAll = Math.Round(clientbalance.NetFundAll,2,MidpointRounding.AwayFromZero);
var vmFundSum = Math.Round(clientbalance.VmFundSum,2,MidpointRounding.AwayFromZero);
var winLoss = Math.Round(clientbalance.WinLoss,2,MidpointRounding.AwayFromZero);
if (r.TransferOutAccount == "初保账户" && money > netFundAll)
{
throw new ServiceException("划转金额不能超过初保账户金额");
}
if (r.TransferOutAccount == "追保账户" && money > clientbalance.VmFundSum)
if (r.TransferOutAccount == "追保账户" && money > vmFundSum)
{
throw new ServiceException("划转金额不能超过追保账户金额");
}
if (r.TransferOutAccount == "已实现盈亏" && money > clientbalance.WinLoss)
if (r.TransferOutAccount == "已实现盈亏" && money > winLoss)
{
throw new ServiceException("划转金额不能超过已实现盈亏");
}
+1 -1
View File
@@ -5,7 +5,7 @@
"launchBrowser": true,
"launchUrl": "http://localhost:49462",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "local"
"ASPNETCORE_ENVIRONMENT": "dev"
},
"applicationUrl": "http://localhost:49462"
}
@@ -256,9 +256,9 @@ function setClientCash() {
}
});
main.post("/trade_span/GetClientLatestBalance", { clientId: clientId }).done(function (data) {
winloss = data.WinLoss;
netFund = data.NetFund;
vmFund = data.VmFundSum;
winloss = numFormart(data.WinLoss);
netFund = numFormart(data.NetFund);
vmFund = numFormart(data.VmFundSum);
setTransferMoney();
});
}
@@ -289,6 +289,14 @@ function setTransferMoney() {
$("#transfer_in_account_money").text("余额:" + winloss);
}
}
function numFormart(num) {
num = num || 0;
var result = numeral(num).format("0,0.00") === "NaN" ? "0.00" : numeral(num).format("0,0.00");
if (result === "-0.00") {
result = "0.00";
}
return result;
}
$(function () {
cardInputMgr.init();