mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
*** empty log message ***
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@2089 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
ae37bf8dfc
commit
8bc80497e1
15
ChangeLog
15
ChangeLog
@ -1,3 +1,18 @@
|
||||
2000-03-18 Dave Peticolas <peticola@cs.ucdavis.edu>
|
||||
|
||||
* src/engine/Query.c (xaccInitQuery): make the standard engine
|
||||
order the default sort order.
|
||||
|
||||
* src/gnome/window-adjust.c (adjBRefresh): update the title
|
||||
|
||||
* src/Refresh.c (gnc_account_ui_refresh): refresh the edit account
|
||||
and adjust balance windows too.
|
||||
|
||||
* src/gnome/dialog-edit.c: add gui for changed the account type.
|
||||
|
||||
* src/engine/Account.c (xaccAccountSetType): allow account types
|
||||
to be changed.
|
||||
|
||||
2000-03-15 Dave Peticolas <peticola@cs.ucdavis.edu>
|
||||
|
||||
* src/scm/extensions.scm (gnc:new-menu-namer): register and
|
||||
|
@ -230,6 +230,15 @@
|
||||
|
||||
<dd>for attempted Java port/MoneyDance</dd>
|
||||
|
||||
<dt> <a href="mailto:dennisb@cs.chalmers.se"> Dennis
|
||||
Björklund</a></dt>
|
||||
|
||||
<dd>Swedish translation</dd>
|
||||
|
||||
<dt> <a href="mailto:bojsen@worldnet.att.net"> Per Bojsen</a></dt>
|
||||
|
||||
<dd>several core dump fixes</dd>
|
||||
|
||||
<dt> <a href="http://www.hex.net/~cbbrowne"> Christopher B.
|
||||
Browne</a></dt>
|
||||
|
||||
|
@ -36,10 +36,10 @@ include @top_srcdir@/Makefile.init
|
||||
default:
|
||||
@echo " "
|
||||
@echo "Please choose one of the following targets:"
|
||||
@echo "motif dynamically linked motif version"
|
||||
@echo "motif-static statically linked motif version"
|
||||
@echo "gnome gnome/gtk version"
|
||||
@echo "gnome-static gnome/gtk statically linked version"
|
||||
@echo "motif motif version (unfinished)"
|
||||
@echo "motif-static motif statically linked version (unfinished)"
|
||||
@echo "qt kde/qt version (unfinished)"
|
||||
@echo "qt-static kde/qt statically linked version (unfinished)"
|
||||
@echo " "
|
||||
|
1
README
1
README
@ -535,6 +535,7 @@ Fixes & Patches:
|
||||
Andrew Arensburger <arensb@cfar.umd.edu> for FreeBSD & other patches
|
||||
Matt Armstrong <matt_armstrong@bigfoot.com> for misc fixes
|
||||
Fred Baube <fred@moremagic.com> for attempted Java port/MoneyDance
|
||||
Dennis Björklund <dennisb@cs.chalmers.se> Swedish translation
|
||||
Per Bojsen <bojsen@worldnet.att.net> several core dump fixes
|
||||
Christopher B. Browne <cbbrowne@hex.net> for perl and lots of scheme
|
||||
Graham Chapman <grahamc@zeta.org.au> for the xacc-rpts addon package
|
||||
|
@ -1,4 +1,5 @@
|
||||
*.gmo
|
||||
*.pox
|
||||
*.mo
|
||||
Makefile
|
||||
Makefile.in
|
||||
|
@ -83,18 +83,16 @@ INSTOBJEXT = @INSTOBJEXT@
|
||||
|
||||
all: $(CATALOGS)
|
||||
|
||||
$(PACKAGE).pot: pseudo-source.c
|
||||
$(XGETTEXT) --default-domain=$(PACKAGE) \
|
||||
--add-comments --keyword=_ --keyword=N_ $<
|
||||
if cmp -s $(PACKAGE).po $(srcdir)/$(PACKAGE).pot; then \
|
||||
rm -f $(PACKAGE).po; \
|
||||
else \
|
||||
rm -f $(srcdir)/$(PACKAGE).pot \
|
||||
&& mv $(PACKAGE).po $(srcdir)/$(PACKAGE).pot; \
|
||||
fi
|
||||
$(PACKAGE).pot: pseudo-source.c $(POTFILES)
|
||||
$(XGETTEXT) --default-domain=$(PACKAGE) --directory=$(top_srcdir) \
|
||||
--add-comments --keyword=_ --keyword=N_ \
|
||||
--files-from=$(srcdir)/POTFILES.in \
|
||||
&& test ! -f $(PACKAGE).po \
|
||||
|| ( rm -f $(srcdir)/$(PACKAGE).pot \
|
||||
&& mv $(PACKAGE).po $(srcdir)/$(PACKAGE).pot )
|
||||
|
||||
pseudo-source.c: $(POTFILES)
|
||||
perl -s extract-macros.perl $(POTFILES) > $@
|
||||
pseudo-source.c: $(top_srcdir)/include/messages_i18n.h
|
||||
perl -s extract-macros.perl $< > $@
|
||||
|
||||
install: install-exec install-data
|
||||
install-exec:
|
||||
|
@ -1,5 +1,9 @@
|
||||
# List of files which containing translatable strings.
|
||||
# Copyright (C) 1995, 1998 Free Software Foundation, Inc.
|
||||
|
||||
include/messages_i18n.h
|
||||
po/pseudo-source.c
|
||||
po/guile_strings.txt
|
||||
src/gnome/dialog-account-picker.c
|
||||
src/gnome/dialog-qif-import.c
|
||||
src/gnome/glade-account-picker.c
|
||||
src/gnome/glade-qif-import.c
|
||||
|
2473
po/en_GB.po
2473
po/en_GB.po
File diff suppressed because it is too large
Load Diff
2450
po/gnucash.pot
2450
po/gnucash.pot
File diff suppressed because it is too large
Load Diff
@ -3,6 +3,7 @@ _("Second Option")
|
||||
_("Mutual Fund")
|
||||
_("Status")
|
||||
_("Date")
|
||||
_("Account Name")
|
||||
_("Equity")
|
||||
_("Account Separator")
|
||||
_("The default background color for splits in multi-line mode and the auto modes")
|
||||
@ -53,12 +54,14 @@ _("The default background color for odd rows in single mode")
|
||||
_("Auto Single")
|
||||
_("Display the Hello, World report.")
|
||||
_("Hello Again")
|
||||
_("This page shows your profits and losses.")
|
||||
_("Show Vertical Borders")
|
||||
_("This is a boolean option.")
|
||||
_("_Profit and Loss")
|
||||
_("Background Color")
|
||||
_("Income/Salary/Taxable")
|
||||
_("There are no selected accounts in the account list option.")
|
||||
_("This page shows your net worth.")
|
||||
_("_Budget")
|
||||
_("Continental Europe: dd.mm.yyyy")
|
||||
_("account_edit_win_height")
|
||||
@ -86,6 +89,7 @@ _("Average")
|
||||
_("The items selected in the list option are:")
|
||||
_("A_ccount Balance Tracker")
|
||||
_("From")
|
||||
_("Start of reporting period")
|
||||
_("Sort by EXACT entry time")
|
||||
_("account_add_win_width")
|
||||
_("Full")
|
||||
@ -107,6 +111,7 @@ _("Account Balance Tracker")
|
||||
_("Report Options")
|
||||
_("Show transactions on single lines")
|
||||
_("Description")
|
||||
_("Calculate balance sheet up to this date")
|
||||
_("Alternate the even and odd colors with each transaction, not each row")
|
||||
_("Gain/Loss")
|
||||
_("Transfer from/to")
|
||||
@ -139,6 +144,7 @@ _("Single Line")
|
||||
_("Sub-Accounts")
|
||||
_("The date and time option is %s.")
|
||||
_("Liability")
|
||||
_("End of reporting period")
|
||||
_("Don't reverse any accounts")
|
||||
_("Good option")
|
||||
_("US")
|
||||
@ -167,6 +173,7 @@ _("Income\\Salary\\Taxable")
|
||||
_("Code")
|
||||
_("Balance sheet")
|
||||
_("Export data as text.")
|
||||
_("Balance Sheet")
|
||||
_("- (Dash)")
|
||||
_("Order of primary sorting")
|
||||
_("Default Currency For New Accounts")
|
||||
@ -246,6 +253,7 @@ _("Make No Plot")
|
||||
_("Bad option")
|
||||
_("Display the Balance sheet report.")
|
||||
_("Display the Account Transactions report.")
|
||||
_("Net")
|
||||
_("Have a nice day!")
|
||||
_("This is a list option")
|
||||
_("Order of Secondary sorting")
|
||||
|
@ -45,6 +45,7 @@ rm -rf $RPM_BUILD_ROOT
|
||||
/usr/share/gnucash
|
||||
/usr/share/gnome/apps/Applications/gnucash.desktop
|
||||
/usr/share/locale/de/LC_MESSAGES/gnucash.mo
|
||||
/usr/share/locale/fr/LC_MESSAGES/gnucash.mo
|
||||
/usr/share/locale/en_GB/LC_MESSAGES/gnucash.mo
|
||||
/usr/share/locale/fr/LC_MESSAGES/gnucash.mo
|
||||
/usr/share/locale/sv/LC_MESSAGES/gnucash.mo
|
||||
%doc /usr/doc/gnucash
|
||||
|
@ -49,5 +49,8 @@ EditNotesWindow * editNotesWindow (Account *acc);
|
||||
void xaccDestroyEditAccWindow (Account *);
|
||||
void xaccDestroyEditNotesWindow (Account *);
|
||||
|
||||
void editAccountRefresh(Account *);
|
||||
|
||||
void xaccSetDefaultNewaccountCurrency(char *new_default_currency);
|
||||
|
||||
#endif /* __XACC_NEWACCWINDOW_H__ */
|
||||
|
@ -1,6 +1,7 @@
|
||||
/********************************************************************\
|
||||
* AdjBWindow.h -- the adjust balance window *
|
||||
* Copyright (C) 1997 Robin D. Clark *
|
||||
* Copyright (C) 1998-2000 Linas Vepstas *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU General Public License as *
|
||||
@ -34,6 +35,8 @@
|
||||
* for the indicated account, if that dialog is not already mapped.
|
||||
* If the dialog already esits, it returns with a no-op.
|
||||
*
|
||||
* The adjBRefresh() subroutine refreshes the associated window.
|
||||
*
|
||||
* The xaccDestroyAdjBWindow() subroutine can be called from
|
||||
* anywhere to shut down the Register window. Used primarily when
|
||||
* destroying the underlying account.
|
||||
@ -42,6 +45,7 @@
|
||||
typedef struct _AdjBWindow AdjBWindow;
|
||||
|
||||
AdjBWindow *adjBWindow(Account *account);
|
||||
void adjBRefresh(Account *account);
|
||||
void xaccDestroyAdjBWindow (Account *);
|
||||
|
||||
#endif /* __XACC_ADJBWINDOW_H__ */
|
||||
|
@ -27,24 +27,22 @@
|
||||
#include "Group.h"
|
||||
#include "LedgerUtils.h"
|
||||
#include "MultiLedger.h"
|
||||
|
||||
#ifdef KDE
|
||||
#if 0
|
||||
#include "qt/reconciledlg.h"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef GNOME
|
||||
#include "window-reconcile.h"
|
||||
#endif
|
||||
|
||||
#ifdef MOTIF
|
||||
#include "RecnWindow.h"
|
||||
#endif
|
||||
|
||||
#include "util.h"
|
||||
|
||||
|
||||
/* ------------------------------------------------------ */
|
||||
void
|
||||
xaccAccountWindowDestroySimple (Account *acc)
|
||||
{
|
||||
xaccDestroyLedgerDisplay (acc);
|
||||
xaccDestroyRecnWindow (acc);
|
||||
xaccDestroyAdjBWindow (acc);
|
||||
xaccDestroyEditAccWindow (acc);
|
||||
xaccDestroyEditNotesWindow (acc);
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------ */
|
||||
void
|
||||
xaccAccountWindowDestroy (Account *acc)
|
||||
@ -64,11 +62,7 @@ xaccAccountWindowDestroy (Account *acc)
|
||||
}
|
||||
}
|
||||
|
||||
xaccDestroyLedgerDisplay (acc);
|
||||
xaccDestroyRecnWindow (acc);
|
||||
xaccDestroyAdjBWindow (acc);
|
||||
xaccDestroyEditAccWindow (acc);
|
||||
xaccDestroyEditNotesWindow (acc);
|
||||
xaccAccountWindowDestroySimple(acc);
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------ */
|
||||
|
@ -28,6 +28,7 @@
|
||||
#include "Group.h"
|
||||
|
||||
void xaccAccountWindowDestroy (Account *acc);
|
||||
void xaccAccountWindowDestroySimple (Account *acc);
|
||||
void xaccGroupWindowDestroy (AccountGroup *grp);
|
||||
|
||||
|
||||
|
47
src/RecnWindow.h
Normal file
47
src/RecnWindow.h
Normal file
@ -0,0 +1,47 @@
|
||||
/********************************************************************\
|
||||
* RecnWindow.h -- the reconcile window *
|
||||
* Copyright (C) 1997 Robin D. Clark *
|
||||
* Copyright (C) 1998-2000 Linas Vepstas *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU General Public License as *
|
||||
* published by the Free Software Foundation; either version 2 of *
|
||||
* the License, or (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License*
|
||||
* along with this program; if not, write to the Free Software *
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
|
||||
* *
|
||||
* Author: Rob Clark *
|
||||
* Internet: rclark@cs.hmc.edu *
|
||||
* Address: 609 8th Street *
|
||||
* Huntington Beach, CA 92648-4632 *
|
||||
\********************************************************************/
|
||||
|
||||
#ifndef __RECONCILE_H__
|
||||
#define __RECONCILE_H__
|
||||
|
||||
#include "top-level.h"
|
||||
#include "Account.h"
|
||||
|
||||
|
||||
/** STRUCTS *********************************************************/
|
||||
typedef struct _RecnWindow RecnWindow;
|
||||
|
||||
/** PROTOTYPES ******************************************************/
|
||||
void recnRefresh( Account * );
|
||||
RecnWindow *recnWindow( gncUIWidget parent, Account *account );
|
||||
|
||||
/*
|
||||
* The xaccDestroyRecnWindow() subroutine can be called from
|
||||
* anywhere to shut down the Register window. Used primarily when
|
||||
* destroying the underlying account.
|
||||
*/
|
||||
void xaccDestroyRecnWindow (Account *);
|
||||
|
||||
#endif
|
@ -1,6 +1,6 @@
|
||||
/*******************************************************************\
|
||||
* Refresh.c -- utilities for window refresh (GnuCash) *
|
||||
* Copyright (C) 1999 Linas Vepstas *
|
||||
* Copyright (C) 1999,2000 Linas Vepstas *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU General Public License as *
|
||||
@ -25,24 +25,13 @@
|
||||
#include "Refresh.h"
|
||||
#include "LedgerUtils.h"
|
||||
#include "MultiLedger.h"
|
||||
|
||||
#ifdef KDE
|
||||
#if 0
|
||||
#include "qt/reconciledlg.h"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef GNOME
|
||||
#include "window-reconcile.h"
|
||||
#endif
|
||||
|
||||
#ifdef MOTIF
|
||||
#include "RecnWindow.h"
|
||||
#endif
|
||||
#include "AdjBWindow.h"
|
||||
#include "AccWindow.h"
|
||||
|
||||
#include "util.h"
|
||||
|
||||
|
||||
|
||||
/* ------------------------------------------------------ */
|
||||
void
|
||||
gnc_account_ui_refresh(Account *account)
|
||||
@ -71,6 +60,8 @@ gnc_account_ui_refresh(Account *account)
|
||||
|
||||
xaccAccountDisplayRefresh(account);
|
||||
recnRefresh(account);
|
||||
adjBRefresh(account);
|
||||
editAccountRefresh(account);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*******************************************************************\
|
||||
* Refresh.h -- utilities for window refresh for GnuCash *
|
||||
* Copyright (C) 1999 Linas Vepstas *
|
||||
* Copyright (C) 1999,2000 Linas Vepstas *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU General Public License as *
|
||||
|
@ -1,6 +1,7 @@
|
||||
/********************************************************************\
|
||||
* RegWindow.h -- the register window for xacc (X-Accountant) *
|
||||
* Copyright (C) 1997 Robin D. Clark *
|
||||
* Copyright (C) 1998-2000 Linas Vepstas *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU General Public License as *
|
||||
@ -35,7 +36,6 @@
|
||||
typedef struct _RegWindow RegWindow;
|
||||
|
||||
/** PROTOTYPES ******************************************************/
|
||||
void accRefresh (Account *);
|
||||
RegWindow *regWindowSimple(Account *account);
|
||||
RegWindow *regWindowAccGroup(Account *account_group);
|
||||
|
||||
|
@ -410,7 +410,6 @@ LedgerTraverse (Table *table,
|
||||
int *p_new_phys_col,
|
||||
void * client_data)
|
||||
{
|
||||
#ifdef GNOME
|
||||
SplitRegister *reg = client_data;
|
||||
SRInfo *info = xaccSRGetInfo(reg);
|
||||
Transaction *trans, *new_trans;
|
||||
@ -465,7 +464,6 @@ LedgerTraverse (Table *table,
|
||||
default:
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/* ======================================================== */
|
||||
@ -647,7 +645,6 @@ xaccSRGetSplitRowCol (SplitRegister *reg, Split *split,
|
||||
Split *
|
||||
xaccSRDuplicateCurrent (SplitRegister *reg)
|
||||
{
|
||||
#ifdef GNOME
|
||||
SRInfo *info = xaccSRGetInfo(reg);
|
||||
CursorType cursor_type;
|
||||
unsigned int changed;
|
||||
@ -779,7 +776,6 @@ xaccSRDuplicateCurrent (SplitRegister *reg)
|
||||
gnc_refresh_main_window();
|
||||
|
||||
return return_split;
|
||||
#endif
|
||||
}
|
||||
|
||||
/* ======================================================== */
|
||||
@ -1238,7 +1234,6 @@ xaccSRSaveRegEntry (SplitRegister *reg, Transaction *newtrans)
|
||||
if ((currency != NULL) || (security != NULL))
|
||||
xaccAccountInsertSplit (new_acc, split);
|
||||
else {
|
||||
#ifdef GNOME
|
||||
char *message = NULL;
|
||||
|
||||
asprintf(&message, REG_CURR_MSG, xaccAccountGetName(new_acc));
|
||||
@ -1246,7 +1241,6 @@ xaccSRSaveRegEntry (SplitRegister *reg, Transaction *newtrans)
|
||||
|
||||
gnc_warning_dialog_parented(xaccSRGetParent(reg), message);
|
||||
free(message);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* make sure any open windows of the old account get redrawn */
|
||||
@ -1314,7 +1308,6 @@ xaccSRSaveRegEntry (SplitRegister *reg, Transaction *newtrans)
|
||||
if ((currency != NULL) || (security != NULL))
|
||||
xaccAccountInsertSplit (new_acc, other_split);
|
||||
else {
|
||||
#ifdef GNOME
|
||||
char *message = NULL;
|
||||
|
||||
asprintf(&message, REG_CURR_MSG, xaccAccountGetName(new_acc));
|
||||
@ -1322,7 +1315,6 @@ xaccSRSaveRegEntry (SplitRegister *reg, Transaction *newtrans)
|
||||
|
||||
gnc_warning_dialog_parented(xaccSRGetParent(reg), message);
|
||||
free(message);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* make sure any open windows of the old account get redrawn */
|
||||
|
@ -1,6 +1,6 @@
|
||||
/********************************************************************\
|
||||
* AccInfo.c -- the Account Info data structures *
|
||||
* Copyright (C) 1998, 1999 Linas Vepstas *
|
||||
* Copyright (C) 1998, 1999, 2000 Linas Vepstas *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU General Public License as *
|
||||
|
@ -1,6 +1,6 @@
|
||||
/********************************************************************\
|
||||
* AccInfoP.h -- the Account Info data structures *
|
||||
* Copyright (C) 1998, 1999 Linas Vepstas *
|
||||
* Copyright (C) 1998, 1999, 2000 Linas Vepstas *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU General Public License as *
|
||||
@ -49,7 +49,6 @@ struct _BankAcct
|
||||
char * acctid; /* account number */
|
||||
char * accttype; /* account type */
|
||||
char * acctkey; /* checksum key */
|
||||
|
||||
};
|
||||
|
||||
/* The InvAcct structure only applies when the account type
|
||||
|
@ -931,22 +931,20 @@ xaccAccountSetType (Account *acc, int tip)
|
||||
if (!acc) return;
|
||||
CHECK (acc);
|
||||
|
||||
/* After an account type has been set, it cannot be changed */
|
||||
if (-1 < acc->type) {
|
||||
PERR ("xaccAccountSetType(): "
|
||||
"the type of the account cannot be changed "
|
||||
"after its been set! \n"
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
/* refuse invalid account types */
|
||||
if (NUM_ACCOUNT_TYPES <= tip) return;
|
||||
|
||||
/* Don't bother if it already is. */
|
||||
if (acc->type == tip) return;
|
||||
|
||||
acc->type = tip;
|
||||
|
||||
/* initialize the auxilliary account info as well */
|
||||
if (acc->accInfo) xaccFreeAccInfo (acc->accInfo);
|
||||
acc->accInfo = xaccMallocAccInfo (tip);
|
||||
|
||||
/* Changing the type can change the way the balances are computed. */
|
||||
xaccAccountRecomputeBalance(acc);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -2,7 +2,7 @@
|
||||
* FileIO.c -- read from and writing to a datafile for gnucash *
|
||||
* (GnuCash/X-Accountant) *
|
||||
* Copyright (C) 1997 Robin D. Clark *
|
||||
* Copyright (C) 1997, 1998, 1999,2000 Linas Vepstas *
|
||||
* Copyright (C) 1997, 1998, 1999, 2000 Linas Vepstas *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU General Public License as *
|
||||
|
@ -1,16 +1,3 @@
|
||||
/*
|
||||
* FILE:
|
||||
* Query.c
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* Provide a simple query engine interface.
|
||||
* Note that the query engine is officially a part of the transaction engine,
|
||||
* and thus has direct access to internal structures.
|
||||
*
|
||||
* HISTORY:
|
||||
* created by Linas Vepstas Sept 1998
|
||||
* Copyright (c) 1998 Linas Vepstas
|
||||
*/
|
||||
/********************************************************************\
|
||||
* This program is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU General Public License as *
|
||||
@ -27,6 +14,20 @@
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
|
||||
\********************************************************************/
|
||||
|
||||
/*
|
||||
* FILE:
|
||||
* Query.c
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* Provide a simple query engine interface.
|
||||
* Note that the query engine is officially a part of the transaction engine,
|
||||
* and thus has direct access to internal structures.
|
||||
*
|
||||
* HISTORY:
|
||||
* created by Linas Vepstas Sept 1998
|
||||
* Copyright (c) 1998-2000 Linas Vepstas
|
||||
*/
|
||||
|
||||
#include <limits.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
@ -79,7 +80,7 @@ xaccMallocQuery (void)
|
||||
|
||||
/* ================================================== */
|
||||
|
||||
static int Sort_DATE_NUM_AMOUNT (Split **, Split **);
|
||||
static int Sort_STANDARD_NONE_NONE (Split **, Split **);
|
||||
|
||||
#ifndef LONG_LONG_MAX
|
||||
#define LONG_LONG_MAX 0x7fffffffffffffffLL
|
||||
@ -111,7 +112,7 @@ xaccInitQuery (Query *q)
|
||||
q->latest_found.tv_sec = LONG_LONG_MIN;
|
||||
q->latest_found.tv_nsec = 0;
|
||||
|
||||
q->sort_func = (int (*)(const void*, const void *)) Sort_DATE_NUM_AMOUNT;
|
||||
q->sort_func = (int (*)(const void*, const void *)) Sort_STANDARD_NONE_NONE;
|
||||
}
|
||||
|
||||
/* ================================================== */
|
||||
@ -243,6 +244,22 @@ xaccQuerySetLatest (Query *q, time_t latest)
|
||||
q->latest.tv_sec = latest;
|
||||
}
|
||||
|
||||
void
|
||||
xaccQuerySetEarliestTS (Query *q, Timespec earliest)
|
||||
{
|
||||
if (!q) return;
|
||||
q->changed = 1;
|
||||
q->earliest = earliest;
|
||||
}
|
||||
|
||||
void
|
||||
xaccQuerySetLatestTS (Query *q, Timespec latest)
|
||||
{
|
||||
if (!q) return;
|
||||
q->changed = 1;
|
||||
q->latest = latest;
|
||||
}
|
||||
|
||||
time_t
|
||||
xaccQueryGetEarliest (Query *q)
|
||||
{
|
||||
|
@ -1,15 +1,3 @@
|
||||
/*
|
||||
* FILE:
|
||||
* Query.h
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* Provide a simple query engine interface.
|
||||
*
|
||||
* HISTORY:
|
||||
* created by Linas Vepstas Sept 1998
|
||||
* Copyright (c) 1998 Linas Vepstas
|
||||
*/
|
||||
|
||||
/********************************************************************\
|
||||
* This program is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU General Public License as *
|
||||
@ -26,6 +14,18 @@
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
|
||||
\********************************************************************/
|
||||
|
||||
/*
|
||||
* FILE:
|
||||
* Query.h
|
||||
*
|
||||
* DESCRIPTION:
|
||||
* Provide a simple query engine interface.
|
||||
*
|
||||
* HISTORY:
|
||||
* created by Linas Vepstas Sept 1998
|
||||
* Copyright (c) 1998-2000 Linas Vepstas
|
||||
*/
|
||||
|
||||
#ifndef __GNUCASH_QUERY_H__
|
||||
#define __GNUCASH_QUERY_H__
|
||||
|
||||
@ -76,6 +76,9 @@ void xaccQuerySetDateRangeL (Query *, long long earliest, long long latest);
|
||||
void xaccQuerySetEarliest (Query *, time_t earliest);
|
||||
void xaccQuerySetLatest (Query *, time_t latest);
|
||||
|
||||
void xaccQuerySetEarliestTS (Query *, Timespec earliest);
|
||||
void xaccQuerySetLatestTS (Query *, Timespec latest);
|
||||
|
||||
time_t xaccQueryGetEarliest (Query *);
|
||||
time_t xaccQueryGetLatest (Query *);
|
||||
|
||||
|
@ -92,7 +92,7 @@ accountPickerBox(char * initial_selection, int initial_type) {
|
||||
AccountGroup * topgroup;
|
||||
Account * selected;
|
||||
int i;
|
||||
GtkWidget * treeitem = gtk_tree_item_new_with_label("All Accounts");
|
||||
GtkWidget * treeitem = gtk_tree_item_new_with_label(_("All Accounts"));
|
||||
GtkWidget * subtree = gtk_tree_new();
|
||||
SCM infolist;
|
||||
GtkWidget * active, * menu;
|
||||
|
@ -3,6 +3,7 @@
|
||||
* Copyright (C) 1997 Robin D. Clark *
|
||||
* Copyright (C) 1997, 1998, 1999 Linas Vepstas *
|
||||
* Copyright (C) 1999 Jeremy Collins *
|
||||
* Copyright (C) 2000 Dave Peticolas <petcola@cs.ucdavis.edu> *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU General Public License as *
|
||||
@ -24,10 +25,6 @@
|
||||
* Huntington Beach, CA 92648-4632 *
|
||||
\********************************************************************/
|
||||
|
||||
/* TODO:
|
||||
* -- tooltips for the widgets in the window
|
||||
*/
|
||||
|
||||
#include "top-level.h"
|
||||
|
||||
#include <gnome.h>
|
||||
@ -64,6 +61,7 @@ struct _accwindow
|
||||
|
||||
Account *parentAccount;
|
||||
Account *newAccount;
|
||||
|
||||
gint type;
|
||||
};
|
||||
|
||||
@ -523,8 +521,6 @@ accWindow (AccountGroup *this_is_not_used)
|
||||
continue;
|
||||
}
|
||||
|
||||
/* fixme check for unique code, if entered */
|
||||
|
||||
gnc_ui_accWindow_create_account(accData->newAccount,
|
||||
accData->parentAccount,
|
||||
accData->type, &strings);
|
||||
|
@ -34,9 +34,12 @@
|
||||
#include "MainWindow.h"
|
||||
#include "Refresh.h"
|
||||
#include "FileDialog.h"
|
||||
#include "MultiLedger.h"
|
||||
#include "window-reconcile.h"
|
||||
#include "dialog-utils.h"
|
||||
#include "account-tree.h"
|
||||
#include "window-help.h"
|
||||
#include "query-user.h"
|
||||
#include "messages.h"
|
||||
#include "util.h"
|
||||
|
||||
@ -60,9 +63,12 @@ struct _editaccwindow
|
||||
AccountEditInfo edit_info;
|
||||
|
||||
GtkWidget * parent_tree;
|
||||
GtkWidget * type_list;
|
||||
|
||||
Account * current_parent;
|
||||
Account * top_level_account;
|
||||
|
||||
gint type;
|
||||
};
|
||||
|
||||
|
||||
@ -114,8 +120,7 @@ gnc_filter_parent_accounts(Account *account, gpointer data)
|
||||
if (xaccAccountHasAncestor(account, editAccData->account))
|
||||
return FALSE;
|
||||
|
||||
return xaccAccountTypesCompatible(xaccAccountGetType(account),
|
||||
xaccAccountGetType(editAccData->account));
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
@ -125,14 +130,57 @@ gnc_ui_EditAccWindow_help_cb(GtkWidget *widget, gpointer data)
|
||||
}
|
||||
|
||||
static void
|
||||
gnc_ui_EditAccWindow_ok_cb(GtkWidget * widget,
|
||||
gpointer data)
|
||||
gnc_edit_change_account_types(Account *account, Account *except, int type)
|
||||
{
|
||||
AccountGroup *children;
|
||||
int i, num_children;
|
||||
|
||||
if (account == NULL)
|
||||
return;
|
||||
|
||||
if (account == except)
|
||||
return;
|
||||
|
||||
if (xaccAccountGetType(account) != type)
|
||||
{
|
||||
/* Just refreshing won't work. */
|
||||
xaccDestroyLedgerDisplay(account);
|
||||
|
||||
xaccAccountBeginEdit(account, GNC_F);
|
||||
xaccAccountSetType(account, type);
|
||||
xaccAccountCommitEdit(account);
|
||||
}
|
||||
|
||||
children = xaccAccountGetChildren(account);
|
||||
if (children == NULL)
|
||||
return;
|
||||
|
||||
num_children = xaccGetNumAccounts(children);
|
||||
for (i = 0; i < num_children; i++)
|
||||
{
|
||||
account = xaccGroupGetAccount(children, i);
|
||||
gnc_edit_change_account_types(account, except, type);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gnc_ui_EditAccWindow_ok_cb(GtkWidget * widget, gpointer data)
|
||||
{
|
||||
EditAccWindow *editAccData = (EditAccWindow *) data;
|
||||
AccountFieldStrings strings;
|
||||
|
||||
gboolean change_children;
|
||||
gboolean has_children;
|
||||
gboolean change_all;
|
||||
|
||||
GNCAccountTree *tree;
|
||||
|
||||
Account *new_parent;
|
||||
Account *account;
|
||||
AccountGroup *children;
|
||||
|
||||
int current_type;
|
||||
|
||||
char *old;
|
||||
|
||||
gnc_ui_extract_field_strings(&strings, &editAccData->edit_info);
|
||||
@ -140,12 +188,19 @@ gnc_ui_EditAccWindow_ok_cb(GtkWidget * widget,
|
||||
/* check for valid name */
|
||||
if (safe_strcmp(strings.name, "") == 0)
|
||||
{
|
||||
gnc_error_dialog(ACC_NO_NAME_MSG);
|
||||
gnc_error_dialog_parented(GTK_WINDOW(editAccData->dialog),
|
||||
ACC_NO_NAME_MSG);
|
||||
gnc_ui_free_field_strings(&strings);
|
||||
return;
|
||||
}
|
||||
|
||||
/* fixme check for unique code, if entered */
|
||||
/* check for valid type */
|
||||
if (editAccData->type == BAD_TYPE)
|
||||
{
|
||||
gnc_error_dialog_parented(GTK_WINDOW(editAccData->dialog), ACC_TYPE_MSG);
|
||||
gnc_ui_free_field_strings(&strings);
|
||||
return;
|
||||
}
|
||||
|
||||
tree = GNC_ACCOUNT_TREE(editAccData->parent_tree);
|
||||
new_parent = gnc_account_tree_get_current_account(tree);
|
||||
@ -153,13 +208,24 @@ gnc_ui_EditAccWindow_ok_cb(GtkWidget * widget,
|
||||
/* Parent check, probably not needed, but be safe */
|
||||
if (!gnc_filter_parent_accounts(new_parent, editAccData))
|
||||
{
|
||||
gnc_error_dialog(ACC_BAD_PARENT_MSG);
|
||||
gnc_error_dialog_parented(GTK_WINDOW(editAccData->dialog),
|
||||
ACC_BAD_PARENT_MSG);
|
||||
gnc_ui_free_field_strings(&strings);
|
||||
return;
|
||||
}
|
||||
|
||||
account = editAccData->account;
|
||||
|
||||
children = xaccAccountGetChildren(account);
|
||||
if (children == NULL)
|
||||
has_children = FALSE;
|
||||
else if (xaccGetNumAccounts(children) == 0)
|
||||
has_children = FALSE;
|
||||
else
|
||||
has_children = TRUE;
|
||||
|
||||
current_type = xaccAccountGetType(account);
|
||||
|
||||
/* currency check */
|
||||
old = xaccAccountGetCurrency(account);
|
||||
if (old == NULL)
|
||||
@ -171,7 +237,8 @@ gnc_ui_EditAccWindow_ok_cb(GtkWidget * widget,
|
||||
gboolean result;
|
||||
|
||||
s = g_strdup_printf(EDIT_CURRENCY_MSG, old, strings.currency);
|
||||
result = gnc_verify_dialog(s, GNC_T);
|
||||
result = gnc_verify_dialog_parented(GTK_WINDOW(editAccData->dialog),
|
||||
s, GNC_T);
|
||||
g_free(s);
|
||||
|
||||
if (!result)
|
||||
@ -192,7 +259,8 @@ gnc_ui_EditAccWindow_ok_cb(GtkWidget * widget,
|
||||
gboolean result;
|
||||
|
||||
s = g_strdup_printf(EDIT_SECURITY_MSG, old, strings.security);
|
||||
result = gnc_verify_dialog(s, GNC_T);
|
||||
result = gnc_verify_dialog_parented(GTK_WINDOW(editAccData->dialog),
|
||||
s, GNC_T);
|
||||
g_free(s);
|
||||
|
||||
if (!result)
|
||||
@ -202,7 +270,68 @@ gnc_ui_EditAccWindow_ok_cb(GtkWidget * widget,
|
||||
}
|
||||
}
|
||||
|
||||
xaccAccountBeginEdit(account, 0);
|
||||
/* If the account has children and the new type isn't compatible
|
||||
* with the old type, the children's types must be changed. */
|
||||
change_children = (has_children &&
|
||||
!xaccAccountTypesCompatible(current_type,
|
||||
editAccData->type));
|
||||
|
||||
/* If the new parent's type is not compatible with the new type,
|
||||
* the whole sub-tree containing the account must be re-typed. */
|
||||
if (new_parent != editAccData->top_level_account)
|
||||
{
|
||||
int parent_type;
|
||||
|
||||
parent_type = xaccAccountGetType(new_parent);
|
||||
|
||||
if (!xaccAccountTypesCompatible(parent_type, editAccData->type))
|
||||
change_all = TRUE;
|
||||
else
|
||||
change_all = FALSE;
|
||||
}
|
||||
else
|
||||
change_all = FALSE;
|
||||
|
||||
if (change_children || change_all)
|
||||
{
|
||||
gchar *format_str;
|
||||
gchar *warning_str;
|
||||
gchar *type_str;
|
||||
gboolean result;
|
||||
|
||||
if (change_all)
|
||||
format_str = TYPE_WARN1_MSG;
|
||||
else
|
||||
format_str = TYPE_WARN2_MSG;
|
||||
|
||||
type_str = xaccAccountGetTypeStr(editAccData->type);
|
||||
|
||||
warning_str = g_strdup_printf(format_str, type_str);
|
||||
|
||||
result = gnc_verify_dialog_parented(GTK_WINDOW(editAccData->dialog),
|
||||
warning_str, GNC_T);
|
||||
|
||||
g_free(warning_str);
|
||||
|
||||
if (!result)
|
||||
{
|
||||
gnc_ui_free_field_strings(&strings);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Everything checked out, perform the changes */
|
||||
xaccAccountBeginEdit(account, GNC_F);
|
||||
|
||||
if (xaccAccountGetType(account) != editAccData->type)
|
||||
{
|
||||
/* Just refreshing won't work. */
|
||||
xaccDestroyLedgerDisplay(account);
|
||||
|
||||
xaccAccountSetType(account, editAccData->type);
|
||||
}
|
||||
|
||||
gnc_ui_install_field_strings(account, &strings, FALSE);
|
||||
if (new_parent != editAccData->current_parent)
|
||||
{
|
||||
@ -211,8 +340,27 @@ gnc_ui_EditAccWindow_ok_cb(GtkWidget * widget,
|
||||
else
|
||||
xaccInsertSubAccount(new_parent, account);
|
||||
}
|
||||
|
||||
xaccAccountCommitEdit(account);
|
||||
|
||||
if (change_children)
|
||||
gnc_edit_change_account_types(account, NULL, editAccData->type);
|
||||
|
||||
if (change_all)
|
||||
{
|
||||
Account *ancestor;
|
||||
Account *temp;
|
||||
|
||||
temp = xaccAccountGetParentAccount(account);
|
||||
do
|
||||
{
|
||||
ancestor = temp;
|
||||
temp = xaccAccountGetParentAccount(ancestor);
|
||||
} while (temp != NULL);
|
||||
|
||||
gnc_edit_change_account_types(ancestor, account, editAccData->type);
|
||||
}
|
||||
|
||||
gnc_ui_free_field_strings(&strings);
|
||||
|
||||
gnc_refresh_main_window();
|
||||
@ -221,6 +369,104 @@ gnc_ui_EditAccWindow_ok_cb(GtkWidget * widget,
|
||||
gnome_dialog_close(GNOME_DIALOG(editAccData->dialog));
|
||||
}
|
||||
|
||||
static void
|
||||
gnc_type_select_cb(GtkCList * type_list, gint row, gint column,
|
||||
GdkEventButton * event, gpointer data)
|
||||
{
|
||||
gboolean sensitive;
|
||||
EditAccWindow * editAccData = data;
|
||||
|
||||
if(editAccData == NULL)
|
||||
return;
|
||||
|
||||
if (!gtk_clist_get_selectable(type_list, row))
|
||||
{
|
||||
gtk_clist_unselect_row(type_list, row, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
editAccData->type = row;
|
||||
|
||||
if (!unsafe_ops)
|
||||
return;
|
||||
|
||||
sensitive = (editAccData->type == STOCK ||
|
||||
editAccData->type == MUTUAL ||
|
||||
editAccData->type == CURRENCY);
|
||||
|
||||
gtk_widget_set_sensitive(GTK_WIDGET(editAccData->edit_info.security_entry),
|
||||
sensitive);
|
||||
gtk_widget_set_sensitive(GTK_WIDGET(editAccData->edit_info.source_menu),
|
||||
sensitive);
|
||||
}
|
||||
|
||||
static void
|
||||
gnc_type_unselect_cb(GtkCList * type_list, gint row, gint column,
|
||||
GdkEventButton * event, gpointer data)
|
||||
{
|
||||
EditAccWindow * editAccData = data;
|
||||
|
||||
editAccData->type = BAD_TYPE;
|
||||
|
||||
gtk_widget_set_sensitive(GTK_WIDGET(editAccData->edit_info.security_entry),
|
||||
FALSE);
|
||||
gtk_widget_set_sensitive(GTK_WIDGET(editAccData->edit_info.source_menu),
|
||||
FALSE);
|
||||
}
|
||||
|
||||
static void
|
||||
gnc_fill_type_list(GtkCList *type_list)
|
||||
{
|
||||
gint row;
|
||||
gchar *text[2] = { NULL, NULL };
|
||||
|
||||
gtk_clist_clear(type_list);
|
||||
|
||||
for (row = 0; row < NUM_ACCOUNT_TYPES; row++)
|
||||
{
|
||||
text[0] = xaccAccountGetTypeStr(row);
|
||||
gtk_clist_append(type_list, text);
|
||||
}
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
gnc_account_type_list_create(EditAccWindow * editAccData)
|
||||
{
|
||||
GtkWidget *frame, *scroll_win;
|
||||
|
||||
frame = gtk_frame_new(ACC_TYPE_STR);
|
||||
|
||||
editAccData->type_list = gtk_clist_new(1);
|
||||
gtk_clist_set_selection_mode(GTK_CLIST(editAccData->type_list),
|
||||
GTK_SELECTION_BROWSE);
|
||||
gtk_container_border_width(GTK_CONTAINER(editAccData->type_list), 3);
|
||||
|
||||
gnc_fill_type_list(GTK_CLIST(editAccData->type_list));
|
||||
|
||||
gtk_clist_columns_autosize(GTK_CLIST(editAccData->type_list));
|
||||
|
||||
gtk_signal_connect(GTK_OBJECT(editAccData->type_list), "select-row",
|
||||
GTK_SIGNAL_FUNC(gnc_type_select_cb), editAccData);
|
||||
|
||||
gtk_signal_connect(GTK_OBJECT(editAccData->type_list), "unselect-row",
|
||||
GTK_SIGNAL_FUNC(gnc_type_unselect_cb), editAccData);
|
||||
|
||||
editAccData->type = xaccAccountGetType(editAccData->account);
|
||||
gtk_clist_select_row(GTK_CLIST(editAccData->type_list),
|
||||
editAccData->type, 0);
|
||||
|
||||
scroll_win = gtk_scrolled_window_new(NULL, NULL);
|
||||
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scroll_win),
|
||||
GTK_POLICY_NEVER,
|
||||
GTK_POLICY_AUTOMATIC);
|
||||
|
||||
gtk_container_add(GTK_CONTAINER(frame), scroll_win);
|
||||
gtk_container_border_width(GTK_CONTAINER(scroll_win), 5);
|
||||
gtk_container_add(GTK_CONTAINER(scroll_win), editAccData->type_list);
|
||||
|
||||
return frame;
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
gnc_ui_create_parent_acc_frame(EditAccWindow *editAccData)
|
||||
{
|
||||
@ -262,6 +508,53 @@ gnc_ui_create_parent_acc_frame(EditAccWindow *editAccData)
|
||||
return frame;
|
||||
}
|
||||
|
||||
static char *
|
||||
gnc_edit_make_window_name(Account *account)
|
||||
{
|
||||
char *fullname;
|
||||
char *title;
|
||||
|
||||
fullname = xaccAccountGetFullName(account, gnc_get_account_separator());
|
||||
title = g_strconcat(fullname, " - ", EDIT_ACCT_STR, NULL);
|
||||
|
||||
free(fullname);
|
||||
|
||||
return title;
|
||||
}
|
||||
|
||||
static void
|
||||
gnc_edit_set_window_name(EditAccWindow *editAccData)
|
||||
{
|
||||
char *title;
|
||||
|
||||
title = gnc_edit_make_window_name(editAccData->account);
|
||||
|
||||
gtk_window_set_title(GTK_WINDOW(editAccData->dialog), title);
|
||||
|
||||
g_free(title);
|
||||
}
|
||||
|
||||
|
||||
/********************************************************************\
|
||||
* editAccountRefresh *
|
||||
* refreshes the edit window *
|
||||
* *
|
||||
* Args: account - the account of the window to refresh *
|
||||
* Return: none *
|
||||
\********************************************************************/
|
||||
void
|
||||
editAccountRefresh(Account *account)
|
||||
{
|
||||
EditAccWindow *editAccData;
|
||||
|
||||
FIND_IN_LIST (EditAccWindow, editAccList, account, account, editAccData);
|
||||
if (editAccData == NULL)
|
||||
return;
|
||||
|
||||
gnc_edit_set_window_name(editAccData);
|
||||
}
|
||||
|
||||
|
||||
/********************************************************************\
|
||||
* editAccWindow *
|
||||
* opens up a window to edit an account *
|
||||
@ -270,16 +563,15 @@ gnc_ui_create_parent_acc_frame(EditAccWindow *editAccData)
|
||||
* Return: null *
|
||||
\********************************************************************/
|
||||
EditAccWindow *
|
||||
editAccWindow(Account *acc)
|
||||
editAccWindow(Account *account)
|
||||
{
|
||||
EditAccWindow * editAccData;
|
||||
GtkWidget *vbox, *widget, *dialog;
|
||||
char *name, *title;
|
||||
GtkWidget *vbox, *hbox, *widget, *dialog, *source_menu;
|
||||
char *title;
|
||||
|
||||
FETCH_FROM_LIST (EditAccWindow, editAccList, acc, account, editAccData);
|
||||
FETCH_FROM_LIST (EditAccWindow, editAccList, account, account, editAccData);
|
||||
|
||||
name = xaccAccountGetFullName(acc, gnc_get_account_separator());
|
||||
title = g_strconcat(name, " - ", EDIT_ACCT_STR, NULL);
|
||||
title = gnc_edit_make_window_name(account);
|
||||
|
||||
dialog = gnome_dialog_new(title,
|
||||
GNOME_STOCK_BUTTON_OK,
|
||||
@ -287,11 +579,10 @@ editAccWindow(Account *acc)
|
||||
GNOME_STOCK_BUTTON_HELP,
|
||||
NULL);
|
||||
|
||||
free(name);
|
||||
g_free(title);
|
||||
|
||||
editAccData->dialog = dialog;
|
||||
editAccData->account = acc;
|
||||
editAccData->account = account;
|
||||
|
||||
if (last_width == 0)
|
||||
gnc_get_window_size("account_edit_win", &last_width, &last_height);
|
||||
@ -311,7 +602,7 @@ editAccWindow(Account *acc)
|
||||
|
||||
/* Account field edit box */
|
||||
widget = gnc_ui_account_field_box_create_from_account
|
||||
(acc, &editAccData->edit_info);
|
||||
(account, &editAccData->edit_info);
|
||||
|
||||
gnome_dialog_editable_enters(GNOME_DIALOG(dialog),
|
||||
editAccData->edit_info.name_entry);
|
||||
@ -334,26 +625,31 @@ editAccWindow(Account *acc)
|
||||
|
||||
gtk_box_pack_start(GTK_BOX(vbox), widget, FALSE, FALSE, 0);
|
||||
|
||||
/* Parent Account entry */
|
||||
widget = gnc_ui_create_parent_acc_frame(editAccData);
|
||||
gtk_box_pack_start(GTK_BOX(vbox), widget, TRUE, TRUE, 0);
|
||||
/* Box for types and tree */
|
||||
hbox = gtk_hbox_new (FALSE, 5);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, TRUE, 0);
|
||||
gtk_container_border_width (GTK_CONTAINER (hbox), 5);
|
||||
|
||||
/* source menu */
|
||||
widget = gnc_ui_account_source_box_create_from_account
|
||||
(acc, &editAccData->edit_info);
|
||||
gtk_box_pack_start(GTK_BOX(vbox), widget, FALSE, FALSE, 0);
|
||||
{
|
||||
int type = xaccAccountGetType(acc);
|
||||
if ((type != STOCK) && (type != MUTUAL) && (type != CURRENCY))
|
||||
gtk_widget_hide(widget);
|
||||
}
|
||||
source_menu = gnc_ui_account_source_box_create_from_account
|
||||
(account, &editAccData->edit_info);
|
||||
|
||||
/* List of account types */
|
||||
widget = gnc_account_type_list_create(editAccData);
|
||||
gtk_box_pack_start(GTK_BOX(hbox), widget, FALSE, FALSE, 0);
|
||||
|
||||
/* Parent Account entry */
|
||||
widget = gnc_ui_create_parent_acc_frame(editAccData);
|
||||
gtk_box_pack_start(GTK_BOX(hbox), widget, TRUE, TRUE, 0);
|
||||
|
||||
gtk_box_pack_start(GTK_BOX(vbox), source_menu, FALSE, FALSE, 0);
|
||||
|
||||
{ /* Notes entry */
|
||||
gchar * notes;
|
||||
|
||||
widget = gnc_ui_notes_frame_create(&editAccData->edit_info.notes_entry);
|
||||
gtk_box_pack_start(GTK_BOX(vbox), widget, TRUE, TRUE, 0);
|
||||
notes = xaccAccountGetNotes(acc);
|
||||
notes = xaccAccountGetNotes(account);
|
||||
gtk_text_insert(GTK_TEXT(editAccData->edit_info.notes_entry),
|
||||
NULL, NULL, NULL, notes, -1);
|
||||
}
|
||||
|
@ -196,9 +196,9 @@ gnc_ui_qif_import_select_file_cb(GtkButton * button,
|
||||
QIFImportWindow * wind =
|
||||
gtk_object_get_data(GTK_OBJECT(dialog), "qif_window_struct");
|
||||
|
||||
char * new_file_name;
|
||||
char * new_file_name;
|
||||
|
||||
new_file_name = (char *)fileBox("Select QIF File", "*.qif");
|
||||
new_file_name = fileBox(_("Select QIF File"), "*.qif");
|
||||
|
||||
if(new_file_name) {
|
||||
|
||||
@ -207,7 +207,7 @@ gnc_ui_qif_import_select_file_cb(GtkButton * button,
|
||||
gtk_entry_set_text(GTK_ENTRY(wind->filename_entry),
|
||||
new_file_name);
|
||||
}
|
||||
|
||||
|
||||
/* the account should be auto-determined by default
|
||||
* if the "opening balance" trick doesn't work "auto" will
|
||||
* use the file name as a guess */
|
||||
@ -309,7 +309,7 @@ gnc_ui_qif_import_load_file_cb (GtkButton *button,
|
||||
scm_currency = gh_str02scm(currency);
|
||||
scm_radix = gh_symbol2scm(radix_symbols[radix_format]);
|
||||
scm_date = gh_symbol2scm(date_symbols[date_format]);
|
||||
|
||||
|
||||
if(gtk_toggle_button_get_active
|
||||
(GTK_TOGGLE_BUTTON(wind->acct_auto_button))) {
|
||||
scm_qif_account = gh_symbol2scm("unknown");
|
||||
@ -317,14 +317,14 @@ gnc_ui_qif_import_load_file_cb (GtkButton *button,
|
||||
else {
|
||||
scm_qif_account = gh_str02scm(qif_account);
|
||||
}
|
||||
|
||||
|
||||
imported_files = wind->imported_files;
|
||||
|
||||
if(gh_call2(qif_file_loaded, scm_filename, wind->imported_files)
|
||||
== SCM_BOOL_T) {
|
||||
if(gnc_verify_dialog_parented
|
||||
(GTK_WINDOW(wind->dialog),
|
||||
_("QIF File already loaded. Reload with current settings?"),
|
||||
_("QIF File already loaded. Reload with current settings?"),
|
||||
TRUE)) {
|
||||
imported_files =
|
||||
gh_call2(unload_qif_file, scm_filename, wind->imported_files);
|
||||
@ -333,7 +333,7 @@ gnc_ui_qif_import_load_file_cb (GtkButton *button,
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* turn on the busy cursor */
|
||||
gnc_set_busy_cursor(NULL);
|
||||
|
||||
@ -892,5 +892,3 @@ update_categories_page(QIFImportWindow * wind) {
|
||||
|
||||
gtk_clist_thaw(GTK_CLIST(wind->cat_list));
|
||||
}
|
||||
|
||||
|
||||
|
@ -477,7 +477,7 @@ GtkWidget *
|
||||
gnc_ui_account_field_box_create_from_account(Account * account,
|
||||
AccountEditInfo * info)
|
||||
{
|
||||
GtkWidget * box = gnc_ui_account_field_box_create(info, TRUE);
|
||||
GtkWidget * box = gnc_ui_account_field_box_create(info, FALSE);
|
||||
gboolean sensitive;
|
||||
int accType;
|
||||
|
||||
@ -485,8 +485,6 @@ gnc_ui_account_field_box_create_from_account(Account * account,
|
||||
xaccAccountGetName(account));
|
||||
gtk_entry_set_text(GTK_ENTRY(info->description_entry),
|
||||
xaccAccountGetDescription(account));
|
||||
gtk_entry_set_text(GTK_ENTRY(info->type_entry),
|
||||
xaccAccountGetTypeStr(xaccAccountGetType(account)));
|
||||
gtk_entry_set_text(GTK_ENTRY(info->currency_entry),
|
||||
xaccAccountGetCurrency(account));
|
||||
gtk_entry_set_text(GTK_ENTRY(info->security_entry),
|
||||
|
@ -55,6 +55,29 @@ static AdjBWindow **adjBList = NULL;
|
||||
/* This static indicates the debugging module that this .o belongs to. */
|
||||
static short module = MOD_GUI;
|
||||
|
||||
/** Prototypes ******************************************************/
|
||||
static void gnc_adjb_set_window_name(AdjBWindow *adjBData);
|
||||
|
||||
|
||||
/********************************************************************\
|
||||
* adjBRefresh *
|
||||
* refreshes the adjust balance window *
|
||||
* *
|
||||
* Args: account - the account of the window to refresh *
|
||||
* Return: none *
|
||||
\********************************************************************/
|
||||
void
|
||||
adjBRefresh(Account *account)
|
||||
{
|
||||
AdjBWindow *adjBData;
|
||||
|
||||
FIND_IN_LIST (AdjBWindow, adjBList, account, account, adjBData);
|
||||
if (adjBData == NULL)
|
||||
return;
|
||||
|
||||
gnc_adjb_set_window_name(adjBData);
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
gnc_ui_adjBWindow_close_cb(GnomeDialog *dialog, gpointer user_data)
|
||||
@ -150,6 +173,33 @@ gnc_adjust_update_cb(GtkWidget *widget, GdkEventFocus *event, gpointer data)
|
||||
}
|
||||
|
||||
|
||||
static char *
|
||||
gnc_adjb_make_window_name(Account *account)
|
||||
{
|
||||
char *fullname;
|
||||
char *title;
|
||||
|
||||
fullname = xaccAccountGetFullName(account, gnc_get_account_separator());
|
||||
title = g_strconcat(fullname, " - ", ADJ_BALN_STR, NULL);
|
||||
|
||||
free(fullname);
|
||||
|
||||
return title;
|
||||
}
|
||||
|
||||
static void
|
||||
gnc_adjb_set_window_name(AdjBWindow *adjBData)
|
||||
{
|
||||
char *title;
|
||||
|
||||
title = gnc_adjb_make_window_name(adjBData->account);
|
||||
|
||||
gtk_window_set_title(GTK_WINDOW(adjBData->dialog), title);
|
||||
|
||||
g_free(title);
|
||||
}
|
||||
|
||||
|
||||
/********************************************************************\
|
||||
* adjBWindow *
|
||||
* opens up the window to adjust the balance *
|
||||
@ -162,19 +212,17 @@ adjBWindow(Account *account)
|
||||
{
|
||||
GtkWidget *dialog, *frame, *vbox;
|
||||
AdjBWindow *adjBData;
|
||||
gchar *title, *name;
|
||||
gchar *title;
|
||||
|
||||
FETCH_FROM_LIST(AdjBWindow, adjBList, account, account, adjBData);
|
||||
|
||||
name = xaccAccountGetFullName(account, gnc_get_account_separator());
|
||||
title = g_strconcat(name, " - ", ADJ_BALN_STR, NULL);
|
||||
title = gnc_adjb_make_window_name(account);
|
||||
|
||||
dialog = gnome_dialog_new(title,
|
||||
GNOME_STOCK_BUTTON_OK,
|
||||
GNOME_STOCK_BUTTON_CANCEL,
|
||||
NULL);
|
||||
|
||||
free(name);
|
||||
g_free(title);
|
||||
|
||||
adjBData->account = account;
|
||||
|
@ -26,23 +26,8 @@
|
||||
#ifndef __WINDOW_RECONCILE_H__
|
||||
#define __WINDOW_RECONCILE_H__
|
||||
|
||||
|
||||
/** GLOBALS *********************************************************/
|
||||
|
||||
/** STRUCTS *********************************************************/
|
||||
typedef struct _RecnWindow RecnWindow;
|
||||
|
||||
/** PROTOTYPES ******************************************************/
|
||||
void recnRefresh(Account *account);
|
||||
RecnWindow *recnWindow(GtkWidget *parent, Account *account);
|
||||
#include "RecnWindow.h"
|
||||
|
||||
void gnc_ui_reconcile_window_raise(RecnWindow * recnData);
|
||||
|
||||
/*
|
||||
* The xaccDestroyRecnWindow() subroutine can be called from
|
||||
* anywhere to shut down the Register window. Used primarily when
|
||||
* destroying the underlying account.
|
||||
*/
|
||||
void xaccDestroyRecnWindow(Account *);
|
||||
|
||||
#endif
|
||||
|
@ -223,15 +223,14 @@ gnc_report_error_dialog(const char *message)
|
||||
static char *
|
||||
gnc_run_report(ReportData *report_data)
|
||||
{
|
||||
SCM result, nil;
|
||||
SCM result;
|
||||
|
||||
if (!gh_procedure_p(report_data->rendering_thunk))
|
||||
return NULL;
|
||||
|
||||
gnc_set_busy_cursor(NULL);
|
||||
|
||||
nil = gh_eval_str("()");
|
||||
result = gfec_apply(report_data->rendering_thunk, nil,
|
||||
result = gfec_apply(report_data->rendering_thunk, SCM_EOL,
|
||||
gnc_report_error_dialog);
|
||||
|
||||
gnc_unset_busy_cursor(NULL);
|
||||
|
@ -1,14 +1,3 @@
|
||||
/*
|
||||
* FILE:
|
||||
* quickfillcell.c
|
||||
*
|
||||
* FUNCTION:
|
||||
* Implements a text cell with automatic typed-phrase
|
||||
* completion.
|
||||
*
|
||||
* HISTORY:
|
||||
* Copyright (c) 1998 Linas Vepstas
|
||||
*/
|
||||
/********************************************************************\
|
||||
* This program is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU General Public License as *
|
||||
@ -25,6 +14,18 @@
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
|
||||
\********************************************************************/
|
||||
|
||||
/*
|
||||
* FILE:
|
||||
* quickfillcell.c
|
||||
*
|
||||
* FUNCTION:
|
||||
* Implements a text cell with automatic typed-phrase
|
||||
* completion.
|
||||
*
|
||||
* HISTORY:
|
||||
* Copyright (c) 1998-2000 Linas Vepstas
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
@ -80,7 +81,6 @@ quick_modify (BasicCell *_cell,
|
||||
int *start_selection,
|
||||
int *end_selection)
|
||||
{
|
||||
#ifndef MOTIF
|
||||
QuickFillCell *cell = (QuickFillCell *) _cell;
|
||||
const char *retval;
|
||||
QuickFill *match;
|
||||
@ -115,106 +115,6 @@ quick_modify (BasicCell *_cell,
|
||||
|
||||
SET (&(cell->cell), retval);
|
||||
return retval;
|
||||
#endif
|
||||
|
||||
#ifdef MOTIF
|
||||
/* The modifications to fix up completion cursor positioning and
|
||||
* stale match handling below are somewhat tortured. I suspect we
|
||||
* can do better, but this works for now... */
|
||||
|
||||
QuickFillCell *cell = (QuickFillCell *) _cell;
|
||||
QuickFill *initial_match_point = cell->qf;
|
||||
const char * retval = newval;
|
||||
|
||||
/* if user typed the very first letter into this
|
||||
* cell, then make sure that the quick-fill is set to
|
||||
* the root. Alternately, if user erased all of the
|
||||
* text in the cell, and has just started typing,
|
||||
* then make sure that the quick-fill root is also reset */
|
||||
if (newval) {
|
||||
if (change && (0x0 != newval[0]) && (0x0 == newval[1])) {
|
||||
/* the first char is being inserted */
|
||||
cell->qf = cell->qfRoot;
|
||||
} else if('\0' == newval[0]) {
|
||||
/* the last char is being deleted */
|
||||
cell->qf = cell->qfRoot;
|
||||
}
|
||||
}
|
||||
|
||||
/* if change is null, then user is deleting text;
|
||||
* otherwise, they are inserting text. */
|
||||
if (change) {
|
||||
int i;
|
||||
char c;
|
||||
int previous_match_len = 0;
|
||||
|
||||
/* search for best-matching quick-fill string */
|
||||
i=0;
|
||||
c = change[i];
|
||||
while (c && cell->qf) {
|
||||
cell->qf = xaccGetQuickFill (cell->qf, c);
|
||||
i++;
|
||||
c = change[i];
|
||||
}
|
||||
|
||||
/* Figure out how long the previous match was. This allows us
|
||||
* to position the cursor incrementally, or DTRT when the user
|
||||
* diverges from a quickfill match. */
|
||||
{
|
||||
QuickFill *qcursor = cell->qfRoot;
|
||||
while(qcursor && (qcursor != initial_match_point)) {
|
||||
qcursor = xaccGetQuickFill (qcursor, oldval[previous_match_len++]);
|
||||
}
|
||||
}
|
||||
|
||||
if (cell->qf) {
|
||||
/* we have a match, return it and reposition the cursor */
|
||||
*cursor_position = previous_match_len + strlen(change);
|
||||
retval = strdup (cell->qf->text);
|
||||
} else {
|
||||
/* do some research to figure out if the failure is because
|
||||
* the current change just diverged from a match, in which
|
||||
* case we should return everything that matched before this
|
||||
* insertion plus the new change, or because the oldval hasn't
|
||||
* matched for a while (i.e. we're no longer quickfilling), in
|
||||
* which case we should just return the suggested newval. */
|
||||
|
||||
int oldval_match_len = 0;
|
||||
|
||||
/* find out how much of oldval is a quickfill entry. */
|
||||
{
|
||||
QuickFill *qcursor = cell->qfRoot;
|
||||
while(qcursor) {
|
||||
qcursor = xaccGetQuickFill (qcursor, oldval[oldval_match_len]);
|
||||
oldval_match_len++;
|
||||
}
|
||||
oldval_match_len--;
|
||||
}
|
||||
|
||||
if(oldval_match_len == strlen(oldval)) {
|
||||
/* If oldval was quick-fill match in its entirety, then the
|
||||
* current "change" is the first divergence. Accordingly,
|
||||
* we need to remove any "post-divergence", stale quickfill
|
||||
* bits that reside after the cursor and then append the new
|
||||
* change text. */
|
||||
|
||||
char *unmatched =
|
||||
(char *) malloc(previous_match_len + strlen(change) + 1);
|
||||
|
||||
strncpy(unmatched, oldval, previous_match_len);
|
||||
unmatched[previous_match_len] = '\0';
|
||||
strcat(unmatched, change);
|
||||
*cursor_position = strlen(unmatched);
|
||||
|
||||
retval = unmatched;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SET (&(cell->cell), retval);
|
||||
return retval;
|
||||
#endif
|
||||
}
|
||||
|
||||
/* ================================================ */
|
||||
|
@ -82,6 +82,12 @@
|
||||
(define (html-cell-header-right item)
|
||||
(html-generic-cell #t #t #f item))
|
||||
|
||||
(define (html-para text)
|
||||
(string-append "<P>" text "</P>\n"))
|
||||
|
||||
(define (html-cell-attributes value attributes)
|
||||
(string-append "<TD " attributes ">" value "</TD>"))
|
||||
|
||||
(define (html-start-document)
|
||||
(list
|
||||
"<HTML>"
|
||||
|
@ -88,11 +88,7 @@
|
||||
|
||||
;; add a hook to save the user configs on shutdown
|
||||
(gnc:hook-add-dangler gnc:*shutdown-hook* gnc:save-global-options)
|
||||
|
||||
(gnc:hook-add-dangler gnc:*ui-shutdown-hook* gnc:ui-finish)
|
||||
|
||||
(gnc:ui-main)
|
||||
|
||||
(gnc:hook-remove-dangler gnc:*ui-shutdown-hook* gnc:ui-finish)
|
||||
|
||||
(gnc:shutdown 0))
|
||||
|
@ -21,7 +21,6 @@
|
||||
(qif-acct:set-description! (list-ref old-map 5) new-descript))
|
||||
(#t
|
||||
(list-set! old-map 5 new-descript)))))
|
||||
|
||||
|
||||
;; the account-display is a 3-columned list of accounts in the QIF
|
||||
;; import dialog (the "Account" page of the notebook). Column 1 is
|
||||
@ -32,7 +31,7 @@
|
||||
(define (qif-dialog:make-account-display qif-files gnc-acct-info)
|
||||
(let ((acct-hash (make-hash-table 20))
|
||||
(retval '()))
|
||||
|
||||
|
||||
;; we want to make two passes here. The first pass picks the
|
||||
;; explicit Account descriptions and implicit "this" description
|
||||
;; out of each file. These are the best sources of info because
|
||||
@ -41,7 +40,7 @@
|
||||
;; the transactions. Hopefully we'll have most of the accounts
|
||||
;; already located by that point. Otherwise, we have to guess
|
||||
;; them.
|
||||
|
||||
|
||||
;; guess-acct returns a list that's
|
||||
;; (qif-name gnc-name gnc-type new-acct?)
|
||||
;; acct-hash hashes QIF account name to a list that's composed of
|
||||
@ -61,7 +60,7 @@
|
||||
gnc-acct-info)
|
||||
(list 0 acct)))))
|
||||
(qif-file:accounts file))
|
||||
|
||||
|
||||
;; then make an implicit account entry for the file
|
||||
(if (and (qif-file:account file)
|
||||
(qif-file:account-type file))
|
||||
@ -85,7 +84,7 @@
|
||||
(length (qif-file:xtns file))
|
||||
#f)))))))
|
||||
qif-files)
|
||||
|
||||
|
||||
;; now make the second pass through the files, looking at the
|
||||
;; transactions. Hopefully the accounts are all there already.
|
||||
;; stock accounts can have both a category/account and another
|
||||
@ -262,3 +261,4 @@
|
||||
#f
|
||||
file))
|
||||
list-of-files)))
|
||||
|
||||
|
@ -6,13 +6,11 @@
|
||||
;;; $Id$
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(gnc:support "qif-file.scm")
|
||||
(gnc:depend "qif-objects.scm")
|
||||
(gnc:depend "qif-parse.scm")
|
||||
(gnc:depend "qif-utils.scm")
|
||||
|
||||
(gnc:support "qif-file.scm")
|
||||
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; qif-file:read-file self path
|
||||
;; suck in all the transactions; if necessary, determine [guess]
|
||||
@ -29,7 +27,10 @@
|
||||
(line #f)
|
||||
(tag #f)
|
||||
(value #f)
|
||||
(heinous-error #f))
|
||||
(heinous-error #f)
|
||||
(valid-acct-types '(type:bank type:cash
|
||||
type:ccard type:invst
|
||||
#{type:oth\ a}# #{type:oth\ l}#)))
|
||||
(with-input-from-file path
|
||||
(lambda ()
|
||||
;; loop over lines
|
||||
@ -48,15 +49,9 @@
|
||||
;; the type switcher.
|
||||
((eq? tag #\!)
|
||||
(set! qstate-type (qif-file:parse-bang-field self value))
|
||||
(cond ((or (eq? qstate-type 'type:bank)
|
||||
(eq? qstate-type 'type:cash)
|
||||
(eq? qstate-type 'type:ccard)
|
||||
(eq? qstate-type 'type:invst)
|
||||
(eq? qstate-type '#{type:oth\ a}#)
|
||||
(eq? qstate-type '#{type:oth\ l}#))
|
||||
|
||||
(set! current-xtn (make-qif-xtn))
|
||||
(set! default-split (make-qif-split))
|
||||
(cond ((member qstate-type valid-acct-types)
|
||||
(set! current-xtn (make-qif-xtn))
|
||||
(set! default-split (make-qif-split))
|
||||
(qif-split:set-category! default-split "")
|
||||
(qif-file:set-account-type!
|
||||
self (qif-file:state-to-account-type
|
||||
@ -78,25 +73,20 @@
|
||||
;; account transactions
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
((or (eq? qstate-type 'type:bank)
|
||||
(eq? qstate-type 'type:cash)
|
||||
(eq? qstate-type 'type:ccard)
|
||||
(eq? qstate-type 'type:invst)
|
||||
(eq? qstate-type '#{type:oth\ a}#)
|
||||
(eq? qstate-type '#{type:oth\ l}#))
|
||||
(cond
|
||||
((member qstate-type valid-acct-types)
|
||||
(case tag
|
||||
;; D : transaction date
|
||||
((eq? tag #\D)
|
||||
((#\D)
|
||||
(qif-xtn:set-date! current-xtn
|
||||
(qif-file:parse-date self value)))
|
||||
|
||||
;; T : total amount
|
||||
((eq? tag #\T)
|
||||
((#\T)
|
||||
(qif-split:set-amount! default-split
|
||||
(qif-file:parse-value self value)))
|
||||
|
||||
;; P : payee
|
||||
((eq? tag #\P)
|
||||
((#\P)
|
||||
(qif-xtn:set-payee! current-xtn
|
||||
(qif-file:parse-string self value)))
|
||||
|
||||
@ -104,7 +94,7 @@
|
||||
;; multiple "A" lines are appended together with
|
||||
;; newlines; some Quicken files have a lot of
|
||||
;; A lines.
|
||||
((eq? tag #\A)
|
||||
((#\A)
|
||||
(qif-xtn:set-address!
|
||||
current-xtn
|
||||
(let ((current (qif-xtn:address current-xtn)))
|
||||
@ -117,48 +107,48 @@
|
||||
;; N : check number / transaction number /xtn direction
|
||||
;; this could be a number or a string; no point in
|
||||
;; keeping it numeric just yet.
|
||||
((eq? tag #\N)
|
||||
((#\N)
|
||||
(qif-xtn:set-number!
|
||||
current-xtn (qif-file:parse-string self value)))
|
||||
|
||||
;; C : cleared flag
|
||||
((eq? tag #\C)
|
||||
((#\C)
|
||||
(qif-xtn:set-cleared!
|
||||
current-xtn (qif-file:parse-cleared-field self value)))
|
||||
|
||||
;; M : memo
|
||||
((eq? tag #\M)
|
||||
((#\M)
|
||||
(qif-split:set-memo! default-split
|
||||
(qif-file:parse-string self value)))
|
||||
|
||||
;; I : share price (stock transactions)
|
||||
((eq? tag #\I)
|
||||
((#\I)
|
||||
(qif-xtn:set-share-price!
|
||||
current-xtn (qif-file:parse-value self value)))
|
||||
|
||||
;; Q : share price (stock transactions)
|
||||
((eq? tag #\Q)
|
||||
((#\Q)
|
||||
(qif-xtn:set-num-shares!
|
||||
current-xtn (qif-file:parse-value self value))
|
||||
(qif-xtn:set-bank-xtn?! current-xtn #f))
|
||||
|
||||
;; Y : name of security (stock transactions)
|
||||
((eq? tag #\Y)
|
||||
((#\Y)
|
||||
(qif-xtn:set-security-name!
|
||||
current-xtn (qif-file:parse-string self value)))
|
||||
|
||||
;; O : adjustment (stock transactions)
|
||||
((eq? tag #\O)
|
||||
((#\O)
|
||||
(qif-xtn:set-adjustment!
|
||||
current-xtn (qif-file:parse-value self value)))
|
||||
|
||||
;; L : category
|
||||
((eq? tag #\L)
|
||||
((#\L)
|
||||
(qif-split:set-category!
|
||||
default-split (qif-file:parse-string self value)))
|
||||
|
||||
;; S : split category
|
||||
((eq? tag #\S)
|
||||
((#\S)
|
||||
(set! current-split (make-qif-split))
|
||||
(qif-split:set-category!
|
||||
current-split (qif-file:parse-string self value))
|
||||
@ -167,20 +157,19 @@
|
||||
(cons current-split (qif-xtn:splits current-xtn))))
|
||||
|
||||
;; E : split memo (?)
|
||||
((eq? tag #\E)
|
||||
((#\E)
|
||||
(qif-split:set-memo!
|
||||
current-split (qif-file:parse-string self value)))
|
||||
|
||||
;; $ : split amount (if there are splits)
|
||||
((eq? tag #\$)
|
||||
((#\$)
|
||||
;; if this is 'Type:Invst, I can't figure out
|
||||
;; what the $ signifies. I'll do it later.
|
||||
(if (eq? qstate-type 'type:bank)
|
||||
(if (not (eq? qstate-type 'type:invst))
|
||||
(qif-split:set-amount!
|
||||
current-split (qif-file:parse-value self value))))
|
||||
|
||||
;; ^ : end-of-record
|
||||
((eq? tag #\^)
|
||||
((#\^)
|
||||
(if (and (qif-xtn:date current-xtn)
|
||||
(qif-split:amount default-split))
|
||||
(begin
|
||||
@ -253,32 +242,33 @@
|
||||
(set! current-xtn (make-qif-xtn))
|
||||
(set! default-split (make-qif-split)))
|
||||
|
||||
(#t
|
||||
(else
|
||||
(display "qif-file:read-file : unknown Bank slot ")
|
||||
(display tag) (newline))))
|
||||
(display tag)
|
||||
(newline))))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; Class transactions
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
((eq? qstate-type 'type:class)
|
||||
(cond
|
||||
(case tag
|
||||
;; N : name
|
||||
((eq? tag #\N)
|
||||
((#\N)
|
||||
(qif-class:set-name! current-xtn
|
||||
(qif-file:parse-string self value)))
|
||||
|
||||
;; D : description
|
||||
((eq? tag #\D)
|
||||
((#\D)
|
||||
(qif-class:set-description!
|
||||
current-xtn (qif-file:parse-string self value)))
|
||||
|
||||
;; end-of-record
|
||||
((eq? tag #\^)
|
||||
((#\^)
|
||||
(qif-file:add-class! self current-xtn)
|
||||
; (qif-class:print current-xtn)
|
||||
(set! current-xtn (make-qif-class)))
|
||||
|
||||
(#t
|
||||
(else
|
||||
(display "qif-file:read-file : unknown Class slot ")
|
||||
(display tag) (newline))))
|
||||
|
||||
@ -286,78 +276,77 @@
|
||||
;; Account definitions
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
((eq? qstate-type 'account)
|
||||
(cond
|
||||
((eq? tag #\N)
|
||||
(case tag
|
||||
((#\N)
|
||||
(qif-acct:set-name! current-xtn
|
||||
(qif-file:parse-string self value)))
|
||||
((eq? tag #\D)
|
||||
((#\D)
|
||||
(qif-acct:set-description!
|
||||
current-xtn (qif-file:parse-string self value)))
|
||||
|
||||
((eq? tag #\T)
|
||||
((#\T)
|
||||
(qif-acct:set-type!
|
||||
current-xtn (qif-file:parse-acct-type self value)))
|
||||
|
||||
((eq? tag #\L)
|
||||
((#\L)
|
||||
(qif-acct:set-limit!
|
||||
current-xtn (qif-file:parse-value self value)))
|
||||
|
||||
((eq? tag #\^)
|
||||
((#\^)
|
||||
(qif-file:add-account! self current-xtn)
|
||||
; (qif-acct:print current-xtn)
|
||||
(set! current-xtn (make-qif-acct)))
|
||||
|
||||
(#t
|
||||
(else
|
||||
(display "qif-file:read-file : unknown Account slot ")
|
||||
(display tag) (newline))))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; Category (Cat) transactions
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
((eq? qstate-type 'type:cat)
|
||||
(cond
|
||||
(case tag
|
||||
;; N : category name
|
||||
((eq? tag #\N)
|
||||
((#\N)
|
||||
(qif-cat:set-name! current-xtn
|
||||
(qif-file:parse-string self value)))
|
||||
|
||||
;; D : category description
|
||||
((eq? tag #\D)
|
||||
((#\D)
|
||||
(qif-cat:set-description! current-xtn
|
||||
(qif-file:parse-string
|
||||
(qif-file:parse-string
|
||||
self value)))
|
||||
|
||||
;; E : is this a taxable category?
|
||||
((eq? tag #\T)
|
||||
((#\T)
|
||||
(qif-cat:set-taxable! current-xtn #t))
|
||||
|
||||
;; E : is this an expense category?
|
||||
((eq? tag #\E)
|
||||
((#\E)
|
||||
(qif-cat:set-expense-cat! current-xtn #t))
|
||||
|
||||
;; I : is this an income category?
|
||||
((eq? tag #\I)
|
||||
((#\I)
|
||||
(qif-cat:set-income-cat! current-xtn #t))
|
||||
|
||||
;; R : what is the tax rate (from some table?
|
||||
;; seems to be an integer)
|
||||
((eq? tag #\R)
|
||||
((#\R)
|
||||
(qif-cat:set-tax-rate!
|
||||
current-xtn (qif-file:parse-value self value)))
|
||||
|
||||
;; B : budget amount. not really supported.
|
||||
((eq? tag #\B)
|
||||
((#\B)
|
||||
(qif-cat:set-budget-amt!
|
||||
current-xtn (qif-file:parse-value self value)))
|
||||
|
||||
;; end-of-record
|
||||
((eq? tag #\^)
|
||||
((#\^)
|
||||
(qif-file:add-cat! self current-xtn)
|
||||
; (qif-cat:print current-xtn)
|
||||
(set! current-xtn (make-qif-cat)))
|
||||
|
||||
(#t
|
||||
(else
|
||||
(display "qif-file:read-file : unknown Cat slot ")
|
||||
(display tag) (newline))))
|
||||
|
||||
@ -426,9 +415,3 @@
|
||||
(display "There was a heinous error. Failed to read file.")
|
||||
(newline)
|
||||
#f))))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -6,6 +6,7 @@
|
||||
;;; $Id$
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(gnc:support "qif-import.scm")
|
||||
(gnc:depend "simple-obj.scm")
|
||||
(gnc:depend "qif-objects.scm") ;; class definitions
|
||||
(gnc:depend "qif-parse.scm") ;; string-to-value, date parsing
|
||||
@ -14,6 +15,3 @@
|
||||
(gnc:depend "qif-dialog-utils.scm") ;; build displays for dialog
|
||||
(gnc:depend "qif-guess-map.scm") ;; build QIF->gnc acct mappings
|
||||
(gnc:depend "qif-to-gnc.scm") ;; conv QIF xtns/acct to GNC xtns/acct
|
||||
|
||||
(gnc:support "qif-import.scm")
|
||||
|
||||
|
@ -6,9 +6,8 @@
|
||||
;;; $Id$
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(gnc:depend "simple-obj.scm")
|
||||
|
||||
(gnc:support "qif-objects.scm")
|
||||
(gnc:depend "simple-obj.scm")
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; qif-file class
|
||||
|
@ -208,7 +208,7 @@
|
||||
(set! numeric-date-parts
|
||||
(map (lambda (elt)
|
||||
(with-input-from-string elt
|
||||
(lambda () (read))))
|
||||
(lambda () (read))))
|
||||
date-parts))
|
||||
|
||||
(cond
|
||||
@ -472,4 +472,3 @@
|
||||
;; later.
|
||||
(#t
|
||||
value-string))))
|
||||
|
||||
|
@ -9,7 +9,6 @@
|
||||
|
||||
(gnc:support "qif-to-gnc.scm")
|
||||
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; find-or-make-acct:
|
||||
;; given a colon-separated account path, return an Account* to
|
||||
@ -231,9 +230,7 @@
|
||||
;; now take the new account tree and merge it in with the
|
||||
;; existing gnucash account tree.
|
||||
(gnc:merge-accounts account-group)
|
||||
(gnc:refresh-main-window)
|
||||
))
|
||||
|
||||
(gnc:refresh-main-window)))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; qif-import:qif-xtn-to-gnc-xtn
|
||||
@ -260,21 +257,13 @@
|
||||
|
||||
;; find the GNC account for the near end of the transaction
|
||||
;; (all splits have the same near end)
|
||||
(if (qif-xtn:bank-xtn? qif-xtn)
|
||||
(begin
|
||||
(set! near-acct-info
|
||||
(hash-ref qif-acct-map
|
||||
(qif-file:account qif-file)))
|
||||
(set! near-acct-name
|
||||
(list-ref near-acct-info 1))
|
||||
(set! near-acct (hash-ref gnc-acct-hash near-acct-name)))
|
||||
(begin
|
||||
(set! near-acct-info
|
||||
(hash-ref qif-acct-map
|
||||
(qif-xtn:security-name qif-xtn)))
|
||||
(set! near-acct-name
|
||||
(list-ref near-acct-info 1))
|
||||
(set! near-acct (hash-ref gnc-acct-hash near-acct-name))))
|
||||
(set! near-acct-info
|
||||
(hash-ref qif-acct-map
|
||||
(if (qif-xtn:bank-xtn? qif-xtn)
|
||||
(qif-file:account qif-file)
|
||||
(qif-xtn:security-name qif-xtn))))
|
||||
(set! near-acct-name (list-ref near-acct-info 1))
|
||||
(set! near-acct (hash-ref gnc-acct-hash near-acct-name))
|
||||
|
||||
;; iterate over QIF splits
|
||||
(for-each
|
||||
@ -284,22 +273,28 @@
|
||||
(far-acct-info #f)
|
||||
(far-acct-name #f)
|
||||
(far-acct-type #f)
|
||||
(far-acct #f))
|
||||
(far-acct #f)
|
||||
(split-amt (qif-split:amount qif-split))
|
||||
(currency (qif-file:currency qif-file))
|
||||
(memo (qif-split:memo qif-split)))
|
||||
|
||||
;; fill the splits in (near first). This handles files in
|
||||
;; multiple currencies by pulling the currency value from the
|
||||
;; file import.
|
||||
(gnc:split-set-base-value gnc-near-split
|
||||
(qif-split:amount qif-split)
|
||||
(qif-file:currency qif-file))
|
||||
(gnc:split-set-base-value gnc-far-split
|
||||
(- (qif-split:amount qif-split))
|
||||
(qif-file:currency qif-file))
|
||||
(if split-amt
|
||||
(begin
|
||||
(gnc:split-set-base-value gnc-near-split
|
||||
split-amt
|
||||
currency)
|
||||
(gnc:split-set-base-value gnc-far-split
|
||||
(- split-amt)
|
||||
currency))
|
||||
(error "No amount in split!" qif-split "txn:" qif-xtn))
|
||||
|
||||
(if (qif-split:memo qif-split)
|
||||
(if memo
|
||||
(begin
|
||||
(gnc:split-set-memo gnc-near-split (qif-split:memo qif-split))
|
||||
(gnc:split-set-memo gnc-far-split (qif-split:memo qif-split))))
|
||||
(gnc:split-set-memo gnc-near-split memo)
|
||||
(gnc:split-set-memo gnc-far-split memo)))
|
||||
|
||||
;; my guess is that you can't have Quicken splits
|
||||
;; on stock transactions. This will break if you can.
|
||||
@ -309,25 +304,22 @@
|
||||
(begin
|
||||
(display "qif-import:qif-xtn-to-gnc-xtn : ")
|
||||
(display "splits in stock transaction!") (newline)))
|
||||
(gnc:split-set-share-price gnc-near-split
|
||||
(qif-xtn:share-price qif-xtn))
|
||||
(gnc:split-set-share-price gnc-far-split
|
||||
(qif-xtn:share-price qif-xtn)))
|
||||
(begin
|
||||
(let ((price (qif-xtn:share-price qif-xtn)))
|
||||
(gnc:split-set-share-price gnc-near-split price)
|
||||
(gnc:split-set-share-price gnc-far-split price)))
|
||||
(begin
|
||||
(gnc:split-set-share-price gnc-near-split 1.0)
|
||||
(gnc:split-set-share-price gnc-far-split 1.0)))
|
||||
|
||||
(if (qif-xtn:num-shares qif-xtn)
|
||||
(begin
|
||||
(let ((numshares (qif-xtn:num-shares qif-xtn)))
|
||||
(if (> (length splits) 1)
|
||||
(begin
|
||||
(display "qif-import:qif-xtn-to-gnc-xtn : ")
|
||||
(display "splits in stock transaction!") (newline)))
|
||||
|
||||
(gnc:split-set-share-amount gnc-near-split
|
||||
(qif-xtn:num-shares qif-xtn))
|
||||
(gnc:split-set-share-amount gnc-far-split
|
||||
(- (qif-xtn:num-shares qif-xtn)))))
|
||||
(gnc:split-set-share-amount gnc-near-split numshares)
|
||||
(gnc:split-set-share-amount gnc-far-split (- numshares))))
|
||||
|
||||
;; find the GNC account on the far end of the split
|
||||
(cond
|
||||
@ -426,7 +418,7 @@
|
||||
(car splits) (car xtns)
|
||||
near-acct-name date amount memo)
|
||||
(begin
|
||||
;; (display "found ")(write (car splits))(newline)
|
||||
;;; (display "found ")(write (car splits))(newline)
|
||||
(qif-split:set-mark! (car splits) #t)
|
||||
(set! done #t)
|
||||
(let ((all-marked #t))
|
||||
@ -474,6 +466,3 @@
|
||||
;; is the memo the same? (is this true?)
|
||||
;; ignore it for now
|
||||
))
|
||||
|
||||
|
||||
|
||||
|
@ -62,4 +62,3 @@
|
||||
(loop first-char))
|
||||
(set! parts (cons (substring str 0 last-char) parts))))
|
||||
parts))
|
||||
|
||||
|
@ -2,9 +2,20 @@
|
||||
;;; Reporting utilities
|
||||
(gnc:support "report-utilities.scm")
|
||||
|
||||
(define (gnc:amount->string amount print_currency_symbol?
|
||||
print_separators? shares_value?)
|
||||
(gnc:amount->string-helper (exact->inexact amount)
|
||||
print_currency_symbol?
|
||||
print_separators?
|
||||
shares_value?))
|
||||
|
||||
(define (gnc:amount->formatted-string amount shares_value?)
|
||||
(gnc:amount->string amount #t #t shares_value?))
|
||||
|
||||
(define (gnc:account-has-shares? account)
|
||||
(let ((type (gnc:account-type->symbol (gnc:account-get-type account))))
|
||||
(member type '(STOCK MUTUAL CURRENCY))))
|
||||
|
||||
(define (gnc:account-separator-char)
|
||||
(let ((option (gnc:lookup-option gnc:*options-entries*
|
||||
"General" "Account Separator")))
|
||||
@ -142,7 +153,8 @@
|
||||
('average (getaverage))
|
||||
('getmax (getmax))
|
||||
('getmin (getmin))
|
||||
('reset (reset-all)))))))
|
||||
('reset (reset-all))
|
||||
(else (gnc:warn "bad stats-collector action: " action)))))))
|
||||
|
||||
(define (makedrcr-collector)
|
||||
(let ;;; values
|
||||
@ -170,7 +182,8 @@
|
||||
('debits (getdebits))
|
||||
('credits (getcredits))
|
||||
('items (getitems))
|
||||
('reset (reset-all)))))))
|
||||
('reset (reset-all))
|
||||
(else (gnc:warn "bad dr-cr-collector action: " action)))))))
|
||||
|
||||
;; Add x to list lst if it is not already in there
|
||||
(define (addunique lst x)
|
||||
@ -186,119 +199,15 @@
|
||||
(thunk (gnc:account-get-split account x)))
|
||||
0 (gnc:account-get-split-count account) 1))
|
||||
|
||||
;; register a configuration option for the transaction report
|
||||
(define (trep-options-generator)
|
||||
(define gnc:*transaction-report-options* (gnc:new-options))
|
||||
(define (gnc:register-trep-option new-option)
|
||||
(gnc:register-option gnc:*transaction-report-options* new-option))
|
||||
;; from date
|
||||
;; hack alert - could somebody set this to an appropriate date?
|
||||
(gnc:register-trep-option
|
||||
(gnc:make-date-option
|
||||
"Report Options" "From"
|
||||
"a" "Report Items from this date"
|
||||
(lambda ()
|
||||
(let ((bdtime (localtime (current-time))))
|
||||
(set-tm:sec bdtime 0)
|
||||
(set-tm:min bdtime 0)
|
||||
(set-tm:hour bdtime 0)
|
||||
(set-tm:mday bdtime 1)
|
||||
(set-tm:mon bdtime 0)
|
||||
(let ((time (car (mktime bdtime))))
|
||||
(cons time 0))))
|
||||
#f))
|
||||
;; to-date
|
||||
(gnc:register-trep-option
|
||||
(gnc:make-date-option
|
||||
"Report Options" "To"
|
||||
"b" "Report items up to and including this date"
|
||||
(lambda () (cons (current-time) 0))
|
||||
#f))
|
||||
|
||||
;; account to do report on
|
||||
(gnc:register-trep-option
|
||||
(gnc:make-account-list-option
|
||||
"Report Options" "Account"
|
||||
"c" "Do transaction report on this account"
|
||||
(lambda ()
|
||||
(let ((current-accounts (gnc:get-current-accounts))
|
||||
(num-accounts (gnc:group-get-num-accounts (gnc:get-current-group)))
|
||||
(first-account (gnc:group-get-account (gnc:get-current-group) 0)))
|
||||
(cond ((not (null? current-accounts)) (list (car current-accounts)))
|
||||
((> num-accounts 0) (list first-account))
|
||||
(else ()))))
|
||||
#f #f))
|
||||
|
||||
;; primary sorting criterion
|
||||
(gnc:register-trep-option
|
||||
(gnc:make-multichoice-option
|
||||
"Sorting" "Primary Key"
|
||||
"a" "Sort by this criterion first"
|
||||
'date
|
||||
(list #(date
|
||||
"Date"
|
||||
"Sort by date")
|
||||
#(time
|
||||
"Time"
|
||||
"Sort by EXACT entry time")
|
||||
#(corresponding-acc
|
||||
"Transfer from/to"
|
||||
"Sort by account transferred from/to's name")
|
||||
#(amount
|
||||
"Amount"
|
||||
"Sort by amount")
|
||||
#(description
|
||||
"Description"
|
||||
"Sort by description")
|
||||
#(number
|
||||
"Number"
|
||||
"Sort by check/transaction number")
|
||||
#(memo
|
||||
"Memo"
|
||||
"Sort by memo"))))
|
||||
|
||||
(gnc:register-trep-option
|
||||
(gnc:make-multichoice-option
|
||||
"Sorting" "Primary Sort Order"
|
||||
"b" "Order of primary sorting"
|
||||
'ascend
|
||||
(list #(ascend "Ascending" "smallest to largest, earliest to latest")
|
||||
#(descend "Descending" "largest to smallest, latest to earliest"))))
|
||||
|
||||
(gnc:register-trep-option
|
||||
(gnc:make-multichoice-option
|
||||
"Sorting" "Secondary Key"
|
||||
"c"
|
||||
"Sort by this criterion second"
|
||||
'corresponding-acc
|
||||
(list #(date
|
||||
"Date"
|
||||
"Sort by date")
|
||||
#(time
|
||||
"Time"
|
||||
"Sort by EXACT entry time")
|
||||
#(corresponding-acc
|
||||
"Transfer from/to"
|
||||
"Sort by account transferred from/to's name")
|
||||
#(amount
|
||||
"Amount"
|
||||
"Sort by amount")
|
||||
#(description
|
||||
"Description"
|
||||
"Sort by description")
|
||||
#(number
|
||||
"Number"
|
||||
"Sort by check/transaction number")
|
||||
#(memo
|
||||
"Memo"
|
||||
"Sort by memo"))))
|
||||
|
||||
(gnc:register-trep-option
|
||||
(gnc:make-multichoice-option
|
||||
"Sorting" "Secondary Sort Order"
|
||||
"d" "Order of Secondary sorting"
|
||||
'ascend
|
||||
(list #(ascend "Ascending" "smallest to largest, earliest to latest")
|
||||
#(descend "Descending" "largest to smallest, latest to earliest"))))
|
||||
gnc:*transaction-report-options*)
|
||||
|
||||
(define (gnc:split-list-balance splits)
|
||||
(let ((num-splits (gnc:count-splits splits)))
|
||||
(if (eq? num-splits 0)
|
||||
0
|
||||
(let loop
|
||||
((balance (gnc:split-get-balance (gnc:ith-split splits 0)))
|
||||
(index 1))
|
||||
(if (>= index num-splits)
|
||||
balance
|
||||
(loop (+ (gnc:split-get-value (gnc:ith-split splits index))
|
||||
balance)
|
||||
(+ index 1)))))))
|
||||
|
@ -5,12 +5,97 @@
|
||||
(gnc:support "report/balance-and-pnl.scm")
|
||||
(gnc:depend "text-export.scm")
|
||||
(gnc:depend "report-utilities.scm")
|
||||
(gnc:depend "options.scm")
|
||||
|
||||
(define (gnc:account-get-balance-until account to-tp)
|
||||
(let ((query (gnc:malloc-query))
|
||||
(balance-temp 0))
|
||||
(gnc:query-add-account query account)
|
||||
(gnc:query-show-earliest query)
|
||||
(gnc:query-set-latest query to-tp)
|
||||
(set! balance-temp
|
||||
(gnc:split-list-balance (gnc:query-get-splits query)))
|
||||
(gnc:free-query query)
|
||||
balance-temp))
|
||||
|
||||
(define (gnc:account-get-balance-interval account from-tp to-tp)
|
||||
(let ((query (gnc:malloc-query))
|
||||
(balance-temp 0))
|
||||
(gnc:query-add-account query account)
|
||||
(gnc:query-set-earliest query from-tp)
|
||||
(gnc:query-set-latest query to-tp)
|
||||
(set! balance-temp
|
||||
(gnc:split-list-balance (gnc:query-get-splits query)))
|
||||
(gnc:free-query query)
|
||||
balance-temp))
|
||||
|
||||
(define (gnc:group-get-balance-until group to-tp)
|
||||
(sum (map (lambda (x) (gnc:account-get-balance-until x to-tp)) group)))
|
||||
|
||||
(define (gnc:group-get-balance-interval group from-tp to-tp)
|
||||
(sum (map (lambda (x)
|
||||
(gnc:account-get-balance-until x from-tp to-tp)) group)))
|
||||
|
||||
;; Just a private scope.
|
||||
(let
|
||||
((l0-collector (make-stats-collector))
|
||||
(l1-collector (make-stats-collector))
|
||||
(l2-collector (make-stats-collector)))
|
||||
;; Just a private scope.
|
||||
|
||||
(define string-db (gnc:make-string-database))
|
||||
|
||||
(define (balsht-options-generator)
|
||||
(define gnc:*balsht-report-options* (gnc:new-options))
|
||||
(define (gnc:register-balsht-option new-option)
|
||||
(gnc:register-option gnc:*balsht-report-options* new-option))
|
||||
|
||||
(gnc:register-balsht-option
|
||||
(gnc:make-date-option
|
||||
"Report Options" "To"
|
||||
"a" "Calculate balance sheet up to this date"
|
||||
(lambda ()
|
||||
(let ((bdtime (localtime (current-time))))
|
||||
(set-tm:sec bdtime 59)
|
||||
(set-tm:min bdtime 59)
|
||||
(set-tm:hour bdtime 23)
|
||||
(let ((time (car (mktime bdtime))))
|
||||
(cons time 0))))
|
||||
#f))
|
||||
gnc:*balsht-report-options*)
|
||||
|
||||
(define (pnl-options-generator)
|
||||
(define gnc:*pnl-report-options* (gnc:new-options))
|
||||
(define (gnc:register-pnl-option new-option)
|
||||
(gnc:register-option gnc:*pnl-report-options* new-option))
|
||||
|
||||
(gnc:register-pnl-option
|
||||
(gnc:make-date-option
|
||||
"Report Options" "From"
|
||||
"a" "Start of reporting period"
|
||||
(lambda ()
|
||||
(let ((bdtime (localtime (current-time))))
|
||||
(set-tm:sec bdtime 0)
|
||||
(set-tm:min bdtime 0)
|
||||
(set-tm:hour bdtime 0)
|
||||
(set-tm:mday bdtime 1)
|
||||
(set-tm:mon bdtime 0)
|
||||
(let ((time (car (mktime bdtime))))
|
||||
(cons time 0))))
|
||||
#f))
|
||||
|
||||
(gnc:register-pnl-option
|
||||
(gnc:make-date-option
|
||||
"Report Options" "To"
|
||||
"b" "End of reporting period"
|
||||
(lambda ()
|
||||
(let ((bdtime (localtime (current-time))))
|
||||
(set-tm:sec bdtime 59)
|
||||
(set-tm:min bdtime 59)
|
||||
(set-tm:hour bdtime 23)
|
||||
(let ((time (car (mktime bdtime))))
|
||||
(cons time 0))))
|
||||
#f))
|
||||
gnc:*pnl-report-options*)
|
||||
|
||||
(define (render-level-2-account level-2-account l2-value)
|
||||
(let ((account-name (gnc:account-get-name level-2-account))
|
||||
@ -18,18 +103,22 @@
|
||||
(gnc:account-get-type level-2-account))))
|
||||
(html-table-row
|
||||
(list
|
||||
account-name type-name l2-value))))
|
||||
account-name type-name (gnc:amount->formatted-string l2-value #f)))))
|
||||
|
||||
(define (render-level-1-account account l1-value l2-value)
|
||||
(let ((name (gnc:account-get-name account))
|
||||
(type (gnc:account-get-type-string (gnc:account-get-type account))))
|
||||
(html-table-row
|
||||
(list name type l2-value l1-value
|
||||
(list name type
|
||||
(gnc:amount->formatted-string l2-value #f)
|
||||
(gnc:amount->formatted-string l1-value #f)
|
||||
" " " "))))
|
||||
|
||||
(define (render-total l0-value)
|
||||
(html-table-row (list " " " " " " (html-strong "Net")
|
||||
" " l0-value)))
|
||||
(html-table-row (list " " " " " "
|
||||
(html-strong (string-db 'lookup 'net))
|
||||
" "
|
||||
(gnc:amount->formatted-string l0-value #f))))
|
||||
|
||||
(define (is-it-on-balance-sheet? type balance?)
|
||||
(eq?
|
||||
@ -38,6 +127,7 @@
|
||||
|
||||
(define (generate-balance-sheet-or-pnl report-name
|
||||
report-description
|
||||
options
|
||||
balance-sheet?)
|
||||
;; currency symbol that is printed is a dollar sign, for now
|
||||
;; currency amounts get printed with two decimal places
|
||||
@ -48,36 +138,55 @@
|
||||
;; just translated it directly from the old ePerl with a few
|
||||
;; schemifications.
|
||||
|
||||
(define (handle-level-1-account account)
|
||||
(let ((type (gnc:account-type->symbol (gnc:account-get-type account))))
|
||||
(if (is-it-on-balance-sheet? type balance-sheet?)
|
||||
;; Ignore
|
||||
'()
|
||||
(let
|
||||
((childrens-output (gnc:group-map-accounts
|
||||
handle-level-2-account
|
||||
(gnc:account-get-children account)))
|
||||
(let* ((from-option (gnc:lookup-option options "Report Options" "From"))
|
||||
(from-value (if from-option (gnc:option-value from-option) #f))
|
||||
(to-value (gnc:option-value
|
||||
(gnc:lookup-option options "Report Options" "To"))))
|
||||
|
||||
(account-balance (gnc:account-get-balance account)))
|
||||
|
||||
(if (not balance-sheet?)
|
||||
(set! account-balance (- account-balance)))
|
||||
(l2-collector 'add account-balance)
|
||||
(l1-collector 'add account-balance)
|
||||
(l0-collector 'add (l1-collector 'total #f))
|
||||
(let ((level-1-output
|
||||
(render-level-1-account account
|
||||
(l1-collector 'total #f)
|
||||
(l2-collector 'total #f))))
|
||||
(l1-collector 'reset #f)
|
||||
(l2-collector 'reset #f)
|
||||
(list childrens-output level-1-output))))))
|
||||
(define (handle-level-1-account account options)
|
||||
(let ((type (gnc:account-type->symbol (gnc:account-get-type account))))
|
||||
(if (is-it-on-balance-sheet? type balance-sheet?)
|
||||
;; Ignore
|
||||
'()
|
||||
(let
|
||||
((childrens-output (gnc:group-map-accounts
|
||||
(lambda (x)
|
||||
(handle-level-2-account x options))
|
||||
(gnc:account-get-children account)))
|
||||
|
||||
(define (handle-level-2-account account)
|
||||
(let
|
||||
(account-balance (if balance-sheet?
|
||||
(gnc:account-get-balance-until
|
||||
account
|
||||
to-value)
|
||||
(gnc:account-get-balance-interval
|
||||
account
|
||||
from-value
|
||||
to-value))))
|
||||
|
||||
(if (not balance-sheet?)
|
||||
(set! account-balance (- account-balance)))
|
||||
(l2-collector 'add account-balance)
|
||||
(l1-collector 'add account-balance)
|
||||
(l0-collector 'add (l1-collector 'total #f))
|
||||
(let ((level-1-output
|
||||
(render-level-1-account account
|
||||
(l1-collector 'total #f)
|
||||
(l2-collector 'total #f))))
|
||||
(l1-collector 'reset #f)
|
||||
(l2-collector 'reset #f)
|
||||
(list childrens-output level-1-output))))))
|
||||
|
||||
(define (handle-level-2-account account options)
|
||||
(let
|
||||
((type (gnc:account-type->symbol (gnc:account-get-type account)))
|
||||
(balance (make-stats-collector))
|
||||
(rawbal (gnc:account-get-balance account)))
|
||||
(rawbal
|
||||
(if balance-sheet?
|
||||
(gnc:account-get-balance-until account to-value)
|
||||
(gnc:account-get-balance-interval
|
||||
account
|
||||
from-value
|
||||
to-value))))
|
||||
(balance 'add
|
||||
(if balance-sheet?
|
||||
rawbal
|
||||
@ -91,20 +200,26 @@
|
||||
(balance 'add
|
||||
((if balance-sheet? + -)
|
||||
0
|
||||
(gnc:group-get-balance grandchildren))))
|
||||
(l2-collector 'add (balance 'get #f))
|
||||
(l1-collector 'add (l2-collector 'get #f))
|
||||
(let
|
||||
((result (render-level-2-account
|
||||
account (l2-collector 'get #f))))
|
||||
(if balance-sheet?
|
||||
(gnc:group-get-balance-until grandchildren
|
||||
to-value)
|
||||
(gnc:group-get-balance-interval grandchildren
|
||||
from-value
|
||||
to-value)))))
|
||||
(l2-collector 'add (balance 'total #f))
|
||||
(l1-collector 'add (l2-collector 'total #f))
|
||||
(let
|
||||
((result (render-level-2-account
|
||||
account (l2-collector 'total #f))))
|
||||
(l2-collector 'reset #f)
|
||||
result)))))
|
||||
|
||||
(let
|
||||
((current-group (gnc:get-current-group))
|
||||
(output '()))
|
||||
|
||||
;;; Now, the main body
|
||||
;;; Reset all the balance collectors
|
||||
;; Now, the main body
|
||||
;; Reset all the balance collectors
|
||||
(l0-collector 'reset #f)
|
||||
(l1-collector 'reset #f)
|
||||
(l2-collector 'reset #f)
|
||||
@ -112,55 +227,66 @@
|
||||
(set! output
|
||||
(list
|
||||
(gnc:group-map-accounts
|
||||
handle-level-1-account
|
||||
(lambda (x) (handle-level-1-account x options))
|
||||
current-group)
|
||||
(render-total (l0-collector 'total #f)))))
|
||||
|
||||
(list
|
||||
"<html>"
|
||||
"<head>"
|
||||
"<title>" (gnc:_ report-name) "</title>"
|
||||
"<title>" report-name "</title>"
|
||||
"</head>"
|
||||
|
||||
"<body bgcolor=#ccccff>"
|
||||
(gnc:_ report-description)
|
||||
report-description
|
||||
"<p>"
|
||||
|
||||
"<table cellpadding=1>"
|
||||
"<caption><b>" (gnc:_ report-name) "</b></caption>"
|
||||
"<tr><th>"(gnc:_ "Account Name")"<th align=center>" (gnc:_ "Type")
|
||||
"<th> <th align=center>"(gnc:_ "Balance")
|
||||
"<caption><b>" report-name "</b></caption>"
|
||||
"<tr><th>" (string-db 'lookup 'account-name)
|
||||
"<th align=center>" (string-db 'lookup 'type)
|
||||
"<th> <th align=center>" (string-db 'lookup 'balance)
|
||||
|
||||
output
|
||||
|
||||
"</table>"
|
||||
"</body>"
|
||||
"</html>")))
|
||||
"</html>"))))
|
||||
|
||||
(string-db 'store 'net "Net")
|
||||
(string-db 'store 'type "Type")
|
||||
(string-db 'store 'account-name "Account Name")
|
||||
(string-db 'store 'balance "Balance")
|
||||
(string-db 'store 'bal-title "Balance Sheet")
|
||||
(string-db 'store 'bal-desc "This page shows your net worth.")
|
||||
(string-db 'store 'pnl-title "Profit and Loss")
|
||||
(string-db 'store 'pnl-desc "This page shows your profits and losses.")
|
||||
|
||||
(gnc:define-report
|
||||
;; version
|
||||
1
|
||||
;; Menu name
|
||||
"Balance sheet"
|
||||
;; Options Generator (none currently)
|
||||
#f
|
||||
;; Code to generate the report
|
||||
(lambda (options)
|
||||
(generate-balance-sheet-or-pnl "Balance Sheet"
|
||||
"This page shows your net worth."
|
||||
#t)))
|
||||
;; version
|
||||
1
|
||||
;; Menu name
|
||||
"Balance sheet"
|
||||
;; Options Generator
|
||||
balsht-options-generator
|
||||
;; Code to generate the report
|
||||
(lambda (options)
|
||||
(generate-balance-sheet-or-pnl (string-db 'lookup 'bal-title)
|
||||
(string-db 'lookup 'bal-desc)
|
||||
options
|
||||
#t)))
|
||||
|
||||
(gnc:define-report
|
||||
;; version
|
||||
1
|
||||
;; Menu name
|
||||
"Profit and Loss"
|
||||
;; Options (none currently)
|
||||
#f
|
||||
;; Code to generate the report
|
||||
(lambda (options)
|
||||
(generate-balance-sheet-or-pnl
|
||||
"Profit and Loss"
|
||||
"This page shows your profits and losses."
|
||||
#f))))
|
||||
(gnc:define-report
|
||||
;; version
|
||||
1
|
||||
;; Menu name
|
||||
"Profit and Loss"
|
||||
;; Options
|
||||
pnl-options-generator
|
||||
;; Code to generate the report
|
||||
(lambda (options)
|
||||
(generate-balance-sheet-or-pnl
|
||||
(string-db 'lookup 'pnl-title)
|
||||
(string-db 'lookup 'pnl-desc)
|
||||
options
|
||||
#f))))
|
||||
|
@ -334,6 +334,121 @@
|
||||
(gnc:tr-report-get-starting-balance
|
||||
(cdr scm-split-list) beginning-date))))
|
||||
|
||||
;; register a configuration option for the transaction report
|
||||
(define (trep-options-generator)
|
||||
(define gnc:*transaction-report-options* (gnc:new-options))
|
||||
(define (gnc:register-trep-option new-option)
|
||||
(gnc:register-option gnc:*transaction-report-options* new-option))
|
||||
;; from date
|
||||
;; hack alert - could somebody set this to an appropriate date?
|
||||
(gnc:register-trep-option
|
||||
(gnc:make-date-option
|
||||
"Report Options" "From"
|
||||
"a" "Report Items from this date"
|
||||
(lambda ()
|
||||
(let ((bdtime (localtime (current-time))))
|
||||
(set-tm:sec bdtime 0)
|
||||
(set-tm:min bdtime 0)
|
||||
(set-tm:hour bdtime 0)
|
||||
(set-tm:mday bdtime 1)
|
||||
(set-tm:mon bdtime 0)
|
||||
(let ((time (car (mktime bdtime))))
|
||||
(cons time 0))))
|
||||
#f))
|
||||
;; to-date
|
||||
(gnc:register-trep-option
|
||||
(gnc:make-date-option
|
||||
"Report Options" "To"
|
||||
"b" "Report items up to and including this date"
|
||||
(lambda () (cons (current-time) 0))
|
||||
#f))
|
||||
|
||||
;; account to do report on
|
||||
(gnc:register-trep-option
|
||||
(gnc:make-account-list-option
|
||||
"Report Options" "Account"
|
||||
"c" "Do transaction report on this account"
|
||||
(lambda ()
|
||||
(let ((current-accounts (gnc:get-current-accounts))
|
||||
(num-accounts (gnc:group-get-num-accounts (gnc:get-current-group)))
|
||||
(first-account (gnc:group-get-account (gnc:get-current-group) 0)))
|
||||
(cond ((not (null? current-accounts)) (list (car current-accounts)))
|
||||
((> num-accounts 0) (list first-account))
|
||||
(else ()))))
|
||||
#f #f))
|
||||
|
||||
;; primary sorting criterion
|
||||
(gnc:register-trep-option
|
||||
(gnc:make-multichoice-option
|
||||
"Sorting" "Primary Key"
|
||||
"a" "Sort by this criterion first"
|
||||
'date
|
||||
(list #(date
|
||||
"Date"
|
||||
"Sort by date")
|
||||
#(time
|
||||
"Time"
|
||||
"Sort by EXACT entry time")
|
||||
#(corresponding-acc
|
||||
"Transfer from/to"
|
||||
"Sort by account transferred from/to's name")
|
||||
#(amount
|
||||
"Amount"
|
||||
"Sort by amount")
|
||||
#(description
|
||||
"Description"
|
||||
"Sort by description")
|
||||
#(number
|
||||
"Number"
|
||||
"Sort by check/transaction number")
|
||||
#(memo
|
||||
"Memo"
|
||||
"Sort by memo"))))
|
||||
|
||||
(gnc:register-trep-option
|
||||
(gnc:make-multichoice-option
|
||||
"Sorting" "Primary Sort Order"
|
||||
"b" "Order of primary sorting"
|
||||
'ascend
|
||||
(list #(ascend "Ascending" "smallest to largest, earliest to latest")
|
||||
#(descend "Descending" "largest to smallest, latest to earliest"))))
|
||||
|
||||
(gnc:register-trep-option
|
||||
(gnc:make-multichoice-option
|
||||
"Sorting" "Secondary Key"
|
||||
"c"
|
||||
"Sort by this criterion second"
|
||||
'corresponding-acc
|
||||
(list #(date
|
||||
"Date"
|
||||
"Sort by date")
|
||||
#(time
|
||||
"Time"
|
||||
"Sort by EXACT entry time")
|
||||
#(corresponding-acc
|
||||
"Transfer from/to"
|
||||
"Sort by account transferred from/to's name")
|
||||
#(amount
|
||||
"Amount"
|
||||
"Sort by amount")
|
||||
#(description
|
||||
"Description"
|
||||
"Sort by description")
|
||||
#(number
|
||||
"Number"
|
||||
"Sort by check/transaction number")
|
||||
#(memo
|
||||
"Memo"
|
||||
"Sort by memo"))))
|
||||
|
||||
(gnc:register-trep-option
|
||||
(gnc:make-multichoice-option
|
||||
"Sorting" "Secondary Sort Order"
|
||||
"d" "Order of Secondary sorting"
|
||||
'ascend
|
||||
(list #(ascend "Ascending" "smallest to largest, earliest to latest")
|
||||
#(descend "Descending" "largest to smallest, latest to earliest"))))
|
||||
gnc:*transaction-report-options*)
|
||||
|
||||
(gnc:define-report
|
||||
;; version
|
||||
|
@ -226,7 +226,7 @@
|
||||
((char=? ch #\7) 7)
|
||||
((char=? ch #\8) 8)
|
||||
((char=? ch #\9) 9)
|
||||
(else (error "Non-integer character" ch i))))
|
||||
(else (error "Non-integer character" ch i))))
|
||||
|
||||
;; non-public procedure
|
||||
(define (normalize-year year nowyear)
|
||||
@ -474,3 +474,4 @@
|
||||
(erriso "day" index string)
|
||||
(encode-julian-day-number
|
||||
day month year))))))))))))))))
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user