fix parsing amount for expense transaction
This commit is contained in:
@@ -187,16 +187,14 @@ 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 {
|
||||||
return nil, false, errs.ErrAmountInvalid
|
return nil, false, errs.ErrAmountInvalid
|
||||||
}
|
|
||||||
|
|
||||||
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)
|
||||||
data[datatable.TRANSACTION_DATA_TABLE_SUB_CATEGORY] = toAccount.Name
|
data[datatable.TRANSACTION_DATA_TABLE_SUB_CATEGORY] = toAccount.Name
|
||||||
|
|||||||
Reference in New Issue
Block a user