From e6873458facadea0dfb228bb33291d6baf68c427 Mon Sep 17 00:00:00 2001 From: Rutger Broekhoff Date: Tue, 26 Aug 2025 00:35:27 +0200 Subject: Basic import seems to be working --- lib/convert.ml | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'lib/convert.ml') 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 @@ open Core open Ledger +open Result.Let_syntax let virt_checking_acc = [ "Unfiled"; "Checking" ] let virt_savings_acc = [ "Unfiled"; "Savings" ] @@ -162,3 +163,15 @@ let tx_from_current_acc euc_id (Ingcsv.Tx (base, spec)) = details.counterparty_name |> add (String_label Desc_tag) details.description |> add (String_label Reference_tag) details.reference) + +let ba_from_current_acc (Ingcsv.Tx (base, _)) = + { + account = virt_checking_acc; + amount = Money.of_z base.resulting_balance; + labels = Labels.(empty |> add (Iban_label Account_tag) base.account); + } + +let les_from_current_acc euc_id tx = + let%map tx' = tx_from_current_acc euc_id tx in + let ba = ba_from_current_acc tx in + [ Bal_assert_item ba; Tx_item tx' ] -- cgit v1.2.3