Re: Year end date

2021-02-22 Thread o1bigtenor
On Mon, Feb 22, 2021 at 3:36 PM Dan Sladden  wrote:
>
> Apologies - I'm not being very clear. I'm trying to total the entries for the 
> whole financial year that ends on (in my case) 5 April.
>
> This is the output of for example ledger broadband --yearly
> '2019-01-01' - '2019-12-31'   Expenses:Utilities:Broadband
> £ 350.14  £ 350.14
> '2020-01-01' - '2020-12-31'   Expenses:Utilities:Broadband
> £ 463.85  £ 813.99
> '2021-01-01' - '2021-12-31'   Expenses:Utilities:Broadband
>  £ 40.34  £ 854.33
>
> But what I want is this:
> '2019-04-06' - '2020-04-05'   Expenses:Utilities:Broadband
> £ 465.58  £ 465.58
> '2020-04-06' - '2021-04-05'   Expenses:Utilities:Broadband
> £ 388.75  £ 854.33
>
ledger reg -f /whereever/you/store/ledger'name'.dat --limit 'account
=~Expenses:Utilities:Broadband -b 2014.04.06 -e 2015.04.05

I modified what I sent earlier to the dating you're looking for.
What I do not know is if that phrase 'Expenses:Utilities:Broadband' is
the actual 'account name - - - - I use numbers.

You may have to experiment with the =~ part of the command.
If you run the years inline without closing each one out (I don't see
the need but ymmv) the search really doesn't care what
you beginning and ending dates are - - - - just enter them.

Now if you're entering your records so that one set ends on dec 31st
and the next starts on jan 1st
- - - - - well then things won't be so easy.

HTH

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"Ledger" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ledger-cli+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ledger-cli/CAPpdf5-Xeh-O_As%3D23k6tAecjiUC%2B3Z1iTvBaiTBVpo%3Df8eRYQ%40mail.gmail.com.


Re: Year end date

2021-02-22 Thread Dan Sladden
Apologies - I'm not being very clear. I'm trying to total the entries for
the whole financial year that ends on (in my case) 5 April.

This is the output of for example *ledger broadband --yearly*
'2019-01-01' - '2019-12-31'   Expenses:Utilities:Broadband
   £ 350.14  £ 350.14
'2020-01-01' - '2020-12-31'   Expenses:Utilities:Broadband
   £ 463.85  £ 813.99
'2021-01-01' - '2021-12-31'   Expenses:Utilities:Broadband
£ 40.34  £ 854.33

But what I want is this:
'2019-04-06' - '2020-04-05'   Expenses:Utilities:Broadband
  £ 465.58  £ 465.58
'2020-04-06' - '2021-04-05'   Expenses:Utilities:Broadband
  £ 388.75  £ 854.33

John, --group-by 'format_date(date, "%Y")' looks helpful as I could write a
function that maps the date onto the financial year (although leap years
would be a pain) but it won't aggregate the entries in the same way as
--yearly I don't think.

Dan

On Mon, 22 Feb 2021 at 21:08, John Wiegley  wrote:

> > "DS" == Dan Sladden  writes:
>
> DS> But none of this does what I want - a single list of tallied
> DS> transactions for each financial year from one ledger command. Yes, I
> DS> can do it by executing multiple commands with different -b and -e
> DS> arguments, but that's IMHO not very elegant.
>
> Have you tried --group-by 'format_date(date, "%Y")'?
>
> John
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"Ledger" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ledger-cli+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ledger-cli/CAJcMy37A2MwzRpX0YhL4vB1CWNk8VWpO4%2B6%3DqUP03PSkyXipcw%40mail.gmail.com.


Re: Year end date

2021-02-22 Thread John Wiegley
> "DS" == Dan Sladden  writes:

DS> But none of this does what I want - a single list of tallied
DS> transactions for each financial year from one ledger command. Yes, I
DS> can do it by executing multiple commands with different -b and -e
DS> arguments, but that's IMHO not very elegant.

Have you tried --group-by 'format_date(date, "%Y")'?

John

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"Ledger" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ledger-cli+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ledger-cli/m235xnq0dn.fsf%40newartisans.com.


Re: Year end date

2021-02-22 Thread o1bigtenor
On Mon, Feb 22, 2021 at 11:31 AM Dan Sladden  wrote:
>
> I get all this and I use -b and -e extensively!
>
> But none of this does what I want - a single list of tallied transactions for 
> each financial year from one ledger command. Yes, I can do it by executing 
> multiple commands with different -b and -e arguments, but that's IMHO not 
> very elegant.
>
> I like the output of --yearly
> I don't like that it has to be 1 Jan through to 31 Dec for each year.
>

Hmmm - - - -it doesn't 'have to be' Jan 1 to Dec 31!
You pick the dates - - - - - YOU.
So you want from Oct 1 to Sep 30 - - - - your choice.

Not sure what you mean by a 'list of tallied transactions'.

