[Gnucash-changes] David Montenegro's General Ledger patch (bug #155268).

Derek Atkins warlord at cvs.gnucash.org
Wed Jul 14 11:30:18 EDT 2004


Log Message:
-----------
David Montenegro's General Ledger patch (bug #155268).

        * 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

Modified Files:
--------------
    gnucash:
        ChangeLog
    gnucash/src/report/standard-reports:
        Makefile.am
        balance-sheet.scm
        equity-statement.scm
        standard-reports.scm
        transaction.scm
        trial-balance.scm

Added Files:
-----------
    gnucash/src/report/standard-reports:
        general-ledger.scm

Revision Data
-------------
Index: ChangeLog
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/ChangeLog,v
retrieving revision 1.1825
retrieving revision 1.1826
diff -LChangeLog -LChangeLog -u -r1.1825 -r1.1826
--- ChangeLog
+++ ChangeLog
@@ -1,5 +1,25 @@
 2004-07-13  David Montenegro  <sunrise2000 at comcast.net>
 
+        * 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  <sunrise2000 at comcast.net>
+
         * src/report/standard-reports/trial-balance.scm:
         * src/report/standard-reports/standard-reports.scm:
         * src/report/standard-reports/Makefile.am
Index: standard-reports.scm
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/src/report/standard-reports/standard-reports.scm,v
retrieving revision 1.17
retrieving revision 1.18
diff -Lsrc/report/standard-reports/standard-reports.scm -Lsrc/report/standard-reports/standard-reports.scm -u -r1.17 -r1.18
--- src/report/standard-reports/standard-reports.scm
+++ 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))
Index: Makefile.am
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/src/report/standard-reports/Makefile.am,v
retrieving revision 1.16
retrieving revision 1.17
diff -Lsrc/report/standard-reports/Makefile.am -Lsrc/report/standard-reports/Makefile.am -u -r1.16 -r1.17
--- src/report/standard-reports/Makefile.am
+++ src/report/standard-reports/Makefile.am
@@ -38,6 +38,7 @@
    register.scm \
    standard-reports.scm \
    trial-balance.scm \
+   general-ledger.scm \
    transaction.scm 
 
 EXTRA_DIST = ${gncscmmod_DATA}
--- /dev/null
+++ src/report/standard-reports/general-ledger.scm
@@ -0,0 +1,138 @@
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; general-ledger.scm: general ledger report
+;; 
+;; By David Montenegro <sunrise2000 at comcast.net> 2004.07.13
+;; 
+;;  * BUGS:
+;;    
+;;    See any "FIXME"s in the code.
+;;    
+;; Largely borrowed from welcome-to-gnucash.scm by
+;;  Bill Gribble <grib at 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
+;; 59 Temple Place - Suite 330        Fax:    +1-617-542-2652
+;; Boston, MA  02111-1307,  USA       gnu at 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
+
Index: trial-balance.scm
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/src/report/standard-reports/trial-balance.scm,v
retrieving revision 1.1
retrieving revision 1.2
diff -Lsrc/report/standard-reports/trial-balance.scm -Lsrc/report/standard-reports/trial-balance.scm -u -r1.1 -r1.2
--- src/report/standard-reports/trial-balance.scm
+++ 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 <sunrise2000 at comcast.net>
 ;; 
 ;; Prepares a trial balance of your books.
 ;; Optionally prepares a complete work sheet.
Index: transaction.scm
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/src/report/standard-reports/transaction.scm,v
retrieving revision 1.20
retrieving revision 1.21
diff -Lsrc/report/standard-reports/transaction.scm -Lsrc/report/standard-reports/transaction.scm -u -r1.20 -r1.21
--- src/report/standard-reports/transaction.scm
+++ 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 @@
            (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 @@
                   (_ "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
Index: balance-sheet.scm
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/src/report/standard-reports/balance-sheet.scm,v
retrieving revision 1.17
retrieving revision 1.18
diff -Lsrc/report/standard-reports/balance-sheet.scm -Lsrc/report/standard-reports/balance-sheet.scm -u -r1.17 -r1.18
--- src/report/standard-reports/balance-sheet.scm
+++ 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
   ;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
Index: equity-statement.scm
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/src/report/standard-reports/equity-statement.scm,v
retrieving revision 1.2
retrieving revision 1.3
diff -Lsrc/report/standard-reports/equity-statement.scm -Lsrc/report/standard-reports/equity-statement.scm -u -r1.2 -r1.3
--- src/report/standard-reports/equity-statement.scm
+++ 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"


More information about the gnucash-changes mailing list