[kmymoney] [Bug 487506] “kmymoney.app” is damaged and can’t be opened. You should move it to the Trash.

2024-06-15 Thread Jonathan Kimmitt via KMyMoney-devel
https://bugs.kde.org/show_bug.cgi?id=487506

Jonathan Kimmitt  changed:

   What|Removed |Added

 CC||jonat...@kimmitt.uk

--- Comment #4 from Jonathan Kimmitt  ---
I had a problem on Sonoma with kMymoney, the problem was alleviated by static
linking. Not all extensions can use static linking so this is a cut down
version which is still too large to attach, so a download link is provided
below at your own risk:

https://jonathankimmitt-my.sharepoint.com/:u:/g/personal/jonathan_kimmitt_uk/EeAVhWVp4pRNvEXrNgvrueAB6mSqJSnV4-OTGa3A4L-UBg?e=BUu4EI

-- 
You are receiving this mail because:
You are the assignee for the bug.

[kmymoney] [Bug 483652] vcpkg build fails unless plugins are built statically

2024-03-16 Thread Jonathan Kimmitt via KMyMoney-devel
https://bugs.kde.org/show_bug.cgi?id=483652

--- Comment #4 from Jonathan Kimmitt  ---
Thanks for the patch. It does not immediately seem to solve the problem of the
lack of pre-existence of kmm_gpgfile_export.h. I have placed a copy from a
previous build in kmymoney/mymoney/storage/kmm_gpgfile_export.h which seems to
solve the problem of the App not building. As of now the file is used in the
ninja build before it is generated. However in this location in prevents the
new version from being generated in the build directory, which might be a bad
thing. There is no recipe for encryption support in vcpkg at the moment that
would provide a better solution. The overall objective of static linking for me
is to reduce reliance on fragile .dynlib files such as provided in
/opt/homebrew and make the Application image portable to other Macs.

-- 
You are receiving this mail because:
You are the assignee for the bug.

[kmymoney] [Bug 483652] vcpkg build fails unless plugins are built statically

2024-03-16 Thread Jonathan Kimmitt via KMyMoney-devel
https://bugs.kde.org/show_bug.cgi?id=483652

--- Comment #2 from Jonathan Kimmitt  ---
build/kmymoney/misc/kmm_gpgfile_export.h seems to get created as a result of
the build process. However it is needed to compile kgpgfile.h; if you don't
have a successful build than you cannot bootstrap the process without
commenting out the reference to kgpgfile.h. I suppose this is some dependency
issue in make, however I lack sufficient familiarity with this tool.

-- 
You are receiving this mail because:
You are the assignee for the bug.

[kmymoney] [Bug 483652] New: vcpkg build fails unless plugins are built statically

2024-03-15 Thread Jonathan Kimmitt via KMyMoney-devel
https://bugs.kde.org/show_bug.cgi?id=483652

Bug ID: 483652
   Summary: vcpkg build fails unless plugins are built statically
Classification: Applications
   Product: kmymoney
   Version: git (master)
  Platform: Compiled Sources
OS: macOS
Status: REPORTED
  Severity: normal
  Priority: NOR
 Component: buildsystem
  Assignee: kmymoney-devel@kde.org
  Reporter: jonat...@kimmitt.co.uk
  Target Milestone: ---

Created attachment 167252
  --> https://bugs.kde.org/attachment.cgi?id=167252&action=edit
kmymoney MacOS execution backtrace

SUMMARY

NOTE: If you are reporting a crash, please try to attach a backtrace with debug
symbols.
See
https://community.kde.org/Guidelines_and_HOWTOs/Debugging/How_to_create_useful_crash_reports
***


STEPS TO REPRODUCE
1.  Install the manifest given in kmymoney git tree using "vcpkg install"
2.  Configure using "cmake ..
-DCMAKE_TOOLCHAIN_FILE=/Users/jonathan/vcpkg/scripts/buildsystems/vcpkg.cmake
-G Ninja -DCMAKE_BUILD_TYPE=Debug"
3.  ninja
4. lldb bin/kmymoney.app/Contents/MacOS/kmymoney
5. run

OBSERVED RESULT
as per attached backtrace

EXPECTED RESULT
The main window appears

SOFTWARE/OS VERSIONS
macOS: 
Qt Version: 

