fixbug: 账户平衡计算导致新增交易异常
This commit is contained in:
parent
15a79c5790
commit
659c1d7e15
|
|
@ -82,7 +82,7 @@ func sum(entries []AddTransactionEntryForm, openingBalances string) decimal.Deci
|
||||||
if entry.Account == openingBalances {
|
if entry.Account == openingBalances {
|
||||||
return decimal.NewFromInt(0)
|
return decimal.NewFromInt(0)
|
||||||
}
|
}
|
||||||
if entry.Price.IntPart() == 0 {
|
if entry.Price.Exponent() == 0 {
|
||||||
sumVal = entry.Number.Add(sumVal)
|
sumVal = entry.Number.Add(sumVal)
|
||||||
} else {
|
} else {
|
||||||
sumVal = entry.Number.Mul(entry.Price).Add(sumVal)
|
sumVal = entry.Number.Mul(entry.Price).Add(sumVal)
|
||||||
|
|
@ -138,7 +138,6 @@ func AddTransactions(c *gin.Context) {
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
script.LogError(ledgerConfig.Mail, err.Error())
|
script.LogError(ledgerConfig.Mail, err.Error())
|
||||||
InternalError(c, "failed to add transaction")
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
OK(c, nil)
|
OK(c, nil)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue