[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [coldsync-hackers] ExpenseDB format



Title: RE: [coldsync-hackers] ExpenseDB format

Does anyone have any ideas on this? 

-----Original Message-----
From: Ferrell, Jason [mailto:Jason.Ferrell@MCCookMETALS.com]
Sent: Wednesday, April 17, 2002 10:10 AM
To: 'coldsync-hackers@lusars.net'
Subject: RE: [coldsync-hackers] ExpenseDB format


Sorry for the delay, here's my script, with the output below.  Basically, I'm not getting anything that I can use as far as a number that I can manipulate as the number of seconds since a date or something else.  How should I format the data to get something like that? 

#!/bin/perl
use Palm::PDB;
use Palm::Raw;
my $pdb = new Palm::PDB;
my $dbfile="/home/jtferrel/visor/backup/ExpenseDB.pdb";
$pdb->Load($dbfile) || die print "oops! no $dbfile found\n";
$pdb->{sort};
open( OUT, ">visorsynch.csv");
print( OUT "Date,Category,Type,Amount,Country,Payment Type,Vendor,City,Attendee,Note\n");
print( OUT "uid,date,expensetype,currency,amount,category,payment,vendor,city,attendees,note\n" );
my $i = 0;
foreach $record (@{$pdb->{records}}){
my $record = {};
$record = $pdb->{records}[$i];
# ($uid,$date,$expensetype,$currency,$amount,$category,$payment,$vendor,$city,$attendees,$note)=unpack("A3 a a a a a a a a a a",$record->{data});

# print( OUT "$uid,$date,$expensetype,$currency,$amount,$category,$payment,$vendor,$city,$attendees,$note\n" );
($recordstring)=unpack("a1000000",$record->{data});
$recordstring =~ tr/\cW/,/;
$recordstring =~ tr/\c@/,/;
print( OUT "$recordstring\n" );
($amount,$vendor,$city,$attendees,$note) = split(/,/,$recordstring);
print( OUT "$amount\t$vendor\t$city\t$attendees\t$note\t".ord($vendor)."\n" );
$i++;
}
close OUT;
Results:
Date,Category,Type,Amount,Country,Payment Type,Vendor,City,Attendee,Note
uid,date,expensetype,currency,amount,category,payment,vendor,city,attendees,note
Äx
,u28.00,Lunch,,,,
Äx
 u28.00 Lunch 117
Äx
,u10.00,Dinner ,,,,
Äx
u10.00 Dinner 117
Äy
,u5.50,Lunch - Jason,,,,
Äy
 u5.50 Lunch - Jason 117
Äz
,u2.50,Dinner - jason,,,,
Äz
 u2.50 Dinner - jason 117
Äz
,u.30,Genoiogy copies,,,,
Äz
 u.30 Genoiogy copies 117
Äz
,u4.00,Snack / drinks - Jason,,,,
Äz
 u4.00 Snack / drinks - Jason 117
Äy
,¾7.58,Southeastern wholesale,1498,,,
Äy
¾7.58 Southeastern wholesale 1498 190
Ä
,¾500.00,NBC,1005,,,
Ä
¾500.00 NBC 1005 190
ă
,Î30.46,Gas,126403.6,Van,19.412-1.569,
ă
 Î30.46 Gas 126403.6 Van 206
ă
,¾18.08,Gas,121149.1,Honda,11.104-1.629,
ă
 ¾18.08 Gas 121149.1 Honda 190
ă
,¾18.00,NBC,1499,,,
ă
¾18.00 NBC 1499 190
ă
,¾35.68,Village of Woodridge,1494,,,
ă
¾35.68 Village of Woodridge 1494 190
Ä"
,¾6.94,Cub,,,,
Ä"
 ¾6.94 Cub 190
ÄŠ
,¾10.02,Dupage Co. Public Works,,,,
ÄŠ
¾10.02 Dupage Co. Public Works 190
Ę
,¾50.83,Com Ed,,,,
Ę
¾50.83 Com Ed 190