Re: [GNC] Configurable Year Start Day/Month

2023-04-21 Thread john
Flywire,

Have you looked at https://code.gnucash.org/docs/MASTER/group__Options.html?

I guess by "set and use" you mean add a date option to your report. The basic 
function is documented at 
https://code.gnucash.org/docs/MASTER/group__Options.html#gae207538b13cb19bb68f9b9300743b709
 and it has an overloaded version 
https://code.gnucash.org/docs/MASTER/group__Options.html#ga5dafb8587af06977a7ee03b73b852a68
 that takes a std::vector of the RelativeDatePeriods to include. That's used by 
 gnc-register-start-date-option 
https://code.gnucash.org/docs/MASTER/group__Options.html#ga4a03e7ac556ea7774046121555df9f51,
 and gnc-register-end-date-option 
https://code.gnucash.org/docs/MASTER/group__Options.html#gaf48579ed1d96c1e7b9fbdc16b589995a
 to generate pre-filtered  controls with the obvious relative date offerings. 
There's also  gnc::options-make-date-interval that quickly adds one of each. 
Most reports use either gnc-register-end-date-option to set the date for a 
single-date report like a Balance Sheet or gnc:options-make-date-interval for 
reports like an Income Statement that cover a period.

Changing the way options work isn't supported, nor has it ever been. If you 
change the way an existing option works you'll break some built-in report. That 
might not matter to you because you'll be able to run your custom report. 
That's fine, it's what Free software is all about, but you own the change and 
its consequences, and you can't expect that your changes will apply cleanly 
after the next commit never mind the next release, as you've just discovered.

Even with the 4.x and earlier option system you couldn't create new option 
classes entirely in Scheme. The old option system was a horrid mix of Scheme 
and C because it had to support both report options and book options, plus the 
UI part was always pure C that had to use the Guile C API to get option values. 
I don' t think you're really interested in adding an option class so I'll spare 
you the details of what you'd need to write in C++ to do it.

Yes, you can turn on Github actions in your fork and it will run the CI for you 
just like it does in the GnuCash mirror, see 
https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/enabling-features-for-your-repository/managing-github-actions-settings-for-a-repository.
 But we don't have a Windows CI action, the nightly builds are done with the 
https://github.com/gnucash/GnuCash-on-windows powershell scripts on a Windows 
VM in Derek's basement. 

Adding new RelativeDatePeriods for 2 years ago is fairly straightforward, just 
add the two values to the enum and the logic to gnc_relative_date_to_time64() 
and set up the various strings and the swig conversions in 
bindings/guile/gnc-options.i.

Adding actual Fiscal Year support is another matter entirely. It's been 
discussed on and off for 20 years, but it requires substantial changes 
throughout GnuCash and so far nobody has wanted to invest the effort.

Regards,
John Ralls




> On Apr 21, 2023, at 6:23 PM, flywire  wrote:
> 
> John,
> 
> Seems like an X-Y response. The meaning of a hack is clear, although this is 
> more of a tweak, and where it occurs hardly matters if it's not part of a PR. 
> A response in terms of using existing report/module code in a new report 
> would be fine. 
> https://github.com/Gnucash/gnucash/blob/5.0/gnucash/report/reports/example/sample-report.scm#L64-L77
>  demonstrates creating a list of options, so it follows, changing it changes 
> the options. I'll take it consult the list is used to mean seek advice or 
> information, and understand some code in the repo is depreciated. None of 
> this is core to the question.
> 
> To elaborate:
> I'm seeking guidance on the processes involved in setting and using the date 
> option, and how to change it. There seems to be more to the changed approach 
> in V5 https://github.com/Gnucash/gnucash/tree/5.0/libgnucash/engine than 
> covered in the documentation. Apologies in advance if terms are used 
> incorrectly.
> I imagine there are two approaches:
> Override the value of year in scheme so it starts 1 July in the previous 
> year. I understand the options and lists are defined in C++ but I'm only 
> focused on scheme reports. Are these option values in scheme mutable or can 
> they easily be changed to mutable? Existing textual descriptions of the 
> options are fine. Can start/end year just be registered again in a scheme 
> report with a new definition or redefined in scheme using the 
> date-utilities.scm process in V4?
> Redefine option values in C++. This is more problematic for me because I 
> haven't been able to compile GnuCash in Windows. Nevertheless, every commit 
> goes through a recompile as part of a CI process. Would it be feasible, and 
> if so how, to use that process in a private fork and grab a windows 
> executable from it to use on my PC? I expect I could work my way through the 
> C++ code and change value definitions and list