The command that I included in my previous email returns a list of
all the transactions for that account number in the period specified
and includes the total. I think that's what you want.

If you are able to give an example of what you're looking for
I am positive someone from the list will be able to help you develop
the command to achieve such - - - - that has been my experience.

As for elegance - - - - I prefer getting the job done quickly, I
suppose, so I've not worried about query 'elegance'.

HTH

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"Ledger" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ledger-cli+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ledger-cli/CAPpdf5_HXFf9NzBWDk3C5jy_y%3DP8DKGh8MqXWv2uAc0LdDZexQ%40mail.gmail.com.


Re: Year end date

2021-02-22 Thread Dan Sladden
I get all this and I use -b and -e extensively!

But none of this does what I want - a single list of tallied transactions
for each financial year from one ledger command. Yes, I can do it by
executing multiple commands with different -b and -e arguments, but that's
IMHO not very elegant.

I like the output of --yearly
I don't like that it has to be 1 Jan through to 31 Dec for each year.

:)



On Mon, 22 Feb 2021 at 14:40, Kent R. Spillner  wrote:

> > My solution has been to have a separate ledger file for each tax year
> > but that means transferring balances at the end of one year to create
> > the new year's file which sometimes leads to issues should anything need
> > to be updated in the previous year's records (missing entry, for
> > instance).
>
> Exactly, but you can work around that issue by using the include directive
> (see:
> https://www.ledger-cli.org/3.0/doc/ledger3.html#Command-Directives).
>
> For example, I have a script that writes out my year-end balances to the
> next year's
> directory (I create subdirectories in my top-level directory for every
> year) with a
> filename of "-opening-balances.ledger" (e.g.
> "2021/business-opening-balances.ledger" and
> "2021/personal-opening-balances.ledger").
> Then at the top of my "2021/business.ledger" and "2021/personal.ledger"
> files I just
> "include business-opening-balances.ledger" or
> "personal-opening-balances.ledger"
> respectively.
>
> That allows me to go back and automatically overwrite those files to
> adjust my opening
> balances at any time without having to edit any subsequent transaction.
>
>
> --
>
> ---
> You received this message because you are subscribed to the Google Groups
> "Ledger" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to ledger-cli+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ledger-cli/1614004814.116413098%40apps.rackspace.com
> .
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"Ledger" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ledger-cli+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ledger-cli/CAJcMy34E1V6twTB4oV7JQ%3DoT83cEbf3MRsxWm4JvohHiTxC91A%40mail.gmail.com.


Re: Year end date

2021-02-22 Thread Kent R. Spillner
> My solution has been to have a separate ledger file for each tax year
> but that means transferring balances at the end of one year to create
> the new year's file which sometimes leads to issues should anything need
> to be updated in the previous year's records (missing entry, for
> instance).

