[Gnucash-changes] r13199 - gnucash/trunk/src/app-utils - Change the reports from using a hard-coded fiscal year to using the global

Derek Atkins warlord at MIT.EDU
Sat Feb 11 10:08:28 EST 2006


A couple of issues with this change:

1) I think users want the ability to report on both the "current"
   accounting period as well as the "previous" accounting period.
   This patch removes the ability to do that.

2) Users who had reports that had "current/previous financial year"
   set will now crash (or at least fail to load properly) because
   their option setting wont be available.  If we care about report
   migration from 1.8->2.0 we need to handle that somehow.  If we
   don't care then we just need to make sure that reports generated
   with this option in 1.8 don't crash during the migration to 2.0.

more inline...

Chris Shoemaker <chris at cvs.gnucash.org> writes:

>    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.
>
>
[snip]
> @@ -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)
>
[snip]
>  
> -/* 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);

I'm wondering if this should be a doxygen comment?  I'm also wondering
if we want to use a time_t or a Timespec for these functions...

> +  (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"

I'm concerned that these return a <gw:int>..  It has a Y2038 bug.

> 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))

At some level I think this is fine, but I'm worried about report
migration.

-derek

-- 
       Derek Atkins, SB '93 MIT EE, SM '95 MIT Media Laboratory
       Member, MIT Student Information Processing Board  (SIPB)
       URL: http://web.mit.edu/warlord/    PP-ASEL-IA     N1NWH
       warlord at MIT.EDU                        PGP key available


More information about the gnucash-devel mailing list