Re: [GNC] Configurable Year Start Day/Month

2023-04-21 Thread flywire
John,

Seems like an X-Y response. The meaning of a hack is clear, although this
is more of a tweak, and where it occurs hardly matters if it's not part of
a PR. A response in terms of using existing report/module code in a new
report would be fine.
https://github.com/Gnucash/gnucash/blob/5.0/gnucash/report/reports/example/sample-report.scm#L64-L77
demonstrates creating a list of options, so it follows, changing it changes
the options. I'll take it consult the list is used to mean seek advice or
information, and understand some code in the repo is depreciated. None of
this is core to the question.

To elaborate:

   1. I'm seeking guidance on the processes involved in setting and using
   the date option, and how to change it. There seems to be more to the
   changed approach in V5
   https://github.com/Gnucash/gnucash/tree/5.0/libgnucash/engine than
   covered in the documentation. Apologies in advance if terms are used
   incorrectly.
   2. I imagine there are two approaches:
  1. Override the value of year in scheme so it starts 1 July in
  the previous year. I understand the options and lists are defined in C++
  but I'm only focused on scheme reports. Are these option values in scheme
  mutable or can they easily be changed to mutable? Existing textual
  descriptions of the options are fine. Can start/end year just be
registered
  again in a scheme report with a new definition or redefined in
scheme using
  the date-utilities.scm process in V4?
  2. Redefine option values in C++. This is more problematic for me
  because I haven't been able to compile GnuCash in Windows. Nevertheless,
  every commit goes through a recompile as part of a CI process.
Would it be
  feasible, and if so how, to use that process in a private fork and grab a
  windows executable from it to use on my PC? I expect I could work my way
  through the C++ code and change value definitions and lists.
   3. I'd actually like to add a new date symbol for start/end of 2 years
   prior period.

Your response previously linked from 2021 shows you have considered it.
Maybe you have a better approach in mind, possibly something this year. It
could be relevant.

Regards
___
gnucash-user mailing list
gnucash-user@gnucash.org
To update your subscription preferences or to unsubscribe:
https://lists.gnucash.org/mailman/listinfo/gnucash-user
-
Please remember to CC this list on all your replies.
You can do this by using Reply-To-List or Reply-All.


Re: [GNC] Configurable Year Start Day/Month

2023-04-20 Thread john
I'm not sure I understand your point. Nothing in the Sample report or the 
Custom Reports wiki page suggests changing the code that makes the options 
work, just how to use the existing options. Of course you can use GnuCash's 
existing code as a starting point just like you might use an existing answer on 
Stack Overflow as a starting point, or study anybody's code to learn ways of 
doing things. What has that got to do with modifying the internals of a program 
and expecting your modification to keep working in future versions?

Regards,
John Ralls

> On Apr 20, 2023, at 12:33 AM, flywire  wrote:
> 
> Fair enough. The quoted link is not part of a PR, it demonstrates the code, 
> and
> the thread from 2021 has extended into getting the functionality working
> again following subsequent code changes released in V5.
> 
> All scheme reports in GnuCash are internals, interpreted reports, with much
> of the repeatable code like the date options being modular. The Manual,
> wiki, and Sample Report all refer to and use existing reports as examples.
> Customising options is certainly part of customising reports and a
> particular focus of the Sample Report.
> 
> https://wiki.gnucash.org/wiki/index.php?title=Custom_Reports&oldid=17184#Introduction
>> Unfortunately, at the present time writing a custom report for GnuCash
> requires a little bit of hacking.
> 
> "For help on writing reports... consult the mailing list
> gnucash-de...@gnucash.org" didn't offer the guidance I was expecting for
> functionality that was previously working.
> 
> https://lists.gnucash.org/pipermail/gnucash-user/2023-April/106563.html
> John Ralls wrote:
> 
>> Nope, accounting periods didn't get fixed so everything I said in 2021
>> about that is still true.
>> 
>>> 
>> https://github.com/flywire/gnucash/blob/Fiscal-year/libgnucash/app-utils/date-utilities.scm#L557-L569
>> 
> ___
> gnucash-user mailing list
> gnucash-user@gnucash.org
> To update your subscription preferences or to unsubscribe:
> https://lists.gnucash.org/mailman/listinfo/gnucash-user
> -
> Please remember to CC this list on all your replies.
> You can do this by using Reply-To-List or Reply-All.

