gnucash maint: Multiple changes pushed

Geert Janssens gjanssens at code.gnucash.org
Tue Jun 21 12:51:04 EDT 2016


Updated	 via  https://github.com/Gnucash/gnucash/commit/5ed88771 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/3e37be81 (commit)
	from  https://github.com/Gnucash/gnucash/commit/71297be8 (commit)



commit 5ed887715b22b9fbd68040e0970f7f91a5943ea1
Author: goodvibes2 <chris.good at ozemail.com.au>
Date:   Mon Jun 20 19:45:28 2016 +1000

    Bug 637004 Optionally allow customer and vendor address info to display
      Use an internal option to hold receivable/payable flag,
      remove trailing spaces.

diff --git a/src/report/business-reports/aging.scm b/src/report/business-reports/aging.scm
index 032bb1d..cd3e60f 100644
--- a/src/report/business-reports/aging.scm
+++ b/src/report/business-reports/aging.scm
@@ -167,7 +167,7 @@
 		 (gnc-numeric-sub-fixed amount current-bucket-amt)
 		 buckets
 		 (+ current-bucket-index 1)))))))
-  
+
   (let ((overpayment (company-get-overpayment company)))
 	;; if there's already an overpayment, make it bigger
     (gnc:debug "processing payment of " amount)
@@ -175,11 +175,11 @@
 
 	(if (gnc-numeric-positive-p overpayment)
 	    (company-set-overpayment company (gnc-numeric-add-fixed overpayment amount))
-	    
+
 	    (let ((result (process-payment-driver amount (company-get-buckets company) 0)))
 	      (gnc:debug "payment-driver processed.  new overpayment: " result)
 	      (company-set-overpayment company result)))))
