r16895 - gnucash/branches/2.2/src/report/standard-reports - [r16875] Display the Notes if Memo is empty in Transaction Report (#454834)

Andreas Köhler andi5 at cvs.gnucash.org
Wed Jan 30 15:25:08 EST 2008


Author: andi5
Date: 2008-01-30 15:25:07 -0500 (Wed, 30 Jan 2008)
New Revision: 16895
Trac: http://svn.gnucash.org/trac/changeset/16895

Modified:
   gnucash/branches/2.2/src/report/standard-reports/transaction.scm
Log:
[r16875] Display the Notes if Memo is empty in Transaction Report (#454834)

Patch by Charles Day.


Modified: gnucash/branches/2.2/src/report/standard-reports/transaction.scm
===================================================================
--- gnucash/branches/2.2/src/report/standard-reports/transaction.scm	2008-01-30 20:24:58 UTC (rev 16894)
+++ gnucash/branches/2.2/src/report/standard-reports/transaction.scm	2008-01-30 20:25:07 UTC (rev 16895)
@@ -320,8 +320,10 @@
   (vector-ref columns-used 17))
 (define (used-sort-account-full-name columns-used)
   (vector-ref columns-used 18))
+(define (used-notes columns-used)
+  (vector-ref columns-used 19))
 
-(define columns-used-size 19)
+(define columns-used-size 20)
 
 (define (num-columns-required columns-used)  
   (do ((i 0 (+ i 1)) 
@@ -372,6 +374,8 @@
         (vector-set! column-list 17 #t))
     (if (opt-val (N_ "Sorting") (N_ "Show Full Account Name?"))
         (vector-set! column-list 18 #t))
+    (if (opt-val (N_ "Display") (N_ "Notes"))
+        (vector-set! column-list 19 #t))
     column-list))
 
 (define (make-heading-list column-vector)
@@ -385,7 +389,9 @@
     (if (used-description column-vector)
         (addto! heading-list (_ "Description")))
     (if (used-memo column-vector)
-        (addto! heading-list (_ "Memo")))
+        (if (used-notes column-vector)
+            (addto! heading-list (string-append (_ "Memo") "/" (_ "Notes")))
+            (addto! heading-list (_ "Memo"))))
     (if (or (used-account-name column-vector) (used-account-code column-vector))
         (addto! heading-list (_ "Account")))
     (if (or (used-other-account-name column-vector) (used-other-account-code column-vector))
@@ -462,8 +468,10 @@
                     " ")))
     
     (if (used-memo column-vector)
-        (addto! row-contents
-                (xaccSplitGetMemo split)))
+        (let ((memo (xaccSplitGetMemo split)))
+          (if (and (equal? memo "") (used-notes column-vector))
+              (addto! row-contents (xaccTransGetNotes parent))
+              (addto! row-contents memo))))
     
     (if (or (used-account-name column-vector) (used-account-code column-vector))
        (addto! row-contents (account-namestring account
@@ -806,7 +814,7 @@
     (list (N_ "Reconciled Date")              "a2" (N_ "Display the reconciled date?") #f)
     (list (N_ "Num")                          "b"  (N_ "Display the check number?") #t)
     (list (N_ "Description")                  "c"  (N_ "Display the description?") #t)
-    (list (N_ "Memo")                         "d"  (N_ "Display the memo?") #t)
+    (list (N_ "Notes")                        "d2" (N_ "Display the notes if the memo is unavailable?") #t)
     (list (N_ "Account Name")                 "e"  (N_ "Display the account name?") #f)
     (list (N_ "Use Full Account Name?")       "f"  (N_ "Display the full account name") #t)
     (list (N_ "Account Code")                 "g"  (N_ "Display the account code") #f)
@@ -820,7 +828,20 @@
     (list (N_ "Running Balance")              "n"  (N_ "Display a running balance") #f)
     (list (N_ "Totals")                       "o"  (N_ "Display the totals?") #t)))
 
+  ;; Add an option to display the memo, and disable the notes option
+  ;; when memos are not included.
   (gnc:register-trep-option
+   (gnc:make-complex-boolean-option
+    gnc:pagename-display (N_ "Memo")
+    "d"  (N_ "Display the memo?") #t
+    #f
+    (lambda (x) (gnc-option-db-set-option-selectable-by-name
+		 gnc:*transaction-report-options*
+		 gnc:pagename-display
+		 (N_ "Notes")
+		 x))))
+
+  (gnc:register-trep-option
    (gnc:make-multichoice-option
     gnc:pagename-display (N_ "Amount")
     "m" (N_ "Display the amount?")  



More information about the gnucash-changes mailing list