___
gnucash-user mailing list
gnucash-user@gnucash.org
To update your subscription preferences or to unsubscribe:
https://lists.gnucash.org/mailman/listinfo/gnucash-user
-
Please remember to CC this list on all your replies.
You can do this by using Reply-To-List or Reply-All.


Re: [GNC] Configurable Year Start Day/Month

2023-04-20 Thread flywire
Fair enough. The quoted link is not part of a PR, it demonstrates the code, and
the thread from 2021 has extended into getting the functionality working
again following subsequent code changes released in V5.

All scheme reports in GnuCash are internals, interpreted reports, with much
of the repeatable code like the date options being modular. The Manual,
wiki, and Sample Report all refer to and use existing reports as examples.
Customising options is certainly part of customising reports and a
particular focus of the Sample Report.

https://wiki.gnucash.org/wiki/index.php?title=Custom_Reports&oldid=17184#Introduction
> Unfortunately, at the present time writing a custom report for GnuCash
requires a little bit of hacking.

"For help on writing reports... consult the mailing list
gnucash-de...@gnucash.org" didn't offer the guidance I was expecting for
functionality that was previously working.

https://lists.gnucash.org/pipermail/gnucash-user/2023-April/106563.html
John Ralls wrote:

> Nope, accounting periods didn't get fixed so everything I said in 2021
> about that is still true.
>
> >
> https://github.com/flywire/gnucash/blob/Fiscal-year/libgnucash/app-utils/date-utilities.scm#L557-L569
>
___
gnucash-user mailing list
gnucash-user@gnucash.org
To update your subscription preferences or to unsubscribe:
https://lists.gnucash.org/mailman/listinfo/gnucash-user
-
Please remember to CC this list on all your replies.
You can do this by using Reply-To-List or Reply-All.


Re: [GNC] Configurable Year Start Day/Month

2023-04-18 Thread John Ralls
Flywire,

Nope, accounting periods didn't get fixed so everything I said in 2021 about 
that is still true. 

> https://github.com/flywire/gnucash/blob/Fiscal-year/libgnucash/app-utils/date-utilities.scm#L557-L569

Messing around in GnuCash's internals is only supported if the result gets 
accepted via a pull request. Otherwise it's a fork and with forks you always 
run the risk that we'll change or remove the underlying code and break your 
changes. That's true no matter what language the code is written in and it's 
true of every FLOSS project I've been involved with, which at this point is 
quite a few.

Regards,
John Ralls

> On Apr 18, 2023, at 4:03 PM, flywire  wrote:
> 
> Your assumptions are wrong. Clearly, communication from the developer(s)
> was ineffective. Full advice of the "major change" quoted in
> https://lists.gnucash.org/pipermail/gnucash-user/2023-April/106463.html
> with no response to the request for guidance.
> 
> On Tue, 18 Apr 2023 at 15:20, Vincent Dawans  wrote:
> 
>> ... It seems that John Ralls mentions the problems with it in the
>> discussion from 2021 you link that and hints that it might be changed in
>> version 5. I don't see a change as of 5.0 yet (unless I am missing
>> something) so I can only assume...
>> 
> ___
> gnucash-user mailing list
> gnucash-user@gnucash.org
> To update your subscription preferences or to unsubscribe:
> https://lists.gnucash.org/mailman/listinfo/gnucash-user
> -
> Please remember to CC this list on all your replies.
> You can do this by using Reply-To-List or Reply-All.

___
gnucash-user mailing list
gnucash-user@gnucash.org
To update your subscription preferences or to unsubscribe:
https://lists.gnucash.org/mailman/listinfo/gnucash-user
-
Please remember to CC this list on all your replies.
You can do this by using Reply-To-List or Reply-All.


Re: [GNC] Configurable Year Start Day/Month

2023-04-18 Thread flywire
Your assumptions are wrong. Clearly, communication from the developer(s)
was ineffective. Full advice of the "major change" quoted in
https://lists.gnucash.org/pipermail/gnucash-user/2023-April/106463.html
with no response to the request for guidance.

On Tue, 18 Apr 2023 at 15:20, Vincent Dawans  wrote:

