* src/scm/options.scm: add a text option type

* src/gnome/dialog-options.c: add support for text options

	* src/gnome/window-main.c (gnc_ui_about_cb): set parent

	* src/scm/report/register.scm: more work

	* src/scm/html-document.scm: fix bug

	* src/scm/report/average-balance.scm: tweak default accounts

	* src/scm/html-utilities.scm (gnc:html-build-acct-table):
	put in a horizontal line before grand total.

	* src/gnome/dialog-tax-info.c: use form & description, not
	code & form, in clist. more work on display.

	* src/scm/report/txf-export.scm: fix bug

	* src/register/gnome/gnucash-sheet.c
	(gnucash_sheet_modify_current_cell): reset item edit position

	* src/register/gnome/gnucash-item-edit.c (item_edit_reset_offset):
	new func

	* src/gnome/gnc-currency-edit.c (add_item): don't use namespace
	in string


git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@3865 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Dave Peticolas
2001-03-31 11:29:30 +00:00
parent fc894d7827
commit 937fe0f9fa
25 changed files with 298 additions and 107 deletions

View File

@@ -1,5 +1,36 @@
2001-03-31 Dave Peticolas <dave@krondo.com>
* src/scm/options.scm: add a text option type
* src/gnome/dialog-options.c: add support for text options
* src/gnome/window-main.c (gnc_ui_about_cb): set parent
* src/scm/report/register.scm: more work
* src/scm/html-document.scm: fix bug
2001-03-30 Dave Peticolas <dave@krondo.com>
* src/scm/report/average-balance.scm: tweak default accounts
* src/scm/html-utilities.scm (gnc:html-build-acct-table):
put in a horizontal line before grand total.
* src/gnome/dialog-tax-info.c: use form & description, not
code & form, in clist. more work on display.
* src/scm/report/txf-export.scm: fix bug
* src/register/gnome/gnucash-sheet.c
(gnucash_sheet_modify_current_cell): reset item edit position
* src/register/gnome/gnucash-item-edit.c (item_edit_reset_offset):
new func
* src/gnome/gnc-currency-edit.c (add_item): don't use namespace
in string
* src/quotes/finance-quote-helper.in: check for non-standard
Perl modules

View File

