Setting finanical year end?

Nicholas Lee nj.lee@plumtree.co.nz
Wed, 4 Jul 2001 10:20:59 +1200


On Tue, Jul 03, 2001 at 02:46:48PM -0700, Dave Peticolas wrote:
> 
> It is hard-coded in date-utilities.scm.

Hmm.  ;; FIXME:: Replace with option when it becomes available


I guess its worth point out that each balance sheet should have the
option of its own Balance year start date.  As well as their being a
system default option.

For when someone gets around to adding that option. ;)

> 
> 
> > Am I going to have to learn soem scheme?
> > I'm afraid so, but probably not much :)

I think there are some bugs in here:

(define (gnc:get-start-prev-fin-year)
  (let ((now (localtime (current-time))))
    (if (< (tm:mon now) 6)
	(begin
	  (set-tm:sec now 0)
	  (set-tm:min now 0)
	  (set-tm:hour now 0)
	  (set-tm:mday now 1)
	  (set-tm:mon now 6)
	  (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 1)
	  (set-tm:mon now 6)
	  (set-tm:year now (- (tm:year now) 2))
          (set-tm:isdst now -1)
	  (gnc:date->timepair now)))))

Tell me if I'm wrong.

Year start seems to default to 1 July XX. (From printing some reports.)

So if we are before July the start-prev-fin-year is XX-2. If we are after
June the prev-fin-year is XX-1.

The code above seems to say:  (I assume (< (tm:mon now) 6) is month < 6,
rather than month <= 6.)

If current month less than June, year = year - 2, else year = year - 2.

Shouldn't this be:
If current month less than July(month of finanical year start), year = year - 2, else year = year - 1.
(Two changes.)



Tell me if I'm wrong since I know pretty much no scheme. ;)

Nicholas