[Gnucash-changes] r13199 - gnucash/trunk/src/app-utils - Change the
reports from using a hard-coded fiscal year to using the global
Chris Shoemaker
chris at cvs.gnucash.org
Sat Feb 11 00:14:21 EST 2006
Author: chris
Date: 2006-02-11 00:14:21 -0500 (Sat, 11 Feb 2006)
New Revision: 13199
Trac: http://svn.gnucash.org/trac/changeset/13199
Modified:
gnucash/trunk/src/app-utils/app-utils.scm
gnucash/trunk/src/app-utils/date-utilities.scm
gnucash/trunk/src/app-utils/gnc-accounting-period.h
gnucash/trunk/src/app-utils/gw-app-utils-spec.scm
gnucash/trunk/src/app-utils/options.scm
Log:
Change the reports from using a hard-coded fiscal year to using the global
accounting period set in the preferences. Both the start date and the end
date are used, so the user is free to choose any arbitrary period.
Modified: gnucash/trunk/src/app-utils/app-utils.scm
===================================================================
--- gnucash/trunk/src/app-utils/app-utils.scm 2006-02-11 05:00:02 UTC (rev 13198)
+++ gnucash/trunk/src/app-utils/app-utils.scm 2006-02-11 05:14:21 UTC (rev 13199)
@@ -209,10 +209,6 @@
(export gnc:get-end-cal-year)
(export gnc:get-start-prev-year)
(export gnc:get-end-prev-year)
-(export gnc:get-start-cur-fin-year)
-(export gnc:get-start-prev-fin-year)
-(export gnc:get-end-prev-fin-year)
-(export gnc:get-end-cur-fin-year)
(export gnc:get-start-this-month)
(export gnc:get-end-this-month)
(export gnc:get-start-prev-month)
Modified: gnucash/trunk/src/app-utils/date-utilities.scm
===================================================================
--- gnucash/trunk/src/app-utils/date-utilities.scm 2006-02-11 05:00:02 UTC (rev 13198)
+++ gnucash/trunk/src/app-utils/date-utilities.scm 2006-02-11 05:14:21 UTC (rev 13199)
@@ -20,14 +20,6 @@
;; 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652
;; Boston, MA 02110-1301, USA gnu at gnu.org
-
-;; fin-year-start format: mm dd
-(define fin-year-start '(07 01))
-
-
-(define fin-year-start-month (- (car fin-year-start) 1)) ;; jan == 0
-(define fin-year-start-day (cadr fin-year-start))
-
(define gnc:reldate-list '())
(define (gnc:timepair->secs tp)
@@ -461,81 +453,12 @@
(set-tm:isdst now -1)
(gnc:date->timepair now)))
-;; FIXME:: Replace with option when it becomes available
-(define (gnc:get-start-cur-fin-year)
- (let ((now (localtime (current-time))))
- (if (or (< (tm:mon now) fin-year-start-month) (and (= (tm:mon now) fin-year-start-month) (< (tm:mday now) fin-year-start-day) ))
- (begin
- (set-tm:sec now 0)
- (set-tm:min now 0)
- (set-tm:hour now 0)
- (set-tm:mday now fin-year-start-day)
- (set-tm:mon now fin-year-start-month)
- (set-tm:year now (- (tm:year now) 1))
- (set-tm:isdst now -1)
- (gnc:date->timepair now))
- (begin
- (set-tm:sec now 0)
- (set-tm:min now 0)
- (set-tm:hour now 0)
- (set-tm:mday now fin-year-start-day)
- (set-tm:mon now fin-year-start-month)
- (set-tm:isdst now -1)
- (gnc:date->timepair now)))))
+(define (gnc:get-start-accounting-period)
+ (gnc:secs->timepair (gnc:accounting-period-start)))
-(define (gnc:get-start-prev-fin-year)
- (let ((now (localtime (current-time))))
- (if (or (< (tm:mon now) fin-year-start-month) (and (= (tm:mon now) fin-year-start-month) (< (tm:mday now) fin-year-start-day) ))
- (begin
- (set-tm:sec now 0)
- (set-tm:min now 0)
- (set-tm:hour now 0)
- (set-tm:mday now fin-year-start-day)
- (set-tm:mon now fin-year-start-month)
- (set-tm:year now (- (tm:year now) 2))
- (set-tm:isdst now -1)
- (gnc:date->timepair now))
- (begin
- (set-tm:sec now 0)
- (set-tm:min now 0)
- (set-tm:hour now 0)
- (set-tm:mday now fin-year-start-day)
- (set-tm:mon now fin-year-start-month)
- (set-tm:year now (- (tm:year now) 1))
- (set-tm:isdst now -1)
- (gnc:date->timepair now)))))
+(define (gnc:get-end-accounting-period)
+ (gnc:secs->timepair (gnc:accounting-period-end)))
-(define (gnc:get-start-next-fin-year)
- (let ((now (localtime (current-time))))
- (if (or (< (tm:mon now) fin-year-start-month) (and (= (tm:mon now) fin-year-start-month) (< (tm:mday now) fin-year-start-day) ))
- (begin
- (set-tm:sec now 0)
- (set-tm:min now 0)
- (set-tm:hour now 0)
- (set-tm:mday now fin-year-start-day)
- (set-tm:mon now fin-year-start-month)
- (set-tm:isdst now -1)
- (gnc:date->timepair now))
- (begin
- (set-tm:sec now 0)
- (set-tm:min now 0)
- (set-tm:hour now 0)
- (set-tm:mday now fin-year-start-day)
- (set-tm:mon now fin-year-start-month)
- (set-tm:year now (+ (tm:year now) 1))
- (set-tm:isdst now -1)
- (gnc:date->timepair now)))))
-
-(define (gnc:get-end-prev-fin-year)
- (let ((now (gnc:get-start-cur-fin-year)))
- (gnc:secs->timepair (- (gnc:timepair->secs now) 1))
- ))
-
-(define (gnc:get-end-cur-fin-year)
- (let ((now (gnc:get-start-next-fin-year)))
- (gnc:secs->timepair (- (gnc:timepair->secs now) 1))
- ))
-
(define (gnc:get-start-this-month)
(let ((now (localtime (current-time))))
(set-tm:sec now 0)
@@ -734,34 +657,20 @@
(N_ "End of the Previous Year"))
(gnc:reldate-string-db
- 'store 'start-cur-fin-year-string
- (N_ "Current Financial Year Start"))
+ 'store 'start-accounting-period-string
+ (N_ "Start of Financial Period"))
(gnc:reldate-string-db
- 'store 'start-cur-fin-year-desc
- (N_ "Start of the current financial year/accounting period"))
+ 'store 'start-accounting-period-desc
+ (N_ "Start of the accounting period, as set in the global preferences"))
(gnc:reldate-string-db
- 'store 'start-prev-fin-year-string
- (N_ "Previous Financial Year Start"))
+ 'store 'end-accounting-period-string
+ (N_ "End of Financial Period"))
(gnc:reldate-string-db
- 'store 'start-prev-fin-year-desc
- (N_ "The start of the previous financial year/accounting period"))
+ 'store 'end-accounting-period-desc
+ (N_ "End of the accounting period, as set in the global preferences"))
(gnc:reldate-string-db
- 'store 'end-prev-fin-year-string
- (N_ "End Previous Financial Year"))
- (gnc:reldate-string-db
- 'store 'end-prev-fin-year-desc
- (N_ "End of the previous Financial year/Accounting Period"))
-
- (gnc:reldate-string-db
- 'store 'end-cur-fin-year-string
- (N_ "End Current Financial Year"))
- (gnc:reldate-string-db
- 'store 'end-cur-fin-year-desc
- (N_ "End of the current Financial year/Accounting Period"))
-
- (gnc:reldate-string-db
'store 'start-this-month-string
(N_ "Start of this month"))
(gnc:reldate-string-db
@@ -870,22 +779,14 @@
(gnc:reldate-string-db 'lookup 'end-prev-year-string)
(gnc:reldate-string-db 'lookup 'end-prev-year-desc)
gnc:get-end-prev-year)
- (vector 'start-cur-fin-year
- (gnc:reldate-string-db 'lookup 'start-cur-fin-year-string)
- (gnc:reldate-string-db 'lookup 'start-cur-fin-year-desc)
- gnc:get-start-cur-fin-year)
- (vector 'start-prev-fin-year
- (gnc:reldate-string-db 'lookup 'start-prev-fin-year-string)
- (gnc:reldate-string-db 'lookup 'start-prev-fin-year-desc)
- gnc:get-start-prev-fin-year)
- (vector 'end-prev-fin-year
- (gnc:reldate-string-db 'lookup 'end-prev-fin-year-string)
- (gnc:reldate-string-db 'lookup 'end-prev-fin-year-desc)
- gnc:get-end-prev-fin-year)
- (vector 'end-cur-fin-year
- (gnc:reldate-string-db 'lookup 'end-cur-fin-year-string)
- (gnc:reldate-string-db 'lookup 'end-cur-fin-year-desc)
- gnc:get-end-cur-fin-year)
+ (vector 'start-accounting-period
+ (gnc:reldate-string-db 'lookup 'start-accounting-period-string)
+ (gnc:reldate-string-db 'lookup 'start-accounting-period-desc)
+ gnc:get-start-accounting-period)
+ (vector 'end-accounting-period
+ (gnc:reldate-string-db 'lookup 'end-accounting-period-string)
+ (gnc:reldate-string-db 'lookup 'end-accounting-period-desc)
+ gnc:get-end-accounting-period)
(vector 'start-this-month
(gnc:reldate-string-db 'lookup 'start-this-month-string)
(gnc:reldate-string-db 'lookup 'start-this-month-desc)
Modified: gnucash/trunk/src/app-utils/gnc-accounting-period.h
===================================================================
--- gnucash/trunk/src/app-utils/gnc-accounting-period.h 2006-02-11 05:00:02 UTC (rev 13198)
+++ gnucash/trunk/src/app-utils/gnc-accounting-period.h 2006-02-11 05:14:21 UTC (rev 13199)
@@ -167,9 +167,8 @@
const GDate *contains);
-/* Convenience routines that take care of getting the fiscal
- accounting period from the preferences and returning the start and
- end times. */
+/* Get the fiscal accounting period from the preferences and return
+ the start and end times. */
time_t gnc_accounting_period_fiscal_start(void);
time_t gnc_accounting_period_fiscal_end(void);
Modified: gnucash/trunk/src/app-utils/gw-app-utils-spec.scm
===================================================================
--- gnucash/trunk/src/app-utils/gw-app-utils-spec.scm 2006-02-11 05:00:02 UTC (rev 13198)
+++ gnucash/trunk/src/app-utils/gw-app-utils-spec.scm 2006-02-11 05:14:21 UTC (rev 13199)
@@ -32,6 +32,7 @@
"#include <gnc-ui-util.h>\n"
"#include <gnc-gettext-util.h>\n"
"#include <gnc-helpers.h>\n"
+ "#include <gnc-accounting-period.h>\n"
"#include <gnc-component-manager.h>\n")))
(gw:wrap-simple-type ws '<gnc:print-amount-info-scm> "GNCPrintAmountInfo"
@@ -398,9 +399,24 @@
'((<gnc:commodity-table*> table))
"Return a list of all the quotable commodities in a given namespace in the table.")
+ (gw:wrap-function
+ ws
+ 'gnc:accounting-period-start
+ '<gw:int>
+ "gnc_accounting_period_fiscal_start"
+ '()
+ "Returns the beginning of the preferred accounting period")
(gw:wrap-function
ws
+ 'gnc:accounting-period-end
+ '<gw:int>
+ "gnc_accounting_period_fiscal_end"
+ '()
+ "Returns the end of the preferred accounting period")
+
+ (gw:wrap-function
+ ws
'gnc:account-separator-char
'(<gw:mchars> callee-owned const)
"gnc_get_account_separator_string"
Modified: gnucash/trunk/src/app-utils/options.scm
===================================================================
--- gnucash/trunk/src/app-utils/options.scm 2006-02-11 05:00:02 UTC (rev 13198)
+++ gnucash/trunk/src/app-utils/options.scm 2006-02-11 05:14:21 UTC (rev 13199)
@@ -1533,9 +1533,8 @@
end-current-quarter
end-prev-quarter
end-cal-year
- end-prev-year
- end-cur-fin-year
- end-prev-fin-year
+ end-prev-year
+ end-accounting-period
))))
(define (gnc:options-make-date-interval! options pagename name-from info-from
@@ -1555,8 +1554,7 @@
start-prev-quarter
start-cal-year
start-prev-year
- start-cur-fin-year
- start-prev-fin-year
+ start-accounting-period
)))
(gnc:options-make-end-date! options pagename name-to
(string-append sort-tag "b") info-to))
More information about the gnucash-changes
mailing list