@@ -40,6 +40,7 @@ rm -rf $RPM_BUILD_ROOT
%defattr(444,root,root,755)
%attr(555,-,-) /usr/bin/gnucash
%attr(555,-,-) /usr/bin/gnc-prices
%attr(555,-,-) /usr/bin/update-finance-quote
%attr(555,-,-) /usr/share/gnucash/finance-quote-helper
/usr/info/*
/usr/lib/libgncengine.*

View File

@@ -219,6 +219,20 @@ gnc_option_set_ui_value(GNCOption *option, gboolean use_default)
else
bad_value = TRUE;
}
else if (safe_strcmp(type, "text") == 0)
{
if (gh_string_p(value))
{
char *string = gh_scm2newstr(value, NULL);
gint pos = 0;
gtk_editable_delete_text(GTK_EDITABLE(option->widget), 0, -1);
gtk_editable_insert_text(GTK_EDITABLE(option->widget),
string, strlen (string), &pos);
free(string);
}
else
bad_value = TRUE;
}
else if (safe_strcmp(type, "currency") == 0)
{
gnc_commodity *commodity;
@@ -509,6 +523,14 @@ gnc_option_get_ui_value(GNCOption *option)
result = gh_str02scm(string);
g_free(string);
}
else if (safe_strcmp(type, "text") == 0)
{
char * string;
string = gtk_editable_get_chars(GTK_EDITABLE(option->widget), 0, -1);
result = gh_str02scm(string);
g_free(string);
}
else if (safe_strcmp(type, "currency") == 0)
{
gnc_commodity *commodity;
@@ -1351,6 +1373,41 @@ gnc_option_set_ui_widget(GNCOption *option,
FALSE, FALSE, 0);
gtk_widget_show_all(enclosing);
}
else if (safe_strcmp(type, "text") == 0)
{
GtkWidget *frame;
GtkWidget *scroll;
gchar *colon_name;
frame = gtk_frame_new(name);
scroll = gtk_scrolled_window_new(NULL, NULL);
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scroll),
GTK_POLICY_NEVER,
GTK_POLICY_AUTOMATIC);
gtk_container_border_width(GTK_CONTAINER(scroll), 2);
gtk_container_add(GTK_CONTAINER(frame), scroll);
enclosing = gtk_hbox_new(FALSE, 10);
value = gtk_text_new(NULL, NULL);
gtk_text_set_word_wrap(GTK_TEXT(value), TRUE);
gtk_text_set_editable(GTK_TEXT(value), TRUE);
gtk_container_add (GTK_CONTAINER (scroll), value);
option->widget = value;
gnc_option_set_ui_value(option, FALSE);
gtk_signal_connect(GTK_OBJECT(value), "changed",
GTK_SIGNAL_FUNC(gnc_option_changed_cb), option);
gtk_box_pack_start(GTK_BOX(enclosing), frame, TRUE, TRUE, 0);
gtk_box_pack_end(GTK_BOX(enclosing),
gnc_option_create_default_button(option, tooltips),
FALSE, FALSE, 0);
gtk_widget_show_all(enclosing);
}
else if (safe_strcmp(type, "currency") == 0)
{
GtkWidget *label;

View File

@@ -242,8 +242,8 @@ load_category_list (TaxInfoDialog *ti_dialog)
{
TXFInfo *txf_info = codes->data;
text[0] = txf_info->code;
text[1] = txf_info->form;
text[0] = txf_info->form;
text[1] = txf_info->description;
gtk_clist_append (clist, text);
}
@@ -308,6 +308,10 @@ account_to_gui (TaxInfoDialog *ti_dialog, Account *account)
index = 0;
gtk_clist_select_row (GTK_CLIST (ti_dialog->txf_category_clist), index, 0);
if (gtk_clist_row_is_visible (GTK_CLIST (ti_dialog->txf_category_clist),
index) != GTK_VISIBILITY_FULL)
gtk_clist_moveto (GTK_CLIST (ti_dialog->txf_category_clist),
index, 0, 0.5, 0.0);
str = xaccAccountGetTaxUSPayerNameSource (account);
if (safe_strcmp (str, "parent") == 0)

View File

@@ -5715,7 +5715,7 @@ create_Tax_Information_Dialog (void)
GtkWidget *tax_related_button;
GtkWidget *hseparator1;
GtkWidget *txf_categories_frame;
GtkWidget *hbox85;
GtkWidget *vbox113;
GtkWidget *scrolledwindow28;
GtkWidget *txf_category_clist;
GtkWidget *label847734;
@@ -5864,20 +5864,20 @@ create_Tax_Information_Dialog (void)
gtk_box_pack_start (GTK_BOX (vbox92), txf_categories_frame, TRUE, TRUE, 0);
gtk_widget_set_sensitive (txf_categories_frame, FALSE);
hbox85 = gtk_hbox_new (FALSE, 0);
gtk_widget_ref (hbox85);
gtk_object_set_data_full (GTK_OBJECT (Tax_Information_Dialog), "hbox85", hbox85,
vbox113 = gtk_vbox_new (FALSE, 2);
gtk_widget_ref (vbox113);
gtk_object_set_data_full (GTK_OBJECT (Tax_Information_Dialog), "vbox113", vbox113,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (hbox85);
gtk_container_add (GTK_CONTAINER (txf_categories_frame), hbox85);
gtk_container_set_border_width (GTK_CONTAINER (hbox85), 3);
gtk_widget_show (vbox113);
gtk_container_add (GTK_CONTAINER (txf_categories_frame), vbox113);
gtk_container_set_border_width (GTK_CONTAINER (vbox113), 3);
scrolledwindow28 = gtk_scrolled_window_new (NULL, NULL);
gtk_widget_ref (scrolledwindow28);
gtk_object_set_data_full (GTK_OBJECT (Tax_Information_Dialog), "scrolledwindow28", scrolledwindow28,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (scrolledwindow28);
gtk_box_pack_start (GTK_BOX (hbox85), scrolledwindow28, TRUE, TRUE, 0);
gtk_box_pack_start (GTK_BOX (vbox113), scrolledwindow28, TRUE, TRUE, 0);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow28), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS);
txf_category_clist = gtk_clist_new (2);
@@ -5890,14 +5890,14 @@ create_Tax_Information_Dialog (void)
gtk_clist_set_column_width (GTK_CLIST (txf_category_clist), 1, 80);
gtk_clist_column_titles_show (GTK_CLIST (txf_category_clist));
label847734 = gtk_label_new (_("Code"));
label847734 = gtk_label_new (_("Form"));
gtk_widget_ref (label847734);
gtk_object_set_data_full (GTK_OBJECT (Tax_Information_Dialog), "label847734", label847734,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (label847734);
gtk_clist_set_column_widget (GTK_CLIST (txf_category_clist), 0, label847734);
label847735 = gtk_label_new (_("Form"));
label847735 = gtk_label_new (_("Description"));
gtk_widget_ref (label847735);
gtk_object_set_data_full (GTK_OBJECT (Tax_Information_Dialog), "label847735", label847735,
(GtkDestroyNotify) gtk_widget_unref);
@@ -5909,7 +5909,7 @@ create_Tax_Information_Dialog (void)
gtk_object_set_data_full (GTK_OBJECT (Tax_Information_Dialog), "scrolledwindow19", scrolledwindow19,
(GtkDestroyNotify) gtk_widget_unref);
gtk_widget_show (scrolledwindow19);
gtk_box_pack_start (GTK_BOX (hbox85), scrolledwindow19, TRUE, TRUE, 0);
gtk_box_pack_start (GTK_BOX (vbox113), scrolledwindow19, TRUE, TRUE, 0);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow19), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS);
txf_help_text = gtk_text_new (NULL, NULL);

View File

@@ -112,11 +112,13 @@ add_item(GNCCurrencyEdit *gce, gnc_commodity *commodity)
{
GtkWidget *item;
GtkWidget *label;
const char *string;
char *string;
item = gtk_list_item_new();
string = gnc_commodity_get_printname (commodity);
string = g_strdup_printf ("%s - %s",
gnc_commodity_get_mnemonic (commodity),
gnc_commodity_get_fullname (commodity));
label = gtk_label_new(string);
gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5);
@@ -129,6 +131,8 @@ add_item(GNCCurrencyEdit *gce, gnc_commodity *commodity)
gnc_commodity_get_mnemonic (commodity));
gtk_container_add(GTK_CONTAINER(GTK_COMBO(gce)->list), item);
g_free (string);
}
static int

View File

@@ -8708,11 +8708,11 @@ words.
</child>
<widget>
<class>GtkHBox</class>
<name>hbox85</name>
<class>GtkVBox</class>
<name>vbox113</name>
<border_width>3</border_width>
<homogeneous>False</homogeneous>
<spacing>0</spacing>
<spacing>2</spacing>
<widget>
<class>GtkScrolledWindow</class>
@@ -8741,7 +8741,7 @@ words.
<class>GtkLabel</class>
<child_name>CList:title</child_name>
<name>label847734</name>
<label>Code</label>
<label>Form</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>0.5</xalign>
@@ -8754,7 +8754,7 @@ words.
<class>GtkLabel</class>
<child_name>CList:title</child_name>
<name>label847735</name>
<label>Form</label>
<label>Description</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>0.5</xalign>

View File

@@ -548,16 +548,18 @@ gnc_ui_about_cb (GtkWidget *widget, gpointer data)
GtkWidget *about;
const gchar *message = _("The GnuCash personal finance manager.\n"
"The GNU way to manage your money!");
const gchar *copyright = "(C) 1998-2000 Linas Vepstas";
const gchar *copyright = "(C) 1998-2001 Linas Vepstas";
const gchar *authors[] = {
"Linas Vepstas <linas@linas.org>",
NULL
};
about = gnome_about_new("GnuCash", VERSION, copyright,
authors, message, NULL);
about = gnome_about_new ("GnuCash", VERSION, copyright,
authors, message, NULL);
gnome_dialog_set_parent (GNOME_DIALOG(about),
GTK_WINDOW(gnc_get_ui_data ()));
gnome_dialog_run_and_close(GNOME_DIALOG(about));
gnome_dialog_run_and_close (GNOME_DIALOG(about));
}
static void

View File

@@ -600,6 +600,15 @@ item_edit_focus_out (ItemEdit *item_edit)
#endif
}
void
item_edit_reset_offset (ItemEdit *item_edit)
{
g_return_if_fail (item_edit != NULL);
g_return_if_fail (IS_ITEM_EDIT(item_edit));
item_edit->reset_pos = TRUE;
}
/*
* Instance initialization
*/

