diff --git a/ChangeLog b/ChangeLog index 5d6aa0aed0..f73d01429e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,23 @@ +2004-07-13 David Montenegro + + * src/report/standard-reports/general-ledger.scm: + src/report/standard-reports/standard-reports.scm: + src/report/standard-reports/Makefile.am: + Added General Ledger report, a Transaction Report + with a pre-set set of options. + + * src/report/standard-reports/transaction.scm: + FIXME - All accounts now selected by default, avoids + confusing error message. Error message also clarified. + Fixed "Totals" option so that it works. + + * src/report/standard-reports/balance-sheet.scm: + * src/report/standard-reports/equity-statement.scm: + * src/report/standard-reports/trial-balance.scm: + Updated comments + + * Fixes #144268 + 2004-07-13 David Montenegro * src/report/standard-reports/trial-balance.scm: diff --git a/src/report/standard-reports/Makefile.am b/src/report/standard-reports/Makefile.am index 62d520cea9..df6dcfc507 100644 --- a/src/report/standard-reports/Makefile.am +++ b/src/report/standard-reports/Makefile.am @@ -38,6 +38,7 @@ gncscmmod_DATA = \ register.scm \ standard-reports.scm \ trial-balance.scm \ + general-ledger.scm \ transaction.scm EXTRA_DIST = ${gncscmmod_DATA} diff --git a/src/report/standard-reports/balance-sheet.scm b/src/report/standard-reports/balance-sheet.scm index 393fd057e5..79c7595de5 100644 --- a/src/report/standard-reports/balance-sheet.scm +++ b/src/report/standard-reports/balance-sheet.scm @@ -18,12 +18,8 @@ ;; default) accounts representative of current & fixed assets & ;; liabilities. ;; -;; There are some gnc:html-acct-table options which remain unused, -;; mostly because I don't know how to make drop-down option -;; controls. -;; -;; This code makes the assumption that you want your equity -;; statement to no more than daily resolution. +;; This code makes the assumption that you want your balance +;; sheet to no more than daily resolution. ;; ;; The Company Name field does not currently default to the name ;; in (gnc:get-current-book). @@ -347,7 +343,7 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; balance-sheet-renderer ;; set up the document and add the table -;; then then return the document or, if +;; then return the document or, if ;; requested, export it to a file ;;;;;;;;;;;;;;;;;;;;;;;;;;; diff --git a/src/report/standard-reports/equity-statement.scm b/src/report/standard-reports/equity-statement.scm index 88d9fba04b..eb12da767c 100644 --- a/src/report/standard-reports/equity-statement.scm +++ b/src/report/standard-reports/equity-statement.scm @@ -203,7 +203,7 @@ gnc:pagename-display optname-use-rules "f" opthelp-use-rules #f)) - ;; adjusting/closing entry match criteria + ;; closing entry match criteria ;; ;; N.B.: transactions really should have a field where we can put ;; transaction types like "Adjusting/Closing/Correcting Entries" diff --git a/src/report/standard-reports/general-ledger.scm b/src/report/standard-reports/general-ledger.scm new file mode 100644 index 0000000000..79778ae0a5 --- /dev/null +++ b/src/report/standard-reports/general-ledger.scm @@ -0,0 +1,138 @@ +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; general-ledger.scm: general ledger report +;; +;; By David Montenegro 2004.07.13 +;; +;; * BUGS: +;; +;; See any "FIXME"s in the code. +;; +;; Largely borrowed from welcome-to-gnucash.scm by +;; Bill Gribble +;; +;; 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 +;; 59 Temple Place - Suite 330 Fax: +1-617-542-2652 +;; Boston, MA 02111-1307, USA gnu@gnu.org +;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(define-module (gnucash report general-ledger)) +(export gnc:make-general-ledger-report) +(use-modules (gnucash main)) ;; FIXME: delete after we finish modularizing. +(use-modules (ice-9 slib)) +(use-modules (gnucash gnc-module)) + +(gnc:module-load "gnucash/report/report-system" 0) + +(define reportname (N_ "General Ledger")) +(define xactrptname "Transaction Report") + +;; report constructor + +(define (gnc:make-general-ledger-report) + (let* ((xactrpt (gnc:make-report xactrptname))) + xactrpt)) + +;; options generator + +(define (general-ledger-options-generator) + + (let* ((options (gnc:report-template-new-options/name xactrptname)) + ) + + (define pagename-sorting (N_ "Sorting")) + (define (set-option! section name value) + (gnc:option-set-value + (gnc:lookup-option options section name) value)) + + ;; set options in the accounts tab... + (set-option! + gnc:pagename-accounts (N_ "Filter Type") 'none) + (set-option! + gnc:pagename-accounts (N_ "Void Transactions?") 'non-void-only) + + ;; set options in the display tab... + (for-each + (lambda (l) + (set-option! gnc:pagename-display (car l) (cadr l))) + ;; One list per option here with: option-name, default-value + (list + (list (N_ "Date") #t) + (list (N_ "Reconciled Date") #f) + (list (N_ "Num") #f) + (list (N_ "Description") #t) + (list (N_ "Memo") #f) + (list (N_ "Account Name") #f) + (list (N_ "Use Full Account Name?") #f) + (list (N_ "Account Code") #f) + (list (N_ "Other Account Name") #f) + (list (N_ "Use Full Other Account Name?") #f) + (list (N_ "Other Account Code") #f) + (list (N_ "Shares") #f) + (list (N_ "Price") #f) + ;; note the "Amount" multichoice option here + (list (N_ "Amount") 'double) + (list (N_ "Running Balance") #t) + (list (N_ "Totals") #f) + (list (N_ "Sign Reverses?") 'credit-accounts) + ) + ) + + ;; set options in the general tab... + (set-option! + gnc:pagename-general (N_ "Style") 'single) + ;; we can't (currently) set the Report name here + ;; because it is automatically set to the template + ;; name... :( + + ;; set options in the sorting tab... + (for-each + (lambda (l) + (set-option! pagename-sorting (car l) (cadr l))) + ;; One list per option here with: option-name, default-value + (list + (list (N_ "Primary Key") 'account-code) + (list (N_ "Show Full Account Name?") #f) + (list (N_ "Show Account Code?") #t) + (list (N_ "Primary Subtotal") #t) + (list (N_ "Primary Subtotal for Date Key") 'none) + (list (N_ "Primary Sort Order") 'ascend) + (list (N_ "Secondary Key") 'register-order) + (list (N_ "Secondary Subtotal") #t) + (list (N_ "Secondary Subtotal for Date Key") 'none) + (list (N_ "Secondary Sort Order") 'ascend) + ) + ) + + options) + ) + +;; report renderer + +(define (general-ledger-renderer report-obj) + ;; just delegate rendering to the Transaction Report renderer... + ((gnc:report-template-renderer/name xactrptname) report-obj)) + +(gnc:define-report + 'version 1 + 'name reportname + 'menu-path (list gnc:menuname-asset-liability) + 'options-generator general-ledger-options-generator + 'renderer general-ledger-renderer + ) + +;; END + diff --git a/src/report/standard-reports/standard-reports.scm b/src/report/standard-reports/standard-reports.scm index 6eda6676cb..5fc8a2af2a 100644 --- a/src/report/standard-reports/standard-reports.scm +++ b/src/report/standard-reports/standard-reports.scm @@ -72,6 +72,7 @@ (use-modules (gnucash report average-balance)) (use-modules (gnucash report balance-sheet)) (use-modules (gnucash report equity-statement)) +(use-modules (gnucash report general-ledger)) (use-modules (gnucash report cash-flow)) (use-modules (gnucash report category-barchart)) (use-modules (gnucash report daily-reports)) diff --git a/src/report/standard-reports/transaction.scm b/src/report/standard-reports/transaction.scm index 3752b11ca5..70ff41da47 100644 --- a/src/report/standard-reports/transaction.scm +++ b/src/report/standard-reports/transaction.scm @@ -508,18 +508,13 @@ (gnc:make-account-list-option gnc:pagename-accounts (N_ "Report Accounts") "a" (N_ "Report on these accounts") - (lambda () - ;; FIXME : gnc:get-current-accounts disappeared. - (let ((current-accounts '()) - (num-accounts (gnc:group-get-num-accounts - (gnc:get-current-group))) - (first-account (gnc:group-get-account - (gnc:get-current-group) 0))) - (cond ((not (null? current-accounts)) - (list (car current-accounts))) - ((> num-accounts 0) (list first-account)) - (else ())))) - #f #t)) + ;; select, by default, all accounts... + (lambda () + (gnc:filter-accountlist-type + '(bank cash credit asset liability stock mutual-fund currency + payable receivable equity income expense) + (gnc:group-get-subaccounts (gnc:get-current-group)))) + #f #t)) (gnc:register-trep-option (gnc:make-account-list-option @@ -908,9 +903,9 @@ Credit Card, and Income accounts"))))) (list (gnc:make-html-table-cell/size 1 width (gnc:make-html-text (gnc:html-markup-hr))))) - - (render-grand-total table width total-collector export?)) - + (if (gnc:option-value (gnc:lookup-option options "Display" "Totals")) + (render-grand-total table width total-collector export?))) + (let* ((current (car splits)) (current-row-style (if multi-rows? def:normal-row-style (if odd-row? def:normal-row-style @@ -1315,7 +1310,8 @@ Credit Card, and Income accounts"))))) (_ "No matching transactions found")) (gnc:html-markup-p (_ "No transactions were found that \ -match the given time interval and account selection."))) +match the time interval and account selection specified \ +in the Options panel."))) (gnc:html-document-add-object! document p)))) ;; error condition: no accounts specified diff --git a/src/report/standard-reports/trial-balance.scm b/src/report/standard-reports/trial-balance.scm index fa9c338a4e..ee6eb35893 100644 --- a/src/report/standard-reports/trial-balance.scm +++ b/src/report/standard-reports/trial-balance.scm @@ -1,6 +1,6 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; trial-balance.scm: trial balance and work sheet -;; By David Montenegro +;; By David Montenegro ;; ;; Prepares a trial balance of your books. ;; Optionally prepares a complete work sheet.