Exactly, but you can work around that issue by using the include directive (see:
https://www.ledger-cli.org/3.0/doc/ledger3.html#Command-Directives).

For example, I have a script that writes out my year-end balances to the next 
year's
directory (I create subdirectories in my top-level directory for every year) 
with a
filename of "-opening-balances.ledger" (e.g.
"2021/business-opening-balances.ledger" and 
"2021/personal-opening-balances.ledger").
Then at the top of my "2021/business.ledger" and "2021/personal.ledger" files I 
just
"include business-opening-balances.ledger" or "personal-opening-balances.ledger"
respectively.

That allows me to go back and automatically overwrite those files to adjust my 
opening
balances at any time without having to edit any subsequent transaction.


-- 

--- 
You received this message because you are subscribed to the Google Groups 
"Ledger" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ledger-cli+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ledger-cli/1614004814.116413098%40apps.rackspace.com.


Re: Year end date

2021-02-22 Thread Kent R. Spillner
In addition to what o1bigtenor suggested I also like to add a little structure 
to
the organization of my ledger files and make heavy use of ledger's include
directive (see: 
https://www.ledger-cli.org/3.0/doc/ledger3.html#Command-Directives).

For example, in my top-level directory I create subdirectories for every year, 
i.e.
2019/, 2020/, 2021/, etc.  Also in my top-level directory I create a bunch of 
ledger
files that *only* contain include directives, e.g. 2021.ledger contains just 
the two
lines "include 2021/business.ledger" and "include 2021/personal.ledger"; these 
are
the files I pass to ledger on the command line.  Then inside each year-based 
subdir
I create a bunch of files that actually record all of my financial transactions,
organized in whatever way makes the most sense (e.g. my "2021/personal.ledger" 
file
also just includes a bunch of files, like "include checking.ledger" and
"include mortgage.ledger").

Ok, so how would this help with different tax year end date?  Currently, all of 
my
tax years end on December 31, but if I ever had a need to support something 
else I
would just add a new file in my top-level directory such as 
"2020-tax-year.ledger"
that just contains the lines "include 2019/whatever.ledger" and
"include 2020/whatever.ledger".  And then so I don't forget to add the 
appropriate
--begin and --end command line arguments I would write a wrapper script in my
top-level directory such as "tax-year-report.sh".


-Original Message-
From: "Eric S Fraga" 
Sent: Monday, February 22, 2021 07:32
To: ledger-cli@googlegroups.com
Subject: Re: Year end date

On Monday, 22 Feb 2021 at 07:20, o1bigtenor wrote:
> May I suggest that you are making life more difficult for yourself and
> to the OP there is a simple yet, imo anyway, elegant solution.

Thank you.  I do use -b and -e as well.

-- 
Eric S Fraga via Emacs 28.0.50 & org 9.4.4 on Debian bullseye/sid

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"Ledger" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ledger-cli+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ledger-cli/87v9akqlcu.fsf%40ucl.ac.uk.


-- 

--- 
You received this message because you are subscribed to the Google Groups 
"Ledger" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ledger-cli+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ledger-cli/1614004193.583216506%40apps.rackspace.com.


Re: Year end date

2021-02-22 Thread Eric S Fraga
On Monday, 22 Feb 2021 at 07:20, o1bigtenor wrote:
> May I suggest that you are making life more difficult for yourself and
> to the OP there is a simple yet, imo anyway, elegant solution.

Thank you.  I do use -b and -e as well.

-- 
Eric S Fraga via Emacs 28.0.50 & org 9.4.4 on Debian bullseye/sid

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"Ledger" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ledger-cli+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ledger-cli/87v9akqlcu.fsf%40ucl.ac.uk.


Re: Year end date

2021-02-22 Thread o1bigtenor
On Mon, Feb 22, 2021 at 6:34 AM Eric S Fraga  wrote:
>
> On Monday, 22 Feb 2021 at 00:59, Dan Sladden wrote:
> > Is there a way of specifying the date of the financial year end so I can
> > use --yearly (or an appropriate *PERIOD_EXPRESSION)* to show annual data
> > for each year from e.g. 6 April to 5 April?
>
> This would be a nice feature to have!
>
> My solution has been to have a separate ledger file for each tax year
> but that means transferring balances at the end of one year to create
> the new year's file which sometimes leads to issues should anything need
> to be updated in the previous year's records (missing entry, for
> instance).
>

May I suggest that you are making life more difficult for yourself and
to the OP there is a simple yet, imo anyway, elegant solution.

This solution was given at least in part, to me here on the forum,
 and I then modified it to fit my needs. (Can't remember the kind soul
who gave me the information originally but huge kudos to them and
this list for their helpfulness!!!)

ledger reg -f /home/memyself/ledger2014-19.dat --limit 'account =~
/9795\.[0-9][0-9]\.[0-9][0-9]\.[0-9][0-9]/' -b 2014.01.01 -e
2014.12.31
(This is all on one line in your terminal! I tend to use 132 or even wider
terminal screens!!)

The part that is specific for the OP would be the last two 'commands'
(dunno if that's the right word - - - - sorry!).
With this you are asking for the search to be performed from the first
date of the fiscal year 2014 (the -b command) to
the last day of fiscal year 2014 (the e command).

I have 10 digit account numbers in a format like xxx.xx.xx.xx so
search will give not only all the items that
fall within the search (each item with its date) but there is also a
sum included (total of all the records!).

So for my tax records - - - - account 9795 has a specific meaning and
then I enter the total in the tax
document.

Very very simple - - - - ledger IS your record keeping friend.

(I'm working on how to use it for not only accounts receivable and
accounts payable but also for
invoicing and account aging - - - so far not in practice but have been
working on a possible technique.
Ledger seriously rocks for business use!!!)

HTH

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"Ledger" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ledger-cli+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ledger-cli/CAPpdf59e1r6BE0zautwDR2NTA4A75gxbOS3JvXEyGow6J2T2sg%40mail.gmail.com.


Re: Year end date

2021-02-22 Thread Eric S Fraga
On Monday, 22 Feb 2021 at 00:59, Dan Sladden wrote:
> Is there a way of specifying the date of the financial year end so I can 
> use --yearly (or an appropriate *PERIOD_EXPRESSION)* to show annual data 
> for each year from e.g. 6 April to 5 April?

This would be a nice feature to have!

My solution has been to have a separate ledger file for each tax year
but that means transferring balances at the end of one year to create
the new year's file which sometimes leads to issues should anything need
to be updated in the previous year's records (missing entry, for
instance).

-- 
Eric S Fraga via Emacs 28.0.50 & org 9.4.4 on Debian bullseye/sid

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"Ledger" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ledger-cli+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ledger-cli/87lfbgs2lv.fsf%40ucl.ac.uk.


Year end date

2021-02-22 Thread Dan Sladden
Is there a way of specifying the date of the financial year end so I can 
use --yearly (or an appropriate *PERIOD_EXPRESSION)* to show annual data 
for each year from e.g. 6 April to 5 April?

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"Ledger" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ledger-cli+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ledger-cli/f99e418f-9887-4004-9e73-189efb197b78n%40googlegroups.com.