[GNC] New report

Stephen M. Butler kg7je at arrl.net
Fri Jun 15 12:37:52 EDT 2018


Here are the changes I made:

1.  Removed the "Total" and "Total xxxx" notations.  It is obvious from
their position that they are totals and the verbiage clutters the report.

2.  We don't use trading accounts and that just bothered her sense of
the fundamental form of the report.  I removed that section.  Perhaps
you can figure out how to suppress that output if there are no such
accounts.

3.  Having the income/expense report violated the purpose of the Balance
Sheet.  So I suppressed that print out and kept the "Profit/Loss" total
to add into the Liabilities and Capital side.

4.  The P&L total wasn't included with the LC section.  So the report
was out of balance by that amount.

5.  She does want an Income statement that has this same type of
formatting.  So I broke the Income and Expense tables into two sections
(but still suppressed the output) as preparation for replicating the
code for a nicely formatted Income Statement report -- if I can figure
out how to add a new report into the system.

6.  One thing I noticed but haven't decided how to correct -- we have
top level accounts name "Assets", "Equity", "Liability", "Income", and
"Expense".  I suspect I should really remove those and promote the lower
accounts up one level to make them top level accounts of those
particular types.  However, it might be useful for the report to detect
this condition and either use those account names for the section titles
are suppress printing those top level placeholder accounts. 

Here is a diff of the relevant files in the reports directory:  -- I
will email you direct the two files with changes so you won't have to
reverse the diff statements!

root at stevelaptop:/usr/share/gnucash/scm/gnucash/report# diff
balsheet-eg.css stylesheet-reports.css

note that there were no changes -- just a file name change in
anticipation of using it also for the income/expense statement


root at stevelaptop:/usr/share/gnucash/scm/gnucash/report# diff
balsheet-eg.scm balsheet-fmtd.scm
1a2,5
> ;; balsheet-fmtd.scm
> ;; by Steve Butler  Stephen.M.Butler51 at gmail.com
> ;; modified from:
> ;;

34c38
< (define-module (gnucash report balsheet-eg))
---
> (define-module (gnucash report balsheet-fmtd))

249c253
< (define reportname (_ "Balance Sheet (eguile)"))
---
> (define reportname (_ "Balance Sheet:"))

354c358
<                                         opthelp-template-file
"balsheet-eg.eguile.scm"))
---
>                                         opthelp-template-file
"balsheet-fmtd.eguile.scm"))

356c360
<                                         opthelp-css-file
"balsheet-eg.css"))
---
>                                         opthelp-css-file
"stylesheet-reports.css"))

366c370
<                                       (N_ "(Development version --
don't rely on the numbers on this report without double-checking
them.<br>Change the 'Extra Notes' option to get rid of this message)")))
---
>                                       (N_ "")))

427,431c431,434
<          (trading-accounts
<            (assoc-ref split-up-accounts ACCT-TYPE-TRADING))
<          (income-expense-accounts
<            (append (assoc-ref split-up-accounts ACCT-TYPE-INCOME)
<                    (assoc-ref split-up-accounts ACCT-TYPE-EXPENSE)))
---
>          (income-accounts
>            (assoc-ref split-up-accounts ACCT-TYPE-INCOME))
>          (expense-accounts
>            (assoc-ref split-up-accounts ACCT-TYPE-EXPENSE))

678c681
<     (gnc:debug "balsheet-eg.scm - generated html:") (gnc:debug html)
---
>     (gnc:debug "balsheet-fmtd.scm - generated html:") (gnc:debug html)

691,693c694,696
<   'report-guid "2e3751edeb7544e8a20fd19e9d08bb65"
<   'menu-name (N_ "Balance Sheet using eguile-gnc")
<   'menu-tip (N_ "Display a balance sheet (using eguile template)")
---
>   'report-guid "e5cff0c5e1c54213899ff7f98bc9e2d7"
>   'menu-name (N_ "Balance Sheet nicely formatted")
>   'menu-tip (N_ "Display a formatted balance sheet")


Some of the changes in this next module are simply ordering of
statements so I could figure out why the report totals were not correct.

root at stevelaptop:/usr/share/gnucash/scm/gnucash/report# diff
balsheet-eg.eguile.scm balsheet-fmtd.eguile.scm
3a4,7
> ;; balsheet-fmtd.eguile.scm
> ;; by Steve Butler   Stephen.M.Butler51 at gmail.com
> ;; modified version:
> ;;

8c12
< ;; balsheet-eg.scm via the eguile mechanism.
---
> ;; balsheet-eg.scm via the eguile mechanism. -- modified to be
balsheet-fmtd.scm

120c124
<                   (string-append (_ "Total") " " (accrec-namelink accrec))
---
>                   (string-append " " )

