From 818eaefc66e6d5c269b78b03d9b9d1ec1d0a088a Mon Sep 17 00:00:00 2001 From: Dave Peticolas Date: Thu, 12 Apr 2001 05:07:37 +0000 Subject: [PATCH] Christian Stimming's report patch. * src/scm/report/average-balance.scm, category-barchart.scm, income-expense-graph.scm, net-worth-timeseries.scm, portfolio.scm: Added menu-path for reports. * src/scm/report/account-piecharts.scm: Report title is now fetched from Reportname option. Slices and legend now have different URLs. git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@3946 57a11ea4-9604-0410-9ed3-97b8803252fd --- ChangeLog | 10 +++ src/scm/report/account-piecharts.scm | 102 ++++++++++++++---------- src/scm/report/average-balance.scm | 1 + src/scm/report/category-barchart.scm | 4 +- src/scm/report/income-expense-graph.scm | 1 + src/scm/report/net-worth-timeseries.scm | 2 + src/scm/report/portfolio.scm | 1 + 7 files changed, 78 insertions(+), 43 deletions(-) diff --git a/ChangeLog b/ChangeLog index 12926d92ac..f62799a64c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2001-04-11 Christian Stimming + + * src/scm/report/average-balance.scm, category-barchart.scm, + income-expense-graph.scm, net-worth-timeseries.scm, portfolio.scm: + Added menu-path for reports. + + * src/scm/report/account-piecharts.scm: Report title is now + fetched from Reportname option. Slices and legend now have + different URLs. + 2001-04-11 Dave Peticolas * src/gnome/dialog-commodities.c: more work diff --git a/src/scm/report/account-piecharts.scm b/src/scm/report/account-piecharts.scm index 1db910c6e6..ce7216d65c 100644 --- a/src/scm/report/account-piecharts.scm +++ b/src/scm/report/account-piecharts.scm @@ -44,6 +44,9 @@ (optname-to-date (N_ "To")) (optname-report-currency (N_ "Report's currency")) + ;; defined in report.scm + (optname-reportname "Report name") + (pagename-accounts (N_ "Accounts")) (optname-accounts (N_ "Accounts")) (optname-levels (N_ "Show Accounts until level")) @@ -147,6 +150,7 @@ (account-levels (op-value pagename-accounts optname-levels)) (report-currency (op-value pagename-general optname-report-currency)) + (report-title (op-value pagename-general optname-reportname)) (show-fullname? (op-value pagename-display optname-fullname)) (show-total? (op-value pagename-display optname-show-total)) @@ -269,35 +273,45 @@ (gnc:report-anchor-text (gnc:make-report reportname options)))))) - ;; set the URLs - (let ((urls - (map + ;; set the URLs; the slices are links to other reports + (gnc:html-piechart-set-button-1-slice-urls! + chart + (map + (lambda (pair) + (if (string? (cadr pair)) + other-anchor + (let* ((acct (cadr pair)) + (subaccts + (gnc:account-get-immediate-subaccounts acct))) + (if (null? subaccts) + ;; if leaf-account, make this an anchor + ;; to the register. + (gnc:account-anchor-text (cadr pair)) + ;; if non-leaf account, make this a link + ;; to another report which is run on the + ;; immediate subaccounts of this account + ;; (and including this account). + (gnc:make-report-anchor + reportname + (gnc:report-options report-obj) + (list + (list pagename-accounts optname-accounts + (cons acct subaccts)) + (list pagename-accounts optname-levels + (+ 1 tree-depth)) + (list pagename-general optname-reportname + ((if show-fullname? + gnc:account-get-full-name + gnc:account-get-name) acct)))))))) + combined)) + + (gnc:html-piechart-set-button-1-legend-urls! + chart (map (lambda (pair) (if (string? (cadr pair)) other-anchor - (let* ((acct (cadr pair)) - (subaccts - (gnc:account-get-immediate-subaccounts - acct))) - (if (null? subaccts) - ;; if leaf-account, make this an anchor - ;; to the register. - (gnc:account-anchor-text (cadr pair)) - ;; if non-leaf account, make this a link - ;; to another report which is run on the - ;; immediate subaccounts of this account - ;; (and including this account). - (gnc:make-report-anchor - reportname - (gnc:report-options report-obj) - (list - (list pagename-accounts optname-accounts - (cons acct subaccts)) - (list pagename-accounts optname-levels - (+ 1 tree-depth)))))))) - combined))) - (gnc:html-piechart-set-button-1-slice-urls! chart urls) - (gnc:html-piechart-set-button-1-legend-urls! chart urls)) + (gnc:account-anchor-text (cadr pair)))) + combined)) (gnc:html-piechart-set-title! chart report-title) @@ -324,22 +338,23 @@ ""))) - (gnc:html-piechart-set-labels! - chart - (map (lambda (pair) - (string-append - (if (string? (cadr pair)) - (cadr pair) - ((if show-fullname? - gnc:account-get-full-name - gnc:account-get-name) (cadr pair))) - (if show-total? - (string-append - " - " - (gnc:amount->string (car pair) print-info)) - ""))) - combined)) - + (let ((urls + (map + (lambda (pair) + (string-append + (if (string? (cadr pair)) + (cadr pair) + ((if show-fullname? + gnc:account-get-full-name + gnc:account-get-name) (cadr pair))) + (if show-total? + (string-append + " - " + (gnc:amount->string (car pair) print-info)) + ""))) + combined))) + (gnc:html-piechart-set-labels! chart urls)) + (gnc:html-document-add-object! document chart) document))) @@ -349,6 +364,9 @@ (gnc:define-report 'version 1 'name (car l) + 'menu-path (if (cadddr l) + (list "_Income & Expense") + (list "_Assets & Liabilities")) 'options-generator (lambda () (options-generator (cadr l) (cadddr l))) 'renderer (lambda (report-obj) diff --git a/src/scm/report/average-balance.scm b/src/scm/report/average-balance.scm index 8bc02e262d..86cd6b0ee9 100644 --- a/src/scm/report/average-balance.scm +++ b/src/scm/report/average-balance.scm @@ -417,5 +417,6 @@ (gnc:define-report 'version 1 'name (N_ "Average Balance") + 'menu-path (list "_Assets & Liabilities") 'options-generator options-generator 'renderer renderer)) diff --git a/src/scm/report/category-barchart.scm b/src/scm/report/category-barchart.scm index 006867d0e8..c3468d5c1f 100644 --- a/src/scm/report/category-barchart.scm +++ b/src/scm/report/category-barchart.scm @@ -378,8 +378,10 @@ (lambda (l) (gnc:define-report 'version 1 - ;; why I use a variable here? See comment at the top. 'name (car l) + 'menu-path (if (cadddr l) + (list "_Income & Expense") + (list "_Assets & Liabilities")) 'options-generator (lambda () (options-generator (cadr l))) 'renderer (lambda (report-obj) (category-barchart-renderer report-obj diff --git a/src/scm/report/income-expense-graph.scm b/src/scm/report/income-expense-graph.scm index e95ea51f93..9f41a2e807 100644 --- a/src/scm/report/income-expense-graph.scm +++ b/src/scm/report/income-expense-graph.scm @@ -212,6 +212,7 @@ ;; untranslated value here! 'name (N_ "Income/Expense Chart") + 'menu-path (list "_Income & Expense") ;; The options generator function defined above. 'options-generator options-generator diff --git a/src/scm/report/net-worth-timeseries.scm b/src/scm/report/net-worth-timeseries.scm index 4c62b71454..74d4868fdd 100644 --- a/src/scm/report/net-worth-timeseries.scm +++ b/src/scm/report/net-worth-timeseries.scm @@ -229,6 +229,8 @@ ;; untranslated value here! 'name (N_ "Net Worth Barchart") + 'menu-path (list "_Assets & Liabilities") + ;; The options generator function defined above. 'options-generator options-generator diff --git a/src/scm/report/portfolio.scm b/src/scm/report/portfolio.scm index d623b0f040..74b11ec200 100644 --- a/src/scm/report/portfolio.scm +++ b/src/scm/report/portfolio.scm @@ -163,6 +163,7 @@ ;; untranslated value here! 'name (N_ "Investment Portfolio") + 'menu-path (list "_Assets & Liabilities") ;; The options generator function defined above. 'options-generator options-generator