- public ParsedPosting asParsedPosting() {
- ParsedPosting result = new ParsedPosting();
- result.setPaccount(accountName);
- ArrayList<ParsedAmount> amounts = new ArrayList<>();
- ParsedAmount amt = new ParsedAmount();
- amt.setAcommodity((currency == null) ? "" : currency);
- amt.setAismultiplier(false);
- ParsedQuantity qty = new ParsedQuantity();
- qty.setDecimalPlaces(2);
- qty.setDecimalMantissa(Math.round(amount * 100));
- amt.setAquantity(qty);
- ParsedStyle style = new ParsedStyle();
- style.setAscommodityside('L');
- style.setAscommodityspaced(false);
- style.setAsprecision(2);
- style.setAsdecimalpoint('.');
- amt.setAstyle(style);
- amounts.add(amt);
- result.setPamount(amounts);
- return result;
- }
-}
+ public TransactionAccount toDBO() {
+ TransactionAccount dbo = new TransactionAccount();
+ dbo.setAccountName(accountName);
+ if (amountSet)
+ dbo.setAmount(amount);
+ dbo.setComment(comment);
+ dbo.setCurrency(Misc.nullIsEmpty(currency));
+ dbo.setId(dbId);
+
+ return dbo;
+ }
+}
\ No newline at end of file