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 * src/scm/commodity-utilities.scm: added another case to
room for long subtotal labels. gnc:case-exchange-time-fn. Needs more work.
* src/scm/doc.scm: remove unnecessary debugging output inadvertantly * src/scm/report/price-scatter.scm: Catch all cases that would
added. cause Guppi's scatterplot to barf.
2001-05-15 Bill Gribble <grib@billgribble.com>
* fix report updating problem. should reload multicolumn reports
correctly when "reload" is hit.
2001-05-15 Rob Browning <rlb@cs.utexas.edu> 2001-05-15 Rob Browning <rlb@cs.utexas.edu>

View File

@ -661,6 +661,14 @@
pricealist (gnc:gnc-monetary-commodity foreign) date)) pricealist (gnc:gnc-monetary-commodity foreign) date))
#f)) #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 ;; Return a ready-to-use function. Which one to use is determined by
;; the value of 'source-option', whose possible values are set in ;; the value of 'source-option', whose possible values are set in
;; gnc:options-add-price-source!. ;; gnc:options-add-price-source!.
@ -688,11 +696,26 @@
(lambda (foreign domestic date) (lambda (foreign domestic date)
(gnc:exchange-by-pricealist-nearest (gnc:exchange-by-pricealist-nearest
pricealist foreign domestic date)))) 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) ('pricedb-latest (lambda (foreign domestic date)
(gnc:exchange-by-pricedb-latest foreign domestic))) (gnc:exchange-by-pricedb-latest foreign domestic)))
('pricedb-nearest gnc:exchange-by-pricedb-nearest) ('pricedb-nearest gnc:exchange-by-pricedb-nearest)
(else (gnc:warn "gnc:case-exchange-time-fn: bad price-source value")))) (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> ;; Adds all different commodities in the commodity-collector <foreign>
;; by using the exchange rates of <exchange-fn> to calculate the ;; by using the exchange rates of <exchange-fn> to calculate the
;; exchange rates to the commodity <domestic>. Returns a ;; exchange rates to the commodity <domestic>. Returns a

View File

@ -126,14 +126,14 @@
(let* ((to-date-tp (gnc:timepair-end-day-time (let* ((to-date-tp (gnc:timepair-end-day-time
(gnc:date-option-absolute-time (gnc:date-option-absolute-time
(get-option gnc:pagename-general (get-option gnc:pagename-general
optname-to-date)))) optname-to-date))))
(from-date-tp (gnc:timepair-start-day-time (from-date-tp (gnc:timepair-start-day-time
(gnc:date-option-absolute-time (gnc:date-option-absolute-time
(get-option gnc:pagename-general (get-option gnc:pagename-general
optname-from-date)))) optname-from-date))))
(interval (get-option gnc:pagename-general optname-stepsize)) (interval (get-option gnc:pagename-general optname-stepsize))
(report-title (get-option gnc:pagename-general (report-title (get-option gnc:pagename-general
gnc:optname-reportname)) gnc:optname-reportname))
(height (get-option gnc:pagename-display optname-plot-height)) (height (get-option gnc:pagename-display optname-plot-height))
(width (get-option gnc:pagename-display optname-plot-width)) (width (get-option gnc:pagename-display optname-plot-width))
@ -144,11 +144,11 @@
gnc:pagename-display optname-markercolor))) gnc:pagename-display optname-markercolor)))
(report-currency (get-option pagename-price (report-currency (get-option pagename-price
optname-report-currency)) optname-report-currency))
(price-commodity (get-option pagename-price (price-commodity (get-option pagename-price
optname-price-commodity)) optname-price-commodity))
(price-source (get-option pagename-price (price-source (get-option pagename-price
optname-price-source)) optname-price-source))
(dates-list (gnc:make-date-list (dates-list (gnc:make-date-list
(gnc:timepair-end-day-time from-date-tp) (gnc:timepair-end-day-time from-date-tp)
@ -161,7 +161,15 @@
(filter gnc:account-has-shares? (gnc:group-get-subaccounts (filter gnc:account-has-shares? (gnc:group-get-subaccounts
(gnc:get-current-group)))) (gnc:get-current-group))))
(data '())) (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! (gnc:html-scatter-set-title!
chart report-title) chart report-title)
(gnc:html-scatter-set-subtitle! (gnc:html-scatter-set-subtitle!
@ -258,22 +266,41 @@
(gnc:html-scatter-set-data! (gnc:html-scatter-set-data!
chart data) chart data)
;; Make tons of tests so that Guppi won't barf
(if (not (null? data)) (if (not (null? data))
(gnc:html-document-add-object! document chart) (if (> (length data) 1)
(gnc:html-document-add-object! (if (apply equal? (map second data))
document (make-warning
(gnc:html-make-empty-data-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 ;; warning if report-currency == price-commodity
(gnc:html-document-add-object! (make-warning
document (_ "Identical commodities")
(gnc:make-html-text (_ "Your selected commodity and the currency of the report \
(gnc:html-markup-h2 (_ "Identical commodities"))
(gnc:html-markup-p
(_ "Your selected commodity and the currency of the report \
are identical. It doesn't make sense to show prices for identical \ are identical. It doesn't make sense to show prices for identical \
commodities."))))) commodities.")))
document)) document))