I've been using this hack which changes the definition of current and
previous year in reports to start 1 July. It will be overwritten each time
a new version of GnuCash is installed and it's unlikely to work with the
next major release.

Find date-utilities.scm eg C:\Program Files
(x86)\gnucash\share\guile\site\2.2\gnucash\app-utils\date-utilities.scm

Update code block (around line 540) with a text editor to that shown below:

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; end relative-date functions
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(define* (gnc:get-start-cal-year #:key (start-month-fy 6))
;; Jan is 0
  (let ((now (gnc-localtime (current-time))))
    (set-tm:sec now 0)
    (set-tm:min now 0)
    (set-tm:hour now 0)
    (set-tm:mday now 1)
    (set-tm:mon now start-month-fy)
    (if (< (tm:mon now) start-month-fy)
      (set-tm:year now (- (tm:year now) 1))
      (set-tm:year now (tm:year now)))
    (set-tm:isdst now -1)
    (gnc-mktime now)))

(define* (gnc:get-end-cal-year #:key (start-month-fy 6))
  (let ((now (gnc-localtime (current-time))))
    (set-tm:sec now 59)
    (set-tm:min now 59)
    (set-tm:hour now 23)
    (set-tm:mday now 30) ; set for month before start-month-fy
    (if (< (tm:mon now) start-month-fy)
      (set-tm:year now (tm:year now))
      (set-tm:year now (+ (tm:year now) 1)))
    (set-tm:mon now (- start-month-fy 1)) ; move line and it works
    (set-tm:isdst now -1)
    (gnc-mktime now)))

(define* (gnc:get-start-prev-year #:key (start-month-fy 6))
  (let ((now (gnc-localtime (current-time))))
    (set-tm:sec now 0)
    (set-tm:min now 0)
    (set-tm:hour now 0)
    (set-tm:mday now 1)
    (set-tm:mon now start-month-fy)
    (if (< (tm:mon now) start-month-fy)
      (set-tm:year now (- (tm:year now) 2))
      (set-tm:year now (- (tm:year now) 1)))
    (set-tm:isdst now -1)
    (gnc-mktime now)))

(define* (gnc:get-end-prev-year #:key (start-month-fy 6))
  (let ((now (gnc-localtime (current-time))))
    (set-tm:sec now 59)
    (set-tm:min now 59)
    (set-tm:hour now 23)
    (set-tm:mday now 30) ; set for month before start-month-fy
    (if (< (tm:mon now) start-month-fy)
      (set-tm:year now (- (tm:year now) 1))
      (set-tm:year now (tm:year now)))
    (set-tm:mon now (- start-month-fy 1)) ; move line and it works
    (set-tm:isdst now -1)
    (gnc-mktime now)))
_______________________________________________
gnucash-user mailing list
gnucash-user@gnucash.org
To update your subscription preferences or to unsubscribe:
https://lists.gnucash.org/mailman/listinfo/gnucash-user
If you are using Nabble or Gmane, please see 
https://wiki.gnucash.org/wiki/Mailing_Lists for more information.
-----
Please remember to CC this list on all your replies.
You can do this by using Reply-To-List or Reply-All.

Reply via email to