#!/usr/bin/perl -w # # The kaupthing2qif.pl is Copyright (c) 2008 Tomas Edwardsson. Iceland. All right reserved. # # You may distribute under the terms of either the GNU General Public License or the Artistic License, # as specified in the Perl README file. # Þetta forrit tekur XML skrá úr yfirliti í netbanka Kaupþings og breytir í qif fyrir gnucash eða # önnur forrit sem kunna það snið. use strict; use Data::Dumper; use XML::Simple; die "Usage: $0 " if (@ARGV != 1); my $ref = XMLin($ARGV[0]); foreach my $r (@{$ref->{Faerslur}}) { my $date = $r->{Dagsetning}; $date =~ s/^(\d{2})\.(\d{2})\.(\d{4}).*$/$3-$2-$1/; my $skyring = $r->{Texti}; if (!ref($r->{Skyring})) { $skyring .= " $r->{Skyring}"; } while ($skyring =~ s/ / /g) { } $skyring =~ s/ / /g; my $upphaed = $r->{Upphaed}; $upphaed =~ s/,/./g; print "!Type:Bank\nD$date\n"; print "P$skyring\n"; print "T$upphaed\n^\n"; }