ADDITIONAL INFORMATION
To compile I had to comment out certain lines that caused errors. This might be
because it is expecting QT6 or some other version issue.

diff --git a/kmymoney/dialogs/kequitypriceupdatedlg.cpp
b/kmymoney/dialogs/kequitypriceupdatedlg.cpp
index 6773525d2..2cb63044c 100644
--- a/kmymoney/dialogs/kequitypriceupdatedlg.cpp
+++ b/kmymoney/dialogs/kequitypriceupdatedlg.cpp
@@ -417,7 +417,7 @@ public:
 m_progressDelay.start();

 m_quote.setDateRange(ui->m_fromDate->date(), ui->m_toDate->date());
-m_quote.setUseSingleQuoteSignal(true);
+   //FIXME!!m_quote.setUseSingleQuoteSignal(true);

 m_abortUpdate = false;
 for (int row = 0; !m_abortUpdate && row < rows; ++row) {
diff --git a/kmymoney/plugins/xml/kcm_xmlstorage.cpp
b/kmymoney/plugins/xml/kcm_xmlstorage.cpp
index a53d0a19b..50a524bbc 100644
--- a/kmymoney/plugins/xml/kcm_xmlstorage.cpp
+++ b/kmymoney/plugins/xml/kcm_xmlstorage.cpp
@@ -22,7 +22,9 @@
 // Project Includes

 #include "config-kmymoney.h"
+#ifdef ENABLE_GPG
 #include "kgpgfile.h"
+#endif
 #include "kmymoneysettings.h"

 #define RECOVER_KEY_ID  "0xD2B08440"
diff --git a/kmymoney/plugins/xml/kgpgkeyselectiondlg.cpp
b/kmymoney/plugins/xml/kgpgkeyselectiondlg.cpp
index 263381a19..530ee1f5a 100644
--- a/kmymoney/plugins/xml/kgpgkeyselectiondlg.cpp
+++ b/kmymoney/plugins/xml/kgpgkeyselectiondlg.cpp
@@ -18,7 +18,9 @@
 // Project Includes

 #include "config-kmymoney.h"
+#ifdef ENABLE_GPG
 #include 
+#endif
 #include 

 class KGpgKeySelectionDlgPrivate
diff --git a/kmymoney/plugins/xml/xmlstorage.cpp
b/kmymoney/plugins/xml/xmlstorage.cpp
index 492eaf9a7..b8372b5de 100644
--- a/kmymoney/plugins/xml/xmlstorage.cpp
+++ b/kmymoney/plugins/xml/xmlstorage.cpp
@@ -36,7 +36,9 @@

 #include "appinterface.h"
 #include "icons.h"
+#ifdef ENABLE_GPG
 #include "kgpgfile.h"
+#endif
 #include "kgpgkeyselectiondlg.h"
 #include "kmymoneyenums.h"
 #include "kmymoneysettings.h"
diff --git a/kmymoney/widgets/passstore.cpp b/kmymoney/widgets/passstore.cpp
index e60048c93..fd7c16eeb 100644
--- a/kmymoney/widgets/passstore.cpp
+++ b/kmymoney/widgets/passstore.cpp
@@ -24,7 +24,9 @@
 // Project Includes

 #include "icons.h"
+#ifdef ENABLE_GPG
 #include "kgpgfile.h"
+#endif

 using namespace Icons;

-- 
You are receiving this mail because:
You are the assignee for the bug.

MacOS woes

2024-03-13 Thread Jonathan Kimmitt via KMyMoney-devel
I tried downloading kMyMoney for OSX from this address:


Download and use the MacOS version
kmymoney.org
[180x180.png]

Testing both stable and master version on AppleSilicon M1.

In both cases verification passed OK, but the program failed immediately with

“kmymoney” is damaged and can’t be opened. You should move it to the Bin.

The version built from home-brew seems to fail also even though it worked a 
month or so ago.

I am on Sonoma 14.2.1

Happy to try to build it myself with Xcode if somebody has instructions for 
that.



Re: Mac support?

2024-02-12 Thread Jonathan Kimmitt via KMyMoney-devel
Hi Steven,
  I managed to build the stable branch on OSX Sonoma with the help of homebrew 
for AppleSilicon. Some of the dependencies are not quite right and I cannot
redistribute the App because I do not have the facility to relocate the brew 
libraries to inside the App. I’m guessing someone else has solved this problem
already but I lack the detailed knowledge to produce the build automatically, 
one solution might be installing brew with a custom path which is inside the 
App destination, and subsequently delete everything not needed at runtime.

Regards,
Jonathan

On 11 Feb 2024, at 22:33, Steven Karp via KMyMoney-devel 
 wrote:

Is the build for MacOS still actively maintained?

I note that the last successful build in Jenkins (#1840) was August 10--six 
months ago.

More vexing is that the current build (#1973) has been running since January 11 
with no indication that it will ever complete and allow more recent builds to 
process.



[kmymoney] Reconciliation bug

2024-01-16 Thread Jonathan Kimmitt via KMyMoney-devel
I just starting using kMyMoney and I have noticed an odd behaviour that it 
sometimes
calculates the reconciliation balance incorrectly and then warns you not to 
finish reconciliation.
However if you post reconciliation and immediately restart it without changing 
any cleared transactions
It will calculate the correct figure to use and allows reconciliation to finish 
correctly without a warning.

This is after importing a bank statement with QIF and accepting the 
transactions matched with manually entered ones.


KMyMoney
Version 5.1.3

OSX-14.2.1 (23C71)

homebrew installation largely from source on AppleSilicon.



Re: GnuCash import difficulty and interim solution

2024-01-07 Thread Jonathan Kimmitt via KMyMoney-devel
I tried to follow the instructions to build the master branch, but it failed 
saying that qca-qt5-config.cmake was not found.
Perhaps this is an Apple-Silicon issue.

On 7 Jan 2024, at 11:36, Thomas Baumgart via KMyMoney-devel 
 wrote:

On Sonntag, 7. Januar 2024 11:30:30 CET Thomas Baumgart via KMyMoney-devel 
wrote:

[...]

The master branch version has other problems after the dialog is left
but that is something we need to find out. They may be related to other
changes made to KMyMoney in the meantime.

This is now fixed with https://invent.kde.org/office/kmymoney/-/commit/352e9f6b

--

Regards

Thomas Baumgart

-
I don't think any of us need any help in this regard, getting
rid of money is probably the single most userfriendly interface
since breast-feeding... unfortunately. -- A.J. Venter
-



Re: GnuCash import difficulty and interim solution

2024-01-06 Thread Jonathan Kimmitt via KMyMoney-devel
This is the head of my file:




http://www.gnucash.org/XML/gnc";

 xmlns:act="http://www.gnucash.org/XML/act";

 xmlns:book="http://www.gnucash.org/XML/book";

 xmlns:cd="http://www.gnucash.org/XML/cd";

 xmlns:cmdty="http://www.gnucash.org/XML/cmdty";

 xmlns:price="http://www.gnucash.org/XML/price";

 xmlns:slot="http://www.gnucash.org/XML/slot";

 xmlns:split="http://www.gnucash.org/XML/split";

 xmlns:sx="http://www.gnucash.org/XML/sx";

 xmlns:trn="http://www.gnucash.org/XML/trn";

 xmlns:ts="http://www.gnucash.org/XML/ts";

 xmlns:fs="http://www.gnucash.org/XML/fs";

 xmlns:bgt="http://www.gnucash.org/XML/bgt";

 xmlns:recurrence="http://www.gnucash.org/XML/recurrence";

 xmlns:lot="http://www.gnucash.org/XML/lot";

 xmlns:addr="http://www.gnucash.org/XML/addr";

 xmlns:billterm="http://www.gnucash.org/XML/billterm";

 xmlns:bt-days="http://www.gnucash.org/XML/bt-days";

 xmlns:bt-prox="http://www.gnucash.org/XML/bt-prox";

 xmlns:cust="http://www.gnucash.org/XML/cust";

 xmlns:employee="http://www.gnucash.org/XML/employee";

 xmlns:entry="http://www.gnucash.org/XML/entry";

 xmlns:invoice="http://www.gnucash.org/XML/invoice";

 xmlns:job="http://www.gnucash.org/XML/job";

 xmlns:order="http://www.gnucash.org/XML/order";

 xmlns:owner="http://www.gnucash.org/XML/owner";

 xmlns:taxtable="http://www.gnucash.org/XML/taxtable";

 xmlns:tte="http://www.gnucash.org/XML/tte";

 xmlns:vendor="http://www.gnucash.org/XML/vendor";>

1




On 6 Jan 2024, at 23:36, Jack via KMyMoney-devel  wrote:

Can you open the file in a text editor and confirm that it meets the criteria 
Thomas listed, specifically that the string " On 6 Jan 2024, at 21:40, Thomas Baumgart via KMyMoney-devel 
>  wrote:
>
> On Samstag, 6. Januar 2024 18:24:47 CET Jack via KMyMoney-devel wrote:
>
>>> On 1/6/24 12:17, Jonathan Kimmitt wrote:
>>> Yes, it is present and has version GNC Importer Version 5.1.3-33a66be8a. 
>>> Under OSX it’s in KMyMoney preferences instead of Setting
>>>
>>> It’s probably something stupid like an account or payee name with an & in 
>>> is represented unadorned in the XML whereas KMyMoney requires &
>> That is certainly possible, but I'll have to look into the code to see
>> what exactly triggers that particular error message.  If you are right,
>> then we would want to find a utility that checks XML files for proper
>> encoding/markup (I can't think of the exact term right now.)
>
> Encoding and structure are the two important things. xmllint would be the 
> tool to use.
>
> I scanned the GNC plugin's open() call real quick. Here is what it checks:
>
> - file is not a database (e.g. SQL, SQLite, ...)
> - file is on local drive (url starts with file://)
> - file is readable
> - if file is gzip compressed (first two bytes are "\037\213") it re-opens it
>  for decompression
> - first bytes in file are not "SQ"
> - the first 70 bytes of the file must contain the regex "
> In case all that is true, a dialog is shown. This contains a switch
> to turn on debug messages which are printed to the console (in case
> KMyMoney was started via terminal) while the file is parsed. Now I have
> two questions: Does the dialog is shown? Do these debug messages provide
> any hint or details why the import fails?
>
> Thomas
>
>
>
>
>>>> On 6 Jan 2024, at 17:10, Jack via KMyMoney-devel  
>>>> wrote:
>>>>
>>>> On 1/6/24 11:40, Jonathan Kimmitt via KMyMoney-devel wrote:
>>>>> Hi Jack,
>>>>>   I am using Apple M1 macOS 14.2.1 (23C71), with GnuCash Version: 5.4 
>>>>> Build ID: 5.4+(2023-09-23) and KMyMoney Version 5.1.3-33a66be8a
>>>>>
>>>>> The converter was written with OCaml 5.0.0 but I would not expect any 
>>>>> lack of portability for the XML handling.
>>>>>
>>>>> The error when trying to open the GnuCash XML  in the GUI was:
>>>>> Could not read your data source. Please check the KMyMoney settings that 
>>>>> the necessary plugin is enabled.
>>>>>
>>>>> Based on what Mark was saying, it sounds like the failure is something 
>>>>> quite trivial, however I lack the knowledge to debug it.
>>>>>
>>>>> Regards,
>>>>> Jonathan
>>>> I'll have to do some digging, but the first step would be to assure the 
>>>> file can be read.  If it is on a local drive and you can look at it in a 
>>>> text editor, then that's OK.  The next step would be to assure that the 
>>>> guncash importer is present and enabled.  Go to Setting/Configure 
>>>> KMyMoney... select Plugins on the left side, and see if GNC Importer is 
>>>> present on the right.  If it's there, then we do have an interesting 
>>>> problem.  If it is NOT present, then we need to figure out why not.  I 
>>>> just confirmed it IS present in the Appimage versions, but I don't know 
>>>> about the macOS version.
>>
>>
>
> --
>
> Regards
>
> Thomas Baumgart
>
> -
> Ilde servers are the devil's work -- robbyoconnor on #irc
> -




Re: GnuCash import difficulty and interim solution

2024-01-06 Thread Jonathan Kimmitt via KMyMoney-devel
I see no dialogue box. My gnucash XML file is uncompressed. My file is chosen 
from a pop up window so it must exist. I can try the Linux version another time 
to see if there are terminal messages. However my GnuCash is v5.4 and the 
documentation says that the importer was designed for v2.x

Sent from my iPhone

> On 6 Jan 2024, at 21:40, Thomas Baumgart via KMyMoney-devel 
>  wrote:
> 
> On Samstag, 6. Januar 2024 18:24:47 CET Jack via KMyMoney-devel wrote:
> 
>>> On 1/6/24 12:17, Jonathan Kimmitt wrote:
>>> Yes, it is present and has version GNC Importer Version 5.1.3-33a66be8a. 
>>> Under OSX it’s in KMyMoney preferences instead of Setting
>>> 
>>> It’s probably something stupid like an account or payee name with an & in 
>>> is represented unadorned in the XML whereas KMyMoney requires &
>> That is certainly possible, but I'll have to look into the code to see
>> what exactly triggers that particular error message.  If you are right,
>> then we would want to find a utility that checks XML files for proper
>> encoding/markup (I can't think of the exact term right now.)
> 
> Encoding and structure are the two important things. xmllint would be the 
> tool to use.
> 
> I scanned the GNC plugin's open() call real quick. Here is what it checks:
> 
> - file is not a database (e.g. SQL, SQLite, ...)
> - file is on local drive (url starts with file://)
> - file is readable
> - if file is gzip compressed (first two bytes are "\037\213") it re-opens it
>  for decompression
> - first bytes in file are not "SQ"
> - the first 70 bytes of the file must contain the regex " 
> In case all that is true, a dialog is shown. This contains a switch
> to turn on debug messages which are printed to the console (in case
> KMyMoney was started via terminal) while the file is parsed. Now I have
> two questions: Does the dialog is shown? Do these debug messages provide
> any hint or details why the import fails?
> 
> Thomas
> 
> 
> 
> 
>>>> On 6 Jan 2024, at 17:10, Jack via KMyMoney-devel  
>>>> wrote:
>>>> 
>>>> On 1/6/24 11:40, Jonathan Kimmitt via KMyMoney-devel wrote:
>>>>> Hi Jack,
>>>>>   I am using Apple M1 macOS 14.2.1 (23C71), with GnuCash Version: 5.4 
>>>>> Build ID: 5.4+(2023-09-23) and KMyMoney Version 5.1.3-33a66be8a
>>>>> 
>>>>> The converter was written with OCaml 5.0.0 but I would not expect any 
>>>>> lack of portability for the XML handling.
>>>>> 
>>>>> The error when trying to open the GnuCash XML  in the GUI was:
>>>>> Could not read your data source. Please check the KMyMoney settings that 
>>>>> the necessary plugin is enabled.
>>>>> 
>>>>> Based on what Mark was saying, it sounds like the failure is something 
>>>>> quite trivial, however I lack the knowledge to debug it.
>>>>> 
>>>>> Regards,
>>>>> Jonathan
>>>> I'll have to do some digging, but the first step would be to assure the 
>>>> file can be read.  If it is on a local drive and you can look at it in a 
>>>> text editor, then that's OK.  The next step would be to assure that the 
>>>> guncash importer is present and enabled.  Go to Setting/Configure 
>>>> KMyMoney... select Plugins on the left side, and see if GNC Importer is 
>>>> present on the right.  If it's there, then we do have an interesting 
>>>> problem.  If it is NOT present, then we need to figure out why not.  I 
>>>> just confirmed it IS present in the Appimage versions, but I don't know 
>>>> about the macOS version.
>> 
>> 
> 
> --
> 
> Regards
> 
> Thomas Baumgart
> 
> -
> Ilde servers are the devil's work -- robbyoconnor on #irc
> -


Re: GnuCash import difficulty and interim solution

2024-01-06 Thread Jonathan Kimmitt via KMyMoney-devel
Yes, it is present and has version GNC Importer Version 5.1.3-33a66be8a. Under 
OSX it’s in KMyMoney preferences instead of Setting

It’s probably something stupid like an account or payee name with an & in is 
represented unadorned in the XML whereas KMyMoney requires &

> On 6 Jan 2024, at 17:10, Jack via KMyMoney-devel  
> wrote:
> 
> On 1/6/24 11:40, Jonathan Kimmitt via KMyMoney-devel wrote:
>> Hi Jack,
>>   I am using Apple M1 macOS 14.2.1 (23C71), with GnuCash Version: 5.4 Build 
>> ID: 5.4+(2023-09-23) and KMyMoney Version 5.1.3-33a66be8a
>> 
>> The converter was written with OCaml 5.0.0 but I would not expect any lack 
>> of portability for the XML handling.
>> 
>> The error when trying to open the GnuCash XML  in the GUI was:
>> Could not read your data source. Please check the KMyMoney settings that the 
>> necessary plugin is enabled.
>> 
>> Based on what Mark was saying, it sounds like the failure is something quite 
>> trivial, however I lack the knowledge to debug it.
>> 
>> Regards,
>> Jonathan
> I'll have to do some digging, but the first step would be to assure the file 
> can be read.  If it is on a local drive and you can look at it in a text 
> editor, then that's OK.  The next step would be to assure that the guncash 
> importer is present and enabled.  Go to Setting/Configure KMyMoney... select 
> Plugins on the left side, and see if GNC Importer is present on the right.  
> If it's there, then we do have an interesting problem.  If it is NOT present, 
> then we need to figure out why not.  I just confirmed it IS present in the 
> Appimage versions, but I don't know about the macOS version.



Re: GnuCash import difficulty and interim solution

2024-01-06 Thread Jonathan Kimmitt via KMyMoney-devel
Hi Jack,
  I am using Apple M1 macOS 14.2.1 (23C71), with GnuCash Version: 5.4 Build ID: 
5.4+(2023-09-23) and KMyMoney Version 5.1.3-33a66be8a

The converter was written with OCaml 5.0.0 but I would not expect any lack of 
portability for the XML handling.

The error when trying to open the GnuCash XML  in the GUI was:
Could not read your data source. Please check the KMyMoney settings that the 
necessary plugin is enabled.

Based on what Mark was saying, it sounds like the failure is something quite 
trivial, however I lack the knowledge to debug it.

Regards,
Jonathan

> On 6 Jan 2024, at 16:23, Jack via KMyMoney-devel  
> wrote:
> 
> On 1/6/24 10:36, Jonathan Kimmitt via KMyMoney-devel wrote:
>> (*
>> Dear kMyMoney developers,
>>   I came across KMyMoney while looking for a replacement for the recently 
>> deceased QuickBooks Desktop.
>> Having gone to the trouble of converting my accounts from Quickbooks to 
>> GnuCash, I was a little disappointed
>> that the “open Gnucash XML file” feature didn’t seem to work. I offer you a 
>> crude standalone converter which someone
>> might be able to work up into a general purpose importer. Comments welcome. 
>> At the moment I don’t have non UK
>> currencies to work with. The extrapolation should be a simple exercise.
>> 
>> Regards,
>> Jonathan
>> *)
> 
> Thanks for the contribution.  I'll let others comment on how we might use it. 
>  However, my first question is what didn't work on trying to open a GnuCash 
> XML file.  Along with that, I'd ask what version of KMyMoney, and what 
> operating system/distribution are you using?
> 
> Thanks
> 
> Jack
> 



GnuCash import difficulty and interim solution

2024-01-06 Thread Jonathan Kimmitt via KMyMoney-devel
(*
Dear kMyMoney developers,
  I came across KMyMoney while looking for a replacement for the recently 
deceased QuickBooks Desktop.
Having gone to the trouble of converting my accounts from Quickbooks to 
GnuCash, I was a little disappointed
that the “open Gnucash XML file” feature didn’t seem to work. I offer you a 
crude standalone converter which someone
might be able to work up into a general purpose importer. Comments welcome. At 
the moment I don’t have non UK
currencies to work with. The extrapolation should be a simple exercise.

Regards,
Jonathan
*)

(* License: GNU General Public Licence Version 2 *)
(* AUTHOR: Dr Jonathan Kimmitt *)

(* can be compiled with "ocamlfind ocamlopt -linkpkg -package unix,xml-light -g 
translate.ml -o mymoney" *)

open Xml

let unm = ref None

let cnvtim (tm:Unix.tm) = Printf.sprintf "%.2d-%.2d-%.2d" (tm.tm_year+1900) 
(tm.tm_mon+1) tm.tm_mday
let cnv t = Scanf.sscanf t "%d-%d-%d %d:%d:%d" (fun yr mn dy hr min sec ->
 let 
x={Unix.tm_year=yr-1900;tm_mon=mn-1;tm_mday=dy;tm_hour=hr;tm_min=mn;tm_sec=sec;tm_wday=0;tm_yday=0;tm_isdst=false}
 in
 let _, tm = Unix.mktime x in cnvtim tm)

type item = {
  mutable tim_posted: string;
  mutable tim_entered: string;
  mutable num: string;
  mutable desc: string;
  mutable tran_id: string;
  mutable split_id: string;
  mutable recon: string;
  mutable recon_date: string;
  mutable value: string;
  mutable quantity: string;
  mutable split_guid: string;
  mutable action: string;
  mutable memo: string;
}

let empty_item () =
  {tim_posted=""; tim_entered=""; num=""; desc=""; tran_id=""; split_id=""; 
recon=""; recon_date=""; value=""; quantity=""; split_guid=""; action=""; 
memo="" }

let copy_item {tim_posted; tim_entered; num; desc; tran_id; split_id; recon; 
recon_date; value; quantity; split_guid; action; memo } =
{tim_posted; tim_entered; num; desc; tran_id; split_id; recon; recon_date; 
value; quantity; split_guid; action; memo }

let scan1 value = Scanf.sscanf value "%f/%f" (fun a b -> Printf.sprintf "%.2f" 
(a /. b))

let cnts = ref []

let acch = Hashtbl.create 255
let payeeh = Hashtbl.create 255
let trancnt = ref 0

let mymoney acclst tranlst payees = Element ("KMYMONEY-FILE", [],
  [Element ("FILEINFO", [],
 [Element ("CREATION_DATE", [("date", "2024-01-05")], []);
  Element ("LAST_MODIFIED_DATE", [("date", "2024-01-05")], []);
  Element ("VERSION", [("id", "1")], []);
  Element ("FIXVERSION", [("id", "5")], [])]);
   Element ("USER", [("name", ""); ("email", "")],
 [Element ("ADDRESS",
[("zipcode", ""); ("county", ""); ("telephone", ""); ("street", "");
 ("city", "")],
[])]);
   Element ("INSTITUTIONS", [("count", "0")], []);
   Element ("PAYEES", [("count", string_of_int (List.length payees))], payees);
   Element ("COSTCENTERS", [("count", "0")], []);
   Element ("TAGS", [("count", "1")],
 [Element ("TAG",
[("id", "G01"); ("name", "tags"); ("closed", "0");
 ("tagcolor", "#00")],
[])]);
   Element ("ACCOUNTS", [("count", string_of_int (List.length acclst))], 
acclst);
   Element ("TRANSACTIONS", [("count", string_of_int (List.length tranlst))], 
tranlst);
   Element ("KEYVALUEPAIRS", [],
 [Element ("PAIR", [("key", "kmm-baseCurrency"); ("value", "GBP")], []);
  Element
   ("PAIR",
[("key", "kmm-id");
 ("value", "{93976d56-6861-4c85-aa47-b6c7b4e20175}")],
[])]);
   Element ("SCHEDULES", [("count", "0")], []);
   Element ("SECURITIES", [("count", "0")], []);
   Element ("CURRENCIES", [("count", "1")],
 [Element ("CURRENCY",
[("type", "3"); ("id", "GBP"); ("name", "British Pound");
 ("scf", "100"); ("saf", "100"); ("rounding-method", "7");
 ("pp", "4"); ("symbol", "£")],
[])]);
   Element ("PRICES", [("count", "0")], []);
   Element ("REPORTS", [("count", "0")], []);
   Element ("BUDGETS", [("count", "0")], []);
   Element ("ONLINEJOBS", [("count", "0")], [])])

let payee name id = Element ("PAYEE",
[("id", id); ("name", name); ("reference", "");
 ("matchignorecase", "1"); ("matchingenabled", "1"); ("email", "");
 ("matchkey", "^$"); ("usingmatchkey", "0")],
[Element ("ADDRESS",
   [("state", ""); ("telephone", ""); ("street", ""); ("city", "");
("postcode", "")],
   [])])

let find_payee name =
  if Hashtbl.mem payeeh name then
 Hashtbl.find payeeh name
  else
 let id = Printf.sprintf "P%.6d" (1 + Hashtbl.length payeeh) in
 let _ = Hashtbl.add payeeh name id in id

let _ = List.iter(function
| Element ("ACCOUNT",
([("type", acctype); ("description", _); ("id", id);
 ("name", accname); ("lastreconciled", _); ("opened", _);
 ("institution", _); ("lastmodified", _); ("parentaccount", "");
 ("number", _); ("currency", "GBP")]), _) ->
   Hashtbl.add acch id (accname,acctype,[],ref [], id)
| _ -> failwith "acc''") 
[Element
  ("ACCOUNT",
   [("type", "9"); ("