diff --git a/src/scm/report/Makefile.am b/src/scm/report/Makefile.am index 58e979c00b..21e25d659e 100644 --- a/src/scm/report/Makefile.am +++ b/src/scm/report/Makefile.am @@ -2,6 +2,7 @@ gncscmdir = ${GNC_SCM_INSTALL_DIR}/report gncscm_DATA = \ + account-summary.scm \ average-balance.scm \ balance-and-pnl.scm \ budget-report.scm \ diff --git a/src/scm/report/Makefile.in b/src/scm/report/Makefile.in index 0e4a623b48..f50099e223 100644 --- a/src/scm/report/Makefile.in +++ b/src/scm/report/Makefile.in @@ -117,7 +117,7 @@ l = @l@ gncscmdir = ${GNC_SCM_INSTALL_DIR}/report -gncscm_DATA = average-balance.scm balance-and-pnl.scm budget-report.scm folio.scm hello-world.scm report-list.scm transaction-report.scm +gncscm_DATA = account-summary.scm average-balance.scm balance-and-pnl.scm budget-report.scm folio.scm hello-world.scm report-list.scm transaction-report.scm EXTRA_DIST = .cvsignore ${gncscm_DATA} diff --git a/src/scm/report/account-summary.scm b/src/scm/report/account-summary.scm new file mode 100644 index 0000000000..4cc226aa3d --- /dev/null +++ b/src/scm/report/account-summary.scm @@ -0,0 +1,247 @@ +;; -*-scheme-*- +;; account-summary.scm +;; account(s) summary report +;; +;; Author makes no implicit or explicit guarantee of accuracy of +;; these calculations and accepts no responsibility for direct +;; or indirect losses incurred as a result of using this software. +;; +;; Terry D. Boldt (tboldt@attglobal.net> +;; created by modifying other report files extensively - the authors of +;; the modified report files are graciously thanked for their efforts. + +(gnc:support "report/account-balance.scm") +(gnc:depend "report-utilities") +(gnc:depend "html-generator.scm") +(gnc:depend "date-utilities.scm") + +(let () + + ;; Options + (define (accsum-options-generator) + (let* + ((gnc:*accsum-track-options* (gnc:new-options)) + ;; register a configuration option for the report + (gnc:register-accsum-option + (lambda (new-option) + (gnc:register-option gnc:*accsum-track-options* + new-option)))) + + ;; to-date + (gnc:register-accsum-option + (gnc:make-date-option + "Report Options" "To" + "a" "Report up to and including this date" + (lambda () + (let ((bdtime (localtime (current-time)))) + (set-tm:sec bdtime 59) + (set-tm:min bdtime 59) + (set-tm:hour bdtime 23) + (cons (car (mktime bdtime)) 0))) + #f)) + + ;; account(s) to do report on + (gnc:register-accsum-option + (gnc:make-account-list-option + "Report Options" "Account" + "b" "Report on these account(s)" + (lambda () + (let ((current-accounts (gnc:get-current-accounts)) + (num-accounts + (gnc:group-get-num-accounts (gnc:get-current-group)))) + + (cond ((not (null? current-accounts)) current-accounts) + (else + (let ((acctlist '())) + (gnc:for-loop + (lambda(x) + (set! acctlist + (append! + acctlist + (list (gnc:group-get-account + (gnc:get-current-group) x))))) + 0 num-accounts 1) + acctlist))))) + #f #t)) + + (gnc:register-accsum-option + (gnc:make-simple-boolean-option + "Report Options" "Sub-Accounts" + "c" "Include Sub-Accounts of each selected Account" #f)) + + gnc:*accsum-track-options*)) + +;; I copied the following html generation code from the html-generation file +;; because I like the numbers in the balance column aligned at the top of the +;; cell - this aligns the number with the account name - rather than placing +;; the balance number in the default position of the vertical center of cell +;; which makes it difficult to match the balance with the account name. + +;; Create a column entry + (define (accsum_html-table-col val) + (string-append "
\n"))
+ rept-data
+;; rept-total
+ suffix)))
+
+ ;; Define the strings
+ (string-db 'store 'account-name "Account Name")
+ (string-db 'store 'balance "Balance")
+ (string-db 'store 'no-account "You have not selected an account.")
+ (string-db 'store 'report-for "Date: %s
Report for %s.
Accounts Total: %s")
+ (string-db 'store 'report-for-and "Date: %s
Report for %s and all Sub-Accounts.
Accounts Total: %s")
+
+ (gnc:define-report
+ ;; version
+ 'version 1
+ ;; Name
+ 'name "Account Summary"
+ ;; Options
+ 'options-generator accsum-options-generator
+ ;; renderer
+ 'renderer accsum-renderer))
diff --git a/src/scm/report/report-list.scm b/src/scm/report/report-list.scm
index 4f0e6652a0..8b0134b7b2 100644
--- a/src/scm/report/report-list.scm
+++ b/src/scm/report/report-list.scm
@@ -7,4 +7,4 @@
(gnc:depend "report/hello-world.scm")
(gnc:depend "report/transaction-report.scm")
(gnc:depend "report/budget-report.scm")
-
+(gnc:depend "report/account-summary.scm")