summaryrefslogtreecommitdiffstats
path: root/lib/convert.ml
diff options
context:
space:
mode:
Diffstat (limited to 'lib/convert.ml')
-rw-r--r--lib/convert.ml13
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/convert.ml b/lib/convert.ml
index cbdb90f..fb41020 100644
--- a/lib/convert.ml
+++ b/lib/convert.ml
@@ -1,5 +1,6 @@
1open Core 1open Core
2open Ledger 2open Ledger
3open Result.Let_syntax
3 4
4let virt_checking_acc = [ "Unfiled"; "Checking" ] 5let virt_checking_acc = [ "Unfiled"; "Checking" ]
5let virt_savings_acc = [ "Unfiled"; "Savings" ] 6let virt_savings_acc = [ "Unfiled"; "Savings" ]
@@ -162,3 +163,15 @@ let tx_from_current_acc euc_id (Ingcsv.Tx (base, spec)) =
162 details.counterparty_name 163 details.counterparty_name
163 |> add (String_label Desc_tag) details.description 164 |> add (String_label Desc_tag) details.description
164 |> add (String_label Reference_tag) details.reference) 165 |> add (String_label Reference_tag) details.reference)
166
167let ba_from_current_acc (Ingcsv.Tx (base, _)) =
168 {
169 account = virt_checking_acc;
170 amount = Money.of_z base.resulting_balance;
171 labels = Labels.(empty |> add (Iban_label Account_tag) base.account);
172 }
173
174let les_from_current_acc euc_id tx =
175 let%map tx' = tx_from_current_acc euc_id tx in
176 let ba = ba_from_current_acc tx in
177 [ Bal_assert_item ba; Tx_item tx' ]