fix parsing amount for expense transaction

This commit is contained in:
MaysWind
2024-10-22 00:22:57 +08:00
parent 54150a9157
commit 1d0817b1b3
@@ -187,7 +187,6 @@ func (t *gnucashTransactionDataRowIterator) parseTransaction(ctx core.Context, u
toAccount = account1 toAccount = account1
} }
if len(fromAmount) > 0 && fromAmount[0] == '-' {
amount, err := utils.ParseAmount(fromAmount) amount, err := utils.ParseAmount(fromAmount)
if err != nil { if err != nil {
@@ -195,7 +194,6 @@ func (t *gnucashTransactionDataRowIterator) parseTransaction(ctx core.Context, u
} }
fromAmount = utils.FormatAmount(-amount) fromAmount = utils.FormatAmount(-amount)
}
data[datatable.TRANSACTION_DATA_TABLE_TRANSACTION_TYPE] = utils.IntToString(int(models.TRANSACTION_TYPE_EXPENSE)) data[datatable.TRANSACTION_DATA_TABLE_TRANSACTION_TYPE] = utils.IntToString(int(models.TRANSACTION_TYPE_EXPENSE))
data[datatable.TRANSACTION_DATA_TABLE_CATEGORY] = t.getCategoryName(toAccount) data[datatable.TRANSACTION_DATA_TABLE_CATEGORY] = t.getCategoryName(toAccount)