Merge branch 'maint'

This commit is contained in:
Christopher Lam 2020-07-23 20:28:49 +08:00
commit 86d923c4f9
124 changed files with 9570 additions and 11821 deletions

View File

@ -275,41 +275,54 @@ include (${SWIG_USE_FILE})
string(REGEX MATCH "^[0-9]+[.]" SWIG_MAJOR ${SWIG_VERSION})
# Find Guile and determine which version we are using.
# Look for guile versions in this order: 2.2 > 2.0
# Look for guile versions in this order: 3.0 > 2.2 > 2.0
# guile library and include dir
pkg_check_modules (GUILE3 guile-3.0 QUIET)
pkg_check_modules (GUILE22 guile-2.2 QUIET)
if (GUILE22_FOUND) # found guile-2.2
pkg_check_modules (GUILE2 guile-2.0>=2.0.9 QUIET)
if (GUILE3_FOUND) # found guile-3.0
add_definitions (-DHAVE_GUILE30)
set(HAVE_GUILE3 TRUE)
set(GUILE_EFFECTIVE_VERSION 3.0)
set(GUILE_INCLUDE_DIRS ${GUILE3_INCLUDE_DIRS})
set(GUILE_LDFLAGS ${GUILE3_LDFLAGS})
find_program (GUILD_EXECUTABLE NAMES guild3.0 guild)
if (NOT GUILD_EXECUTABLE)
message (SEND_ERROR "The guild executable was not found, but is required. Please set GUILD_EXECUTABLE.")
endif()
message(STATUS "Using guile-3.0.x")
find_program (GUILE_EXECUTABLE NAMES guile3.0 guile)
elseif (GUILE22_FOUND) # found guile-2.2
add_definitions (-DHAVE_GUILE22)
set(HAVE_GUILE2 TRUE)
set(GUILE_EFFECTIVE_VERSION 2.2)
set(GUILE_INCLUDE_DIRS ${GUILE22_INCLUDE_DIRS})
set(GUILE_LDFLAGS ${GUILE22_LDFLAGS})
find_program (GUILD_EXECUTABLE NAMES guild2.2 guild)
if (NOT GUILD_EXECUTABLE)
message (SEND_ERROR "The guild executable was not found, but is required. Please set GUILD_EXECUTABLE.")
endif()
message(STATUS "Using guile-2.2.x")
find_program (GUILE_EXECUTABLE NAMES guile2.2 guile)
else()
pkg_check_modules (GUILE2 guile-2.0>=2.0.9 QUIET)
if (GUILE2_FOUND) # found guile-2.0
add_definitions (-DHAVE_GUILE20)
set(HAVE_GUILE2 TRUE)
set(GUILE_EFFECTIVE_VERSION 2.0)
set(GUILE_INCLUDE_DIRS ${GUILE2_INCLUDE_DIRS})
set(GUILE_LDFLAGS ${GUILE2_LDFLAGS})
find_program (GUILD_EXECUTABLE NAMES guild2.0 guild)
if (NOT GUILD_EXECUTABLE)
message (SEND_ERROR "The guild executable was not found, but is required. Please set GUILD_EXECUTABLE.")
endif()
message(STATUS "Using guile-2.0.x")
find_program (GUILE_EXECUTABLE NAMES guile2.0 guile)
else()
message (FATAL_ERROR "Neither guile 2.2 nor guile 2.0 were found GnuCash can't run without one of them. Ensure that one is installed and can be found with pkg-config.")
elseif (GUILE2_FOUND) # found guile-2.0
add_definitions (-DHAVE_GUILE20)
set(HAVE_GUILE2 TRUE)
set(GUILE_EFFECTIVE_VERSION 2.0)
set(GUILE_INCLUDE_DIRS ${GUILE2_INCLUDE_DIRS})
set(GUILE_LDFLAGS ${GUILE2_LDFLAGS})
find_program (GUILD_EXECUTABLE NAMES guild2.0 guild)
if (NOT GUILD_EXECUTABLE)
message (SEND_ERROR "The guild executable was not found, but is required. Please set GUILD_EXECUTABLE.")
endif()
message(STATUS "Using guile-2.0.x")
find_program (GUILE_EXECUTABLE NAMES guile2.0 guile)
else()
message (FATAL_ERROR "Neither guile 3.0, guile 2.2, nor guile 2.0 were found GnuCash can't run without one of them. Ensure that one is installed and can be found with pkg-config.")
endif()
if (NOT GUILE_EXECUTABLE)

View File

@ -57,7 +57,7 @@ Libraries/Deps
cmake 3.10 Build system manager
glib2 2.56.1
gtk+3 3.22.30
guile 2.2.0 or 2.0.9 Must be built with regex
guile 3.0, 2.2 or 2.0.9 Must be built with regex
support enabled
libxml2 2.9.4
gettext 0.20 Required to build gnucash.pot,

View File

@ -24,22 +24,23 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(define-module (gnucash core-utils))
(define-module (gnucash core-utils)
#:export (N_
G_
gnc:version))
;; Guile 2 needs to find the symbols from the extension at compile time already
(eval-when
(compile load eval expand)
(load-extension "libgnucash-guile" "gnc_guile_bindings_init"))
(eval-when (compile load eval expand)
(load-extension "libgnucash-guile" "gnc_guile_bindings_init"))
(use-modules (sw_core_utils))
; Export the swig-wrapped symbols in the public interface of this module
(let ((i (module-public-interface (current-module))))
(module-use! i (resolve-interface '(sw_core_utils))))
;; Export the swig-wrapped symbols in the public interface of this module
(module-use! (module-public-interface (current-module))
(resolve-interface '(sw_core_utils)))
(define gnc:version (gnc-version))
(define-public gnc:version (gnc-version))
;; gettext functions
(define-public _ gnc:gettext)
(define-syntax N_
(syntax-rules ()
((_ x) x)))
(export N_)
(define G_ gnc:gettext)
(define-syntax-rule (N_ x) x)

View File

@ -21,6 +21,8 @@
;; Boston, MA 02110-1301, USA gnu@gnu.org
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(use-modules (srfi srfi-9))
;; use 'logior' in guile to bit-combine RND and DENOM flags.
(define GNC-RND-FLOOR 1)
@ -48,30 +50,17 @@
(define GNC-ERROR-REMAINDER -4)
(define <gnc-monetary>
(make-record-type "<gnc-monetary>"
'(commodity amount)))
;; Constructor; takes one <gnc:commodity*> and one <gnc-numeric>
(define (gnc:make-gnc-monetary c a)
;;FIXME: we used to type-check the values, like:
;; (gw:wcp-is-of-type? <gnc:commodity*> c)
(if (and #t (number? a))
((record-constructor <gnc-monetary>) c a)
(warn "wrong arguments for gnc:make-gnc-monetary: " c a)))
(define gnc:gnc-monetary?
(record-predicate <gnc-monetary>))
(define gnc:gnc-monetary-commodity
(record-accessor <gnc-monetary> 'commodity))
(define gnc:gnc-monetary-amount
(record-accessor <gnc-monetary> 'amount))
(define-record-type :gnc-monetary
(make-gnc-monetary commodity amount)
gnc-monetary?
(commodity gnc-monetary-commodity)
(amount gnc-monetary-amount))
(define gnc:make-gnc-monetary make-gnc-monetary)
(define gnc:gnc-monetary? gnc-monetary?)
(define gnc:gnc-monetary-commodity gnc-monetary-commodity)
(define gnc:gnc-monetary-amount gnc-monetary-amount)
(define (gnc:monetary-neg a)
(if (gnc:gnc-monetary? a)
(gnc:make-gnc-monetary
(gnc:gnc-monetary-commodity a)
(gnc-numeric-neg (gnc:gnc-monetary-amount a)))
(warn "wrong arguments for gnc:monetary-neg: " a)))
(gnc:make-gnc-monetary
(gnc:gnc-monetary-commodity a)
(- (gnc:gnc-monetary-amount a))))

View File

@ -22,7 +22,7 @@
/* Application wide font setting */
* {
font: 12px arial, sans-serif;
font: 12px arial;
}
@ -40,7 +40,7 @@ scrollbar slider {
/* Register sheet font setting */
gnc-id-sheet {
font: 10px arial, sans-serif;
font: 10px arial;
}
@ -65,7 +65,7 @@ gnc-id-cursor button {
/* Register sheet calendar */
gnc-id-sheet calendar {
font: 13px arial, sans-serif;
font: 13px arial;
background-color:lightgreen;
border-color: green;
border-width: 1px;

View File

@ -222,6 +222,8 @@ if (WITH_PYTHON)
endif()
if (MAC_INTEGRATION)
file(APPEND ${ENV_FILE_OUT} "GTK_EXE_PREFIX={GNC_HOME}\n")
file(APPEND ${ENV_FILE_OUT} "GIO_MODULE_DIR={SYS_LIB}/gio/modules\n")
file(APPEND ${ENV_FILE_OUT} "XDG_CONFIG_HOME={HOME}/Library/Application Support/${PACKAGE_NAME}/config\n")
file(APPEND ${ENV_FILE_OUT} "GDK_PIXBUF_MODULE_FILE={SYS_LIB}/gdk-pixbuf-2.0/2.10.0/loaders.cache\n")
file(APPEND ${ENV_FILE_OUT} "FONTCONFIG_FILE={GNC_HOME}/etc/fonts/fonts.conf\n")

View File

@ -116,6 +116,8 @@ typedef struct _AccountWindow
GtkWidget * tax_related_button;
GtkWidget * placeholder_button;
GtkWidget * hidden_button;
GtkWidget * auto_interest_button;
GtkWidget * auto_interest_button_label;
gint component_id;
} AccountWindow;
@ -155,6 +157,7 @@ void gnc_account_name_insert_text_cb (GtkWidget *entry,
gint length,
gint *position,
gpointer data);
static void set_auto_interest_box (AccountWindow *aw);
/** Implementation *******************************************************/
@ -275,6 +278,8 @@ gnc_account_to_ui(AccountWindow *aw)
flag = xaccAccountGetHidden (account);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (aw->hidden_button),
flag);
set_auto_interest_box (aw);
LEAVE(" ");
}
@ -443,6 +448,11 @@ gnc_ui_to_account(AccountWindow *aw)
if (xaccAccountGetHidden (account) != flag)
xaccAccountSetHidden (account, flag);
flag =
gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (aw->auto_interest_button));
if (xaccAccountGetAutoInterest (account) != flag)
xaccAccountSetAutoInterest (account, flag);
parent_account = gnc_tree_view_account_get_selected_account (GNC_TREE_VIEW_ACCOUNT (aw->parent_tree));
if (parent_account == NULL)
@ -1083,6 +1093,19 @@ gnc_account_parent_changed_cb (GtkTreeSelection *selection, gpointer data)
gnc_account_window_set_name(aw);
}
static void
set_auto_interest_box(AccountWindow *aw)
{
Account* account = aw_get_account (aw);
gboolean type_ok = account_type_has_auto_interest_xfer (aw->type);
gboolean pref_set = xaccAccountGetAutoInterest (account);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (aw->auto_interest_button),
type_ok && pref_set);
gtk_widget_set_sensitive (GTK_WIDGET (aw->auto_interest_button), type_ok);
gtk_widget_set_sensitive (GTK_WIDGET (aw->auto_interest_button_label),
type_ok);
}
static void
gnc_account_type_changed_cb (GtkTreeSelection *selection, gpointer data)
{
@ -1120,6 +1143,7 @@ gnc_account_type_changed_cb (GtkTreeSelection *selection, gpointer data)
gnc_amount_edit_set_amount (GNC_AMOUNT_EDIT (aw->opening_balance_edit),
gnc_numeric_zero ());
}
set_auto_interest_box(aw);
}
static void
@ -1389,6 +1413,10 @@ gnc_account_window_create(GtkWindow *parent, AccountWindow *aw)
aw->tax_related_button = GTK_WIDGET(gtk_builder_get_object (builder, "tax_related_button"));
aw->placeholder_button = GTK_WIDGET(gtk_builder_get_object (builder, "placeholder_button"));
aw->hidden_button = GTK_WIDGET(gtk_builder_get_object (builder, "hidden_button"));
aw->auto_interest_button = GTK_WIDGET(gtk_builder_get_object (builder, "auto_interest_button"));
aw->auto_interest_button_label = GTK_WIDGET(gtk_builder_get_object (builder, "label405"));
set_auto_interest_box(aw);
box = GTK_WIDGET(gtk_builder_get_object (builder, "opening_balance_box"));
amount = gnc_amount_edit_new ();

View File

@ -26,6 +26,23 @@
#include "Account.h"
/* Note: make sure to update the help text for this in prefs.scm if these
* change! These macros define the account types for which an auto interest
* xfer dialog could pop up, if the user's preferences allow it.
*/
#define account_type_has_auto_interest_charge(type) (((type) == ACCT_TYPE_CREDIT) || \
((type) == ACCT_TYPE_LIABILITY) ||\
((type) == ACCT_TYPE_PAYABLE))
#define account_type_has_auto_interest_payment(type) (((type) == ACCT_TYPE_BANK) || \
((type) == ACCT_TYPE_ASSET) || \
((type) == ACCT_TYPE_MUTUAL) || \
((type) == ACCT_TYPE_RECEIVABLE))
#define account_type_has_auto_interest_xfer(type) \
( account_type_has_auto_interest_charge(type) || \
account_type_has_auto_interest_payment(type) )
/** @addtogroup GUI
@{ */
/** @addtogroup GuiAccount Creating and editing accounts in the GUI

View File

@ -2809,17 +2809,20 @@ gnc_main_window_connect (GncMainWindow *window,
{
GncMainWindowPrivate *priv;
GtkNotebook *notebook;
gint current_position = -1;
page->window = GTK_WIDGET(window);
priv = GNC_MAIN_WINDOW_GET_PRIVATE(window);
notebook = GTK_NOTEBOOK (priv->notebook);
priv->installed_pages = g_list_append (priv->installed_pages, page);
current_position = g_list_index (priv->installed_pages, priv->current_page) + 1;
priv->installed_pages = g_list_insert (priv->installed_pages, page, current_position);
priv->usage_order = g_list_prepend (priv->usage_order, page);
gtk_notebook_append_page_menu (notebook, page->notebook_page,
tab_hbox, menu_label);
gtk_notebook_insert_page_menu (notebook, page->notebook_page,
tab_hbox, menu_label, current_position);
gtk_notebook_set_tab_reorderable (notebook, page->notebook_page, TRUE);
gnc_plugin_page_inserted (page);
gtk_notebook_set_current_page (notebook, -1);
gtk_notebook_set_current_page (notebook, current_position);
if (GNC_PLUGIN_PAGE_GET_CLASS(page)->window_changed)
(GNC_PLUGIN_PAGE_GET_CLASS(page)->window_changed)(page, GTK_WIDGET(window));
g_signal_emit (window, main_window_signals[PAGE_ADDED], 0, page);

View File

@ -741,6 +741,7 @@ gnc_tree_model_account_get_value (GtkTreeModel *tree_model,
{
g_value_init (value, G_TYPE_STRING);
g_value_take_string (value, cached_string);
LEAVE("value in cache, '%s'", cached_string);
return;
}

View File

@ -2507,6 +2507,7 @@ tree_restore_expanded_row (GncTreeViewAccount *view,
QofBook *book;
book = qof_session_get_book(gnc_get_current_session());
g_return_if_fail(book);
account = gnc_account_lookup_by_full_name(gnc_book_get_root_account(book),
account_name);
if (account)
@ -2529,6 +2530,7 @@ tree_restore_selected_row (GncTreeViewAccount *view,
QofBook *book;
book = qof_session_get_book(gnc_get_current_session());
g_return_if_fail(book);
account = gnc_account_lookup_by_full_name(gnc_book_get_root_account(book),
account_name);
if (account)

View File

@ -3556,6 +3556,12 @@ gnc_invoice_show_docs_due (GtkWindow *parent, QofBook *book, double days_in_adva
{ NULL },
};
if (!book)
{
PERR("No book, no due invoices.");
return NULL;
}
/* Create the param list (in reverse order) */
if (param_list == NULL)
{

View File

@ -653,10 +653,12 @@ GNCPrice *
gnc_price_edit_by_guid (GtkWidget * parent, const GncGUID * guid)
{
GNCPrice *price;
QofSession *session;
QofSession *session = gnc_get_current_session();
QofBook* book = qof_session_get_book (session);
session = gnc_get_current_session ();
price = gnc_price_lookup (guid, qof_session_get_book(session));
if (!book)
return (NULL);
price = gnc_price_lookup (guid, book);
if (price == NULL)
return(NULL);

View File

@ -490,11 +490,13 @@ gnc_column_view_edit_add_cb(GtkButton * button, gpointer user_data)
oldlist = SCM_CDR(oldlist);
}
newlist = scm_append
(scm_list_n (scm_reverse(scm_cons(SCM_LIST4(new_report,
scm_from_int (1),
scm_from_int (1),
SCM_BOOL_F),
newlist)),
(scm_list_n (scm_reverse
(scm_cons
(scm_list_4 (new_report,
scm_from_int (1),
scm_from_int (1),
SCM_BOOL_F),
newlist)),
oldlist,
SCM_UNDEFINED));
}
@ -502,10 +504,11 @@ gnc_column_view_edit_add_cb(GtkButton * button, gpointer user_data)
{
newlist = scm_append
(scm_list_n (oldlist,
SCM_LIST1(SCM_LIST4(new_report,
scm_from_int (1),
scm_from_int (1),
SCM_BOOL_F)),
scm_list_1
(scm_list_4 (new_report,
scm_from_int (1),
scm_from_int (1),
SCM_BOOL_F)),
SCM_UNDEFINED));
r->contents_selected = oldlength;
}
@ -680,12 +683,12 @@ gnc_column_view_edit_size_cb(GtkButton * button, gpointer user_data)
if (dlg_ret == GTK_RESPONSE_OK)
{
current = SCM_LIST4(SCM_CAR(current),
scm_from_int (gtk_spin_button_get_value_as_int
(GTK_SPIN_BUTTON(colspin))),
scm_from_int (gtk_spin_button_get_value_as_int
(GTK_SPIN_BUTTON(rowspin))),
SCM_BOOL_F);
current = scm_list_4 (SCM_CAR (current),
scm_from_int (gtk_spin_button_get_value_as_int
(GTK_SPIN_BUTTON(colspin))),
scm_from_int (gtk_spin_button_get_value_as_int
(GTK_SPIN_BUTTON(rowspin))),
SCM_BOOL_F);
scm_gc_unprotect_object(r->contents_list);
r->contents_list = scm_list_set_x(r->contents_list,
scm_from_int (r->contents_selected),

View File

@ -1816,6 +1816,11 @@ gnc_plugin_page_register_recreate_page (GtkWidget* window,
include_subs = (g_ascii_strcasecmp (reg_type, LABEL_SUBACCOUNT) == 0);
DEBUG ("Include subs: %d", include_subs);
book = qof_session_get_book (gnc_get_current_session());
if (!book)
{
LEAVE("Session has no book");
return NULL;
}
acct_guid = g_key_file_get_string (key_file, group_name,
KEY_ACCOUNT_GUID, &error);
if (string_to_guid (acct_guid, &guid)) //find account by guid

View File

@ -1495,6 +1495,11 @@ gnc_plugin_page_register2_recreate_page (GtkWidget *window,
acct_name = g_key_file_get_string (key_file, group_name,
KEY_ACCOUNT_NAME, &error);
book = qof_session_get_book (gnc_get_current_session());
if (!book)
{
LEAVE("Session has no book");
return NULL;
}
account = gnc_account_lookup_by_full_name (gnc_book_get_root_account(book),
acct_name);
g_free (acct_name);

View File

@ -54,7 +54,7 @@
(template (cdr item))
(report-guid (gnc:report-template-report-guid template))
(menu-tip (or (gnc:report-template-menu-tip template)
(format #f (_ "Display the ~a report") (_ menu-name))))
(format #f (G_ "Display the ~a report") (G_ menu-name))))
(menu-path (append (list gnc:menuname-reports)
(or (gnc:report-template-menu-path template)
'()))))

View File

@ -359,6 +359,11 @@ gnc_save_all_state (gpointer session, gpointer unused)
/* Store the book's GncGUID in the top level group */
book = qof_session_get_book(session);
if (!book)
{
PERR("Session has no book!");
return;
}
guid = qof_entity_get_guid(QOF_INSTANCE(book));
guid_to_string_buff(guid, guid_string);
g_key_file_set_string(keyfile, STATE_FILE_TOP, STATE_FILE_BOOK_GUID,

View File

@ -63,7 +63,6 @@
#endif
#define WINDOW_RECONCILE_CM_CLASS "window-reconcile"
#define GNC_PREF_AUTO_INTEREST_TRANSFER "auto-interest-transfer"
#define GNC_PREF_AUTO_CC_PAYMENT "auto-cc-payment"
#define GNC_PREF_ALWAYS_REC_TO_TODAY "always-reconcile-to-today"
@ -127,24 +126,6 @@ typedef struct _startRecnWindowData
time64 date; /* the interest xfer reconcile date */
} startRecnWindowData;
/* Note: make sure to update the help text for this in prefs.scm if these
* change! These macros define the account types for which an auto interest
* xfer dialog could pop up, if the user's preferences allow it.
*/
#define account_type_has_auto_interest_charge(type) (((type) == ACCT_TYPE_CREDIT) || \
((type) == ACCT_TYPE_LIABILITY) ||\
((type) == ACCT_TYPE_PAYABLE))
#define account_type_has_auto_interest_payment(type) (((type) == ACCT_TYPE_BANK) || \
((type) == ACCT_TYPE_ASSET) || \
((type) == ACCT_TYPE_MUTUAL) || \
((type) == ACCT_TYPE_RECEIVABLE))
#define account_type_has_auto_interest_xfer(type) \
( account_type_has_auto_interest_charge(type) || \
account_type_has_auto_interest_payment(type) )
/** PROTOTYPES ******************************************************/
static gnc_numeric recnRecalculateBalance (RecnWindow *recnData);
@ -424,21 +405,6 @@ gnc_start_recn_children_changed (GtkWidget *widget, startRecnWindowData *data)
}
/* For a given account, determine if an auto interest xfer dialog should be
* shown, based on both the per-account flag as well as the global reconcile
* option. The global option is the default that is used if there is no
* per-account option.
*/
static gboolean
gnc_recn_interest_xfer_get_auto_interest_xfer_allowed( Account *account )
{
gboolean auto_xfer;
auto_xfer = gnc_prefs_get_bool(GNC_PREFS_GROUP_RECONCILE, GNC_PREF_AUTO_INTEREST_TRANSFER);
return xaccAccountGetAutoInterestXfer( account, auto_xfer );
}
/********************************************************************\
* recnInterestXferWindow *
* opens up a window to prompt the user to enter an interest *
@ -472,27 +438,6 @@ gnc_recn_make_interest_window_name(Account *account, char *text)
}
/* user clicked button in the interest xfer dialog entitled
* "No Auto Interest Payments for this Account".
*/
static void
gnc_recn_interest_xfer_no_auto_clicked_cb(GtkButton *button,
startRecnWindowData *data)
{
/* Indicate that the user doesn't want
* an auto interest xfer for this account.
*/
xaccAccountSetAutoInterestXfer( data->account, FALSE );
/* shut down the interest xfer dialog */
gnc_xfer_dialog_close( data->xferData );
/* make the button clickable again */
if ( data->xfer_button )
gtk_widget_set_sensitive(GTK_WIDGET(data->xfer_button), TRUE);
}
static void
recnInterestXferWindow( startRecnWindowData *data)
{
@ -561,15 +506,6 @@ recnInterestXferWindow( startRecnWindowData *data)
gnc_xfer_dialog_quickfill_to_account( data->xferData, FALSE );
}
/* add a button to disable auto interest payments for this account */
gnc_xfer_dialog_add_user_specified_button( data->xferData,
( account_type_has_auto_interest_payment( data->account_type ) ?
_("No Auto Interest Payments for this Account")
: _("No Auto Interest Charges for this Account") ),
G_CALLBACK(gnc_recn_interest_xfer_no_auto_clicked_cb),
(gpointer) data );
/* no currency frame */
gnc_xfer_dialog_toggle_currency_table( data->xferData, FALSE );
@ -627,10 +563,6 @@ gnc_reconcile_interest_xfer_run(startRecnWindowData *data)
void
gnc_start_recn_interest_clicked_cb(GtkButton *button, startRecnWindowData *data)
{
/* indicate in account that user wants
* an auto interest xfer for this account */
xaccAccountSetAutoInterestXfer( data->account, TRUE );
/* make the button unclickable since we're popping up the window */
if ( data->xfer_button )
gtk_widget_set_sensitive(GTK_WIDGET(data->xfer_button), FALSE);
@ -730,8 +662,7 @@ startRecnWindow(GtkWidget *parent, Account *account,
data.date = *statement_date;
/* whether to have an automatic interest xfer dialog or not */
auto_interest_xfer_option =
gnc_recn_interest_xfer_get_auto_interest_xfer_allowed( account );
auto_interest_xfer_option = xaccAccountGetAutoInterest (account);
data.include_children = !has_account_different_commodities(account) &&
xaccAccountGetReconcileChildrenStatus(account);

View File

@ -56,9 +56,9 @@
#include "gnc-window.h"
#include "reconcile-view.h"
#include "window-reconcile2.h"
#include "Account.h"
#define WINDOW_RECONCILE_CM_CLASS "window-reconcile"
#define GNC_PREF_AUTO_INTEREST_TRANSFER "auto-interest-transfer"
#define GNC_PREF_AUTO_CC_PAYMENT "auto-cc-payment"
#define GNC_PREF_ALWAYS_REC_TO_TODAY "always-reconcile-to-today"
@ -120,23 +120,6 @@ typedef struct _startRecnWindowData
} startRecnWindowData;
/* Note: make sure to update the help text for this in prefs.scm if these
* change! These macros define the account types for which an auto interest
* xfer dialog could pop up, if the user's preferences allow it.
*/
#define account_type_has_auto_interest_charge(type) (((type) == ACCT_TYPE_CREDIT) || \
((type) == ACCT_TYPE_LIABILITY) ||\
((type) == ACCT_TYPE_PAYABLE))
#define account_type_has_auto_interest_payment(type) (((type) == ACCT_TYPE_BANK) || \
((type) == ACCT_TYPE_ASSET) || \
((type) == ACCT_TYPE_MUTUAL) || \
((type) == ACCT_TYPE_RECEIVABLE))
#define account_type_has_auto_interest_xfer(type) \
( account_type_has_auto_interest_charge(type) || \
account_type_has_auto_interest_payment(type) )
/** PROTOTYPES ******************************************************/
static gnc_numeric recnRecalculateBalance (RecnWindow2 *recnData);
@ -366,21 +349,6 @@ gnc_start_recn2_children_changed (GtkWidget *widget, startRecnWindowData *data)
}
/* For a given account, determine if an auto interest xfer dialog should be
* shown, based on both the per-account flag as well as the global reconcile
* option. The global option is the default that is used if there is no
* per-account option.
*/
static gboolean
gnc_recn_interest_xfer_get_auto_interest_xfer_allowed (Account *account)
{
gboolean auto_xfer;
auto_xfer = gnc_prefs_get_bool (GNC_PREFS_GROUP_RECONCILE, GNC_PREF_AUTO_INTEREST_TRANSFER);
return xaccAccountGetAutoInterestXfer (account, auto_xfer);
}
/********************************************************************\
* recnInterestXferWindow *
* opens up a window to prompt the user to enter an interest *
@ -421,11 +389,6 @@ static void
gnc_recn_interest_xfer_no_auto_clicked_cb (GtkButton *button,
startRecnWindowData *data)
{
/* Indicate that the user doesn't want
* an auto interest xfer for this account.
*/
xaccAccountSetAutoInterestXfer (data->account, FALSE);
/* shut down the interest xfer dialog */
gnc_xfer_dialog_close (data->xferData);
@ -568,10 +531,6 @@ gnc_reconcile_interest_xfer_run (startRecnWindowData *data)
void
gnc_start_recn2_interest_clicked_cb (GtkButton *button, startRecnWindowData *data)
{
/* indicate in account that user wants
* an auto interest xfer for this account */
xaccAccountSetAutoInterestXfer (data->account, TRUE);
/* make the button unclickable since we're popping up the window */
if (data->xfer_button)
gtk_widget_set_sensitive (GTK_WIDGET (data->xfer_button), FALSE);
@ -671,8 +630,7 @@ startRecnWindow (GtkWidget *parent, Account *account,
data.date = *statement_date;
/* whether to have an automatic interest xfer dialog or not */
auto_interest_xfer_option =
gnc_recn_interest_xfer_get_auto_interest_xfer_allowed (account);
auto_interest_xfer_option = xaccAccountGetAutoInterest (account);
data.include_children = xaccAccountGetReconcileChildrenStatus (account);

View File

@ -133,11 +133,15 @@ report_session_percentage (const char *message, double percent)
return;
}
/* Don't try to use std::string& for the members of the following struct, it
* results in the values getting corrupted as it passes through initializing
* Scheme when compiled with Clang.
*/
struct run_report_args {
const std::string& file_to_load;
const std::string& run_report;
const std::string& export_type;
const std::string& output_file;
const std::string file_to_load;
const std::string run_report;
const std::string export_type;
const std::string output_file;
};
static void
@ -199,7 +203,7 @@ scm_run_report (void *data,
struct show_report_args {
const std::string& show_report;
const std::string show_report;
};
static void

View File

@ -258,10 +258,13 @@ set_mac_locale()
* before another call to setlocale messes it up. */
gnc_localeconv ();
/* Process the languages, including the one from the Apple locale. */
if ([languages count] > 0)
mac_set_languages(languages, lang_str);
else
g_setenv("LANGUAGE", [lang_str UTF8String], TRUE);
if (g_getenv("LANGUAGE") == NULL)
{
if ([languages count] > 0)
mac_set_languages(languages, lang_str);
else
g_setenv("LANGUAGE", [lang_str UTF8String], TRUE);
}
[languages release];
[pool drain];
}

View File

@ -1502,6 +1502,20 @@
<property name="top_attach">8</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="auto_interest_button">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="tooltip_text" translatable="yes">Prior to reconciling an account which charges or pays interest, prompt the user to enter a transaction for the interest charge or payment. Currently only enabled for Bank, Credit, Mutual, Asset, Receivable, Payable, and Liability accounts.</property>
<property name="halign">start</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">10</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="tax_related_button">
<property name="visible">True</property>
@ -1560,6 +1574,20 @@
<property name="top_attach">7</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label405">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">end</property>
<property name="label" translatable="yes">Auto _interest transfer</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">auto_interest_button</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">10</property>
</packing>
</child>
</object>
<packing>
<property name="left_attach">0</property>

View File

@ -14,7 +14,7 @@
<property name="page_increment">10</property>
</object>
<object class="GtkAdjustment" id="auto_clear_adj">
<property name="lower">6</property>
<property name="lower">5</property>
<property name="upper">12</property>
<property name="step_increment">1</property>
<property name="page_increment">10</property>
@ -2377,24 +2377,6 @@ many months before the current month</property>
<property name="top_attach">6</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="pref/dialogs.reconcile/auto-interest-transfer">
<property name="label" translatable="yes">Automatic _interest transfer</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="has_tooltip">True</property>
<property name="tooltip_markup">Prior to reconciling an account which charges or pays interest, prompt the user to enter a transaction for the interest charge or payment. Currently only enabled for Bank, Credit, Mutual, Asset, Receivable, Payable, and Liability accounts.</property>
<property name="tooltip_text" translatable="yes">Prior to reconciling an account which charges or pays interest, prompt the user to enter a transaction for the interest charge or payment. Currently only enabled for Bank, Credit, Mutual, Asset, Receivable, Payable, and Liability accounts.</property>
<property name="halign">start</property>
<property name="use_underline">True</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">7</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="pref/dialogs.reconcile/auto-cc-payment">
<property name="label" translatable="yes">Automatic credit card _payment</property>
@ -2410,7 +2392,7 @@ many months before the current month</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">8</property>
<property name="top_attach">7</property>
</packing>
</child>
<child>
@ -2428,7 +2410,7 @@ many months before the current month</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">9</property>
<property name="top_attach">8</property>
</packing>
</child>
<child>
@ -2438,7 +2420,7 @@ many months before the current month</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">10</property>
<property name="top_attach">9</property>
</packing>
</child>
<child>
@ -2451,7 +2433,7 @@ many months before the current month</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">11</property>
<property name="top_attach">10</property>
</packing>
</child>
<child>
@ -2469,7 +2451,7 @@ many months before the current month</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">12</property>
<property name="top_attach">11</property>
</packing>
</child>
<child>
@ -2487,7 +2469,7 @@ many months before the current month</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">13</property>
<property name="top_attach">12</property>
</packing>
</child>
<child>
@ -2505,7 +2487,7 @@ many months before the current month</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">14</property>
<property name="top_attach">13</property>
</packing>
</child>
<child>
@ -2523,7 +2505,7 @@ many months before the current month</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">15</property>
<property name="top_attach">14</property>
</packing>
</child>
<child>
@ -2533,7 +2515,7 @@ many months before the current month</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">16</property>
<property name="top_attach">15</property>
</packing>
</child>
<child>
@ -2546,7 +2528,7 @@ many months before the current month</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">17</property>
<property name="top_attach">16</property>
</packing>
</child>
<child>
@ -2564,7 +2546,7 @@ many months before the current month</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">18</property>
<property name="top_attach">17</property>
</packing>
</child>
</object>

View File

@ -89,6 +89,20 @@ struct _GncABImExContextImport
GData *tmp_job_list;
};
static inline time64
gnc_gwen_date_to_time64 (const GNC_GWEN_DATE* date)
{
#if AQBANKING_VERSION_INT >= 59900
return gnc_dmy2time64_neutral(GWEN_Date_GetDay(date),
GWEN_Date_GetMonth(date),
GWEN_Date_GetYear(date));
#else
int month, day, year;
GWEN_Time_GetBrokenDownDate(date, &day, &month, &year);
return gnc_dmy2time64_neutral(day, month, year);
#endif
}
void
gnc_GWEN_Init(void)
{
@ -571,11 +585,7 @@ gnc_ab_trans_to_gnc(const AB_TRANSACTION *ab_trans, Account *gnc_acc)
}
if (valuta_date)
{
#ifdef AQBANKING6
time64 secs = GWEN_Date_toLocalTime(valuta_date);
#else
time64 secs = GWEN_Time_toTime_t(valuta_date);
#endif
time64 secs = gnc_gwen_date_to_time64(valuta_date);
xaccTransSetDatePostedSecsNormalized(gnc_trans, secs);
}
else
@ -1057,12 +1067,7 @@ bal_accountinfo_cb(AB_IMEXPORTER_ACCOUNTINFO *element, gpointer user_data)
#endif
if (ti)
{
#ifdef AQBANKING6
time64 secs = GWEN_Date_toLocalTime(ti);
#else
time64 secs = GWEN_Time_toTime_t(ti);
#endif
booked_tt = gnc_time64_get_day_neutral(secs);
booked_tt = gnc_gwen_date_to_time64(ti);
}
else
{

View File

@ -136,11 +136,6 @@ static void refresh_model_row (
GtkTreeModel *model,
GtkTreeIter *iter,
GNCImportTransInfo *info);
static gboolean view_selection_function (GtkTreeSelection *selection,
GtkTreeModel *model,
GtkTreePath *path,
gboolean path_currently_selected,
gpointer data);
/* end local prototypes */
void gnc_gen_trans_list_delete (GNCImportMainMatcher *info)
@ -373,7 +368,6 @@ gnc_gen_trans_add_toggled_cb (GtkCellRendererToggle *cell_renderer,
else
{
gnc_import_TransInfo_set_action (trans_info, GNCImport_ADD);
gui->add_toggled =TRUE; //flag A(dd) has just been toggled to view_selection_function
}
refresh_model_row (gui, model, &iter, trans_info);
LEAVE("");
@ -604,6 +598,16 @@ gnc_gen_trans_row_activated_cb (GtkTreeView *treeview,
LEAVE("");
}
static GNCImportAction
get_action_for_path (GtkTreePath* path, GtkTreeModel *model)
{
GNCImportTransInfo *trans_info;
GtkTreeIter iter;
gtk_tree_model_get_iter (model, &iter, path);
gtk_tree_model_get (model, &iter, DOWNLOADED_COL_DATA, &trans_info, -1);
return gnc_import_TransInfo_get_action (trans_info);
}
static void
gnc_gen_trans_row_changed_cb (GtkTreeSelection *selection,
GNCImportMainMatcher *info)
@ -614,6 +618,18 @@ gnc_gen_trans_row_changed_cb (GtkTreeSelection *selection,
ENTER("");
mode = gtk_tree_selection_get_mode (selection);
if (gtk_tree_selection_count_selected_rows (selection) >= 2)
{
// Unselect rows that should not be selectable
GList* list = gtk_tree_selection_get_selected_rows (selection, &model);
for ( ; list; list=list->next)
{
if (get_action_for_path (list->data, model) != GNCImport_ADD)
gtk_tree_selection_unselect_path (selection, list->data);
}
g_list_free_full (list, (GDestroyNotify) gtk_tree_path_free);
}
switch (mode)
{
case GTK_SELECTION_MULTIPLE:
@ -678,11 +694,23 @@ gnc_gen_trans_onButtonPressed_cb (GtkTreeView *treeview,
event_button = (GdkEventButton *) event;
if (event_button->button == GDK_BUTTON_SECONDARY)
{
int count = 0;
DEBUG("Right mouseClick detected- popup the menu.");
// Only pop up the menu if there's more than 1 selected transaction,
// or the selected transaction is an ADD.
selection = gtk_tree_view_get_selection (treeview);
if (gtk_tree_selection_count_selected_rows (selection) > 0)
{
count = gtk_tree_selection_count_selected_rows (selection);
if (count > 1)
gnc_gen_trans_view_popup_menu (treeview, event, info);
else if (count > 0)
{
GList* selected;
GtkTreeModel *model;
selected = gtk_tree_selection_get_selected_rows (selection, &model);
get_action_for_path (selected->data, model);
if (get_action_for_path (selected->data, model) == GNCImport_ADD)
gnc_gen_trans_view_popup_menu (treeview, event, info);
g_list_free_full (selected, (GDestroyNotify) gtk_tree_path_free);
}
LEAVE("return TRUE");
return TRUE;
@ -831,19 +859,6 @@ gnc_gen_trans_init_view (GNCImportMainMatcher *info,
GTK_SORT_ASCENDING);
selection = gtk_tree_view_get_selection (info->view);
/* set a selection function which will block selection of rows which are not
flagged to be imported into Gnucash */
gtk_tree_selection_set_select_function
(selection,
view_selection_function,
info,
NULL);
/* clear the flag which indicates that A(dd) has been toggled so that the
view_selection_function can block selection of a row when the
view_selection_function is called immediately after A(dd) is toggled
on that row */
info->add_toggled = FALSE;
g_signal_connect (info->view, "row-activated",
G_CALLBACK(gnc_gen_trans_row_activated_cb), info);
g_signal_connect (selection, "changed",
@ -855,78 +870,6 @@ gnc_gen_trans_init_view (GNCImportMainMatcher *info,
G_CALLBACK(gnc_gen_trans_onPopupMenu_cb), info);
}
static gboolean
view_selection_function (GtkTreeSelection *selection,
GtkTreeModel *model,
GtkTreePath *path,
gboolean path_currently_selected,
gpointer data)
{
GtkTreeIter iter;
GNCImportTransInfo *trans_info;
GNCImportAction action;
GNCImportMainMatcher *info = data;
ENTER("view_selection_function");
// only allow response at the top level
if (gtk_tree_path_get_depth (path) != 1)
return FALSE;
if (gtk_tree_model_get_iter(model, &iter, path))
{
gtk_tree_model_get (model, &iter, DOWNLOADED_COL_DATA, &trans_info, -1);
switch (gnc_import_TransInfo_get_action (trans_info))
{
case GNCImport_ADD:
DEBUG("Import action = ADD row selected");
if (info->add_toggled)
{
DEBUG("Add just toggled- do not select the row.");
info->add_toggled = FALSE;
LEAVE("FALSE");
return FALSE;
}
else
{
DEBUG("Add has not been toggled - select the row");
LEAVE("TRUE");
return TRUE;
}
case GNCImport_UPDATE:
DEBUG("Import action = UPDATE row not selected");
LEAVE("FALSE");
return FALSE;
case GNCImport_CLEAR:
DEBUG("Import action = CLEAR row not selected");
LEAVE("FALSE");
return FALSE;
case GNCImport_SKIP:
DEBUG("Import action = SKIP row not selected");
LEAVE("FALSE");
return FALSE;
case GNCImport_LAST_ACTION:
DEBUG("Import action = LAST_ACTION row not selected");
LEAVE("FALSE");
return FALSE;
case GNCImport_INVALID_ACTION:
DEBUG("Import action = LAST_ACTION row not selected");
LEAVE("FALSE");
return FALSE;
default:
DEBUG("Import action = UNDEFINED -cannot select");
LEAVE("FALSE");
return FALSE;
}
}
else
{
DEBUG("path to selected row undefined");
LEAVE("FALSE");
return FALSE;
}
}
static void
show_account_column_toggled_cb (GtkToggleButton *togglebutton,
GNCImportMainMatcher *info)

View File

@ -1118,7 +1118,7 @@ reconcile_when_close_toggled_cb (GtkToggleButton *togglebutton, ofx_info* info)
static void
gnc_file_ofx_import_process_file (ofx_info* info)
{
LibofxContextPtr libofx_context = libofx_get_new_context();
LibofxContextPtr libofx_context;
char* filename = NULL;
char * selected_filename = NULL;
GtkWindow *parent = info->parent;
@ -1127,6 +1127,7 @@ gnc_file_ofx_import_process_file (ofx_info* info)
return;
filename = info->file_list->data;
libofx_context = libofx_get_new_context();
#ifdef G_OS_WIN32
selected_filename = g_win32_locale_filename_from_utf8 (filename);
@ -1150,6 +1151,9 @@ gnc_file_ofx_import_process_file (ofx_info* info)
// Create the match dialog, and run the ofx file through the importer.
info->gnc_ofx_importer_gui = gnc_gen_trans_list_new (GTK_WIDGET(parent), NULL, TRUE, 42, FALSE);
libofx_proc_file (libofx_context, selected_filename, AUTODETECT);
// Free the libofx context before recursing to process the next file
libofx_free_context(libofx_context);
// See whether the view has anything in it and warn the user if not.
if(gnc_gen_trans_list_empty (info->gnc_ofx_importer_gui))
@ -1191,7 +1195,6 @@ void gnc_file_ofx_import (GtkWindow *parent)
extern int ofx_STATUS_msg;
GSList* selected_filenames = NULL;
char *default_dir;
LibofxContextPtr libofx_context = libofx_get_new_context();
GList *filters = NULL;
GSList* iter = NULL;
ofx_info* info = NULL;

View File

@ -1422,9 +1422,9 @@ gnc_ui_qif_import_close_cb (GtkAssistant *gtkassistant, gpointer user_data)
SCM
gnc_ui_qif_import_assistant_get_mappings (QIFImportWindow * w)
{
return SCM_LIST3(w->acct_map_info,
w->cat_map_info,
w->memo_map_info);
return scm_list_3 (w->acct_map_info,
w->cat_map_info,
w->memo_map_info);
}
@ -3038,15 +3038,16 @@ gnc_ui_qif_import_convert_progress_start_cb (GtkButton * button,
/* This step will fill 70% of the bar. */
gnc_progress_dialog_push (wind->convert_progress, 0.7);
retval = scm_apply (qif_to_gnc,
SCM_LIST8(wind->imported_files,
wind->acct_map_info,
wind->cat_map_info,
wind->memo_map_info,
wind->security_hash,
scm_from_utf8_string (currname ? currname : ""),
wind->transaction_status,
progress),
SCM_EOL);
scm_list_n (wind->imported_files,
wind->acct_map_info,
wind->cat_map_info,
wind->memo_map_info,
wind->security_hash,
scm_from_utf8_string (currname ? currname : ""),
wind->transaction_status,
progress,
SCM_UNDEFINED),
SCM_EOL);
gnc_progress_dialog_pop (wind->convert_progress);
if (retval == SCM_BOOL_T)
@ -3403,9 +3404,9 @@ gnc_ui_qif_import_finish_cb (GtkAssistant *assistant,
/* Save the user's mapping preferences. */
scm_result = scm_apply (save_map_prefs,
SCM_LIST5 (wind->acct_map_info, wind->cat_map_info,
wind->memo_map_info, wind->security_hash,
wind->security_prefs),
scm_list_5 (wind->acct_map_info, wind->cat_map_info,
wind->memo_map_info, wind->security_hash,
wind->security_prefs),
SCM_EOL);
if (scm_result == SCM_BOOL_F)

View File

@ -30,14 +30,14 @@
(string-append brokerage (gnc-get-account-separator-string) security))
(define (default-dividend-acct brokerage security)
(string-append (_ "Income") (gnc-get-account-separator-string)
(_ "Dividends") (gnc-get-account-separator-string)
(string-append (G_ "Income") (gnc-get-account-separator-string)
(G_ "Dividends") (gnc-get-account-separator-string)
brokerage (gnc-get-account-separator-string)
security))
(define (default-interest-acct brokerage security)
(string-append (_ "Income") (gnc-get-account-separator-string)
(_ "Interest") (gnc-get-account-separator-string)
(string-append (G_ "Income") (gnc-get-account-separator-string)
(G_ "Interest") (gnc-get-account-separator-string)
brokerage
(if (string=? security "")
""
@ -45,49 +45,49 @@
security))))
(define (default-capital-return-acct brokerage security)
(string-append (_ "Income") (gnc-get-account-separator-string)
(_ "Cap Return") (gnc-get-account-separator-string)
(string-append (G_ "Income") (gnc-get-account-separator-string)
(G_ "Cap Return") (gnc-get-account-separator-string)
brokerage (gnc-get-account-separator-string)
security))
(define (default-cglong-acct brokerage security)
(string-append (_ "Income") (gnc-get-account-separator-string)
(_ "Cap. gain (long)") (gnc-get-account-separator-string)
(string-append (G_ "Income") (gnc-get-account-separator-string)
(G_ "Cap. gain (long)") (gnc-get-account-separator-string)
brokerage (gnc-get-account-separator-string)
security))
(define (default-cgmid-acct brokerage security)
(string-append (_ "Income") (gnc-get-account-separator-string)
(_ "Cap. gain (mid)") (gnc-get-account-separator-string)
(string-append (G_ "Income") (gnc-get-account-separator-string)
(G_ "Cap. gain (mid)") (gnc-get-account-separator-string)
brokerage (gnc-get-account-separator-string)
security))
(define (default-cgshort-acct brokerage security)
(string-append (_ "Income") (gnc-get-account-separator-string)
(_ "Cap. gain (short)") (gnc-get-account-separator-string)
(string-append (G_ "Income") (gnc-get-account-separator-string)
(G_ "Cap. gain (short)") (gnc-get-account-separator-string)
brokerage (gnc-get-account-separator-string)
security))
(define (default-equity-holding security)
(string-append (_ "Equity") (gnc-get-account-separator-string)
(_ "Retained Earnings")))
(string-append (G_ "Equity") (gnc-get-account-separator-string)
(G_ "Retained Earnings")))
(define (default-equity-account)
(string-append (_ "Equity") (gnc-get-account-separator-string)
(_ "Retained Earnings")))
(string-append (G_ "Equity") (gnc-get-account-separator-string)
(G_ "Retained Earnings")))
(define (default-commission-acct brokerage)
(string-append (_ "Expenses") (gnc-get-account-separator-string)
(_ "Commissions") (gnc-get-account-separator-string)
(string-append (G_ "Expenses") (gnc-get-account-separator-string)
(G_ "Commissions") (gnc-get-account-separator-string)
brokerage))
(define (default-margin-interest-acct brokerage)
(string-append (_ "Expenses") (gnc-get-account-separator-string)
(_ "Margin Interest") (gnc-get-account-separator-string)
(string-append (G_ "Expenses") (gnc-get-account-separator-string)
(G_ "Margin Interest") (gnc-get-account-separator-string)
brokerage))
(define (default-unspec-acct)
(_ "Unspecified"))
(G_ "Unspecified"))
;; The following investment actions implicitly specify
;; the two accounts involved in the transaction.

View File

@ -82,7 +82,7 @@
;; This procedure simplifies handling of warnings.
(define (mywarn . args)
(let ((str (gnc:list-display-to-string
(append (list (_ "Line") " " line-num ": ") args))))
(append (list (G_ "Line") " " line-num ": ") args))))
(set! private-retval (list #t str))
(qif-import:log progress-dialog "qif-file:read-file" str)))
@ -90,10 +90,10 @@
;; This procedure simplifies handling of failures
(define (myfail . args)
(let ((str (gnc:list-display-to-string
(append (list (_ "Line") " " line-num ": ") args))))
(append (list (G_ "Line") " " line-num ": ") args))))
(set! private-retval (list #f str))
(qif-import:log progress-dialog "qif-file:read-file"
(string-append str "\n" (_ "Read aborted.")))
(string-append str "\n" (G_ "Read aborted.")))
(set! abort-read #t)))
(define (strip-bom)
@ -127,7 +127,7 @@
(if progress-dialog
(gnc-progress-dialog-set-sub progress-dialog
(string-append (_ "Reading") " " path)))
(string-append (G_ "Reading") " " path)))
(with-input-from-file path
(lambda ()
@ -157,12 +157,12 @@
(begin
(set! value (gnc-utf8-strip-invalid-strdup value))
(mywarn
(_ "Some characters have been discarded.")
" " (_"Converted to: ") value))
(G_ "Some characters have been discarded.")
" " (G_"Converted to: ") value))
(begin
(mywarn
(_ "Some characters have been converted according to your locale.")
" " (_"Converted to: ") converted-value)
(G_ "Some characters have been converted according to your locale.")
" " (G_"Converted to: ") converted-value)
(set! value converted-value)))))
(if (eq? tag #\!)
@ -220,7 +220,7 @@
(if (string-match "^option:"
(symbol->string qstate-type))
(begin
(mywarn (_ "Ignoring unknown option") " '"
(mywarn (G_ "Ignoring unknown option") " '"
qstate-type "'")
(set! qstate-type old-qstate))))))
@ -354,8 +354,8 @@
(if (qif-xtn:date current-xtn)
(qif-file:add-xtn! self current-xtn)
;; The date is missing! Warn the user.
(mywarn (_ "Date required.") " "
(_ "Discarding this transaction.")))
(mywarn (G_ "Date required.") " "
(G_ "Discarding this transaction.")))
;;(write current-xtn) (newline)
(set! current-xtn (make-qif-xtn))
@ -387,7 +387,7 @@
(set! current-xtn (make-qif-class)))
(else
(mywarn (_ "Ignoring class line") ": " line))))
(mywarn (G_ "Ignoring class line") ": " line))))
;;;;;;;;;;;;;;;;;;
@ -455,7 +455,7 @@
(set! current-xtn (make-qif-cat)))
(else
(mywarn (_ "Ignoring category line") ": " line))))
(mywarn (G_ "Ignoring category line") ": " line))))
;;;;;;;;;;;;;;;;;;;
@ -486,7 +486,7 @@
(set! current-xtn (make-qif-stock-symbol)))
(else
(mywarn (_ "Ignoring security line") ": " line))))
(mywarn (G_ "Ignoring security line") ": " line))))
;; trying to sneak one by, eh?
@ -494,7 +494,7 @@
(if (and (not qstate-type)
(not (string=? (string-trim line) "")))
(myfail
(_ "File does not appear to be in QIF format")
(G_ "File does not appear to be in QIF format")
": " line)))))
;; Report the progress.
@ -670,18 +670,18 @@
(qif-import:log progress-dialog
"qif-file:parse-fields"
(string-append (case t
((date) (_ "Transaction date"))
((split-amounts) (_ "Transaction amount"))
((share-price) (_ "Share price"))
((num-shares) (_ "Share quantity"))
((action) (_ "Investment action"))
((cleared) (_ "Reconciliation status"))
((commission) (_ "Commission"))
((acct-type) (_ "Account type"))
((tax-class) (_ "Tax class"))
((budget-amt) (_ "Category budget amount"))
((budget) (_ "Account budget amount"))
((limit) (_ "Credit limit"))
((date) (G_ "Transaction date"))
((split-amounts) (G_ "Transaction amount"))
((share-price) (G_ "Share price"))
((num-shares) (G_ "Share quantity"))
((action) (G_ "Investment action"))
((cleared) (G_ "Reconciliation status"))
((commission) (G_ "Commission"))
((acct-type) (G_ "Account type"))
((tax-class) (G_ "Tax class"))
((budget-amt) (G_ "Category budget amount"))
((budget) (G_ "Account budget amount"))
((limit) (G_ "Credit limit"))
(else (symbol->string t)))
": " e)))
;; Save the error condition.
@ -694,7 +694,7 @@
;;
;; Fields of categories.
;;
(set-sub (_ "Parsing categories"))
(set-sub (G_ "Parsing categories"))
;; The category tasks will be 5% of the overall parsing effort.
(start-sub 0.05)
@ -726,7 +726,7 @@
;;
;; Fields of accounts
;;
(set-sub (_ "Parsing accounts"))
(set-sub (G_ "Parsing accounts"))
;; The account tasks will be 5% of the overall parsing effort.
(start-sub 0.05)
@ -767,7 +767,7 @@
;;
;; fields of transactions
;;
(set-sub (_ "Parsing transactions"))
(set-sub (G_ "Parsing transactions"))
;; Transaction parsing takes up the rest of the overall parsing effort.
(start-sub 1)
@ -943,7 +943,7 @@
((or (not formats)
(null? formats))
;; Data was not in any of the supplied formats.
(errorproc errortype (_ "Unrecognized or inconsistent format."))
(errorproc errortype (G_ "Unrecognized or inconsistent format."))
(set! retval #f)
(set! do-parsing #f))
@ -985,7 +985,7 @@
(begin
(set! retval #f)
(errorproc errortype
(_ "Parsing failed.")))))))
(G_ "Parsing failed.")))))))
(set! work-done (+ 1 work-done))
(reporter (/ work-done work-to-do)))
objects))
@ -1026,9 +1026,9 @@
(if (not (eq? errortype 'date))
(errorproc errortype
(gnc:list-display-to-string (list
(_ "Parse ambiguity between formats") " "
(G_ "Parse ambiguity between formats") " "
formats "\n"
(format #f (_ "Value '~a' could be ~a or ~a.")
(format #f (G_ "Value '~a' could be ~a or ~a.")
parsed
(printer parsed)
(printer this-parsed))))))))))