> ... It seems that John Ralls mentions the problems with it in the
> discussion from 2021 you link that and hints that it might be changed in
> version 5. I don't see a change as of 5.0 yet (unless I am missing
> something) so I can only assume...
>
___
gnucash-user mailing list
gnucash-user@gnucash.org
To update your subscription preferences or to unsubscribe:
https://lists.gnucash.org/mailman/listinfo/gnucash-user
-
Please remember to CC this list on all your replies.
You can do this by using Reply-To-List or Reply-All.


Re: [GNC] Configurable Year Start Day/Month

2023-04-17 Thread Vincent Dawans
My comment was related to custom report creation from an
end-user perspective, which is to say using the given set of options. So
yes the move to c++ makes changing the supporting utility code on the fly
more difficult if that's something required (as in this case). That is a
limitation of going from an interpreted to a compiled language but I don't
think in itself it's a reason not to do it if other considerations like
code maintainability are to be considered.

For that specific issue there is no question the current implementation for
the financial/fiscal year doesn't make total sense (whether written in
scheme or C++ is irrelevant). It seems that John Ralls mentions the
problems with it in the discussion from 2021 you link that and hints that
it might be changed in version 5. I don't see a change as of 5.0 yet
(unless I am missing something) so I can only assume it's still in the
works or more help is needed to implement that fix. As much as it was
possible to hack a fix in version 4 I think it is worthwhile to focus on a
more permanent fix in version 5.

John Ralls says "GnuCash uses the term Accounting Period for non-calendar
fiscal years. There are two problems with this: First, it's in Preferences
instead of File properties so a user can't have different books with
different fiscal years and two users of the same book have to set their
preferences to the same Accounting Period. Second and maybe worse it sets
specific dates that don't roll over."

Hopefully we can join our efforts to help fix this feature so that hacking
code is no longer needed.

Sincerely,

Vincent Dawans



On Mon, Apr 17, 2023 at 9:11 PM flywire  wrote:

> I can't see how.
>
> Firstly, from previous comments, people don't seem to understand my
> workflow. The suggestion it is only a matter of setting the Accounting
> Period once per year is so wrong without changing start date of year.
>
> To briefly summarise, I have half a dozen entities and a few extras, each
> with separate tax file numbers in a standard folder structure. If an entity
> has it's own bank account it gets it's own set of books, otherwise, I use
> QuickBooks and put classes on transactions/splits and report on the
> classes. (My preference is the openness of GnuCash.) I normally navigate
> through the Windows folders and double-click on the entity.gnucash file or
> start it from the MRU list so it is easy to flick between entities.
>
> A typical workflow is preparing tax returns for the previous financial
> year. The V4 year hack defining start year as 1 July works well for all the
> reports I use with year being relative to current date (as opposed to
> accounting period which must be explicitly set). I often need to look at 2
> years prior, ie the last finalised tax return, but it doesn't have a date
> option so I set start/end of accounting period to the dates for 2
> (financial) years prior. This workflow allows me to identify issues with
> transactions/splits/accounts that often need something similar in another
> entity. I imagine the workflow is fairly typical.
>
> Accounting period is really useful for running a series of reports when the
> entity was different, say a particular project period.
>
> So, I very much want to define the current year which would also define
> prior year, keep the existing accounting period functionality, and add a
> start/end of 2 years prior period. A preference setting like currency for
> start date of year would be nice but I'd be happy with a hacked version.
>
> Regards
>
> https://lists.gnucash.org/pipermail/gnucash-user/2023-April/106523.html
> Adrien wrote:
> > I can certainly see the utility of being able to define various 'start
> > of year' options for different reports. Though I think this is
> > essentially what the 'accounting period' option was supposed to
> > accomplish. (and then the report's generic 'start of accounting period'
> > will use that date)
> >
> > However, this preference allows only either a very general relative
> > date, or an absolute date with a year, so it has to be reset if wanting
> > to set a specific date. I think there is already a bug report for it.
> >
> > If this preference offered the ability to set *any* day relative to
> > *any* year, would that accomplish your goal?
> >
> > (I still think a hard absolute date option is useful for someone working
> > on historical data)
> >
> > Regards,
> > Adrien
> ___
> gnucash-user mailing list
> gnucash-user@gnucash.org
> To update your subscription preferences or to unsubscribe:
> https://lists.gnucash.org/mailman/listinfo/gnucash-user
> -
> Please remember to CC this list on all your replies.
> You can do this by using Reply-To-List or Reply-All.
>
___
gnucash-user mailing list
gnucash-user@gnucash.org
To update your subscription preferences or to unsubscribe:
https://lists.gnucash.org/mailman/listinfo/gnucash-user
-
Please remember to CC this li

