X-Git-Url: https://git.ktnx.net/?p=mobile-ledger.git;a=blobdiff_plain;f=app%2Fsrc%2Fmain%2Fjava%2Fnet%2Fktnx%2Fmobileledger%2Fmodel%2FLedgerAccount.java;h=1e2a1a4f6834ed306d1ffb948715f26379c5df7f;hp=c76f2d564970193e29b37740f88a5ec86857c5d4;hb=5df10dc0b58df4d4be4e9ab34f1e0f477ca46766;hpb=7c71910950d18868e1f419eed5234f113ee51776 diff --git a/app/src/main/java/net/ktnx/mobileledger/model/LedgerAccount.java b/app/src/main/java/net/ktnx/mobileledger/model/LedgerAccount.java index c76f2d56..1e2a1a4f 100644 --- a/app/src/main/java/net/ktnx/mobileledger/model/LedgerAccount.java +++ b/app/src/main/java/net/ktnx/mobileledger/model/LedgerAccount.java @@ -212,6 +212,21 @@ public class LedgerAccount { return dbo; } + @NonNull + public AccountWithAmounts toDBOWithAmounts() { + AccountWithAmounts dbo = new AccountWithAmounts(); + dbo.account = toDBO(); + + dbo.amounts = new ArrayList<>(); + for (LedgerAmount amt : getAmounts()) { + AccountValue val = new AccountValue(); + val.setCurrency(amt.getCurrency()); + val.setValue(amt.getAmount()); + dbo.amounts.add(val); + } + + return dbo; + } public long getId() { return dbId; }