View File

@ -87,7 +87,7 @@
(when progress-dialog
(gnc-progress-dialog-set-sub progress-dialog
(_ "Finding duplicate transactions")))
(G_ "Finding duplicate transactions")))
(let loop ((new-splits new-splits)
(work-done 0)

View File

@ -142,7 +142,7 @@
(list "oth s" GNC-ASSET-TYPE GNC-BANK-TYPE GNC-CASH-TYPE)
(list "mutual" GNC-BANK-TYPE)))
(or (assoc-ref string-map-alist (string-downcase! (string-trim-both read-value)))
(let ((msg (format #f (_ "Unrecognized account type '~s'. Defaulting to Bank.")
(let ((msg (format #f (G_ "Unrecognized account type '~s'. Defaulting to Bank.")
read-value)))
(errorproc errortype msg)
(list GNC-BANK-TYPE))))
@ -205,7 +205,7 @@
(and read-value
(let ((sym (string->symbol (string-downcase (string-trim-both read-value)))))
(or (any (lambda (lst) (and (memq sym lst) (car lst))) action-map)
(let ((msg (format #f (_ "Unrecognized action '~a'.") read-value)))
(let ((msg (format #f (G_ "Unrecognized action '~a'.") read-value)))
(errorproc errortype msg))))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@ -224,7 +224,7 @@
(not (string-null? read-value))
(let* ((secondchar (string-ref read-value 0)))
(or (any (lambda (m) (and (memq secondchar (cdr m)) (car m))) maplist)
(let ((msg (format #f (_ "Unrecognized status '~a'. Defaulting to uncleared.")
(let ((msg (format #f (G_ "Unrecognized status '~a'. Defaulting to uncleared.")
read-value)))
(errorproc errortype msg))))))

View File

@ -193,7 +193,7 @@
(xaccAccountSetName new-acct new-name)
(xaccAccountSetDescription
new-acct
(_ "QIF import: Name conflict with another account."))))
(G_ "QIF import: Name conflict with another account."))))
;; Set the account type.
(xaccAccountSetType new-acct
@ -282,7 +282,7 @@
(if progress-dialog
(gnc-progress-dialog-set-sub progress-dialog
(_ "Preparing to convert your QIF data")))
(G_ "Preparing to convert your QIF data")))
;; Build a list of all accounts to create for the import tree.
;; We need to iterate over the account, category, and payee/memo
@ -333,7 +333,7 @@
;; Build a local account tree to hold converted transactions.
(if progress-dialog
(gnc-progress-dialog-set-sub progress-dialog
(_ "Creating accounts")))
(G_ "Creating accounts")))
;; Sort the account list on the depth of the account path. If a
;; short part is explicitly mentioned, make sure it gets created
@ -382,7 +382,7 @@
;; duplicates. marked transactions/splits won't get imported.
(if progress-dialog
(gnc-progress-dialog-set-sub progress-dialog
(_ "Matching transfers between accounts")))
(G_ "Matching transfers between accounts")))
(if (> (length markable-xtns) 1)
(let xloop ((xtn (car markable-xtns))
(rest (cdr markable-xtns)))
@ -400,7 +400,7 @@
(lambda (qif-file)
(if progress-dialog
(gnc-progress-dialog-set-sub progress-dialog
(string-append (_ "Converting") " "
(string-append (G_ "Converting") " "
(qif-file:path qif-file))))
(for-each
(lambda (xtn)
@ -480,7 +480,7 @@
((not qif-date)
(qif-import:log progress-dialog
"qif-import:qif-xtn-to-gnc-xtn"
(_ "Missing transaction date."))
(G_ "Missing transaction date."))
(throw 'bad-date
"qif-import:qif-xtn-to-gnc-xtn"
"Missing transaction date."

View File

@ -403,7 +403,7 @@
prices)))
(define (show-error msg)
(gnc:gui-error msg (_ msg)))
(gnc:gui-error msg (G_ msg)))
;; Add the alphavantage api key to the environment. This value is taken from
;; the Online Quotes preference tab
@ -453,7 +453,7 @@ Run 'gnc-fq-update' as root to install them.")))
((memq 'need-alphavantage-key fq-results)
(set! keep-going? #f)
(gnc-error-dialog
window (format #f (_ "ERROR: ALPHAVANTAGE_API_KEY must be set for currency and quotes; see ~A")
window (format #f (G_ "ERROR: ALPHAVANTAGE_API_KEY must be set for currency and quotes; see ~A")
"https://wiki.gnucash.org/wiki/Online_Quotes#Source_Alphavantage.2C_US")))
((memq 'system-error fq-results)
@ -485,18 +485,18 @@ Run 'gnc-fq-update' as root to install them.")))
(gnc-verify-dialog
window #t (with-output-to-string
(lambda ()
(display (_ "Unable to retrieve quotes for these items:"))
(display (G_ "Unable to retrieve quotes for these items:"))
(display "\n ")
(display (string-join problem-syms "\n "))
(newline)
(display (_ "Continue using only the good quotes?")))))))
(display (G_ "Continue using only the good quotes?")))))))
(else
(set! keep-going? #f)
(gnc-error-dialog
window (with-output-to-string
(lambda ()
(display (_ "Unable to retrieve quotes for these items:"))
(display (G_ "Unable to retrieve quotes for these items:"))
(display "\n ")
(display (string-join problem-syms "\n ")))))))))
@ -511,11 +511,11 @@ Run 'gnc-fq-update' as root to install them.")))
window #t
(with-output-to-string
(lambda ()
(display (_ "Unable to create prices for these items:"))
(display (G_ "Unable to create prices for these items:"))
(display "\n ")
(display (string-join (filter string? prices) "\n "))
(newline)
(display (_ "Add remaining good quotes?"))))))
(display (G_ "Add remaining good quotes?"))))))
(gnc:warn
(with-output-to-string
(lambda ()
@ -533,7 +533,7 @@ Run 'gnc-fq-update' as root to install them.")))
(cond
((list? sources)
;; Translators: ~A is the version string
(format #t (_ "Found Finance::Quote version ~A.") (car sources))
(format #t (G_ "Found Finance::Quote version ~A.") (car sources))
(newline)
(gnc:msg "Found Finance::Quote version " (car sources))
(gnc-quote-source-set-fq-installed (car sources) (cdr sources))))))

View File

@ -192,6 +192,8 @@ gnc_quickfill_cell_modify_verify (BasicCell *_cell,
gnc_quickfill_cell_set_original (cell, NULL);
gnc_basic_cell_set_value_internal (&cell->cell, newval);
// Remove any selection.
*end_selection = *start_selection = *cursor_position;
return;
}

View File

@ -530,9 +530,11 @@ gnc_combo_cell_type_ahead_search (const gchar* newval,
int num_found = 0;
gchar* match_str = NULL;
const char* sep = gnc_get_account_separator_string ();
gchar* newval_rep = g_strdup_printf (".*%s.*", sep);
GRegex* regex0 = g_regex_new (sep, 0, 0, NULL);
char* rep_str = g_regex_replace_literal (regex0, newval, -1, 0,
char* escaped_sep = g_regex_escape_string (sep, -1);
char* escaped_newval = g_regex_escape_string (newval, -1);
gchar* newval_rep = g_strdup_printf (".*%s.*", escaped_sep);
GRegex* regex0 = g_regex_new (escaped_sep, 0, 0, NULL);
char* rep_str = g_regex_replace_literal (regex0, escaped_newval, -1, 0,
newval_rep, 0, NULL);
GRegex *regex = g_regex_new (rep_str, G_REGEX_CASELESS, 0, NULL);
@ -546,6 +548,8 @@ gnc_combo_cell_type_ahead_search (const gchar* newval,
g_free (rep_str);
g_free (newval_rep);
g_free (escaped_sep);
g_free (escaped_newval);
g_regex_unref (regex0);
block_list_signals (cell); //Prevent recursion from gtk_tree_view signals.

View File

@ -413,7 +413,38 @@ gnucash_sheet_activate_cursor_cell (GnucashSheet *sheet,
}
else
{
gnucash_sheet_set_selection_from_entry (sheet);
GncItemEdit *item_edit = GNC_ITEM_EDIT(sheet->item_editor);
Table *table = sheet->table;
const char *text = gnc_table_get_entry (table, virt_loc);
PangoLayout *layout;
PangoRectangle logical_rect;
GdkRectangle rect;
gint x, y, width, height;
gint index = 0, trailing = 0;
gboolean result;
gint x_offset = 0;
if (text && *text)
{
// Get the item_edit position
gnc_item_edit_get_pixel_coords (item_edit, &x, &y,
&width, &height);
layout = gtk_widget_create_pango_layout (GTK_WIDGET (sheet),
text);
// We don't need word wrap or line wrap
pango_layout_set_width (layout, -1);
pango_layout_get_pixel_extents (layout, NULL, &logical_rect);
gnucash_sheet_set_text_bounds (sheet, &rect, x, y,
width, height);
x_offset = gnucash_sheet_get_text_offset (sheet, virt_loc,
rect.width,
logical_rect.width);
pango_layout_xy_to_index (layout,
PANGO_SCALE * (sheet->button_x - rect.x - x_offset),
PANGO_SCALE * (height/2), &index, &trailing);
g_object_unref (layout);
}
gnucash_sheet_set_position (sheet, index + trailing);
}
sheet->direct_update_cell =
gnucash_sheet_check_direct_update_cell (sheet, virt_loc);
@ -1164,18 +1195,10 @@ gnucash_sheet_delete_cb (GtkWidget *widget,
&start_sel, &end_sel,
&sheet->input_cancelled);
if (retval && (strcmp (retval, new_text) != 0))
{
if (retval)
gnucash_sheet_set_entry_value (sheet, retval);
g_signal_stop_emission_by_name (G_OBJECT(sheet->entry),
"delete_text");
}
else if (retval == NULL)
{
/* the entry was disallowed, so we stop the delete signal */
g_signal_stop_emission_by_name (G_OBJECT(sheet->entry),
"delete_text");
}
g_signal_stop_emission_by_name (G_OBJECT(sheet->entry), "delete_text");
DEBUG ("%s", retval ? retval : "nothing");
gnucash_sheet_set_position_and_selection (sheet, cursor_position,

View File

@ -99,8 +99,11 @@
;; If no file is found, returns just 'fname' for use in error messages.
(find-internal "templates" fname))
; Define syntax for more readable for loops (the built-in for-each requires an
; explicit lambda and has the list expression all the way at the end).
;; Define syntax for more readable for loops (the built-in for-each
;; requires an explicit lambda and has the list expression all the way
;; at the end). Note: deprecated in 4.x, removal in 5.x. this syntax
;; is pythonic rather than lispy, is not recognized by code
;; highlighters, and is not necessary to seasoned schemers.
(export for)
(define-syntax for
(syntax-rules (for in do)
@ -110,8 +113,12 @@
;; Note that this template must be defined before the
;; next one, since the template are evaluated in-order.
((for (<var> ...) in (<list> ...) do <expr> ...)
(for-each (lambda (<var> ...) <expr> ...) <list> ...))
(begin
(issue-deprecation-warning "for loops are deprecated. use for-each instead.")
(for-each (lambda (<var> ...) <expr> ...) <list> ...)))
;; Single variable and list. e.g.: (for a in lst do (display a))
((for <var> in <list> do <expr> ...)
(for-each (lambda (<var>) <expr> ...) <list>))))
(begin
(issue-deprecation-warning "for loops are deprecated. use for-each instead.")
(for-each (lambda (<var>) <expr> ...) <list>)))))

View File

@ -152,7 +152,7 @@
(define (eguile-file-to-string infile environment)
(cond
((not (access? infile R_OK))
(format #f (_ "Template file \"~a\" can not be read") infile))
(format #f (G_ "Template file \"~a\" can not be read") infile))
(else
(let ((script (with-input-from-file infile
(lambda ()

View File

@ -591,13 +591,13 @@
(balance-mode (or (get-val env 'balance-mode) 'post-closing))
(closing-pattern (or (get-val env 'closing-pattern)
(list
(list 'str (_ "Closing Entries"))
(list 'str (G_ "Closing Entries"))
(list 'cased #f)
(list 'regexp #f)
(list 'closing #t))))
(adjusting-pattern (or (get-val env 'adjusting-pattern)
(list
(list 'str (_ "Adjusting Entries"))
(list 'str (G_ "Adjusting Entries"))
(list 'cased #f)
(list 'regexp #f))))
(report-budget (or (get-val env 'report-budget) #f))
@ -790,7 +790,7 @@
(not children-displayed?)
(and (gnc-commodity-collector-allzero? recursive-bal)
(eq? zero-mode 'omit-leaf-acct)))
(let ((lbl-txt (gnc:make-html-text (_ "Total") " ")))
(let ((lbl-txt (gnc:make-html-text (G_ "Total") " ")))
(apply gnc:html-text-append! lbl-txt (gnc:html-text-body label))
(if (eq? subtotal-mode 'canonically-tabbed)
(set! disp-depth (+ disp-depth 1))

View File

@ -24,48 +24,31 @@
;; Boston, MA 02110-1301, USA gnu@gnu.org
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(define <html-anytag>
(make-record-type "<html-anytag>"
'(tag
data
style
)))
(define gnc:html-anytag?
(record-predicate <html-anytag>))
(use-modules (srfi srfi-9))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; <html-anytag> class
;; wrapper around HTML anytags
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(define gnc:make-html-anytag-internal
(record-constructor <html-anytag>))
(define-record-type <html-anytag>
(make-html-anytag tag data style)
html-anytag?
(tag html-anytag-tag html-anytag-set-tag!)
(data html-anytag-data html-anytag-set-data!)
(style html-anytag-style html-anytag-set-style!))
(define gnc:html-anytag? html-anytag?)
(define gnc:make-html-anytag-internal make-html-anytag)
(define gnc:html-anytag-tag html-anytag-tag)
(define gnc:html-anytag-set-tag! html-anytag-set-tag!)
(define gnc:html-anytag-data html-anytag-data)
(define gnc:html-anytag-set-data! html-anytag-set-data!)
(define gnc:html-anytag-style html-anytag-style)
(define gnc:html-anytag-set-style-internal! html-anytag-set-style!)
(define (gnc:make-html-anytag tag . data)
(gnc:make-html-anytag-internal
tag ;; tag
data ;; data
(gnc:make-html-style-table) ;; style
))
(define gnc:html-anytag-tag
(record-accessor <html-anytag> 'tag))
(define gnc:html-anytag-set-tag!
(record-modifier <html-anytag> 'tag))
(define gnc:html-anytag-data
(record-accessor <html-anytag> 'data))
(define gnc:html-anytag-set-data!
(record-modifier <html-anytag> 'data))
(define gnc:html-anytag-style
(record-accessor <html-anytag> 'style))
(define gnc:html-anytag-set-style-internal!
(record-modifier <html-anytag> 'style))
(gnc:make-html-anytag-internal tag data (gnc:make-html-style-table)))
(define (gnc:html-anytag-append-data! anytag . data)
(gnc:html-anytag-set-data!
@ -114,8 +97,10 @@
'attribute (list "class" class))
anytag))
(define (gnc:make-html-div . data) ;ideally should have been (gnc:make-html-anytag "div" data) but it will inherit parent div class.
(apply gnc:make-html-div/markup (cons "" data))) ;so we have to redo as an empty-string. so annoying!
;;ideally should have been (gnc:make-html-anytag "div" data) but it
;;will inherit parent div class.
(define (gnc:make-html-div . data)
(apply gnc:make-html-div/markup (cons "" data)))
(define (gnc:make-html-span . data)
(apply gnc:make-html-span/markup (cons "" data)))

View File

@ -22,7 +22,7 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(define <html-barchart>
(make-record-type "<html-barchart>"
(make-record-type '<html-barchart>
'(width
height
title

View File

@ -25,6 +25,7 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(use-modules (gnucash json builder)) ;for building JSON options
(use-modules (srfi srfi-9))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
@ -106,26 +107,42 @@
;; width - pair
;; height - pair
(define <html-chart>
(make-record-type "<html-chart>"
'(width
height
chart-options
currency-iso
currency-symbol
custom-x-axis-ticks?
custom-y-axis-ticks?)))
(define-record-type <html-chart>
(make-html-chart width height chart-options currency-iso
currency-symbol custom-x-axis-ticks? custom-y-axis-ticks?)
html-chart?
(width html-chart-width html-chart-set-width)
(height html-chart-height html-chart-set-height)
(chart-options html-chart-chart-options html-chart-set-chart-options)
(currency-iso html-chart-currency-iso html-chart-set-currency-iso)
(currency-symbol html-chart-currency-symbol html-chart-set-currency-symbol)
(custom-x-axis-ticks? html-chart-custom-x-axis-ticks?
html-chart-set-custom-x-axis-ticks?)
(custom-y-axis-ticks? html-chart-custom-y-axis-ticks?
html-chart-set-custom-y-axis-ticks?))
(define gnc:html-chart?
(record-predicate <html-chart>))
(define gnc:make-html-chart-internal make-html-chart)
(define gnc:html-chart? html-chart?)
(define gnc:html-chart-width html-chart-width)
(define gnc:html-chart-set-width! html-chart-set-width)
(define gnc:html-chart-height html-chart-height)
(define gnc:html-chart-set-height! html-chart-set-height)
(define gnc:html-chart-currency-iso html-chart-currency-iso)
(define gnc:html-chart-set-currency-iso! html-chart-set-currency-iso)
(define gnc:html-chart-currency-symbol html-chart-currency-symbol)
(define gnc:html-chart-set-currency-symbol! html-chart-set-currency-symbol)
(define gnc:html-chart-custom-x-axis-ticks? html-chart-custom-x-axis-ticks?)
(define gnc:html-chart-set-custom-x-axis-ticks?! html-chart-set-custom-x-axis-ticks?)
(define gnc:html-chart-custom-y-axis-ticks? html-chart-custom-y-axis-ticks?)
(define gnc:html-chart-set-custom-y-axis-ticks?! html-chart-set-custom-y-axis-ticks?)
(define gnc:html-chart-get-options-internal html-chart-chart-options)
(define gnc:html-chart-set-options-internal! html-chart-set-chart-options)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; <html-chart> class
;; generate the <object> form for an html chart.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(define gnc:make-html-chart-internal
(record-constructor <html-chart>))
(define (gnc:make-html-chart)
(gnc:make-html-chart-internal
@ -207,18 +224,6 @@
#t ;custom y-axis ticks?
))
(define gnc:html-chart-width
(record-accessor <html-chart> 'width))
(define gnc:html-chart-set-width!
(record-modifier <html-chart> 'width))
(define gnc:html-chart-height
(record-accessor <html-chart> 'height))
(define gnc:html-chart-set-height!
(record-modifier <html-chart> 'height))
(define (gnc:html-chart-type chart)
(gnc:html-chart-get chart '(type)))
@ -288,12 +293,6 @@
(define-public (gnc:html-chart-set-y-axis-label! chart label)
(gnc:html-chart-set! chart '(options scales yAxes (0) scaleLabel labelString) label))
(define gnc:html-chart-get-options-internal
(record-accessor <html-chart> 'chart-options))
(define gnc:html-chart-set-options-internal!
(record-modifier <html-chart> 'chart-options))
(define (gnc:html-chart-get chart path)
(let ((options (gnc:html-chart-get-options-internal chart)))
(nested-alist-get options path)))
@ -304,30 +303,6 @@
(nested-alist-set! options path val-vec)
(gnc:html-chart-set-options-internal! chart options)))
(define gnc:html-chart-currency-iso
(record-accessor <html-chart> 'currency-iso))
(define gnc:html-chart-set-currency-iso!
(record-modifier <html-chart> 'currency-iso))
(define gnc:html-chart-currency-symbol
(record-accessor <html-chart> 'currency-symbol))
(define gnc:html-chart-set-currency-symbol!
(record-modifier <html-chart> 'currency-symbol))
(define gnc:html-chart-custom-x-axis-ticks?
(record-accessor <html-chart> 'custom-x-axis-ticks?))
(define-public gnc:html-chart-set-custom-x-axis-ticks?!
(record-modifier <html-chart> 'custom-x-axis-ticks?))
(define gnc:html-chart-custom-y-axis-ticks?
(record-accessor <html-chart> 'custom-y-axis-ticks?))
(define-public gnc:html-chart-set-custom-y-axis-ticks?!
(record-modifier <html-chart> 'custom-y-axis-ticks?))
(define JS-Number-to-String "
// The following snippet from MDN
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/toLocaleString
@ -439,7 +414,7 @@ document.getElementById(chartid).onclick = function(evt) {
(push (format #f "var currsym = ~s;\n" (gnc:html-chart-currency-symbol chart)))
(push (format #f "var chartid = 'chart-~a';\n" id))
(push (format #f "var jumpid = 'jump-~a';\n" id))
(push (format #f "var loadstring = ~s;\n" (_ "Load")))
(push (format #f "var loadstring = ~s;\n" (G_ "Load")))
(push (format #f "var chartjsoptions = ~a;\n\n"
(get-options-string chart)))

View File

@ -22,6 +22,7 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(use-modules (gnucash html))
(use-modules (srfi srfi-9))
(use-modules (ice-9 match))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@ -29,15 +30,35 @@
;; this is the top-level object representing an entire HTML document.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(define <html-document>
(make-record-type "<html-document>"
'(style-sheet style-stack style style-text title headline objects)))
(define-record-type <html-document>
(make-html-document-internal style-sheet style-stack style
style-text title headline objects)
html-document?
(style-sheet html-document-style-sheet html-document-set-style-sheet)
(style-stack html-document-style-stack html-document-set-style-stack)
(style html-document-style html-document-set-style)
(style-text html-document-style-text html-document-set-style-text)
(title html-document-title html-document-set-title)
(headline html-document-headline html-document-set-headline)
(objects html-document-objects html-document-set-objects))
(define gnc:html-document?
(record-predicate <html-document>))
(define gnc:make-html-document-internal
(record-constructor <html-document>))
(define gnc:html-document-set-title! html-document-set-title)
(define gnc:html-document-title html-document-title)
(define gnc:html-document-set-headline! html-document-set-headline)
(define gnc:html-document-headline html-document-headline)
(define gnc:html-document-set-style-sheet! html-document-set-style-sheet)
(define gnc:html-document-set-style-sheet! html-document-set-style-sheet)
(define gnc:html-document-style-sheet html-document-style-sheet)
(define gnc:html-document-set-style-stack! html-document-set-style-stack)
(define gnc:html-document-style-stack html-document-style-stack)
(define gnc:html-document-set-style-text! html-document-set-style-text)
(define gnc:html-document-style-text html-document-style-text)
(define gnc:html-document-set-style-internal! html-document-set-style)
(define gnc:html-document-style html-document-style)
(define gnc:html-document-set-objects! html-document-set-objects)
(define gnc:html-document-objects html-document-objects)
(define gnc:html-document? html-document?)
(define gnc:make-html-document-internal make-html-document-internal)
(define (gnc:make-html-document)
(gnc:make-html-document-internal
@ -50,54 +71,6 @@
'() ;; subobjects
))
(define gnc:html-document-set-title!
(record-modifier <html-document> 'title))
(define gnc:html-document-title
(record-accessor <html-document> 'title))
(define gnc:html-document-set-headline!
(record-modifier <html-document> 'headline))
(define gnc:html-document-headline
(record-accessor <html-document> 'headline))
(define gnc:html-document-set-style-sheet!
(record-modifier <html-document> 'style-sheet))
(define gnc:html-document-set-style-sheet!
(record-modifier <html-document> 'style-sheet))
(define gnc:html-document-style-sheet
(record-accessor <html-document> 'style-sheet))
(define gnc:html-document-set-style-stack!
(record-modifier <html-document> 'style-stack))
(define gnc:html-document-style-stack
(record-accessor <html-document> 'style-stack))
(define gnc:html-document-set-style-text!
(record-modifier <html-document> 'style-text))
(define gnc:html-document-style-text
(record-accessor <html-document> 'style-text))
(define gnc:html-document-set-style-internal!
(record-modifier <html-document> 'style))
(define gnc:html-document-style
(record-accessor <html-document> 'style))
(define gnc:html-document-set-objects!
(record-modifier <html-document> 'objects))
(define gnc:html-document-objects
(record-accessor <html-document> 'objects))
(define gnc:html-document?
(record-predicate <html-document>))
(define (gnc:html-document-set-style! doc tag . rest)
(gnc:html-style-table-set!
(gnc:html-document-style doc) tag
@ -292,14 +265,18 @@
;; want.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(define <html-object>
(make-record-type "<html-object>"
'(renderer data)))
(define gnc:html-object?
(record-predicate <html-object>))
(define-record-type <html-object>
(make-html-object-internal renderer data)
html-object?
(renderer html-object-renderer html-object-set-renderer!)
(data html-object-data html-object-set-data!))
(define gnc:make-html-object-internal
(record-constructor <html-object>))
(define gnc:html-object? html-object?)
(define gnc:make-html-object-internal make-html-object-internal)
(define gnc:html-object-renderer html-object-renderer)
(define gnc:html-object-set-renderer! html-object-set-renderer!)
(define gnc:html-object-data html-object-data)
(define gnc:html-object-set-data! html-object-set-data!)
(define (gnc:make-html-object obj)
(cond
@ -347,18 +324,6 @@
(lambda (obj doc)
(gnc:html-document-render-data doc obj)) obj))))
(define gnc:html-object-renderer
(record-accessor <html-object> 'renderer))
(define gnc:html-object-set-renderer!
(record-modifier <html-object> 'renderer))
(define gnc:html-object-data
(record-accessor <html-object> 'data))
(define gnc:html-object-set-data!
(record-modifier <html-object> 'data))
(define (gnc:html-object-render obj doc)
(if (gnc:html-object? obj)
((gnc:html-object-renderer obj) (gnc:html-object-data obj) doc)

View File

@ -156,4 +156,5 @@
"td.total-number-cell { " total-number-cell-info " }\n"
"td.total-label-cell { " total-label-cell-info " }\n"
"td.centered-label-cell { text-align: center; " centered-label-cell-info " }\n"
"@media print { html, body { height: unset; }}\n"
(or (gnc:html-document-style-text doc) "")))))

View File

@ -25,7 +25,7 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(define <html-linechart>
(make-record-type "<html-linechart>"
(make-record-type '<html-linechart>
'(width
height
title

View File

@ -22,7 +22,7 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(define <html-piechart>
(make-record-type "<html-piechart>"
(make-record-type '<html-piechart>
'(width
height
title

View File

@ -25,7 +25,7 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(define <html-scatter>
(make-record-type "<html-scatter>"
(make-record-type '<html-scatter>
'(width
height
title

View File

@ -22,6 +22,7 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(use-modules (ice-9 match))
(use-modules (srfi srfi-9))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; <html-markup-style-info> class
@ -38,31 +39,36 @@
;; attribute : single attribute-value pair in a list
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(define-record-type <html-markup-style-info>
(make-html-markup-style-info-internal tag attributes inheritable?)
html-markup-style-info?
(tag style-info-tag style-info-set-tag)
(attributes style-info-attributes style-info-set-attributes)
(inheritable? style-info-inheritable? style-info-set-inheritable?))
(define <html-markup-style-info>
(make-record-type "<html-markup-style-info>"
'(tag
attributes
inheritable?)))
(define gnc:html-markup-style-info?
(record-predicate <html-markup-style-info>))
(define gnc:make-html-markup-style-info-internal
(record-constructor <html-markup-style-info>))
(define gnc:make-html-markup-style-info-internal make-html-markup-style-info-internal)
(define gnc:html-markup-style-info? html-markup-style-info?)
(define gnc:html-markup-style-info-tag style-info-tag)
(define gnc:html-markup-style-info-set-tag! style-info-set-tag)
(define gnc:html-markup-style-info-attributes style-info-attributes)
(define gnc:html-markup-style-info-set-attributes! style-info-set-attributes)
(define gnc:html-markup-style-info-inheritable? style-info-inheritable?)
(define gnc:html-markup-style-info-set-inheritable?! style-info-set-inheritable?)
(define (gnc:make-html-markup-style-info . rest)
(let ((retval (gnc:make-html-markup-style-info-internal
#f (make-hash-table) #t)))
(let ((retval (gnc:make-html-markup-style-info-internal #f (make-hash-table) #t)))
(apply gnc:html-markup-style-info-set! retval rest)
retval))
(define (gnc:html-markup-style-info-set! style . rest)
(let loop ((arglist rest))
(match arglist
(('attribute (key . val) . rest)
(gnc:html-markup-style-info-set-attribute!
style key (and (pair? val) (car val)))
(('attribute (key val) . rest)
(gnc:html-markup-style-info-set-attribute! style key val)
(loop rest))
(('attribute (key) . rest)
(gnc:html-markup-style-info-set-attribute! style key #f)
(loop rest))
((field value . rest)
@ -71,24 +77,6 @@
(else style))))
(define gnc:html-markup-style-info-tag
(record-accessor <html-markup-style-info> 'tag))
(define gnc:html-markup-style-info-set-tag!
(record-modifier <html-markup-style-info> 'tag))
(define gnc:html-markup-style-info-attributes
(record-accessor <html-markup-style-info> 'attributes))
(define gnc:html-markup-style-info-set-attributes!
(record-modifier <html-markup-style-info> 'attributes))
(define gnc:html-markup-style-info-inheritable?
(record-accessor <html-markup-style-info> 'inheritable?))
(define gnc:html-markup-style-info-set-inheritable?!
(record-modifier <html-markup-style-info> 'inheritable?))
(define (gnc:html-markup-style-info-set-attribute! info attr val)
(hash-set! (gnc:html-markup-style-info-attributes info) attr val))
@ -144,41 +132,25 @@
;; style. The return should be an HTML string.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(define <html-data-style-info>
(make-record-type "<html-data-style-info>"
'(renderer data inheritable?)))
(define-record-type <html-data-style-info>
(make-html-data-style-info-internal renderer data inheritable?)
data-style-info?
(renderer html-data-style-info-renderer html-data-style-info-set-renderer)
(data html-data-style-info-data html-data-style-info-set-data)
(inheritable? html-data-style-info-inherit html-data-style-info-set-inherit))
(define gnc:html-data-style-info?
(record-predicate <html-data-style-info>))
(define gnc:make-html-data-style-info-internal
(record-constructor <html-data-style-info>))
(define gnc:make-html-data-style-info-internal make-html-data-style-info-internal)
(define gnc:html-data-style-info? data-style-info?)
(define gnc:html-data-style-info-renderer html-data-style-info-renderer)
(define gnc:html-data-style-info-set-renderer! html-data-style-info-set-renderer)
(define gnc:html-data-style-info-data html-data-style-info-data)
(define gnc:html-data-style-info-set-data! html-data-style-info-set-data)
(define gnc:html-data-style-info-inheritable? html-data-style-info-inherit)
(define gnc:html-data-style-info-set-inheritable?! html-data-style-info-set-inherit)
(define (gnc:make-html-data-style-info renderer data)
(gnc:make-html-data-style-info-internal renderer data #t))
(define gnc:html-data-style-info?
(record-predicate <html-data-style-info>))
(define gnc:html-data-style-info-renderer
(record-accessor <html-data-style-info> 'renderer))
(define gnc:html-data-style-info-set-renderer!
(record-modifier <html-data-style-info> 'renderer))
(define gnc:html-data-style-info-data
(record-accessor <html-data-style-info> 'data))
(define gnc:html-data-style-info-set-data!
(record-modifier <html-data-style-info> 'data))
(define gnc:html-data-style-info-inheritable?
(record-accessor <html-data-style-info> 'inheritable?))
(define gnc:html-data-style-info-set-inheritable?!
(record-modifier <html-data-style-info> 'inheritable?))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; default renderers for some data types.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@ -216,37 +188,24 @@
;; deserves a record structure.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(define <html-style-table>
(make-record-type "<html-style-table>"
'(primary compiled inheritable)))
(define gnc:html-style-table?
(record-predicate <html-style-table>))
(define gnc:make-html-style-table-internal
(record-constructor <html-style-table>))
(define-record-type <html-style-table>
(make-html-style-table primary compiled inheritable)
html-style-table?
(primary html-style-table-primary)
(compiled html-style-table-compiled html-style-table-set-compiled!)
(inheritable html-style-table-inheritable html-style-table-set-inheritable!))
(define gnc:html-style-table? html-style-table?)
(define gnc:make-html-style-table-internal make-html-style-table)
(define gnc:html-style-table-primary html-style-table-primary)
(define gnc:html-style-table-set-compiled! html-style-table-set-compiled!)
(define gnc:html-style-table-inheritable html-style-table-inheritable)
(define gnc:html-style-table-set-inheritable! html-style-table-set-inheritable!)
(define gnc:html-style-table-compiled html-style-table-compiled)
(define gnc:html-style-table-compiled? gnc:html-style-table-compiled)
(define (gnc:make-html-style-table)
(gnc:make-html-style-table-internal (make-hash-table) #f #f))
(define gnc:html-style-table-primary
(record-accessor <html-style-table> 'primary))
(define gnc:html-style-table-compiled
(record-accessor <html-style-table> 'compiled))
(define gnc:html-style-table-set-compiled!
(record-modifier <html-style-table> 'compiled))
(define gnc:html-style-table-inheritable
(record-accessor <html-style-table> 'inheritable))
(define gnc:html-style-table-set-inheritable!
(record-modifier <html-style-table> 'inheritable))
(define (gnc:html-style-table-compiled? table)
(gnc:html-style-table-compiled table))
(define (gnc:html-style-table-compile table antecedents)
;; merge a key-value pair from an antecedent into the
;; compiled table. Only add values to the inheritable table

View File

@ -21,42 +21,30 @@
;; Boston, MA 02110-1301, USA gnu@gnu.org
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(use-modules (srfi srfi-9))
(use-modules (ice-9 match))
(use-modules (gnucash core-utils))
(define *gnc:_style-sheet-templates_* (make-hash-table 23))
(define *gnc:_style-sheets_* (make-hash-table 23))
(define <html-style-sheet-template>
(make-record-type "<html-style-sheet-template>"
'(version name options-generator renderer)))
(define-record-type <html-style-sheet-template>
(make-ss-template version name options-generator renderer)
ss-template?
(version ss-template-version ss-template-set-version!)
(name ss-template-name ss-template-set-name!)
(options-generator ss-template-options-generator ss-template-set-options-generator!)
(renderer ss-template-renderer ss-template-set-renderer!))
(define gnc:html-style-sheet-template?
(record-predicate <html-style-sheet-template>))
(define gnc:html-style-sheet-template-version
(record-accessor <html-style-sheet-template> 'version))
(define gnc:html-style-sheet-template-set-version!
(record-modifier <html-style-sheet-template> 'version))
(define gnc:html-style-sheet-template-name
(record-accessor <html-style-sheet-template> 'name))
(define gnc:html-style-sheet-template-set-name!
(record-modifier <html-style-sheet-template> 'name))
(define gnc:html-style-sheet-template-options-generator
(record-accessor <html-style-sheet-template> 'options-generator))
(define gnc:html-style-sheet-template-set-options-generator!
(record-modifier <html-style-sheet-template> 'options-generator))
(define gnc:html-style-sheet-template-renderer
(record-accessor <html-style-sheet-template> 'renderer))
(define gnc:html-style-sheet-template-set-renderer!
(record-modifier <html-style-sheet-template> 'renderer))
(define gnc:html-style-sheet-template? ss-template?)
(define gnc:html-style-sheet-template-version ss-template-version)
(define gnc:html-style-sheet-template-set-version! ss-template-set-version!)
(define gnc:html-style-sheet-template-name ss-template-name)
(define gnc:html-style-sheet-template-set-name! ss-template-set-name!)
(define gnc:html-style-sheet-template-options-generator ss-template-options-generator)
(define gnc:html-style-sheet-template-set-options-generator! ss-template-set-options-generator!)
(define gnc:html-style-sheet-template-renderer ss-template-renderer)
(define gnc:html-style-sheet-template-set-renderer! ss-template-set-renderer!)
(define (gnc:html-style-sheet-template-find tname)
(hash-ref *gnc:_style-sheet-templates_* tname))
@ -68,56 +56,38 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(define (gnc:define-html-style-sheet . args)
(let loop ((args args)
(ss ((record-constructor <html-style-sheet-template>) #f #f #f #f)))
(let loop ((args args) (ss (make-ss-template #f #f #f #f)))
(match args
((field value . rest)
((record-modifier <html-style-sheet-template> field) ss value)
(loop rest ss))
(else ;; store the style sheet template
(hash-set! *gnc:_style-sheet-templates_*
(gnc:html-style-sheet-template-name ss) ss)))))
(_ (hash-set! *gnc:_style-sheet-templates_*
(gnc:html-style-sheet-template-name ss) ss)))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; <html-style-sheet> methods
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(define <html-style-sheet>
(make-record-type "<html-style-sheet>"
'(name type options renderer style)))
(define-record-type <html-style-sheet>
(make-html-ss name type options renderer style)
html-ss?
(name ss-name ss-set-name!)
(type ss-type ss-set-type!)
(options ss-options ss-set-options!)
(renderer ss-renderer ss-set-renderer!)
(style ss-style))
(define gnc:html-style-sheet?
(record-predicate <html-style-sheet>))
(define gnc:html-style-sheet-name
(record-accessor <html-style-sheet> 'name))
(define gnc:html-style-sheet-set-name!
(record-modifier <html-style-sheet> 'name))
(define gnc:html-style-sheet-type
(record-accessor <html-style-sheet> 'type))
(define gnc:html-style-sheet-set-type!
(record-modifier <html-style-sheet> 'type))
(define gnc:html-style-sheet-options
(record-accessor <html-style-sheet> 'options))
(define gnc:html-style-sheet-set-options!
(record-modifier <html-style-sheet> 'options))
(define gnc:html-style-sheet-renderer
(record-accessor <html-style-sheet> 'renderer))
(define gnc:html-style-sheet-set-renderer!
(record-modifier <html-style-sheet> 'renderer))
(define gnc:make-html-style-sheet-internal
(record-constructor <html-style-sheet>))
(define gnc:html-style-sheet-style
(record-accessor <html-style-sheet> 'style))
(define gnc:make-html-style-sheet-internal make-html-ss)
(define gnc:html-style-sheet? html-ss?)
(define gnc:html-style-sheet-name ss-name)
(define gnc:html-style-sheet-set-name! ss-set-name!)
(define gnc:html-style-sheet-type ss-type)
(define gnc:html-style-sheet-set-type! ss-set-type!)
(define gnc:html-style-sheet-options ss-options)
(define gnc:html-style-sheet-set-options! ss-set-options!)
(define gnc:html-style-sheet-renderer ss-renderer)
(define gnc:html-style-sheet-set-renderer! ss-set-renderer!)
(define gnc:html-style-sheet-style ss-style)
(define gnc:current-saved-stylesheets
(gnc-build-userdata-path "stylesheets-2.0"))
@ -127,7 +97,7 @@
(open gnc:current-saved-stylesheets
(logior O_WRONLY O_CREAT O_TRUNC)))))
(if (not port)
(gnc:warn (_ "Can't save style sheet"))
(gnc:warn (G_ "Can't save style sheet"))
(begin
(hash-fold
(lambda (id ss-obj p)
@ -154,65 +124,31 @@
(apply gnc:make-html-data-style-info rest)
(apply gnc:make-html-markup-style-info rest))))
(define (gnc:make-html-style-sheet template-name style-sheet-name)
(let* ((template (gnc:html-style-sheet-template-find template-name)))
(if template
(let ((rv (gnc:make-html-style-sheet-internal
style-sheet-name template-name
((gnc:html-style-sheet-template-options-generator template))
(gnc:html-style-sheet-template-renderer template)
(gnc:make-html-style-table))))
;; set up the fallback data styles for every rendered document
(gnc:html-style-sheet-set-style!
rv "<string>"
gnc:default-html-string-renderer #f)
(gnc:html-style-sheet-set-style!
rv "<gnc-numeric>"
gnc:default-html-gnc-numeric-renderer #f)
(gnc:html-style-sheet-set-style!
rv "<number>"
gnc:default-html-number-renderer #f)
(gnc:html-style-sheet-set-style!
rv "<gnc-monetary>"
gnc:default-html-gnc-monetary-renderer #f)
(define (make-html-style-sheet-internal template-name style-sheet-name options)
(define template (gnc:html-style-sheet-template-find template-name))
(define fallback-styles
(list (cons "<string>" gnc:default-html-string-renderer)
(cons "<gnc-numeric>" gnc:default-html-gnc-numeric-renderer)
(cons "<number>" gnc:default-html-number-renderer)
(cons ':gnc-monetary gnc:default-html-gnc-monetary-renderer)))
(and template
(let ((ss (gnc:make-html-style-sheet-internal
style-sheet-name template-name
(or options
((gnc:html-style-sheet-template-options-generator template)))
(gnc:html-style-sheet-template-renderer template)
(gnc:make-html-style-table))))
(for-each (lambda (pair)
(gnc:html-style-sheet-set-style! ss (car pair) (cdr pair) #f))
fallback-styles)
(hash-set! *gnc:_style-sheets_* style-sheet-name ss)
ss)))
;; store it in the style sheet hash
(hash-set! *gnc:_style-sheets_* style-sheet-name rv)
rv)
#f)))
(define (gnc:make-html-style-sheet template-name style-sheet-name)
(make-html-style-sheet-internal template-name style-sheet-name #f))
(define (gnc:restore-html-style-sheet style-sheet-name template-name options)
(let* ((template (gnc:html-style-sheet-template-find template-name)))
(if template
(let ((rv (gnc:make-html-style-sheet-internal
style-sheet-name template-name
options
(gnc:html-style-sheet-template-renderer template)
(gnc:make-html-style-table))))
;; set up the fallback data styles for every rendered document
(gnc:html-style-sheet-set-style!
rv "<string>"
gnc:default-html-string-renderer #f)
(gnc:html-style-sheet-set-style!
rv "<gnc-numeric>"
gnc:default-html-gnc-numeric-renderer #f)
(gnc:html-style-sheet-set-style!
rv "<number>"
gnc:default-html-number-renderer #f)
(gnc:html-style-sheet-set-style!
rv "<gnc-monetary>"
gnc:default-html-gnc-monetary-renderer #f)
;; store it in the style sheet hash
(hash-set! *gnc:_style-sheets_* style-sheet-name rv)
rv)
#f)))
(make-html-style-sheet-internal template-name style-sheet-name options))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

View File

@ -24,6 +24,7 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(use-modules (srfi srfi-2))
(use-modules (srfi srfi-9))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
@ -35,29 +36,66 @@
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(define <html-table>
(make-record-type "<html-table>"
'(col-headers
row-headers
caption
data
num-rows
style
col-styles
row-styles
row-markup-table
col-headers-style
row-headers-style)))
(define-record-type <html-table>
(make-html-table col-headers row-headers caption data num-rows style
col-styles row-styles row-markup-table col-headers-style
row-headers-style)
html-table?
(col-headers html-table-col-headers html-table-set-col-headers!)
(row-headers html-table-row-headers html-table-set-row-headers!)
(caption html-table-caption html-table-set-caption!)
(data html-table-data html-table-set-data!)
(num-rows html-table-num-rows html-table-set-num-rows!)
(style html-table-style html-table-set-style!)
(col-styles html-table-col-styles html-table-set-col-styles!)
(row-styles html-table-row-styles html-table-set-row-styles!)
(row-markup-table html-table-row-markup-table html-table-set-row-markup-table!)
(col-headers-style html-table-col-headers-style)
(row-headers-style html-table-row-headers-style))
(define gnc:html-table?
(record-predicate <html-table>))
(define gnc:html-table? html-table?)
(define gnc:make-html-table-internal make-html-table)
(define gnc:html-table-data html-table-data)
(define gnc:html-table-set-data! html-table-set-data!)
(define gnc:html-table-caption html-table-caption)
(define gnc:html-table-set-caption! html-table-set-caption!)
(define gnc:html-table-multirow-col-headers html-table-col-headers)
(define gnc:html-table-set-multirow-col-headers! html-table-set-col-headers!)
(define gnc:html-table-style html-table-style)
(define gnc:html-table-set-style-internal! html-table-set-style!)
(define gnc:html-table-row-styles html-table-row-styles)
(define gnc:html-table-set-row-styles! html-table-set-row-styles!)
(define gnc:html-table-row-markup-table html-table-row-markup-table)
(define gnc:html-table-set-row-markup-table! html-table-set-row-markup-table!)
(define gnc:html-table-col-styles html-table-col-styles)
(define gnc:html-table-set-col-styles! html-table-set-col-styles!)
(define gnc:html-table-col-headers-style html-table-col-headers-style)
(define gnc:html-table-row-headers-style html-table-row-headers-style)
(define gnc:html-table-num-rows html-table-num-rows)
(define gnc:html-table-set-num-rows-internal! html-table-set-num-rows!)
(define <html-table-cell>
(make-record-type "<html-table-cell>"
'(rowspan colspan tag data style)))
(define gnc:make-html-table-cell-internal
(record-constructor <html-table-cell>))
(define-record-type <html-table-cell>
(make-html-table-cell rowspan colspan tag data style)
html-table-cell?
(rowspan html-table-cell-rowspan html-table-cell-set-rowspan!)
(colspan html-table-cell-colspan html-table-cell-set-colspan!)
(tag html-table-cell-tag html-table-cell-set-tag!)
(data html-table-cell-data html-table-cell-set-data!)
(style html-table-cell-style html-table-cell-set-style!))
(define gnc:make-html-table-cell-internal make-html-table-cell)
(define gnc:html-table-cell? html-table-cell?)
(define gnc:html-table-cell-rowspan html-table-cell-rowspan)
(define gnc:html-table-cell-set-rowspan! html-table-cell-set-rowspan!)
(define gnc:html-table-cell-colspan html-table-cell-colspan)
(define gnc:html-table-cell-set-colspan! html-table-cell-set-colspan!)
(define gnc:html-table-cell-tag html-table-cell-tag)
(define gnc:html-table-cell-set-tag! html-table-cell-set-tag!)
(define gnc:html-table-cell-data html-table-cell-data)
(define gnc:html-table-cell-set-data-internal! html-table-cell-set-data!)
(define gnc:html-table-cell-style html-table-cell-style)
(define gnc:html-table-cell-set-style-internal! html-table-cell-set-style!)
(define (gnc:make-html-table-cell . objects)
(gnc:make-html-table-cell-internal 1 1 "td" objects
@ -93,39 +131,6 @@
(gnc:make-html-table-cell-internal rowspan colspan "th"
objects (gnc:make-html-style-table)))
(define gnc:html-table-cell?
(record-predicate <html-table-cell>))
(define gnc:html-table-cell-rowspan
(record-accessor <html-table-cell> 'rowspan))
(define gnc:html-table-cell-set-rowspan!
(record-modifier <html-table-cell> 'rowspan))
(define gnc:html-table-cell-colspan
(record-accessor <html-table-cell> 'colspan))
(define gnc:html-table-cell-set-colspan!
(record-modifier <html-table-cell> 'colspan))
(define gnc:html-table-cell-tag
(record-accessor <html-table-cell> 'tag))
(define gnc:html-table-cell-set-tag!
(record-modifier <html-table-cell> 'tag))
(define gnc:html-table-cell-data
(record-accessor <html-table-cell> 'data))
(define gnc:html-table-cell-set-data-internal!
(record-modifier <html-table-cell> 'data))
(define gnc:html-table-cell-style
(record-accessor <html-table-cell> 'style))
(define gnc:html-table-cell-set-style-internal!
(record-modifier <html-table-cell> 'style))
(define (gnc:html-table-cell-set-style! cell tag . rest)
(let ((newstyle (if (and (= (length rest) 2) (procedure? (car rest)))
(apply gnc:make-html-data-style-info rest)
@ -174,9 +179,6 @@
;; wrapper around HTML tables
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(define gnc:make-html-table-internal
(record-constructor <html-table>))
(define (gnc:make-html-table)
(gnc:make-html-table-internal
#f ;; col-headers
@ -192,60 +194,16 @@
(gnc:make-html-style-table) ;; row-headers-style
))
(define gnc:html-table-data
(record-accessor <html-table> 'data))
(define gnc:html-table-set-data!
(record-modifier <html-table> 'data))
(define gnc:html-table-caption
(record-accessor <html-table> 'caption))
(define gnc:html-table-set-caption!
(record-modifier <html-table> 'caption))
(define (gnc:html-table-set-col-headers! table col-headers)
(gnc:html-table-set-multirow-col-headers! table (list col-headers)))
(define gnc:html-table-multirow-col-headers
(record-accessor <html-table> 'col-headers))
(define gnc:html-table-set-multirow-col-headers!
(record-modifier <html-table> 'col-headers))
(define gnc:html-table-style
(record-accessor <html-table> 'style))
(define gnc:html-table-set-style-internal!
(record-modifier <html-table> 'style))
(define gnc:html-table-row-styles
(record-accessor <html-table> 'row-styles))
(define gnc:html-table-set-row-styles!
(record-modifier <html-table> 'row-styles))
(define gnc:html-table-row-markup-table
(record-accessor <html-table> 'row-markup-table))
(define (gnc:html-table-row-markup table row)
(hash-ref (gnc:html-table-row-markup-table table) row))
(define gnc:html-table-set-row-markup-table!
(record-modifier <html-table> 'row-markup-table))
(define (gnc:html-table-set-row-markup! table row markup)
(hash-set! (gnc:html-table-row-markup-table table) row markup))
(define gnc:html-table-col-styles
(record-accessor <html-table> 'col-styles))
(define gnc:html-table-set-col-styles!
(record-modifier <html-table> 'col-styles))
(define gnc:html-table-col-headers-style
(record-accessor <html-table> 'col-headers-style))
(define (gnc:html-table-set-col-headers-style! table tag . rest)
(let ((newstyle (if (and (= (length rest) 2) (procedure? (car rest)))
(apply gnc:make-html-data-style-info rest)
@ -253,8 +211,6 @@
(style (gnc:html-table-col-headers-style table)))
(gnc:html-style-table-set! style tag newstyle)))
(define gnc:html-table-row-headers-style
(record-accessor <html-table> 'row-headers-style))
(define (gnc:html-table-set-row-headers-style! table tag . rest)
(let* ((newstyle (if (and (= (length rest) 2) (procedure? (car rest)))
@ -298,12 +254,6 @@
(define (gnc:html-table-col-style table col)
(hash-ref (gnc:html-table-col-styles table) col))
(define gnc:html-table-num-rows
(record-accessor <html-table> 'num-rows))
(define gnc:html-table-set-num-rows-internal!
(record-modifier <html-table> 'num-rows))
(define (gnc:html-table-num-columns table)
(apply max (cons 0 (map length (gnc:html-table-data table)))))

View File

@ -21,6 +21,7 @@
;; Boston, MA 02110-1301, USA gnu@gnu.org
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(use-modules (srfi srfi-9))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; <html-text> class
@ -30,35 +31,25 @@
;; doc as arg to get the string out.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(define <html-text>
(make-record-type "<html-text>"
'(body style)))
(define gnc:html-text?
(record-predicate <html-text>))
(define-record-type <html-text>
(make-html-text body style)
html-text?
(body html-text-body html-text-set-body!)
(style html-text-style html-text-set-style!))
(define gnc:make-html-text-internal
(record-constructor <html-text>))
(define gnc:html-text? html-text?)
(define gnc:make-html-text-internal make-html-text)
(define gnc:html-text-body html-text-body)
(define gnc:html-text-set-body-internal! html-text-set-body!)
(define gnc:html-text-style html-text-style)
(define gnc:html-text-set-style-internal! html-text-set-style!)
(define (gnc:make-html-text . body)
(gnc:make-html-text-internal
body
(gnc:make-html-style-table)))
(define gnc:html-text-body
(record-accessor <html-text> 'body))
(define gnc:html-text-set-body-internal!
(record-modifier <html-text> 'body))
(gnc:make-html-text-internal body (gnc:make-html-style-table)))
(define (gnc:html-text-set-body! txt . rest)
(gnc:html-text-set-body-internal! txt rest))
(define gnc:html-text-style
(record-accessor <html-text> 'style))
(define gnc:html-text-set-style-internal!
(record-modifier <html-text> 'style))
(define (gnc:html-text-set-style! text tag . rest)
(let ((newstyle (if (and (= (length rest) 2) (procedure? (car rest)))
(apply gnc:make-html-data-style-info rest)

View File

@ -215,15 +215,15 @@
(gnc:html-table-set-col-headers!
table (list (gnc:make-html-table-header-cell/size
1 2 (if (null? (cdr comm-list))
(_ "Exchange rate")
(_ "Exchange rates"))))))
(G_ "Exchange rate")
(G_ "Exchange rates"))))))
table))
(define (gnc:html-make-generic-budget-warning report-title-string)
(gnc:html-make-generic-simple-warning
report-title-string
(_ "No budgets exist. You must create at least one budget.")))
(G_ "No budgets exist. You must create at least one budget.")))
(define (gnc:html-make-generic-simple-warning report-title-string message)
@ -243,7 +243,7 @@
(gnc-build-url URL-TYPE-OPTIONS
(string-append "report-id=" (format #f "~a" report-id))
"")
(_ "Edit report options")))))
(G_ "Edit report options")))))
(define* (gnc:html-render-options-changed options #:optional plaintext?)
;; options -> html-object or string, depending on plaintext?. This
@ -259,7 +259,7 @@
(catch 'wrong-type-arg
(lambda () (proc d))
(const #f)))
(or (and (boolean? d) (if d (_ "Enabled") (_ "Disabled")))
(or (and (boolean? d) (if d (G_ "Enabled") (G_ "Disabled")))
(and (null? d) "null")
(and (list? d) (string-join (map disp d) ", "))
(and (pair? d) (format #f "~a . ~a"
@ -303,7 +303,7 @@
(let ((p (gnc:make-html-text)))
(gnc:html-text-append!
p
(gnc:html-markup-h2 (string-append (_ report-title-string) ":"))
(gnc:html-markup-h2 (string-append (G_ report-title-string) ":"))
(gnc:html-markup-h2 warning-title-string)
(gnc:html-markup-p warning-string)
(gnc:html-make-options-link report-id))
@ -315,23 +315,23 @@
report-title-string
report-id
""
(_ "This report requires you to specify certain report options.")))
(G_ "This report requires you to specify certain report options.")))
(define (gnc:html-make-no-account-warning
report-title-string report-id)
(gnc:html-make-generic-warning
report-title-string
report-id
(_ "No accounts selected")
(_ "This report requires accounts to be selected in the report options.")))
(G_ "No accounts selected")
(G_ "This report requires accounts to be selected in the report options.")))
(define (gnc:html-make-empty-data-warning
report-title-string report-id)
(gnc:html-make-generic-warning
report-title-string
report-id
(_ "No data")
(_ "The selected accounts contain no data/transactions (or only zeroes) for the selected time period")))
(G_ "No data")
(G_ "The selected accounts contain no data/transactions (or only zeroes) for the selected time period")))
(define (gnc:html-js-include file)
(format #f

View File

@ -29,6 +29,7 @@
(use-modules (sw_report))
(use-modules (ice-9 match))
(use-modules (srfi srfi-9))
; Export the swig-wrapped symbols in the public interface of this module
(let ((i (module-public-interface (current-module))))
@ -82,22 +83,54 @@
(define gnc:optname-invoice-number (N_ "Invoice Number"))
;; A <report-template> represents one of the available report types.
(define <report-template>
(make-record-type
"<report-template>"
;; The data items in a report record
'(version name report-guid parent-type options-generator
options-cleanup-cb options-changed-cb
renderer in-menu? menu-path menu-name
menu-tip export-types export-thunk)))
(define-record-type <report-template>
(make-new-record-template version name report-guid parent-type options-generator
options-cleanup-cb options-changed-cb
renderer in-menu? menu-path menu-name
menu-tip export-types export-thunk)
report-template?
(version report-template-version)
(report-guid report-template-report-guid report-template-set-report-guid!)
(name report-template-name report-template-set-name)
(parent-type report-template-parent-type report-template-set-parent-type!)
(options-generator report-template-options-generator)
(options-cleanup-cb report-template-options-cleanup-cb)
(options-changed-cb report-template-options-changed-cb)
(renderer report-template-renderer)
(in-menu? report-template-in-menu?)
(menu-path report-template-menu-path)
(menu-name report-template-menu-name)
(menu-tip report-template-menu-tip)
(export-types report-template-export-types)
(export-thunk report-template-export-thunk))
(define (make-report-template)
(make-new-record-template #f #f #f #f #f #f #f #f #t #f #f #f #f #f))
(define gnc:report-template-version report-template-version)
(define gnc:report-template-report-guid report-template-report-guid)
(define gnc:report-template-set-report-guid! report-template-set-report-guid!)
(define gnc:report-template-name report-template-name)
(define gnc:report-template-set-name report-template-set-name)
(define gnc:report-template-parent-type report-template-parent-type)
(define gnc:report-template-set-parent-type! report-template-set-parent-type!)
(define gnc:report-template-options-generator report-template-options-generator)
(define gnc:report-template-options-cleanup-cb report-template-options-cleanup-cb)
(define gnc:report-template-options-changed-cb report-template-options-changed-cb)
(define gnc:report-template-renderer report-template-renderer)
(define gnc:report-template-in-menu? report-template-in-menu?)
(define gnc:report-template-menu-path report-template-menu-path)
(define gnc:report-template-menu-name report-template-menu-name)
(define gnc:report-template-menu-tip report-template-menu-tip)
(define gnc:report-template-export-types report-template-export-types)
(define gnc:report-template-export-thunk report-template-export-thunk)
;; define strings centrally to ease code clarity
(define rpterr-dupe
(_ "One of your reports has a report-guid that is a duplicate. Please check the report system, especially your saved reports, for a report with this report-guid: "))
(define rpterr-guid1 (_ "Wrong report definition: "))
(define rpterr-guid2 (_ " Report is missing a GUID."))
(G_ "One of your reports has a report-guid that is a duplicate. Please check the report system, especially your saved reports, for a report with this report-guid: "))
(define rpterr-guid1 (G_ "Wrong report definition: "))
(define rpterr-guid2 (G_ " Report is missing a GUID."))
(define rptwarn-legacy
(_ "Some reports stored in a legacy format were found. This format is not supported anymore so these reports may not have been restored properly."))
(G_ "Some reports stored in a legacy format were found. This format is not supported anymore so these reports may not have been restored properly."))
(define (gui-error str)
(if (gnucash-ui-is-running)
(gnc-error-dialog '() str)
@ -121,14 +154,16 @@ not found.")))
;; The renderer should be a function that accepts one argument, a
;; set of options, and generates the report. the renderer must
;; return as its final value an <html-document> object.
(define report-rec (make-report-template))
(let* ((report-rec (let loop ((report-rec (make-report-template)) (args args))
(match args
(() report-rec)
((field val . rest)
((record-modifier <report-template> field) report-rec val)
(loop report-rec rest)))))
(report-guid (gnc:report-template-report-guid report-rec))
(let loop ((args args))
(match args
(() #f)
((field val . rest)
((record-modifier <report-template> field) report-rec val)
(loop rest))))
(let* ((report-guid (gnc:report-template-report-guid report-rec))
(report-name (gnc:report-template-name report-rec)))
(cond
@ -144,60 +179,6 @@ not found.")))
(else
(hash-set! *gnc:_report-templates_* report-guid report-rec)))))
(define gnc:report-template-version
(record-accessor <report-template> 'version))
(define gnc:report-template-report-guid
(record-accessor <report-template> 'report-guid))
(define gnc:report-template-set-report-guid!
(record-modifier <report-template> 'report-guid))
(define gnc:report-template-name
(record-accessor <report-template> 'name))
(define gnc:report-template-set-name
(record-modifier <report-template> 'name))
(define gnc:report-template-parent-type
(record-accessor <report-template> 'parent-type))
(define gnc:report-template-set-parent-type!
(record-modifier <report-template> 'parent-type))
(define gnc:report-template-options-generator
(record-accessor <report-template> 'options-generator))
(define gnc:report-template-options-cleanup-cb
(record-accessor <report-template> 'options-cleanup-cb))
(define gnc:report-template-options-changed-cb
(record-accessor <report-template> 'options-changed-cb))
(define gnc:report-template-renderer
(record-accessor <report-template> 'renderer))
(define gnc:report-template-in-menu?
(record-accessor <report-template> 'in-menu?))
(define gnc:report-template-menu-path
(record-accessor <report-template> 'menu-path))
(define gnc:report-template-menu-name
(record-accessor <report-template> 'menu-name))
(define gnc:report-template-menu-tip
(record-accessor <report-template> 'menu-tip))
(define gnc:report-template-export-types
(record-accessor <report-template> 'export-types))
(define gnc:report-template-export-thunk
(record-accessor <report-template> 'export-thunk))
(define (make-report-template)
((record-constructor <report-template>)
#f ;; version
#f ;; name
#f ;; report-guid
#f ;; parent-type (meaning guid of
;; report-template this template is
;; based on)
#f ;; options-generator
#f ;; options-cleanup-cb
#f ;; options-changed-cb
#f ;; renderer
#t ;; in-menu?
#f ;; menu-path
#f ;; menu-name
#f ;; menu-tip
#f ;; export-types
#f ;; export-thunk
))
(define (gnc:report-template-new-options/report-guid template-id template-name)
(let ((templ (hash-ref *gnc:_report-templates_* template-id)))
(and templ
@ -220,7 +201,7 @@ not found.")))
(gnc:make-string-option
gnc:pagename-general gnc:optname-reportname "0a"
(N_ "Enter a descriptive name for this report.")
(_ (gnc:report-template-name report-template))))
(G_ (gnc:report-template-name report-template))))
(stylesheet
(gnc:make-multichoice-option
gnc:pagename-general gnc:optname-stylesheet "0b"
@ -232,7 +213,7 @@ not found.")))
(string->symbol (gnc:html-style-sheet-name ss))
(gnc:html-style-sheet-name ss)
(string-append (gnc:html-style-sheet-name ss)
" " (_ "stylesheet."))))
" " (G_ "stylesheet."))))
(gnc:get-html-style-sheets)))))
(let ((options (if (procedure? generator)
@ -250,69 +231,42 @@ not found.")))
options)))
;; A <report> represents an instantiation of a particular report type.
(define <report>
(make-record-type
"<report>"
'(type id options dirty? needs-save? editor-widget ctext custom-template)))
(define-record-type <report>
(make-report type id options dirty? needs-save? editor-widget ctext custom-template)
report?
(type report-type report-set-type!)
(id report-id report-set-id!)
(options report-options report-set-options!)
(dirty? report-dirty? report-set-dirty?!)
(needs-save? report-needs-save? report-set-needs-save?!)
(editor-widget report-editor-widget report-set-editor-widget!)
(ctext report-ctext report-set-ctext!)
(custom-template report-custom-template report-set-custom-template!))
(define gnc:report-type
(record-accessor <report> 'type))
(define gnc:report-set-type!
(record-modifier <report> 'type))
(define gnc:report-id
(record-accessor <report> 'id))
(define gnc:report-set-id!
(record-modifier <report> 'id))
(define gnc:report-options
(record-accessor <report> 'options))
(define gnc:report-set-options!
(record-modifier <report> 'options))
(define gnc:report-needs-save?
(record-accessor <report> 'needs-save?))
(define gnc:report-set-needs-save?!
(record-modifier <report> 'needs-save?))
(define gnc:report-dirty?
(record-accessor <report> 'dirty?))
(define gnc:report-set-dirty?-internal!
(record-modifier <report> 'dirty?))
(define gnc:report-type report-type)
(define gnc:report-set-type! report-set-type!)
(define gnc:report-id report-id)
(define gnc:report-set-id! report-set-id!)
(define gnc:report-options report-options)
(define gnc:report-set-options! report-set-options!)
(define gnc:report-needs-save? report-needs-save?)
(define gnc:report-set-needs-save?! report-set-needs-save?!)
(define gnc:report-dirty? report-dirty?)
(define gnc:report-set-dirty?-internal! report-set-dirty?!)
(define gnc:report-editor-widget report-editor-widget)
(define gnc:report-set-editor-widget! report-set-editor-widget!)
(define gnc:report-ctext report-ctext)
(define gnc:report-set-ctext! report-set-ctext!)
(define gnc:report-custom-template report-custom-template)
(define gnc:report-set-custom-template! report-set-custom-template!)
(define (gnc:report-set-dirty?! report val)
(gnc:report-set-dirty?-internal! report val)
(let* ((template (hash-ref *gnc:_report-templates_*
(gnc:report-type report)))
(let* ((template (hash-ref *gnc:_report-templates_* (gnc:report-type report)))
(cb (gnc:report-template-options-changed-cb template)))
(if (and cb (procedure? cb))
(cb report))))
(define gnc:report-editor-widget
(record-accessor <report> 'editor-widget))
(define gnc:report-set-editor-widget!
(record-modifier <report> 'editor-widget))
;; ctext is for caching the rendered html
(define gnc:report-ctext
(record-accessor <report> 'ctext))
(define gnc:report-set-ctext!
(record-modifier <report> 'ctext))
(define gnc:report-custom-template
(record-accessor <report> 'custom-template))
(define gnc:report-set-custom-template!
(record-modifier <report> 'custom-template))
;; gnc:make-report instantiates a report from a report-template.
;; The actual report is stored away in a hash-table -- only the id is returned.
(define (gnc:make-report template-id . rest)
@ -320,7 +274,7 @@ not found.")))
(hash-ref *gnc:_report-templates_* template-id)))
(report-type (or template-parent template-id))
(custom-template (if template-parent template-id ""))
(r ((record-constructor <report>)
(r (make-report
report-type ;; type
#f ;; id
#f ;; options
@ -348,8 +302,7 @@ not found.")))
(define (gnc:restore-report-by-guid id template-id template-name options)
(if options
(let* ((r ((record-constructor <report>)
template-id id options #t #t #f #f ""))
(let* ((r (make-report template-id id options #t #t #f #f ""))
(report-id (gnc-report-add r)))
(if (number? report-id)
(gnc:report-set-id! r report-id))
@ -361,8 +314,7 @@ not found.")))
(define (gnc:restore-report-by-guid-with-custom-template
id template-id template-name custom-template-id options)
(if options
(let* ((r ((record-constructor <report>)
template-id id options #t #t #f #f custom-template-id))
(let* ((r (make-report template-id id options #t #t #f #f custom-template-id))
(report-id (gnc-report-add r)))
(if (number? report-id)
(gnc:report-set-id! r report-id))
@ -826,9 +778,22 @@ not found.")))
(else
(for-each
(lambda (template)
(let* ((options-gen (gnc:report-template-options-generator template)))
(format port "\n* guid: ~a\n~a"
(let* ((options-gen (gnc:report-template-options-generator template))
(parent-guid (gnc:report-template-parent-type template))
(parent-template (and parent-guid
(hash-ref *gnc:_report-templates_* parent-guid)))
(export-types (gnc:report-template-export-types
(or parent-template template))))
(format port "\n* name: ~a\n guid: ~a\n~a~a~a"
(gnc:report-template-name template)
(gnc:report-template-report-guid template)
(if parent-template
(format #f " parent-template: ~a\n"
(gnc:report-template-name parent-template))
"")
(if export-types
(format #f " export-types: ~a\n"
(string-join (map car export-types) ", ")) "")
(gnc:html-render-options-changed (options-gen) #t))))
templates)))))

View File

@ -98,24 +98,24 @@
(define (gnc:account-get-type-string-plural type)
(assoc-ref
(list
(cons ACCT-TYPE-BANK (_ "Bank"))
(cons ACCT-TYPE-CASH (_ "Cash"))
(cons ACCT-TYPE-CREDIT (_ "Credits"))
(cons ACCT-TYPE-ASSET (_ "Assets"))
(cons ACCT-TYPE-LIABILITY (_ "Liabilities"))
(cons ACCT-TYPE-STOCK (_ "Stocks"))
(cons ACCT-TYPE-MUTUAL (_ "Mutual Funds"))
(cons ACCT-TYPE-CURRENCY (_ "Currencies"))
(cons ACCT-TYPE-INCOME (_ "Income"))
(cons ACCT-TYPE-EXPENSE (_ "Expenses"))
(cons ACCT-TYPE-EQUITY (_ "Equities"))
(cons ACCT-TYPE-CHECKING (_ "Checking"))
(cons ACCT-TYPE-SAVINGS (_ "Savings"))
(cons ACCT-TYPE-MONEYMRKT (_ "Money Market"))
(cons ACCT-TYPE-RECEIVABLE (_ "Accounts Receivable"))
(cons ACCT-TYPE-PAYABLE (_ "Accounts Payable"))
(cons ACCT-TYPE-CREDITLINE (_ "Credit Lines"))
(cons ACCT-TYPE-TRADING (_ "Trading Accounts")))
(cons ACCT-TYPE-BANK (G_ "Bank"))
(cons ACCT-TYPE-CASH (G_ "Cash"))
(cons ACCT-TYPE-CREDIT (G_ "Credits"))
(cons ACCT-TYPE-ASSET (G_ "Assets"))
(cons ACCT-TYPE-LIABILITY (G_ "Liabilities"))
(cons ACCT-TYPE-STOCK (G_ "Stocks"))
(cons ACCT-TYPE-MUTUAL (G_ "Mutual Funds"))
(cons ACCT-TYPE-CURRENCY (G_ "Currencies"))
(cons ACCT-TYPE-INCOME (G_ "Income"))
(cons ACCT-TYPE-EXPENSE (G_ "Expenses"))
(cons ACCT-TYPE-EQUITY (G_ "Equities"))
(cons ACCT-TYPE-CHECKING (G_ "Checking"))
(cons ACCT-TYPE-SAVINGS (G_ "Savings"))
(cons ACCT-TYPE-MONEYMRKT (G_ "Money Market"))
(cons ACCT-TYPE-RECEIVABLE (G_ "Accounts Receivable"))
(cons ACCT-TYPE-PAYABLE (G_ "Accounts Payable"))
(cons ACCT-TYPE-CREDITLINE (G_ "Credit Lines"))
(cons ACCT-TYPE-TRADING (G_ "Trading Accounts")))
type))
;; Get the list of all different commodities that are used within the
@ -605,16 +605,16 @@
(define (gnc:report-starting report-name)
(gnc-window-show-progress (format #f
(_ "Building '~a' report ...")
(_ report-name))
(G_ "Building '~a' report ...")
(G_ report-name))
0))
(define (gnc:report-render-starting report-name)
(gnc-window-show-progress (format #f
(_ "Rendering '~a' report ...")
(G_ "Rendering '~a' report ...")
(if (string-null? report-name)
(_ "Untitled")
(_ report-name)))
(G_ "Untitled")
(G_ report-name)))
0))
(define (gnc:report-percent-done percent)

View File

@ -534,6 +534,8 @@
(export gnc:html-chart-currency-symbol)
(export gnc:html-chart-set-currency-symbol!)
(export gnc:html-chart-render)
(export gnc:html-chart-set-custom-x-axis-ticks?!)
(export gnc:html-chart-set-custom-y-axis-ticks?!)
;; html-table.scm

View File

@ -4,7 +4,7 @@ add_subdirectory(support)
#These provide some functions used by more than one report.
set (reports_common_SCHEME
aging.scm
aging.scm #deprecated 4.x to be removed in 5.x
cash-flow-calc.scm
)
@ -13,10 +13,10 @@ set (reports_common_SCHEME
set (reports_standard_with_exposed_generator_SCHEME
standard/new-aging.scm
standard/register.scm
standard/owner-report.scm
standard/owner-report.scm #deprecated 4.x to be removed in 5.x
standard/new-owner-report.scm
standard/payables.scm
standard/receivables.scm
standard/payables.scm #deprecated 4.x to be removed in 5.x
standard/receivables.scm #deprecated 4.x to be removed in 5.x
)
set (reports_standard_SCHEME

View File

@ -31,6 +31,7 @@
(use-modules (gnucash core-utils))
(use-modules (gnucash app-utils))
(use-modules (gnucash report))
(use-modules (srfi srfi-9))
(define optname-to-date (N_ "To"))
(define optname-sort-by (N_ "Sort By"))
@ -67,42 +68,20 @@
;; if any. Any bills get taken out of the overpayment before
;; incurring debt.
(define company-info (make-record-type "ComanyInfo"
'(currency
bucket-vector
overpayment
owner-obj)))
(define-record-type :company-info
(make-company-private currency bucket overpayment owner-obj)
company-info?
(currency company-get-currency)
(bucket company-get-buckets company-set-buckets)
(overpayment company-get-overpayment company-set-overpayment)
(owner-obj company-get-owner-obj company-set-owner-obj!))
(define num-buckets 5)
(define (new-bucket-vector)
(make-vector num-buckets (gnc-numeric-zero)))
(define make-company-private
(record-constructor company-info '(currency bucket-vector overpayment owner-obj)))
(define (make-company currency owner-obj)
(make-company-private currency (new-bucket-vector) (gnc-numeric-zero) owner-obj))
(define company-get-currency
(record-accessor company-info 'currency))
(define company-get-owner-obj
(record-accessor company-info 'owner-obj))
(define company-set-owner-obj!
(record-modifier company-info 'owner-obj))
(define company-get-buckets
(record-accessor company-info 'bucket-vector))
(define company-set-buckets
(record-modifier company-info 'bucket-vector))
(define company-get-overpayment
(record-accessor company-info 'overpayment))
(define company-set-overpayment
(record-modifier company-info 'overpayment))
(make-company-private currency (new-bucket-vector) 0 owner-obj))
;; Put an invoice in the appropriate bucket
@ -222,7 +201,7 @@
"\nClient Currency:" (gnc:strify (company-get-currency company-info)))))
(gnc-error-dialog '() error-str)
(gnc:error error-str)
(cons #f (format #f (_ "Transactions relating to '~a' contain \
(cons #f (format #f (G_ "Transactions relating to '~a' contain \
more than one currency. This report is not designed to cope with this possibility.") (gncOwnerGetName owner))))
(begin
(gnc:debug "it's an old company")
@ -554,24 +533,24 @@ copying this report to a spreadsheet for use in a mail merge.")
;; more general interval scheme in this report
(define make-heading-list
(list
(_ "Company")
(_ "Current")
(_ "0-30 days")
(_ "31-60 days")
(_ "61-90 days")
(_ "91+ days")
(_ "Total")))
(G_ "Company")
(G_ "Current")
(G_ "0-30 days")
(G_ "31-60 days")
(G_ "61-90 days")
(G_ "91+ days")
(G_ "Total")))
;; following cols are optional
;; (_ "Address Name")
;; (_ "Address 1")
;; (_ "Address 2")
;; (_ "Address 3")
;; (_ "Address 4")
;; (_ "Phone")
;; (_ "Fax")
;; (_ "Email")
;; (_ "Active")
;; (G_ "Address Name")
;; (G_ "Address 1")
;; (G_ "Address 2")
;; (G_ "Address 3")
;; (G_ "Address 4")
;; (G_ "Phone")
;; (G_ "Fax")
;; (G_ "Email")
;; (G_ "Active")
;; Make a list of commodity collectors for column totals
@ -698,23 +677,23 @@ copying this report to a spreadsheet for use in a mail merge.")
;; add optional column headings
(if disp-addr-name
(set! heading-list (append heading-list (list (_ "Address Name")))))
(set! heading-list (append heading-list (list (G_ "Address Name")))))
(if disp-addr1
(set! heading-list (append heading-list (list (_ "Address 1")))))
(set! heading-list (append heading-list (list (G_ "Address 1")))))
(if disp-addr2
(set! heading-list (append heading-list (list (_ "Address 2")))))
(set! heading-list (append heading-list (list (G_ "Address 2")))))
(if disp-addr3
(set! heading-list (append heading-list (list (_ "Address 3")))))
(set! heading-list (append heading-list (list (G_ "Address 3")))))
(if disp-addr4
(set! heading-list (append heading-list (list (_ "Address 4")))))
(set! heading-list (append heading-list (list (G_ "Address 4")))))
(if disp-addr-phone
(set! heading-list (append heading-list (list (_ "Phone")))))
(set! heading-list (append heading-list (list (G_ "Phone")))))
(if disp-addr-fax
(set! heading-list (append heading-list (list (_ "Fax")))))
(set! heading-list (append heading-list (list (G_ "Fax")))))
(if disp-addr-email
(set! heading-list (append heading-list (list (_ "Email")))))
(set! heading-list (append heading-list (list (G_ "Email")))))
(if disp-active
(set! heading-list (append heading-list (list (_ "Active")))))
(set! heading-list (append heading-list (list (G_ "Active")))))
;; set default title
(gnc:html-document-set-title! document report-title)
@ -790,7 +769,7 @@ copying this report to a spreadsheet for use in a mail merge.")
(addr-fax (gncAddressGetFax addr))
(addr-email (gncAddressGetEmail addr))
(company-active (if (gncOwnerGetActive owner)
(_ "Y") (_ "N")))
(G_ "Y") (G_ "N")))
(opt-fld-list '())
)
;; (gnc:debug "aging-renderer: disp-addr-source=" disp-addr-source
@ -847,7 +826,7 @@ copying this report to a spreadsheet for use in a mail merge.")
;; add the totals
(gnc:html-table-append-row!
table
(cons (_ "Total") (convert-collectors total-collector-list
(cons (G_ "Total") (convert-collectors total-collector-list
report-currency
exchange-fn
multi-totals-p)))
@ -857,7 +836,7 @@ copying this report to a spreadsheet for use in a mail merge.")
(gnc:html-document-add-object!
document
(gnc:make-html-text
(_ "No valid account selected. Click on the Options button and select the account to use."))))
(G_ "No valid account selected. Click on the Options button and select the account to use."))))
(qof-query-destroy query)
(gnc:report-finished)
document))

View File

@ -146,9 +146,9 @@
(define columns
;; Watch out -- these names should be consistent with the display
;; option where you choose them, otherwise users are confused.
(list (_ "Period start") (_ "Period end") (_ "Average")
(_ "Maximum") (_ "Minimum") (_ "Gain")
(_ "Loss") (_ "Profit") ))
(list (G_ "Period start") (G_ "Period end") (G_ "Average")
(G_ "Maximum") (G_ "Minimum") (G_ "Gain")
(G_ "Loss") (G_ "Profit") ))
(define (analyze-splits splits balances daily-dates interval-dates

View File

@ -187,9 +187,9 @@
;; in src/engine/FreqSpeq.c. For now, we simply use
;; the normal translations, which show up in the glade
;; file src/gnome-utils/gtkbuilder/gnc-frequency.glade anyway.
(days-of-week (list (_"Sunday") (_"Monday")
(_"Tuesday") (_"Wednesday")
(_"Thursday") (_"Friday") (_"Saturday"))))
(days-of-week (list (G_ "Sunday") (G_ "Monday")
(G_ "Tuesday") (G_ "Wednesday")
(G_ "Thursday") (G_ "Friday") (G_ "Saturday"))))
(gnc:debug daily-totals)
@ -285,7 +285,7 @@
report-title
(string-append
(format #f
(_ "~a to ~a")
(G_ "~a to ~a")
(qof-print-date from-date)
(qof-print-date to-date))
(if show-total?

View File

@ -324,7 +324,7 @@ option like this.")
;; translation of the given string is available for the
;; current locale, then the translation is returned,
;; otherwise the original string is returned.
(gnc:html-document-set-title! document (_ "Hello, World"))
(gnc:html-document-set-title! document (G_ "Hello, World"))
;; we make a "text object" to add a bunch of text to.
;; the function gnc:make-html-text can take any number of
@ -339,68 +339,68 @@ option like this.")
(gnc:make-html-text
(gnc:html-markup-p
(gnc:html-markup/format
(_ "This is a sample GnuCash report. \
(G_ "This is a sample GnuCash report. \
See the guile (scheme) source code in the scm/report directory \
for details on writing your own reports, \
or extending existing reports.")))
(gnc:html-markup-p
(gnc:html-markup/format
(_ "For help on writing reports, or to contribute your brand \
(G_ "For help on writing reports, or to contribute your brand \
new, totally cool report, consult the mailing list ~a.")
(gnc:html-markup-anchor
"mailto:gnucash-devel@gnucash.org"
(gnc:html-markup-tt "gnucash-devel@gnucash.org")))
(_ "For details on subscribing to that list, see &lt;https://www.gnucash.org/&gt;.")
(_ "You can learn more about writing scheme at &lt;https://www.scheme.com/tspl2d/&gt;."))
(G_ "For details on subscribing to that list, see &lt;https://www.gnucash.org/&gt;.")
(G_ "You can learn more about writing scheme at &lt;https://www.scheme.com/tspl2d/&gt;."))
(gnc:html-markup-p
(gnc:html-markup/format
(_ "The current time is ~a.")
(G_ "The current time is ~a.")
(gnc:html-markup-b time-string)))
(gnc:html-markup-p
(gnc:html-markup/format
(_ "The boolean option is ~a.")
(gnc:html-markup-b (if bool-val (_ "true") (_ "false")))))
(G_ "The boolean option is ~a.")
(gnc:html-markup-b (if bool-val (G_ "true") (G_ "false")))))
(gnc:html-markup-p
(gnc:html-markup/format
(_ "The radio button option is ~a.")
(G_ "The radio button option is ~a.")
(gnc:html-markup-b radio-val)))
(gnc:html-markup-p
(gnc:html-markup/format
(_ "The multi-choice option is ~a.")
(G_ "The multi-choice option is ~a.")
(gnc:html-markup-b (symbol->string mult-val))))
(gnc:html-markup-p
(gnc:html-markup/format
(_ "The string option is ~a.")
(G_ "The string option is ~a.")
(gnc:html-markup-b string-val)))
(gnc:html-markup-p
(gnc:html-markup/format
(_ "The date option is ~a.")
(G_ "The date option is ~a.")
(gnc:html-markup-b date-string)))
(gnc:html-markup-p
(gnc:html-markup/format
(_ "The date and time option is ~a.")
(G_ "The date and time option is ~a.")
(gnc:html-markup-b date-string2)))
(gnc:html-markup-p
(gnc:html-markup/format
(_ "The relative date option is ~a.")
(G_ "The relative date option is ~a.")
(gnc:html-markup-b rel-date-string)))
(gnc:html-markup-p
(gnc:html-markup/format
(_ "The combination date option is ~a.")
(G_ "The combination date option is ~a.")
(gnc:html-markup-b combo-date-string)))
(gnc:html-markup-p
(gnc:html-markup/format
(_ "The number option is ~a.")
(G_ "The number option is ~a.")
(gnc:html-markup-b (number->string num-val))))
;; Here we print the value of the number option formatted as
@ -411,7 +411,7 @@ new, totally cool report, consult the mailing list ~a.")
;; it yourself -- it will be wrong in other locales.
(gnc:html-markup-p
(gnc:html-markup/format
(_ "The number option formatted as currency is ~a.")
(G_ "The number option formatted as currency is ~a.")
(gnc:html-markup-b
(xaccPrintAmount
(inexact->exact num-val)
@ -423,7 +423,7 @@ new, totally cool report, consult the mailing list ~a.")
(gnc:html-document-add-object!
document
(gnc:make-html-text
(gnc:html-markup-p (_ "Items you selected:"))))
(gnc:html-markup-p (G_ "Items you selected:"))))
(if (not (null? list-val))
(let ((table (gnc:make-html-table)))
@ -432,12 +432,12 @@ new, totally cool report, consult the mailing list ~a.")
(gnc:html-table-set-style! table "table"
'attribute (list "style" "width:200px"))
(gnc:html-table-set-caption! table
(_ "List items selected"))
(G_ "List items selected"))
(gnc:html-document-add-object! document table))
(let ((txt (gnc:make-html-text)))
(gnc:html-text-append!
txt
(gnc:html-markup-p (_ "(You selected no list items.)")))
(gnc:html-markup-p (G_ "(You selected no list items.)")))
(gnc:html-document-add-object! document txt)))
;; here's a bullet list of accounts. We can mark up the
@ -473,17 +473,17 @@ new, totally cool report, consult the mailing list ~a.")
(gnc:html-document-add-object!
document
(gnc:make-html-text
(gnc:html-markup-p (_ "You have selected no accounts.")))))
(gnc:html-markup-p (G_ "You have selected no accounts.")))))
(gnc:html-document-add-object!
document
(gnc:make-html-text
(gnc:html-markup-anchor (gnc-build-url URL-TYPE-HELP "gnucash-guide" "") (_ "Display help"))))
(gnc:html-markup-anchor (gnc-build-url URL-TYPE-HELP "gnucash-guide" "") (G_ "Display help"))))
(gnc:html-document-add-object!
document
(gnc:make-html-text
(gnc:html-markup-p (_ "Have a nice day!"))))
(gnc:html-markup-p (G_ "Have a nice day!"))))
document)))

View File

@ -33,7 +33,7 @@
;; Add this module to enable translatable strings
;; Use (N_ string) to mark string for translation (it won't be translated on the spot)
;; Use (_ string) to use a translation of this string if it exists.
;; Use (G_ string) to use a translation of this string if it exists.
(use-modules (gnucash core-utils))
;; It's common to define frequently used strings once
@ -135,26 +135,26 @@
(let ((document (gnc:make-html-document)))
(gnc:html-document-set-title! document (_ reportname))
(gnc:html-document-set-title! document (G_ reportname))
(gnc:html-document-add-object!
document
(gnc:make-html-text (gnc:html-markup-p (_ "Pie:"))))
(gnc:make-html-text (gnc:html-markup-p (G_ "Pie:"))))
(gnc:html-document-add-object! document (simple-pie-chart))
(gnc:html-document-add-object!
document
(gnc:make-html-text (gnc:html-markup-p (_ "Bar, normal:"))))
(gnc:make-html-text (gnc:html-markup-p (G_ "Bar, normal:"))))
(gnc:html-document-add-object! document (simple-bar-chart #f))
(gnc:html-document-add-object!
document
(gnc:make-html-text (gnc:html-markup-p (_ "Bar, stacked:"))))
(gnc:make-html-text (gnc:html-markup-p (G_ "Bar, stacked:"))))
(gnc:html-document-add-object! document (simple-bar-chart #t))
(gnc:html-document-add-object!
document
(gnc:make-html-text (gnc:html-markup-p (_ "Scatter:"))))
(gnc:make-html-text (gnc:html-markup-p (G_ "Scatter:"))))
(gnc:html-document-add-object! document (simple-scatter-chart))
document))
@ -179,11 +179,11 @@
;; The name in the menu
;; (only necessary if it differs from the name)
'menu-name (_ reportname)
'menu-name (G_ reportname)
;; A tip that is used to provide additional information about the
;; report to the user.
'menu-tip (_ reportname)
'menu-tip (G_ reportname)
;; A path describing where to put the report in the menu system.
;; In this case, it's going under the utility menu.

View File

@ -25,7 +25,7 @@
(use-modules (gnucash engine))
(use-modules (gnucash utilities))
(use-modules (gnucash core-utils)) ; for gnc:version and (_ ...)
(use-modules (gnucash core-utils)) ; for gnc:version and (G_ ...)
(use-modules (gnucash app-utils))
(use-modules (gnucash report))
@ -38,10 +38,10 @@
doc
(gnc:make-html-text
(gnc:html-markup-h2
(format #f (_ "Welcome to GnuCash ~a !")
(format #f (G_ "Welcome to GnuCash ~a !")
gnc:version))
(gnc:html-markup-p
(format #f (_ "GnuCash ~a has lots of nice features. Here are a few.")
(format #f (G_ "GnuCash ~a has lots of nice features. Here are a few.")
gnc:version))))
doc))

View File

@ -69,7 +69,7 @@
(define-module (gnucash reports locale-specific de_DE taxtxf))
(use-modules (gnucash engine))
(use-modules (gnucash utilities))
(use-modules (gnucash core-utils)) ; for gnc:version and (_ ...)
(use-modules (gnucash core-utils)) ; for gnc:version and (G_ ...)
(use-modules (gnucash app-utils))
(use-modules (gnucash locale de_DE tax))
(use-modules (gnucash report))
@ -262,7 +262,7 @@
(gnc:html-markup-p
(gnc:html-markup
"blue"
(_ "WARNING: There are duplicate TXF codes assigned\
(G_ "WARNING: There are duplicate TXF codes assigned\
to some accounts. Only TXF codes with payer sources may be repeated."))))
(map (lambda (s)
(gnc:html-text-append!
@ -287,10 +287,10 @@
(gnc:html-table-prepend-row!
table
(append (list (gnc:make-html-table-header-cell/markup
"account-header" (_ "Account Name")))
"account-header" (G_ "Account Name")))
(make-sub-headers max-level)
(list (gnc:make-html-table-header-cell/markup
"number-header" (_ "Total"))))))
"number-header" (G_ "Total"))))))
(define (make-sub-headers max-level)
(if (<= max-level 1)
@ -828,7 +828,7 @@
"center"
(gnc:html-markup-p
(gnc:html-markup/format
(_ "Period from ~a to ~a") from-date to-date)))))
(G_ "Period from ~a to ~a") from-date to-date)))))
(gnc:html-document-add-object!
doc (gnc:make-html-text
@ -871,17 +871,17 @@ Gehen Sie zu Bearbeiten -> Optionen Steuerbericht, um Konten entsprechend einzur
'options-generator tax-options-generator
'renderer (lambda (report-obj)
(generate-tax-or-txf
(_ "Taxable Income / Deductible Expenses")
(_ "This report shows your Taxable Income and \
(G_ "Taxable Income / Deductible Expenses")
(G_ "This report shows your Taxable Income and \
Deductible Expenses.")
report-obj
#t
#f))
'export-types (list (cons (_ "XML") 'txf))
'export-types (list (cons (G_ "XML") 'txf))
'export-thunk (lambda (report-obj choice file-name)
(generate-tax-or-txf
(_ "Taxable Income / Deductible Expenses")
(_ "This page shows your Taxable Income and \
(G_ "Taxable Income / Deductible Expenses")
(G_ "This page shows your Taxable Income and \
Deductible Expenses.")
report-obj
#f

View File

@ -101,7 +101,7 @@
(define-module (gnucash reports locale-specific us taxtxf))
(use-modules (gnucash engine))
(use-modules (gnucash utilities))
(use-modules (gnucash core-utils)) ; for gnc:version and (_ ...)
(use-modules (gnucash core-utils)) ; for gnc:version and (G_ ...)
(use-modules (gnucash app-utils))
(use-modules (gnucash locale us tax))
(use-modules (gnucash gnome-utils))
@ -3371,8 +3371,8 @@
'options-generator tax-options-generator
'renderer (lambda (report-obj)
(generate-tax-schedule
(_ "Taxable Income/Deductible Expenses")
(_ "This report shows transaction detail for your accounts \
(G_ "Taxable Income/Deductible Expenses")
(G_ "This report shows transaction detail for your accounts \
related to Income Taxes.")
report-obj
#t
@ -3380,8 +3380,8 @@ related to Income Taxes.")
'export-types (list (cons "TXF" 'txf))
'export-thunk (lambda (report-obj choice file-name)
(generate-tax-schedule
(_ "Taxable Income/Deductible Expenses")
(_ "This page shows transaction detail for relevant \
(G_ "Taxable Income/Deductible Expenses")
(G_ "This page shows transaction detail for relevant \
Income Tax accounts.")
report-obj
#f

View File

@ -410,9 +410,9 @@ balance at a given time"))
;; accordingly.
(report-title
(case averaging-selection
((YearDelta) (string-append report-title " " (_ "Yearly Average")))
((MonthDelta) (string-append report-title " " (_ "Monthly Average")))
((WeekDelta) (string-append report-title " " (_ "Weekly Average")))
((YearDelta) (string-append report-title " " (G_ "Yearly Average")))
((MonthDelta) (string-append report-title " " (G_ "Monthly Average")))
((WeekDelta) (string-append report-title " " (G_ "Weekly Average")))
(else report-title)))
(combined '())
(other-anchor "")
@ -431,12 +431,9 @@ balance at a given time"))
;; everything foreign gets converted
;; (gnc:sum-collector-commodity) based on the average
;; cost of all holdings.
(gnc-numeric-convert
(* (gnc:gnc-monetary-amount
(gnc:sum-collector-commodity c report-currency exchange-fn))
averaging-multiplier)
(gnc-commodity-get-fraction report-currency)
GNC-RND-ROUND))
(* (gnc:gnc-monetary-amount
(gnc:sum-collector-commodity c report-currency exchange-fn))
averaging-multiplier))
;; Get balance of an account as an inexact number converted to,
;; and using precision of the report's currency.
@ -488,7 +485,7 @@ balance at a given time"))
(sum (apply + (unzip1 finish))))
(set! combined
(append start
(list (list sum (_ "Other")))))
(list (list sum (G_ "Other")))))
(if depth-based?
(let ((options (gnc:make-report-options report-guid))
(id #f))
@ -541,11 +538,11 @@ balance at a given time"))
(string-append
(if do-intervals?
(format #f
(_ "~a to ~a")
(G_ "~a to ~a")
(qof-print-date from-date)
(qof-print-date to-date))
(format #f
(_ "Balance at ~a")
(G_ "Balance at ~a")
(qof-print-date to-date)))
(if show-total?
(let ((total (apply + (unzip1 combined))))

View File

@ -145,7 +145,7 @@
(add-option
(gnc:make-string-option
gnc:pagename-general optname-report-title
"a" opthelp-report-title (_ reportname)))
"a" opthelp-report-title (G_ reportname)))
(add-option
(gnc:make-string-option
gnc:pagename-general optname-party-name
@ -322,7 +322,7 @@
company-name " " report-title " "
(if sx?
;; Translators: This is part of the report title, which is capitalzed in English, but not all other languages
(format #f (_ "For Period Covering ~a to ~a")
(format #f (G_ "For Period Covering ~a to ~a")
(qof-print-date from-date)
(qof-print-date to-date))
(qof-print-date to-date))))
@ -403,10 +403,10 @@
build-table
(map make-header
(append
(if show-code? (list (_ "Code")) '())
(if show-type? (list (_ "Type")) '())
(if show-desc? (list (_ "Description")) '())
(list (_ "Account title")))))
(if show-code? (list (G_ "Code")) '())
(if show-type? (list (G_ "Type")) '())
(if show-desc? (list (G_ "Description")) '())
(list (G_ "Account title")))))
;; add any fields to be displayed before the account name
(if show-code? (add-col 'account-code))
(if show-type? (add-col 'account-type-string))
@ -418,7 +418,7 @@
account-cols))
(when show-bals?
(gnc:html-table-set-cell/tag!
build-table 0 (+ cur-col account-cols) "number-header" (_ "Balance")))
build-table 0 (+ cur-col account-cols) "number-header" (G_ "Balance")))
(let rowloop ((row 0))
(when (< row table-rows)
(gnc:html-table-set-row-markup!
@ -433,7 +433,7 @@
(set! cur-col (+ cur-col hold-table-width))
(when show-notes?
(gnc:html-table-set-cell/tag!
build-table 0 cur-col "number-header" (_ "Notes"))
build-table 0 cur-col "number-header" (G_ "Notes"))
(add-col 'account-notes))
(gnc:html-document-add-object! doc build-table)

View File

@ -1004,8 +1004,8 @@ by preventing negative stock balances.<br/>")
(lambda (foreign domestic date)
(find-price (gnc-pricedb-lookup-nearest-in-time-any-currency-t64
pricedb foreign (time64CanonicalDayTime date)) domestic)))))
(headercols (list (_ "Account")))
(totalscols (list (gnc:make-html-table-cell/markup "total-label-cell" (_ "Total"))))
(headercols (list (G_ "Account")))
(totalscols (list (gnc:make-html-table-cell/markup "total-label-cell" (G_ "Total"))))
(sum-total-moneyin (gnc-numeric-zero))
(sum-total-income (gnc-numeric-zero))
(sum-total-both-gains (gnc-numeric-zero))
@ -1016,37 +1016,37 @@ by preventing negative stock balances.<br/>")
;;begin building lists for which columns to display
(if show-symbol
(begin (append! headercols (list (_ "Symbol")))
(begin (append! headercols (list (G_ "Symbol")))
(append! totalscols (list " "))))
(if show-listing
(begin (append! headercols (list (_ "Listing")))
(begin (append! headercols (list (G_ "Listing")))
(append! totalscols (list " "))))
(if show-shares
(begin (append! headercols (list (_ "Shares")))
(begin (append! headercols (list (G_ "Shares")))
(append! totalscols (list " "))))
(if show-price
(begin (append! headercols (list (_ "Price")))
(begin (append! headercols (list (G_ "Price")))
(append! totalscols (list " "))))
(append! headercols (list " "
(_ "Basis")
(_ "Value")
(_ "Money In")
(_ "Money Out")
(_ "Realized Gain")
(_ "Unrealized Gain")
(_ "Total Gain")
(_ "Rate of Gain")
(_ "Income")))
(G_ "Basis")
(G_ "Value")
(G_ "Money In")
(G_ "Money Out")
(G_ "Realized Gain")
(G_ "Unrealized Gain")
(G_ "Total Gain")
(G_ "Rate of Gain")
(G_ "Income")))
(if (not (eq? handle-brokerage-fees 'ignore-brokerage))
(append! headercols (list (_ "Brokerage Fees"))))
(append! headercols (list (G_ "Brokerage Fees"))))
(append! headercols (list (_ "Total Return")
(_ "Rate of Return")))
(append! headercols (list (G_ "Total Return")
(G_ "Rate of Return")))
(append! totalscols (list " "))
@ -1144,14 +1144,14 @@ by preventing negative stock balances.<br/>")
(gnc:html-document-add-object! document table)
(if (hashq-ref warnings 'warn-price-dirty)
(gnc:html-document-append-objects! document
(list (gnc:make-html-text (_ "* this commodity data was built using transaction pricing instead of the price list."))
(list (gnc:make-html-text (G_ "* this commodity data was built using transaction pricing instead of the price list."))
(gnc:make-html-text (gnc:html-markup-br))
(gnc:make-html-text (_ "If you are in a multi-currency situation, the exchanges may not be correct.")))))
(gnc:make-html-text (G_ "If you are in a multi-currency situation, the exchanges may not be correct.")))))
(if (hashq-ref warnings 'warn-no-price)
(gnc:html-document-append-objects! document
(list (gnc:make-html-text (if (hashq-ref warnings 'warn-price-dirty) (gnc:html-markup-br) ""))
(gnc:make-html-text (_ "** this commodity has no price and a price of 1 has been used.")))))
(gnc:make-html-text (G_ "** this commodity has no price and a price of 1 has been used.")))))
)
;if no accounts selected.

View File

@ -35,7 +35,7 @@
(define reportname (N_ "Balance Forecast"))
(define optname-accounts (N_ "Accounts"))
(define opthelp-accounts (_ "Report on these accounts."))
(define opthelp-accounts (G_ "Report on these accounts."))
(define optname-from-date (N_ "Start Date"))
(define optname-to-date (N_ "End Date"))
@ -47,25 +47,25 @@
(define optname-plot-width (N_ "Plot Width"))
(define optname-plot-height (N_ "Plot Height"))
(define optname-show-markers (N_ "Data markers?"))
(define opthelp-show-markers (_ "Display a mark for each data point."))
(define opthelp-show-markers (G_ "Display a mark for each data point."))
(define optname-show-reserve (N_ "Show reserve line"))
(define opthelp-show-reserve (_ "Show reserve line"))
(define opthelp-show-reserve (G_ "Show reserve line"))
(define optname-reserve (N_ "Reserve amount"))
(define opthelp-reserve (_ "The reserve amount is set to a \
(define opthelp-reserve (G_ "The reserve amount is set to a \
minimum balance desired"))
(define optname-show-target (N_ "Show target line"))
(define opthelp-show-target (_ "Show target line"))
(define opthelp-show-target (G_ "Show target line"))
(define optname-target (N_ "Target amount above reserve"))
(define opthelp-target (_ "The target is used to plan for \
(define opthelp-target (G_ "The target is used to plan for \
a future large purchase, which will be added as a line above the \
reserve amount."))
(define optname-show-minimum (N_ "Show future minimum"))
(define opthelp-show-minimum (_ "The future minimum will add, for each \
(define opthelp-show-minimum (G_ "The future minimum will add, for each \
date point, a projected minimum balance including scheduled transactions."))
; Options generator
@ -233,7 +233,7 @@ date point, a projected minimum balance including scheduled transactions."))
(when show-minimum
(gnc:html-chart-add-data-series!
chart
(_ "Minimum")
(G_ "Minimum")
(let loop ((balances balances) (result '()))
(if (null? balances) (reverse! result)
(loop (cdr balances) (cons (apply min balances) result))))
@ -244,7 +244,7 @@ date point, a projected minimum balance including scheduled transactions."))
;; Balance line (do this here so it draws over the minimum line)
(gnc:html-chart-add-data-series!
chart (_ "Balance") balances "#0A0"
chart (G_ "Balance") balances "#0A0"
'fill #f
'borderWidth 1.5
'pointRadius markers)
@ -252,7 +252,7 @@ date point, a projected minimum balance including scheduled transactions."))
;; Target line
(when show-target
(gnc:html-chart-add-data-series!
chart (_ "Target")
chart (G_ "Target")
(make-list (length intervals) (+ reserve target))
"#FF0"
'fill #f
@ -262,7 +262,7 @@ date point, a projected minimum balance including scheduled transactions."))
;; Reserve line
(when show-reserve
(gnc:html-chart-add-data-series!
chart (_ "Reserve") (make-list (length intervals) reserve)
chart (G_ "Reserve") (make-list (length intervals) reserve)
"#F00"
'fill #f
'borderWidth 1.5
@ -272,7 +272,7 @@ date point, a projected minimum balance including scheduled transactions."))
;; Set the chart titles
(gnc:html-chart-set-title!
chart (list report-title
(format #f (_ "~a to ~a")
(format #f (G_ "~a to ~a")
(qof-print-date from-date) (qof-print-date to-date))))
;; Set the chart size
(gnc:html-chart-set-width! chart plot-width)

View File

@ -154,7 +154,7 @@
(add-option
(gnc:make-string-option
gnc:pagename-general optname-report-title
"a" opthelp-report-title (_ reportname)))
"a" opthelp-report-title (G_ reportname)))
(add-option
(gnc:make-string-option
gnc:pagename-general optname-party-name
@ -383,11 +383,11 @@
(let* ((liability-table
(gnc:make-html-acct-table/env/accts table-env liability-accounts)))
(when label-liabilities?
(add-subtotal-line parent-table (_ "Liabilities") #f #f))
(add-subtotal-line parent-table (G_ "Liabilities") #f #f))
(gnc:html-table-add-account-balances parent-table liability-table params)
(when total-liabilities?
(add-subtotal-line
parent-table (_ "Total Liabilities") #f liability-balance))
parent-table (G_ "Total Liabilities") #f liability-balance))
(add-rule parent-table)))
(define (get-total-value-fn account)
@ -482,10 +482,10 @@
(gnc:report-percent-done 80)
(when label-assets?
(add-subtotal-line left-table (_ "Assets") #f #f))
(add-subtotal-line left-table (G_ "Assets") #f #f))
(gnc:html-table-add-account-balances left-table asset-table params)
(when total-assets?
(add-subtotal-line left-table (_ "Total Assets") #f asset-balance))
(add-subtotal-line left-table (G_ "Total Assets") #f asset-balance))
(when report-form?
(add-rule left-table)
@ -499,29 +499,29 @@
(gnc:report-percent-done 88)
(when label-equity?
(add-subtotal-line right-table (_ "Equity") #f #f))
(add-subtotal-line right-table (G_ "Equity") #f #f))
(gnc:html-table-add-account-balances right-table equity-table params)
;; we omit retained earnings & unrealized gains
;; from the balance report, if zero, since they
;; are not present on normal balance sheets
(unless (gnc-commodity-collector-allzero? retained-earnings)
(add-subtotal-line right-table
(_ "Retained Earnings")
(_ "Retained Losses")
(G_ "Retained Earnings")
(G_ "Retained Losses")
retained-earnings))
(unless (gnc-commodity-collector-allzero? trading-balance)
(add-subtotal-line right-table
(_ "Trading Gains")
(_ "Trading Losses")
(G_ "Trading Gains")
(G_ "Trading Losses")
trading-balance))
(unless (gnc-commodity-collector-allzero? unrealized-gain-collector)
(add-subtotal-line right-table
(_ "Unrealized Gains")
(_ "Unrealized Losses")
(G_ "Unrealized Gains")
(G_ "Unrealized Losses")
unrealized-gain-collector))
(when total-equity?
(add-subtotal-line
right-table (_ "Total Equity") #f total-equity-balance))
right-table (G_ "Total Equity") #f total-equity-balance))
(add-rule right-table)
@ -531,7 +531,7 @@
total-liabilities? liability-balance))
(add-subtotal-line
right-table (gnc:html-string-sanitize (_ "Total Liabilities & Equity"))
right-table (gnc:html-string-sanitize (G_ "Total Liabilities & Equity"))
#f liability-plus-equity)
(gnc:html-document-add-object!

View File

@ -42,16 +42,17 @@
(use-modules (ice-9 local-eval)) ; for the-environment
(use-modules (srfi srfi-13)) ; for extra string functions
(use-modules (srfi srfi-9))
(define debugging? #f)
(define (debug . args)
(if debugging?
(for arg in args do
(if (string? arg)
(display (string-append arg " "))
(display (string-append (dump arg) " "))))
))
(when debugging?
(for-each
(lambda (arg)
(display (if (string? arg) arg (dump arg)))
(display " "))
args)))
(define (hrule cols) ; in fact just puts in an empty row for spacing
(display "<tr valign=\"center\"><td colspan=\"")
@ -102,77 +103,44 @@
(display " sublist: ") (if (accrec-sublist accrec)
(begin
(display "\n<ul>")
(for sub-accrec in (accrec-sublist accrec) do
(for-each
(lambda (sub-accrec)
(display "\n<li>")
(accrec-printer sub-accrec port)
(display "</li>"))
(accrec-sublist accrec))
(display "</ul>"))
(display "#f")))
(define accrectype (make-record-type "accrecc"
'(account
code
placeholder?
namelink ; a/c name, as link if required
commodity
balance-num ; excluding sublist
depth
treedepth
non-zero? ; #t if this or any sub-a/cs are non zero
summary? ; #t if subaccounts summarised here
subtotal-cc ; of sublist plus this a/c
sublist)
accrec-printer))
(define newaccrec-full (record-constructor accrectype)) ; requires all the fields
(define (newaccrec-clean)
;; Create a new accrec with 'clean' empty values, e.g. strings are "", not #f
(newaccrec-full #f ; account
"" ; code
#f ; placeholder?
"" ; namelink
(gnc-default-currency) ; commodity
(gnc-numeric-zero) ; balance-num
0 ; depth
0 ; treedepth
#f ; non-zero?
#f ; summary?
(gnc:make-commodity-collector) ; subtotal-cc
#f ;'() ; sublist
))
(define accrec? (record-predicate accrectype))
(define accrec-account (record-accessor accrectype 'account))
(define accrec-code (record-accessor accrectype 'code))
(define accrec-placeholder? (record-accessor accrectype 'placeholder?))
(define accrec-namelink (record-accessor accrectype 'namelink))
(define accrec-commodity (record-accessor accrectype 'commodity))
(define accrec-balance-num (record-accessor accrectype 'balance-num))
(define-record-type <accrec>
(newaccrec-full account code placeholder? namelink commodity balance-num depth
treedepth non-zero? summary? subtotal-cc sublist)
accrec?
(account accrec-account accrec-set-account!)
(code accrec-code accrec-set-code!)
(placeholder? accrec-placeholder? accrec-set-placeholder?!)
(namelink accrec-namelink accrec-set-namelink!)
(commodity accrec-commodity accrec-set-commodity!)
(balance-num accrec-balance-num accrec-set-balance-num!)
(depth accrec-depth accrec-set-depth!)
(treedepth accrec-treedepth accrec-set-treedepth!)
(non-zero? accrec-non-zero? accrec-set-non-zero?!)
(summary? accrec-summary? accrec-set-summary?!)
(subtotal-cc accrec-subtotal-cc accrec-set-subtotal-cc!)
(sublist accrec-sublist accrec-set-sublist!))
(define (accrec-balance-mny accrec)
(gnc:make-gnc-monetary (accrec-commodity accrec) (accrec-balance-num accrec)))
(define accrec-depth (record-accessor accrectype 'depth))
(define accrec-treedepth (record-accessor accrectype 'treedepth))
(define accrec-non-zero? (record-accessor accrectype 'non-zero?))
(define accrec-summary? (record-accessor accrectype 'summary?))
(define accrec-subtotal-cc (record-accessor accrectype 'subtotal-cc))
(define accrec-sublist (record-accessor accrectype 'sublist))
(define accrec-set-account! (record-modifier accrectype 'account))
(define accrec-set-code! (record-modifier accrectype 'code))
(define accrec-set-placeholder?! (record-modifier accrectype 'placeholder?))
(define accrec-set-namelink! (record-modifier accrectype 'namelink))
(define accrec-set-commodity! (record-modifier accrectype 'commodity))
(define accrec-set-balance-num! (record-modifier accrectype 'balance-num))
(define (accrec-set-balance-mny! accrec mny)
(accrec-set-commodity! accrec (gnc:gnc-monetary-commodity mny))
(accrec-set-balance-num! accrec (gnc:gnc-monetary-amount mny)))
(define accrec-set-depth! (record-modifier accrectype 'depth))
(define accrec-set-treedepth! (record-modifier accrectype 'treedepth))
(define accrec-set-non-zero?! (record-modifier accrectype 'non-zero?))
(define accrec-set-summary?! (record-modifier accrectype 'summary?))
(define accrec-set-subtotal-cc! (record-modifier accrectype 'subtotal-cc))
(define accrec-set-sublist! (record-modifier accrectype 'sublist))
(define (newaccrec-clean)
(newaccrec-full #f "" #f "" (gnc-default-currency) 0 0 0 #f #f
(gnc:make-commodity-collector) #f))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; All the options stuff starts here
(define reportname (_ "Balance Sheet (eguile)"))
(define reportname (G_ "Balance Sheet (eguile)"))
;; define all option's names and help text so that they are properly
;; defined in *one* place.
@ -370,21 +338,6 @@
(html #f))
;; end of all the lets. time for some real code
;; The following routines are defined inside
;; the renderer to make options available:
;; number formatting stuff
(define (fmtnumber n)
;; format double n with as many decimal places as required
(number->string (if (integer? n) (inexact->exact n) n)))
(define (fmtnumeric n)
;; format gnc-numeric n for printing
(fmtnumber (gnc-numeric-to-double n)))
;; HTML-specific formatting
(define (negstyle item)
;; apply styling for negative amounts
(string-append "<span class=\"negative\">" item "</span>"))
@ -430,10 +383,10 @@
;; Reason 1: zero Imbalance a/c
;; The line break in the next expressions will suppress comments as translator comments.
(string-prefix?
(_ "Imbalance") (xaccAccountGetName (accrec-account accrec)))
(G_ "Imbalance") (xaccAccountGetName (accrec-account accrec)))
;; Reason 2: zero Orphan a/c
(string-prefix?
(_ "Orphan") (xaccAccountGetName (accrec-account accrec))))))
(G_ "Orphan") (xaccAccountGetName (accrec-account accrec))))))
(define (flattened-acc-depth acc)
;; Accounts deeper than required get moved to the requested depth

View File

@ -49,7 +49,7 @@
(define FOOTER-TEXT
(gnc:make-html-text
(_ "WARNING: Foreign currency conversions, and unrealized gains
(G_ "WARNING: Foreign currency conversions, and unrealized gains
calculations are not confirmed correct. This report may be modified
without notice. Bug reports are very welcome at
https://bugs.gnucash.org/")))
@ -134,32 +134,32 @@ also show overall period profit & loss."))
(define periodlist
(list
(list 'disabled
(cons 'text (_ "Disabled"))
(cons 'tip (_ "Disabled")))
(cons 'text (G_ "Disabled"))
(cons 'tip (G_ "Disabled")))
(list 'YearDelta
(cons 'text (_ "Year"))
(cons 'tip (_ "One year.")))
(cons 'text (G_ "Year"))
(cons 'tip (G_ "One year.")))
(list 'HalfYearDelta
(cons 'text (_ "Half Year"))
(cons 'tip (_ "Half Year.")))
(cons 'text (G_ "Half Year"))
(cons 'tip (G_ "Half Year.")))
(list 'QuarterDelta
(cons 'text (_ "Quarter"))
(cons 'tip (_ "One Quarter.")))
(cons 'text (G_ "Quarter"))
(cons 'tip (G_ "One Quarter.")))
(list 'MonthDelta
(cons 'text (_ "Month"))
(cons 'tip (_ "One Month.")))
(cons 'text (G_ "Month"))
(cons 'tip (G_ "One Month.")))
(list 'TwoWeekDelta
(cons 'text (_ "2Week"))
(cons 'tip (_ "Two Weeks.")))
(cons 'text (G_ "2Week"))
(cons 'tip (G_ "Two Weeks.")))
(list 'WeekDelta
(cons 'text (_ "Week"))
(cons 'tip (_ "One Week.")))))
(cons 'text (G_ "Week"))
(cons 'tip (G_ "One Week.")))))
(define (keylist->vectorlist keylist)
(map
@ -235,11 +235,11 @@ also show overall period profit & loss."))
"d" opthelp-options-summary
'never
(list (vector 'always
(_ "Always")
(_ "Always display summary."))
(G_ "Always")
(G_ "Always display summary."))
(vector 'never
(_ "Never")
(_ "Disable report summary.")))))
(G_ "Never")
(G_ "Disable report summary.")))))
;; accounts to work on
(add-option
@ -493,7 +493,7 @@ also show overall period profit & loss."))
(disable-account-indent? (gnc-account-get-full-name account))
(else (xaccAccountGetName account))))
(acct-label (if (and (not virtual?) total?)
(string-append (_ "Total For ") acct-name)
(string-append (G_ "Total For ") acct-name)
acct-name))
(acct-url (and account-anchor?
(not total?)
@ -649,7 +649,7 @@ also show overall period profit & loss."))
(if show-total?
(add-indented-row 0
(string-append (_ "Total For ") title)
(string-append (G_ "Total For ") title)
"total-label-cell"
"primary-subheading"
maxindent
@ -841,7 +841,7 @@ also show overall period profit & loss."))
(format #f "~a ~a "
(gnc:monetary->string orig-monetary)
(gnc-commodity-get-nice-symbol common-currency))
(_ "missing")))))
(G_ "missing")))))
(gnc:html-text-append! cell (gnc:html-markup-br)))
commodities)
(gnc:make-html-table-cell/markup "number-cell" cell))))
@ -905,7 +905,7 @@ also show overall period profit & loss."))
(display report-title)
(display " ")
(if (or (not (eq? incr 'disabled)) (eq? report-type 'pnl))
(format #t (_ "~a to ~a")
(format #t (G_ "~a to ~a")
(qof-print-date startdate) (qof-print-date enddate))
(display (qof-print-date enddate))))))
@ -1076,49 +1076,49 @@ also show overall period profit & loss."))
))))
(unless (eq? incr 'disabled)
(add-to-table multicol-table-left (_ "Date") '()
(add-to-table multicol-table-left (G_ "Date") '()
#:get-col-header-fn get-col-header-fn
#:show-accounts? #f
#:show-total? #f)
(if enable-dual-columns?
(add-to-table multicol-table-right (_ "Date") '()
(add-to-table multicol-table-right (G_ "Date") '()
#:get-col-header-fn get-col-header-fn
#:show-accounts? #f
#:show-total? #f)))
(unless (null? asset-accounts)
(add-to-table multicol-table-left (_ "Asset") asset-accounts))
(add-to-table multicol-table-left (G_ "Asset") asset-accounts))
(unless (null? liability-accounts)
(add-to-table multicol-table-right (_ "Liability") liability-accounts
(add-to-table multicol-table-right (G_ "Liability") liability-accounts
#:negate-amounts? #t))
(add-to-table
multicol-table-right (_ "Equity")
multicol-table-right (G_ "Equity")
(append equity-accounts
(cond
(use-trading-accts? trading-accounts)
(common-currency (list (vector (_ "Unrealized Gains")
(common-currency (list (vector (G_ "Unrealized Gains")
unrealized-gain-fn)))
(else '()))
(if (null? income-expense)
'()
(list (vector (_ "Retained Earnings")
(list (vector (G_ "Retained Earnings")
retained-earnings-fn))))
#:negate-amounts? #t)
(add-to-table multicol-table-right (_ "Liability and Equity")
(add-to-table multicol-table-right (G_ "Liability and Equity")
(append liability-accounts
equity-accounts
(cond
(use-trading-accts? trading-accounts)
(common-currency (list (vector (_ "Unrealized Gains")
(common-currency (list (vector (G_ "Unrealized Gains")
unrealized-gain-fn)))
(else '()))
(if (null? income-expense)
'()
(list (vector (_ "Retained Earnings")
(list (vector (G_ "Retained Earnings")
retained-earnings-fn))))
#:negate-amounts? #t
#:show-title? #f
@ -1126,7 +1126,7 @@ also show overall period profit & loss."))
#:show-total? #t)
(if (and common-currency show-rates?)
(add-to-table multicol-table-right (_ "Exchange Rates")
(add-to-table multicol-table-right (G_ "Exchange Rates")
asset-liability
#:get-col-header-fn get-exchange-rates-fn
#:show-accounts? #f
@ -1136,7 +1136,7 @@ also show overall period profit & loss."))
(gnc:html-document-add-object!
doc
(gnc:make-html-text
(gnc:html-markup-anchor chart (_ "Barchart")))))))
(gnc:html-markup-anchor chart (G_ "Barchart")))))))
((eq? report-type 'pnl)
(let* ((include-overall-period? (get-option gnc:pagename-general
@ -1205,7 +1205,7 @@ also show overall period profit & loss."))
(header (gnc:make-html-text
(qof-print-date (car datepair))
(gnc:html-markup-br)
(_ " to ")
(G_ " to ")
(qof-print-date (cdr datepair))))
(cell (gnc:make-html-table-cell/markup
"total-label-cell" header)))
@ -1248,33 +1248,33 @@ also show overall period profit & loss."))
get-cell-anchor-fn)))))
(unless (eq? incr 'disabled)
(add-to-table multicol-table-left (_ "Period") '()
(add-to-table multicol-table-left (G_ "Period") '()
#:get-col-header-fn get-col-header-fn
#:show-accounts? #f
#:show-total? #f)
(if enable-dual-columns?
(add-to-table multicol-table-right (_ "Period") '()
(add-to-table multicol-table-right (G_ "Period") '()
#:get-col-header-fn get-col-header-fn
#:show-accounts? #f
#:show-total? #f)))
(unless (null? income-accounts)
(add-to-table multicol-table-left (_ "Income") income-accounts
(add-to-table multicol-table-left (G_ "Income") income-accounts
#:negate-amounts? #t))
(unless (null? expense-accounts)
(add-to-table multicol-table-right (_ "Expense") expense-accounts))
(add-to-table multicol-table-right (G_ "Expense") expense-accounts))
(unless (or (null? income-accounts)
(null? expense-accounts))
(add-to-table multicol-table-left (_ "Net Income")
(add-to-table multicol-table-left (G_ "Net Income")
income-expense
#:show-accounts? #f
#:negate-amounts? #t
#:force-total? #t))
(if (and common-currency show-rates?)
(add-to-table multicol-table-left (_ "Exchange Rates")
(add-to-table multicol-table-left (G_ "Exchange Rates")
income-expense
#:get-col-header-fn get-exchange-rates-fn
#:show-accounts? #f
@ -1303,8 +1303,8 @@ also show overall period profit & loss."))
;; doc " table, td{ border-width: 1px; border-style:solid; border-color: lightgray; border-collapse: collapse}")
doc))
(define balsheet-reportname (_ "Balance Sheet (Multicolumn)"))
(define pnl-reportname (_ "Income Statement (Multicolumn)"))
(define balsheet-reportname (G_ "Balance Sheet (Multicolumn)"))
(define pnl-reportname (G_ "Income Statement (Multicolumn)"))
(gnc:define-report
'version 1

View File

@ -122,7 +122,7 @@
(add-option
(gnc:make-string-option
gnc:pagename-general optname-report-title
"a" opthelp-report-title (_ reportname)))
"a" opthelp-report-title (G_ reportname)))
(add-option
(gnc:make-string-option
gnc:pagename-general optname-party-name
@ -661,7 +661,7 @@
(gnc:html-table-append-row! right-table space)))
(gnc:report-percent-done 80)
(if label-assets? (add-subtotal-line left-table (_ "Assets") #f #f))
(if label-assets? (add-subtotal-line left-table (G_ "Assets") #f #f))
(set! asset-table
(gnc:make-html-acct-table/env/accts
(append table-env (list (list 'get-balance-fn asset-get-balance-fn)))
@ -673,16 +673,16 @@
(if new-existing?
(begin
(add-subtotal-line
left-table (_ "Existing Assets") #f existing-assets)
left-table (G_ "Existing Assets") #f existing-assets)
(add-subtotal-line
left-table (_ "Allocated Assets") #f allocated-assets)))
left-table (G_ "Allocated Assets") #f allocated-assets)))
(if (not (gnc-commodity-collector-allzero? unallocated-assets))
(add-subtotal-line
left-table (_ "Unallocated Assets") #f unallocated-assets))
left-table (G_ "Unallocated Assets") #f unallocated-assets))
(add-subtotal-line
left-table (_ "Total Assets") #f asset-balance)))
left-table (G_ "Total Assets") #f asset-balance)))
(if report-form?
(add-rule left-table))
@ -691,7 +691,7 @@
(gnc:report-percent-done 85)
(if label-liabilities?
(add-subtotal-line right-table (_ "Liabilities") #f #f))
(add-subtotal-line right-table (G_ "Liabilities") #f #f))
(set! liability-table
(gnc:make-html-acct-table/env/accts
(append table-env
@ -705,22 +705,22 @@
(begin
(add-subtotal-line
right-table
(_ "Existing Liabilities")
(G_ "Existing Liabilities")
#f
existing-liabilities)
(add-subtotal-line
right-table (_ "New Liabilities") #f new-liabilities)))
right-table (G_ "New Liabilities") #f new-liabilities)))
(add-subtotal-line
right-table (_ "Total Liabilities") #f liability-balance)))
right-table (G_ "Total Liabilities") #f liability-balance)))
(add-rule right-table)
(gnc:report-percent-done 88)
(if label-equity?
(add-subtotal-line
right-table (_ "Equity") #f #f))
right-table (G_ "Equity") #f #f))
(set! equity-table
(gnc:make-html-acct-table/env/accts
(append table-env
@ -736,27 +736,27 @@
(begin
(add-subtotal-line
right-table
(_ "Existing Retained Earnings")
(_ "Existing Retained Losses")
(G_ "Existing Retained Earnings")
(G_ "Existing Retained Losses")
existing-retained-earnings)
(add-subtotal-line
right-table
(_ "New Retained Earnings")
(_ "New Retained Losses")
(G_ "New Retained Earnings")
(G_ "New Retained Losses")
new-retained-earnings)))
(add-subtotal-line
right-table
(_ "Total Retained Earnings")
(_ "Total Retained Losses")
(G_ "Total Retained Earnings")
(G_ "Total Retained Losses")
retained-earnings))
(if (not (gnc-commodity-collector-allzero? unrealized-gain))
(add-subtotal-line right-table
(_ "Unrealized Gains")
(_ "Unrealized Losses")
(G_ "Unrealized Gains")
(G_ "Unrealized Losses")
unrealized-gain))
@ -765,19 +765,19 @@
(if new-existing?
(begin
(add-subtotal-line
right-table (_ "Existing Equity") #f existing-equity)
right-table (G_ "Existing Equity") #f existing-equity)
(add-subtotal-line
right-table (_ "New Equity") #f new-equity)))
right-table (G_ "New Equity") #f new-equity)))
(add-subtotal-line
right-table (_ "Total Equity") #f equity-balance)))
right-table (G_ "Total Equity") #f equity-balance)))
(add-rule right-table)
(add-subtotal-line
right-table
(gnc:html-string-sanitize (_ "Total Liabilities & Equity"))
(gnc:html-string-sanitize (G_ "Total Liabilities & Equity"))
#f
liability-plus-equity)

View File

@ -213,18 +213,18 @@
(list (xaccAccountGetName acct)
;; Translators: Bgt and Act refer to budgeted and
;; actual total amounts.
(format #f (_ "Bgt: ~a Act: ~a")
(format #f (G_ "Bgt: ~a Act: ~a")
(amount->monetary bgt-sum)
(amount->monetary act-sum)))
(list (xaccAccountGetName acct))))
(gnc:html-chart-set-data-labels! chart (reverse dates-list))
(gnc:html-chart-add-data-series! chart
(_ "Actual")
(G_ "Actual")
(reverse act-vals)
"#FF4136"
'fill (eq? chart-type 'bars))
(gnc:html-chart-add-data-series! chart
(_ "Budget")
(G_ "Budget")
(reverse bgt-vals)
"#0074D9"
'fill (eq? chart-type 'bars))

View File

@ -165,7 +165,7 @@
(gnc:sum-collector-commodity act-total report-currency exchange-fn)))
(gnc:html-table-add-budget-row!
html-table "total-number-cell"
(string-append (_ "Total") ":")
(string-append (G_ "Total") ":")
bgt-total-numeric act-total-numeric)
(gnc:html-table-append-row!
@ -244,7 +244,7 @@
;; Display Grand Total
(gnc:html-table-add-budget-row!
html-table "total-number-cell"
(string-append (_ "Total") ":") bgt-total-numeric act-total-numeric))))
(string-append (G_ "Total") ":") bgt-total-numeric act-total-numeric))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; budget-renderer
@ -303,7 +303,7 @@
;; Display Title Name - Budget - Period
(gnc:html-document-set-title!
doc (format #f (_ "~a: ~a - ~a")
doc (format #f (G_ "~a: ~a - ~a")
report-name (gnc-budget-get-name budget)
(qof-print-date (gnc-budget-get-period-start-date
budget (1- period)))))

View File

@ -141,7 +141,7 @@
(add-option
(gnc:make-string-option
gnc:pagename-general optname-report-title
"a" opthelp-report-title (_ reportname)))
"a" opthelp-report-title (G_ reportname)))
(add-option
(gnc:make-string-option
gnc:pagename-general optname-party-name
@ -439,7 +439,7 @@
(gnc:html-document-add-object!
doc (gnc:html-make-generic-simple-warning
report-title
(_ "Reporting range end period cannot be less than start period."))))
(G_ "Reporting range end period cannot be less than start period."))))
(else
;; Get all the balances for each of the account types.
@ -507,20 +507,20 @@
(let ((table (gnc:make-html-table)))
(gnc:html-table-append-row! table space)
(when label-revenue?
(add-subtotal-line table (_ "Revenues") #f #f))
(add-subtotal-line table (G_ "Revenues") #f #f))
(gnc:html-table-add-account-balances table revenue-table params)
(when total-revenue?
(add-subtotal-line table (_ "Total Revenue") #f revenue-total))
(add-subtotal-line table (G_ "Total Revenue") #f revenue-total))
table))
(exp-table
(let ((table (gnc:make-html-table)))
(gnc:html-table-append-row! table space)
(when label-expense?
(add-subtotal-line table (_ "Expenses") #f #f))
(add-subtotal-line table (G_ "Expenses") #f #f))
(gnc:html-table-add-account-balances table expense-table params)
(when total-expense?
(add-subtotal-line table (_ "Total Expenses") #f expense-total))
(add-subtotal-line table (G_ "Total Expenses") #f expense-total))
table))
(budget-name (gnc-budget-get-name budget))
@ -528,12 +528,12 @@
(period-for
(cond
((not use-budget-period-range?)
(format #f (_ "for Budget ~a") budget-name))
(format #f (G_ "for Budget ~a") budget-name))
((= user-budget-period-start user-budget-period-end)
(format #f (_ "for Budget ~a Period ~d")
(format #f (G_ "for Budget ~a Period ~d")
budget-name user-budget-period-start))
(else
(format #f (_ "for Budget ~a Periods ~d - ~d")
(format #f (G_ "for Budget ~a Periods ~d - ~d")
budget-name user-budget-period-start
user-budget-period-end)))))
@ -561,8 +561,8 @@
(report-line
(if standard-order? exp-table inc-table)
(string-append (_ "Net income") " " period-for)
(string-append (_ "Net loss") " " period-for)
(string-append (G_ "Net income") " " period-for)
(string-append (G_ "Net loss") " " period-for)
net-income
(* 2 (1- tree-depth)) exchange-fn #f #f)

View File

@ -505,9 +505,9 @@
html-table 0 current-col
(cond
((eq? (car column-list) 'total)
(_ "Total"))
(G_ "Total"))
((list? (car column-list))
(format #f (_ "~a to ~a")
(format #f (G_ "~a to ~a")
(period-to-date-string (car (car column-list)))
(period-to-date-string (last (car column-list)))))
(else
@ -531,17 +531,17 @@
(gnc:html-table-set-cell/tag!
html-table 1 col0 "centered-label-cell"
;; Translators: Abbreviation for "Budget" amount
(_ "Bgt")))
(G_ "Bgt")))
(when show-actual?
(gnc:html-table-set-cell/tag!
html-table 1 col1 "centered-label-cell"
;; Translators: Abbreviation for "Actual" amount
(_ "Act")))
(G_ "Act")))
(when show-diff?
(gnc:html-table-set-cell/tag!
html-table 1 col2 "centered-label-cell"
;; Translators: Abbreviation for "Difference" amount
(_ "Diff")))
(G_ "Diff")))
(loop (cdr column-list)
col3))))))
@ -771,7 +771,7 @@
;; budget will report on budgeted and actual
;; amounts from the beginning of budget, instead
;; of only using the budget-period amounts.
(if accumulate? (_ "using accumulated amounts")
(if accumulate? (G_ "using accumulated amounts")
"")))
;; We do this in two steps: First the account names... the

View File

@ -185,7 +185,7 @@
doc (string-append
(get-option gnc:pagename-general gnc:optname-reportname)
" - "
(format #f (_ "~a to ~a")
(format #f (G_ "~a to ~a")
(qof-print-date from-date-t64) (qof-print-date to-date-t64))))
(if (not (null? accounts))
@ -200,8 +200,8 @@
(if (and (= (gnc-account-get-current-depth account) tree-depth)
(pair? (gnc-account-get-children account)))
(if show-subaccts?
(_ "~a and subaccounts")
(_ "~a and selected subaccounts"))
(G_ "~a and subaccounts")
(G_ "~a and selected subaccounts"))
"~a")
(gnc:html-markup-anchor
(gnc:account-anchor-text account)
@ -251,7 +251,7 @@
(gnc:html-document-add-object!
doc
(gnc:make-html-text (_ "Selected Accounts")))
(gnc:make-html-text (G_ "Selected Accounts")))
(gnc:html-document-add-object!
doc
@ -265,7 +265,7 @@
table
"primary-subheading"
(list
(_ "Money into selected accounts comes from")
(G_ "Money into selected accounts comes from")
""))
(add-accounts-flow money-in-accounts money-in-alist)
@ -274,7 +274,7 @@
table
"grand-total"
(list
(gnc:make-html-table-header-cell/markup "text-cell" (_ "Money In"))
(gnc:make-html-table-header-cell/markup "text-cell" (G_ "Money In"))
(gnc:make-html-table-header-cell/markup
"total-number-cell"
(gnc:sum-collector-commodity
@ -286,7 +286,7 @@
table
"primary-subheading"
(list
(_ "Money out of selected accounts goes to")
(G_ "Money out of selected accounts goes to")
""))
(add-accounts-flow money-out-accounts money-out-alist)
@ -295,7 +295,7 @@
table
"grand-total"
(list
(gnc:make-html-table-header-cell/markup "text-cell" (_ "Money Out"))
(gnc:make-html-table-header-cell/markup "text-cell" (G_ "Money Out"))
(gnc:make-html-table-header-cell/markup
"total-number-cell"
(gnc:sum-collector-commodity
@ -307,7 +307,7 @@
table
"grand-total"
(list
(gnc:make-html-table-header-cell/markup "text-cell" (_ "Difference"))
(gnc:make-html-table-header-cell/markup "text-cell" (G_ "Difference"))
(gnc:make-html-table-header-cell/markup
"total-number-cell"
(gnc:sum-collector-commodity

View File

@ -279,7 +279,7 @@
(gnc:html-chart-set-title!
chart (list report-title
(format #f
(_ "~a to ~a")
(G_ "~a to ~a")
(qof-print-date from-date-t64)
(qof-print-date to-date-t64))))
(gnc:html-chart-set-width! chart width)
@ -294,19 +294,19 @@
(gnc:html-chart-set-data-labels! chart date-string-list)
(if show-in?
(gnc:html-chart-add-data-series! chart
(_ "Money In")
(G_ "Money In")
(map gnc:gnc-monetary-amount in-list)
"#0074D9"
'urls cashflow-urls))
(if show-out?
(gnc:html-chart-add-data-series! chart
(_ "Money Out")
(G_ "Money Out")
(map gnc:gnc-monetary-amount out-list)
"#FF4136"
'urls cashflow-urls))
(if show-net?
(gnc:html-chart-add-data-series! chart
(_ "Net Flow")
(G_ "Net Flow")
(map gnc:gnc-monetary-amount net-list)
"#2ECC40"
'urls cashflow-urls))
@ -328,13 +328,13 @@
(if (and non-zeros show-table?)
(let* ((table (gnc:make-html-table)))
(gnc:html-table-set-col-headers!
table (append (list (_ "Date"))
(if show-in? (list (_ "Money In")) '())
(if show-out? (list (_ "Money Out")) '())
(if show-net? (list (_ "Net Flow")) '())))
table (append (list (G_ "Date"))
(if show-in? (list (G_ "Money In")) '())
(if show-out? (list (G_ "Money Out")) '())
(if show-net? (list (G_ "Net Flow")) '())))
(gnc:html-document-add-object!
doc (gnc:make-html-text (gnc:html-markup-h3 (_ "Overview:"))))
doc (gnc:make-html-text (gnc:html-markup-h3 (G_ "Overview:"))))
(gnc:html-table-append-column! table (append date-string-list (list "Total")))
(if show-in?

View File

@ -301,9 +301,9 @@ developing over time"))
;; accordingly.
(report-title
(case averaging-selection
((MonthDelta) (string-append report-title " " (_ "Monthly Average")))
((WeekDelta) (string-append report-title " " (_ "Weekly Average")))
((DayDelta) (string-append report-title " " (_ "Daily Average")))
((MonthDelta) (string-append report-title " " (G_ "Monthly Average")))
((WeekDelta) (string-append report-title " " (G_ "Weekly Average")))
((DayDelta) (string-append report-title " " (G_ "Daily Average")))
(else report-title)))
(currency-frac (gnc-commodity-get-fraction report-currency))
;; This is the list of date intervals to calculate.
@ -509,8 +509,8 @@ developing over time"))
chart (list report-title
(format #f
(if do-intervals?
(_ "~a to ~a")
(_ "Balances ~a to ~a"))
(G_ "~a to ~a")
(G_ "Balances ~a to ~a"))
(qof-print-date from-date-t64)
(qof-print-date to-date-t64))))
@ -532,7 +532,7 @@ developing over time"))
(apply zip (map cadr finish)))))
(set! all-data
(append start
(list (list (_ "Other") other-sum))))
(list (list (G_ "Other") other-sum))))
(let* ((options (gnc:make-report-options reportguid)))
;; now copy all the options
(gnc:options-copy-values
@ -630,7 +630,7 @@ developing over time"))
(gnc:html-table-set-col-headers!
table
(append
(list (_ "Date"))
(list (G_ "Date"))
(map
(lambda (col)
(cond
@ -639,7 +639,7 @@ developing over time"))
(else (xaccAccountGetName col))))
(map car all-data))
(if cols>1?
(list (_ "Grand Total"))
(list (G_ "Grand Total"))
'())))
(gnc:html-document-add-object! document table))))

View File

@ -288,10 +288,10 @@
(type-str (N_ "Customer")))
(gnc:html-document-set-title!
document (string-append (_ type-str) " " (_ "Report")))
document (string-append (G_ type-str) " " (G_ "Report")))
(gnc:html-document-set-title!
document (format #f (_ "~a ~a - ~a")
document (format #f (G_ "~a ~a - ~a")
report-title
(qof-print-date start-date)
(qof-print-date end-date)))
@ -311,19 +311,19 @@
(gnc:html-document-add-object!
document
(gnc:make-html-text
(_ "No valid customer found."))))
(G_ "No valid customer found."))))
(else
(let ((all-splits (query #f all-accounts start-date end-date))
(table (gnc:make-html-table))
(total-sales (gnc:make-commodity-collector))
(total-expense (gnc:make-commodity-collector))
(headings (cons* (_ "Customer")
(_ "Profit")
(_ "Markup")
(_ "Sales")
(headings (cons* (G_ "Customer")
(G_ "Profit")
(G_ "Markup")
(G_ "Sales")
(if show-column-expense?
(list (_ "Expense"))
(list (G_ "Expense"))
'())))
(results (map
(lambda (owner)
@ -399,7 +399,7 @@
(unless (and (zero? profit) (zero? sales))
(set! sortingtable
(cons (vector
(_ "No Customer") comm markup profit sales expense #f)
(G_ "No Customer") comm markup profit sales expense #f)
sortingtable)))))
commodities))
@ -473,9 +473,9 @@
(markup (markup-percent profit sales)))
(add-row (if commodities>1?
(format #f "~a (~a)"
(_ "Total")
(G_ "Total")
(gnc-commodity-get-mnemonic comm))
(_ "Total"))
(G_ "Total"))
comm markup
(gnc:make-gnc-monetary comm profit)
(gnc:make-gnc-monetary comm sales)

View File

@ -27,7 +27,7 @@
(use-modules (gnucash engine))
(use-modules (gnucash utilities))
(use-modules (gnucash core-utils)) ; for gnc:version and (_ ...)
(use-modules (gnucash core-utils)) ; for gnc:version and (G_ ...)
(use-modules (gnucash app-utils))
(use-modules (gnucash report))
@ -49,7 +49,7 @@
(gnc:option-set-value
(gnc:lookup-option options section name) value))
(set-option! "General" "Report name" (_ "Dashboard"))
(set-option! "General" "Report name" (G_ "Dashboard"))
(set-option! "General" "Number of columns" 2)
;; mark the reports as needing to be saved

View File

@ -106,7 +106,7 @@
(add-option
(gnc:make-string-option
(N_ "General") optname-report-title
"a" opthelp-report-title (_ reportname)))
"a" opthelp-report-title (G_ reportname)))
(add-option
(gnc:make-string-option
(N_ "General") optname-party-name
@ -166,7 +166,7 @@
(add-option
(gnc:make-string-option
pagename-entries optname-closing-pattern
"a" opthelp-closing-pattern (_ "Closing Entries")))
"a" opthelp-closing-pattern (G_ "Closing Entries")))
(add-option
(gnc:make-simple-boolean-option
pagename-entries optname-closing-casing
@ -299,7 +299,7 @@
(gnc:html-document-set-title!
doc (format #f
(string-append "~a ~a "
(_ "For Period Covering ~a to ~a"))
(G_ "For Period Covering ~a to ~a"))
company-name report-title
(qof-print-date start-date-printable)
(qof-print-date end-date)))
@ -420,7 +420,7 @@
;; Create the account table below where its
;; percentage time can be tracked.
(build-table (gnc:make-html-table)) ;; gnc:html-table
(period-for (string-append " " (_ "for Period"))))
(period-for (string-append " " (G_ "for Period"))))
;; a helper to add a line to our report
(define (add-report-line
@ -447,43 +447,43 @@
(add-report-line
build-table
(string-append (_ "Capital") ", " (qof-print-date start-date-printable))
(string-append (G_ "Capital") ", " (qof-print-date start-date-printable))
#f start-total-equity 1 start-exchange-fn #f "primary-subheading")
(add-report-line
build-table
(string-append (_ "Net income") period-for)
(string-append (_ "Net loss") period-for)
(string-append (G_ "Net income") period-for)
(string-append (G_ "Net loss") period-for)
net-income 0 end-exchange-fn #f #f)
(add-report-line
build-table
(string-append (_ "Investments") period-for) #f
(string-append (G_ "Investments") period-for) #f
investments 0 end-exchange-fn #f #f)
(add-report-line
build-table
(string-append (_ "Withdrawals") period-for)
(string-append (G_ "Withdrawals") period-for)
#f withdrawals 0 end-exchange-fn #f #f)
(unless (gnc-commodity-collector-allzero? net-unrealized-gains)
(add-report-line
build-table
(_ "Unrealized Gains")
(_ "Unrealized Losses")
(G_ "Unrealized Gains")
(G_ "Unrealized Losses")
net-unrealized-gains
0 end-exchange-fn #f #f))
(add-report-line
build-table
(_ "Increase in capital")
(_ "Decrease in capital")
(G_ "Increase in capital")
(G_ "Decrease in capital")
capital-increase
1 end-exchange-fn use-rules? #f)
(add-report-line
build-table
(string-append (_ "Capital") ", " (qof-print-date end-date)) #f
(string-append (G_ "Capital") ", " (qof-print-date end-date)) #f
end-total-equity
1 end-exchange-fn #f "primary-subheading")

View File

@ -79,8 +79,8 @@
(list "query" (gnc-query2scm query)) ;; think this wants an scm...
(list "journal" #t)
(list "double" #t)
(list "debit-string" (_ "Debit"))
(list "credit-string" (_ "Credit"))
(list "debit-string" (G_ "Debit"))
(list "credit-string" (G_ "Credit"))
)
)
;; we'll leave query malloc'd in case this is required by the C side...
@ -115,7 +115,7 @@
;; just delegate rendering to the Register Report renderer...
(let* ((renderer (gnc:report-template-renderer/report-guid regrptguid #f))
(doc (renderer report-obj)))
(gnc:html-document-set-title! doc (_ reportname))
(gnc:html-document-set-title! doc (G_ reportname))
doc))
(gnc:define-report

View File

@ -143,7 +143,7 @@
;; just delegate rendering to the Transaction Report renderer...
(let ((document ((gnc:report-template-renderer/report-guid xactrptguid xactrptname)
report-obj)))
(gnc:html-document-set-title! document (_ reportname))
(gnc:html-document-set-title! document (G_ reportname))
document))
(gnc:define-report

View File

@ -45,7 +45,7 @@
(gnc:make-html-text
(gnc:html-markup-p
(_ "This report is useful to calculate periodic business tax \
(G_ "This report is useful to calculate periodic business tax \
payable/receivable from authorities. From 'Edit report options', \
choose your business sales and purchase accounts. Each transaction \
may contain, in addition to the asset, liability, A/Payable or \
@ -53,22 +53,22 @@ A/Receivable accounts, a split to a tax account, e.g. Income:Sales \
-$1000, A/Receivable $1100, Liability:GST on Sales -$100."))
(gnc:html-markup-p
(_ "These tax accounts can either be populated using the standard register, or from Business Invoices and Bills \
(G_ "These tax accounts can either be populated using the standard register, or from Business Invoices and Bills \
which will require Tax Tables to be set up correctly. Please see the documentation."))
(gnc:html-markup-p
(_ "From the Report Options, you will need to select the accounts which will \
(G_ "From the Report Options, you will need to select the accounts which will \
hold the GST/VAT taxes collected or paid. These accounts must contain splits which document the \
monies which are wholly sent or claimed from tax authorities during periodic GST/VAT returns. These \
accounts must be of type ASSET for taxes paid on expenses, and type LIABILITY for taxes collected on sales."))
(gnc:html-markup-p
(_ "Note the UK variant may specify EU VAT accounts may be tagged \
(G_ "Note the UK variant may specify EU VAT accounts may be tagged \
with *EUVAT* in the VAT account description. EU Goods sales and purchase \
accounts may be tagged with *EUGOODS* in the account description."))
(gnc:html-markup-p
(_ "This message will be removed when tax accounts are specified."))))
(G_ "This message will be removed when tax accounts are specified."))))
(define* (gst-statement-renderer rpt #:optional export-type file-name)
(define (opt-val section name)
@ -156,17 +156,17 @@ for taxes paid on expenses, and type LIABILITY for taxes collected on sales.")
options
(gnc:make-multichoice-callback-option
pagename-format (N_ "Report format")
"a" (_ "Report Format") 'default
"a" (G_ "Report Format") 'default
(list (vector 'default
(_ "default format")
(_ "default format"))
(G_ "default format")
(G_ "default format"))
(vector 'au-bas
(_ "Australia BAS")
(_ "Australia BAS. Specify sales, purchase and tax \
(G_ "Australia BAS")
(G_ "Australia BAS. Specify sales, purchase and tax \
accounts."))
(vector 'uk-vat
(_ "UK VAT Return")
(_ "UK VAT Return. Specify sales, purchase and tax \
(G_ "UK VAT Return")
(G_ "UK VAT Return. Specify sales, purchase and tax \
accounts. EU rules may be used. Denote EU VAT accounts *EUVAT* in \
account description, and denote EU goods sales and purchases accounts \
with *EUGOODS* in the account description."))) #f
@ -310,25 +310,25 @@ with *EUGOODS* in the account description."))) #f
(append
;; Translators: "Gross Sales" refer to Net Sales + GST/VAT on Sales
(list (vector (_ "Gross Sales") tot-sales #f #t #f #f))
(list (vector (G_ "Gross Sales") tot-sales #f #t #f #f))
(if (opt-val pagename-format "Individual sales columns")
(map
(lambda (acc)
(vector (xaccAccountGetName acc) (account-adder-neg acc) #f #t #f #f))
accounts-sales)
(list (vector (_ "Net Sales") net-sales #f #t #f #f)))
(list (vector (G_ "Net Sales") net-sales #f #t #f #f)))
(if (opt-val pagename-format "Individual tax columns")
(map
(lambda (acc)
(vector (xaccAccountGetName acc) (account-adder-neg acc) #f #t #f #f))
accounts-tax-collected)
(list (vector (_ "Tax on Sales") tax-sales #f #t #f #f)))
(list (vector (G_ "Tax on Sales") tax-sales #f #t #f #f)))
;; Translators: "Gross Purchases" refer to Net Purchase +
;; GST/VAT on Purchase
(list (vector (_ "Gross Purchases") tot-purch #f #t #f #f))
(list (vector (G_ "Gross Purchases") tot-purch #f #t #f #f))
(if (opt-val pagename-format "Individual purchases columns")
(map
@ -336,7 +336,7 @@ with *EUGOODS* in the account description."))) #f
(vector (xaccAccountGetName acc) (account-adder acc) #f #t #f #f))
accounts-purchases)
(list
(vector (_ "Net Purchases") net-purch #f #t #f #f)))
(vector (G_ "Net Purchases") net-purch #f #t #f #f)))
(if (opt-val pagename-format "Individual tax columns")
(map
@ -344,13 +344,13 @@ with *EUGOODS* in the account description."))) #f
(vector (xaccAccountGetName acc) (account-adder acc) #f #t #f #f))
accounts-tax-paid)
(list
(vector (_ "Tax on Purchases") tax-purch #f #t #f #f)))
(vector (G_ "Tax on Purchases") tax-purch #f #t #f #f)))
(if (opt-val pagename-format "Gross Balance")
;; Translators: "Gross Balance" refer to "Gross Sales
;; minus Gross Purchases" in GST Report
(list
(vector (_ "Gross Balance") tot-bal #f #t #f #f))
(vector (G_ "Gross Balance") tot-bal #f #t #f #f))
'())
;; Note: Net income = net balance - other costs
@ -358,14 +358,14 @@ with *EUGOODS* in the account description."))) #f
;; Translators: "Net Balance" refer to Net Sales - Net
;; Purchases in GST Report
(list
(vector (_ "Net Balance") net-bal #f #t #f #f))
(vector (G_ "Net Balance") net-bal #f #t #f #f))
'())
(if (opt-val pagename-format "Tax payable")
;; Translators: "Tax Payable" refer to the difference
;; GST Sales - GST Purchases
(list
(vector (_ "Tax payable") tax-diff #f #t #f #f))
(vector (G_ "Tax payable") tax-diff #f #t #f #f))
'()))))
((au-bas)

View File

@ -146,7 +146,7 @@
(add-option
(gnc:make-string-option
gnc:pagename-general optname-report-title
"a" opthelp-report-title (_ reportname)))
"a" opthelp-report-title (G_ reportname)))
(add-option
(gnc:make-string-option
gnc:pagename-general optname-party-name
@ -265,7 +265,7 @@
(add-option
(gnc:make-string-option
pagename-entries optname-closing-pattern
"a" opthelp-closing-pattern (_ "Closing Entries")))
"a" opthelp-closing-pattern (G_ "Closing Entries")))
(add-option
(gnc:make-simple-boolean-option
pagename-entries optname-closing-casing
@ -404,7 +404,7 @@
(gnc:html-table-append-ruler! table (* 2 tree-depth)))
(gnc:html-document-set-title!
doc (format #f (string-append "~a ~a " (_ "For Period Covering ~a to ~a"))
doc (format #f (string-append "~a ~a " (G_ "For Period Covering ~a to ~a"))
company-name report-title
(qof-print-date start-date-printable)
(qof-print-date end-date)))
@ -478,7 +478,7 @@
(trading-table
(gnc:make-html-acct-table/env/accts table-env trading-accounts))
(period-for (string-append " " (_ "for Period"))))
(period-for (string-append " " (G_ "for Period"))))
;; a helper to add a line to our report
(define (add-report-line
@ -502,28 +502,28 @@
(gnc:report-percent-done 80)
(when label-revenue?
(add-subtotal-line inc-table (_ "Revenues") #f #f))
(add-subtotal-line inc-table (G_ "Revenues") #f #f))
(gnc:html-table-add-account-balances inc-table revenue-table params)
(when total-revenue?
(add-subtotal-line inc-table (_ "Total Revenue") #f revenue-total))
(add-subtotal-line inc-table (G_ "Total Revenue") #f revenue-total))
(gnc:report-percent-done 85)
(when label-expense?
(add-subtotal-line exp-table (_ "Expenses") #f #f))
(add-subtotal-line exp-table (G_ "Expenses") #f #f))
(gnc:html-table-add-account-balances exp-table expense-table params)
(when total-expense?
(add-subtotal-line exp-table (_ "Total Expenses") #f expense-total))
(add-subtotal-line exp-table (G_ "Total Expenses") #f expense-total))
(when label-trading?
(add-subtotal-line tra-table (_ "Trading") #f #f))
(add-subtotal-line tra-table (G_ "Trading") #f #f))
(gnc:html-table-add-account-balances tra-table trading-table params)
(when total-trading?
(add-subtotal-line tra-table (_ "Total Trading") #f trading-total))
(add-subtotal-line tra-table (G_ "Total Trading") #f trading-total))
(add-report-line
(if standard-order? exp-table inc-table)
(string-append (_ "Net income") period-for)
(string-append (_ "Net loss") period-for)
(string-append (G_ "Net income") period-for)
(string-append (G_ "Net loss") period-for)
net-income (* 2 (1- tree-depth)) exchange-fn #f #f)
;; add the sections in the desired order to document

View File

@ -85,50 +85,50 @@
(define (make-heading-list column-vector)
(append
(addif (date-col column-vector)
(_ "Date"))
(G_ "Date"))
(addif (description-col column-vector)
(_ "Description"))
(G_ "Description"))
(addif (action-col column-vector)
(_ "Action"))
(G_ "Action"))
(addif (quantity-col column-vector)
(_ "Quantity"))
(G_ "Quantity"))
(addif (price-col column-vector)
(_ "Unit Price"))
(G_ "Unit Price"))
(addif (discount-col column-vector)
(_ "Discount"))
(G_ "Discount"))
(addif (tax-col column-vector)
(_ "Taxable"))
(G_ "Taxable"))
(addif (taxvalue-col column-vector)
(_ "Tax Amount"))
(G_ "Tax Amount"))
(addif (value-col column-vector)
(_ "Total"))))
(G_ "Total"))))
(define (monetary-or-percent numeric currency entry-type)
(if (eqv? entry-type GNC-AMT-TYPE-PERCENT)
(string-append (gnc:default-html-gnc-numeric-renderer numeric #f) " " (_ "%"))
(string-append (gnc:default-html-gnc-numeric-renderer numeric #f) " " (G_ "%"))
(gnc:make-gnc-monetary currency numeric)))
(define layout-key-list
;; Translators: "Their details" refer to the invoice 'other party' details i.e. client/vendor name/address/ID
(list (cons 'client (list (cons 'text (_ "Their details"))
(cons 'tip (_ "Client or vendor name, address and ID"))))
(list (cons 'client (list (cons 'text (G_ "Their details"))
(cons 'tip (G_ "Client or vendor name, address and ID"))))
;; Translators: "Our details" refer to the book owner's details i.e. name/address/tax-ID
(cons 'company (list (cons 'text (_ "Our details"))
(cons 'tip (_ "Company name, address and tax-ID"))))
(cons 'company (list (cons 'text (G_ "Our details"))
(cons 'tip (G_ "Company name, address and tax-ID"))))
(cons 'invoice (list (cons 'text (_ "Invoice details"))
(cons 'tip (_ "Invoice date, due date, billing ID, terms, job details"))))
(cons 'invoice (list (cons 'text (G_ "Invoice details"))
(cons 'tip (G_ "Invoice date, due date, billing ID, terms, job details"))))
(cons 'today (list (cons 'text (_ "Today's date"))
(cons 'tip (_ "Today's date"))))
(cons 'today (list (cons 'text (G_ "Today's date"))
(cons 'tip (G_ "Today's date"))))
(cons 'picture (list (cons 'text (_ "Picture"))
(cons 'tip (_ "Picture"))))
(cons 'picture (list (cons 'text (G_ "Picture"))
(cons 'tip (G_ "Picture"))))
;; Translators: "(empty)" refers to invoice header section being left blank
(cons 'none (list (cons 'text (_ "(empty)"))
(cons 'tip (_ "Empty space"))))))
(cons 'none (list (cons 'text (G_ "(empty)"))
(cons 'tip (G_ "Empty space"))))))
(define variant-list
(list
@ -274,7 +274,7 @@ for styling the invoice. Please see the exported report for the CSS class names.
(gnc:make-text-option
(N_ "Display") (N_ "Payable to string")
"ua2" (N_ "The phrase for specifying to whom payments should be made.")
(_ "Please make all checks payable to")))
(G_ "Please make all checks payable to")))
(gnc:register-inv-option
(gnc:make-complex-boolean-option
@ -287,7 +287,7 @@ for styling the invoice. Please see the exported report for the CSS class names.
(gnc:make-text-option
(N_ "Display") (N_ "Company contact string")
"ub2" (N_ "The phrase used to introduce the company contact.")
(_ "Please direct all enquiries to")))
(G_ "Please direct all enquiries to")))
(gnc:register-inv-option
(gnc:make-number-range-option
@ -341,7 +341,7 @@ for styling the invoice. Please see the exported report for the CSS class names.
(gnc:make-text-option
(N_ "Display") (N_ "Extra Notes")
"u" (N_ "Extra notes to put on the invoice.")
(_ "Thank you for your patronage!")))
(G_ "Thank you for your patronage!")))
(gnc:register-inv-option
(gnc:make-multichoice-option
@ -433,7 +433,7 @@ for styling the invoice. Please see the exported report for the CSS class names.
(qof-print-date (xaccTransGetDate t)))
(addif (description-col used-columns)
(_ "Payment, thank you!"))
(G_ "Payment, thank you!"))
(list (gnc:make-html-table-cell/size/markup
1 (- (max 3 (num-columns-required used-columns))
@ -488,7 +488,7 @@ for styling the invoice. Please see the exported report for the CSS class names.
(and (gncEntryGetBillTaxable entry)
(gncEntryGetBillTaxTable entry)))
;; Translators: This "T" is displayed in the taxable column, if this entry contains tax
(_ "T") ""))
(G_ "T") ""))
(addif (taxvalue-col used-columns)
(gnc:make-html-table-cell/markup
@ -535,7 +535,7 @@ for styling the invoice. Please see the exported report for the CSS class names.
(if display-subtotal?
(add-subtotal-row (gncInvoiceGetTotalSubtotal invoice)
"grand-total" (_ "Net Price")))
"grand-total" (G_ "Net Price")))
(if display-all-taxes
(for-each
@ -548,10 +548,10 @@ for styling the invoice. Please see the exported report for the CSS class names.
;; nope, just show the total tax.
(add-subtotal-row (gncInvoiceGetTotalTax invoice)
"grand-total" (_ "Tax")))
"grand-total" (G_ "Tax")))
(add-subtotal-row (gncInvoiceGetTotal invoice)
"grand-total" (_ "Total Price"))
"grand-total" (G_ "Total Price"))
(total-collector 'add currency (gncInvoiceGetTotal invoice))
@ -571,7 +571,7 @@ for styling the invoice. Please see the exported report for the CSS class names.
splits)))
(add-subtotal-row (cadr (total-collector 'getpair currency #f))
"grand-total" (_ "Amount Due")))
"grand-total" (G_ "Amount Due")))
(begin
@ -600,19 +600,19 @@ for styling the invoice. Please see the exported report for the CSS class names.
(begin
(gnc:html-table-append-row!
invoice-details-table
(make-date-row (_ "Date") (gncInvoiceGetDatePosted invoice) date-format))
(make-date-row (G_ "Date") (gncInvoiceGetDatePosted invoice) date-format))
(if (opt-val "Display" "Due Date")
(gnc:html-table-append-row!
invoice-details-table
(make-date-row (_ "Due Date") (gncInvoiceGetDateDue invoice) date-format))))
(make-date-row (G_ "Due Date") (gncInvoiceGetDateDue invoice) date-format))))
(gnc:html-table-append-row! invoice-details-table
(gnc:make-html-table-cell/size
1 2 (gnc:make-html-span/markup
"invoice-in-progress"
(gnc:make-html-text
(_ "Invoice in progress..."))))))
(G_ "Invoice in progress..."))))))
(if (opt-val "Display" "Billing ID")
(let ((billing-id (gncInvoiceGetBillingID invoice)))
@ -620,7 +620,7 @@ for styling the invoice. Please see the exported report for the CSS class names.
(begin
(gnc:html-table-append-row! invoice-details-table
(list
(_ "Reference:")
(G_ "Reference:")
(gnc:make-html-div/markup
"div-align-right"
(multiline-to-html-text billing-id))))
@ -632,7 +632,7 @@ for styling the invoice. Please see the exported report for the CSS class names.
(if (and terms (not (string-null? terms)))
(gnc:html-table-append-row! invoice-details-table
(list
(_ "Terms:")
(G_ "Terms:")
(gnc:make-html-div/markup
"div-align-right"
(multiline-to-html-text terms)))))))
@ -642,12 +642,12 @@ for styling the invoice. Please see the exported report for the CSS class names.
(not (string-null? jobnumber)))
(begin
(gnc:html-table-append-row! invoice-details-table
(list (_ "Job number:")
(list (G_ "Job number:")
(gnc:make-html-div/markup
"div-align-right"
jobnumber)))
(gnc:html-table-append-row! invoice-details-table
(list (_ "Job name:")
(list (G_ "Job name:")
(gnc:make-html-div/markup
"div-align-right"
jobname)))))
@ -693,7 +693,7 @@ for styling the invoice. Please see the exported report for the CSS class names.
(if (and reference (not (string-null? reference)))
(gnc:html-table-append-row! table
(list (string-append
(_ "REF") " "
(G_ "REF") " "
reference))))))
orders)
@ -771,7 +771,7 @@ for styling the invoice. Please see the exported report for the CSS class names.
(if (null? invoice)
(gnc:html-document-add-object! document
(gnc:make-html-text
(_ "No valid invoice selected. Click on the Options button and select the invoice to use.")))
(G_ "No valid invoice selected. Click on the Options button and select the invoice to use.")))
(let* ((book (gncInvoiceGetBook invoice))
(owner (gncInvoiceGetOwner invoice))
(type (gncInvoiceGetType invoice))
@ -780,20 +780,20 @@ for styling the invoice. Please see the exported report for the CSS class names.
(credit-note? (memv type (list GNC-INVOICE-CUST-CREDIT-NOTE GNC-INVOICE-VEND-CREDIT-NOTE GNC-INVOICE-EMPL-CREDIT-NOTE)))
(default-title (cond
((eqv? type GNC-INVOICE-VEND-INVOICE)
(_ "Bill"))
(G_ "Bill"))
((eqv? type GNC-INVOICE-EMPL-INVOICE)
(_ "Expense Voucher"))
(G_ "Expense Voucher"))
((memv type (list GNC-INVOICE-CUST-CREDIT-NOTE
GNC-INVOICE-VEND-CREDIT-NOTE
GNC-INVOICE-EMPL-CREDIT-NOTE))
(_ "Credit Note"))
(G_ "Credit Note"))
(else
(_ "Invoice"))))
(G_ "Invoice"))))
(title (if (string-null? custom-title) default-title custom-title))
;; Translators: This is the format of the invoice title.
;; The first ~a is "Invoice", "Credit Note"... and the second the number.
;; Replace " #" by whatever is common as number abbreviation, i.e. "~a Nr. ~a"
(invoice-title (format #f (_"~a #~a") title (gncInvoiceGetID invoice)))
(invoice-title (format #f (G_"~a #~a") title (gncInvoiceGetID invoice)))
(layout-lookup-table (list (cons 'none #f)
(cons 'picture (gnc:make-html-div/markup
"picture"

View File

@ -85,17 +85,17 @@
(define (make-heading-list column-vector)
(let ((heading-list '()))
(if (date-col column-vector)
(addto! heading-list (_ date-header)))
(addto! heading-list (G_ date-header)))
(if (date-due-col column-vector)
(addto! heading-list (_ due-date-header)))
(addto! heading-list (G_ due-date-header)))
(if (num-col column-vector)
(addto! heading-list (_ reference-header)))
(addto! heading-list (G_ reference-header)))
(if (type-col column-vector)
(addto! heading-list (_ type-header)))
(addto! heading-list (G_ type-header)))
(if (memo-col column-vector)
(addto! heading-list (_ desc-header)))
(addto! heading-list (G_ desc-header)))
(if (value-col column-vector)
(addto! heading-list (_ amount-header)))
(addto! heading-list (G_ amount-header)))
(reverse heading-list)))
@ -156,10 +156,10 @@
(gnc:html-table-set-col-headers!
table
(list (_ "0-30 days")
(_ "31-60 days")
(_ "61-90 days")
(_ "91+ days")))
(list (G_ "0-30 days")
(G_ "31-60 days")
(G_ "61-90 days")
(G_ "91+ days")))
(gnc:html-table-append-row!
table
@ -203,7 +203,7 @@
(begin
(set! printed? #t)
(if (not (gnc-numeric-zero-p total))
(let ((row (make-row column-vector start-date #f "" (_ "Balance") ""
(let ((row (make-row column-vector start-date #f "" (G_ "Balance") ""
(gnc:make-gnc-monetary (xaccTransGetCurrency txn) total)))
(row-style (if odd-row? "normal-row" "alternate-row")))
(gnc:html-table-append-row/markup! table row-style (reverse row))
@ -236,8 +236,8 @@
(gnc:invoice-anchor-text invoice)
inv-str))
inv-str))
((equal? type TXN-TYPE-PAYMENT) (_ "Payment, thank you!"))
(else (_ "Unknown"))))
((equal? type TXN-TYPE-PAYMENT) (G_ "Payment, thank you!"))
(else (G_ "Unknown"))))
)
(if reverse?
@ -315,8 +315,8 @@
(append (cons (gnc:make-html-table-cell/markup
"total-label-cell"
(if (gnc-numeric-negative-p total)
(_ "Total Credit")
(_ "Total Due")))
(G_ "Total Credit")
(G_ "Total Due")))
'())
(list (gnc:make-html-table-cell/size/markup
1 (value-col used-columns)
@ -400,7 +400,7 @@
(define (job-options-generator)
(options-generator (list ACCT-TYPE-RECEIVABLE) GNC-OWNER-JOB
(_ "Invoice") #f))
(G_ "Invoice") #f))
(define (setup-query q owner account end-date)
(let* ((guid (gncOwnerReturnGUID owner)))
@ -498,16 +498,16 @@
(cond
((eqv? type GNC-OWNER-CUSTOMER)
(set! type-str (N_ "Customer"))
(set! report-title-str (_ "Customer Report")))
(set! report-title-str (G_ "Customer Report")))
((eqv? type GNC-OWNER-JOB)
(set! type-str (N_ "Job"))
(set! report-title-str (_ "Job Report")))
(set! report-title-str (G_ "Job Report")))
((eqv? type GNC-OWNER-VENDOR)
(set! type-str (N_ "Vendor"))
(set! report-title-str (_ "Vendor Report")))
(set! report-title-str (G_ "Vendor Report")))
((eqv? type GNC-OWNER-EMPLOYEE)
(set! type-str (N_ "Employee"))
(set! report-title-str (_ "Employee Report"))))
(set! report-title-str (G_ "Employee Report"))))
(gnc:html-document-set-title! document report-title-str)
@ -540,7 +540,7 @@
(set!
table
(gnc:make-html-text
(_ "No valid account selected. Click on the Options button and select the account to use."))))
(G_ "No valid account selected. Click on the Options button and select the account to use."))))
(gnc:html-document-add-object!
document
@ -556,7 +556,7 @@
document
(gnc:make-html-text
(string-append
(_ "Date Range")
(G_ "Date Range")
": "
(qof-print-date start-date)
" - "
@ -573,16 +573,16 @@
(string-append
(cond
((eqv? type GNC-OWNER-CUSTOMER)
(_ "No valid customer selected."))
(G_ "No valid customer selected."))
((eqv? type GNC-OWNER-JOB)
(_ "No valid job selected."))
(G_ "No valid job selected."))
((eqv? type GNC-OWNER-VENDOR)
(_ "No valid vendor selected."))
(G_ "No valid vendor selected."))
((eqv? type GNC-OWNER-EMPLOYEE)
(_ "No valid employee selected."))
(G_ "No valid employee selected."))
(else ""))
" "
(_ "Click on the \"Options\" button to select a company.")))))
(G_ "Click on the \"Options\" button to select a company.")))))
(qof-query-destroy query)
document))

View File

@ -74,6 +74,7 @@
(gnc:lookup-option (gnc:report-options report-obj) section name)))
(define (get-all-lots splits)
(define lots-seen (make-hash-table))
(let lp ((splits splits) (lots '()))
(match splits
(() (reverse lots))
@ -82,8 +83,9 @@
(lp rest
(cond
((null? lot) lots)
((member lot lots) lots) ;warning: O(N^2)!
(else (cons lot lots)))))))))
((hash-ref lots-seen lot) lots)
(else (hash-set! lots-seen lot #t)
(cons lot lots)))))))))
(let* ((to-date (gnc:time64-end-day-time
(gnc:date-option-absolute-time

View File

@ -330,7 +330,7 @@
(gnc:html-chart-set-height! chart height)
(gnc:html-chart-set-title!
chart (list report-title
(format #f (_ "~a to ~a")
(format #f (G_ "~a to ~a")
(qof-print-date from-date-t64)
(qof-print-date to-date-t64))))
(gnc:html-chart-set-y-axis-label!
@ -346,7 +346,7 @@
(when show-sep?
(gnc:html-chart-add-data-series!
chart
(if inc-exp? (_ "Income") (_ "Assets"))
(if inc-exp? (G_ "Income") (G_ "Assets"))
(map gnc:gnc-monetary-amount minuend-balances)
"#0074D9"
'fill (not linechart?)
@ -362,12 +362,12 @@
(list gnc:pagename-general
gnc:optname-reportname
(if inc-exp?
(_ "Income Chart")
(_ "Asset Chart"))))))
(G_ "Income Chart")
(G_ "Asset Chart"))))))
(gnc:html-chart-add-data-series!
chart
(if inc-exp? (_ "Expense") (_ "Liabilities"))
(if inc-exp? (G_ "Expense") (G_ "Liabilities"))
(map - (map gnc:gnc-monetary-amount subtrahend-balances))
"#FF4136"
'fill (not linechart?)
@ -383,13 +383,13 @@
(list gnc:pagename-general
gnc:optname-reportname
(if inc-exp?
(_ "Expense Chart")
(_ "Liability Chart")))))))
(G_ "Expense Chart")
(G_ "Liability Chart")))))))
(when show-net?
(gnc:html-chart-add-data-series!
chart
(if inc-exp? (_ "Net Profit") (_ "Net Worth"))
(if inc-exp? (G_ "Net Profit") (G_ "Net Worth"))
(map gnc:gnc-monetary-amount difference-balances)
"#2ECC40"
'fill (not linechart?)
@ -413,16 +413,16 @@
(gnc:html-table-set-col-headers!
table
(append
(list (_ "Date"))
(list (G_ "Date"))
(if show-sep?
(if inc-exp?
(list (_ "Income") (_ "Expense"))
(list (_ "Assets") (_ "Liabilities")))
(list (G_ "Income") (G_ "Expense"))
(list (G_ "Assets") (G_ "Liabilities")))
'())
(if show-net?
(if inc-exp?
(list (_ "Net Profit"))
(list (_ "Net Worth")))
(list (G_ "Net Profit"))
(list (G_ "Net Worth")))
'())))
(gnc:html-table-append-column! table date-string-list)
(when show-sep?

View File

@ -60,10 +60,10 @@ copying this report to a spreadsheet for use in a mail merge."))
(list (N_ "Address Email") "i" (N_ "Display Email."))
(list (N_ "Active") "j" (N_ "Display Active status."))))
(define no-APAR-account (_ "No valid A/Payable or A/Receivable \
(define no-APAR-account (G_ "No valid A/Payable or A/Receivable \
account found. Please ensure valid AP/AR account exists."))
(define empty-APAR-accounts (_ "A/Payable or A/Receivable accounts \
(define empty-APAR-accounts (G_ "A/Payable or A/Receivable accounts \
exist but have no suitable transactions."))
(define num-buckets 6)
@ -160,7 +160,7 @@ exist but have no suitable transactions."))
(gncAddressGetPhone addr)
(gncAddressGetFax addr)
(gncAddressGetEmail addr)
(if (gncOwnerGetActive owner) (_ "Y") (_ "N")))))
(if (gncOwnerGetActive owner) (G_ "Y") (G_ "N")))))
(else address-list-names))))
(fold-right (lambda (opt elt prev) (if opt (cons elt prev) prev))
'() address-list-options result-list)))
@ -189,14 +189,14 @@ exist but have no suitable transactions."))
(gnc:option-value (gnc:lookup-option options section name)))
(define make-heading-list
(list (_ "Company")
(_ "Pre-Payment")
(_ "Current")
(_ "0-30 days")
(_ "31-60 days")
(_ "61-90 days")
(_ "91+ days")
(_ "Total")))
(list (G_ "Company")
(G_ "Pre-Payment")
(G_ "Current")
(G_ "0-30 days")
(G_ "31-60 days")
(G_ "61-90 days")
(G_ "91+ days")
(G_ "Total")))
(let* ((type (if receivable ACCT-TYPE-RECEIVABLE ACCT-TYPE-PAYABLE))
(accounts (filter (lambda (acc) (eqv? (xaccAccountGetType acc) type))
@ -319,7 +319,7 @@ exist but have no suitable transactions."))
(append
(if accounts>1? '(#f) '())
(list (gnc:make-html-table-cell/markup
"total-label-cell" (_ "Total")))
"total-label-cell" (G_ "Total")))
(map
(lambda (amt)
(gnc:make-html-table-cell/markup
@ -337,7 +337,7 @@ exist but have no suitable transactions."))
(gnc:html-document-add-object!
document
(gnc:make-html-text
(_ "Please note some transactions were not processed")
(G_ "Please note some transactions were not processed")
(gnc:html-markup-ol
(map
(lambda (invalid-split)
@ -370,7 +370,7 @@ exist but have no suitable transactions."))
(let ((type (xaccTransGetTxnType (xaccSplitGetParent this))))
(lp rest
acc-totals
(cons (list (format #f (_ "Invalid Txn Type ~a") type) this)
(cons (list (format #f (G_ "Invalid Txn Type ~a") type) this)
invalid-splits)
owners-and-aging)))
@ -380,7 +380,7 @@ exist but have no suitable transactions."))
(gnc:warn "split " this " has no owner")
(lp rest
acc-totals
(cons (list (_ "Payment has no owner") this) invalid-splits)
(cons (list (G_ "Payment has no owner") this) invalid-splits)
owners-and-aging))
((this . _)

View File

@ -85,23 +85,23 @@
(list
(list GNC-OWNER-CUSTOMER
(N_ "Customer")
(_ "No valid customer selected.")
(_ "This report requires a customer to be selected."))
(G_ "No valid customer selected.")
(G_ "This report requires a customer to be selected."))
(list GNC-OWNER-EMPLOYEE
(N_ "Employee")
(_ "No valid employee selected.")
(_ "This report requires a employee to be selected."))
(G_ "No valid employee selected.")
(G_ "This report requires a employee to be selected."))
(list GNC-OWNER-JOB
(N_ "Job")
(_ "No valid job selected.")
(_ "This report requires a job to be selected."))
(G_ "No valid job selected.")
(G_ "This report requires a job to be selected."))
(list GNC-OWNER-VENDOR
(N_ "Vendor")
(_ "No valid vendor selected.")
(_ "This report requires a vendor to be selected."))))
(G_ "No valid vendor selected.")
(G_ "This report requires a vendor to be selected."))))
(define (get-info key)
(assv-ref owner-string-alist key))
@ -200,19 +200,19 @@
(formal? (gnc-prefs-get-bool GNC-PREFS-GROUP-GENERAL
GNC-PREF-ACCOUNTING-LABELS)))
(if (date-col column-vector)
(addto! heading-list (_ date-header)))
(addto! heading-list (G_ date-header)))
(if (date-due-col column-vector)
(addto! heading-list (_ due-date-header)))
(addto! heading-list (G_ due-date-header)))
(if (ref-col column-vector)
(addto! heading-list (_ reference-header)))
(addto! heading-list (G_ reference-header)))
(if (type-col column-vector)
(addto! heading-list (_ type-header)))
(addto! heading-list (G_ type-header)))
(if (desc-col column-vector)
(addto! heading-list (_ desc-header)))
(addto! heading-list (G_ desc-header)))
(if (sale-col column-vector)
(addto! heading-list (_ sale-header)))
(addto! heading-list (G_ sale-header)))
(if (tax-col column-vector)
(addto! heading-list (_ tax-header)))
(addto! heading-list (G_ tax-header)))
(if (debit-col column-vector)
(addto! heading-list
(if formal? debit-header (gnc-account-get-debit-string acct-type))))
@ -220,20 +220,20 @@
(addto! heading-list
(if formal? credit-header (gnc-account-get-credit-string acct-type))))
(if (bal-col column-vector)
(addto! heading-list (_ balance-header)))
(addto! heading-list (G_ balance-header)))
(case link-option
((simple)
(addto! heading-list (_ linked-txns-header)))
(addto! heading-list (G_ linked-txns-header)))
((detailed)
(if (< 0 (num-cols column-vector 'mid-spac)) (addto! heading-list #f))
(if (date-col column-vector) (addto! heading-list (_ "Date")))
(if (ref-col column-vector) (addto! heading-list (_ "Reference")))
(if (type-col column-vector) (addto! heading-list (_ "Type")))
(if (desc-col column-vector) (addto! heading-list (_ "Description")))
(if (date-col column-vector) (addto! heading-list (G_ "Date")))
(if (ref-col column-vector) (addto! heading-list (G_ "Reference")))
(if (type-col column-vector) (addto! heading-list (G_ "Type")))
(if (desc-col column-vector) (addto! heading-list (G_ "Description")))
(if (or (debit-col column-vector) (credit-col column-vector))
(addto! heading-list (_ "Partial Amount")))
(addto! heading-list (G_ "Partial Amount")))
(if (or (debit-col column-vector) (credit-col column-vector))
(addto! heading-list (_ "Amount")))))
(addto! heading-list (G_ "Amount")))))
(reverse heading-list)))
(define num-buckets 6)
@ -283,9 +283,9 @@
(invoice (gncInvoiceGetInvoiceFromTxn txn)))
(cond
((txn-is-invoice? txn) (gncInvoiceGetTypeString invoice))
((txn-is-payment? txn) (if refund? (_ "Refund") (_ "Payment")))
((txn-is-link? txn) (_ "Link"))
(else (_ "Unknown")))))
((txn-is-payment? txn) (if refund? (G_ "Refund") (G_ "Payment")))
((txn-is-link? txn) (G_ "Link"))
(else (G_ "Unknown")))))
;; input: list of html-text elements
;; output: a cell with html-text interleaved with <br> tags
@ -304,13 +304,13 @@
splits num-buckets to-date date-type (not payable?))))
(gnc:html-table-set-col-headers!
table (list (_ "Pre-Payment")
(_ "Current")
(_ "0-30 days")
(_ "31-60 days")
(_ "61-90 days")
(_ "91+ days")
(_ "Total")))
table (list (G_ "Pre-Payment")
(G_ "Current")
(G_ "0-30 days")
(G_ "31-60 days")
(G_ "61-90 days")
(G_ "91+ days")
(G_ "Total")))
(gnc:html-table-append-row!
table (map (lambda (entry) (gnc:make-gnc-monetary currency entry))
@ -332,9 +332,9 @@
(append
;; Translators: ~a History refers to main details table in owner
;; report. ~a will be replaced with Customer, Vendor or Employee.
(addif (< 0 lhs) (make-heading lhs (format #f (_ "~a History") owner-desc)) )
(addif (< 0 lhs) (make-heading lhs (format #f (G_ "~a History") owner-desc)) )
(addif (< 0 mid) (make-heading mid #f))
(addif (< 0 rhs) (make-heading rhs (_ "Linked Details"))))))
(addif (< 0 rhs) (make-heading rhs (G_ "Linked Details"))))))
;;
;; Make a row list based on the visible columns
;;
@ -488,7 +488,7 @@
table "grand-total"
(append
(addif (< 0 period-span) (gnc:make-html-table-cell/markup
"total-label-cell" (_ "Period Totals")))
"total-label-cell" (G_ "Period Totals")))
(addif (< 1 period-span) (gnc:make-html-table-cell/size
1 (1- period-span) #f))
(addif (sale-col used-columns) (make-cell sale))
@ -508,8 +508,8 @@
(gnc:make-html-table-cell/markup
"total-label-cell"
(if (negative? total)
(_ "Total Credit")
(_ "Total Due"))))
(G_ "Total Credit")
(G_ "Total Due"))))
(addif (< 1 grand-span)
(gnc:make-html-table-cell/size/markup
1 (1- grand-span)
@ -528,7 +528,7 @@
payable? date-type currency)))))
(define (add-balance-row odd-row? total)
(add-row table odd-row? used-columns start-date #f "" (_ "Balance") ""
(add-row table odd-row? used-columns start-date #f "" (G_ "Balance") ""
currency total #f #f #f #f #f
link-option (case link-option
((none) '(()))
@ -547,7 +547,7 @@
(if (gncInvoiceIsPaid invoice)
result
(cons (make-link-desc-amount
(_ "UNPAID")
(G_ "UNPAID")
(gnc:make-gnc-monetary
currency (AP-negate (gnc-lot-get-balance lot)))
(gncInvoiceReturnGUID invoice))
@ -683,7 +683,7 @@
(if (zero? overpayment)
'()
(list (make-link-desc-amount
(_ "Pre-Payment")
(G_ "Pre-Payment")
(gnc:make-gnc-monetary currency overpayment)
(gncTransGetGUID txn))))))
@ -784,7 +784,7 @@
(gncInvoiceReturnGUID invoice)
link-option
(case link-option
((simple) (list (list (and (gncInvoiceIsPaid invoice) (_ "Paid")))))
((simple) (list (list (and (gncInvoiceIsPaid invoice) (G_ "Paid")))))
((detailed) (make-invoice->payments-table invoice))
(else '(()))))
@ -1021,7 +1021,7 @@ invoices and amounts.")))))
GNC-OWNER-CUSTOMER)
ACCT-TYPE-RECEIVABLE
ACCT-TYPE-PAYABLE)))
(report-title (string-append (_ owner-descr) " " (_ "Report"))))
(report-title (string-append (G_ owner-descr) " " (G_ "Report"))))
(cond
((not (gncOwnerIsValid owner))
@ -1036,8 +1036,8 @@ invoices and amounts.")))))
(gnc:html-make-generic-warning
(string-append report-title ": " (gncOwnerGetName owner))
(gnc:report-id report-obj)
(_ "No valid account found")
(_ "This report requires a valid AP/AR account to be available."))))
(G_ "No valid account found")
(G_ "This report requires a valid AP/AR account to be available."))))
(else
(setup-query query owner accounts end-date (eqv? GNC-OWNER-JOB type))
@ -1060,9 +1060,9 @@ invoices and amounts.")))))
(gnc:html-document-add-object!
document
(gnc:make-html-text
(gnc:html-markup-h2 (_ "No transactions found."))
(gnc:html-markup-h2 (G_ "No transactions found."))
(gnc:html-markup-p
(format #f (_ "No transactions were found associated with the ~a.")
(format #f (G_ "No transactions were found associated with the ~a.")
(string-downcase (car (get-info type)))))
(gnc:html-make-options-link (gnc:report-id report-obj)))))
@ -1090,7 +1090,7 @@ invoices and amounts.")))))
1 (length headings)
(gnc:make-html-text
(gnc:html-markup-h3
(string-append (_ "Account") ": "
(string-append (G_ "Account") ": "
(xaccAccountGetName account)))))))
(add-owner-table table splits account start-date end-date
@ -1123,7 +1123,7 @@ invoices and amounts.")))))
(gnc:html-document-add-object!
document (gnc:make-html-text
(string-append (_ "Date Range") ": " (qof-print-date start-date)
(string-append (G_ "Date Range") ": " (qof-print-date start-date)
" - " (qof-print-date end-date))))
(make-break! document)

View File

@ -77,18 +77,18 @@
;; Error strings in case there is no (valid) selection (translated)
(define (invalid-selection-title-string owner-type)
(cond ((eqv? owner-type GNC-OWNER-CUSTOMER) (_ "No valid customer selected."))
((eqv? owner-type GNC-OWNER-EMPLOYEE) (_ "No valid employee selected."))
(cond ((eqv? owner-type GNC-OWNER-CUSTOMER) (G_ "No valid customer selected."))
((eqv? owner-type GNC-OWNER-EMPLOYEE) (G_ "No valid employee selected."))
;; FALL THROUGH
(else
(_ "No valid company selected."))))
(G_ "No valid company selected."))))
(define (invalid-selection-string owner-type)
(cond ((eqv? owner-type GNC-OWNER-CUSTOMER) (_ "This report requires a customer to be selected."))
((eqv? owner-type GNC-OWNER-EMPLOYEE) (_ "This report requires a employee to be selected."))
(cond ((eqv? owner-type GNC-OWNER-CUSTOMER) (G_ "This report requires a customer to be selected."))
((eqv? owner-type GNC-OWNER-EMPLOYEE) (G_ "This report requires a employee to be selected."))
;; FALL THROUGH
(else
(_ "This report requires a company to be selected."))))
(G_ "This report requires a company to be selected."))))
;; Html formatted error message documents
(define (gnc:html-make-no-owner-warning
@ -104,17 +104,17 @@
(gnc:html-make-generic-warning
report-title-string
report-id
(_ "No valid account selected")
(_ "This report requires a valid account to be selected.")))
(G_ "No valid account selected")
(G_ "This report requires a valid account to be selected.")))
;; Document names, used in report names (translated)
(define (doctype-str owner-type)
(cond ((eqv? owner-type GNC-OWNER-CUSTOMER) (_ "Customer"))
((eqv? owner-type GNC-OWNER-EMPLOYEE) (_ "Employee"))
(cond ((eqv? owner-type GNC-OWNER-CUSTOMER) (G_ "Customer"))
((eqv? owner-type GNC-OWNER-EMPLOYEE) (G_ "Employee"))
;; FALL THROUGH
(else
(_ "Vendor"))))
(G_ "Vendor"))))
(define (date-col columns-used)
(vector-ref columns-used 0))
@ -169,25 +169,25 @@
(define (make-heading-list column-vector)
(let ((heading-list '()))
(if (date-col column-vector)
(addto! heading-list (_ date-header)))
(addto! heading-list (G_ date-header)))
(if (date-due-col column-vector)
(addto! heading-list (_ due-date-header)))
(addto! heading-list (G_ due-date-header)))
(if (num-col column-vector)
(addto! heading-list (_ reference-header)))
(addto! heading-list (G_ reference-header)))
(if (type-col column-vector)
(addto! heading-list (_ type-header)))
(addto! heading-list (G_ type-header)))
(if (memo-col column-vector)
(addto! heading-list (_ desc-header)))
(addto! heading-list (G_ desc-header)))
(if (sale-col column-vector)
(addto! heading-list (_ sale-header)))
(addto! heading-list (G_ sale-header)))
(if (tax-col column-vector)
(addto! heading-list (_ tax-header)))
(addto! heading-list (G_ tax-header)))
(if (credit-col column-vector)
(addto! heading-list (_ credit-header)))
(addto! heading-list (G_ credit-header)))
(if (debit-col column-vector)
(addto! heading-list (_ debit-header)))
(addto! heading-list (G_ debit-header)))
(if (value-col column-vector)
(addto! heading-list (_ amount-header)))
(addto! heading-list (G_ amount-header)))
(reverse heading-list)))
@ -256,11 +256,11 @@
(gnc:html-table-set-col-headers!
table
(list (_ "Current")
(_ "0-30 days")
(_ "31-60 days")
(_ "61-90 days")
(_ "91+ days")))
(list (G_ "Current")
(G_ "0-30 days")
(G_ "31-60 days")
(G_ "61-90 days")
(G_ "91+ days")))
(gnc:html-table-append-row!
table
@ -316,7 +316,7 @@
(begin
(set! printed? #t)
(if (and (value-col column-vector) (not (gnc-numeric-zero-p total)))
(let ((row (make-row column-vector start-date #f "" (_ "Balance") ""
(let ((row (make-row column-vector start-date #f "" (G_ "Balance") ""
(gnc:make-gnc-monetary (xaccTransGetCurrency txn) total) "" "" "" ""))
(row-style (if odd-row? "normal-row" "alternate-row")))
(gnc:html-table-append-row/markup! table row-style (reverse row))
@ -350,12 +350,12 @@
(gnc:html-markup-anchor
(gnc:invoice-anchor-text invoice)
(gncInvoiceGetTypeString invoice)))
(_ "Unknown")))
(G_ "Unknown")))
((equal? type TXN-TYPE-PAYMENT)
(gnc:make-html-text
(gnc:html-markup-anchor
(gnc:split-anchor-text split) (_ "Payment"))))
(else (_ "Unknown"))))
(gnc:split-anchor-text split) (G_ "Payment"))))
(else (G_ "Unknown"))))
)
(if reverse?
@ -460,7 +460,7 @@
"grand-total"
(append (cons (gnc:make-html-table-cell/markup
"total-label-cell"
(_ "Period Totals"))
(G_ "Period Totals"))
'())
(let ((row-contents '())
@ -502,8 +502,8 @@
(append (cons (gnc:make-html-table-cell/markup
"total-label-cell"
(if (gnc-numeric-negative-p total)
(_ "Total Credit")
(_ "Total Due")))
(G_ "Total Credit")
(G_ "Total Due")))
'())
(list (gnc:make-html-table-cell/size/markup
1 (value-col used-columns)
@ -740,7 +740,7 @@
(owner-descr (owner-string type))
(date-type (opt-val gnc:pagename-general optname-date-driver))
(owner (opt-val owner-page owner-descr))
(report-title (string-append (doctype-str type) " " (_ "Report"))))
(report-title (string-append (doctype-str type) " " (G_ "Report"))))
(if (not (gncOwnerIsValid owner))
(gnc:html-document-add-object!
document
@ -765,7 +765,7 @@
document (gnc:html-markup
"span"
(doctype-str type)
" " (_ "Report:") " "
" " (G_ "Report:") " "
(gnc:html-markup-anchor
(gnc:owner-anchor-text owner)
(gncOwnerGetName owner))))
@ -792,7 +792,7 @@
document
(gnc:make-html-text
(string-append
(_ "Date Range")
(G_ "Date Range")
": "
(qof-print-date start-date)
" - "

View File

@ -250,12 +250,12 @@
(gnc:html-table-set-col-headers!
table
(list (_ "Account")
(_ "Symbol")
(_ "Listing")
(_ "Units")
(_ "Price")
(_ "Value")))
(list (G_ "Account")
(G_ "Symbol")
(G_ "Listing")
(G_ "Units")
(G_ "Price")
(G_ "Value")))
(table-add-stock-rows
table accounts to-date currency
@ -275,7 +275,7 @@
table
"grand-total"
(list (gnc:make-html-table-cell/markup
"total-label-cell" (_ "Total"))
"total-label-cell" (G_ "Total"))
(gnc:make-html-table-cell/size/markup
1 5 "total-number-cell"
(gnc:make-gnc-monetary currency amount)))))

View File

@ -197,7 +197,7 @@
(gnc-commodity-get-mnemonic base-commodity)
" - "
(format #f
(_ "~a to ~a")
(G_ "~a to ~a")
(qof-print-date from-date)
(qof-print-date to-date)))))
(gnc:html-chart-set-width! chart width)
@ -219,11 +219,11 @@
(gnc-commodity-get-mnemonic amount-commodity))
(gnc:html-chart-set-x-axis-label!
chart (case interval
((DayDelta) (_ "Days"))
((WeekDelta) (_ "Weeks"))
((TwoWeekDelta) (_ "Double-Weeks"))
((MonthDelta) (_ "Months"))
((YearDelta) (_ "Years"))))
((DayDelta) (G_ "Days"))
((WeekDelta) (G_ "Weeks"))
((TwoWeekDelta) (G_ "Double-Weeks"))
((MonthDelta) (G_ "Months"))
((YearDelta) (G_ "Years"))))
(gnc:html-chart-set!
chart '(options scales xAxes (0) type) 'linear)
@ -283,11 +283,11 @@
(format #f "~2,2f ~a = ~a"
(car datum)
(case interval
((DayDelta) (_ "Days"))
((WeekDelta) (_ "Weeks"))
((TwoWeekDelta) (_ "Double-Weeks"))
((MonthDelta) (_ "Months"))
((YearDelta) (_ "Years")))
((DayDelta) (G_ "Days"))
((WeekDelta) (G_ "Weeks"))
((TwoWeekDelta) (G_ "Double-Weeks"))
((MonthDelta) (G_ "Months"))
((YearDelta) (G_ "Years")))
(gnc:monetary->string
(gnc:make-gnc-monetary
amount-commodity
@ -295,7 +295,7 @@
data))
(gnc:html-chart-add-data-series!
chart (_ "Price")
chart (G_ "Price")
(map
(lambda (datum)
(list
@ -313,28 +313,28 @@
(cond
((null? data)
(make-warning
(_ "No data")
(_ "There is no price information available for the \
(G_ "No data")
(G_ "There is no price information available for the \
selected commodities in the selected time period.")))
((<= (length data) 1)
(make-warning
(_ "Only one price")
(_ "There was only one single price found for the \
(G_ "Only one price")
(G_ "There was only one single price found for the \
selected commodities in the selected time period. This doesn't give \
a useful plot.")))
((apply equal? (map cadr data))
(make-warning
(_ "All Prices equal")
(_ "All the prices found are equal. \
(G_ "All Prices equal")
(G_ "All the prices found are equal. \
This would result in a plot with one straight line. \
Unfortunately, the plotting tool can't handle that.")))
((apply equal? (map car data))
(make-warning
(_ "All Prices at the same date")
(_ "All the prices found are from the same date. \
(G_ "All Prices at the same date")
(G_ "All the prices found are from the same date. \
This would result in a plot with one straight line. \
Unfortunately, the plotting tool can't handle that.")))
@ -343,8 +343,8 @@ Unfortunately, the plotting tool can't handle that.")))
;; warning if report-currency == price-commodity
(make-warning
(_ "Identical commodities")
(_ "Your selected commodity and the currency of the report \
(G_ "Identical commodities")
(G_ "Your selected commodity and the currency of the report \
are identical. It doesn't make sense to show prices for identical \
commodities.")))

View File

@ -107,37 +107,37 @@
(N_ "The format for the date->string conversion for today's date.")
;; Translators: Boost::date_time format string
;; "%l:%M %P, %e %B %Y" means " 9:56 pm, 19 June 2019"
(_ "%l:%M %P, %e %B %Y")))
(G_ "%l:%M %P, %e %B %Y")))
;; Heading options
(add-option (gnc:make-string-option
; page / name / orderkey / tooltip / default
headingpage optname-report-title "a" "" (_ "Invoice")))
headingpage optname-report-title "a" "" (G_ "Invoice")))
(add-option (gnc:make-string-option
headingpage optname-units "b" "" (_ "Units")))
headingpage optname-units "b" "" (G_ "Units")))
(add-option (gnc:make-string-option
headingpage optname-qty "c" "" (_ "Qty")))
headingpage optname-qty "c" "" (G_ "Qty")))
(add-option (gnc:make-string-option
headingpage optname-unit-price "d" "" (_ "Unit Price")))
headingpage optname-unit-price "d" "" (G_ "Unit Price")))
(add-option (gnc:make-string-option
headingpage optname-disc-rate "e" "" (_ "Discount Rate")))
headingpage optname-disc-rate "e" "" (G_ "Discount Rate")))
(add-option (gnc:make-string-option
headingpage optname-disc-amount "f" "" (_ "Discount Amount")))
headingpage optname-disc-amount "f" "" (G_ "Discount Amount")))
(add-option (gnc:make-string-option
headingpage optname-net-price "g" "" (_ "Net Price")))
headingpage optname-net-price "g" "" (G_ "Net Price")))
(add-option (gnc:make-string-option
headingpage optname-tax-rate "h" "" (_ "Tax Rate")))
headingpage optname-tax-rate "h" "" (G_ "Tax Rate")))
(add-option (gnc:make-string-option
headingpage optname-tax-amount "i" "" (_ "Tax Amount")))
headingpage optname-tax-amount "i" "" (G_ "Tax Amount")))
(add-option (gnc:make-string-option
headingpage optname-total-price "j" "" (_ "Total Price")))
headingpage optname-total-price "j" "" (G_ "Total Price")))
(add-option (gnc:make-string-option
headingpage2 optname-subtotal "a" "" (_ "Sub-total")))
headingpage2 optname-subtotal "a" "" (G_ "Sub-total")))
(add-option (gnc:make-string-option
headingpage2 optname-amount-due "b" "" (_ "Amount Due")))
headingpage2 optname-amount-due "b" "" (G_ "Amount Due")))
(add-option (gnc:make-string-option
headingpage2 optname-payment-recd "c" ""
(_ "Payment received, thank you!")))
(G_ "Payment received, thank you!")))
(add-option (gnc:make-text-option
notespage optname-extra-notes "a"

View File

@ -56,7 +56,7 @@
(define reconcile-report-instructions
(gnc:make-html-text
(_ "The reconcile report is designed to be similar to the formal \
(G_ "The reconcile report is designed to be similar to the formal \
reconciliation tool. Please select the account from Report \
Options. Please note the dates specified in the options will apply \
to the Reconciliation Date.")
@ -83,10 +83,10 @@ to the Reconciliation Date.")
(and (not (positive? (split-amount s)))
(gnc:monetary-neg (amount s))))))
;; similar to default-calculated-cells but disable dual-subtotals.
(list (vector (_ "Funds In")
(list (vector (G_ "Funds In")
debit-amount #f #t #f
(const "") #t)
(vector (_ "Funds Out")
(vector (G_ "Funds Out")
credit-amount #f #t #f
(const "") #f))))
@ -100,7 +100,7 @@ to the Reconciliation Date.")
(gnc:define-report
'version 1
'name (_ "Reconciliation Report")
'name (G_ "Reconciliation Report")
'report-guid "e45218c6d76f11e7b5ef0800277ef320"
'options-generator reconcile-report-options-generator
;; the renderer is the same as trep, however we're using a different

View File

@ -126,27 +126,27 @@
(let ((heading-list '()))
(gnc:debug "Column-vector" column-vector)
(if (date-col column-vector)
(addto! heading-list (_ "Date")))
(addto! heading-list (G_ "Date")))
(if (num-col column-vector)
(addto! heading-list (if action-for-num?
(if ledger-type?
(_ "T-Num")
(_ "Num/Action"))
(_ "Num"))))
(G_ "T-Num")
(G_ "Num/Action"))
(G_ "Num"))))
(if (description-col column-vector)
(addto! heading-list (_ "Description")))
(addto! heading-list (G_ "Description")))
(if (memo-col column-vector)
(addto! heading-list (_ "Memo")))
(addto! heading-list (G_ "Memo")))
(if (account-col column-vector)
(addto! heading-list (if multi-rows?
(_ "Account")
(_ "Transfer"))))
(G_ "Account")
(G_ "Transfer"))))
(if (shares-col column-vector)
(addto! heading-list (_ "Shares")))
(addto! heading-list (G_ "Shares")))
(if (lot-col column-vector)
(addto! heading-list (_ "Lot")))
(addto! heading-list (G_ "Lot")))
(if (price-col column-vector)
(addto! heading-list (_ "Price")))
(addto! heading-list (G_ "Price")))
(if (amount-single-col column-vector)
(addto! heading-list amount-string))
(if (debit-col column-vector)
@ -154,13 +154,13 @@
(if (credit-col column-vector)
(addto! heading-list credit-string))
(if (value-single-col column-vector)
(addto! heading-list (_ "Value")))
(addto! heading-list (G_ "Value")))
(if (value-debit-col column-vector)
(addto! heading-list (_ "Debit Value")))
(addto! heading-list (G_ "Debit Value")))
(if (value-credit-col column-vector)
(addto! heading-list (_ "Credit Value")))
(addto! heading-list (G_ "Credit Value")))
(if (balance-col column-vector)
(addto! heading-list (_ "Balance")))
(addto! heading-list (G_ "Balance")))
(reverse heading-list)))
(define (add-split-row table split column-vector row-style transaction-info?
@ -224,8 +224,8 @@
((2) (gnc-account-get-full-name
(xaccSplitGetAccount
(xaccSplitGetOtherSplit split))))
((1) (_ "None"))
(else (_ "-- Split Transaction --"))))))))
((1) (G_ "None"))
(else (G_ "-- Split Transaction --"))))))))
(if (shares-col column-vector)
(addto! row-contents
(gnc:make-html-table-cell/markup
@ -366,9 +366,9 @@
(gnc:register-reg-option
(gnc:make-internal-option "__reg" "double" #f))
(gnc:register-reg-option
(gnc:make-internal-option "__reg" "debit-string" (_ "Debit")))
(gnc:make-internal-option "__reg" "debit-string" (G_ "Debit")))
(gnc:register-reg-option
(gnc:make-internal-option "__reg" "credit-string" (_ "Credit")))
(gnc:make-internal-option "__reg" "credit-string" (G_ "Credit")))
(gnc:register-reg-option
(gnc:make-string-option
@ -578,18 +578,18 @@
;; ----------------------------------
((null? splits)
(when reg-report-show-totals?
(add-subtotal-row (_ "Total Debits") leader table used-columns
(add-subtotal-row (G_ "Total Debits") leader table used-columns
debit-collector "grand-total" #f)
(add-subtotal-row (_ "Total Credits") leader table used-columns
(add-subtotal-row (G_ "Total Credits") leader table used-columns
credit-collector "grand-total" #f)
(add-subtotal-row (_ "Total Value Debits") leader table used-columns
(add-subtotal-row (G_ "Total Value Debits") leader table used-columns
debit-value "grand-total" #t)
(add-subtotal-row (_ "Total Value Credits") leader table used-columns
(add-subtotal-row (G_ "Total Value Credits") leader table used-columns
credit-value "grand-total" #t))
(when ledger-type?
(add-subtotal-row (_ "Net Change") leader table used-columns
(add-subtotal-row (G_ "Net Change") leader table used-columns
total-collector "grand-total" #f))
(add-subtotal-row (_ "Value Change") leader table used-columns
(add-subtotal-row (G_ "Value Change") leader table used-columns
total-value "grand-total" #t))
;; The general journal has a split that doesn't have an account
@ -662,7 +662,7 @@
(table (make-split-table splits
(gnc:report-options report-obj)
debit-string credit-string
(_ "Amount"))))
(G_ "Amount"))))
(gnc:html-document-set-title! document title)
(gnc:html-document-add-object! document table)
(qof-query-destroy query))

View File

@ -67,7 +67,7 @@
(if pc? (format #t "~a%" (pctot 'total #f)))
(if (and amt? pc?) (display " +&nbsp;"))
(if amt? (display-comm-coll-total amttot #f))
(if (equal? amt? pc? #f) (display (_ "n/a")))))))
(if (equal? amt? pc? #f) (display (G_ "n/a")))))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Define all the options
@ -170,47 +170,47 @@
;; Heading options
(add-option (gnc:make-string-option
; page / name / orderkey / tooltip / default
headingpage optname-report-title "a" "" (_ "Invoice")))
headingpage optname-report-title "a" "" (G_ "Invoice")))
(add-option (gnc:make-string-option
headingpage optname-units "b" "" (_ "Units")))
headingpage optname-units "b" "" (G_ "Units")))
(add-option (gnc:make-string-option
headingpage optname-qty "c" "" (_ "Qty")))
headingpage optname-qty "c" "" (G_ "Qty")))
(add-option (gnc:make-string-option
headingpage optname-unit-price "d" "" (_ "Unit Price")))
headingpage optname-unit-price "d" "" (G_ "Unit Price")))
(add-option (gnc:make-string-option
headingpage optname-disc-rate "e" "" (_ "Discount Rate")))
headingpage optname-disc-rate "e" "" (G_ "Discount Rate")))
(add-option (gnc:make-string-option
headingpage optname-disc-amount "f" "" (_ "Discount Amount")))
headingpage optname-disc-amount "f" "" (G_ "Discount Amount")))
(add-option (gnc:make-string-option
headingpage optname-net-price "g" "" (_ "Net Price")))
headingpage optname-net-price "g" "" (G_ "Net Price")))
(add-option (gnc:make-string-option
headingpage optname-tax-rate "h" "" (_ "Tax Rate")))
headingpage optname-tax-rate "h" "" (G_ "Tax Rate")))
(add-option (gnc:make-string-option
headingpage optname-tax-amount "i" "" (_ "Tax Amount")))
headingpage optname-tax-amount "i" "" (G_ "Tax Amount")))
(add-option (gnc:make-string-option
headingpage optname-total-price "j" "" (_ "Total Price")))
headingpage optname-total-price "j" "" (G_ "Total Price")))
(add-option (gnc:make-string-option
headingpage2 optname-subtotal "a" "" (_ "Sub-total")))
headingpage2 optname-subtotal "a" "" (G_ "Sub-total")))
(add-option (gnc:make-string-option
headingpage2 optname-amount-due "b" "" (_ "Amount Due")))
headingpage2 optname-amount-due "b" "" (G_ "Amount Due")))
(add-option (gnc:make-string-option
headingpage2 optname-payment-recd "c" ""
(_ "Payment received, thank you!")))
(G_ "Payment received, thank you!")))
(add-option (gnc:make-string-option headingpage2 optname-invoice-number-text
"d" "" (_ "Invoice number: ")))
"d" "" (G_ "Invoice number: ")))
(add-option (gnc:make-string-option headingpage2 optname-to-text
"e" "" (_ "To: ")))
"e" "" (G_ "To: ")))
(add-option (gnc:make-string-option headingpage2 optname-ref-text
"f" "" (_ "Your ref: ")))
"f" "" (G_ "Your ref: ")))
(add-option (gnc:make-string-option headingpage2 optname-jobnumber-text
"g" "" (_ "Job number: ")))
"g" "" (G_ "Job number: ")))
(add-option (gnc:make-string-option headingpage2 optname-jobname-text
"h" "" (_ "Job name: ")))
"h" "" (G_ "Job name: ")))
(add-option (gnc:make-text-option
notespage optname-extra-notes "a"
(_ "Notes added at end of invoice -- may contain HTML markup.")
(_ "Thank you for your patronage!")))
(G_ "Notes added at end of invoice -- may contain HTML markup.")
(G_ "Thank you for your patronage!")))
(add-option (gnc:make-text-option notespage optname-extra-css "b"
(N_ "Embedded CSS.") "h1.coyname { text-align: left; }"))
@ -306,14 +306,14 @@
(gnc:option-set-value option value)))
(let ((options (options-generator)))
(set-opt options headingpage optname-report-title (_ "Tax Invoice"))
(set-opt options headingpage optname-unit-price (_ "Unit"))
(set-opt options headingpage optname-tax-rate (_ "GST Rate"))
(set-opt options headingpage optname-tax-amount (_ "GST Amount"))
(set-opt options headingpage2 optname-amount-due (_ "Amount Due (inc GST)"))
(set-opt options headingpage2 optname-invoice-number-text (_ "Invoice #: "))
(set-opt options headingpage2 optname-ref-text (_ "Reference: "))
(set-opt options headingpage2 optname-jobname-text (_ "Engagement: "))
(set-opt options headingpage optname-report-title (G_ "Tax Invoice"))
(set-opt options headingpage optname-unit-price (G_ "Unit"))
(set-opt options headingpage optname-tax-rate (G_ "GST Rate"))
(set-opt options headingpage optname-tax-amount (G_ "GST Amount"))
(set-opt options headingpage2 optname-amount-due (G_ "Amount Due (inc GST)"))
(set-opt options headingpage2 optname-invoice-number-text (G_ "Invoice #: "))
(set-opt options headingpage2 optname-ref-text (G_ "Reference: "))
(set-opt options headingpage2 optname-jobname-text (G_ "Engagement: "))
(set-opt options notespage optname-extra-css "h1.coyname { text-align: right; margin-bottom: 0px ; font-size: 200%; } h2.invoice { text-align: left; margin-bottom: 0px ; font-size: 500%; }")
options))

Some files were not shown because too many files have changed in this diff Show More