mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
resurect from the dead
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@4992 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
87a8e216c9
commit
f01c9af127
28
src/optional/swig/examples/scan-acct.pl
Executable file
28
src/optional/swig/examples/scan-acct.pl
Executable file
@ -0,0 +1,28 @@
|
||||
#!/usr/bin/perl -w
|
||||
|
||||
# gnucash perl demo:
|
||||
#
|
||||
# This file demonstrates how to open an acount file and print
|
||||
# the names and balances of the top-level accounts in the file.
|
||||
#
|
||||
# use lib '../swig/perl5/';
|
||||
use lib '../perl5/';
|
||||
use gnucash;
|
||||
package gnucash;
|
||||
|
||||
die "Usage: $0 <filename>" if $#ARGV < 0;
|
||||
print "its $ARGV[0]\n";
|
||||
|
||||
$sess = gnucash::xaccMallocSession ();
|
||||
$grp = gnucash::xaccSessionBeginFile ($sess,$ARGV[0]);
|
||||
$numacc = gnucash::xaccGroupGetNumAccounts ($grp);
|
||||
print "Loaded $numacc accounts\n\n";
|
||||
|
||||
for ($i=0; $i<$numacc; $i++) {
|
||||
$acct = gnucash::xaccGroupGetAccount ($grp, $i);
|
||||
$acctname = gnucash::xaccAccountGetName ($acct);
|
||||
$baln = gnucash::xaccAccountGetBalance ($acct);
|
||||
print "\tAccount: $acctname \tBalance: $baln\n";
|
||||
}
|
||||
|
||||
gnucash::xaccSessionEnd ($sess);
|
Loading…
Reference in New Issue
Block a user