Re: [GNC] Configurable Year Start Day/Month

2023-04-17 Thread flywire
I can't see how.

Firstly, from previous comments, people don't seem to understand my
workflow. The suggestion it is only a matter of setting the Accounting
Period once per year is so wrong without changing start date of year.

To briefly summarise, I have half a dozen entities and a few extras, each
with separate tax file numbers in a standard folder structure. If an entity
has it's own bank account it gets it's own set of books, otherwise, I use
QuickBooks and put classes on transactions/splits and report on the
classes. (My preference is the openness of GnuCash.) I normally navigate
through the Windows folders and double-click on the entity.gnucash file or
start it from the MRU list so it is easy to flick between entities.

A typical workflow is preparing tax returns for the previous financial
year. The V4 year hack defining start year as 1 July works well for all the
reports I use with year being relative to current date (as opposed to
accounting period which must be explicitly set). I often need to look at 2
years prior, ie the last finalised tax return, but it doesn't have a date
option so I set start/end of accounting period to the dates for 2
(financial) years prior. This workflow allows me to identify issues with
transactions/splits/accounts that often need something similar in another
entity. I imagine the workflow is fairly typical.

Accounting period is really useful for running a series of reports when the
entity was different, say a particular project period.

So, I very much want to define the current year which would also define
prior year, keep the existing accounting period functionality, and add a
start/end of 2 years prior period. A preference setting like currency for
start date of year would be nice but I'd be happy with a hacked version.

Regards

https://lists.gnucash.org/pipermail/gnucash-user/2023-April/106523.html
Adrien wrote:
> I can certainly see the utility of being able to define various 'start
> of year' options for different reports. Though I think this is
> essentially what the 'accounting period' option was supposed to
> accomplish. (and then the report's generic 'start of accounting period'
> will use that date)
>
> However, this preference allows only either a very general relative
> date, or an absolute date with a year, so it has to be reset if wanting
> to set a specific date. I think there is already a bug report for it.
>
> If this preference offered the ability to set *any* day relative to
> *any* year, would that accomplish your goal?
>
> (I still think a hard absolute date option is useful for someone working
> on historical data)
>
> Regards,
> Adrien
___
gnucash-user mailing list
gnucash-user@gnucash.org
To update your subscription preferences or to unsubscribe:
https://lists.gnucash.org/mailman/listinfo/gnucash-user
-
Please remember to CC this list on all your replies.
You can do this by using Reply-To-List or Reply-All.


Re: [GNC] Configurable Year Start Day/Month

2023-04-17 Thread Adrien Monteleone
I can certainly see the utility of being able to define various 'start 
of year' options for different reports. Though I think this is 
essentially what the 'accounting period' option was supposed to 
accomplish. (and then the report's generic 'start of accounting period' 
will use that date)


However, this preference allows only either a very general relative 
date, or an absolute date with a year, so it has to be reset if wanting 
to set a specific date. I think there is already a bug report for it.


If this preference offered the ability to set *any* day relative to 
*any* year, would that accomplish your goal?


(I still think a hard absolute date option is useful for someone working 
on historical data)


Regards,
Adrien

On 4/14/23 7:22 PM, flywire wrote:

Vincent, you seem confident. I posted an example. Can you demonstrate
changing say Start of This Year to 1 July in V5?

Code at
https://github.com/flywire/gnucash/blob/Fiscal-year/libgnucash/app-utils/date-utilities.scm#L557-L569
works in V4 (check cur-year/cal-year). See comments at
https://lists.gnucash.org/pipermail/gnucash-devel/2021-September/045956.html

Regards

https://lists.gnucash.org/pipermail/gnucash-user/2023-April/106464.html
wrote:


As for the changes in version 5.0, they don't really impact the ability to
create custom reports... Bottom line version 5.0 is actually easier to work
with for creating options.

https://lists.gnucash.org/pipermail/gnucash-user/2023-April/106463.html
  wrote:


A new section is needed to address moving the option lists into C++ lists.
It seems those options, say start/end-of-year, could be overwritten in
scheme so they are customised before being used in reports, restoring
previous functionality.


___
gnucash-user mailing list
gnucash-user@gnucash.org
To update your subscription preferences or to unsubscribe:
https://lists.gnucash.org/mailman/listinfo/gnucash-user
-
Please remember to CC this list on all your replies.
You can do this by using Reply-To-List or Reply-All.