CSV again

Vasil Vasilev vasil-gnucash at sychron.com
Tue May 18 19:29:46 EDT 2004


>> My request is to allow for optional empty cells in the report for the
>> totals. This should solve the problem the exporting of reporting into
>> "Tab Separated Values", which is more usefull IMHO than CSV as I
>> actually have commas in transaction descriptions. Tab's are very
>> easily convertable into commas too.
>
> File a bug report.  Better yet, supply a patch.  Otherwise it'll
> get added to the queue and happen eventually.

OK, very well, a patch is a attached to gnucash-1.8.8 and it seems there is no 
change to the file in 1.8.9. Excuse me if it doesn't match your coding style. 
It seems to work fine with the old behaviour being the default. I've tested 1, 
2 and 3 currencies and it seems fine. I don't know how you handle translations 
but I've done what the rest of the code arround seems to do.

BTW, the "Totals" option doesn't seem to do anything. I was going to "fix" it, 
but am not sure what that means. It seems to be superseded by the subtotals 
options and is only relevant to the Grand Total. So, to make "Totals" more 
useful will be to make it remove all subtotal and the grand total. This can be 
useful for exporting as well as otherwise I have to individually turn off the 
two subtotals and remember not to copy and paste the grand total. However, 
this is some extra work which I might do later or not. I can always have two 
separate reports - one for exporting and one for viewing.