168,169c172,173
<          (accrec-tr (process-acc-list trading-accounts #t))
<          (accrec-ie (process-acc-list income-expense-accounts #t))
---
>          (accrec-in (process-acc-list income-accounts #t))
>          (accrec-ex (process-acc-list expense-accounts #t))

174,175c178,179
<          (rshift-tr 0)
<          (rshift-ie 0)
---
>          (rshift-in 0)
>          (rshift-ex 0)

177,178c181,183
<          (etl-cc (gnc:make-commodity-collector)))
<     (accrec-set-namelink! accrec-as (_ "Assets Accounts"))
---
>          (pl-cc (gnc:make-commodity-collector))
>          (le-cc (gnc:make-commodity-collector)))
>     (accrec-set-namelink! accrec-as (_ "ASSETS:"))

180c185,192
<     (balancing-cc 'merge (accrec-subtotal-cc accrec-as) #f)
---
>     (accrec-set-namelink! accrec-li (_ "LIABILITIES:"))
>     (accrec-set-placeholder?! accrec-li #t)
>     (accrec-set-namelink! accrec-eq (_ "EQUITIES:"))
>     (accrec-set-placeholder?! accrec-eq #t)
>     (accrec-set-namelink! accrec-in (_ "INCOME:"))
>     (accrec-set-placeholder?! accrec-in #t)
>     (accrec-set-namelink! accrec-ex (_ "EXPENSE:"))
>     (accrec-set-placeholder?! accrec-ex #t)

184,186d195
<     (accrec-set-namelink! accrec-li (_ "Liability Accounts"))
<     (accrec-set-placeholder?! accrec-li #t)
<     (etl-cc 'merge (accrec-subtotal-cc accrec-li) #f)

190,202d198
<     (accrec-set-namelink! accrec-eq (_ "Equity Accounts"))
<     (accrec-set-placeholder?! accrec-eq #t)
<     (etl-cc 'merge (accrec-subtotal-cc accrec-eq) #f)
<     (accrec-set-namelink! accrec-tr (_ "Trading Accounts"))
<     (accrec-set-placeholder?! accrec-tr #t)
<     (etl-cc 'merge (accrec-subtotal-cc accrec-tr) #f)
<     (balancing-cc 'minusmerge etl-cc #f)
<     (accrec-set-namelink! accrec-ie
<                           (if (gnc-numeric-negative-p
(accrec-balance-num accrec-ie))
<                             (_ "Retained Losses")
<                             (_ "Retained Earnings")))
<     (accrec-set-placeholder?! accrec-ie #t)
<     (balancing-cc 'minusmerge (accrec-subtotal-cc accrec-ie) #f)

206,211c202,217
<     (if (and (one-depth-1 accrec-tr)
<              (> (accrec-treedepth accrec-tr) 1))
<       (set! rshift-tr 1))
<     (if (and (one-depth-1 accrec-ie)
<              (> (accrec-treedepth accrec-ie) 1))
<       (set! rshift-ie 1))
---
>     (if (and (one-depth-1 accrec-in)
>              (> (accrec-treedepth accrec-in) 1))
>       (set! rshift-in 1))
>     (if (and (one-depth-1 accrec-ex)
>              (> (accrec-treedepth accrec-ex) 1))
>       (set! rshift-ex 1))
>
>     (pl-cc 'merge (accrec-subtotal-cc accrec-in) #f)
>     (pl-cc 'merge (accrec-subtotal-cc accrec-ex) #f)
>
>     (le-cc 'merge (accrec-subtotal-cc accrec-li) #f)
>     (le-cc 'merge (accrec-subtotal-cc accrec-eq) #f)
>     (le-cc 'merge pl-cc #f)
>
>     (balancing-cc 'merge (accrec-subtotal-cc accrec-as) #f)
>     (balancing-cc 'minusmerge le-cc #f)

218,219c224,225
<       (display "<p>Trading: ") (display accrec-tr)
<       (display "<p>Profit and loss: ") (display accrec-ie)))
---
>       (display "<p>Income: ") (display accrec-in)
>       (display "<p>Expense: ") (display accrec-ex)))

229,230c235,236
<                         (accrec-treedepth accrec-ie)
<                         (accrec-treedepth accrec-tr)))
---
>                         (accrec-treedepth accrec-in)
>                         (accrec-treedepth accrec-ex)))

254,255d259
<     (display-accounts-table-r (list accrec-tr) #t maxdepth rshift-tr
(one-depth-1 accrec-tr))
<     (hrule (* maxdepth 2))

258a263,267
>       maxdepth 1 0
>       (_ "PROFIT/LOSS:")
>       (format-comm-coll-total pl-cc)
>       #t #f)
>     (display-acc-row

260,261c269,270
<       (_ "Total Equity, Trading, and Liabilities")
<       (format-comm-coll-total etl-cc)
---
>       (_ " " )
>       (format-comm-coll-total le-cc)

264,265d272
<     (display-accounts-table-r (list accrec-ie) #t maxdepth 0
(one-depth-1 accrec-ie))
<     (hrule (* maxdepth 2))

272d278root at stevelaptop:/usr/share/gnucash/scm/gnucash/report# diff
balsheet-eg.eguile.scm balsheet-fmtd.eguile.scm
3a4,7
> ;; balsheet-fmtd.eguile.scm
> ;; by Steve Butler   Stephen.M.Butler51 at gmail.com
> ;; modified version:
> ;;
8c12
< ;; balsheet-eg.scm via the eguile mechanism.
---
> ;; balsheet-eg.scm via the eguile mechanism. -- modified to be
balsheet-fmtd.scm
120c124
<                   (string-append (_ "Total") " " (accrec-namelink accrec))
---
>                   (string-append " " )
168,169c172,173
<          (accrec-tr (process-acc-list trading-accounts #t))
<          (accrec-ie (process-acc-list income-expense-accounts #t))
---
>          (accrec-in (process-acc-list income-accounts #t))
>          (accrec-ex (process-acc-list expense-accounts #t))
174,175c178,179
<          (rshift-tr 0)
<          (rshift-ie 0)
---
>          (rshift-in 0)
>          (rshift-ex 0)
177,178c181,183
<          (etl-cc (gnc:make-commodity-collector)))
<     (accrec-set-namelink! accrec-as (_ "Assets Accounts"))
---
>          (pl-cc (gnc:make-commodity-collector))
>          (le-cc (gnc:make-commodity-collector)))
>     (accrec-set-namelink! accrec-as (_ "ASSETS:"))
180c185,192
<     (balancing-cc 'merge (accrec-subtotal-cc accrec-as) #f)
---
>     (accrec-set-namelink! accrec-li (_ "LIABILITIES:"))
>     (accrec-set-placeholder?! accrec-li #t)
>     (accrec-set-namelink! accrec-eq (_ "EQUITIES:"))
>     (accrec-set-placeholder?! accrec-eq #t)
>     (accrec-set-namelink! accrec-in (_ "INCOME:"))
>     (accrec-set-placeholder?! accrec-in #t)
>     (accrec-set-namelink! accrec-ex (_ "EXPENSE:"))
>     (accrec-set-placeholder?! accrec-ex #t)
184,186d195
<     (accrec-set-namelink! accrec-li (_ "Liability Accounts"))
<     (accrec-set-placeholder?! accrec-li #t)
<     (etl-cc 'merge (accrec-subtotal-cc accrec-li) #f)
190,202d198
<     (accrec-set-namelink! accrec-eq (_ "Equity Accounts"))
<     (accrec-set-placeholder?! accrec-eq #t)
<     (etl-cc 'merge (accrec-subtotal-cc accrec-eq) #f)
<     (accrec-set-namelink! accrec-tr (_ "Trading Accounts"))
<     (accrec-set-placeholder?! accrec-tr #t)
<     (etl-cc 'merge (accrec-subtotal-cc accrec-tr) #f)
<     (balancing-cc 'minusmerge etl-cc #f)
<     (accrec-set-namelink! accrec-ie
<                           (if (gnc-numeric-negative-p
(accrec-balance-num accrec-ie))
<                             (_ "Retained Losses")
<                             (_ "Retained Earnings")))
<     (accrec-set-placeholder?! accrec-ie #t)
<     (balancing-cc 'minusmerge (accrec-subtotal-cc accrec-ie) #f)
206,211c202,217
<     (if (and (one-depth-1 accrec-tr)
<              (> (accrec-treedepth accrec-tr) 1))
<       (set! rshift-tr 1))
<     (if (and (one-depth-1 accrec-ie)
<              (> (accrec-treedepth accrec-ie) 1))
<       (set! rshift-ie 1))
---
>     (if (and (one-depth-1 accrec-in)
>              (> (accrec-treedepth accrec-in) 1))
>       (set! rshift-in 1))
>     (if (and (one-depth-1 accrec-ex)
>              (> (accrec-treedepth accrec-ex) 1))
>       (set! rshift-ex 1))
>
>     (pl-cc 'merge (accrec-subtotal-cc accrec-in) #f)
>     (pl-cc 'merge (accrec-subtotal-cc accrec-ex) #f)
>
>     (le-cc 'merge (accrec-subtotal-cc accrec-li) #f)
>     (le-cc 'merge (accrec-subtotal-cc accrec-eq) #f)
>     (le-cc 'merge pl-cc #f)
>
>     (balancing-cc 'merge (accrec-subtotal-cc accrec-as) #f)
>     (balancing-cc 'minusmerge le-cc #f)
218,219c224,225
<       (display "<p>Trading: ") (display accrec-tr)
<       (display "<p>Profit and loss: ") (display accrec-ie)))
---
>       (display "<p>Income: ") (display accrec-in)
>       (display "<p>Expense: ") (display accrec-ex)))
229,230c235,236
<                         (accrec-treedepth accrec-ie)
<                         (accrec-treedepth accrec-tr)))
---
>                         (accrec-treedepth accrec-in)
>                         (accrec-treedepth accrec-ex)))
254,255d259
<     (display-accounts-table-r (list accrec-tr) #t maxdepth rshift-tr
(one-depth-1 accrec-tr))
<     (hrule (* maxdepth 2))
258a263,267
>       maxdepth 1 0
>       (_ "PROFIT/LOSS:")
>       (format-comm-coll-total pl-cc)
>       #t #f)
>     (display-acc-row
260,261c269,270
<       (_ "Total Equity, Trading, and Liabilities")
<       (format-comm-coll-total etl-cc)
---
>       (_ " " )
>       (format-comm-coll-total le-cc)
264,265d272
<     (display-accounts-table-r (list accrec-ie) #t maxdepth 0
(one-depth-1 accrec-ie))
<     (hrule (* maxdepth 2))
272d278
<
root at stevelaptop:/usr/share/gnucash/scm/gnucash/report# diff
balsheet-eg.eguile.scm balsheet-fmtd.eguile.scm
3a4,7
> ;; balsheet-fmtd.eguile.scm
> ;; by Steve Butler   Stephen.M.Butler51 at gmail.com
> ;; modified version:
> ;;
8c12
< ;; balsheet-eg.scm via the eguile mechanism.
---
> ;; balsheet-eg.scm via the eguile mechanism. -- modified to be
balsheet-fmtd.scm
120c124
<                   (string-append (_ "Total") " " (accrec-namelink accrec))
---
>                   (string-append " " )
168,169c172,173
<          (accrec-tr (process-acc-list trading-accounts #t))
<          (accrec-ie (process-acc-list income-expense-accounts #t))
---
>          (accrec-in (process-acc-list income-accounts #t))
>          (accrec-ex (process-acc-list expense-accounts #t))
174,175c178,179
<          (rshift-tr 0)
<          (rshift-ie 0)
---
>          (rshift-in 0)
>          (rshift-ex 0)
177,178c181,183
<          (etl-cc (gnc:make-commodity-collector)))
<     (accrec-set-namelink! accrec-as (_ "Assets Accounts"))
---
>          (pl-cc (gnc:make-commodity-collector))
>          (le-cc (gnc:make-commodity-collector)))
>     (accrec-set-namelink! accrec-as (_ "ASSETS:"))
180c185,192
<     (balancing-cc 'merge (accrec-subtotal-cc accrec-as) #f)
---
>     (accrec-set-namelink! accrec-li (_ "LIABILITIES:"))
>     (accrec-set-placeholder?! accrec-li #t)
>     (accrec-set-namelink! accrec-eq (_ "EQUITIES:"))
>     (accrec-set-placeholder?! accrec-eq #t)
>     (accrec-set-namelink! accrec-in (_ "INCOME:"))
>     (accrec-set-placeholder?! accrec-in #t)
>     (accrec-set-namelink! accrec-ex (_ "EXPENSE:"))
>     (accrec-set-placeholder?! accrec-ex #t)
184,186d195
<     (accrec-set-namelink! accrec-li (_ "Liability Accounts"))
<     (accrec-set-placeholder?! accrec-li #t)
<     (etl-cc 'merge (accrec-subtotal-cc accrec-li) #f)
190,202d198
<     (accrec-set-namelink! accrec-eq (_ "Equity Accounts"))
<     (accrec-set-placeholder?! accrec-eq #t)
<     (etl-cc 'merge (accrec-subtotal-cc accrec-eq) #f)
<     (accrec-set-namelink! accrec-tr (_ "Trading Accounts"))
<     (accrec-set-placeholder?! accrec-tr #t)
<     (etl-cc 'merge (accrec-subtotal-cc accrec-tr) #f)
<     (balancing-cc 'minusmerge etl-cc #f)
<     (accrec-set-namelink! accrec-ie
<                           (if (gnc-numeric-negative-p
(accrec-balance-num accrec-ie))
<                             (_ "Retained Losses")
<                             (_ "Retained Earnings")))
<     (accrec-set-placeholder?! accrec-ie #t)
<     (balancing-cc 'minusmerge (accrec-subtotal-cc accrec-ie) #f)
206,211c202,217
<     (if (and (one-depth-1 accrec-tr)
<              (> (accrec-treedepth accrec-tr) 1))
<       (set! rshift-tr 1))
<     (if (and (one-depth-1 accrec-ie)
<              (> (accrec-treedepth accrec-ie) 1))
<       (set! rshift-ie 1))
---
>     (if (and (one-depth-1 accrec-in)
>              (> (accrec-treedepth accrec-in) 1))
>       (set! rshift-in 1))
>     (if (and (one-depth-1 accrec-ex)
>              (> (accrec-treedepth accrec-ex) 1))
>       (set! rshift-ex 1))
>
>     (pl-cc 'merge (accrec-subtotal-cc accrec-in) #f)
>     (pl-cc 'merge (accrec-subtotal-cc accrec-ex) #f)
>
>     (le-cc 'merge (accrec-subtotal-cc accrec-li) #f)
>     (le-cc 'merge (accrec-subtotal-cc accrec-eq) #f)
>     (le-cc 'merge pl-cc #f)
>
>     (balancing-cc 'merge (accrec-subtotal-cc accrec-as) #f)
>     (balancing-cc 'minusmerge le-cc #f)
218,219c224,225
<       (display "<p>Trading: ") (display accrec-tr)
<       (display "<p>Profit and loss: ") (display accrec-ie)))
---
>       (display "<p>Income: ") (display accrec-in)
>       (display "<p>Expense: ") (display accrec-ex)))
229,230c235,236
<                         (accrec-treedepth accrec-ie)
<                         (accrec-treedepth accrec-tr)))
---
>                         (accrec-treedepth accrec-in)
>                         (accrec-treedepth accrec-ex)))
254,255d259
<     (display-accounts-table-r (list accrec-tr) #t maxdepth rshift-tr
(one-depth-1 accrec-tr))
<     (hrule (* maxdepth 2))
258a263,267
>       maxdepth 1 0
>       (_ "PROFIT/LOSS:")
>       (format-comm-coll-total pl-cc)
>       #t #f)
>     (display-acc-row
260,261c269,270
<       (_ "Total Equity, Trading, and Liabilities")
<       (format-comm-coll-total etl-cc)
---
>       (_ " " )
>       (format-comm-coll-total le-cc)
264,265d272
<     (display-accounts-table-r (list accrec-ie) #t maxdepth 0
(one-depth-1 accrec-ie))
<     (hrule (* maxdepth 2))
272d278
< root at stevelaptop:/usr/share/gnucash/scm/gnucash/report# diff
balsheet-eg.eguile.scm balsheet-fmtd.eguile.scm
3a4,7
> ;; balsheet-fmtd.eguile.scm
> ;; by Steve Butler   Stephen.M.Butler51 at gmail.com
> ;; modified version:
> ;;
8c12
< ;; balsheet-eg.scm via the eguile mechanism.
---
> ;; balsheet-eg.scm via the eguile mechanism. -- modified to be
balsheet-fmtd.scm
120c124
<                   (string-append (_ "Total") " " (accrec-namelink accrec))
---
>                   (string-append " " )
168,169c172,173
<          (accrec-tr (process-acc-list trading-accounts #t))
<          (accrec-ie (process-acc-list income-expense-accounts #t))
---
>          (accrec-in (process-acc-list income-accounts #t))
>          (accrec-ex (process-acc-list expense-accounts #t))
174,175c178,179
<          (rshift-tr 0)
<          (rshift-ie 0)
---
>          (rshift-in 0)
>          (rshift-ex 0)
177,178c181,183
<          (etl-cc (gnc:make-commodity-collector)))
<     (accrec-set-namelink! accrec-as (_ "Assets Accounts"))
---
>          (pl-cc (gnc:make-commodity-collector))
>          (le-cc (gnc:make-commodity-collector)))
>     (accrec-set-namelink! accrec-as (_ "ASSETS:"))
180c185,192
<     (balancing-cc 'merge (accrec-subtotal-cc accrec-as) #f)
---
>     (accrec-set-namelink! accrec-li (_ "LIABILITIES:"))
>     (accrec-set-placeholder?! accrec-li #t)
>     (accrec-set-namelink! accrec-eq (_ "EQUITIES:"))
>     (accrec-set-placeholder?! accrec-eq #t)
>     (accrec-set-namelink! accrec-in (_ "INCOME:"))
>     (accrec-set-placeholder?! accrec-in #t)
>     (accrec-set-namelink! accrec-ex (_ "EXPENSE:"))
>     (accrec-set-placeholder?! accrec-ex #t)
184,186d195
<     (accrec-set-namelink! accrec-li (_ "Liability Accounts"))
<     (accrec-set-placeholder?! accrec-li #t)
<     (etl-cc 'merge (accrec-subtotal-cc accrec-li) #f)
190,202d198
<     (accrec-set-namelink! accrec-eq (_ "Equity Accounts"))
<     (accrec-set-placeholder?! accrec-eq #t)
<     (etl-cc 'merge (accrec-subtotal-cc accrec-eq) #f)
<     (accrec-set-namelink! accrec-tr (_ "Trading Accounts"))
<     (accrec-set-placeholder?! accrec-tr #t)
<     (etl-cc 'merge (accrec-subtotal-cc accrec-tr) #f)
<     (balancing-cc 'minusmerge etl-cc #f)
<     (accrec-set-namelink! accrec-ie
<                           (if (gnc-numeric-negative-p
(accrec-balance-num accrec-ie))
<                             (_ "Retained Losses")
<                             (_ "Retained Earnings")))
<     (accrec-set-placeholder?! accrec-ie #t)
<     (balancing-cc 'minusmerge (accrec-subtotal-cc accrec-ie) #f)
206,211c202,217
<     (if (and (one-depth-1 accrec-tr)
<              (> (accrec-treedepth accrec-tr) 1))
<       (set! rshift-tr 1))
<     (if (and (one-depth-1 accrec-ie)
<              (> (accrec-treedepth accrec-ie) 1))
<       (set! rshift-ie 1))
---
>     (if (and (one-depth-1 accrec-in)
>              (> (accrec-treedepth accrec-in) 1))
>       (set! rshift-in 1))
>     (if (and (one-depth-1 accrec-ex)
>              (> (accrec-treedepth accrec-ex) 1))
>       (set! rshift-ex 1))
>
>     (pl-cc 'merge (accrec-subtotal-cc accrec-in) #f)
>     (pl-cc 'merge (accrec-subtotal-cc accrec-ex) #f)
>
>     (le-cc 'merge (accrec-subtotal-cc accrec-li) #f)
>     (le-cc 'merge (accrec-subtotal-cc accrec-eq) #f)
>     (le-cc 'merge pl-cc #f)
>
>     (balancing-cc 'merge (accrec-subtotal-cc accrec-as)
#f)root at stevelaptop:/usr/share/gnucash/scm/gnucash/report# diff
balsheet-eg.eguile.scm balsheet-fmtd.eguile.scm
3a4,7
> ;; balsheet-fmtd.eguile.scm
> ;; by Steve Butler   Stephen.M.Butler51 at gmail.com
> ;; modified version:
> ;;
8c12
< ;; balsheet-eg.scm via the eguile mechanism.
---
> ;; balsheet-eg.scm via the eguile mechanism. -- modified to be
balsheet-fmtd.scm
120c124
<                   (string-append (_ "Total") " " (accrec-namelink accrec))
---
>                   (string-append " " )
168,169c172,173
<          (accrec-tr (process-acc-list trading-accounts #t))
<          (accrec-ie (process-acc-list income-expense-accounts #t))
---
>          (accrec-in (process-acc-list income-accounts #t))
>          (accrec-ex (process-acc-list expense-accounts #t))
174,175c178,179
<          (rshift-tr 0)
<          (rshift-ie 0)
---
>          (rshift-in 0)
>          (rshift-ex 0)
177,178c181,183
<          (etl-cc (gnc:make-commodity-collector)))
<     (accrec-set-namelink! accrec-as (_ "Assets Accounts"))
---
>          (pl-cc (gnc:make-commodity-collector))
>          (le-cc
(gnc:make-commodity-collector)))root at stevelaptop:/usr/share/gnucash/scm/gnucash/report#
diff balsheet-eg.eguile.scm balsheet-fmtd.eguile.scm
3a4,7
> ;; balsheet-fmtd.eguile.scm
> ;; by Steve Butler   Stephen.M.Butler51 at gmail.com
> ;; modified version:
> ;;
8c12
< ;; balsheet-eg.scm via the eguile mechanism.
---
> ;; balsheet-eg.scm via the eguile mechanism. -- modified to be
balsheet-fmtd.scm
120c124
<                   (string-append (_ "Total") " " (accrec-namelink accrec))
---
>                   (string-append " " )
168,169c172,173
<          (accrec-tr (process-acc-list trading-accounts #t))
<          (accrec-ie (process-acc-list income-expense-accounts #t))
---
>          (accrec-in (process-acc-list income-accounts #t))
>          (accrec-ex (process-acc-list expense-accounts #t))
174,175c178,179
<          (rshift-tr 0)
<          (rshift-ie 0)
---
>          (rshift-in 0)
>          (rshift-ex 0)
177,178c181,183
<          (etl-cc (gnc:make-commodity-collector)))
<     (accrec-set-namelink! accrec-as (_ "Assets Accounts"))
---
>          (pl-cc (gnc:make-commodity-collector))
>          (le-cc (gnc:make-commodity-collector)))
>     (accrec-set-namelink! accrec-as (_ "ASSETS:"))
180c185,192
<     (balancing-cc 'merge (accrec-subtotal-cc accrec-as) #f)
---
>     (accrec-set-namelink! accrec-li (_ "LIABILITIES:"))
>     (accrec-set-placeholder?! accrec-li #t)
>     (accrec-set-namelink! accrec-eq (_ "EQUITIES:"))
>     (accrec-set-placeholder?! accrec-eq #t)
>     (accrec-set-namelink! accrec-in (_ "INCOME:"))
>     (accrec-set-placeholder?! accrec-in #t)
>     (accrec-set-namelink! accrec-ex (_ "EXPENSE:"))
>     (accrec-set-placeholder?! accrec-ex #t)
184,186d195
<     (accrec-set-namelink! accrec-li (_ "Liability Accounts"))
<     (accrec-set-placeholder?! accrec-li #t)
<     (etl-cc 'merge (accrec-subtotal-cc accrec-li) #f)
190,202d198
<     (accrec-set-namelink! accrec-eq (_ "Equity Accounts"))
<     (accrec-set-placeholder?! accrec-eq #t)
<     (etl-cc 'merge (accrec-subtotal-cc accrec-eq) #f)
<     (accrec-set-namelink! accrec-tr (_ "Trading Accounts"))
<     (accrec-set-placeholder?! accrec-tr #t)
<     (etl-cc 'merge (accrec-subtotal-cc accrec-tr) #f)
<     (balancing-cc 'minusmerge etl-cc #f)
<     (accrec-set-namelink! accrec-ie
<                           (if (gnc-numeric-negative-p
(accrec-balance-num accrec-ie))
<                             (_ "Retained Losses")
<                             (_ "Retained Earnings")))
<     (accrec-set-placeholder?! accrec-ie #t)
<     (balancing-cc 'minusmerge (accrec-subtotal-cc accrec-ie) #f)
206,211c202,217
<     (if (and (one-depth-1 accrec-tr)
<              (> (accrec-treedepth accrec-tr) 1))
<       (set! rshift-tr 1))
<     (if (and (one-depth-1 accrec-ie)
<              (> (accrec-treedepth accrec-ie) 1))
<       (set! rshift-ie 1))
---
>     (if (and (one-depth-1 accrec-in)
>              (> (accrec-treedepth accrec-in) 1))
>       (set! rshift-in 1))
>     (if (and (one-depth-1 accrec-ex)
>              (> (accrec-treedepth accrec-ex) 1))
>       (set! rshift-ex 1))
>
>     (pl-cc 'merge (accrec-subtotal-cc accrec-in) #f)
>     (pl-cc 'merge (accrec-subtotal-cc accrec-ex)
#f)root at stevelaptop:/usr/share/gnucash/scm/gnucash/report# diff
balsheet-eg.eguile.scm balsheet-fmtd.eguile.scm
3a4,7
> ;; balsheet-fmtd.eguile.scm
> ;; by Steve Butler   Stephen.M.Butler51 at gmail.com
> ;; modified version:
> ;;
8c12
< ;; balsheet-eg.scm via the eguile mechanism.
---
> ;; balsheet-eg.scm via the eguile mechanism. -- modified to be
balsheet-fmtd.scm
120c124
<                   (string-append (_ "Total") " " (accrec-namelink accrec))
---
>                   (string-append " " )
168,169c172,173
<          (accrec-tr (process-acc-list trading-accounts #t))
<          (accrec-ie (process-acc-list income-expense-accounts #t))
---
>          (accrec-in (process-acc-list income-accounts #t))
>          (accrec-ex (process-acc-list expense-accounts #t))
174,175c178,179
<          (rshift-tr 0)
<          (rshift-ie 0)
---
>          (rshift-in 0)
>          (rshift-ex 0)
177,178c181,183
<          (etl-cc (gnc:make-commodity-collector)))
<     (accrec-set-namelink! accrec-as (_ "Assets Accounts"))
---
>          (pl-cc (gnc:make-commodity-collector))
>          (le-cc (gnc:make-commodity-collector)))
>     (accrec-set-namelink! accrec-as (_ "ASSETS:"))
180c185,192
<     (balancing-cc 'merge (accrec-subtotal-cc accrec-as) #f)
---
>     (accrec-set-namelink! accrec-li (_ "LIABILITIES:"))
>     (accrec-set-placeholder?! accrec-li #t)
>     (accrec-set-namelink! accrec-eq (_ "EQUITIES:"))
>     (accrec-set-placeholder?! accrec-eq #t)
>     (accrec-set-namelink! accrec-in (_ "INCOME:"))
>     (accrec-set-placeholder?! accrec-in #t)
>     (accrec-set-namelink! accrec-ex (_ "EXPENSE:"))
>     (accrec-set-placeholder?! accrec-ex #t)
184,186d195
<     (accrec-set-namelink! accrec-li (_ "Liability Accounts"))
<     (accrec-set-placeholder?! accrec-li #t)
<     (etl-cc 'merge (accrec-subtotal-cc accrec-li) #f)
190,202d198
<     (accrec-set-namelink! accrec-eq (_ "Equity Accounts"))
<     (accrec-set-placeholder?! accrec-eq #t)
<     (etl-cc 'merge (accrec-subtotal-cc accrec-eq) #f)
<     (accrec-set-namelink! accrec-tr (_ "Trading Accounts"))
<     (accrec-set-placeholder?! accrec-tr #t)
<     (etl-cc 'merge (accrec-subtotal-cc accrec-tr) #f)
<     (balancing-cc 'minusmerge etl-cc #f)
<     (accrec-set-namelink! accrec-ie
<                           (if (gnc-numeric-negative-p
(accrec-balance-num accrec-ie))
<                             (_ "Retained Losses")
<                             (_ "Retained Earnings")))
<     (accrec-set-placeholder?! accrec-ie #t)
<     (balancing-cc 'minusmerge (accrec-subtotal-cc accrec-ie) #f)
206,211c202,217
<     (if (and (one-depth-1 accrec-tr)
<              (> (accrec-treedepth accrec-tr) 1))
<       (set! rshift-tr 1))
<     (if (and (one-depth-1 accrec-ie)
<              (> (accrec-treedepth accrec-ie) 1))
<       (set! rshift-ie 1))
---
>     (if (and (one-depth-1 accrec-in)
>              (> (accrec-treedepth accrec-in) 1))
>       (set! rshift-in 1))
>     (if (and (one-depth-1 accrec-ex)
>              (> (accrec-treedepth accrec-ex) 1))
>       (set! rshift-ex 1))
>
>     (pl-cc 'merge (accrec-subtotal-cc accrec-in) #f)
>     (pl-cc 'merge (accrec-subtotal-cc accrec-ex) #f)
>
>     (le-cc 'merge (accrec-subtotal-cc accrec-li) #f)
>     (le-cc 'merge (accrec-subtotal-cc accrec-eq) #f)
>     (le-cc 'merge pl-cc #f)
>
>     (balancing-cc 'merge (accrec-subtotal-cc accrec-as) #f)
>     (balancing-cc 'minusmerge le-cc #f)
218,219c224,225
<       (display "<p>Trading: ") (display accrec-tr)
<       (display "<p>Profit and loss: ") (display accrec-ie)))
---
>       (display "<p>Income: ") (display accrec-in)
>       (display "<p>Expense: ") (display accrec-ex)))
229,230c235,236
<                         (accrec-treedepth accrec-ie)
<                         (accrec-treedepth accrec-tr)))
---
>                         (accrec-treedepth accrec-in)
>                         (accrec-treedepth accrec-ex)))
254,255d259
<     (display-accounts-table-r (list accrec-tr) #t maxdepth rshift-tr
(one-depth-1 accrec-tr))
<     (hrule (* maxdepth 2))
258a263,267
>       maxdepth 1 0
>       (_ "PROFIT/LOSS:")
>       (format-comm-coll-total pl-cc)
>       #t #f)
>     (display-acc-row
260,261c269,270
<       (_ "Total Equity, Trading, and Liabilities")
<       (format-comm-coll-total etl-cc)
---
>       (_ " " )
>       (format-comm-coll-total le-cc)
264,265d272
<     (display-accounts-table-r (list accrec-ie) #t maxdepth 0
(one-depth-1 accrec-ie))
<     (hrule (* maxdepth 2))
272d278
<

>
>     (le-cc 'merge (accrec-subtotal-cc accrec-li) #f)
>     (le-cc 'merge (accrec-subtotal-cc accrec-eq) #f)
>     (le-cc 'merge pl-cc #f)
>
>     (balancing-cc 'merge (accrec-subtotal-cc accrec-as) #f)
>     (balancing-cc 'minusmerge le-cc #f)
218,219c224,225
<       (display "<p>Trading: ") (display accrec-tr)
<       (display "<p>Profit and loss: ") (display accrec-ie)))
---
>       (display "<p>Income: ") (display accrec-in)
>       (display "<p>Expense: ") (display accrec-ex)))
229,230c235,236
<                         (accrec-treedepth accrec-ie)
<                         (accrec-treedepth accrec-tr)))
---
>                         (accrec-treedepth accrec-in)
>                         (accrec-treedepth accrec-ex)))
254,255d259
<     (display-accounts-table-r (list accrec-tr) #t maxdepth rshift-tr
(one-depth-1 accrec-tr))
<     (hrule (* maxdepth 2))
258a263,267
>       maxdepth 1 0
>       (_ "PROFIT/LOSS:")
>       (format-comm-coll-total pl-cc)
>       #t #f)
>     (display-acc-row
260,261c269,270
<       (_ "Total Equity, Trading, and Liabilities")
<       (format-comm-coll-total etl-cc)
---
>       (_ " " )
>       (format-comm-coll-total le-cc)
264,265d272
<     (display-accounts-table-r (list accrec-ie) #t maxdepth 0
(one-depth-1 accrec-ie))
<     (hrule (* maxdepth 2))
272d278
<

>     (accrec-set-namelink! accrec-as (_ "ASSETS:"))
180c185,192
<     (balancing-cc 'merge (accrec-subtotal-cc accrec-as) #f)
---
>     (accrec-set-namelink! accrec-li (_ "LIABILITIES:"))
>     (accrec-set-placeholder?! accrec-li #t)
>     (accrec-set-namelink! accrec-eq (_ "EQUITIES:"))
>     (accrec-set-placeholder?! accrec-eq #t)
>     (accrec-set-namelink! accrec-in (_ "INCOME:"))
>     (accrec-set-placeholder?! accrec-in #t)
>     (accrec-set-namelink! accrec-ex (_ "EXPENSE:"))
>     (accrec-set-placeholder?! accrec-ex #t)
184,186d195
<     (accrec-set-namelink! accrec-li (_ "Liability Accounts"))
<     (accrec-set-placeholder?! accrec-li #t)
<     (etl-cc 'merge (accrec-subtotal-cc accrec-li) #f)
190,202d198
<     (accrec-set-namelink! accrec-eq (_ "Equity Accounts"))
<     (accrec-set-placeholder?! accrec-eq #t)
<     (etl-cc 'merge (accrec-subtotal-cc accrec-eq) #f)
<     (accrec-set-namelink! accrec-tr (_ "Trading Accounts"))
<     (accrec-set-placeholder?! accrec-tr #t)
<     (etl-cc 'merge (accrec-subtotal-cc accrec-tr) #f)
<     (balancing-cc 'minusmerge etl-cc #f)
<     (accrec-set-namelink! accrec-ie
<                           (if (gnc-numeric-negative-p
(accrec-balance-num accrec-ie))
<                             (_ "Retained Losses")
<                             (_ "Retained Earnings")))
<     (accrec-set-placeholder?! accrec-ie #t)
<     (balancing-cc 'minusmerge (accrec-subtotal-cc accrec-ie) #f)
206,211c202,217
<     (if (and (one-depth-1 accrec-tr)
<              (> (accrec-treedepth accrec-tr) 1))
<       (set! rshift-tr 1))
<     (if (and (one-depth-1 accrec-ie)
<              (> (accrec-treedepth accrec-ie) 1))
<       (set! rshift-ie 1))
---
>     (if (and (one-depth-1 accrec-in)
>              (> (accrec-treedepth accrec-in) 1))
>       (set! rshift-in 1))
>     (if (and (one-depth-1 accrec-ex)
>              (> (accrec-treedepth accrec-ex) 1))
>       (set! rshift-ex 1))
>
>     (pl-cc 'merge (accrec-subtotal-cc accrec-in) #f)
>     (pl-cc 'merge (accrec-subtotal-cc accrec-ex) #f)
>
>     (le-cc 'merge (accrec-subtotal-cc accrec-li) #f)
>     (le-cc 'merge (accrec-subtotal-cc accrec-eq) #f)
>     (le-cc 'merge pl-cc #f)
>
>     (balancing-cc 'merge (accrec-subtotal-cc accrec-as) #f)
>     (balancing-cc 'minusmerge le-cc #f)
218,219c224,225
<       (display "<p>Trading: ") (display accrec-tr)
<       (display "<p>Profit and loss: ") (display accrec-ie)))
---
>       (display "<p>Income: ") (display accrec-in)
>       (display "<p>Expense: ") (display accrec-ex)))
229,230c235,236
<                         (accrec-treedepth accrec-ie)
<                         (accrec-treedepth accrec-tr)))
---
>                         (accrec-treedepth accrec-in)
>                         (accrec-treedepth accrec-ex)))
254,255d259
<     (display-accounts-table-r (list accrec-tr) #t maxdepth rshift-tr
(one-depth-1 accrec-tr))
<     (hrule (* maxdepth 2))
258a263,267
>       maxdepth 1 0
>       (_ "PROFIT/LOSS:")
>       (format-comm-coll-total pl-cc)
>       #t #f)
>     (display-acc-row
260,261c269,270
<       (_ "Total Equity, Trading, and Liabilities")
<       (format-comm-coll-total etl-cc)
---
>       (_ " " )
>       (format-comm-coll-total le-cc)
264,265d272
<     (display-accounts-table-r (list accrec-ie) #t maxdepth 0
(one-depth-1 accrec-ie))
<     (hrule (* maxdepth 2))
272d278
<

>     (balancing-cc 'minusmerge le-cc #f)
218,219c224,225
<       (display "<p>Trading: ") (display accrec-tr)
<       (display "<p>Profit and loss: ") (display accrec-ie)))
---
>       (display "<p>Income: ") (display accrec-in)
>       (display "<p>Expense: ") (display accrec-ex)))
229,230c235,236
<                         (accrec-treedepth accrec-ie)
<                         (accrec-treedepth accrec-tr)))
---
>                         (accrec-treedepth accrec-in)
>                         (accrec-treedepth accrec-ex)))
254,255d259
<     (display-accounts-table-r (list accrec-tr) #t maxdepth rshift-tr
(one-depth-1 accrec-tr))
<     (hrule (* maxdepth 2))
258a263,267
>       maxdepth 1 0
>       (_ "PROFIT/LOSS:")
>       (format-comm-coll-total pl-cc)
>       #t #f)
>     (display-acc-row
260,261c269,270
<       (_ "Total Equity, Trading, and Liabilities")
<       (format-comm-coll-total etl-cc)
---
>       (_ " " )
>       (format-comm-coll-total le-cc)
264,265d272
<     (display-accounts-table-r (list accrec-ie) #t maxdepth 0
(one-depth-1 accrec-ie))
<     (hrule (* maxdepth 2))
272d278
< root at stevelaptop:/usr/share/gnucash/scm/gnucash/report# diff
balsheet-eg.eguile.scm balsheet-fmtd.eguile.scm
3a4,7
> ;; balsheet-fmtd.eguile.scm
> ;; by Steve Butler   Stephen.M.Butler51 at gmail.com
> ;; modified version:
> ;;
8c12
< ;; balsheet-eg.scm via the eguile mechanism.
---
> ;; balsheet-eg.scm via the eguile mechanism. -- modified to be
balsheet-fmtd.scm
120c124
<                   (string-append (_ "Total") " " (accrec-namelink accrec))
---
>                   (string-append " " )
168,169c172,173
<          (accrec-tr (process-acc-list trading-accounts #t))
<          (accrec-ie (process-acc-list income-expense-accounts #t))
---
>          (accrec-in (process-acc-list income-accounts #t))
>          (accrec-ex (process-acc-list expense-accounts #t))
174,175c178,179
<          (rshift-tr 0)
<          (rshift-ie 0)
---
>          (rshift-in 0)
>          (rshift-ex 0)
177,178c181,183
<          (etl-cc (gnc:make-commodity-collector)))
<     (accrec-set-namelink! accrec-as (_ "Assets Accounts"))
---
>          (pl-cc (gnc:make-commodity-collector))
>          (le-cc (gnc:make-commodity-collector)))
>     (accrec-set-namelink! accrec-as (_ "ASSETS:"))
180c185,192
<     (balancing-cc 'merge (accrec-subtotal-cc accrec-as) #f)
---
>     (accrec-set-namelink! accrec-li (_ "LIABILITIES:"))
>     (accrec-set-placeholder?! accrec-li #t)
>     (accrec-set-namelink! accrec-eq (_ "EQUITIES:"))
>     (accrec-set-placeholder?! accrec-eq #t)
>     (accrec-set-namelink! accrec-in (_ "INCOME:"))
>     (accrec-set-placeholder?! accrec-in #t)
>     (accrec-set-namelink! accrec-ex (_ "EXPENSE:"))
>     (accrec-set-placeholder?! accrec-ex #t)
184,186d195
<     (accrec-set-namelink! accrec-li (_ "Liability Accounts"))
<     (accrec-set-placeholder?! accrec-li #t)
<     (etl-cc 'merge (accrec-subtotal-cc accrec-li) #f)
190,202d198
<     (accrec-set-namelink! accrec-eq (_ "Equity Accounts"))
<     (accrec-set-placeholder?! accrec-eq #t)
<     (etl-cc 'merge (accrec-subtotal-cc accrec-eq) #f)
<     (accrec-set-namelink! accrec-tr (_ "Trading Accounts"))
<     (accrec-set-placeholder?! accrec-tr #t)
<     (etl-cc 'merge (accrec-subtotal-cc accrec-tr) #f)
<     (balancing-cc 'minusmerge etl-cc #f)
<     (accrec-set-namelink! accrec-ie
<                           (if (gnc-numeric-negative-p
(accrec-balance-num accrec-ie))
<                             (_ "Retained Losses")
<                             (_ "Retained Earnings")))
<     (accrec-set-placeholder?! accrec-ie #t)
<     (balancing-cc 'minusmerge (accrec-subtotal-cc accrec-ie) #f)
206,211c202,217
<     (if (and (one-depth-1 accrec-tr)
<              (> (accrec-treedepth accrec-tr) 1))
<       (set! rshift-tr 1))
<     (if (and (one-depth-1 accrec-ie)
<              (> (accrec-treedepth accrec-ie) 1))
<       (set! rshift-ie 1))
---
>     (if (and (one-depth-1 accrec-in)
>              (> (accrec-treedepth accrec-in) 1))
>       (set! rshift-in 1))
>     (if (and (one-depth-1 accrec-ex)
>              (> (accrec-treedepth accrec-ex) 1))
>       (set! rshift-ex 1))
>
>     (pl-cc 'merge (accrec-subtotal-cc accrec-in) #f)
>     (pl-cc 'merge (accrec-subtotal-cc accrec-ex) #f)
>
>     (le-cc 'merge (accrec-subtotal-cc accrec-li) #f)
>     (le-cc 'merge (accrec-subtotal-cc accrec-eq) #f)
>     (le-cc 'merge pl-cc #f)
>
>     (balancing-cc 'merge (accrec-subtotal-cc accrec-as) #f)
>     (balancing-cc 'minusmerge le-cc #f)
218,219c224,225
<       (display "<p>Trading: ") (display accrec-tr)
<       (display "<p>Profit and loss: ") (display accrec-ie)))
---
>       (display "<p>Income: ") (display accrec-in)
>       (display "<p>Expense: ") (display accrec-ex)))
229,230c235,236
<                         (accrec-treedepth accrec-ie)
<                         (accrec-treedepth accrec-tr)))
---
>                         (accrec-treedepth accrec-in)
>                         (accrec-treedepth accrec-ex)))
254,255d259
<     (display-accounts-table-r (list accrec-tr) #t maxdepth rshift-tr
(one-depth-1 accrec-tr))
<     (hrule (* maxdepth 2))
258a263,267
>       maxdepth 1 0
>       (_ "PROFIT/LOSS:")
>       (format-comm-coll-total pl-cc)
>       #t #f)
>     (display-acc-row
260,261c269,270
<       (_ "Total Equity, Trading, and Liabilities")
<       (format-comm-coll-total etl-cc)
---
>       (_ " " )
>       (format-comm-coll-total le-cc)
264,265d272
<     (display-accounts-table-r (list accrec-ie) #t maxdepth 0
(one-depth-1 accrec-ie))
<     (hrule (* maxdepth 2))
272d278
<



<




More information about the gnucash-user mailing list