mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Merge branch 'maint'
This commit is contained in:
commit
f89691f73c
@ -97,6 +97,9 @@ typedef struct GncTreeModelAccountPrivate
|
|||||||
Account *root;
|
Account *root;
|
||||||
gint event_handler_id;
|
gint event_handler_id;
|
||||||
const gchar *negative_color;
|
const gchar *negative_color;
|
||||||
|
|
||||||
|
GHashTable *account_values_hash;
|
||||||
|
|
||||||
} GncTreeModelAccountPrivate;
|
} GncTreeModelAccountPrivate;
|
||||||
|
|
||||||
#define GNC_TREE_MODEL_ACCOUNT_GET_PRIVATE(o) \
|
#define GNC_TREE_MODEL_ACCOUNT_GET_PRIVATE(o) \
|
||||||
@ -134,9 +137,16 @@ gnc_tree_model_account_update_color (gpointer gsettings, gchar *key, gpointer us
|
|||||||
g_return_if_fail (GNC_IS_TREE_MODEL_ACCOUNT(user_data));
|
g_return_if_fail (GNC_IS_TREE_MODEL_ACCOUNT(user_data));
|
||||||
model = user_data;
|
model = user_data;
|
||||||
priv = GNC_TREE_MODEL_ACCOUNT_GET_PRIVATE(model);
|
priv = GNC_TREE_MODEL_ACCOUNT_GET_PRIVATE(model);
|
||||||
|
|
||||||
|
// destroy/recreate the cached acount value hash to force update
|
||||||
|
g_hash_table_destroy (priv->account_values_hash);
|
||||||
|
priv->account_values_hash = g_hash_table_new_full (g_str_hash, g_str_equal,
|
||||||
|
g_free, g_free);
|
||||||
|
|
||||||
use_red = gnc_prefs_get_bool (GNC_PREFS_GROUP_GENERAL, GNC_PREF_NEGATIVE_IN_RED);
|
use_red = gnc_prefs_get_bool (GNC_PREFS_GROUP_GENERAL, GNC_PREF_NEGATIVE_IN_RED);
|
||||||
priv->negative_color = use_red ? get_negative_color () : NULL;
|
priv->negative_color = use_red ? get_negative_color () : NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/************************************************************/
|
/************************************************************/
|
||||||
/* g_object required functions */
|
/* g_object required functions */
|
||||||
/************************************************************/
|
/************************************************************/
|
||||||
@ -182,6 +192,10 @@ gnc_tree_model_account_init (GncTreeModelAccount *model)
|
|||||||
priv->root = NULL;
|
priv->root = NULL;
|
||||||
priv->negative_color = red ? get_negative_color () : NULL;
|
priv->negative_color = red ? get_negative_color () : NULL;
|
||||||
|
|
||||||
|
// create the account values cache hash
|
||||||
|
priv->account_values_hash = g_hash_table_new_full (g_str_hash, g_str_equal,
|
||||||
|
g_free, g_free);
|
||||||
|
|
||||||
gnc_prefs_register_cb (GNC_PREFS_GROUP_GENERAL, GNC_PREF_NEGATIVE_IN_RED,
|
gnc_prefs_register_cb (GNC_PREFS_GROUP_GENERAL, GNC_PREF_NEGATIVE_IN_RED,
|
||||||
gnc_tree_model_account_update_color,
|
gnc_tree_model_account_update_color,
|
||||||
model);
|
model);
|
||||||
@ -230,6 +244,9 @@ gnc_tree_model_account_dispose (GObject *object)
|
|||||||
priv->event_handler_id = 0;
|
priv->event_handler_id = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// destroy the cached acount values
|
||||||
|
g_hash_table_destroy (priv->account_values_hash);
|
||||||
|
|
||||||
gnc_prefs_remove_cb_by_func (GNC_PREFS_GROUP_GENERAL, GNC_PREF_NEGATIVE_IN_RED,
|
gnc_prefs_remove_cb_by_func (GNC_PREFS_GROUP_GENERAL, GNC_PREF_NEGATIVE_IN_RED,
|
||||||
gnc_tree_model_account_update_color,
|
gnc_tree_model_account_update_color,
|
||||||
model);
|
model);
|
||||||
@ -265,8 +282,7 @@ gnc_tree_model_account_new (Account *root)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
model = g_object_new (GNC_TYPE_TREE_MODEL_ACCOUNT,
|
model = g_object_new (GNC_TYPE_TREE_MODEL_ACCOUNT, NULL);
|
||||||
NULL);
|
|
||||||
|
|
||||||
priv = GNC_TREE_MODEL_ACCOUNT_GET_PRIVATE(model);
|
priv = GNC_TREE_MODEL_ACCOUNT_GET_PRIVATE(model);
|
||||||
priv->book = gnc_get_current_book();
|
priv->book = gnc_get_current_book();
|
||||||
@ -351,8 +367,7 @@ gnc_tree_model_account_get_n_columns (GtkTreeModel *tree_model)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static GType
|
static GType
|
||||||
gnc_tree_model_account_get_column_type (GtkTreeModel *tree_model,
|
gnc_tree_model_account_get_column_type (GtkTreeModel *tree_model, int index)
|
||||||
int index)
|
|
||||||
{
|
{
|
||||||
g_return_val_if_fail (GNC_IS_TREE_MODEL_ACCOUNT (tree_model), G_TYPE_INVALID);
|
g_return_val_if_fail (GNC_IS_TREE_MODEL_ACCOUNT (tree_model), G_TYPE_INVALID);
|
||||||
g_return_val_if_fail ((index < GNC_TREE_MODEL_ACCOUNT_NUM_COLUMNS) && (index >= 0), G_TYPE_INVALID);
|
g_return_val_if_fail ((index < GNC_TREE_MODEL_ACCOUNT_NUM_COLUMNS) && (index >= 0), G_TYPE_INVALID);
|
||||||
@ -561,6 +576,131 @@ gnc_tree_model_account_compute_period_balance(GncTreeModelAccount *model,
|
|||||||
return g_strdup(xaccPrintAmount (b3, gnc_account_print_info (acct, TRUE)));
|
return g_strdup(xaccPrintAmount (b3, gnc_account_print_info (acct, TRUE)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
row_changed_foreach_func (GtkTreeModel *model, GtkTreePath *path,
|
||||||
|
GtkTreeIter *iter, gpointer user_data)
|
||||||
|
{
|
||||||
|
gtk_tree_model_row_changed (model, path, iter);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
gnc_tree_model_account_clear_cache (GncTreeModelAccount *model)
|
||||||
|
{
|
||||||
|
if (model)
|
||||||
|
{
|
||||||
|
GncTreeModelAccountPrivate *priv = GNC_TREE_MODEL_ACCOUNT_GET_PRIVATE(model);
|
||||||
|
|
||||||
|
// destroy the cached acount values and recreate
|
||||||
|
g_hash_table_destroy (priv->account_values_hash);
|
||||||
|
priv->account_values_hash = g_hash_table_new_full (g_str_hash, g_str_equal,
|
||||||
|
g_free, g_free);
|
||||||
|
|
||||||
|
gtk_tree_model_foreach (GTK_TREE_MODEL(model), row_changed_foreach_func, NULL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
clear_account_cached_values (GncTreeModelAccount *model, GHashTable *hash, Account *account)
|
||||||
|
{
|
||||||
|
GtkTreeIter iter;
|
||||||
|
gchar acct_guid_str[GUID_ENCODING_LENGTH + 1];
|
||||||
|
|
||||||
|
if (!account)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// make sure tree view sees the change
|
||||||
|
if (gnc_tree_model_account_get_iter_from_account (model, account, &iter))
|
||||||
|
{
|
||||||
|
GtkTreePath *path = gtk_tree_model_get_path (GTK_TREE_MODEL(model), &iter);
|
||||||
|
|
||||||
|
gtk_tree_model_row_changed (GTK_TREE_MODEL(model), path, &iter);
|
||||||
|
gtk_tree_path_free (path);
|
||||||
|
}
|
||||||
|
|
||||||
|
guid_to_string_buff (xaccAccountGetGUID (account), acct_guid_str);
|
||||||
|
|
||||||
|
// loop over the columns and remove any found
|
||||||
|
for (gint col = 0; col <= GNC_TREE_MODEL_ACCOUNT_NUM_COLUMNS; col++)
|
||||||
|
{
|
||||||
|
gchar *key = g_strdup_printf ("%s,%d", acct_guid_str, col);
|
||||||
|
|
||||||
|
g_hash_table_remove (hash, key);
|
||||||
|
g_free (key);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gnc_tree_model_account_clear_cached_values (GncTreeModelAccount *model, Account *account)
|
||||||
|
{
|
||||||
|
GncTreeModelAccountPrivate *priv = GNC_TREE_MODEL_ACCOUNT_GET_PRIVATE(model);
|
||||||
|
Account *parent;
|
||||||
|
|
||||||
|
// no hash table or account, return
|
||||||
|
if ((!priv->account_values_hash) || (!account))
|
||||||
|
return;
|
||||||
|
|
||||||
|
clear_account_cached_values (model, priv->account_values_hash, account);
|
||||||
|
parent = gnc_account_get_parent (account);
|
||||||
|
|
||||||
|
// clear also all parent accounts, this will update any balances/totals
|
||||||
|
while (parent)
|
||||||
|
{
|
||||||
|
clear_account_cached_values (model, priv->account_values_hash, parent);
|
||||||
|
parent = gnc_account_get_parent (parent);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
gnc_tree_model_account_get_cached_value (GncTreeModelAccount *model, Account *account,
|
||||||
|
gint column, gchar **cached_string)
|
||||||
|
{
|
||||||
|
GncTreeModelAccountPrivate *priv = GNC_TREE_MODEL_ACCOUNT_GET_PRIVATE(model);
|
||||||
|
gchar acct_guid_str[GUID_ENCODING_LENGTH + 1];
|
||||||
|
gchar *key = NULL;
|
||||||
|
gpointer value;
|
||||||
|
gboolean found;
|
||||||
|
|
||||||
|
if ((!priv->account_values_hash) || (!account))
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
guid_to_string_buff (xaccAccountGetGUID (account), acct_guid_str);
|
||||||
|
key = g_strdup_printf ("%s,%d", acct_guid_str, column);
|
||||||
|
|
||||||
|
found = g_hash_table_lookup_extended (priv->account_values_hash, key,
|
||||||
|
NULL, &value);
|
||||||
|
|
||||||
|
if (found)
|
||||||
|
*cached_string = g_strdup (value);
|
||||||
|
|
||||||
|
g_free (key);
|
||||||
|
|
||||||
|
return found;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gnc_tree_model_account_set_cached_value (GncTreeModelAccount *model, Account *account,
|
||||||
|
gint column, GValue *value)
|
||||||
|
{
|
||||||
|
GncTreeModelAccountPrivate *priv = GNC_TREE_MODEL_ACCOUNT_GET_PRIVATE(model);
|
||||||
|
|
||||||
|
if ((!priv->account_values_hash) || (!account))
|
||||||
|
return;
|
||||||
|
|
||||||
|
// only interested in string values
|
||||||
|
if (G_VALUE_HOLDS_STRING(value))
|
||||||
|
{
|
||||||
|
gchar acct_guid_str[GUID_ENCODING_LENGTH + 1];
|
||||||
|
const gchar *str = g_value_get_string (value);
|
||||||
|
gchar *key = NULL;
|
||||||
|
|
||||||
|
guid_to_string_buff (xaccAccountGetGUID (account), acct_guid_str);
|
||||||
|
key = g_strdup_printf ("%s,%d", acct_guid_str, column);
|
||||||
|
|
||||||
|
g_hash_table_insert (priv->account_values_hash, key, g_strdup (str));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gnc_tree_model_account_get_value (GtkTreeModel *tree_model,
|
gnc_tree_model_account_get_value (GtkTreeModel *tree_model,
|
||||||
GtkTreeIter *iter,
|
GtkTreeIter *iter,
|
||||||
@ -572,6 +712,8 @@ gnc_tree_model_account_get_value (GtkTreeModel *tree_model,
|
|||||||
Account *account;
|
Account *account;
|
||||||
gboolean negative; /* used to set "deficit style" also known as red numbers */
|
gboolean negative; /* used to set "deficit style" also known as red numbers */
|
||||||
gchar *string;
|
gchar *string;
|
||||||
|
gchar *cached_string = NULL;
|
||||||
|
|
||||||
time64 last_date;
|
time64 last_date;
|
||||||
|
|
||||||
g_return_if_fail (GNC_IS_TREE_MODEL_ACCOUNT(model));
|
g_return_if_fail (GNC_IS_TREE_MODEL_ACCOUNT(model));
|
||||||
@ -585,6 +727,14 @@ gnc_tree_model_account_get_value (GtkTreeModel *tree_model,
|
|||||||
account = (Account *) iter->user_data;
|
account = (Account *) iter->user_data;
|
||||||
priv = GNC_TREE_MODEL_ACCOUNT_GET_PRIVATE(model);
|
priv = GNC_TREE_MODEL_ACCOUNT_GET_PRIVATE(model);
|
||||||
|
|
||||||
|
// lets see if the value is in the cache
|
||||||
|
if (gnc_tree_model_account_get_cached_value (model, account, column, &cached_string))
|
||||||
|
{
|
||||||
|
g_value_init (value, G_TYPE_STRING);
|
||||||
|
g_value_take_string (value, cached_string);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
switch (column)
|
switch (column)
|
||||||
{
|
{
|
||||||
case GNC_TREE_MODEL_ACCOUNT_COL_NAME:
|
case GNC_TREE_MODEL_ACCOUNT_COL_NAME:
|
||||||
@ -699,9 +849,7 @@ gnc_tree_model_account_get_value (GtkTreeModel *tree_model,
|
|||||||
case GNC_TREE_MODEL_ACCOUNT_COL_RECONCILED_DATE:
|
case GNC_TREE_MODEL_ACCOUNT_COL_RECONCILED_DATE:
|
||||||
g_value_init (value, G_TYPE_STRING);
|
g_value_init (value, G_TYPE_STRING);
|
||||||
if (xaccAccountGetReconcileLastDate (account, &last_date))
|
if (xaccAccountGetReconcileLastDate (account, &last_date))
|
||||||
{
|
|
||||||
g_value_take_string (value, qof_print_date (last_date));
|
g_value_take_string (value, qof_print_date (last_date));
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GNC_TREE_MODEL_ACCOUNT_COL_COLOR_RECONCILED:
|
case GNC_TREE_MODEL_ACCOUNT_COL_COLOR_RECONCILED:
|
||||||
@ -797,6 +945,10 @@ gnc_tree_model_account_get_value (GtkTreeModel *tree_model,
|
|||||||
g_assert_not_reached ();
|
g_assert_not_reached ();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// save the value to the account values cache
|
||||||
|
gnc_tree_model_account_set_cached_value (model, account, column, value);
|
||||||
|
|
||||||
LEAVE(" ");
|
LEAVE(" ");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1264,6 +1416,7 @@ gnc_tree_model_account_event_handler (QofInstance *entity,
|
|||||||
Account *account, *parent;
|
Account *account, *parent;
|
||||||
|
|
||||||
g_return_if_fail (model); /* Required */
|
g_return_if_fail (model); /* Required */
|
||||||
|
|
||||||
if (!GNC_IS_ACCOUNT(entity))
|
if (!GNC_IS_ACCOUNT(entity))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -1272,6 +1425,10 @@ gnc_tree_model_account_event_handler (QofInstance *entity,
|
|||||||
priv = GNC_TREE_MODEL_ACCOUNT_GET_PRIVATE(model);
|
priv = GNC_TREE_MODEL_ACCOUNT_GET_PRIVATE(model);
|
||||||
|
|
||||||
account = GNC_ACCOUNT(entity);
|
account = GNC_ACCOUNT(entity);
|
||||||
|
|
||||||
|
/* clear the cached model values for account */
|
||||||
|
gnc_tree_model_account_clear_cached_values (model, account);
|
||||||
|
|
||||||
if (gnc_account_get_book (account) != priv->book)
|
if (gnc_account_get_book (account) != priv->book)
|
||||||
{
|
{
|
||||||
LEAVE("not in this book");
|
LEAVE("not in this book");
|
||||||
|
@ -122,6 +122,11 @@ typedef struct
|
|||||||
*/
|
*/
|
||||||
GType gnc_tree_model_account_get_type (void);
|
GType gnc_tree_model_account_get_type (void);
|
||||||
|
|
||||||
|
/** Clear the tree model account cached values.
|
||||||
|
*
|
||||||
|
* @param model A pointer to the account tree model.
|
||||||
|
*/
|
||||||
|
void gnc_tree_model_account_clear_cache (GncTreeModelAccount *model);
|
||||||
|
|
||||||
/** @name Account Tree Model Constructors
|
/** @name Account Tree Model Constructors
|
||||||
@{ */
|
@{ */
|
||||||
|
@ -1076,6 +1076,17 @@ gnc_tree_view_account_count_children (GncTreeViewAccount *view,
|
|||||||
return num_children;
|
return num_children;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
gnc_tree_view_account_clear_model_cache (GncTreeViewAccount *view)
|
||||||
|
{
|
||||||
|
GtkTreeModel *model, *f_model, *s_model;
|
||||||
|
|
||||||
|
s_model = gtk_tree_view_get_model (GTK_TREE_VIEW(view));
|
||||||
|
f_model = gtk_tree_model_sort_get_model (GTK_TREE_MODEL_SORT(s_model));
|
||||||
|
model = gtk_tree_model_filter_get_model (GTK_TREE_MODEL_FILTER(f_model));
|
||||||
|
|
||||||
|
gnc_tree_model_account_clear_cache (GNC_TREE_MODEL_ACCOUNT(model));
|
||||||
|
}
|
||||||
|
|
||||||
/************************************************************/
|
/************************************************************/
|
||||||
/* Account Tree View Filter Functions */
|
/* Account Tree View Filter Functions */
|
||||||
|
@ -346,6 +346,13 @@ void gnc_tree_view_account_refilter (GncTreeViewAccount *view);
|
|||||||
gint gnc_tree_view_account_count_children (GncTreeViewAccount *view,
|
gint gnc_tree_view_account_count_children (GncTreeViewAccount *view,
|
||||||
Account *account);
|
Account *account);
|
||||||
|
|
||||||
|
/** This function clears the tree model account cache so the values will
|
||||||
|
* be updated/refreshed.
|
||||||
|
*
|
||||||
|
* @param view A pointer to an account tree view.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
void gnc_tree_view_account_clear_model_cache (GncTreeViewAccount *view);
|
||||||
|
|
||||||
|
|
||||||
/** This function returns the account associated with the specified
|
/** This function returns the account associated with the specified
|
||||||
|
@ -205,6 +205,7 @@ gnc_prices_dialog_remove_clicked (GtkWidget *widget, gpointer data)
|
|||||||
g_list_foreach(price_list, (GFunc)remove_helper, pdb_dialog->price_db);
|
g_list_foreach(price_list, (GFunc)remove_helper, pdb_dialog->price_db);
|
||||||
}
|
}
|
||||||
g_list_free(price_list);
|
g_list_free(price_list);
|
||||||
|
gnc_gui_refresh_all ();
|
||||||
LEAVE(" ");
|
LEAVE(" ");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -504,6 +505,7 @@ gnc_prices_dialog_remove_old_clicked (GtkWidget *widget, gpointer data)
|
|||||||
}
|
}
|
||||||
g_list_free (comm_list);
|
g_list_free (comm_list);
|
||||||
}
|
}
|
||||||
|
gnc_gui_refresh_all ();
|
||||||
gtk_widget_destroy (pdb_dialog->remove_dialog);
|
gtk_widget_destroy (pdb_dialog->remove_dialog);
|
||||||
LEAVE(" ");
|
LEAVE(" ");
|
||||||
}
|
}
|
||||||
|
@ -602,6 +602,8 @@ gnc_plugin_page_account_refresh_cb (GHashTable *changes, gpointer user_data)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
priv = GNC_PLUGIN_PAGE_ACCOUNT_TREE_GET_PRIVATE(page);
|
priv = GNC_PLUGIN_PAGE_ACCOUNT_TREE_GET_PRIVATE(page);
|
||||||
|
|
||||||
|
gnc_tree_view_account_clear_model_cache (GNC_TREE_VIEW_ACCOUNT(priv->tree_view));
|
||||||
gtk_widget_queue_draw(priv->widget);
|
gtk_widget_queue_draw(priv->widget);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1671,6 +1673,8 @@ gnc_plugin_page_account_tree_cmd_refresh (GtkAction *action,
|
|||||||
g_return_if_fail(GNC_IS_PLUGIN_PAGE_ACCOUNT_TREE(page));
|
g_return_if_fail(GNC_IS_PLUGIN_PAGE_ACCOUNT_TREE(page));
|
||||||
|
|
||||||
priv = GNC_PLUGIN_PAGE_ACCOUNT_TREE_GET_PRIVATE(page);
|
priv = GNC_PLUGIN_PAGE_ACCOUNT_TREE_GET_PRIVATE(page);
|
||||||
|
|
||||||
|
gnc_tree_view_account_clear_model_cache (GNC_TREE_VIEW_ACCOUNT(priv->tree_view));
|
||||||
gtk_widget_queue_draw (priv->widget);
|
gtk_widget_queue_draw (priv->widget);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
;; Boston, MA 02110-1301, USA gnu@gnu.org
|
;; Boston, MA 02110-1301, USA gnu@gnu.org
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
|
(use-modules (ice-9 match))
|
||||||
(use-modules (gnucash gettext))
|
(use-modules (gnucash gettext))
|
||||||
|
|
||||||
(define *gnc:_style-sheet-templates_* (make-hash-table 23))
|
(define *gnc:_style-sheet-templates_* (make-hash-table 23))
|
||||||
@ -67,23 +68,15 @@
|
|||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
(define (gnc:define-html-style-sheet . args)
|
(define (gnc:define-html-style-sheet . args)
|
||||||
(let ((ss
|
(let loop ((args args)
|
||||||
((record-constructor <html-style-sheet-template>) #f #f #f #f)))
|
(ss ((record-constructor <html-style-sheet-template>) #f #f #f #f)))
|
||||||
(let loop ((left args))
|
(match args
|
||||||
(if (and (list? left)
|
((field value . rest)
|
||||||
(not (null? left))
|
((record-modifier <html-style-sheet-template> field) ss value)
|
||||||
(not (null? (cdr left))))
|
(loop rest ss))
|
||||||
(let* ((field (car left))
|
(else ;; store the style sheet template
|
||||||
(value (cadr left))
|
|
||||||
(mod (record-modifier <html-style-sheet-template> field)))
|
|
||||||
(mod ss value)
|
|
||||||
(loop (cddr left)))))
|
|
||||||
|
|
||||||
;; store the style sheet template
|
|
||||||
(hash-set! *gnc:_style-sheet-templates_*
|
(hash-set! *gnc:_style-sheet-templates_*
|
||||||
(gnc:html-style-sheet-template-name ss)
|
(gnc:html-style-sheet-template-name ss) ss)))))
|
||||||
ss)))
|
|
||||||
|
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; <html-style-sheet> methods
|
;; <html-style-sheet> methods
|
||||||
|
@ -959,15 +959,8 @@
|
|||||||
(format #f "[~a]"
|
(format #f "[~a]"
|
||||||
(gnc:monetary->string mon)))
|
(gnc:monetary->string mon)))
|
||||||
(define (owner->str owner)
|
(define (owner->str owner)
|
||||||
(define owner-alist
|
|
||||||
(list (cons GNC-OWNER-NONE "None")
|
|
||||||
(cons GNC-OWNER-UNDEFINED "Undefined")
|
|
||||||
(cons GNC-OWNER-JOB "Job")
|
|
||||||
(cons GNC-OWNER-CUSTOMER "Cust")
|
|
||||||
(cons GNC-OWNER-VENDOR "Vend")
|
|
||||||
(cons GNC-OWNER-EMPLOYEE "Emp")))
|
|
||||||
(format #f "[~a:~a]"
|
(format #f "[~a:~a]"
|
||||||
(or (assv-ref owner-alist (gncOwnerGetType owner)) "Owner")
|
(gncOwnerGetTypeString owner)
|
||||||
(gncOwnerGetName owner)))
|
(gncOwnerGetName owner)))
|
||||||
(define (invoice->str inv)
|
(define (invoice->str inv)
|
||||||
(format #f "~a<Post:~a,Owner:~a,Notes:~a,Total:~a>"
|
(format #f "~a<Post:~a,Owner:~a,Notes:~a,Total:~a>"
|
||||||
@ -978,6 +971,13 @@
|
|||||||
(monetary->string (gnc:make-gnc-monetary
|
(monetary->string (gnc:make-gnc-monetary
|
||||||
(gncInvoiceGetCurrency inv)
|
(gncInvoiceGetCurrency inv)
|
||||||
(gncInvoiceGetTotal inv)))))
|
(gncInvoiceGetTotal inv)))))
|
||||||
|
(define (lot->str lot)
|
||||||
|
(format #f "Lot<Acc:~a,Title:~a,Notes:~a,Balance:~a,NSplits:~a>"
|
||||||
|
(gnc:strify (xaccAccountGetName (gnc-lot-get-account lot)))
|
||||||
|
(gnc-lot-get-title lot)
|
||||||
|
(gnc-lot-get-notes lot)
|
||||||
|
(gnc-lot-get-balance lot)
|
||||||
|
(gnc-lot-count-splits lot)))
|
||||||
(define (try proc)
|
(define (try proc)
|
||||||
;; Try proc with d as a parameter, catching exceptions to return
|
;; Try proc with d as a parameter, catching exceptions to return
|
||||||
;; #f to the (or) evaluator below.
|
;; #f to the (or) evaluator below.
|
||||||
@ -1008,6 +1008,7 @@
|
|||||||
(try gnc-budget-get-name)
|
(try gnc-budget-get-name)
|
||||||
(try owner->str)
|
(try owner->str)
|
||||||
(try invoice->str)
|
(try invoice->str)
|
||||||
|
(try lot->str)
|
||||||
(object->string d)))
|
(object->string d)))
|
||||||
|
|
||||||
(define (pair->num pair)
|
(define (pair->num pair)
|
||||||
|
@ -29,6 +29,9 @@
|
|||||||
(use-modules (gnucash utilities))
|
(use-modules (gnucash utilities))
|
||||||
(use-modules (gnucash gnc-module))
|
(use-modules (gnucash gnc-module))
|
||||||
(use-modules (gnucash gettext))
|
(use-modules (gnucash gettext))
|
||||||
|
(eval-when (compile load eval expand)
|
||||||
|
(load-extension "libgncmod-gnome-utils" "scm_init_sw_gnome_utils_module"))
|
||||||
|
(use-modules (sw_gnome_utils))
|
||||||
|
|
||||||
(gnc:module-load "gnucash/report" 0)
|
(gnc:module-load "gnucash/report" 0)
|
||||||
|
|
||||||
@ -212,14 +215,17 @@
|
|||||||
this-currency
|
this-currency
|
||||||
(company-get-currency company-info)))
|
(company-get-currency company-info)))
|
||||||
(let ((error-str
|
(let ((error-str
|
||||||
(string-append "IGNORING TRANSACTION!\n" "Invoice Owner: " (gncOwnerGetName owner)
|
(string-append "IGNORING TRANSACTION!\n" "Invoice Owner: " (gnc:strify owner)
|
||||||
"\nTransaction GUID:" (gncTransGetGuid transaction)
|
"\nTransaction:" (gnc:strify transaction)
|
||||||
"\nTransaction Currency" (gnc-commodity-get-mnemonic this-currency)
|
"\nSplits are:\n"
|
||||||
"\nClient Currency" (gnc-ommodity-get-mnemonic(company-get-currency company-info)))))
|
(string-join
|
||||||
|
(map gnc:strify (xaccTransGetSplitList transaction))
|
||||||
|
"\n")
|
||||||
|
"\nTransaction Currency:" (gnc:strify this-currency)
|
||||||
|
"\nClient Currency:" (gnc:strify (company-get-currency company-info)))))
|
||||||
(gnc-error-dialog '() error-str)
|
(gnc-error-dialog '() error-str)
|
||||||
(gnc:error error-str)
|
(gnc:error error-str)
|
||||||
(cons #f (format
|
(cons #f (format #f (_ "Transactions relating to '~a' contain \
|
||||||
(_ "Transactions relating to '~a' contain \
|
|
||||||
more than one currency. This report is not designed to cope with this possibility.") (gncOwnerGetName owner))))
|
more than one currency. This report is not designed to cope with this possibility.") (gncOwnerGetName owner))))
|
||||||
(begin
|
(begin
|
||||||
(gnc:debug "it's an old company")
|
(gnc:debug "it's an old company")
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
|
|
||||||
set(stylesheets_SCHEME
|
set(stylesheets_SCHEME
|
||||||
plain.scm
|
plain.scm
|
||||||
fancy.scm
|
|
||||||
footer.scm
|
footer.scm
|
||||||
easy.scm
|
|
||||||
head-or-tail.scm
|
head-or-tail.scm
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -25,8 +23,8 @@ gnc_add_scheme_targets(scm-report-stylesheets-1
|
|||||||
)
|
)
|
||||||
|
|
||||||
# Module interfaces deprecated in 4.x, will be removed for 5.x
|
# Module interfaces deprecated in 4.x, will be removed for 5.x
|
||||||
gnc_add_scheme_deprecated_module ("gnucash report stylesheet-easy" "gnucash report stylesheets easy" "scm-report-stylesheets-1" "")
|
gnc_add_scheme_deprecated_module ("gnucash report stylesheet-easy" "gnucash report stylesheets footer" "scm-report-stylesheets-1" "")
|
||||||
gnc_add_scheme_deprecated_module ("gnucash report stylesheet-fancy" "gnucash report stylesheets fancy" "scm-report-stylesheets-1" "")
|
gnc_add_scheme_deprecated_module ("gnucash report stylesheet-fancy" "gnucash report stylesheets footer" "scm-report-stylesheets-1" "")
|
||||||
gnc_add_scheme_deprecated_module ("gnucash report stylesheet-footer" "gnucash report stylesheets footer" "scm-report-stylesheets-1" "")
|
gnc_add_scheme_deprecated_module ("gnucash report stylesheet-footer" "gnucash report stylesheets footer" "scm-report-stylesheets-1" "")
|
||||||
gnc_add_scheme_deprecated_module ("gnucash report stylesheet-head-or-tail" "gnucash report stylesheets head-or-tail" "scm-report-stylesheets-1" "")
|
gnc_add_scheme_deprecated_module ("gnucash report stylesheet-head-or-tail" "gnucash report stylesheets head-or-tail" "scm-report-stylesheets-1" "")
|
||||||
gnc_add_scheme_deprecated_module ("gnucash report stylesheet-plain" "gnucash report stylesheets plain" "scm-report-stylesheets-1" "")
|
gnc_add_scheme_deprecated_module ("gnucash report stylesheet-plain" "gnucash report stylesheets plain" "scm-report-stylesheets-1" "")
|
||||||
|
@ -1,394 +0,0 @@
|
|||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
||||||
;; stylesheet-easy.scm: stylesheet with nicer formatting for
|
|
||||||
;; printing and easier configurability
|
|
||||||
;;
|
|
||||||
;; Copyright 2004 James Strandboge <jstrand1@rochester.rr.com>
|
|
||||||
;;
|
|
||||||
;; This program is free software; you can redistribute it and/or
|
|
||||||
;; modify it under the terms of the GNU General Public License as
|
|
||||||
;; published by the Free Software Foundation; either version 2 of
|
|
||||||
;; the License, or (at your option) any later version.
|
|
||||||
;;
|
|
||||||
;; This program is distributed in the hope that it will be useful,
|
|
||||||
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
;; GNU General Public License for more details.
|
|
||||||
;;
|
|
||||||
;; You should have received a copy of the GNU General Public License
|
|
||||||
;; along with this program; if not, contact:
|
|
||||||
;;
|
|
||||||
;; Free Software Foundation Voice: +1-617-542-5942
|
|
||||||
;; 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652
|
|
||||||
;; Boston, MA 02110-1301, USA gnu@gnu.org
|
|
||||||
;;
|
|
||||||
;; Based on work from:
|
|
||||||
;; stylesheet-header.scm
|
|
||||||
;; Copyright 2000 Bill Gribble <grib@gnumatic.com>
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
||||||
|
|
||||||
|
|
||||||
(define-module (gnucash report stylesheets easy))
|
|
||||||
|
|
||||||
(use-modules (gnucash utilities))
|
|
||||||
(use-modules (gnucash gnc-module))
|
|
||||||
(use-modules (gnucash gettext))
|
|
||||||
|
|
||||||
(gnc:module-load "gnucash/html" 0)
|
|
||||||
(gnc:module-load "gnucash/report" 0)
|
|
||||||
|
|
||||||
(define (easy-options)
|
|
||||||
(let* ((options (gnc:new-options))
|
|
||||||
(opt-register
|
|
||||||
(lambda (opt)
|
|
||||||
(gnc:register-option options opt))))
|
|
||||||
(opt-register
|
|
||||||
(gnc:make-string-option
|
|
||||||
(N_ "General")
|
|
||||||
(N_ "Preparer") "a"
|
|
||||||
(N_ "Name of person preparing the report.")
|
|
||||||
""))
|
|
||||||
(opt-register
|
|
||||||
(gnc:make-string-option
|
|
||||||
(N_ "General")
|
|
||||||
(N_ "Prepared for") "b"
|
|
||||||
(N_ "Name of organization or company prepared for.")
|
|
||||||
""))
|
|
||||||
(opt-register
|
|
||||||
(gnc:make-simple-boolean-option
|
|
||||||
(N_ "General")
|
|
||||||
(N_ "Show preparer info") "c"
|
|
||||||
(N_ "Name of organization or company.")
|
|
||||||
#f))
|
|
||||||
(opt-register
|
|
||||||
(gnc:make-simple-boolean-option
|
|
||||||
(N_ "General")
|
|
||||||
(N_ "Enable Links") "d"
|
|
||||||
(N_ "Enable hyperlinks in reports.")
|
|
||||||
#t))
|
|
||||||
|
|
||||||
(opt-register
|
|
||||||
(gnc:make-pixmap-option
|
|
||||||
(N_ "Images")
|
|
||||||
(N_ "Background Tile") "a" (N_ "Background tile for reports.")
|
|
||||||
""))
|
|
||||||
(opt-register
|
|
||||||
(gnc:make-pixmap-option
|
|
||||||
(N_ "Images")
|
|
||||||
(N_ "Heading Banner") "b" (N_ "Banner for top of report.")
|
|
||||||
""))
|
|
||||||
(opt-register
|
|
||||||
(gnc:make-multichoice-option
|
|
||||||
(N_ "Images")
|
|
||||||
(N_ "Heading Alignment") "c" (N_ "Banner for top of report.")
|
|
||||||
'left
|
|
||||||
(list (vector 'left
|
|
||||||
(N_ "Left")
|
|
||||||
(N_ "Align the banner to the left."))
|
|
||||||
(vector 'center
|
|
||||||
(N_ "Center")
|
|
||||||
(N_ "Align the banner in the center."))
|
|
||||||
(vector 'right
|
|
||||||
(N_ "Right")
|
|
||||||
(N_ "Align the banner to the right."))
|
|
||||||
)))
|
|
||||||
(opt-register
|
|
||||||
(gnc:make-pixmap-option
|
|
||||||
(N_ "Images")
|
|
||||||
(N_ "Logo") "d" (N_ "Company logo image.")
|
|
||||||
""))
|
|
||||||
|
|
||||||
(opt-register
|
|
||||||
(gnc:make-color-option
|
|
||||||
(N_ "Colors")
|
|
||||||
(N_ "Background Color") "a" (N_ "General background color for report.")
|
|
||||||
(list #xff #xff #xff #xff)
|
|
||||||
255 #f))
|
|
||||||
|
|
||||||
(opt-register
|
|
||||||
(gnc:make-color-option
|
|
||||||
(N_ "Colors")
|
|
||||||
(N_ "Text Color") "b" (N_ "Normal body text color.")
|
|
||||||
(list #x00 #x00 #x00 #xff)
|
|
||||||
255 #f))
|
|
||||||
|
|
||||||
(opt-register
|
|
||||||
(gnc:make-color-option
|
|
||||||
(N_ "Colors")
|
|
||||||
(N_ "Link Color") "c" (N_ "Link text color.")
|
|
||||||
(list #xb2 #x22 #x22 #xff)
|
|
||||||
255 #f))
|
|
||||||
|
|
||||||
(opt-register
|
|
||||||
(gnc:make-color-option
|
|
||||||
(N_ "Colors")
|
|
||||||
(N_ "Table Cell Color") "c" (N_ "Default background for table cells.")
|
|
||||||
(list #xff #xff #xff #xff)
|
|
||||||
255 #f))
|
|
||||||
|
|
||||||
(opt-register
|
|
||||||
(gnc:make-color-option
|
|
||||||
(N_ "Colors")
|
|
||||||
(N_ "Alternate Table Cell Color") "d"
|
|
||||||
(N_ "Default alternate background for table cells.")
|
|
||||||
(list #xff #xff #xff #xff)
|
|
||||||
255 #f))
|
|
||||||
|
|
||||||
(opt-register
|
|
||||||
(gnc:make-color-option
|
|
||||||
(N_ "Colors")
|
|
||||||
(N_ "Subheading/Subtotal Cell Color") "e"
|
|
||||||
(N_ "Default color for subtotal rows.")
|
|
||||||
(list #xee #xe8 #xaa #xff)
|
|
||||||
255 #f))
|
|
||||||
|
|
||||||
(opt-register
|
|
||||||
(gnc:make-color-option
|
|
||||||
(N_ "Colors")
|
|
||||||
(N_ "Sub-subheading/total Cell Color") "f"
|
|
||||||
(N_ "Color for subsubtotals.")
|
|
||||||
(list #xfa #xfa #xd2 #xff)
|
|
||||||
255 #f))
|
|
||||||
|
|
||||||
(opt-register
|
|
||||||
(gnc:make-color-option
|
|
||||||
(N_ "Colors")
|
|
||||||
(N_ "Grand Total Cell Color") "g"
|
|
||||||
(N_ "Color for grand totals.")
|
|
||||||
(list #xff #xff #x00 #xff)
|
|
||||||
255 #f))
|
|
||||||
|
|
||||||
(opt-register
|
|
||||||
(gnc:make-number-range-option
|
|
||||||
(N_ "Tables")
|
|
||||||
(N_ "Table cell spacing") "a" (N_ "Space between table cells.")
|
|
||||||
1 0 20 0 1))
|
|
||||||
|
|
||||||
(opt-register
|
|
||||||
(gnc:make-number-range-option
|
|
||||||
(N_ "Tables")
|
|
||||||
(N_ "Table cell padding") "b" (N_ "Space between table cell edge and content.")
|
|
||||||
1 0 20 0 1))
|
|
||||||
|
|
||||||
(opt-register
|
|
||||||
(gnc:make-number-range-option
|
|
||||||
(N_ "Tables")
|
|
||||||
(N_ "Table border width") "c" (N_ "Bevel depth on tables.")
|
|
||||||
1 0 20 0 1))
|
|
||||||
(register-font-options options)
|
|
||||||
|
|
||||||
options))
|
|
||||||
|
|
||||||
(define (easy-renderer options doc)
|
|
||||||
(let* ((ssdoc (gnc:make-html-document))
|
|
||||||
(opt-val
|
|
||||||
(lambda (section name)
|
|
||||||
(gnc:option-value
|
|
||||||
(gnc:lookup-option options section name))))
|
|
||||||
(color-val
|
|
||||||
(lambda (section name)
|
|
||||||
(gnc:color-option->html
|
|
||||||
(gnc:lookup-option options section name))))
|
|
||||||
(preparer (opt-val "General" "Preparer"))
|
|
||||||
(prepared-for (opt-val "General" "Prepared for"))
|
|
||||||
(show-preparer? (opt-val "General" "Show preparer info"))
|
|
||||||
(links? (opt-val "General" "Enable Links"))
|
|
||||||
(bgcolor (color-val "Colors" "Background Color"))
|
|
||||||
(textcolor (color-val "Colors" "Text Color"))
|
|
||||||
(linkcolor (color-val "Colors" "Link Color"))
|
|
||||||
(normal-row-color (color-val "Colors" "Table Cell Color"))
|
|
||||||
(alternate-row-color (color-val "Colors" "Alternate Table Cell Color"))
|
|
||||||
(primary-subheading-color
|
|
||||||
(color-val "Colors" "Subheading/Subtotal Cell Color"))
|
|
||||||
(secondary-subheading-color
|
|
||||||
(color-val "Colors" "Sub-subheading/total Cell Color"))
|
|
||||||
(grand-total-color (color-val "Colors" "Grand Total Cell Color"))
|
|
||||||
(bgpixmap (opt-val "Images" "Background Tile"))
|
|
||||||
(headpixmap (opt-val "Images" "Heading Banner"))
|
|
||||||
(logopixmap (opt-val "Images" "Logo"))
|
|
||||||
(align (gnc:value->string (opt-val "Images" "Heading Alignment")))
|
|
||||||
(spacing (opt-val "Tables" "Table cell spacing"))
|
|
||||||
(padding (opt-val "Tables" "Table cell padding"))
|
|
||||||
(border (opt-val "Tables" "Table border width"))
|
|
||||||
(headcolumn 0))
|
|
||||||
|
|
||||||
(gnc:html-document-set-style!
|
|
||||||
ssdoc "body"
|
|
||||||
'attribute (list "bgcolor" bgcolor)
|
|
||||||
'attribute (list "text" textcolor)
|
|
||||||
'attribute (list "link" linkcolor))
|
|
||||||
;;;;
|
|
||||||
;;;;
|
|
||||||
;;;;
|
|
||||||
(gnc:html-document-set-style!
|
|
||||||
ssdoc "column-heading-left"
|
|
||||||
'tag "th"
|
|
||||||
'attribute (list "class" "column-heading-left"))
|
|
||||||
|
|
||||||
(gnc:html-document-set-style!
|
|
||||||
ssdoc "column-heading-center"
|
|
||||||
'tag "th"
|
|
||||||
'attribute (list "class" "column-heading-center"))
|
|
||||||
|
|
||||||
(gnc:html-document-set-style!
|
|
||||||
ssdoc "column-heading-right"
|
|
||||||
'tag "th"
|
|
||||||
'attribute (list "class" "column-heading-right"))
|
|
||||||
|
|
||||||
(gnc:html-document-set-style!
|
|
||||||
ssdoc "date-cell"
|
|
||||||
'tag "td"
|
|
||||||
'attribute (list "class" "date-cell"))
|
|
||||||
|
|
||||||
(gnc:html-document-set-style!
|
|
||||||
ssdoc "anchor-cell"
|
|
||||||
'tag "td"
|
|
||||||
'attribute (list "class" "anchor-cell"))
|
|
||||||
|
|
||||||
(gnc:html-document-set-style!
|
|
||||||
ssdoc "number-cell"
|
|
||||||
'tag "td"
|
|
||||||
'attribute (list "class" "number-cell"))
|
|
||||||
|
|
||||||
(gnc:html-document-set-style!
|
|
||||||
ssdoc "number-cell-neg"
|
|
||||||
'tag "td"
|
|
||||||
'attribute (list "class" "number-cell neg"))
|
|
||||||
|
|
||||||
(gnc:html-document-set-style!
|
|
||||||
ssdoc "number-header"
|
|
||||||
'tag "th"
|
|
||||||
'attribute (list "class" "number-header"))
|
|
||||||
|
|
||||||
(gnc:html-document-set-style!
|
|
||||||
ssdoc "text-cell"
|
|
||||||
'tag "td"
|
|
||||||
'attribute (list "class" "text-cell"))
|
|
||||||
|
|
||||||
(gnc:html-document-set-style!
|
|
||||||
ssdoc "total-number-cell"
|
|
||||||
'tag '("td")
|
|
||||||
'attribute (list "class" "total-number-cell"))
|
|
||||||
|
|
||||||
(gnc:html-document-set-style!
|
|
||||||
ssdoc "total-number-cell-neg"
|
|
||||||
'tag '("td")
|
|
||||||
'attribute (list "class" "total-number-cell neg"))
|
|
||||||
|
|
||||||
(gnc:html-document-set-style!
|
|
||||||
ssdoc "total-label-cell"
|
|
||||||
'tag '("td")
|
|
||||||
'attribute (list "class" "total-label-cell"))
|
|
||||||
|
|
||||||
(gnc:html-document-set-style!
|
|
||||||
ssdoc "centered-label-cell"
|
|
||||||
'tag '("td")
|
|
||||||
'attribute (list "class" "centered-label-cell"))
|
|
||||||
|
|
||||||
(if (and bgpixmap
|
|
||||||
(not (string=? bgpixmap "")))
|
|
||||||
(gnc:html-document-set-style!
|
|
||||||
ssdoc "body"
|
|
||||||
'attribute (list "background" (make-file-url bgpixmap))))
|
|
||||||
|
|
||||||
(gnc:html-document-set-style!
|
|
||||||
ssdoc "table"
|
|
||||||
'attribute (list "border" border)
|
|
||||||
'attribute (list "cellspacing" spacing)
|
|
||||||
'attribute (list "cellpadding" padding))
|
|
||||||
|
|
||||||
(gnc:html-document-set-style!
|
|
||||||
ssdoc "normal-row"
|
|
||||||
'attribute (list "bgcolor" normal-row-color)
|
|
||||||
'tag "tr")
|
|
||||||
(gnc:html-document-set-style!
|
|
||||||
ssdoc "alternate-row"
|
|
||||||
'attribute (list "bgcolor" alternate-row-color)
|
|
||||||
'tag "tr")
|
|
||||||
(gnc:html-document-set-style!
|
|
||||||
ssdoc "primary-subheading"
|
|
||||||
'attribute (list "bgcolor" primary-subheading-color)
|
|
||||||
'tag "tr")
|
|
||||||
(gnc:html-document-set-style!
|
|
||||||
ssdoc "secondary-subheading"
|
|
||||||
'attribute (list "bgcolor" secondary-subheading-color)
|
|
||||||
'tag "tr")
|
|
||||||
(gnc:html-document-set-style!
|
|
||||||
ssdoc "grand-total"
|
|
||||||
'attribute (list "bgcolor" grand-total-color)
|
|
||||||
'tag "tr")
|
|
||||||
|
|
||||||
;; don't surround marked-up links with <a> </a>
|
|
||||||
(if (not links?)
|
|
||||||
(gnc:html-document-set-style!
|
|
||||||
ssdoc "a" 'tag ""))
|
|
||||||
|
|
||||||
(add-css-information-to-doc options ssdoc doc)
|
|
||||||
|
|
||||||
(let ((t (gnc:make-html-table)))
|
|
||||||
;; we don't want a bevel for this table, but we don't want
|
|
||||||
;; that to propagate
|
|
||||||
(gnc:html-table-set-style!
|
|
||||||
t "table"
|
|
||||||
'attribute (list "border" 0)
|
|
||||||
'attribute (list "style" "margin-left:auto; margin-right:auto")
|
|
||||||
'inheritable? #f)
|
|
||||||
|
|
||||||
;; set the header column to be the 2nd when we have a logo
|
|
||||||
;; do this so that when logo is not present, the document
|
|
||||||
;; is perfectly centered
|
|
||||||
(if (and logopixmap (> (string-length logopixmap) 0))
|
|
||||||
(set! headcolumn 1))
|
|
||||||
|
|
||||||
(let* ((headline (or (gnc:html-document-headline doc)
|
|
||||||
(gnc:html-document-title doc))))
|
|
||||||
|
|
||||||
(gnc:html-table-set-cell!
|
|
||||||
t 1 headcolumn
|
|
||||||
(if show-preparer?
|
|
||||||
;; title plus preparer info
|
|
||||||
(gnc:make-html-text
|
|
||||||
(gnc:html-markup-h3 headline)
|
|
||||||
(gnc:html-markup-br)
|
|
||||||
(_ "Prepared by: ")
|
|
||||||
(gnc:html-markup-b preparer)
|
|
||||||
(gnc:html-markup-br)
|
|
||||||
(_ "Prepared for: ")
|
|
||||||
(gnc:html-markup-b prepared-for)
|
|
||||||
(gnc:html-markup-br)
|
|
||||||
(_ "Date: ")
|
|
||||||
(qof-print-date
|
|
||||||
(current-time)))
|
|
||||||
|
|
||||||
;; title only
|
|
||||||
(gnc:make-html-text
|
|
||||||
(gnc:html-markup-h3 headline))))
|
|
||||||
)
|
|
||||||
|
|
||||||
;; only setup an image if we specified one
|
|
||||||
(if (and logopixmap (> (string-length logopixmap) 0))
|
|
||||||
(gnc:html-table-set-cell!
|
|
||||||
t 0 0
|
|
||||||
(gnc:make-html-text
|
|
||||||
(gnc:html-markup-img (make-file-url logopixmap)))))
|
|
||||||
|
|
||||||
(if (and headpixmap (> (string-length headpixmap) 0))
|
|
||||||
(let* ((div (gnc:html-markup-img (make-file-url headpixmap)))
|
|
||||||
(cell (gnc:make-html-table-cell (gnc:make-html-text div))))
|
|
||||||
(gnc:html-table-cell-set-style! cell "td" 'attribute `("align" ,align))
|
|
||||||
(gnc:html-table-set-cell! t 0 headcolumn cell))
|
|
||||||
(gnc:html-table-set-cell! t 0 headcolumn (gnc:make-html-text " ")))
|
|
||||||
|
|
||||||
(apply
|
|
||||||
gnc:html-table-set-cell!
|
|
||||||
t 2 headcolumn
|
|
||||||
(gnc:html-document-objects doc))
|
|
||||||
(gnc:html-document-add-object! ssdoc t))
|
|
||||||
ssdoc))
|
|
||||||
|
|
||||||
(gnc:define-html-style-sheet
|
|
||||||
'version 1
|
|
||||||
'name (N_ "Easy")
|
|
||||||
'renderer easy-renderer
|
|
||||||
'options-generator easy-options)
|
|
||||||
|
|
||||||
(gnc:make-html-style-sheet "Easy" (N_ "Easy"))
|
|
@ -1,388 +0,0 @@
|
|||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
||||||
;; stylesheet-header.scm : stylesheet with nicer layout
|
|
||||||
;; Copyright 2000 Bill Gribble <grib@gnumatic.com>
|
|
||||||
;;
|
|
||||||
;; This program is free software; you can redistribute it and/or
|
|
||||||
;; modify it under the terms of the GNU General Public License as
|
|
||||||
;; published by the Free Software Foundation; either version 2 of
|
|
||||||
;; the License, or (at your option) any later version.
|
|
||||||
;;
|
|
||||||
;; This program is distributed in the hope that it will be useful,
|
|
||||||
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
;; GNU General Public License for more details.
|
|
||||||
;;
|
|
||||||
;; You should have received a copy of the GNU General Public License
|
|
||||||
;; along with this program; if not, contact:
|
|
||||||
;;
|
|
||||||
;; Free Software Foundation Voice: +1-617-542-5942
|
|
||||||
;; 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652
|
|
||||||
;; Boston, MA 02110-1301, USA gnu@gnu.org
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
||||||
|
|
||||||
|
|
||||||
(define-module (gnucash report stylesheets fancy))
|
|
||||||
|
|
||||||
(use-modules (gnucash utilities))
|
|
||||||
(use-modules (gnucash gnc-module))
|
|
||||||
(use-modules (gnucash gettext))
|
|
||||||
|
|
||||||
(gnc:module-load "gnucash/html" 0)
|
|
||||||
(gnc:module-load "gnucash/report" 0)
|
|
||||||
|
|
||||||
(define (fancy-options)
|
|
||||||
(let* ((options (gnc:new-options))
|
|
||||||
(opt-register
|
|
||||||
(lambda (opt)
|
|
||||||
(gnc:register-option options opt))))
|
|
||||||
(opt-register
|
|
||||||
(gnc:make-string-option
|
|
||||||
(N_ "General")
|
|
||||||
(N_ "Preparer") "a"
|
|
||||||
(N_ "Name of person preparing the report.")
|
|
||||||
""))
|
|
||||||
(opt-register
|
|
||||||
(gnc:make-string-option
|
|
||||||
(N_ "General")
|
|
||||||
(N_ "Prepared for") "b"
|
|
||||||
(N_ "Name of organization or company prepared for.")
|
|
||||||
""))
|
|
||||||
(opt-register
|
|
||||||
(gnc:make-simple-boolean-option
|
|
||||||
(N_ "General")
|
|
||||||
(N_ "Show preparer info") "c"
|
|
||||||
(N_ "Name of organization or company.")
|
|
||||||
#f))
|
|
||||||
(opt-register
|
|
||||||
(gnc:make-simple-boolean-option
|
|
||||||
(N_ "General")
|
|
||||||
(N_ "Enable Links") "d"
|
|
||||||
(N_ "Enable hyperlinks in reports.")
|
|
||||||
#t))
|
|
||||||
|
|
||||||
(opt-register
|
|
||||||
(gnc:make-pixmap-option
|
|
||||||
(N_ "Images")
|
|
||||||
(N_ "Background Tile") "a" (N_ "Background tile for reports.")
|
|
||||||
""))
|
|
||||||
(opt-register
|
|
||||||
(gnc:make-pixmap-option
|
|
||||||
(N_ "Images")
|
|
||||||
(N_ "Heading Banner") "b" (N_ "Banner for top of report.")
|
|
||||||
""))
|
|
||||||
(opt-register
|
|
||||||
(gnc:make-multichoice-option
|
|
||||||
(N_ "Images")
|
|
||||||
(N_ "Heading Alignment") "c" (N_ "Banner for top of report.")
|
|
||||||
'left
|
|
||||||
(list (vector 'left
|
|
||||||
(N_ "Left")
|
|
||||||
(N_ "Align the banner to the left."))
|
|
||||||
(vector 'center
|
|
||||||
(N_ "Center")
|
|
||||||
(N_ "Align the banner in the center."))
|
|
||||||
(vector 'right
|
|
||||||
(N_ "Right")
|
|
||||||
(N_ "Align the banner to the right."))
|
|
||||||
)))
|
|
||||||
(opt-register
|
|
||||||
(gnc:make-pixmap-option
|
|
||||||
(N_ "Images")
|
|
||||||
(N_ "Logo") "d" (N_ "Company logo image.")
|
|
||||||
""))
|
|
||||||
|
|
||||||
(opt-register
|
|
||||||
(gnc:make-color-option
|
|
||||||
(N_ "Colors")
|
|
||||||
(N_ "Background Color") "a" (N_ "General background color for report.")
|
|
||||||
(list #xff #xff #xff #xff)
|
|
||||||
255 #f))
|
|
||||||
|
|
||||||
(opt-register
|
|
||||||
(gnc:make-color-option
|
|
||||||
(N_ "Colors")
|
|
||||||
(N_ "Text Color") "b" (N_ "Normal body text color.")
|
|
||||||
(list #x00 #x00 #x00 #xff)
|
|
||||||
255 #f))
|
|
||||||
|
|
||||||
(opt-register
|
|
||||||
(gnc:make-color-option
|
|
||||||
(N_ "Colors")
|
|
||||||
(N_ "Link Color") "c" (N_ "Link text color.")
|
|
||||||
(list #xb2 #x22 #x22 #xff)
|
|
||||||
255 #f))
|
|
||||||
|
|
||||||
(opt-register
|
|
||||||
(gnc:make-color-option
|
|
||||||
(N_ "Colors")
|
|
||||||
(N_ "Table Cell Color") "c" (N_ "Default background for table cells.")
|
|
||||||
(list #xff #xff #xff #xff)
|
|
||||||
255 #f))
|
|
||||||
|
|
||||||
(opt-register
|
|
||||||
(gnc:make-color-option
|
|
||||||
(N_ "Colors")
|
|
||||||
(N_ "Alternate Table Cell Color") "d"
|
|
||||||
(N_ "Default alternate background for table cells.")
|
|
||||||
(list #xff #xff #xff #xff)
|
|
||||||
255 #f))
|
|
||||||
|
|
||||||
(opt-register
|
|
||||||
(gnc:make-color-option
|
|
||||||
(N_ "Colors")
|
|
||||||
(N_ "Subheading/Subtotal Cell Color") "e"
|
|
||||||
(N_ "Default color for subtotal rows.")
|
|
||||||
(list #xee #xe8 #xaa #xff)
|
|
||||||
255 #f))
|
|
||||||
|
|
||||||
(opt-register
|
|
||||||
(gnc:make-color-option
|
|
||||||
(N_ "Colors")
|
|
||||||
(N_ "Sub-subheading/total Cell Color") "f"
|
|
||||||
(N_ "Color for subsubtotals.")
|
|
||||||
(list #xfa #xfa #xd2 #xff)
|
|
||||||
255 #f))
|
|
||||||
|
|
||||||
(opt-register
|
|
||||||
(gnc:make-color-option
|
|
||||||
(N_ "Colors")
|
|
||||||
(N_ "Grand Total Cell Color") "g"
|
|
||||||
(N_ "Color for grand totals.")
|
|
||||||
(list #xff #xff #x00 #xff)
|
|
||||||
255 #f))
|
|
||||||
|
|
||||||
(opt-register
|
|
||||||
(gnc:make-number-range-option
|
|
||||||
(N_ "Tables")
|
|
||||||
(N_ "Table cell spacing") "a" (N_ "Space between table cells.")
|
|
||||||
1 0 20 0 1))
|
|
||||||
|
|
||||||
(opt-register
|
|
||||||
(gnc:make-number-range-option
|
|
||||||
(N_ "Tables")
|
|
||||||
(N_ "Table cell padding") "b" (N_ "Space between table cell edge and content.")
|
|
||||||
1 0 20 0 1))
|
|
||||||
|
|
||||||
(opt-register
|
|
||||||
(gnc:make-number-range-option
|
|
||||||
(N_ "Tables")
|
|
||||||
(N_ "Table border width") "c" (N_ "Bevel depth on tables.")
|
|
||||||
1 0 20 0 1))
|
|
||||||
(register-font-options options)
|
|
||||||
|
|
||||||
options))
|
|
||||||
|
|
||||||
(define (fancy-renderer options doc)
|
|
||||||
(let* ((ssdoc (gnc:make-html-document))
|
|
||||||
(opt-val
|
|
||||||
(lambda (section name)
|
|
||||||
(gnc:option-value
|
|
||||||
(gnc:lookup-option options section name))))
|
|
||||||
(color-val
|
|
||||||
(lambda (section name)
|
|
||||||
(gnc:color-option->html
|
|
||||||
(gnc:lookup-option options section name))))
|
|
||||||
(preparer (opt-val "General" "Preparer"))
|
|
||||||
(prepared-for (opt-val "General" "Prepared for"))
|
|
||||||
(show-preparer? (opt-val "General" "Show preparer info"))
|
|
||||||
(links? (opt-val "General" "Enable Links"))
|
|
||||||
(bgcolor (color-val "Colors" "Background Color"))
|
|
||||||
(textcolor (color-val "Colors" "Text Color"))
|
|
||||||
(linkcolor (color-val "Colors" "Link Color"))
|
|
||||||
(normal-row-color (color-val "Colors" "Table Cell Color"))
|
|
||||||
(alternate-row-color (color-val "Colors" "Alternate Table Cell Color"))
|
|
||||||
(primary-subheading-color
|
|
||||||
(color-val "Colors" "Subheading/Subtotal Cell Color"))
|
|
||||||
(secondary-subheading-color
|
|
||||||
(color-val "Colors" "Sub-subheading/total Cell Color"))
|
|
||||||
(grand-total-color (color-val "Colors" "Grand Total Cell Color"))
|
|
||||||
(bgpixmap (opt-val "Images" "Background Tile"))
|
|
||||||
(headpixmap (opt-val "Images" "Heading Banner"))
|
|
||||||
(logopixmap (opt-val "Images" "Logo"))
|
|
||||||
(align (gnc:value->string (opt-val "Images" "Heading Alignment")))
|
|
||||||
(spacing (opt-val "Tables" "Table cell spacing"))
|
|
||||||
(padding (opt-val "Tables" "Table cell padding"))
|
|
||||||
(border (opt-val "Tables" "Table border width"))
|
|
||||||
(headcolumn 0))
|
|
||||||
|
|
||||||
(gnc:html-document-set-style!
|
|
||||||
ssdoc "body"
|
|
||||||
'attribute (list "bgcolor" bgcolor)
|
|
||||||
'attribute (list "text" textcolor)
|
|
||||||
'attribute (list "link" linkcolor))
|
|
||||||
;;;;
|
|
||||||
;;;;
|
|
||||||
;;;;
|
|
||||||
(gnc:html-document-set-style!
|
|
||||||
ssdoc "column-heading-left"
|
|
||||||
'tag "th"
|
|
||||||
'attribute (list "class" "column-heading-left"))
|
|
||||||
|
|
||||||
(gnc:html-document-set-style!
|
|
||||||
ssdoc "column-heading-center"
|
|
||||||
'tag "th"
|
|
||||||
'attribute (list "class" "column-heading-center"))
|
|
||||||
|
|
||||||
(gnc:html-document-set-style!
|
|
||||||
ssdoc "column-heading-right"
|
|
||||||
'tag "th"
|
|
||||||
'attribute (list "class" "column-heading-right"))
|
|
||||||
|
|
||||||
(gnc:html-document-set-style!
|
|
||||||
ssdoc "date-cell"
|
|
||||||
'tag "td"
|
|
||||||
'attribute (list "class" "date-cell"))
|
|
||||||
|
|
||||||
(gnc:html-document-set-style!
|
|
||||||
ssdoc "anchor-cell"
|
|
||||||
'tag "td"
|
|
||||||
'attribute (list "class" "anchor-cell"))
|
|
||||||
|
|
||||||
(gnc:html-document-set-style!
|
|
||||||
ssdoc "number-cell"
|
|
||||||
'tag "td"
|
|
||||||
'attribute (list "class" "number-cell"))
|
|
||||||
|
|
||||||
(gnc:html-document-set-style!
|
|
||||||
ssdoc "number-cell-neg"
|
|
||||||
'tag "td"
|
|
||||||
'attribute (list "class" "number-cell neg"))
|
|
||||||
|
|
||||||
(gnc:html-document-set-style!
|
|
||||||
ssdoc "number-header"
|
|
||||||
'tag "th"
|
|
||||||
'attribute (list "class" "number-header"))
|
|
||||||
|
|
||||||
(gnc:html-document-set-style!
|
|
||||||
ssdoc "text-cell"
|
|
||||||
'tag "td"
|
|
||||||
'attribute (list "class" "text-cell"))
|
|
||||||
|
|
||||||
(gnc:html-document-set-style!
|
|
||||||
ssdoc "total-number-cell"
|
|
||||||
'tag '("td")
|
|
||||||
'attribute (list "class" "total-number-cell"))
|
|
||||||
|
|
||||||
(gnc:html-document-set-style!
|
|
||||||
ssdoc "total-number-cell-neg"
|
|
||||||
'tag '("td")
|
|
||||||
'attribute (list "class" "total-number-cell neg"))
|
|
||||||
|
|
||||||
(gnc:html-document-set-style!
|
|
||||||
ssdoc "total-label-cell"
|
|
||||||
'tag '("td")
|
|
||||||
'attribute (list "class" "total-label-cell"))
|
|
||||||
|
|
||||||
(gnc:html-document-set-style!
|
|
||||||
ssdoc "centered-label-cell"
|
|
||||||
'tag '("td")
|
|
||||||
'attribute (list "class" "centered-label-cell"))
|
|
||||||
|
|
||||||
(if (and bgpixmap
|
|
||||||
(not (string=? bgpixmap "")))
|
|
||||||
(gnc:html-document-set-style!
|
|
||||||
ssdoc "body"
|
|
||||||
'attribute (list "background" (make-file-url bgpixmap))))
|
|
||||||
|
|
||||||
(gnc:html-document-set-style!
|
|
||||||
ssdoc "table"
|
|
||||||
'attribute (list "border" border)
|
|
||||||
'attribute (list "cellspacing" spacing)
|
|
||||||
'attribute (list "cellpadding" padding))
|
|
||||||
|
|
||||||
(gnc:html-document-set-style!
|
|
||||||
ssdoc "normal-row"
|
|
||||||
'attribute (list "bgcolor" normal-row-color)
|
|
||||||
'tag "tr")
|
|
||||||
(gnc:html-document-set-style!
|
|
||||||
ssdoc "alternate-row"
|
|
||||||
'attribute (list "bgcolor" alternate-row-color)
|
|
||||||
'tag "tr")
|
|
||||||
(gnc:html-document-set-style!
|
|
||||||
ssdoc "primary-subheading"
|
|
||||||
'attribute (list "bgcolor" primary-subheading-color)
|
|
||||||
'tag "tr")
|
|
||||||
(gnc:html-document-set-style!
|
|
||||||
ssdoc "secondary-subheading"
|
|
||||||
'attribute (list "bgcolor" secondary-subheading-color)
|
|
||||||
'tag "tr")
|
|
||||||
(gnc:html-document-set-style!
|
|
||||||
ssdoc "grand-total"
|
|
||||||
'attribute (list "bgcolor" grand-total-color)
|
|
||||||
'tag "tr")
|
|
||||||
|
|
||||||
;; don't surround marked-up links with <a> </a>
|
|
||||||
(if (not links?)
|
|
||||||
(gnc:html-document-set-style!
|
|
||||||
ssdoc "a" 'tag ""))
|
|
||||||
|
|
||||||
(add-css-information-to-doc options ssdoc doc)
|
|
||||||
|
|
||||||
(let ((t (gnc:make-html-table)))
|
|
||||||
;; we don't want a bevel for this table, but we don't want
|
|
||||||
;; that to propagate
|
|
||||||
(gnc:html-table-set-style!
|
|
||||||
t "table"
|
|
||||||
'attribute (list "border" 0)
|
|
||||||
'attribute (list "style" "margin-left:auto; margin-right:auto")
|
|
||||||
'inheritable? #f)
|
|
||||||
|
|
||||||
;; set the header column to be the 2nd when we have a logo
|
|
||||||
;; do this so that when logo is not present, the document
|
|
||||||
;; is perfectly centered
|
|
||||||
(if (and logopixmap (> (string-length logopixmap) 0))
|
|
||||||
(set! headcolumn 1))
|
|
||||||
|
|
||||||
(let* ((headline (or (gnc:html-document-headline doc)
|
|
||||||
(gnc:html-document-title doc))))
|
|
||||||
|
|
||||||
(gnc:html-table-set-cell!
|
|
||||||
t 1 headcolumn
|
|
||||||
(if show-preparer?
|
|
||||||
;; title plus preparer info
|
|
||||||
(gnc:make-html-text
|
|
||||||
(gnc:html-markup-h3 headline)
|
|
||||||
(gnc:html-markup-br)
|
|
||||||
(_ "Prepared by: ")
|
|
||||||
(gnc:html-markup-b preparer)
|
|
||||||
(gnc:html-markup-br)
|
|
||||||
(_ "Prepared for: ")
|
|
||||||
(gnc:html-markup-b prepared-for)
|
|
||||||
(gnc:html-markup-br)
|
|
||||||
(_ "Date: ")
|
|
||||||
(qof-print-date
|
|
||||||
(current-time)))
|
|
||||||
|
|
||||||
;; title only
|
|
||||||
(gnc:make-html-text
|
|
||||||
(gnc:html-markup-h3 headline))))
|
|
||||||
)
|
|
||||||
|
|
||||||
;; only setup an image if we specified one
|
|
||||||
(if (and logopixmap (> (string-length logopixmap) 0))
|
|
||||||
(gnc:html-table-set-cell!
|
|
||||||
t 0 0
|
|
||||||
(gnc:make-html-text
|
|
||||||
(gnc:html-markup-img (make-file-url logopixmap)))))
|
|
||||||
|
|
||||||
(if (and headpixmap (> (string-length headpixmap) 0))
|
|
||||||
(let* ((div (gnc:html-markup-img (make-file-url headpixmap)))
|
|
||||||
(cell (gnc:make-html-table-cell (gnc:make-html-text div))))
|
|
||||||
(gnc:html-table-cell-set-style! cell "td" 'attribute `("align" ,align))
|
|
||||||
(gnc:html-table-set-cell! t 0 headcolumn cell))
|
|
||||||
(gnc:html-table-set-cell! t 0 headcolumn (gnc:make-html-text " ")))
|
|
||||||
|
|
||||||
(apply
|
|
||||||
gnc:html-table-set-cell!
|
|
||||||
t 2 headcolumn
|
|
||||||
(gnc:html-document-objects doc))
|
|
||||||
(gnc:html-document-add-object! ssdoc t))
|
|
||||||
ssdoc))
|
|
||||||
|
|
||||||
(gnc:define-html-style-sheet
|
|
||||||
'version 1.01
|
|
||||||
'name (N_ "Fancy")
|
|
||||||
'renderer fancy-renderer
|
|
||||||
'options-generator fancy-options)
|
|
||||||
|
|
||||||
(gnc:make-html-style-sheet "Fancy" (N_ "Technicolor"))
|
|
@ -27,6 +27,8 @@
|
|||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
;
|
;
|
||||||
|
;; Merged with easy/fancy/footer stylesheets
|
||||||
|
;; by Christopher Lam in 2019
|
||||||
;; Modified by Graham Billiau to include a text footer
|
;; Modified by Graham Billiau to include a text footer
|
||||||
;; with small adjustments by Frank H. Ellenberger 2010
|
;; with small adjustments by Frank H. Ellenberger 2010
|
||||||
;
|
;
|
||||||
@ -41,36 +43,40 @@
|
|||||||
(gnc:module-load "gnucash/html" 0)
|
(gnc:module-load "gnucash/html" 0)
|
||||||
(gnc:module-load "gnucash/report" 0)
|
(gnc:module-load "gnucash/report" 0)
|
||||||
|
|
||||||
(define (footer-options)
|
(define (easy-fancy-footer-options)
|
||||||
(let* ((options (gnc:new-options))
|
(let* ((options (gnc:new-options))
|
||||||
(opt-register
|
(opt-register
|
||||||
(lambda (opt)
|
(lambda (opt)
|
||||||
(gnc:register-option options opt))))
|
(gnc:register-option options opt))))
|
||||||
|
|
||||||
(opt-register
|
(opt-register
|
||||||
(gnc:make-string-option
|
(gnc:make-string-option
|
||||||
(N_ "General")
|
(N_ "General")
|
||||||
(N_ "Preparer") "a"
|
(N_ "Preparer") "a"
|
||||||
(N_ "Name of person preparing the report.")
|
(N_ "Name of person preparing the report.")
|
||||||
""))
|
""))
|
||||||
|
|
||||||
(opt-register
|
(opt-register
|
||||||
(gnc:make-string-option
|
(gnc:make-string-option
|
||||||
(N_ "General")
|
(N_ "General")
|
||||||
(N_ "Prepared for") "b"
|
(N_ "Prepared for") "b"
|
||||||
(N_ "Name of organization or company prepared for.")
|
(N_ "Name of organization or company prepared for.")
|
||||||
""))
|
""))
|
||||||
|
|
||||||
(opt-register
|
(opt-register
|
||||||
(gnc:make-simple-boolean-option
|
(gnc:make-simple-boolean-option
|
||||||
(N_ "General")
|
(N_ "General")
|
||||||
(N_ "Show preparer info") "c"
|
(N_ "Show preparer info") "c"
|
||||||
(N_ "Name of organization or company.")
|
(N_ "Name of organization or company.")
|
||||||
#f))
|
#f))
|
||||||
|
|
||||||
(opt-register
|
(opt-register
|
||||||
(gnc:make-simple-boolean-option
|
(gnc:make-simple-boolean-option
|
||||||
(N_ "General")
|
(N_ "General")
|
||||||
(N_ "Enable Links") "d"
|
(N_ "Enable Links") "d"
|
||||||
(N_ "Enable hyperlinks in reports.")
|
(N_ "Enable hyperlinks in reports.")
|
||||||
#t))
|
#t))
|
||||||
;; FIXME: put this in a more sensible tab like Text or Header/Footer
|
|
||||||
(opt-register
|
(opt-register
|
||||||
(gnc:make-text-option
|
(gnc:make-text-option
|
||||||
(N_ "General")
|
(N_ "General")
|
||||||
@ -83,12 +89,14 @@
|
|||||||
(N_ "Images")
|
(N_ "Images")
|
||||||
(N_ "Background Tile") "a" (N_ "Background tile for reports.")
|
(N_ "Background Tile") "a" (N_ "Background tile for reports.")
|
||||||
""))
|
""))
|
||||||
|
|
||||||
(opt-register
|
(opt-register
|
||||||
(gnc:make-pixmap-option
|
(gnc:make-pixmap-option
|
||||||
(N_ "Images")
|
(N_ "Images")
|
||||||
;;; Translators: Banner is an image like Logo.
|
;;; Translators: Banner is an image like Logo.
|
||||||
(N_ "Heading Banner") "b" (N_ "Banner for top of report.")
|
(N_ "Heading Banner") "b" (N_ "Banner for top of report.")
|
||||||
""))
|
""))
|
||||||
|
|
||||||
(opt-register
|
(opt-register
|
||||||
(gnc:make-multichoice-option
|
(gnc:make-multichoice-option
|
||||||
(N_ "Images")
|
(N_ "Images")
|
||||||
@ -102,8 +110,8 @@
|
|||||||
(N_ "Align the banner in the center."))
|
(N_ "Align the banner in the center."))
|
||||||
(vector 'right
|
(vector 'right
|
||||||
(N_ "Right")
|
(N_ "Right")
|
||||||
(N_ "Align the banner to the right."))
|
(N_ "Align the banner to the right.")))))
|
||||||
)))
|
|
||||||
(opt-register
|
(opt-register
|
||||||
(gnc:make-pixmap-option
|
(gnc:make-pixmap-option
|
||||||
(N_ "Images")
|
(N_ "Images")
|
||||||
@ -191,7 +199,7 @@
|
|||||||
|
|
||||||
options))
|
options))
|
||||||
|
|
||||||
(define (footer-renderer options doc)
|
(define (easy-fancy-footer-renderer options doc)
|
||||||
(let* ((ssdoc (gnc:make-html-document))
|
(let* ((ssdoc (gnc:make-html-document))
|
||||||
(opt-val
|
(opt-val
|
||||||
(lambda (section name)
|
(lambda (section name)
|
||||||
@ -222,8 +230,7 @@
|
|||||||
(align (gnc:value->string (opt-val "Images" "Heading Alignment")))
|
(align (gnc:value->string (opt-val "Images" "Heading Alignment")))
|
||||||
(spacing (opt-val "Tables" "Table cell spacing"))
|
(spacing (opt-val "Tables" "Table cell spacing"))
|
||||||
(padding (opt-val "Tables" "Table cell padding"))
|
(padding (opt-val "Tables" "Table cell padding"))
|
||||||
(border (opt-val "Tables" "Table border width"))
|
(border (opt-val "Tables" "Table border width")))
|
||||||
(headcolumn 0))
|
|
||||||
|
|
||||||
(gnc:html-document-set-style!
|
(gnc:html-document-set-style!
|
||||||
ssdoc "body"
|
ssdoc "body"
|
||||||
@ -314,18 +321,22 @@
|
|||||||
ssdoc "normal-row"
|
ssdoc "normal-row"
|
||||||
'attribute (list "bgcolor" normal-row-color)
|
'attribute (list "bgcolor" normal-row-color)
|
||||||
'tag "tr")
|
'tag "tr")
|
||||||
|
|
||||||
(gnc:html-document-set-style!
|
(gnc:html-document-set-style!
|
||||||
ssdoc "alternate-row"
|
ssdoc "alternate-row"
|
||||||
'attribute (list "bgcolor" alternate-row-color)
|
'attribute (list "bgcolor" alternate-row-color)
|
||||||
'tag "tr")
|
'tag "tr")
|
||||||
|
|
||||||
(gnc:html-document-set-style!
|
(gnc:html-document-set-style!
|
||||||
ssdoc "primary-subheading"
|
ssdoc "primary-subheading"
|
||||||
'attribute (list "bgcolor" primary-subheading-color)
|
'attribute (list "bgcolor" primary-subheading-color)
|
||||||
'tag "tr")
|
'tag "tr")
|
||||||
|
|
||||||
(gnc:html-document-set-style!
|
(gnc:html-document-set-style!
|
||||||
ssdoc "secondary-subheading"
|
ssdoc "secondary-subheading"
|
||||||
'attribute (list "bgcolor" secondary-subheading-color)
|
'attribute (list "bgcolor" secondary-subheading-color)
|
||||||
'tag "tr")
|
'tag "tr")
|
||||||
|
|
||||||
(gnc:html-document-set-style!
|
(gnc:html-document-set-style!
|
||||||
ssdoc "grand-total"
|
ssdoc "grand-total"
|
||||||
'attribute (list "bgcolor" grand-total-color)
|
'attribute (list "bgcolor" grand-total-color)
|
||||||
@ -338,7 +349,13 @@
|
|||||||
|
|
||||||
(add-css-information-to-doc options ssdoc doc)
|
(add-css-information-to-doc options ssdoc doc)
|
||||||
|
|
||||||
(let ((t (gnc:make-html-table)))
|
(let ((t (gnc:make-html-table))
|
||||||
|
;; set the header column to be the 2nd when we have a logo
|
||||||
|
;; do this so that when logo is not present, the document is
|
||||||
|
;; perfectly centered
|
||||||
|
(headcolumn (if (and logopixmap (> (string-length logopixmap) 0))
|
||||||
|
1 0)))
|
||||||
|
|
||||||
;; we don't want a bevel for this table, but we don't want
|
;; we don't want a bevel for this table, but we don't want
|
||||||
;; that to propagate
|
;; that to propagate
|
||||||
(gnc:html-table-set-style!
|
(gnc:html-table-set-style!
|
||||||
@ -347,12 +364,6 @@
|
|||||||
'attribute (list "style" "margin-left:auto; margin-right:auto")
|
'attribute (list "style" "margin-left:auto; margin-right:auto")
|
||||||
'inheritable? #f)
|
'inheritable? #f)
|
||||||
|
|
||||||
;; set the header column to be the 2nd when we have a logo
|
|
||||||
;; do this so that when logo is not present, the document
|
|
||||||
;; is perfectly centered
|
|
||||||
(if (and logopixmap (> (string-length logopixmap) 0))
|
|
||||||
(set! headcolumn 1))
|
|
||||||
|
|
||||||
(let* ((headline (or (gnc:html-document-headline doc)
|
(let* ((headline (or (gnc:html-document-headline doc)
|
||||||
(gnc:html-document-title doc))))
|
(gnc:html-document-title doc))))
|
||||||
|
|
||||||
@ -375,8 +386,7 @@
|
|||||||
|
|
||||||
;; title only
|
;; title only
|
||||||
(gnc:make-html-text
|
(gnc:make-html-text
|
||||||
(gnc:html-markup-h3 headline))))
|
(gnc:html-markup-h3 headline)))))
|
||||||
)
|
|
||||||
|
|
||||||
;; only setup an image if we specified one
|
;; only setup an image if we specified one
|
||||||
(if (and logopixmap (> (string-length logopixmap) 0))
|
(if (and logopixmap (> (string-length logopixmap) 0))
|
||||||
@ -396,9 +406,9 @@
|
|||||||
gnc:html-table-set-cell!
|
gnc:html-table-set-cell!
|
||||||
t 2 headcolumn
|
t 2 headcolumn
|
||||||
(gnc:html-document-objects doc))
|
(gnc:html-document-objects doc))
|
||||||
|
|
||||||
(gnc:html-document-add-object! ssdoc t)
|
(gnc:html-document-add-object! ssdoc t)
|
||||||
|
|
||||||
;; I think this is the correct place to put the footer
|
|
||||||
(gnc:html-table-set-cell!
|
(gnc:html-table-set-cell!
|
||||||
t 3 headcolumn
|
t 3 headcolumn
|
||||||
(gnc:make-html-text footer-text)))
|
(gnc:make-html-text footer-text)))
|
||||||
@ -406,8 +416,22 @@
|
|||||||
|
|
||||||
(gnc:define-html-style-sheet
|
(gnc:define-html-style-sheet
|
||||||
'version 1
|
'version 1
|
||||||
'name (N_ "Footer")
|
'name (N_ "Easy")
|
||||||
'renderer footer-renderer
|
'renderer easy-fancy-footer-renderer
|
||||||
'options-generator footer-options)
|
'options-generator easy-fancy-footer-options)
|
||||||
|
|
||||||
|
(gnc:define-html-style-sheet
|
||||||
|
'version 1.01
|
||||||
|
'name (N_ "Fancy")
|
||||||
|
'renderer easy-fancy-footer-renderer
|
||||||
|
'options-generator easy-fancy-footer-options)
|
||||||
|
|
||||||
|
(gnc:define-html-style-sheet
|
||||||
|
'version 1
|
||||||
|
'name (N_ "Footer")
|
||||||
|
'renderer easy-fancy-footer-renderer
|
||||||
|
'options-generator easy-fancy-footer-options)
|
||||||
|
|
||||||
|
(gnc:make-html-style-sheet "Easy" (N_ "Easy"))
|
||||||
|
(gnc:make-html-style-sheet "Fancy" (N_ "Technicolor"))
|
||||||
(gnc:make-html-style-sheet "Footer" (N_ "Footer"))
|
(gnc:make-html-style-sheet "Footer" (N_ "Footer"))
|
||||||
|
@ -204,6 +204,29 @@ GncOwnerType gncOwnerGetType (const GncOwner *owner)
|
|||||||
return owner->type;
|
return owner->type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char * gncOwnerGetTypeString (const GncOwner *owner)
|
||||||
|
{
|
||||||
|
GncOwnerType type = gncOwnerGetType(owner);
|
||||||
|
switch (type)
|
||||||
|
{
|
||||||
|
case GNC_OWNER_NONE:
|
||||||
|
return "None";
|
||||||
|
case GNC_OWNER_UNDEFINED:
|
||||||
|
return "Undefined";
|
||||||
|
case GNC_OWNER_CUSTOMER:
|
||||||
|
return "Customer";
|
||||||
|
case GNC_OWNER_JOB:
|
||||||
|
return "Job";
|
||||||
|
case GNC_OWNER_VENDOR:
|
||||||
|
return "Vendor";
|
||||||
|
case GNC_OWNER_EMPLOYEE:
|
||||||
|
return "Employee";
|
||||||
|
default:
|
||||||
|
PWARN ("Unknown owner type");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
QofIdTypeConst
|
QofIdTypeConst
|
||||||
qofOwnerGetType(const GncOwner *owner)
|
qofOwnerGetType(const GncOwner *owner)
|
||||||
{
|
{
|
||||||
|
@ -65,6 +65,8 @@ to QOF as they can be used by objects like GncInvoice.
|
|||||||
*/
|
*/
|
||||||
/** return the type for the collection. */
|
/** return the type for the collection. */
|
||||||
QofIdTypeConst qofOwnerGetType(const GncOwner *owner);
|
QofIdTypeConst qofOwnerGetType(const GncOwner *owner);
|
||||||
|
/** return the type for the owner as an untranslated string. */
|
||||||
|
const char * gncOwnerGetTypeString (const GncOwner *owner);
|
||||||
/** return the owner itself as an entity. */
|
/** return the owner itself as an entity. */
|
||||||
QofInstance* qofOwnerGetOwner (const GncOwner *owner);
|
QofInstance* qofOwnerGetOwner (const GncOwner *owner);
|
||||||
/** set the owner from the entity. */
|
/** set the owner from the entity. */
|
||||||
|
@ -495,8 +495,6 @@ gnucash/report/reports/support/receipt.eguile.scm
|
|||||||
gnucash/report/reports/support/taxinvoice.eguile.scm
|
gnucash/report/reports/support/taxinvoice.eguile.scm
|
||||||
gnucash/report/report.scm
|
gnucash/report/report.scm
|
||||||
gnucash/report/report-utilities.scm
|
gnucash/report/report-utilities.scm
|
||||||
gnucash/report/stylesheets/easy.scm
|
|
||||||
gnucash/report/stylesheets/fancy.scm
|
|
||||||
gnucash/report/stylesheets/footer.scm
|
gnucash/report/stylesheets/footer.scm
|
||||||
gnucash/report/stylesheets/head-or-tail.scm
|
gnucash/report/stylesheets/head-or-tail.scm
|
||||||
gnucash/report/stylesheets/plain.scm
|
gnucash/report/stylesheets/plain.scm
|
||||||
|
Loading…
Reference in New Issue
Block a user