my "learn scheme" project was to support multi-splits on the account
transactions report.

I'm not sending it out as a patch because I have a bunch of budget crap
littering the file as well.

as this is my first scheme code, if you scheme experts could comment, that
would be appreciated.

for src/scm/report/transaction-report.scm
et voila,

(define (gnc:tr-report-split-to-html split-scm 
                                     starting-balance)
  (let ((other-splits (gnc:tr-report-get-other-splits split-scm))
        (report-string ""))
    (cond ((> (gnc:tr-report-get-value split-scm) 0)
           (gnc:set-total-inflow! (+ gnc:total-inflow
                                     (gnc:tr-report-get-value split-scm))))
          (else 
           (gnc:set-total-outflow! (+ gnc:total-outflow
                                      (- (gnc:tr-report-get-value split-scm))))))
    (for-each
     (lambda (split-sub first last)
       (set! report-string
             (string-append 
              report-string
              "<TR><TD>"
              (cond (first (gnc:timepair-to-datestring
                            (gnc:tr-report-get-date split-scm)))
                    (else ""))
              "</TD><TD>"
              (cond (first (gnc:tr-report-get-num split-scm))
                    (else ""))
              "</TD><TD>"
              (cond (first (gnc:tr-report-get-description split-scm))
                    (else ""))
              "</TD><TD>"
              (cond (first (gnc:tr-report-get-memo split-scm))
                    (else ""))
              "</TD><TD>"
              (car split-sub)
              "</TD><TD>"
              (cond ((< (cadr split-sub) 0)
                     (string-append
                      (sprintf #f "%.2f" (- (cadr split-sub)))
                      "</TD><TD>"))
                    (else
                     (string-append
                      "</TD><TD>"       
                      (sprintf #f "%.2f" (cadr split-sub)))))           
              "</TD>"
              (cond ((not last) "</TR>")
                    (else "")))))
     other-splits
     (append (list #t) (make-list (- (length other-splits) 1) #f))
     (append (make-list (- (length other-splits) 1) #f) (list #t)))
    (string-append
     report-string
     "<TD>"
     (sprintf #f "%.2f" (- (+ starting-balance gnc:total-inflow)
                           gnc:total-outflow))
     "</TD></TR>")))


--
Gnucash Developer's List 
To unsubscribe send empty email to: [EMAIL PROTECTED]

Reply via email to