mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
reports/example/* untabify/delete-trailing-whitespace
This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
;; average-balance.scm
|
;; average-balance.scm
|
||||||
;; Report history of account balance and other info
|
;; Report history of account balance and other info
|
||||||
;;
|
;;
|
||||||
;; Author makes no implicit or explicit guarantee of accuracy of
|
;; Author makes no implicit or explicit guarantee of accuracy of
|
||||||
;; these calculations and accepts no responsibility for direct
|
;; these calculations and accepts no responsibility for direct
|
||||||
;; or indirect losses incurred as a result of using this software.
|
;; or indirect losses incurred as a result of using this software.
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
@@ -86,7 +86,7 @@
|
|||||||
"c" (N_ "Do transaction report on this account.")
|
"c" (N_ "Do transaction report on this account.")
|
||||||
(let ((current-accounts '()))
|
(let ((current-accounts '()))
|
||||||
;; If some accounts were selected, use those
|
;; If some accounts were selected, use those
|
||||||
(cond ((not (null? current-accounts))
|
(cond ((not (null? current-accounts))
|
||||||
current-accounts)
|
current-accounts)
|
||||||
(else
|
(else
|
||||||
;; otherwise get some accounts -- here as an
|
;; otherwise get some accounts -- here as an
|
||||||
@@ -112,7 +112,7 @@
|
|||||||
(gnc-register-list-option options
|
(gnc-register-list-option options
|
||||||
gnc:pagename-display (N_ "Plot Type")
|
gnc:pagename-display (N_ "Plot Type")
|
||||||
"c" (N_ "The type of graph to generate.") "AvgBalPlot"
|
"c" (N_ "The type of graph to generate.") "AvgBalPlot"
|
||||||
(list
|
(list
|
||||||
(vector 'AvgBalPlot (N_ "Average"))
|
(vector 'AvgBalPlot (N_ "Average"))
|
||||||
(vector 'GainPlot (N_ "Profit"))
|
(vector 'GainPlot (N_ "Profit"))
|
||||||
(vector 'GLPlot (N_ "Gain/Loss"))))
|
(vector 'GLPlot (N_ "Gain/Loss"))))
|
||||||
@@ -127,14 +127,14 @@
|
|||||||
options))
|
options))
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;; Some utilities for generating the data
|
;; Some utilities for generating the data
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
(define columns
|
(define columns
|
||||||
;; Watch out -- these names should be consistent with the display
|
;; Watch out -- these names should be consistent with the display
|
||||||
;; option where you choose them, otherwise users are confused.
|
;; option where you choose them, otherwise users are confused.
|
||||||
(list (G_ "Period start") (G_ "Period end") (G_ "Average")
|
(list (G_ "Period start") (G_ "Period end") (G_ "Average")
|
||||||
(G_ "Maximum") (G_ "Minimum") (G_ "Gain")
|
(G_ "Maximum") (G_ "Minimum") (G_ "Gain")
|
||||||
(G_ "Loss") (G_ "Profit") ))
|
(G_ "Loss") (G_ "Profit") ))
|
||||||
|
|
||||||
|
|
||||||
@@ -263,17 +263,17 @@
|
|||||||
(gnc-optiondb-lookup-value (gnc:report-options report-obj) section name))
|
(gnc-optiondb-lookup-value (gnc:report-options report-obj) section name))
|
||||||
|
|
||||||
(gnc:report-starting reportname)
|
(gnc:report-starting reportname)
|
||||||
(let* ((report-title (get-option gnc:pagename-general
|
(let* ((report-title (get-option gnc:pagename-general
|
||||||
gnc:optname-reportname))
|
gnc:optname-reportname))
|
||||||
(begindate (gnc:time64-start-day-time
|
(begindate (gnc:time64-start-day-time
|
||||||
(gnc:date-option-absolute-time
|
(gnc:date-option-absolute-time
|
||||||
(get-option gnc:pagename-general optname-from-date))))
|
(get-option gnc:pagename-general optname-from-date))))
|
||||||
(enddate (gnc:time64-end-day-time
|
(enddate (gnc:time64-end-day-time
|
||||||
(gnc:date-option-absolute-time
|
(gnc:date-option-absolute-time
|
||||||
(get-option gnc:pagename-general optname-to-date))))
|
(get-option gnc:pagename-general optname-to-date))))
|
||||||
(stepsize (gnc:deltasym-to-delta
|
(stepsize (gnc:deltasym-to-delta
|
||||||
(get-option gnc:pagename-general optname-stepsize)))
|
(get-option gnc:pagename-general optname-stepsize)))
|
||||||
(report-currency (get-option gnc:pagename-general
|
(report-currency (get-option gnc:pagename-general
|
||||||
optname-report-currency))
|
optname-report-currency))
|
||||||
(price-source (get-option gnc:pagename-general
|
(price-source (get-option gnc:pagename-general
|
||||||
optname-price-source))
|
optname-price-source))
|
||||||
@@ -290,8 +290,8 @@
|
|||||||
|
|
||||||
(document (gnc:make-html-document))
|
(document (gnc:make-html-document))
|
||||||
|
|
||||||
(commodity-list #f)
|
(commodity-list #f)
|
||||||
(exchange-fn #f)
|
(exchange-fn #f)
|
||||||
(all-zeros? #t))
|
(all-zeros? #t))
|
||||||
|
|
||||||
;;(warn commodity-list)
|
;;(warn commodity-list)
|
||||||
@@ -307,40 +307,40 @@
|
|||||||
;; routine needs to send progress reports, or the price
|
;; routine needs to send progress reports, or the price
|
||||||
;; lookup should be distributed and done when actually
|
;; lookup should be distributed and done when actually
|
||||||
;; needed so as to amortize the cpu time properly.
|
;; needed so as to amortize the cpu time properly.
|
||||||
(gnc:report-percent-done 1)
|
(gnc:report-percent-done 1)
|
||||||
(set! commodity-list (gnc:accounts-get-commodities
|
(set! commodity-list (gnc:accounts-get-commodities
|
||||||
accounts report-currency))
|
accounts report-currency))
|
||||||
|
|
||||||
(gnc:report-percent-done 5)
|
(gnc:report-percent-done 5)
|
||||||
(set! exchange-fn (gnc:case-exchange-time-fn
|
(set! exchange-fn (gnc:case-exchange-time-fn
|
||||||
price-source report-currency
|
price-source report-currency
|
||||||
commodity-list enddate
|
commodity-list enddate
|
||||||
5 20))
|
5 20))
|
||||||
(gnc:report-percent-done 20)
|
(gnc:report-percent-done 20)
|
||||||
|
|
||||||
;; initialize the query to find splits in the right
|
;; initialize the query to find splits in the right
|
||||||
;; date range and accounts
|
;; date range and accounts
|
||||||
(qof-query-set-book query (gnc-get-current-book))
|
(qof-query-set-book query (gnc-get-current-book))
|
||||||
|
|
||||||
;; for balance purposes, we don't need to do this, but it cleans up
|
;; for balance purposes, we don't need to do this, but it cleans up
|
||||||
;; the table display.
|
;; the table display.
|
||||||
(xaccQueryAddClearedMatch
|
(xaccQueryAddClearedMatch
|
||||||
query (logand CLEARED-ALL (lognot CLEARED-VOIDED)) QOF-QUERY-AND)
|
query (logand CLEARED-ALL (lognot CLEARED-VOIDED)) QOF-QUERY-AND)
|
||||||
;; add accounts to the query (include subaccounts
|
;; add accounts to the query (include subaccounts
|
||||||
;; if requested)
|
;; if requested)
|
||||||
(gnc:report-percent-done 25)
|
(gnc:report-percent-done 25)
|
||||||
|
|
||||||
(xaccQueryAddAccountMatch query accounts QOF-GUID-MATCH-ANY QOF-QUERY-AND)
|
(xaccQueryAddAccountMatch query accounts QOF-GUID-MATCH-ANY QOF-QUERY-AND)
|
||||||
|
|
||||||
;; match splits between start and end dates
|
;; match splits between start and end dates
|
||||||
(xaccQueryAddDateMatchTT
|
(xaccQueryAddDateMatchTT
|
||||||
query #t begindate #t enddate QOF-QUERY-AND)
|
query #t begindate #t enddate QOF-QUERY-AND)
|
||||||
(qof-query-set-sort-order query
|
(qof-query-set-sort-order query
|
||||||
(list SPLIT-TRANS TRANS-DATE-POSTED)
|
(list SPLIT-TRANS TRANS-DATE-POSTED)
|
||||||
(list QUERY-DEFAULT-SORT)
|
(list QUERY-DEFAULT-SORT)
|
||||||
'())
|
'())
|
||||||
|
|
||||||
(gnc:report-percent-done 40)
|
(gnc:report-percent-done 40)
|
||||||
|
|
||||||
(let* ((splits (qof-query-run query))
|
(let* ((splits (qof-query-run query))
|
||||||
(daily-dates (gnc:make-date-list begindate enddate DayDelta))
|
(daily-dates (gnc:make-date-list begindate enddate DayDelta))
|
||||||
@@ -380,9 +380,9 @@
|
|||||||
internal-included exchange-fn report-currency))))
|
internal-included exchange-fn report-currency))))
|
||||||
|
|
||||||
(gnc:report-percent-done 70)
|
(gnc:report-percent-done 70)
|
||||||
|
|
||||||
;; make a plot (optionally)... if both plot and table,
|
;; make a plot (optionally)... if both plot and table,
|
||||||
;; plot comes first.
|
;; plot comes first.
|
||||||
(if show-plot?
|
(if show-plot?
|
||||||
(let ((barchart (gnc:make-html-chart))
|
(let ((barchart (gnc:make-html-chart))
|
||||||
(height (get-option gnc:pagename-display optname-plot-height))
|
(height (get-option gnc:pagename-display optname-plot-height))
|
||||||
@@ -391,7 +391,7 @@
|
|||||||
(if (memq 'AvgBalPlot plot-type)
|
(if (memq 'AvgBalPlot plot-type)
|
||||||
(let
|
(let
|
||||||
((number-data
|
((number-data
|
||||||
(map
|
(map
|
||||||
(lambda (row) (list-ref row 2)) data)))
|
(lambda (row) (list-ref row 2)) data)))
|
||||||
(if (not (every zero? number-data))
|
(if (not (every zero? number-data))
|
||||||
(begin
|
(begin
|
||||||
@@ -402,7 +402,7 @@
|
|||||||
(set! all-zeros? #f)))))
|
(set! all-zeros? #f)))))
|
||||||
|
|
||||||
(if (memq 'GainPlot plot-type)
|
(if (memq 'GainPlot plot-type)
|
||||||
(let ((number-data
|
(let ((number-data
|
||||||
(map (lambda (row) (list-ref row 7)) data)))
|
(map (lambda (row) (list-ref row 7)) data)))
|
||||||
(if (not (every zero? number-data))
|
(if (not (every zero? number-data))
|
||||||
(begin
|
(begin
|
||||||
@@ -413,11 +413,11 @@
|
|||||||
(set! all-zeros? #f)))))
|
(set! all-zeros? #f)))))
|
||||||
|
|
||||||
(if (memq 'GLPlot plot-type)
|
(if (memq 'GLPlot plot-type)
|
||||||
(let ((debit-data
|
(let ((debit-data
|
||||||
(map (lambda (row) (list-ref row 5)) data))
|
(map (lambda (row) (list-ref row 5)) data))
|
||||||
(credit-data
|
(credit-data
|
||||||
(map (lambda (row) (list-ref row 6)) data)))
|
(map (lambda (row) (list-ref row 6)) data)))
|
||||||
;; debit column
|
;; debit column
|
||||||
(if (not (and
|
(if (not (and
|
||||||
(every zero? debit-data)
|
(every zero? debit-data)
|
||||||
(every zero? credit-data)))
|
(every zero? credit-data)))
|
||||||
@@ -431,7 +431,7 @@
|
|||||||
credit-data
|
credit-data
|
||||||
"#FF4136")
|
"#FF4136")
|
||||||
(set! all-zeros? #f)))))
|
(set! all-zeros? #f)))))
|
||||||
|
|
||||||
(if (not all-zeros?)
|
(if (not all-zeros?)
|
||||||
(begin
|
(begin
|
||||||
(gnc:html-chart-set-currency-iso!
|
(gnc:html-chart-set-currency-iso!
|
||||||
@@ -447,12 +447,12 @@
|
|||||||
(gnc:html-document-add-object! document barchart))
|
(gnc:html-document-add-object! document barchart))
|
||||||
(gnc:html-document-add-object!
|
(gnc:html-document-add-object!
|
||||||
document
|
document
|
||||||
(gnc:html-make-empty-data-warning
|
(gnc:html-make-empty-data-warning
|
||||||
report-title (gnc:report-id report-obj))))))
|
report-title (gnc:report-id report-obj))))))
|
||||||
|
|
||||||
;; make a table (optionally)
|
;; make a table (optionally)
|
||||||
(gnc:report-percent-done 80)
|
(gnc:report-percent-done 80)
|
||||||
(if show-table?
|
(if show-table?
|
||||||
(let ((table (gnc:make-html-table))
|
(let ((table (gnc:make-html-table))
|
||||||
(scu (gnc-commodity-get-fraction report-currency)))
|
(scu (gnc-commodity-get-fraction report-currency)))
|
||||||
(gnc:html-table-set-col-headers!
|
(gnc:html-table-set-col-headers!
|
||||||
@@ -478,10 +478,10 @@
|
|||||||
(gnc:html-document-add-object! document table))))
|
(gnc:html-document-add-object! document table))))
|
||||||
|
|
||||||
;; if there are no accounts selected...
|
;; if there are no accounts selected...
|
||||||
(gnc:html-document-add-object!
|
(gnc:html-document-add-object!
|
||||||
document
|
document
|
||||||
(gnc:html-make-no-account-warning
|
(gnc:html-make-no-account-warning
|
||||||
report-title (gnc:report-id report-obj))))
|
report-title (gnc:report-id report-obj))))
|
||||||
(gnc:report-finished)
|
(gnc:report-finished)
|
||||||
document))
|
document))
|
||||||
|
|
||||||
|
|||||||
@@ -6,16 +6,16 @@
|
|||||||
;; based on account-piecharts.scm by Robert Merkel (rgmerk@mira.net)
|
;; based on account-piecharts.scm by Robert Merkel (rgmerk@mira.net)
|
||||||
;; and Christian Stimming <stimming@tu-harburg.de>
|
;; and Christian Stimming <stimming@tu-harburg.de>
|
||||||
;;
|
;;
|
||||||
;; This program is free software; you can redistribute it and/or
|
;; This program is free software; you can redistribute it and/or
|
||||||
;; modify it under the terms of the GNU General Public License as
|
;; modify it under the terms of the GNU General Public License as
|
||||||
;; published by the Free Software Foundation; either version 2 of
|
;; published by the Free Software Foundation; either version 2 of
|
||||||
;; the License, or (at your option) any later version.
|
;; the License, or (at your option) any later version.
|
||||||
;;
|
;;
|
||||||
;; This program is distributed in the hope that it will be useful,
|
;; This program is distributed in the hope that it will be useful,
|
||||||
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
;; GNU General Public License for more details.
|
;; GNU General Public License for more details.
|
||||||
;;
|
;;
|
||||||
;; You should have received a copy of the GNU General Public License
|
;; You should have received a copy of the GNU General Public License
|
||||||
;; along with this program; if not, contact:
|
;; along with this program; if not, contact:
|
||||||
;;
|
;;
|
||||||
@@ -40,7 +40,7 @@
|
|||||||
;; The menu statusbar tips.
|
;; The menu statusbar tips.
|
||||||
(define menutip-income
|
(define menutip-income
|
||||||
(N_ "Shows a piechart with the total income for each day of the week"))
|
(N_ "Shows a piechart with the total income for each day of the week"))
|
||||||
(define menutip-expense
|
(define menutip-expense
|
||||||
(N_ "Shows a piechart with the total expenses for each day of the week"))
|
(N_ "Shows a piechart with the total expenses for each day of the week"))
|
||||||
|
|
||||||
;; The names here are used 1. for internal identification, 2. as
|
;; The names here are used 1. for internal identification, 2. as
|
||||||
@@ -171,8 +171,8 @@
|
|||||||
;; routine needs to send progress reports, or the price
|
;; routine needs to send progress reports, or the price
|
||||||
;; lookup should be distributed and done when actually
|
;; lookup should be distributed and done when actually
|
||||||
;; needed so as to amortize the cpu time properly.
|
;; needed so as to amortize the cpu time properly.
|
||||||
(gnc:report-percent-done 1)
|
(gnc:report-percent-done 1)
|
||||||
(set! commodity-list (gnc:accounts-get-commodities
|
(set! commodity-list (gnc:accounts-get-commodities
|
||||||
(gnc-accounts-and-all-descendants accounts)
|
(gnc-accounts-and-all-descendants accounts)
|
||||||
report-currency))
|
report-currency))
|
||||||
(gnc:report-percent-done 5)
|
(gnc:report-percent-done 5)
|
||||||
@@ -212,7 +212,7 @@
|
|||||||
;; get the query results
|
;; get the query results
|
||||||
(set! splits (qof-query-run query))
|
(set! splits (qof-query-run query))
|
||||||
(qof-query-destroy query)
|
(qof-query-destroy query)
|
||||||
(gnc:report-percent-done 40)
|
(gnc:report-percent-done 40)
|
||||||
|
|
||||||
;; each split is analyzed... the amount is converted to
|
;; each split is analyzed... the amount is converted to
|
||||||
;; report-currency, and the date modulo 7 used to find
|
;; report-currency, and the date modulo 7 used to find
|
||||||
@@ -232,7 +232,7 @@
|
|||||||
|
|
||||||
(gnc:report-percent-done 60)
|
(gnc:report-percent-done 60)
|
||||||
|
|
||||||
(let* ((zipped-list (filter (lambda (p)
|
(let* ((zipped-list (filter (lambda (p)
|
||||||
(not (zero? (cadr p))))
|
(not (zero? (cadr p))))
|
||||||
(zip days-of-week daily-totals)))
|
(zip days-of-week daily-totals)))
|
||||||
(labels (map (lambda (p)
|
(labels (map (lambda (p)
|
||||||
|
|||||||
@@ -169,7 +169,7 @@
|
|||||||
"c" opthelp-report-title (N_ "Report Title Default"))
|
"c" opthelp-report-title (N_ "Report Title Default"))
|
||||||
|
|
||||||
;; Setting a default section is optional but set in most reports.
|
;; Setting a default section is optional but set in most reports.
|
||||||
;; If not set, the default section will be the first section.
|
;; If not set, the default section will be the first section.
|
||||||
(gnc:options-set-default-section options "Tab B")
|
(gnc:options-set-default-section options "Tab B")
|
||||||
(GncOptionDBPtr-set-default-section optiondb "Tab B")
|
(GncOptionDBPtr-set-default-section optiondb "Tab B")
|
||||||
;; We still need to return the function wrapper instead of the GncOptionDBPtr for all of the options functions in the reports system.
|
;; We still need to return the function wrapper instead of the GncOptionDBPtr for all of the options functions in the reports system.
|
||||||
@@ -465,4 +465,4 @@ new, totally cool report, consult the mailing list ~a.")
|
|||||||
|
|
||||||
;; The rendering function defined above.
|
;; The rendering function defined above.
|
||||||
'renderer sample-report-renderer)
|
'renderer sample-report-renderer)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user