2001-05-15 Christian Stimming <stimming@tuhh.de>

* src/scm/commodity-utilities.scm: added another case to
        gnc:case-exchange-time-fn. Needs more work.

        * src/scm/report/price-scatter.scm: Catch all cases that would
        cause Guppi's scatterplot to barf.


git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@4225 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Christian Stimming 2001-05-16 04:18:32 +00:00
parent 6bcacd1a2e
commit a12f34c673
3 changed files with 74 additions and 29 deletions

View File

@ -1,15 +1,10 @@
2001-05-16 Robert Graham Merkel <rgmerk@mira.net>
2001-05-15 Christian Stimming <stimming@tuhh.de>
* src/scm/report/transaction-report.scm: use colspan to make
room for long subtotal labels.
* src/scm/commodity-utilities.scm: added another case to
gnc:case-exchange-time-fn. Needs more work.
* src/scm/doc.scm: remove unnecessary debugging output inadvertantly
added.
2001-05-15 Bill Gribble <grib@billgribble.com>
* fix report updating problem. should reload multicolumn reports
correctly when "reload" is hit.
* src/scm/report/price-scatter.scm: Catch all cases that would
cause Guppi's scatterplot to barf.
2001-05-15 Rob Browning <rlb@cs.utexas.edu>

View File

@ -661,6 +661,14 @@
pricealist (gnc:gnc-monetary-commodity foreign) date))
#f))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Choosing exchange functions made easy -- get the right function by
;; the value of a multichoice option.
;; Return a ready-to-use function. Which one to use is determined by
;; the value of 'source-option', whose possible values are set in
;; gnc:options-add-price-source!.
@ -688,11 +696,26 @@
(lambda (foreign domestic date)
(gnc:exchange-by-pricealist-nearest
pricealist foreign domestic date))))
('actual-transactions (let ((pricealist
(gnc:get-commoditylist-inst-prices
commodity-list report-currency to-date-tp)))
(lambda (foreign domestic date)
(gnc:exchange-by-pricealist-nearest
pricealist foreign domestic date))))
('pricedb-latest (lambda (foreign domestic date)
(gnc:exchange-by-pricedb-latest foreign domestic)))
('pricedb-nearest gnc:exchange-by-pricedb-nearest)
(else (gnc:warn "gnc:case-exchange-time-fn: bad price-source value"))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Functions using the exchange-fn's above to get from a
;; commodity-collector to one value.
;; Adds all different commodities in the commodity-collector <foreign>
;; by using the exchange rates of <exchange-fn> to calculate the
;; exchange rates to the commodity <domestic>. Returns a

View File

@ -126,14 +126,14 @@
(let* ((to-date-tp (gnc:timepair-end-day-time
(gnc:date-option-absolute-time
(get-option gnc:pagename-general
optname-to-date))))
optname-to-date))))
(from-date-tp (gnc:timepair-start-day-time
(gnc:date-option-absolute-time
(get-option gnc:pagename-general
optname-from-date))))
optname-from-date))))
(interval (get-option gnc:pagename-general optname-stepsize))
(report-title (get-option gnc:pagename-general
gnc:optname-reportname))
gnc:optname-reportname))
(height (get-option gnc:pagename-display optname-plot-height))
(width (get-option gnc:pagename-display optname-plot-width))
@ -144,11 +144,11 @@
gnc:pagename-display optname-markercolor)))
(report-currency (get-option pagename-price
optname-report-currency))
optname-report-currency))
(price-commodity (get-option pagename-price
optname-price-commodity))
optname-price-commodity))
(price-source (get-option pagename-price
optname-price-source))
optname-price-source))
(dates-list (gnc:make-date-list
(gnc:timepair-end-day-time from-date-tp)
@ -162,6 +162,14 @@
(gnc:get-current-group))))
(data '()))
;; Short helper for all the warnings below
(define (make-warning title text)
(gnc:html-document-add-object!
document
(gnc:make-html-text
(gnc:html-markup-h2 title)
(gnc:html-markup-p text))))
(gnc:html-scatter-set-title!
chart report-title)
(gnc:html-scatter-set-subtitle!
@ -259,21 +267,40 @@
(gnc:html-scatter-set-data!
chart data)
;; Make tons of tests so that Guppi won't barf
(if (not (null? data))
(gnc:html-document-add-object! document chart)
(gnc:html-document-add-object!
document
(gnc:html-make-empty-data-warning))))
(if (> (length data) 1)
(if (apply equal? (map second data))
(make-warning
(_ "All Prices equal")
(_ "All the prices found are equal. \
This would result in a plot with one straight line. \
Unfortunately, the plotting tool can't handle that."))
(if (apply equal? (map first data))
(make-warning
(_ "All Prices at the same date")
(_ "All the prices found are from the same date. \
This would result in a plot with one straight line. \
Unfortunately, the plotting tool can't handle that."))
(gnc:html-document-add-object! document chart)))
(make-warning
(_ "Only one price")
(_ "There was only one single price found for the \
selected commodities in the selected time period. This doesn't give \
a useful plot.")))
(make-warning
(_ "No data")
(_ "There is no price information available for the \
selected commodities in the selected time period."))))
;; warning if report-currency == price-commodity
(gnc:html-document-add-object!
document
(gnc:make-html-text
(gnc:html-markup-h2 (_ "Identical commodities"))
(gnc:html-markup-p
(_ "Your selected commodity and the currency of the report \
(make-warning
(_ "Identical commodities")
(_ "Your selected commodity and the currency of the report \
are identical. It doesn't make sense to show prices for identical \
commodities.")))))
commodities.")))
document))