r19017 - gnucash/trunk/src/report/standard-reports - Update eguile based balance sheet report to work with current GnuCash.
Mike Alexander
mta at code.gnucash.org
Sun Apr 11 15:12:30 EDT 2010
Author: mta
Date: 2010-04-11 15:12:29 -0400 (Sun, 11 Apr 2010)
New Revision: 19017
Trac: http://svn.gnucash.org/trac/changeset/19017
Added:
gnucash/trunk/src/report/standard-reports/balsheet-eg.css
Modified:
gnucash/trunk/src/report/standard-reports/Makefile.am
gnucash/trunk/src/report/standard-reports/balsheet-eg.eguile.scm
gnucash/trunk/src/report/standard-reports/balsheet-eg.scm
Log:
Update eguile based balance sheet report to work with current GnuCash.
Modified: gnucash/trunk/src/report/standard-reports/Makefile.am
===================================================================
--- gnucash/trunk/src/report/standard-reports/Makefile.am 2010-04-11 19:05:44 UTC (rev 19016)
+++ gnucash/trunk/src/report/standard-reports/Makefile.am 2010-04-11 19:12:29 UTC (rev 19017)
@@ -20,7 +20,9 @@
gncscmmoddir = ${GNC_SHAREDIR}/guile-modules/gnucash/report/
gncscmmod_DATA = \
- standard-reports.scm
+ standard-reports.scm \
+ balsheet-eg.css \
+ balsheet-eg.eguile.scm
gncscmreportmoddir = ${GNC_SHAREDIR}/guile-modules/gnucash/report/standard-reports
gncscmreportmod_DATA = \
@@ -46,7 +48,8 @@
trial-balance.scm \
general-journal.scm \
general-ledger.scm \
- transaction.scm
+ transaction.scm \
+ balsheet-eg.scm
if GNUCASH_SEPARATE_BUILDDIR
#For executing test cases
Added: gnucash/trunk/src/report/standard-reports/balsheet-eg.css
===================================================================
--- gnucash/trunk/src/report/standard-reports/balsheet-eg.css (rev 0)
+++ gnucash/trunk/src/report/standard-reports/balsheet-eg.css 2010-04-11 19:12:29 UTC (rev 19017)
@@ -0,0 +1,59 @@
+/* Stylesheet for balsheet-eg.scm -- eguile-based Gnucash Balance Sheet report */
+
+/* Note that body and table font family and size will be overridden */
+/* by separate report options. */
+
+ body {
+ margin: 2em;
+ }
+ table.outer {
+ border-spacing: 0em;
+ }
+ table.outer tr {
+ vertical-align: top;
+ }
+ table.accounts tr {
+ vertical-align: bottom;
+ }
+ table.accounts td {
+ }
+ td {
+ padding: 0em 0.5em;
+ }
+ td.empty {
+ }
+ td.indent {
+ width: 1em;
+ }
+ td.accname {
+ text-align: left;
+ vertical-align: top;
+ }
+ td.accnametotal {
+ text-align: left;
+ vertical-align: top;
+ font-weight: bold;
+ }
+ td.balance {
+ text-align: right;
+ vertical-align: bottom;
+ }
+ td.balancetotal {
+ text-align: right;
+ vertical-align: bottom;
+ font-weight: bold;
+ }
+ td.overruled {
+ border-top: solid thin black;
+ }
+ td.ruledtotal {
+ border-top: solid thin black;
+ border-bottom: double medium black;
+ font-weight: bold;
+ vertical-align: bottom;
+ }
+ /* Negative amounts (in addition to separate 'sign' and 'braces' options */
+ .negative { color: red; }
+ /* Foreign currency amounts */
+ .foreign { font-size: smaller; font-style: italic; }
+
Property changes on: gnucash/trunk/src/report/standard-reports/balsheet-eg.css
___________________________________________________________________
Added: svn:eol-style
+ native
Modified: gnucash/trunk/src/report/standard-reports/balsheet-eg.eguile.scm
===================================================================
--- gnucash/trunk/src/report/standard-reports/balsheet-eg.eguile.scm 2010-04-11 19:05:44 UTC (rev 19016)
+++ gnucash/trunk/src/report/standard-reports/balsheet-eg.eguile.scm 2010-04-11 19:12:29 UTC (rev 19017)
@@ -166,10 +166,12 @@
(let* ((accrec-as (process-acc-list asset-accounts #f))
(accrec-li (process-acc-list liability-accounts #t))
(accrec-eq (process-acc-list equity-accounts #t))
+ (accrec-tr (process-acc-list trading-accounts #t))
(maxdepth 0)
(rshift-as 0)
(rshift-li 0)
(rshift-eq 0)
+ (rshift-tr 0)
(balancing-cc (gnc:make-commodity-collector))
(balancing-accrec (newaccrec-clean)))
(accrec-set-namelink! accrec-as (_ "Assets Accounts"))
@@ -187,6 +189,9 @@
(accrec-set-namelink! accrec-eq (_ "Equity Accounts"))
(accrec-set-placeholder?! accrec-eq #t)
(balancing-cc 'minusmerge (accrec-subtotal-cc accrec-eq) #f)
+ (accrec-set-namelink! accrec-tr (_ "Trading Accounts"))
+ (accrec-set-placeholder?! accrec-tr #t)
+ (balancing-cc 'minusmerge (accrec-subtotal-cc accrec-tr) #f)
;; Create a balancing entry
(if (not (gnc-commodity-collector-allzero? balancing-cc))
(begin
@@ -207,12 +212,16 @@
(if (and (one-depth-1 accrec-eq)
(> (accrec-treedepth accrec-eq) 1))
(set! rshift-eq 1))
+ (if (and (one-depth-1 accrec-tr)
+ (> (accrec-treedepth accrec-tr) 1))
+ (set! rshift-tr 1))
(if debugging?
(begin
(display "<p>Assets: ") (display accrec-as)
(display "<p>Liabilities: ") (display accrec-li)
- (display "<p>Equities: ") (display accrec-eq)))
+ (display "<p>Equities: ") (display accrec-eq)
+ (display "<p>Trading: ") (display accrec-tr)))
?>
<table border="0" class="outer"><tr valign="top"><td valign="top"> <!-- outer table to control columns -->
@@ -221,7 +230,8 @@
(set! maxdepth (max (accrec-treedepth accrec-as)
(accrec-treedepth accrec-li)
- (accrec-treedepth accrec-eq)))
+ (accrec-treedepth accrec-eq)
+ (accrec-treedepth accrec-tr)))
; Display assets section
(display-accounts-table-r (list accrec-as) #f maxdepth rshift-as (one-depth-1 accrec-as))
@@ -229,14 +239,14 @@
; Split table across columns if required
(case opt-columns
- ('autocols
+ ((autocols)
?>
</table>
<!-- <table border="0" align="left"><tr><td> </td></tr></table> -->
<table border="0" align="left">
<?scm
)
- ('twocols
+ ((twocols)
?>
</table></td><td valign="top"><table border="0">
<?scm
@@ -245,11 +255,13 @@
; Display liabilities and equity sections
(display-accounts-table-r (list accrec-li) #t maxdepth rshift-li (one-depth-1 accrec-li))
(hrule (* maxdepth 2))
+ (display-accounts-table-r (list accrec-tr) #t maxdepth rshift-tr (one-depth-1 accrec-tr))
+ (hrule (* maxdepth 2))
(display-accounts-table-r (list accrec-eq) #t maxdepth rshift-eq (one-depth-1 accrec-eq))
(hrule (* maxdepth 2))
(display-acc-row
maxdepth 0 0
- (_ "Total Equity and Liabilities")
+ (_ "Total Equity, Trading, and Liabilities")
(format-comm-coll-total (accrec-subtotal-cc accrec-as)) ; yes, show the assets total
#t #f)
Modified: gnucash/trunk/src/report/standard-reports/balsheet-eg.scm
===================================================================
--- gnucash/trunk/src/report/standard-reports/balsheet-eg.scm 2010-04-11 19:05:44 UTC (rev 19016)
+++ gnucash/trunk/src/report/standard-reports/balsheet-eg.scm 2010-04-11 19:12:29 UTC (rev 19017)
@@ -31,7 +31,7 @@
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;(define-module (gnucash report balsheet-eg))
+(define-module (gnucash report standard-reports balsheet-eg))
(use-modules (gnucash main))
(use-modules (gnucash gnc-module))
(use-modules (gnucash business-utils))
@@ -117,7 +117,7 @@
(define (gnc:company-info key) ; this should be in business-utils.scm soon
;; Access company info from key-value pairs for current book
(kvp-frame-get-slot-path-gslist
- (gnc-book-get-slots (gnc-get-current-book))
+ (qof-book-get-slots (gnc-get-current-book))
(append gnc:*kvp-option-path* (list gnc:*business-label* key))))
(define (add-to-cc cc com num neg?)
@@ -445,7 +445,7 @@
ACCT-TYPE-ASSET ACCT-TYPE-LIABILITY
ACCT-TYPE-STOCK ACCT-TYPE-MUTUAL ACCT-TYPE-CURRENCY
ACCT-TYPE-PAYABLE ACCT-TYPE-RECEIVABLE
- ACCT-TYPE-EQUITY )
+ ACCT-TYPE-EQUITY ACCT-TYPE-TRADING )
;ACCT-TYPE-INCOME ACCT-TYPE-EXPENSE)
(gnc-account-get-descendants-sorted (gnc-get-current-root-account))))
;; decompose the account list
@@ -456,6 +456,8 @@
(assoc-ref split-up-accounts ACCT-TYPE-LIABILITY))
(equity-accounts
(assoc-ref split-up-accounts ACCT-TYPE-EQUITY))
+ (trading-accounts
+ (assoc-ref split-up-accounts ACCT-TYPE-TRADING))
;; exchange rates calculation parameters
@@ -469,7 +471,7 @@
(coyname (or (gnc:company-info gnc:*company-name*) ""))
- (css? (and (defined? 'gnc-html-engine-supports-css) (gnc-html-engine-supports-css)))
+ (css? (gnc-html-engine-supports-css))
(html #f))
@@ -717,7 +719,7 @@
'report-guid "2e3751edeb7544e8a20fd19e9d08bb65"
'menu-name (N_ "Balance Sheet using eguile-gnc")
'menu-tip (N_ "Display a balance sheet (using eguile template)")
- 'menu-path (list gnc:menuname-business-reports)
+ 'menu-path (list gnc:menuname-asset-liability)
'options-generator balsheet-options-generator
'renderer balsheet-renderer)
More information about the gnucash-changes
mailing list