Small patch: from-date on account summary
Lars Clausen
lrclause@cs.uiuc.edu
11 Mar 2002 22:50:47 -0600
--=-=-=
I found myself in need of an account summary covering only the last month,
so I hacked account-summary.scm with inspiration from pnl.scm to take a
from-date and to-date. If you want it, take it.
-Lars
P.S.: I know I should have done a makepatch on the sources, but I worked
directly on the installation and didn't want the bother for a single-file
patch.
--=-=-=
Content-Disposition: attachment; filename=from-to.diff
Content-Description: Diff of account-summary.scm to add from date
--- account-summary-old.scm Mon Mar 11 21:55:56 2002
+++ account-summary.scm Mon Mar 11 22:23:20 2002
@@ -32,6 +32,8 @@
(define-module (gnucash report account-summary))
(use-modules (srfi srfi-1))
+(use-modules (ice-9 slib))
+(require 'printf)
;; account summary report
;; prints a table of account information with clickable
@@ -39,7 +41,9 @@
;; first define all option's names such that typos etc. are no longer
;; possible.
-(define optname-date (N_ "Date"))
+(define optname-from-date (N_ "From"))
+(define optname-to-date (N_ "To"))
+;;(define optname-date (N_ "Date"))
(define optname-display-depth (N_ "Account Display Depth"))
(define optname-show-foreign (N_ "Show Foreign Currencies/Shares of Stock"))
@@ -64,8 +68,11 @@
(define (accsum-options-generator)
(let* ((options (gnc:new-options)))
;; date at which to report balance
- (gnc:options-add-report-date!
- options gnc:pagename-general optname-date "a")
+ (gnc:options-add-date-interval!
+ options gnc:pagename-general
+ optname-from-date optname-to-date "a")
+;; (gnc:options-add-report-date!
+;; options gnc:pagename-general optname-date "a")
;; all about currencies
(gnc:options-add-currency!
@@ -133,7 +140,7 @@
(gnc:lookup-option
(gnc:report-options report-obj) pagename optname)))
- (let ((display-depth (get-option gnc:pagename-accounts
+ (let* ((display-depth (get-option gnc:pagename-accounts
optname-display-depth ))
(show-subaccts? (get-option gnc:pagename-accounts
optname-show-subaccounts))
@@ -151,12 +158,26 @@
optname-price-source))
(show-rates? (get-option gnc:pagename-display
optname-show-rates))
- (date-tp (gnc:timepair-end-day-time
+ (to-date-tp (gnc:timepair-end-day-time
+ (gnc:date-option-absolute-time
+ (get-option gnc:pagename-general
+ optname-to-date))))
+ (from-date-tp (gnc:timepair-start-day-time
(gnc:date-option-absolute-time
(get-option gnc:pagename-general
- optname-date))))
- (report-title (get-option gnc:pagename-general
- gnc:optname-reportname))
+ optname-from-date))))
+;; (date-tp (gnc:timepair-end-day-time
+;; (gnc:date-option-absolute-time
+;; (get-option gnc:pagename-general
+;; optname-date))))
+ (report-title (sprintf #f
+ (_ "Account Summary %s - %s to %s")
+ (get-option gnc:pagename-general
+ gnc:optname-reportname)
+ (gnc:timepair-to-datestring from-date-tp)
+ (gnc:timepair-to-datestring to-date-tp)))
+;; (report-title (get-option gnc:pagename-general
+;; gnc:optname-reportname))
(doc (gnc:make-html-document))
(txt (gnc:make-html-text)))
@@ -170,10 +191,11 @@
display-depth)
(if do-grouping? 1 0)))
(exchange-fn (gnc:case-exchange-fn
- price-source report-currency date-tp))
+ price-source report-currency to-date-tp))
;; do the processing here
(table (gnc:html-build-acct-table
- #f date-tp
+ from-date-tp to-date-tp
+;; #f date-tp
tree-depth show-subaccts? accounts
#t
#t gnc:accounts-get-comm-total-assets
--=-=-=
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable
--=20
Lars Clausen (http://shasta.cs.uiuc.edu/~lrclause)| H=E5rdgrim of Numenor
"I do not agree with a word that you say, but I |------------------------=
----
will defend to the death your right to say it." | Where are we going, and
--Evelyn Beatrice Hall paraphrasing Voltaire | what's with the handbas=
ket?
--=-=-=--