View File

@@ -168,6 +168,8 @@ void item_edit_selection_received (ItemEdit *item_edit,
void item_edit_focus_in (ItemEdit *item_edit);
void item_edit_focus_out (ItemEdit *item_edit);
void item_edit_reset_offset (ItemEdit *item_edit);
typedef struct
{

View File

@@ -661,6 +661,8 @@ gnucash_sheet_modify_current_cell(GnucashSheet *sheet, const gchar *new_text)
g_free (new_text_wc);
if (retval) {
item_edit_reset_offset (ITEM_EDIT(sheet->item_editor));
gtk_signal_handler_block (GTK_OBJECT (sheet->entry),
sheet->insert_signal);

View File

@@ -144,7 +144,7 @@
(push "</html>\n")
(gnc:html-document-pop-style doc)
(gnc:html-style-table-uncompile (gnc:html-document-style doc))
(apply string-append
(gnc:html-document-tree-collapse retval))))))
@@ -249,7 +249,7 @@
(set! tag #f)))
(let* ((retval '())
(push (lambda (l) (set! retval (cons l retval))))
(add-internal-tag (lambda (t) (push "<") (push tag) (push ">")))
(add-internal-tag (lambda (tag) (push "<") (push tag) (push ">")))
(add-attribute
(lambda (key value prior) (push " ") (push key) (push "=")
(push value) #t))

View File

@@ -411,10 +411,16 @@
;; Show the total sum.
(if show-total?
(add-subtotal-row!
1 total-name
(get-total-fn (filter show-acct? topl-accounts) my-get-balance)
#t))
(begin
(gnc:html-table-append-row!
table
(list
(gnc:make-html-table-cell/size
1 (* 2 tree-depth) (gnc:make-html-text (gnc:html-markup-hr)))))
(add-subtotal-row!
1 total-name
(get-total-fn (filter show-acct? topl-accounts) my-get-balance)
#t)))
;; set default alignment to right, and override for the name
;; columns

View File

@@ -190,6 +190,25 @@
(else (list #f "string-option: not a string"))))
#f #f #f #f)))
(define (gnc:make-text-option
section
name
sort-tag
documentation-string
default-value)
(let* ((value default-value)
(value->string (lambda () (gnc:value->string value))))
(gnc:make-option
section name sort-tag 'text documentation-string
(lambda () value)
(lambda (x) (set! value x))
(lambda () default-value)
(gnc:restore-form-generator value->string)
(lambda (x)
(cond ((string? x)(list #t x))
(else (list #f "text-option: not a string"))))
#f #f #f #f)))
;;; font options store fonts as strings a la the X Logical
;;; Font Description. You should always provide a default
;;; value, as currently there seems to be no way to go from

View File

@@ -45,10 +45,10 @@
;; otherwise get some accounts -- here as an
;; example we get the asset and liability stuff
(gnc:filter-accountlist-type
'(asset liability equity)
'(bank cash credit asset liability equity)
;; or: '(bank cash checking savings stock
;; mutual-fund money-market)
(gnc:group-get-account-list (gnc:get-current-group)))))))
(gnc:group-get-subaccounts (gnc:get-current-group)))))))
#f #t))
(gnc:options-add-interval-choice!
@@ -266,7 +266,7 @@
report-currency
exchange-fn))))
(gnc:html-document-set-title! document (N_ "Average Balance"))
(gnc:html-document-set-title! document (_ "Average Balance"))
(if (not (null? accounts))
(let ((query (gnc:malloc-query))

View File

@@ -72,7 +72,7 @@
(gnc:make-account-list-option
pagename-accounts optname-accounts
"a"
(_ "Select accounts to calculate income on")
(N_ "Select accounts to calculate income on")
(lambda ()
(gnc:filter-accountlist-type
(if is-income? '(income) '(expense))
@@ -86,19 +86,19 @@
(gnc:options-add-account-levels!
options pagename-accounts optname-levels "c"
(_ "Show accounts to this depth and not further")
(N_ "Show accounts to this depth and not further")
2)
;; Display tab
(add-option
(gnc:make-simple-boolean-option
pagename-display optname-fullname
"a" (_ "Show the full account name in legend?") #f))
"a" (N_ "Show the full account name in legend?") #f))
(add-option
(gnc:make-simple-boolean-option
pagename-display optname-stacked
"b" (_ "Show barchart as stacked barchart?") #t))
"b" (N_ "Show barchart as stacked barchart?") #t))
(add-option
(gnc:make-number-range-option

View File

@@ -41,7 +41,7 @@
(gnc:make-account-list-option
pagename-general optname-accounts
"c"
(_ "Select accounts to calculate income on")
(N_ "Select accounts to calculate income on")
(lambda ()
(filter
gnc:account-is-inc-exp?
@@ -57,17 +57,17 @@
(add-option
(gnc:make-simple-boolean-option
pagename-display optname-inc-exp
"a" (_ "Show Income and Expenses?") #t))
"a" (N_ "Show Income and Expenses?") #t))
(add-option
(gnc:make-simple-boolean-option
pagename-display optname-show-profit
"b" (_ "Show the net profit?") #f))
"b" (N_ "Show the net profit?") #f))
(add-option
(gnc:make-simple-boolean-option
pagename-display optname-stacked
"ba" (_ "Show barchart as stacked?") #f))
"ba" (N_ "Show barchart as stacked?") #f))
(gnc:options-add-plot-size!
options pagename-display

View File

@@ -40,7 +40,7 @@
(gnc:make-account-list-option
pagename-general optname-accounts
"b"
(_ "Select accounts to calculate income on")
(N_ "Select accounts to calculate income on")
(lambda ()
(gnc:filter-accountlist-type
(if is-income? '(income) '(expense))
@@ -54,14 +54,14 @@
(gnc:options-add-account-levels!
options pagename-general optname-levels "c"
(_ "Show accounts to this depth and not further")
(N_ "Show accounts to this depth and not further")
2)
(add-option
(gnc:make-currency-option
pagename-general optname-report-currency
"d"
(_ "Select the display value for the currency")
(N_ "Select the display value for the currency")
(gnc:option-value
(gnc:lookup-global-option "International"
"Default Currency"))))
@@ -69,12 +69,12 @@
(add-option
(gnc:make-simple-boolean-option
pagename-display optname-fullname
"a" (_ "Show the full account name in legend?") #f))
"a" (N_ "Show the full account name in legend?") #f))
(add-option
(gnc:make-simple-boolean-option
pagename-display optname-show-total
"b" (_ "Show the total balance in legend?") #t))
"b" (N_ "Show the total balance in legend?") #t))
(add-option
(gnc:make-number-range-option
@@ -82,8 +82,9 @@
"c" (N_ "Maximum number of slices in pie") 7
2 24 0 1))
(gnc:options-add-plot-size! options pagename-display
optname-plot-width optname-plot-height "d" 500 250)
(gnc:options-add-plot-size!
options pagename-display
optname-plot-width optname-plot-height "d" 500 250)
(gnc:options-set-default-section options pagename-general)
@@ -219,7 +220,7 @@
(options (gnc:make-report-options name))
(account-op
(gnc:lookup-option options pagename-general
optname-accounts)))
optname-accounts)))
;; now copy all the options
(define (set-option! pagename optname value)
(gnc:option-set-value

View File

@@ -19,17 +19,17 @@
(add-option
(gnc:make-date-option
"General" "Date"
(N_ "General") (N_ "Date")
"a"
"Date to report on"
(N_ "Date to report on")
(lambda () (cons 'absolute (cons (current-time) 0)))
#f 'absolute #f ))
(add-option
(gnc:make-account-list-option
"General" "Accounts"
(N_ "General") (N_ "Accounts")
"b"
"Stock Accounts to report on"
(N_ "Stock Accounts to report on")
(lambda () (filter gnc:account-is-stock?
(gnc:group-get-subaccounts
(gnc:get-current-group))))
@@ -38,9 +38,9 @@
(add-option
(gnc:make-currency-option
"General" "Report Currency"
(N_ "General" "Report Currency")
"c"
"Select the displayed currency"
(N_ "Select the displayed currency")
(gnc:option-value
(gnc:lookup-global-option "International"
"Default Currency"))))

View File

@@ -35,7 +35,7 @@
(vector-ref columns-used 6))
(define (debit-col columns-used)
(vector-ref columns-used 7))
(define (debit-col columns-used)
(define (credit-col columns-used)
(vector-ref columns-used 8))
(define (balance-col columns-used)
(vector-ref columns-used 9))
@@ -103,7 +103,7 @@
(addto! heading-list (_ "Amount")))
(if (debit-col column-vector)
(addto! heading-list debit-string))
(if (debit-col column-vector)
(if (credit-col column-vector)
(addto! heading-list credit-string))
(if (balance-col column-vector)
(addto! heading-list (_ "Balance")))
@@ -164,10 +164,9 @@
(if (amount-single-col column-vector)
(addto! row-contents
(if split-info?
(gnc:html-split-anchor
split
(gnc:make-html-table-header-cell/markup "number-cell"
split-value))
(gnc:make-html-table-header-cell/markup
"number-cell"
(gnc:html-split-anchor split split-value))
" ")))
(if (debit-col column-vector)
(if (gnc:numeric-positive-p (gnc:gnc-monetary-amount split-value))
@@ -226,7 +225,7 @@
(define (lookup-subtotal-pred sort-option)
(vector-ref (cdr (assq sort-option comp-funcs-assoc-list)) 1))
(define (reg-options-generator)
(define (options-generator)
(define gnc:*report-options* (gnc:new-options))
@@ -244,9 +243,24 @@
(gnc:register-reg-option
(gnc:make-internal-option "__reg" "credit-string" (_ "Credit")))
(gnc:register-reg-option
(gnc:make-simple-boolean-option
(N_ "Invoice") (N_ "Make an invoice")
"a" (N_ "Display this report as an invoice.") #f))
(gnc:register-reg-option
(gnc:make-string-option
(N_ "Report Options") (N_ "Title")
(N_ "Invoice") (N_ "Client Name")
"b" (N_ "The name of the client to put on the invoice.") ""))
(gnc:register-reg-option
(gnc:make-text-option
(N_ "Invoice") (N_ "Client Address")
"c" (N_ "The address of the client to put on the invoice") ""))
(gnc:register-reg-option
(gnc:make-string-option
(N_ "General") (N_ "Title")
"a" (N_ "The title of the report")
(N_ "Register Report")))
@@ -286,7 +300,6 @@
"i" (N_ "Display the amount?")
'double
(list
(vector 'none (N_ "None") (N_ "No amount display"))
(vector 'single (N_ "Single") (N_ "Single Column Display"))
(vector 'double (N_ "Double") (N_ "Two Column Display")))))
@@ -326,7 +339,7 @@
255
#f))
(gnc:options-set-default-section gnc:*report-options* "Report Options")
(gnc:options-set-default-section gnc:*report-options* "General")
gnc:*report-options*)
@@ -356,34 +369,48 @@
(define (make-split-table splits options debit-string credit-string)
(define (opt-val section name)
(gnc:option-value (gnc:lookup-option options section name)))
(define (reg-report-journal?)
(opt-val "__reg" "journal"))
(define (reg-report-double?)
(opt-val "__reg" "double"))
(define (reg-report-invoice?)
(opt-val "Invoice" "Make an invoice"))
(define (add-subtotal-row table width subtotal-collector subtotal-style)
(define (add-subtotal-row table used-columns
subtotal-collector subtotal-style)
(let ((currency-totals (subtotal-collector
'format gnc:make-gnc-monetary #f))
(blanks (make-list (- width 1) #f)))
'format gnc:make-gnc-monetary #f)))
(define (make-blanks monetary)
(make-list
(- (if (amount-single-col used-columns)
(amount-single-col used-columns)
(if (gnc:numeric-negative-p
(gnc:gnc-monetary-amount monetary))
(credit-col used-columns)
(debit-col used-columns)))
1)
#f))
(gnc:html-table-append-row!
table
(list
(gnc:make-html-table-cell/size
1 width (gnc:make-html-text (gnc:html-markup-hr)))))
(if (not (reg-report-invoice?))
(gnc:html-table-append-row!
table
(list
(gnc:make-html-table-cell/size
1 (num-columns-required used-columns)
(gnc:make-html-text (gnc:html-markup-hr))))))
(for-each (lambda (currency)
(gnc:html-table-append-row!
table
(append blanks
(append (cons (gnc:make-html-table-header-cell/markup
"total-label-cell" (_ "Total"))
(make-blanks currency))
(list (gnc:make-html-table-header-cell/markup
"number-cell" currency))))
"total-number-cell" currency))))
(apply set-last-row-style!
(cons table (cons "tr" subtotal-style))))
currency-totals)))
(define (reg-report-journal?)
(opt-val "__reg" "journal"))
(define (reg-report-double?)
(opt-val "__reg" "double"))
(define (add-other-split-rows split table used-columns row-style)
(define (other-rows-driver split parent table used-columns i)
(let ((current (gnc:transaction-get-split parent i)))
@@ -408,7 +435,8 @@
grand-total-style
total-collector)
(if (null? splits)
(add-subtotal-row table width total-collector grand-total-style)
(add-subtotal-row table used-columns
total-collector grand-total-style)
(let* ((current (car splits))
(current-row-style (if multi-rows? main-row-style
@@ -486,7 +514,11 @@
(journal? (opt-val "__reg" "journal"))
(debit-string (opt-val "__reg" "debit-string"))
(credit-string (opt-val "__reg" "credit-string"))
(title (opt-val "Report Options" "Title")))
(invoice? (opt-val "Invoice" "Make an invoice"))
(title (opt-val "General" "Title")))
(if invoice?
(set! title (_ "Invoice")))
(gnc:query-set-group query (gnc:get-current-group))
@@ -500,6 +532,13 @@
(gnc:report-options report-obj)
debit-string credit-string))
(if invoice?
(gnc:html-document-set-style!
document "table"
'attribute (list "border" 1)
'attribute (list "cellspacing" 0)
'attribute (list "cellpadding" 0)))
(gnc:html-document-set-title! document title)
(gnc:html-document-add-object! document table)
@@ -508,20 +547,29 @@
(gnc:define-report
'version 1
'name (N_ "Register")
'options-generator reg-options-generator
'options-generator options-generator
'renderer reg-renderer
'in-menu? #f)
(gnc:define-report
'version 1
'name (N_ "Invoice")
'options-generator options-generator
'renderer reg-renderer
'in-menu? #f))
(define (gnc:apply-register-report func query journal? double?
(define (gnc:apply-register-report func invoice? query journal? double?
title debit-string credit-string)
(let* ((options (gnc:make-report-options "Register"))
(invoice-op (gnc:lookup-option options "Invoice" "Make an invoice"))
(query-op (gnc:lookup-option options "__reg" "query"))
(journal-op (gnc:lookup-option options "__reg" "journal"))
(double-op (gnc:lookup-option options "__reg" "double"))
(title-op (gnc:lookup-option options "Report Options" "Title"))
(title-op (gnc:lookup-option options "General" "Title"))
(debit-op (gnc:lookup-option options "__reg" "debit-string"))
(credit-op (gnc:lookup-option options "__reg" "credit-string")))
(gnc:option-set-value invoice-op invoice?)
(gnc:option-set-value query-op query)
(gnc:option-set-value journal-op journal?)
(gnc:option-set-value double-op double?)
@@ -532,7 +580,13 @@
(func (gnc:make-report "Register" options))))
(define (gnc:show-register-report . rest)
(apply gnc:apply-register-report (cons gnc:report-window rest)))
(apply gnc:apply-register-report
(cons gnc:report-window (cons #f rest))))
(define (gnc:print-register-report . rest)
(apply gnc:apply-register-report (cons gnc:print-report rest)))
(apply gnc:apply-register-report
(cons gnc:print-report (cons #f rest))))
(define (gnc:show-invoice-report . rest)
(apply gnc:apply-register-report
(cons gnc:report-window (cons #t rest))))

View File

@@ -215,7 +215,7 @@
ssdoc))
(gnc:define-html-style-sheet
'version 1.0
'version 1
'name "Fancy"
'renderer fancy-renderer
'options-generator fancy-options)

View File

@@ -133,11 +133,13 @@
(gnc:html-markup-p
(gnc:html-markup-h3 title))))))
(gnc:html-document-append-objects! ssdoc (gnc:html-document-objects doc))
(gnc:html-document-append-objects! ssdoc
(gnc:html-document-objects doc))
ssdoc))
(gnc:define-html-style-sheet
'version 1.0
'version 1
'name "Plain"
'renderer plain-renderer
'options-generator plain-options))

View File

@@ -294,12 +294,12 @@
(gnc:options-add-date-interval!
gnc:*transaction-report-options*
(N_ "Report Options") (N_ "From") (N_ "To") "a")
(N_ "General") (N_ "From") (N_ "To") "a")
;; account to do report on
(gnc:register-trep-option
(gnc:make-account-list-option
(N_ "Report Options") (N_ "Account")
(N_ "General") (N_ "Account")
"c" (N_ "Do transaction report on these accounts")
(lambda ()
(let ((current-accounts (gnc:get-current-accounts))
@@ -314,7 +314,7 @@
(gnc:register-trep-option
(gnc:make-multichoice-option
(N_ "Report Options") (N_ "Style")
(N_ "General") (N_ "Style")
"d" (N_ "Report style")
'single
(list (vector 'multi-line
@@ -523,7 +523,7 @@
#f))
(gnc:options-set-default-section gnc:*transaction-report-options*
"Report Options")
"General")
gnc:*transaction-report-options*)
@@ -572,7 +572,7 @@
table
(append blanks
(list (gnc:make-html-table-header-cell/markup
"number-cell" currency))))
"total-number-cell" currency))))
(apply set-last-row-style!
(cons table (cons "tr" subtotal-style))))
currency-totals)))
@@ -615,7 +615,7 @@
(define (transaction-report-multi-rows-p options)
(eq? (gnc:option-value
(gnc:lookup-option options (N_ "Report Options") (N_ "Style")))
(gnc:lookup-option options (N_ "General") (N_ "Style")))
'multi-line))
(define (add-other-split-rows split table used-columns row-style)
@@ -781,11 +781,11 @@
(gnc:lookup-option (gnc:report-options report-obj) section name)))
(let ((document (gnc:make-html-document))
(c_accounts (opt-val "Report Options" "Account"))
(c_accounts (opt-val "General" "Account"))
(begindate (gnc:date-option-absolute-time
(opt-val "Report Options" "From")))
(opt-val "General" "From")))
(enddate (gnc:date-option-absolute-time
(opt-val "Report Options" "To")))
(opt-val "General" "To")))
(primary-key (opt-val "Sorting" "Primary Key"))
(primary-order (opt-val "Sorting" "Primary Sort Order"))
(secondary-key (opt-val "Sorting" "Secondary Key"))

View File

@@ -47,7 +47,6 @@
(cons 'N258 #(none "F1040" "Sick pay or disability pay" 1 #f))
(cons 'N483 #(none "F1040" "Social Security inc., spouse" 1 #f))
(cons 'N266 #(none "F1040" "Social Security income, self" 1 #f))
(cons 'N260 #(none "F1040" "State and local tax refunds" 1 #t))
(cons 'N269 #(none "F1040" "Taxable fringe benefits" 1 #f))
(cons 'N672 #(none "F1099-G" "Qualified state tuition earnings" 1 #t))
(cons 'N260 #(none "F1099-G" "State and local tax refunds" 1 #t))

View File

@@ -124,8 +124,7 @@
(gnc:html-markup-anchor
(sprintf #f "gnc-report:id=%a" (car report-info))
"Single Report"))))
;; add the report-table to the toplevel-cell
(gnc:html-table-cell-append-objects!
toplevel-cell report-table)
@@ -158,9 +157,8 @@
;; define the view now.
(gnc:define-report
'version 1.0
'name "Multicolumn View"
'version 1
'name (N_ "Multicolumn View")
'renderer render-view
'options-generator make-options
'options-editor edit-options))