budget-balance-sheet.scm (gnucash-5.0.tar.bz2) | : | budget-balance-sheet.scm (gnucash-5.1.tar.bz2) | ||
---|---|---|---|---|
skipping to change at line 137 | skipping to change at line 137 | |||
(gnc-register-account-list-option options | (gnc-register-account-list-option options | |||
gnc:pagename-accounts optname-accounts | gnc:pagename-accounts optname-accounts | |||
"a" | "a" | |||
opthelp-accounts | opthelp-accounts | |||
(gnc:filter-accountlist-type | (gnc:filter-accountlist-type | |||
(list ACCT-TYPE-BANK ACCT-TYPE-CASH ACCT-TYPE-CREDIT | (list ACCT-TYPE-BANK ACCT-TYPE-CASH ACCT-TYPE-CREDIT | |||
ACCT-TYPE-ASSET ACCT-TYPE-LIABILITY | ACCT-TYPE-ASSET ACCT-TYPE-LIABILITY | |||
ACCT-TYPE-STOCK ACCT-TYPE-MUTUAL ACCT-TYPE-CURRENCY | ACCT-TYPE-STOCK ACCT-TYPE-MUTUAL ACCT-TYPE-CURRENCY | |||
ACCT-TYPE-PAYABLE ACCT-TYPE-RECEIVABLE | ACCT-TYPE-PAYABLE ACCT-TYPE-RECEIVABLE | |||
ACCT-TYPE-EQUITY ACCT-TYPE-INCOME ACCT-TYPE-EXPENSE) | ACCT-TYPE-EQUITY ACCT-TYPE-INCOME ACCT-TYPE-EXPENSE) | |||
(gnc-account-get-descendants-sorted (gnc-get-current-root-account)))) | (gnc-account-get-descendants-sorted (gnc-get-current-root-account)))) | |||
(gnc:options-add-account-levels! | (gnc:options-add-account-levels! | |||
options gnc:pagename-accounts optname-depth-limit | options gnc:pagename-accounts optname-depth-limit | |||
"b" opthelp-depth-limit 3) | "b" opthelp-depth-limit 3) | |||
(gnc-register-simple-boolean-option options | (gnc-register-simple-boolean-option options | |||
gnc:pagename-accounts optname-bottom-behavior | gnc:pagename-accounts optname-bottom-behavior | |||
"c" opthelp-bottom-behavior #f) | "c" opthelp-bottom-behavior #f) | |||
;; all about currencies | ;; all about currencies | |||
(gnc:options-add-currency! | (gnc:options-add-currency! | |||
skipping to change at line 254 | skipping to change at line 254 | |||
(define (sum-prefetched-account-balances-for-account | (define (sum-prefetched-account-balances-for-account | |||
initial-balances budget-balances account) | initial-balances budget-balances account) | |||
(let ((initial (gnc:select-assoc-account-balance initial-balances account)) | (let ((initial (gnc:select-assoc-account-balance initial-balances account)) | |||
(budget (gnc:select-assoc-account-balance budget-balances account))) | (budget (gnc:select-assoc-account-balance budget-balances account))) | |||
(and initial budget (gnc:collector+ initial budget)))) | (and initial budget (gnc:collector+ initial budget)))) | |||
(gnc:report-starting reportname) | (gnc:report-starting reportname) | |||
;; get all option's values | ;; get all option's values | |||
(let* ( | (let* ( | |||
(report-title (get-option gnc:pagename-general optname-report-title)) | (report-title (get-option gnc:pagename-general optname-report-title)) | |||
(company-name (or (gnc:company-info (gnc-get-current-book) gnc:*company- | (company-name (or (gnc:company-info (gnc-get-current-book) gnc:*company | |||
name*) "")) | -name*) "")) | |||
(budget (get-option gnc:pagename-general optname-budget)) | (budget (get-option gnc:pagename-general optname-budget)) | |||
(budget-valid? (and budget (not (null? budget)))) | (budget-valid? (and budget (not (null? budget)))) | |||
(date-t64 (if budget-valid? (gnc:budget-get-start-date budget) #f)) | (date-t64 (if budget-valid? (gnc:budget-get-start-date budget) #f)) | |||
(report-form? (get-option gnc:pagename-general | (report-form? (get-option gnc:pagename-general | |||
optname-report-form)) | optname-report-form)) | |||
(accounts (get-option gnc:pagename-accounts | (accounts (get-option gnc:pagename-accounts | |||
optname-accounts)) | optname-accounts)) | |||
(depth-limit (get-option gnc:pagename-accounts | (depth-limit (get-option gnc:pagename-accounts | |||
optname-depth-limit)) | optname-depth-limit)) | |||
(bottom-behavior (get-option gnc:pagename-accounts | (bottom-behavior (get-option gnc:pagename-accounts | |||
optname-bottom-behavior)) | optname-bottom-behavior)) | |||
(report-commodity (get-option pagename-commodities | (report-commodity (get-option pagename-commodities | |||
optname-report-commodity)) | optname-report-commodity)) | |||
(price-source (get-option pagename-commodities | (price-source (get-option pagename-commodities | |||
optname-price-source)) | optname-price-source)) | |||
(show-fcur? (get-option pagename-commodities | (show-fcur? (get-option pagename-commodities | |||
optname-show-foreign)) | optname-show-foreign)) | |||
(show-rates? (get-option pagename-commodities | (show-rates? (get-option pagename-commodities | |||
optname-show-rates)) | optname-show-rates)) | |||
(parent-balance-mode (get-option gnc:pagename-display | (parent-balance-mode (get-option gnc:pagename-display | |||
optname-parent-balance-mode)) | optname-parent-balance-mode)) | |||
(parent-total-mode | (parent-total-mode | |||
(assq-ref '((t . #t) (f . #f)) | (assq-ref '((t . #t) (f . #f)) | |||
(get-option gnc:pagename-display | (get-option gnc:pagename-display | |||
optname-parent-total-mode))) | optname-parent-total-mode))) | |||
(show-zb-accts? (get-option gnc:pagename-display | (show-zb-accts? (get-option gnc:pagename-display | |||
optname-show-zb-accts)) | optname-show-zb-accts)) | |||
(omit-zb-bals? (get-option gnc:pagename-display | (omit-zb-bals? (get-option gnc:pagename-display | |||
optname-omit-zb-bals)) | optname-omit-zb-bals)) | |||
(label-assets? (get-option gnc:pagename-display | (label-assets? (get-option gnc:pagename-display | |||
optname-label-assets)) | optname-label-assets)) | |||
(total-assets? (get-option gnc:pagename-display | (total-assets? (get-option gnc:pagename-display | |||
optname-total-assets)) | optname-total-assets)) | |||
(label-liabilities? (get-option gnc:pagename-display | (label-liabilities? (get-option gnc:pagename-display | |||
optname-label-liabilities)) | optname-label-liabilities)) | |||
(total-liabilities? (get-option gnc:pagename-display | (total-liabilities? (get-option gnc:pagename-display | |||
optname-total-liabilities)) | optname-total-liabilities)) | |||
(label-equity? (get-option gnc:pagename-display | (label-equity? (get-option gnc:pagename-display | |||
optname-label-equity)) | optname-label-equity)) | |||
(total-equity? (get-option gnc:pagename-display | (total-equity? (get-option gnc:pagename-display | |||
optname-total-equity)) | optname-total-equity)) | |||
(new-existing? (get-option gnc:pagename-display | (new-existing? (get-option gnc:pagename-display | |||
optname-new-existing)) | optname-new-existing)) | |||
(use-links? (get-option gnc:pagename-display | (use-links? (get-option gnc:pagename-display | |||
optname-account-links)) | optname-account-links)) | |||
(use-rules? (get-option gnc:pagename-display | (use-rules? (get-option gnc:pagename-display | |||
optname-use-rules)) | optname-use-rules)) | |||
;; decompose the account list | ;; decompose the account list | |||
(split-up-accounts (gnc:decompose-accountlist accounts)) | (split-up-accounts (gnc:decompose-accountlist accounts)) | |||
(asset-accounts (assoc-ref split-up-accounts ACCT-TYPE-ASSET)) | (asset-accounts (assoc-ref split-up-accounts ACCT-TYPE-ASSET)) | |||
(liability-accounts (assoc-ref split-up-accounts ACCT-TYPE-LIABILITY)) | (liability-accounts (assoc-ref split-up-accounts ACCT-TYPE-LIABILITY)) | |||
(income-accounts (assoc-ref split-up-accounts ACCT-TYPE-INCOME)) | (income-accounts (assoc-ref split-up-accounts ACCT-TYPE-INCOME)) | |||
(expense-accounts (assoc-ref split-up-accounts ACCT-TYPE-EXPENSE)) | (expense-accounts (assoc-ref split-up-accounts ACCT-TYPE-EXPENSE)) | |||
(equity-accounts (assoc-ref split-up-accounts ACCT-TYPE-EQUITY)) | (equity-accounts (assoc-ref split-up-accounts ACCT-TYPE-EQUITY)) | |||
(doc (gnc:make-html-document)) | (doc (gnc:make-html-document)) | |||
;; this can occasionally put extra (blank) columns in our | ;; this can occasionally put extra (blank) columns in our | |||
;; table (when there is one account at the maximum depth and | ;; table (when there is one account at the maximum depth and | |||
;; it has at least one of its ancestors deselected), but this | ;; it has at least one of its ancestors deselected), but this | |||
;; is the only simple way to ensure that all three tables | ;; is the only simple way to ensure that all three tables | |||
;; (asset, liability, equity) have the same width. | ;; (asset, liability, equity) have the same width. | |||
(tree-depth (if (equal? depth-limit 'all) | (tree-depth (if (equal? depth-limit 'all) | |||
(gnc:get-current-account-tree-depth) | (gnc:get-current-account-tree-depth) | |||
depth-limit)) | depth-limit)) | |||
;; exchange rates calculation parameters | ;; exchange rates calculation parameters | |||
(exchange-fn | (exchange-fn | |||
(gnc:case-exchange-fn price-source report-commodity date-t64)) | (gnc:case-exchange-fn price-source report-commodity date-t64)) | |||
(price-fn (gnc:case-price-fn price-source report-commodity date-t64))) | (price-fn (gnc:case-price-fn price-source report-commodity date-t64))) | |||
(define (add-subtotal-line table pos-label neg-label signed-balance) | (define (add-subtotal-line table pos-label neg-label signed-balance) | |||
(let* ((neg? (and signed-balance neg-label | (let* ((neg? (and signed-balance neg-label | |||
(negative? | (negative? | |||
(gnc:gnc-monetary-amount | (gnc:gnc-monetary-amount | |||
(gnc:sum-collector-commodity | (gnc:sum-collector-commodity | |||
signed-balance report-commodity exchange-fn))))) | signed-balance report-commodity exchange-fn))))) | |||
(label (if neg? (or neg-label pos-label) pos-label)) | (label (if neg? (or neg-label pos-label) pos-label)) | |||
(balance (if neg? (gnc:collector- signed-balance) signed-balance))) | (balance (if neg? (gnc:collector- signed-balance) signed-balance))) | |||
(gnc:html-table-add-labeled-amount-line! | (gnc:html-table-add-labeled-amount-line! | |||
table (* tree-depth 2) "primary-subheading" #f label 0 1 "total-label-c ell" | table (* tree-depth 2) "primary-subheading" #f label 0 1 "total-label-c ell" | |||
(gnc:sum-collector-commodity balance report-commodity exchange-fn) | (gnc:sum-collector-commodity balance report-commodity exchange-fn) | |||
(1- (* tree-depth 2)) 1 "total-number-cell"))) | (1- (* tree-depth 2)) 1 "total-number-cell"))) | |||
;; Wrapper around gnc:html-table-append-ruler! since we call it so | ;; Wrapper around gnc:html-table-append-ruler! since we call it so | |||
;; often. | ;; often. | |||
(define (add-rule table) | (define (add-rule table) | |||
(gnc:html-table-append-ruler! | (gnc:html-table-append-ruler! | |||
table (* 2 tree-depth))) | table (* 2 tree-depth))) | |||
(cond | (cond | |||
((null? accounts) | ((null? accounts) | |||
;; No accounts selected. | ;; No accounts selected. | |||
(gnc:html-document-add-object! | (gnc:html-document-add-object! | |||
doc | doc | |||
(gnc:html-make-no-account-warning | (gnc:html-make-no-account-warning | |||
reportname (gnc:report-id report-obj)))) | reportname (gnc:report-id report-obj)))) | |||
((not budget-valid?) | ((not budget-valid?) | |||
;; No budget selected. | ;; No budget selected. | |||
(gnc:html-document-add-object! | (gnc:html-document-add-object! | |||
doc (gnc:html-make-generic-budget-warning reportname))) | doc (gnc:html-make-generic-budget-warning reportname))) | |||
(else (begin | (else (begin | |||
;; Get all the balances for each of the account types. | ;; Get all the balances for each of the account types. | |||
(let* ((asset-balance #f) | (let* ((asset-balance #f) | |||
(asset-account-initial-balances #f) | (asset-account-initial-balances #f) | |||
(asset-account-budget-balances #f) | (asset-account-budget-balances #f) | |||
skipping to change at line 393 | skipping to change at line 393 | |||
(new-equity #f) | (new-equity #f) | |||
(equity-balance #f) | (equity-balance #f) | |||
(equity-get-balance-fn #f) | (equity-get-balance-fn #f) | |||
(new-retained-earnings #f) | (new-retained-earnings #f) | |||
(existing-retained-earnings #f) | (existing-retained-earnings #f) | |||
(retained-earnings #f) | (retained-earnings #f) | |||
(liability-plus-equity #f) | (liability-plus-equity #f) | |||
(table-env #f) ;; parameters for :make- | (table-env #f) ;; parameters for :make- | |||
(params #f) ;; and -add-account- | (params #f) ;; and -add-account- | |||
(asset-table #f) ;; gnc:html-acct-table | (asset-table #f) ;; gnc:html-acct-table | |||
(liability-table #f) ;; gnc:html-acct-table | (liability-table #f) ;; gnc:html-acct-table | |||
(equity-table #f) ;; gnc:html-acct-table | (equity-table #f) ;; gnc:html-acct-table | |||
;; Create the account tables below where their | ;; Create the account tables below where their | |||
;; percentage time can be tracked. | ;; percentage time can be tracked. | |||
(left-table (gnc:make-html-table)) ;; gnc:html-table | (left-table (gnc:make-html-table)) ;; gnc:html-table | |||
(right-table (if report-form? left-table | (right-table (if report-form? left-table | |||
(gnc:make-html-table))) | (gnc:make-html-table))) | |||
(budget-name (gnc-budget-get-name budget)) | (budget-name (gnc-budget-get-name budget)) | |||
) | ) | |||
(gnc:report-percent-done 4) | (gnc:report-percent-done 4) | |||
;; Get asset account balances (positive). | ;; Get asset account balances (positive). | |||
(set! asset-account-initial-balances | (set! asset-account-initial-balances | |||
(get-assoc-account-balances-budget | (get-assoc-account-balances-budget | |||
budget | budget | |||
asset-accounts | asset-accounts | |||
get-budget-account-initial-balance)) | get-budget-account-initial-balance)) | |||
(set! asset-account-budget-balances | (set! asset-account-budget-balances | |||
skipping to change at line 431 | skipping to change at line 431 | |||
asset-accounts | asset-accounts | |||
get-budget-account-budget-balance)) | get-budget-account-budget-balance)) | |||
(set! asset-get-balance-fn | (set! asset-get-balance-fn | |||
(lambda (account start-date end-date) | (lambda (account start-date end-date) | |||
(sum-prefetched-account-balances-for-account | (sum-prefetched-account-balances-for-account | |||
asset-account-initial-balances | asset-account-initial-balances | |||
asset-account-budget-balances | asset-account-budget-balances | |||
account))) | account))) | |||
(gnc:report-percent-done 6) | (gnc:report-percent-done 6) | |||
;; Get liability account balances (negative). | ;; Get liability account balances (negative). | |||
(set! liability-account-initial-balances | (set! liability-account-initial-balances | |||
(get-assoc-account-balances-budget | (get-assoc-account-balances-budget | |||
budget | budget | |||
liability-accounts | liability-accounts | |||
get-budget-account-initial-balance)) | get-budget-account-initial-balance)) | |||
(set! liability-account-budget-balances | (set! liability-account-budget-balances | |||
skipping to change at line 454 | skipping to change at line 454 | |||
liability-accounts | liability-accounts | |||
get-budget-account-budget-balance)) | get-budget-account-budget-balance)) | |||
(set! liability-get-balance-fn | (set! liability-get-balance-fn | |||
(lambda (account start-date end-date) | (lambda (account start-date end-date) | |||
(sum-prefetched-account-balances-for-account | (sum-prefetched-account-balances-for-account | |||
liability-account-initial-balances | liability-account-initial-balances | |||
liability-account-budget-balances | liability-account-budget-balances | |||
account))) | account))) | |||
(gnc:report-percent-done 8) | (gnc:report-percent-done 8) | |||
;; Get equity account balances (negative). | ;; Get equity account balances (negative). | |||
(set! equity-account-initial-balances | (set! equity-account-initial-balances | |||
(get-assoc-account-balances-budget | (get-assoc-account-balances-budget | |||
budget | budget | |||
equity-accounts | equity-accounts | |||
get-budget-account-initial-balance)) | get-budget-account-initial-balance)) | |||
(set! equity-account-budget-balances | (set! equity-account-budget-balances | |||
skipping to change at line 491 | skipping to change at line 491 | |||
(get-assoc-account-balances-total-negated liability-account-initial- balances)) | (get-assoc-account-balances-total-negated liability-account-initial- balances)) | |||
;; Budgeted liabilities are liability repayments (negative liabilities ). | ;; Budgeted liabilities are liability repayments (negative liabilities ). | |||
(set! liability-repayments | (set! liability-repayments | |||
(gnc:get-assoc-account-balances-total liability-account-budget-balan ces)) | (gnc:get-assoc-account-balances-total liability-account-budget-balan ces)) | |||
;; New liabilities are then negated liability repayments. | ;; New liabilities are then negated liability repayments. | |||
(set! new-liabilities | (set! new-liabilities | |||
(gnc:commodity-collector-get-negated liability-repayments)) | (gnc:commodity-collector-get-negated liability-repayments)) | |||
;; Total liabilities. | ;; Total liabilities. | |||
(set! liability-balance | (set! liability-balance | |||
(gnc:collector+ existing-liabilities new-liabilities)) | (gnc:collector+ existing-liabilities new-liabilities)) | |||
(gnc:report-percent-done 12) | (gnc:report-percent-done 12) | |||
;; Total existing retained earnings. | ;; Total existing retained earnings. | |||
;; existing retained earnings = initial income - initial expenses | ;; existing retained earnings = initial income - initial expenses | |||
(set! existing-retained-earnings | (set! existing-retained-earnings | |||
(gnc:collector- | (gnc:collector- | |||
(gnc:collector+ | (gnc:collector+ | |||
(gnc:budget-accountlist-get-initial-balance budget income-accounts ) | (gnc:budget-accountlist-get-initial-balance budget income-accounts ) | |||
(gnc:budget-accountlist-get-initial-balance budget expense-account s)))) | (gnc:budget-accountlist-get-initial-balance budget expense-account s)))) | |||
(gnc:report-percent-done 14) | (gnc:report-percent-done 14) | |||
;; Total new retained earnings. | ;; Total new retained earnings. | |||
(set! new-retained-earnings | (set! new-retained-earnings | |||
(gnc:collector- | (gnc:collector- | |||
(get-budget-accountlist-budget-balance budget income-accounts) | (get-budget-accountlist-budget-balance budget income-accounts) | |||
(get-budget-accountlist-budget-balance budget expense-accounts))) | (get-budget-accountlist-budget-balance budget expense-accounts))) | |||
;; Total retained earnings. | ;; Total retained earnings. | |||
(set! retained-earnings | (set! retained-earnings | |||
(gnc:collector+ existing-retained-earnings new-retained-earnings)) | (gnc:collector+ existing-retained-earnings new-retained-earnings)) | |||
(gnc:report-percent-done 16) | (gnc:report-percent-done 16) | |||
;; Total existing assets. | ;; Total existing assets. | |||
(set! existing-assets | (set! existing-assets | |||
(gnc:get-assoc-account-balances-total | (gnc:get-assoc-account-balances-total | |||
asset-account-initial-balances)) | asset-account-initial-balances)) | |||
;; Total allocated assets. | ;; Total allocated assets. | |||
(set! allocated-assets | (set! allocated-assets | |||
(gnc:get-assoc-account-balances-total | (gnc:get-assoc-account-balances-total | |||
asset-account-budget-balances)) | asset-account-budget-balances)) | |||
;; Total unallocated assets. | ;; Total unallocated assets. | |||
;; unallocated-assets = | ;; unallocated-assets = | |||
;; new-retained-earnings - allocated-assets - liability-repayments | ;; new-retained-earnings - allocated-assets - liability-repayments | |||
(set! unallocated-assets | (set! unallocated-assets | |||
(gnc:collector- new-retained-earnings | (gnc:collector- new-retained-earnings | |||
allocated-assets | allocated-assets | |||
liability-repayments)) | liability-repayments)) | |||
;; Total assets. | ;; Total assets. | |||
(set! asset-balance | (set! asset-balance | |||
(gnc:collector+ existing-assets allocated-assets unallocated-assets) ) | (gnc:collector+ existing-assets allocated-assets unallocated-assets) ) | |||
(gnc:report-percent-done 18) | (gnc:report-percent-done 18) | |||
;; Calculate unrealized gains. | ;; Calculate unrealized gains. | |||
(let* ((get-total-value-fn | (let* ((get-total-value-fn | |||
(lambda (account) | (lambda (account) | |||
(gnc:account-get-comm-value-at-date account date-t64 #f))) | (gnc:account-get-comm-value-at-date account date-t64 #f))) | |||
(asset-basis | (asset-basis | |||
(gnc:accounts-get-comm-total-assets | (gnc:accounts-get-comm-total-assets | |||
asset-accounts get-total-value-fn)) | asset-accounts get-total-value-fn)) | |||
(liability-basis | (liability-basis | |||
(gnc:collector- | (gnc:collector- | |||
(gnc:accounts-get-comm-total-assets | (gnc:accounts-get-comm-total-assets | |||
liability-accounts get-total-value-fn)))) | liability-accounts get-total-value-fn)))) | |||
(set! unrealized-gain | (set! unrealized-gain | |||
(gnc:collector- | (gnc:collector- | |||
(gnc:collector- existing-assets asset-basis) | (gnc:collector- existing-assets asset-basis) | |||
(gnc:collector- existing-liabilities liability-basis)))) | (gnc:collector- existing-liabilities liability-basis)))) | |||
(gnc:report-percent-done 22) | (gnc:report-percent-done 22) | |||
;; Total existing equity; negative. | ;; Total existing equity; negative. | |||
(set! existing-equity | (set! existing-equity | |||
(gnc:collector+ | (gnc:collector+ | |||
(get-assoc-account-balances-total-negated equity-account-initial-ba lances) | (get-assoc-account-balances-total-negated equity-account-initial-ba lances) | |||
existing-retained-earnings | existing-retained-earnings | |||
unrealized-gain)) | unrealized-gain)) | |||
;; Total new equity; positive. | ;; Total new equity; positive. | |||
(set! new-equity | (set! new-equity | |||
(gnc:collector+ | (gnc:collector+ | |||
(gnc:get-assoc-account-balances-total equity-account-budget-balance s) | (gnc:get-assoc-account-balances-total equity-account-budget-balance s) | |||
new-retained-earnings)) | new-retained-earnings)) | |||
;; Total equity. | ;; Total equity. | |||
(set! equity-balance | (set! equity-balance | |||
(gnc:collector+ existing-equity new-equity)) | (gnc:collector+ existing-equity new-equity)) | |||
;; Total liability + equity. | ;; Total liability + equity. | |||
(set! liability-plus-equity | (set! liability-plus-equity | |||
(gnc:collector+ liability-balance equity-balance)) | (gnc:collector+ liability-balance equity-balance)) | |||
(gnc:report-percent-done 30) | (gnc:report-percent-done 30) | |||
(gnc:html-document-set-title! | (gnc:html-document-set-title! | |||
doc (string-append company-name " " report-title " " budget-name)) | doc (string-append company-name " " report-title " " budget-name)) | |||
(set! table-env | (set! table-env | |||
(list | (list | |||
(list 'start-date #f) | (list 'start-date #f) | |||
(list 'end-date #f) | (list 'end-date #f) | |||
(list 'display-tree-depth tree-depth) | (list 'display-tree-depth tree-depth) | |||
(list 'depth-limit-behavior (if bottom-behavior | (list 'depth-limit-behavior (if bottom-behavior | |||
'flatten | 'flatten | |||
'summarize)) | 'summarize)) | |||
(list 'report-commodity report-commodity) | (list 'report-commodity report-commodity) | |||
(list 'exchange-fn exchange-fn) | (list 'exchange-fn exchange-fn) | |||
(list 'parent-account-subtotal-mode parent-total-mode) | (list 'parent-account-subtotal-mode parent-total-mode) | |||
(list 'zero-balance-mode (if show-zb-accts? | (list 'zero-balance-mode (if show-zb-accts? | |||
'show-leaf-acct | 'show-leaf-acct | |||
'omit-leaf-acct)) | 'omit-leaf-acct)) | |||
(list 'account-label-mode (if use-links? | (list 'account-label-mode (if use-links? | |||
'anchor | 'anchor | |||
'name)) | 'name)) | |||
) | ) | |||
) | ) | |||
(set! params | (set! params | |||
(list | (list | |||
(list 'parent-account-balance-mode parent-balance-mode) | (list 'parent-account-balance-mode parent-balance-mode) | |||
(list 'zero-balance-display-mode (if omit-zb-bals? | (list 'zero-balance-display-mode (if omit-zb-bals? | |||
'omit-balance | 'omit-balance | |||
'show-balance)) | 'show-balance)) | |||
(list 'multicommodity-mode (if show-fcur? 'table #f)) | (list 'multicommodity-mode (if show-fcur? 'table #f)) | |||
(list 'rule-mode use-rules?) | (list 'rule-mode use-rules?) | |||
) | ) | |||
) | ) | |||
(let ((space (make-list tree-depth (gnc:make-html-table-cell/min-width 60)))) | (let ((space (make-list tree-depth (gnc:make-html-table-cell/min-width 60)))) | |||
(gnc:html-table-append-row! left-table space) | (gnc:html-table-append-row! left-table space) | |||
(unless report-form? | (unless report-form? | |||
(gnc:html-table-append-row! right-table space))) | (gnc:html-table-append-row! right-table space))) | |||
(gnc:report-percent-done 80) | (gnc:report-percent-done 80) | |||
(if label-assets? (add-subtotal-line left-table (G_ "Assets") #f #f)) | (if label-assets? (add-subtotal-line left-table (G_ "Assets") #f #f)) | |||
(set! asset-table | (set! asset-table | |||
(gnc:make-html-acct-table/env/accts | (gnc:make-html-acct-table/env/accts | |||
(append table-env (list (list 'get-balance-fn asset-get-balance-fn)) ) | (append table-env (list (list 'get-balance-fn asset-get-balance-fn)) ) | |||
asset-accounts)) | asset-accounts)) | |||
(gnc:html-table-add-account-balances left-table asset-table params) | (gnc:html-table-add-account-balances left-table asset-table params) | |||
(if total-assets? | (if total-assets? | |||
(begin | (begin | |||
(if new-existing? | (if new-existing? | |||
(begin | (begin | |||
(add-subtotal-line | (add-subtotal-line | |||
left-table (G_ "Existing Assets") #f existing-assets) | left-table (G_ "Existing Assets") #f existing-assets) | |||
(add-subtotal-line | (add-subtotal-line | |||
left-table (G_ "Allocated Assets") #f allocated-assets))) | left-table (G_ "Allocated Assets") #f allocated-assets))) | |||
(if (not (gnc-commodity-collector-allzero? unallocated-assets)) | (if (not (gnc-commodity-collector-allzero? unallocated-assets)) | |||
(add-subtotal-line | (add-subtotal-line | |||
left-table (G_ "Unallocated Assets") #f unallocated-assets)) | left-table (G_ "Unallocated Assets") #f unallocated-assets)) | |||
(add-subtotal-line | (add-subtotal-line | |||
left-table (G_ "Total Assets") #f asset-balance))) | left-table (G_ "Total Assets") #f asset-balance))) | |||
(if report-form? | (if report-form? | |||
(add-rule left-table)) | (add-rule left-table)) | |||
(if report-form? | (if report-form? | |||
(add-rule left-table)) | (add-rule left-table)) | |||
(gnc:report-percent-done 85) | (gnc:report-percent-done 85) | |||
(if label-liabilities? | (if label-liabilities? | |||
(add-subtotal-line right-table (G_ "Liabilities") #f #f)) | (add-subtotal-line right-table (G_ "Liabilities") #f #f)) | |||
(set! liability-table | (set! liability-table | |||
(gnc:make-html-acct-table/env/accts | (gnc:make-html-acct-table/env/accts | |||
(append table-env | (append table-env | |||
(list (list 'get-balance-fn liability-get-balance-fn))) | (list (list 'get-balance-fn liability-get-balance-fn))) | |||
liability-accounts)) | liability-accounts)) | |||
(gnc:html-table-add-account-balances | (gnc:html-table-add-account-balances | |||
right-table liability-table params) | right-table liability-table params) | |||
(if total-liabilities? | (if total-liabilities? | |||
(begin | (begin | |||
(if new-existing? | (if new-existing? | |||
(begin | (begin | |||
(add-subtotal-line | (add-subtotal-line | |||
right-table | right-table | |||
(G_ "Existing Liabilities") | (G_ "Existing Liabilities") | |||
#f | #f | |||
existing-liabilities) | existing-liabilities) | |||
(add-subtotal-line | (add-subtotal-line | |||
right-table (G_ "New Liabilities") #f new-liabilities))) | right-table (G_ "New Liabilities") #f new-liabilities))) | |||
(add-subtotal-line | (add-subtotal-line | |||
right-table (G_ "Total Liabilities") #f liability-balance))) | right-table (G_ "Total Liabilities") #f liability-balance))) | |||
(add-rule right-table) | (add-rule right-table) | |||
(gnc:report-percent-done 88) | (gnc:report-percent-done 88) | |||
(if label-equity? | (if label-equity? | |||
(add-subtotal-line | (add-subtotal-line | |||
right-table (G_ "Equity") #f #f)) | right-table (G_ "Equity") #f #f)) | |||
(set! equity-table | (set! equity-table | |||
(gnc:make-html-acct-table/env/accts | (gnc:make-html-acct-table/env/accts | |||
(append table-env | (append table-env | |||
(list (list 'get-balance-fn equity-get-balance-fn))) | (list (list 'get-balance-fn equity-get-balance-fn))) | |||
equity-accounts)) | equity-accounts)) | |||
(gnc:html-table-add-account-balances | (gnc:html-table-add-account-balances | |||
right-table equity-table params) | right-table equity-table params) | |||
;; we omit retianed earnings from the balance report, if zero, since | ;; we omit retianed earnings from the balance report, if zero, since | |||
;; they are not present on normal balance sheets | ;; they are not present on normal balance sheets | |||
(if (not (gnc-commodity-collector-allzero? retained-earnings)) | (if (not (gnc-commodity-collector-allzero? retained-earnings)) | |||
(if new-existing? | (if new-existing? | |||
(begin | (begin | |||
(add-subtotal-line | (add-subtotal-line | |||
right-table | right-table | |||
(G_ "Existing Retained Earnings") | (G_ "Existing Retained Earnings") | |||
(G_ "Existing Retained Losses") | (G_ "Existing Retained Losses") | |||
skipping to change at line 721 | skipping to change at line 721 | |||
(G_ "Total Retained Earnings") | (G_ "Total Retained Earnings") | |||
(G_ "Total Retained Losses") | (G_ "Total Retained Losses") | |||
retained-earnings)) | retained-earnings)) | |||
(if (not (gnc-commodity-collector-allzero? unrealized-gain)) | (if (not (gnc-commodity-collector-allzero? unrealized-gain)) | |||
(add-subtotal-line right-table | (add-subtotal-line right-table | |||
(G_ "Unrealized Gains") | (G_ "Unrealized Gains") | |||
(G_ "Unrealized Losses") | (G_ "Unrealized Losses") | |||
unrealized-gain)) | unrealized-gain)) | |||
(if total-equity? | (if total-equity? | |||
(begin | (begin | |||
(if new-existing? | (if new-existing? | |||
(begin | (begin | |||
(add-subtotal-line | (add-subtotal-line | |||
right-table (G_ "Existing Equity") #f existing-equity) | right-table (G_ "Existing Equity") #f existing-equity) | |||
(add-subtotal-line | (add-subtotal-line | |||
right-table (G_ "New Equity") #f new-equity))) | right-table (G_ "New Equity") #f new-equity))) | |||
(add-subtotal-line | (add-subtotal-line | |||
right-table (G_ "Total Equity") #f equity-balance))) | right-table (G_ "Total Equity") #f equity-balance))) | |||
(add-rule right-table) | (add-rule right-table) | |||
(add-subtotal-line | (add-subtotal-line | |||
right-table | right-table | |||
(gnc:html-string-sanitize (G_ "Total Liabilities & Equity")) | (gnc:html-string-sanitize (G_ "Total Liabilities & Equity")) | |||
#f | #f | |||
liability-plus-equity) | liability-plus-equity) | |||
(gnc:html-document-add-object! | (gnc:html-document-add-object! | |||
doc | doc | |||
(if report-form? | (if report-form? | |||
left-table | left-table | |||
(let* ((build-table (gnc:make-html-table)) | (let* ((build-table (gnc:make-html-table)) | |||
) | ) | |||
(gnc:html-table-append-row! | (gnc:html-table-append-row! | |||
build-table | build-table | |||
(list | (list | |||
(gnc:make-html-table-cell left-table) | (gnc:make-html-table-cell left-table) | |||
(gnc:make-html-table-cell right-table) | (gnc:make-html-table-cell right-table) | |||
) | ) | |||
) | ) | |||
(gnc:html-table-set-style! | (gnc:html-table-set-style! | |||
build-table "td" | build-table "td" | |||
'attribute '("align" "left") | 'attribute '("align" "left") | |||
'attribute '("valign" "top")) | 'attribute '("valign" "top")) | |||
build-table | build-table | |||
) | ) | |||
) | ) | |||
) | ) | |||
;; add currency information if requested | ;; add currency information if requested | |||
(gnc:report-percent-done 90) | (gnc:report-percent-done 90) | |||
(if show-rates? | (if show-rates? | |||
(gnc:html-document-add-object! | (gnc:html-document-add-object! | |||
doc ;;(gnc:html-markup-p) | doc ;;(gnc:html-markup-p) | |||
(gnc:html-make-rates-table report-commodity price-fn accounts))) | (gnc:html-make-rates-table report-commodity price-fn accounts))) | |||
(gnc:report-percent-done 100))))) | (gnc:report-percent-done 100))))) | |||
(gnc:report-finished) | (gnc:report-finished) | |||
doc)) | doc)) | |||
(gnc:define-report | (gnc:define-report | |||
'version 1 | 'version 1 | |||
'name reportname | 'name reportname | |||
'report-guid "ecc35ea9dbfa4e20ba389fc85d59cb69" | 'report-guid "ecc35ea9dbfa4e20ba389fc85d59cb69" | |||
'menu-path (list gnc:menuname-budget) | 'menu-path (list gnc:menuname-budget) | |||
End of changes. 51 change blocks. | ||||
137 lines changed or deleted | 137 lines changed or added |