-		  
+
 ;; determine date function to use 
 (define (get-selected-date-from-txn transaction date-type)
   (if (eq? date-type 'postdate)
@@ -233,7 +233,7 @@ more than one currency. This report is not designed to cope with this possibilit
 		     (hash-set! hash guid company-info)
 		     (cons #t guid)))
 	       (gncOwnerFree temp-owner))
-		 
+
 	     ;; if it's a new company
 	     (begin
 	       (gnc:debug "value" value)
@@ -245,7 +245,7 @@ more than one currency. This report is not designed to cope with this possibilit
 	       (cons #t guid))))
        ; else (no owner)
        (gncOwnerFree temp-owner))))
-  
+
   ;; figure out if this split is part of a closed lot
   ;; also save the split value...
   (let* ((lot (xaccSplitGetLot split))
@@ -272,7 +272,7 @@ more than one currency. This report is not designed to cope with this possibilit
 
 ;; compare by the total in the buckets
 
-(define (compare-total litem-a litem-b)    
+(define (compare-total litem-a litem-b)
   (let*  ((company-a (cdr litem-a))
 	 (bucket-a (company-get-buckets company-a))
 	 (company-b (cdr litem-b))
@@ -299,19 +299,19 @@ more than one currency. This report is not designed to cope with this possibilit
 	  (if (= diff 0)
 	      (driver (cdr buckets-a) (cdr buckets-b))
 	      diff))))
- 
+
   (let*  ((company-a (cdr litem-a))
 	 (bucket-a (vector->list (company-get-buckets company-a)))
 	 (company-b (cdr litem-b))
 	 (bucket-b (vector->list (company-get-buckets company-b)))
-	 
+
 	 (difference (driver bucket-a bucket-b)))
 	 ;; if same totals, compare by name
 	 (if (= difference 0)
 	     (gnc:safe-strcmp (car litem-a) (car litem-b))
 	     difference)))
-  
-    
+
+
 ;; set up the query to get the splits in the chosen account
 ;; XXX: FIXME: begindate is a hack -- we currently only go back a year
 (define (setup-query query account date)
@@ -329,13 +329,14 @@ more than one currency. This report is not designed to cope with this possibilit
 			      (list SPLIT-TRANS TRANS-DATE-POSTED)
 			      '() '())
     (qof-query-set-sort-increasing query #t #t #t)))
-     
 
-(define (aging-options-generator options receivable)
+
+(define (aging-options-generator options)
   (let* ((add-option 
           (lambda (new-option)
             (gnc:register-option options new-option))))
 
+
     (gnc:options-add-report-date!
      options gnc:pagename-general
      optname-to-date "a")
@@ -344,7 +345,7 @@ more than one currency. This report is not designed to cope with this possibilit
                                              gnc:pagename-general
                                              optname-to-date)
                           (cons 'relative 'today))
-   
+
  ;; all about currencies
     (gnc:options-add-currency!
      options gnc:pagename-general
@@ -404,23 +405,12 @@ totals to report currency.")
        (list
          (vector 'duedate (N_ "Due Date") (N_ "Due date is leading.")) ;; Should be using standard label for due date?
          (vector 'postdate (N_ "Post Date") (N_ "Post date is leading."))))) ;; Should be using standard label for post date?
-    
-	;; display tab options
-	
-	(gnc:debug "aging-options-generator: receivable=" receivable)
-	
-    (if receivable
-        (add-option
-          (gnc:make-multichoice-option
-            gnc:pagename-display
-            optname-addr-source
-            "a"
-            (N_ "Address source.")
-            'billing
-            (list
-             (vector 'billing (N_ "Billing") (N_ "Address fields from billing address."))
-             (vector 'shipping (N_ "Shipping") (N_ "Address fields from shipping address."))))))
-		
+
+	  ;; display tab options
+
+    ;; option optname-addr-source is added in receivables.scm
+    ;; as cannot access the value of an option in aging-options-generator
+
     (add-option
      (gnc:make-simple-boolean-option
       gnc:pagename-display
@@ -445,7 +435,7 @@ copying this report to a spreadsheet for use in a mail merge.")
       "d"
       (N_ "Display Address 2.")
       #f))
-	
+
     (add-option
      (gnc:make-simple-boolean-option
       gnc:pagename-display
@@ -453,7 +443,7 @@ copying this report to a spreadsheet for use in a mail merge.")
       "e"
       (N_ "Display Address 3.")
       #f))
-	
+
     (add-option
      (gnc:make-simple-boolean-option
       gnc:pagename-display
@@ -461,7 +451,7 @@ copying this report to a spreadsheet for use in a mail merge.")
       "f"
       (N_ "Display Address 4.")
       #f))
-	
+
     (add-option
      (gnc:make-simple-boolean-option
       gnc:pagename-display
@@ -469,7 +459,7 @@ copying this report to a spreadsheet for use in a mail merge.")
       "g"
       (N_ "Display Phone.")
       #f))
-	
+
     (add-option
      (gnc:make-simple-boolean-option
       gnc:pagename-display
@@ -477,7 +467,7 @@ copying this report to a spreadsheet for use in a mail merge.")
       "h"
       (N_ "Display Fax.")
       #f))
-	
+
     (add-option
      (gnc:make-simple-boolean-option
       gnc:pagename-display
@@ -485,7 +475,7 @@ copying this report to a spreadsheet for use in a mail merge.")
       "i"
       (N_ "Display Email.")
       #f))
-		
+
     (add-option
      (gnc:make-simple-boolean-option
       gnc:pagename-display
@@ -493,8 +483,8 @@ copying this report to a spreadsheet for use in a mail merge.")
       "j"
       (N_ "Display Active status.")
       #f))
-		
-    (gnc:options-set-default-section options "General")      
+
+    (gnc:options-set-default-section options "General")
     options))
 
 (define (make-interval-list to-date)
@@ -510,8 +500,10 @@ copying this report to a spreadsheet for use in a mail merge.")
     (define oldintervalreversed (reverse (make-interval-list to-date)))		
   (reverse (cons dayforcurrent oldintervalreversed)))
 
-(define (aging-renderer report-obj reportname account reverse? receivable)
-	
+(define (aging-renderer report-obj reportname account reverse?)
+
+  (define receivable #t)     ;; receivable=#t payable=#f
+
   (define (get-name a)
     (let* ((owner (company-get-owner-obj (cdr a))))
       (gncOwnerGetName owner)))
@@ -534,8 +526,7 @@ copying this report to a spreadsheet for use in a mail merge.")
 			     (< (compare-buckets a b) 0))
 			    (lambda (a b)
 			      (> (compare-buckets a b) 0))))))
-				 
-				 
+
 
   (define (get-sort-pred sort-criterion sort-order)
     (let ((choice (assq-ref sort-preds sort-criterion)))
@@ -550,15 +541,12 @@ copying this report to a spreadsheet for use in a mail merge.")
 	    (gnc:warn "internal sorting option errorin aging.scm")
 	    (lambda (a b)
 	      (string<? (car a) (car b)))))))
-		       
+
   (define (get-op section name)
     (gnc:lookup-option (gnc:report-options report-obj) section name))
-  
+
   (define (op-value section name)
-    (begin
-;;	  (gnc:debug "op-value: name=" name)
-      (gnc:option-value (get-op section name)))
-  )
+    (gnc:option-value (get-op section name)))
 
 
   ;; XXX: This is a hack - will be fixed when we move to a
@@ -660,13 +648,11 @@ copying this report to a spreadsheet for use in a mail merge.")
   ;;  note customers have a shipping address but not vendors
   
   (define (get-addr owner disp-addr-source)
-   (begin
-;;  (gnc:debug "get-addr: disp-addr-source=" disp-addr-source)
     (if (and receivable (eq? disp-addr-source 'shipping))
-        (gncCustomerGetShipAddr (gncOwnerGetCustomer owner)) ;; shipping
-        (gncOwnerGetAddr owner))) 			   			     ;; billing
-  )
+      (gncCustomerGetShipAddr (gncOwnerGetCustomer owner)) ;; shipping
+      (gncOwnerGetAddr owner)))                            ;; billing
 
+  (set! receivable (eq? (op-value "__hidden" "receivable-or-payable") 'R))
   (gnc:report-starting reportname)
   (let* ((companys (make-hash-table 23))
 	 (report-title (op-value gnc:pagename-general gnc:optname-reportname))
@@ -706,7 +692,7 @@ copying this report to a spreadsheet for use in a mail merge.")
         (document (gnc:make-html-document)))
 ;    (gnc:debug "Account: " account)
 
-	;; add optional column headings
+    ;; add optional column headings
     (if disp-addr-name
       (set! heading-list (append heading-list (list (_ "Address Name")))))
     (if disp-addr1
diff --git a/src/report/business-reports/payables.scm b/src/report/business-reports/payables.scm
index feb9f07..fec88c2 100644
--- a/src/report/business-reports/payables.scm
+++ b/src/report/business-reports/payables.scm
@@ -37,7 +37,6 @@
 
 (define acc-page gnc:pagename-general)
 (define this-acc (N_ "Payable Account"))
-(define receivable #f)		;; receivable = #t, payable = #f
 
 (define (options-generator)    
   (let* ((options (gnc:new-options)) 
@@ -51,7 +50,16 @@
       "w" (N_ "The payable account you wish to examine.") 
       #f #f (list ACCT-TYPE-PAYABLE)))
 
-    (aging-options-generator options receivable)))
+    ;; As aging.scm functions are used by both receivables.scm and payables.scm
+    ;;  add option "receivable" on hidden page "__hidden" with default value 'P
+    ;;  so aging.scm functions can tell if they are reporting on
+    ;;  accounts receivable or payable, as customers have a shipping address
+    ;;  but vendors do not. The Address Source option therefore only applies
+    ;;  to customers.
+    (add-option
+     (gnc:make-internal-option "__hidden" "receivable-or-payable" 'P))
+
+    (aging-options-generator options)))
 
 (define (payables-renderer report-obj)
   (define (opt-val section name)
@@ -60,7 +68,7 @@
 
   (let ((payables-account (opt-val acc-page this-acc)))
     (gnc:debug "payables-account" payables-account)
-    (aging-renderer report-obj this-acc payables-account #f receivable)))
+    (aging-renderer report-obj this-acc payables-account #f)))
 
 (define payables-aging-guid "e57770f2dbca46619d6dac4ac5469b50")
 
diff --git a/src/report/business-reports/receivables.scm b/src/report/business-reports/receivables.scm
index 325f576..ce1ff00 100644
--- a/src/report/business-reports/receivables.scm
+++ b/src/report/business-reports/receivables.scm
@@ -37,7 +37,7 @@
 
 (define acc-page gnc:pagename-general)
 (define this-acc (N_ "Receivables Account"))
-(define receivable #t)		;; receivable = #t, payable = #f
+(define optname-addr-source (N_ "Address Source")) ;; Billing or Shipping addresses
 
 (define (options-generator)    
   (let* ((options (gnc:new-options)) 
@@ -51,7 +51,27 @@
       "w" (N_ "The receivables account you wish to examine.") 
       #f #f (list ACCT-TYPE-RECEIVABLE)))
 
-    (aging-options-generator options receivable)))
+    ;; As aging.scm functions are used by both receivables.scm and payables.scm
+    ;;  add option "receivable" on hidden page "__hidden" with default value 'R
+    ;;  so aging.scm functions can tell if they are reporting on
+    ;;  accounts receivable or payable, as customers have a shipping address
+    ;;  but vendors do not. The Address Source option therefore only applies
+    ;;  to customers.
+    (add-option
+     (gnc:make-internal-option "__hidden" "receivable-or-payable" 'R))
+
+    (add-option
+      (gnc:make-multichoice-option
+        gnc:pagename-display
+        optname-addr-source
+        "a"
+        (N_ "Address source.")
+        'billing
+        (list
+         (vector 'billing (N_ "Billing") (N_ "Address fields from billing address."))
+         (vector 'shipping (N_ "Shipping") (N_ "Address fields from shipping address.")))))
+
+    (aging-options-generator options)))
 
 (define (receivables-renderer report-obj)
   (define (op-value section name)
@@ -61,7 +81,7 @@
   (let* ((receivables-account (op-value acc-page this-acc)))
     (gnc:debug "receivables-account" receivables-account)
 
-    (aging-renderer report-obj this-acc receivables-account #t receivable)))
+    (aging-renderer report-obj this-acc receivables-account #t)))
 
 (define receivables-aging-guid "9cf76bed17f14401b8e3e22d0079cb98")
 

commit 3e37be8144c6ea9e4f87db387a92b292ca467dd7
Author: goodvibes2 <chris.good at ozemail.com.au>
Date:   Sat Jun 18 08:55:27 2016 +1000

    Bug 637004 Optionally allow customer and vendor address info to display
      in the Receivable Aging and Payable Aging reports so can be copied
      and pasted into a spreadsheet for use in mail merge.

diff --git a/src/report/business-reports/aging.scm b/src/report/business-reports/aging.scm
index d141b03..032bb1d 100644
--- a/src/report/business-reports/aging.scm
+++ b/src/report/business-reports/aging.scm
@@ -45,6 +45,18 @@
 (define optname-show-zeros (N_ "Show zero balance items"))
 (define optname-date-driver (N_ "Due or Post Date"))
 
+;; Display tab options
+(define optname-addr-source (N_ "Address Source")) ;; Billing or Shipping addresses
+(define optname-disp-addr-name (N_ "Address Name"))
+(define optname-disp-addr1 (N_ "Address 1"))
+(define optname-disp-addr2 (N_ "Address 2"))
+(define optname-disp-addr3 (N_ "Address 3"))
+(define optname-disp-addr4 (N_ "Address 4"))
+(define optname-disp-addr-phone (N_ "Address Phone"))
+(define optname-disp-addr-fax (N_ "Address Fax"))
+(define optname-disp-addr-email (N_ "Address Email"))
+(define optname-disp-active (N_ "Active"))
+
 (export optname-show-zeros)
 
 ;; The idea is:  have a hash with the key being the contact name
@@ -319,7 +331,7 @@ more than one currency. This report is not designed to cope with this possibilit
     (qof-query-set-sort-increasing query #t #t #t)))
      
 
-(define (aging-options-generator options)
+(define (aging-options-generator options receivable)
   (let* ((add-option 
           (lambda (new-option)
             (gnc:register-option options new-option))))
@@ -391,8 +403,97 @@ totals to report currency.")
        'duedate
        (list
          (vector 'duedate (N_ "Due Date") (N_ "Due date is leading.")) ;; Should be using standard label for due date?
-	 (vector 'postdate (N_ "Post Date") (N_ "Post date is leading."))))) ;; Should be using standard label for post date?
+         (vector 'postdate (N_ "Post Date") (N_ "Post date is leading."))))) ;; Should be using standard label for post date?
     
+	;; display tab options
+	
+	(gnc:debug "aging-options-generator: receivable=" receivable)
+	
+    (if receivable
+        (add-option
+          (gnc:make-multichoice-option
+            gnc:pagename-display
+            optname-addr-source
+            "a"
+            (N_ "Address source.")
+            'billing
+            (list
+             (vector 'billing (N_ "Billing") (N_ "Address fields from billing address."))
+             (vector 'shipping (N_ "Shipping") (N_ "Address fields from shipping address."))))))
+		
+    (add-option
+     (gnc:make-simple-boolean-option
+      gnc:pagename-display
+      optname-disp-addr-name
+      "b"
+      (N_ "Display Address Name. This, and other fields, may be useful if \
+copying this report to a spreadsheet for use in a mail merge.")
+      #f))
+
+    (add-option
+     (gnc:make-simple-boolean-option
+      gnc:pagename-display
+      optname-disp-addr1
+      "c"
+      (N_ "Display Address 1.")
+      #f))
+
+    (add-option
+     (gnc:make-simple-boolean-option
+      gnc:pagename-display
+      optname-disp-addr2
+      "d"
+      (N_ "Display Address 2.")
+      #f))
+	
+    (add-option
+     (gnc:make-simple-boolean-option
+      gnc:pagename-display
+      optname-disp-addr3
+      "e"
+      (N_ "Display Address 3.")
+      #f))
+	
+    (add-option
+     (gnc:make-simple-boolean-option
+      gnc:pagename-display
+      optname-disp-addr4
+      "f"
+      (N_ "Display Address 4.")
+      #f))
+	
+    (add-option
+     (gnc:make-simple-boolean-option
+      gnc:pagename-display
+      optname-disp-addr-phone
+      "g"
+      (N_ "Display Phone.")
+      #f))
+	
+    (add-option
+     (gnc:make-simple-boolean-option
+      gnc:pagename-display
+      optname-disp-addr-fax
+      "h"
+      (N_ "Display Fax.")
+      #f))
+	
+    (add-option
+     (gnc:make-simple-boolean-option
+      gnc:pagename-display
+      optname-disp-addr-email
+      "i"
+      (N_ "Display Email.")
+      #f))
+		
+    (add-option
+     (gnc:make-simple-boolean-option
+      gnc:pagename-display
+      optname-disp-active
+      "j"
+      (N_ "Display Active status.")
+      #f))
+		
     (gnc:options-set-default-section options "General")      
     options))
 
@@ -409,8 +510,8 @@ totals to report currency.")
     (define oldintervalreversed (reverse (make-interval-list to-date)))		
   (reverse (cons dayforcurrent oldintervalreversed)))
 
-(define (aging-renderer report-obj reportname account reverse?)
-
+(define (aging-renderer report-obj reportname account reverse? receivable)
+	
   (define (get-name a)
     (let* ((owner (company-get-owner-obj (cdr a))))
       (gncOwnerGetName owner)))
@@ -454,20 +555,34 @@ totals to report currency.")
     (gnc:lookup-option (gnc:report-options report-obj) section name))
   
   (define (op-value section name)
-    (gnc:option-value (get-op section name)))
+    (begin
+;;	  (gnc:debug "op-value: name=" name)
+      (gnc:option-value (get-op section name)))
+  )
 
 
   ;; XXX: This is a hack - will be fixed when we move to a
   ;; more general interval scheme in this report
-  (define (make-heading-list)
+  (define make-heading-list
     (list 
-     (_ "Company")
-     (_ "Current")
-     (_ "0-30 days")
-     (_ "31-60 days")
-     (_ "61-90 days")
-     (_ "91+ days")
-     (_ "Total")))
+      (_ "Company")
+      (_ "Current")
+      (_ "0-30 days")
+      (_ "31-60 days")
+      (_ "61-90 days")
+      (_ "91+ days")
+      (_ "Total")))
+     
+;; following cols are optional 
+;;    (_ "Address Name")
+;;    (_ "Address 1")
+;;    (_ "Address 2")
+;;    (_ "Address 3")
+;;    (_ "Address 4")
+;;    (_ "Phone")
+;;    (_ "Fax")
+;;    (_ "Email")
+;;    (_ "Active")
 
 
   ;;  Make a list of commodity collectors for column totals
@@ -540,7 +655,17 @@ totals to report currency.")
 	       fmt-multiple-currencies
 	       fmt-one-currency)))
       (map fmt-function collector-list)))
-
+  
+  ;; return pointer to either billing or shipping address
+  ;;  note customers have a shipping address but not vendors
+  
+  (define (get-addr owner disp-addr-source)
+   (begin
+;;  (gnc:debug "get-addr: disp-addr-source=" disp-addr-source)
+    (if (and receivable (eq? disp-addr-source 'shipping))
+        (gncCustomerGetShipAddr (gncOwnerGetCustomer owner)) ;; shipping
+        (gncOwnerGetAddr owner))) 			   			     ;; billing
+  )
 
   (gnc:report-starting reportname)
   (let* ((companys (make-hash-table 23))
@@ -557,8 +682,20 @@ totals to report currency.")
 	(price-source (op-value gnc:pagename-general optname-price-source))
 	(multi-totals-p (op-value gnc:pagename-general optname-multicurrency-totals))
 	(show-zeros (op-value gnc:pagename-general optname-show-zeros))
-        (date-type (op-value gnc:pagename-general optname-date-driver))        
-	(heading-list (make-heading-list))
+    (date-type (op-value gnc:pagename-general optname-date-driver)) 
+    (disp-addr-source (if receivable
+      (op-value gnc:pagename-display optname-addr-source)
+      'billing))
+    (disp-addr-name (op-value gnc:pagename-display optname-disp-addr-name))
+    (disp-addr1 (op-value gnc:pagename-display optname-disp-addr1))
+    (disp-addr2 (op-value gnc:pagename-display optname-disp-addr2))
+    (disp-addr3 (op-value gnc:pagename-display optname-disp-addr3))
+    (disp-addr4 (op-value gnc:pagename-display optname-disp-addr4))
+    (disp-addr-phone (op-value gnc:pagename-display optname-disp-addr-phone))
+    (disp-addr-fax (op-value gnc:pagename-display optname-disp-addr-fax))
+    (disp-addr-email (op-value gnc:pagename-display optname-disp-addr-email))
+    (disp-active (op-value gnc:pagename-display optname-disp-active))
+	(heading-list make-heading-list)
 	(exchange-fn (gnc:case-exchange-fn price-source report-currency report-date))
 	(total-collector-list (make-collector-list))
 	(table (gnc:make-html-table))
@@ -569,6 +706,26 @@ totals to report currency.")
         (document (gnc:make-html-document)))
 ;    (gnc:debug "Account: " account)
 
+	;; add optional column headings
+    (if disp-addr-name
+      (set! heading-list (append heading-list (list (_ "Address Name")))))
+    (if disp-addr1
+      (set! heading-list (append heading-list (list (_ "Address 1")))))
+    (if disp-addr2
+      (set! heading-list (append heading-list (list (_ "Address 2")))))
+    (if disp-addr3
+      (set! heading-list (append heading-list (list (_ "Address 3")))))
+    (if disp-addr4
+      (set! heading-list (append heading-list (list (_ "Address 4")))))
+    (if disp-addr-phone
+      (set! heading-list (append heading-list (list (_ "Phone")))))
+    (if disp-addr-fax
+      (set! heading-list (append heading-list (list (_ "Fax")))))
+    (if disp-addr-email
+      (set! heading-list (append heading-list (list (_ "Email")))))
+    (if disp-active
+      (set! heading-list (append heading-list (list (_ "Active")))))
+
     ;; set default title
     (gnc:html-document-set-title! document report-title)
     ;; maybe redefine better...
@@ -632,8 +789,43 @@ totals to report currency.")
 						(cdr company-list-entry))))
 			       (owner (company-get-owner-obj
 				       (cdr company-list-entry)))
-			       (company-name (gncOwnerGetName owner)))
-
+			       (company-name (gncOwnerGetName owner))
+			       (addr (get-addr owner disp-addr-source))
+			       (addr-name  (gncAddressGetName  addr))
+			       (addr-addr1 (gncAddressGetAddr1 addr))
+			       (addr-addr2 (gncAddressGetAddr2 addr))
+			       (addr-addr3 (gncAddressGetAddr3 addr))
+			       (addr-addr4 (gncAddressGetAddr4 addr))
+			       (addr-phone (gncAddressGetPhone addr))
+			       (addr-fax   (gncAddressGetFax   addr))
+			       (addr-email (gncAddressGetEmail addr))
+			       (company-active (if (gncOwnerGetActive owner)
+			         (_ "Y") (_ "N")))
+			       (opt-fld-list '())
+			      )
+;;            (gnc:debug "aging-renderer: disp-addr-source=" disp-addr-source
+;;              " owner=" owner
+;;              " gncOwnerGetID="  (gncOwnerGetID owner)	;; cust no
+;;              " gncCustomerGetShipAddr="                  
+;;                (gncCustomerGetShipAddr (gncOwnerGetCustomer owner)))
+			  (if disp-addr-name
+			    (set! opt-fld-list (append opt-fld-list (list addr-name))))
+			  (if disp-addr1
+                (set! opt-fld-list (append opt-fld-list (list addr-addr1))))
+			  (if disp-addr2
+                (set! opt-fld-list (append opt-fld-list (list addr-addr2))))
+			  (if disp-addr3
+                (set! opt-fld-list (append opt-fld-list (list addr-addr3))))
+			  (if disp-addr4
+                (set! opt-fld-list (append opt-fld-list (list addr-addr4))))
+			  (if disp-addr-phone
+                (set! opt-fld-list (append opt-fld-list (list addr-phone))))
+			  (if disp-addr-fax
+                (set! opt-fld-list (append opt-fld-list (list addr-fax))))
+			  (if disp-addr-email
+                (set! opt-fld-list (append opt-fld-list (list addr-email))))
+			  (if disp-active
+                (set! opt-fld-list (append opt-fld-list (list company-active))))
 			  (add-to-column-totals total-collector-list
 						monetary-list)
 
@@ -650,13 +842,15 @@ totals to report currency.")
 				      total))
 				    rest))))
 
-			  (gnc:html-table-append-row!
-			   table (cons
-				  (gnc:make-html-text
-				   (gnc:html-markup-anchor
-				    (gnc:owner-anchor-text owner)
-				    company-name))
-				  monetary-list))
+			  (gnc:html-table-append-row! table
+			  	(append
+			  	  (cons
+				    (gnc:make-html-text
+				      (gnc:html-markup-anchor
+				        (gnc:owner-anchor-text owner)
+				        company-name))
+				    monetary-list)
+				  opt-fld-list))
 			  (gncOwnerFree owner)))
 		      company-list)
 
diff --git a/src/report/business-reports/payables.scm b/src/report/business-reports/payables.scm
index a1c87b6..feb9f07 100644
--- a/src/report/business-reports/payables.scm
+++ b/src/report/business-reports/payables.scm
@@ -37,6 +37,7 @@
 
 (define acc-page gnc:pagename-general)
 (define this-acc (N_ "Payable Account"))
+(define receivable #f)		;; receivable = #t, payable = #f
 
 (define (options-generator)    
   (let* ((options (gnc:new-options)) 
@@ -50,7 +51,7 @@
       "w" (N_ "The payable account you wish to examine.") 
       #f #f (list ACCT-TYPE-PAYABLE)))
 
-    (aging-options-generator options)))
+    (aging-options-generator options receivable)))
 
 (define (payables-renderer report-obj)
   (define (opt-val section name)
@@ -59,7 +60,7 @@
 
   (let ((payables-account (opt-val acc-page this-acc)))
     (gnc:debug "payables-account" payables-account)
-    (aging-renderer report-obj this-acc payables-account #f)))
+    (aging-renderer report-obj this-acc payables-account #f receivable)))
 
 (define payables-aging-guid "e57770f2dbca46619d6dac4ac5469b50")
 
diff --git a/src/report/business-reports/receivables.scm b/src/report/business-reports/receivables.scm
index 75adf36..325f576 100644
--- a/src/report/business-reports/receivables.scm
+++ b/src/report/business-reports/receivables.scm
@@ -37,6 +37,7 @@
 
 (define acc-page gnc:pagename-general)
 (define this-acc (N_ "Receivables Account"))
+(define receivable #t)		;; receivable = #t, payable = #f
 
 (define (options-generator)    
   (let* ((options (gnc:new-options)) 
@@ -50,7 +51,7 @@
       "w" (N_ "The receivables account you wish to examine.") 
       #f #f (list ACCT-TYPE-RECEIVABLE)))
 
-    (aging-options-generator options)))
+    (aging-options-generator options receivable)))
 
 (define (receivables-renderer report-obj)
   (define (op-value section name)
@@ -60,7 +61,7 @@
   (let* ((receivables-account (op-value acc-page this-acc)))
     (gnc:debug "receivables-account" receivables-account)
 
-    (aging-renderer report-obj this-acc receivables-account #t)))
+    (aging-renderer report-obj this-acc receivables-account #t receivable)))
 
 (define receivables-aging-guid "9cf76bed17f14401b8e3e22d0079cb98")
 



Summary of changes:
 src/report/business-reports/aging.scm       | 258 +++++++++++++++++++++++-----
 src/report/business-reports/payables.scm    |   9 +
 src/report/business-reports/receivables.scm |  21 +++
 3 files changed, 249 insertions(+), 39 deletions(-)



More information about the gnucash-changes mailing list