budget-income-statement.scm (gnucash-5.0.tar.bz2) | : | budget-income-statement.scm (gnucash-5.1.tar.bz2) | ||
---|---|---|---|---|
skipping to change at line 182 | skipping to change at line 182 | |||
;; defined globally somewhere so we could reference it here. However, it | ;; defined globally somewhere so we could reference it here. However, it | |||
;; only appears to be defined currently in src/gnome/glade/budget.glade. | ;; only appears to be defined currently in src/gnome/glade/budget.glade. | |||
1 1 60 1) | 1 1 60 1) | |||
;; accounts to work on | ;; accounts to work on | |||
(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 | |||
;; select, by default, only income and expense accounts | ;; select, by default, only income and expense accounts | |||
(list ACCT-TYPE-INCOME ACCT-TYPE-EXPENSE) | (list 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 282 | skipping to change at line 282 | |||
(get-balance-fn budget account period-start period-end)))) | (get-balance-fn budget account period-start period-end)))) | |||
(define (get-budget-account-budget-balance budget account period-start period- end) | (define (get-budget-account-budget-balance budget account period-start period- end) | |||
(let ((bal (gnc:budget-account-get-net budget account period-start period-en d))) | (let ((bal (gnc:budget-account-get-net budget account period-start period-en d))) | |||
(if (gnc-reverse-balance account) (gnc:collector- bal) bal))) | (if (gnc-reverse-balance account) (gnc:collector- bal) bal))) | |||
(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)))) | |||
(use-budget-period-range? | (use-budget-period-range? | |||
(get-option gnc:pagename-general optname-use-budget-period-range)) | (get-option gnc:pagename-general optname-use-budget-period-range)) | |||
(user-budget-period-start | (user-budget-period-start | |||
(if use-budget-period-range? | (if use-budget-period-range? | |||
(inexact->exact | (inexact->exact | |||
(truncate | (truncate | |||
(get-option gnc:pagename-general optname-budget-period-start))) | (get-option gnc:pagename-general optname-budget-period-start))) | |||
#f)) | #f)) | |||
skipping to change at line 312 | skipping to change at line 312 | |||
(period-end | (period-end | |||
(if use-budget-period-range? user-budget-period-end #f)) | (if use-budget-period-range? user-budget-period-end #f)) | |||
(date-t64 | (date-t64 | |||
(if budget-valid? | (if budget-valid? | |||
(gnc-budget-get-period-start-date | (gnc-budget-get-period-start-date | |||
budget | budget | |||
(if use-budget-period-range? period-start 0)) | (if use-budget-period-range? period-start 0)) | |||
#f)) | #f)) | |||
(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-revenue? (get-option gnc:pagename-display | (label-revenue? (get-option gnc:pagename-display | |||
optname-label-revenue)) | optname-label-revenue)) | |||
(total-revenue? (get-option gnc:pagename-display | (total-revenue? (get-option gnc:pagename-display | |||
optname-total-revenue)) | optname-total-revenue)) | |||
(label-expense? (get-option gnc:pagename-display | (label-expense? (get-option gnc:pagename-display | |||
optname-label-expense)) | optname-label-expense)) | |||
(total-expense? (get-option gnc:pagename-display | (total-expense? (get-option gnc:pagename-display | |||
optname-total-expense)) | optname-total-expense)) | |||
(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)) | |||
(two-column? (get-option gnc:pagename-display | (two-column? (get-option gnc:pagename-display | |||
optname-two-column)) | optname-two-column)) | |||
(standard-order? (get-option gnc:pagename-display | (standard-order? (get-option gnc:pagename-display | |||
optname-standard-order)) | optname-standard-order)) | |||
;; decompose the account list | ;; decompose the account list | |||
(split-up-accounts (gnc:decompose-accountlist accounts)) | (split-up-accounts (gnc:decompose-accountlist accounts)) | |||
(revenue-accounts (assoc-ref split-up-accounts ACCT-TYPE-INCOME)) | (revenue-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)) | |||
(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 both tables | ;; is the only simple way to ensure that both tables | |||
;; (revenue, expense) have the same width. | ;; (revenue, expense) 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-ce | table (* tree-depth 2) "primary-subheading" #f label 0 1 "total-label-c | |||
ll" | 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"))) | |||
(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?) | |||
skipping to change at line 405 | skipping to change at line 405 | |||
doc (gnc:html-make-generic-budget-warning report-title))) | doc (gnc:html-make-generic-budget-warning report-title))) | |||
((and use-budget-period-range? | ((and use-budget-period-range? | |||
(< user-budget-period-end user-budget-period-start)) | (< user-budget-period-end user-budget-period-start)) | |||
;; User has selected a range with end period lower than start period. | ;; User has selected a range with end period lower than start period. | |||
(gnc:html-document-add-object! | (gnc:html-document-add-object! | |||
doc (gnc:html-make-generic-simple-warning | doc (gnc:html-make-generic-simple-warning | |||
report-title | report-title | |||
(G_ "Reporting range end period cannot be less than start period.")) )) | (G_ "Reporting range end period cannot be less than start period.")) )) | |||
((and use-budget-period-range? | ||||
(< (gnc-budget-get-num-periods budget) user-budget-period-end)) | ||||
(gnc:html-document-add-object! | ||||
doc (gnc:html-make-generic-simple-warning | ||||
report-title | ||||
(G_ "Reporting range end period cannot exceed number of periods in b | ||||
udget")))) | ||||
(else | (else | |||
;; Get all the balances for each of the account types. | ;; Get all the balances for each of the account types. | |||
(let* ((revenue-account-balances | (let* ((revenue-account-balances | |||
(get-assoc-account-balances-budget | (get-assoc-account-balances-budget | |||
budget revenue-accounts period-start period-end | budget revenue-accounts period-start period-end | |||
get-budget-account-budget-balance)) | get-budget-account-budget-balance)) | |||
(expense-account-balances | (expense-account-balances | |||
(get-assoc-account-balances-budget | (get-assoc-account-balances-budget | |||
budget expense-accounts period-start period-end | budget expense-accounts period-start period-end | |||
get-budget-account-budget-balance)) | get-budget-account-budget-balance)) | |||
(revenue-total | (revenue-total | |||
(gnc:get-assoc-account-balances-total revenue-account-balances)) | (gnc:get-assoc-account-balances-total revenue-account-balances)) | |||
(expense-total | (expense-total | |||
(gnc:get-assoc-account-balances-total expense-account-balances)) | (gnc:get-assoc-account-balances-total expense-account-balances)) | |||
(net-income | (net-income | |||
(gnc:collector- revenue-total expense-total)) | (gnc:collector- | |||
(gnc:get-assoc-account-balances-total | ||||
(get-assoc-account-balances-budget | ||||
budget (append revenue-accounts expense-accounts) | ||||
period-start period-end gnc:budget-account-get-net)))) | ||||
(table-env | (table-env | |||
(list | (list | |||
(list 'display-tree-depth tree-depth) | (list 'display-tree-depth tree-depth) | |||
(list 'depth-limit-behavior | (list 'depth-limit-behavior | |||
(if bottom-behavior 'flatten 'summarize)) | (if bottom-behavior 'flatten '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 | (list 'zero-balance-mode | |||
End of changes. 19 change blocks. | ||||
47 lines changed or deleted | 59 lines changed or added |