>> PS. A while ago I've posted bug/enhancement request (bug 137017) about
>> time zone changes problem. Is there any intention to do anything about
>> it? (Yes or No will do).
>
> Of course..  Just lack of time (or interest) on the part of the
> developers.  We're all busy.  It's in the system, so we wont forget
> about it (that's why we use bugzilla).  But it can take months or
> years before some requests get handled.

Now that I've done my first coding in Schema, I might do something about
allowing entering the time of transactions and/or timezones for accounts, 
both of which have design issues: time entry requires extra space on the 
screen; time of transaction should be possible to be included in the reports; 
some accounts are fixed to timezones (e.g, bank accounts, credit cards), 
others aren't (e.g. cash and currency that you carry). Both of these are 
mostly useful for cash flow analyses and prediction.

Thanks.

Vasil
-- 
I can't decide whether to commit suicide or go bowling.
 		-- Florence Henderson
-------------- next part --------------
*** /usr/share/gnucash/guile-modules/gnucash/report/transaction.scm	2004-05-18 18:46:01.000000000 -0400
--- /usr/share/gnucash/guile-modules/gnucash/report/transaction.scm.backup	2004-05-18 16:03:58.000000000 -0400
***************
*** 55,61 ****
  (define optname-sec-subtotal (N_ "Secondary Subtotal"))
  (define optname-sec-date-subtotal (N_ "Secondary Subtotal for Date Key"))
  (define optname-void-transactions (N_ "Void Transactions?"))
- (define optname-table-export (N_ "Table for Exporting"))
  (define def:grand-total-style "grand-total")
  (define def:normal-row-style "normal-row")
  (define def:alternate-row-style "alternate-row")
--- 55,60 ----
***************
*** 171,250 ****
  
  
  (define (add-subtotal-row table width subtotal-string subtotal-collector 
!                           subtotal-style export?)
    (let ((currency-totals (subtotal-collector
                            'format gnc:make-gnc-monetary #f))
          (blanks (gnc:make-html-table-cell/size 1 (- width 1) #f)))
      (gnc:html-table-append-row/markup!
       table
       subtotal-style 
!      (if export?
!       (append! (cons (gnc:make-html-table-cell subtotal-string)
!                      (gnc:html-make-empty-cells (- width 2)))
!                (list (gnc:make-html-table-cell/markup 
!                       "total-number-cell"
!                       (car currency-totals))))
!       (list (gnc:make-html-table-cell/size 1 (- width 1)  
                                            subtotal-string)
!             (gnc:make-html-table-cell/markup
!              "total-number-cell"
!              (car currency-totals)))))
      (for-each (lambda (currency)
                  (gnc:html-table-append-row/markup! 
                   table
                   subtotal-style
!                  (append!
!                   (if export?
!                    (gnc:html-make-empty-cells (- width 1))
!                    (list blanks))
!                   (list (gnc:make-html-table-cell/markup
!                          "total-number-cell" currency)))))
                (cdr currency-totals))))
  
  (define (total-string str) (string-append (_ "Total For ") str))
  
! (define (render-account-subtotal
!          table width split total-collector subtotal-style column-vector export?)
      (add-subtotal-row table width 
                        (total-string (account-namestring (gnc:split-get-account split)
                                                          (used-sort-account-code      column-vector)
                                                          #t
                                                          (used-sort-account-full-name column-vector)))
!                       total-collector subtotal-style export?))
  
  (define (render-corresponding-account-subtotal
!          table width split total-collector subtotal-style column-vector export?)
      (add-subtotal-row table width
                        (total-string (account-namestring (gnc:split-get-account 
                                                            (gnc:split-get-other-split split))
                                                          (used-sort-account-code      column-vector)
                                                          #t
                                                          (used-sort-account-full-name column-vector)))
!                     total-collector subtotal-style export?))
  
  (define (render-month-subtotal
!          table width split total-collector subtotal-style column-vector export?)
    (let ((tm (gnc:timepair->date (gnc:transaction-get-date-posted
                                   (gnc:split-get-parent split)))))
      (add-subtotal-row table width 
                        (total-string (strftime "%B %Y" tm))
!                       total-collector subtotal-style export?)))
  
  
  (define (render-year-subtotal
!          table width split total-collector subtotal-style column-vector export?)
    (let ((tm (gnc:timepair->date (gnc:transaction-get-date-posted
                                   (gnc:split-get-parent split)))))
      (add-subtotal-row table width 
                        (total-string (strftime "%Y" tm))
!                       total-collector subtotal-style export?)))
  
  
  (define (render-grand-total
!          table width total-collector export?)
    (add-subtotal-row table width
                      (_ "Grand Total")
!                     total-collector def:grand-total-style export?))
  
  (define account-types-to-reverse-assoc-list
    (list (cons 'none '())
--- 170,240 ----
  
  
  (define (add-subtotal-row table width subtotal-string subtotal-collector 
!                           subtotal-style)
    (let ((currency-totals (subtotal-collector
                            'format gnc:make-gnc-monetary #f))
          (blanks (gnc:make-html-table-cell/size 1 (- width 1) #f)))
      (gnc:html-table-append-row/markup!
       table
       subtotal-style 
!      (list (gnc:make-html-table-cell/size 1 (- width 1) 
                                            subtotal-string)
!            (gnc:make-html-table-cell/markup 
!             "total-number-cell"
!             (car currency-totals))))
      (for-each (lambda (currency)
                  (gnc:html-table-append-row/markup! 
                   table
                   subtotal-style
!                  (cons blanks
!                          (list (gnc:make-html-table-cell/markup
!                                 "total-number-cell" currency)))))
                (cdr currency-totals))))
  
  (define (total-string str) (string-append (_ "Total For ") str))
  
! (define (render-account-subtotal 
!          table width split total-collector subtotal-style column-vector)
      (add-subtotal-row table width 
                        (total-string (account-namestring (gnc:split-get-account split)
                                                          (used-sort-account-code      column-vector)
                                                          #t
                                                          (used-sort-account-full-name column-vector)))
!                       total-collector subtotal-style))
  
  (define (render-corresponding-account-subtotal
!          table width split total-collector subtotal-style column-vector)
      (add-subtotal-row table width
                        (total-string (account-namestring (gnc:split-get-account 
                                                            (gnc:split-get-other-split split))
                                                          (used-sort-account-code      column-vector)
                                                          #t
                                                          (used-sort-account-full-name column-vector)))
!                     total-collector subtotal-style))
  
  (define (render-month-subtotal
!          table width split total-collector subtotal-style column-vector)
    (let ((tm (gnc:timepair->date (gnc:transaction-get-date-posted
                                   (gnc:split-get-parent split)))))
      (add-subtotal-row table width 
                        (total-string (strftime "%B %Y" tm))
!                       total-collector subtotal-style)))
  
  
  (define (render-year-subtotal
!          table width split total-collector subtotal-style column-vector)
    (let ((tm (gnc:timepair->date (gnc:transaction-get-date-posted
                                   (gnc:split-get-parent split)))))
      (add-subtotal-row table width 
                        (total-string (strftime "%Y" tm))
!                       total-collector subtotal-style)))
  
  
  (define (render-grand-total
!          table width total-collector)
    (add-subtotal-row table width
                      (_ "Grand Total")
!                     total-collector def:grand-total-style))
  
  (define account-types-to-reverse-assoc-list
    (list (cons 'none '())
***************
*** 495,505 ****
            (vector 'single
                    (N_ "Single")
                    (N_ "Display 1 line")))))
!   (gnc:register-trep-option
!    (gnc:make-simple-boolean-option
!     gnc:pagename-general optname-table-export
!     "e" (N_ "Formats the table suitable for cut & paste exporting with extra cells") #f))  
! 
    ;; Accounts options
    
    ;; account to do report on
--- 485,491 ----
            (vector 'single
                    (N_ "Single")
                    (N_ "Display 1 line")))))
!   
    ;; Accounts options
    
    ;; account to do report on
***************
*** 858,868 ****
            (gnc:lookup-option options gnc:pagename-general (N_ "Style")))
           'multi-line))
  
-   (define (transaction-report-export-p options)
-     (gnc:option-value
-      (gnc:lookup-option options gnc:pagename-general
-        optname-table-export)))
- 
    (define (add-other-split-rows split table used-columns
                                  row-style account-types-to-reverse)
      (define (other-rows-driver split parent table used-columns i)
--- 844,849 ----
***************
*** 885,891 ****
                                    width
                                    multi-rows?
                                    odd-row?
-                                   export?
                                    account-types-to-reverse
                                    primary-subtotal-pred
                                    secondary-subtotal-pred 
--- 866,871 ----
***************
*** 908,914 ****
              (gnc:make-html-table-cell/size
               1 width (gnc:make-html-text (gnc:html-markup-hr)))))
  
!           (render-grand-total table width total-collector export?))
  
          (let* ((current (car splits))
                 (current-row-style (if multi-rows? def:normal-row-style
--- 888,894 ----
              (gnc:make-html-table-cell/size
               1 width (gnc:make-html-text (gnc:html-markup-hr)))))
  
!           (render-grand-total table width total-collector))
  
          (let* ((current (car splits))
                 (current-row-style (if multi-rows? def:normal-row-style
***************
*** 954,966 ****
                        (secondary-subtotal-renderer
                         table width current
                         secondary-subtotal-collector
!                        def:secondary-subtotal-style used-columns export?)
                        (secondary-subtotal-collector 'reset #f #f)))
  
!                 (primary-subtotal-renderer
!                  table width current
!                  primary-subtotal-collector
!                  def:primary-subtotal-style used-columns export?)
  
                  (primary-subtotal-collector 'reset #f #f)
  
--- 934,945 ----
                        (secondary-subtotal-renderer
                         table width current
                         secondary-subtotal-collector
!                        def:secondary-subtotal-style used-columns)
                        (secondary-subtotal-collector 'reset #f #f)))
  
!                 (primary-subtotal-renderer table width current
!                                            primary-subtotal-collector
!                                            def:primary-subtotal-style used-columns)
  
                  (primary-subtotal-collector 'reset #f #f)
  
***************
*** 983,989 ****
                    (begin (secondary-subtotal-renderer
                            table width current
                            secondary-subtotal-collector
!                           def:secondary-subtotal-style used-columns export?)
                           (secondary-subtotal-collector 'reset #f #f)
                           (if next
                               (secondary-subheading-renderer
--- 962,968 ----
                    (begin (secondary-subtotal-renderer
                            table width current
                            secondary-subtotal-collector
!                           def:secondary-subtotal-style used-columns)
                           (secondary-subtotal-collector 'reset #f #f)
                           (if next
                               (secondary-subheading-renderer
***************
*** 996,1002 ****
                                    width 
                                    multi-rows?
                                    (not odd-row?)
-                                   export?
                                    account-types-to-reverse
                                    primary-subtotal-pred 
                                    secondary-subtotal-pred
--- 975,980 ----
***************
*** 1028,1035 ****
                 (car splits) table width def:secondary-subtotal-style used-columns))
  
            (do-rows-with-subtotals splits table used-columns width
!                                   multi-rows? #t
!                                   (transaction-report-export-p options)
                                    account-types-to-reverse
                                    primary-subtotal-pred
                                    secondary-subtotal-pred
--- 1006,1012 ----
                 (car splits) table width def:secondary-subtotal-style used-columns))
  
            (do-rows-with-subtotals splits table used-columns width
!                                   multi-rows? #t 
                                    account-types-to-reverse
                                    primary-subtotal-pred
                                    secondary-subtotal-pred
***************
*** 1109,1115 ****
       (cons 'monthly (vector split-same-month-p render-month-subheading 
                              render-month-subtotal))
       (cons 'yearly (vector split-same-year-p render-year-subheading
!                             render-year-subtotal))))
  
    (define (get-subtotalstuff-helper 
             name-sortkey name-subtotal name-date-subtotal
--- 1086,1092 ----
       (cons 'monthly (vector split-same-month-p render-month-subheading 
                              render-month-subtotal))
       (cons 'yearly (vector split-same-year-p render-year-subheading
!                            render-year-subtotal))))
  
    (define (get-subtotalstuff-helper 
             name-sortkey name-subtotal name-date-subtotal


More information about the gnucash-user mailing list