- return new LedgerTransactionAccount(paccount, amt.getAquantity().asFloat(),
- amt.getAcommodity());
- }
- public static ParsedPosting fromLedgerAccount(LedgerTransactionAccount acc) {
- ParsedPosting result = new ParsedPosting();
- result.setPaccount(acc.getAccountName());
-
- String comment = acc.getComment();
- if (comment == null)
- comment = "";
- result.setPcomment(comment);
-
- ArrayList<ParsedAmount> amounts = new ArrayList<>();
- ParsedAmount amt = new ParsedAmount();
- amt.setAcommodity((acc.getCurrency() == null) ? "" : acc.getCurrency());
- amt.setAismultiplier(false);
- ParsedQuantity qty = new ParsedQuantity();
- qty.setDecimalPlaces(2);
- qty.setDecimalMantissa(Math.round(acc.getAmount() * 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;
+ return new LedgerTransactionAccount(paccount, amt.getAquantity()
+ .asFloat(), amt.getAcommodity(),
+ getPcomment());