u/cottagepainter

46 post karma · 56 comment karma · joined Apr 2020

  1. 5points

    Payroll and PTA (self.plaintextaccounting)

    2 comments

  2. 1points

    Ideas for dealing with Sales Tax (self.plaintextaccounting)

    5 comments

  3. 3points

    Automated Postings with changing commodities (self.plaintextaccounting)

    4 comments

  4. 5points

    Help with tracking inventory and conversions (self.plaintextaccounting)

    13 comments

  5. 1points

    Vdirsyncer not downloading all entries (self.EteSync) [help]

    0 comments

cottagepainter

Cool. Its part of the archlinux package csvkit. Another set of tools for me to play with. Thanks.

cottagepainter

What is csvlook?

cottagepainter

Assuming your good with a command-line, try running you book through

hledger -f - print

hledger can parse most, but not all, of ledger's syntax. It will output a book you can use with hledger and most likely with ledger as well.

For me, i maintain two copies of my book, one for ledger and one for hledger. They are both pretty much the same except i use ledger's expression matching in my automatic and periodic transactions. Other then that, they are the same.

I manage the construction of these two books with a makefile and then i have a shell script led to interface with them, selecting hledger or ledger depending on which functions i want to use. So far its working great!

cottagepainter

Thank you. I'm new to payroll and it looks like a giant pain in the ass. Hope my brain can eventually forge some simplicity out of it all.

cottagepainter

Great blog post link! This seems to me like something that you can't do. In my experience so far, ledger has so many little features and they don't always combine in the ways you would want them to. You might consider trying this in hledger which is normally more consistant.

cottagepainter

Hey,

I was a complete newbie myself starting last november (2021). I started using ledger and reading the ledger book (https://www.ledger-cli.org/docs.html). Then i learned about hledger. Right now, i'm using both ledger and hledger as the syntax is mostly the same and both provide useful functions which the other does not.

The best resource for starting out is https://plaintextaccounting.org/. It contains links to blog posts and resources to get you started. I read every single one.

As for importing, i started using ledger's import system, but hledger is far more developed and robust. The system is well documented here https://hledger.org/hledger.html#csv-format. There are lots of importing programs people have made, many have been compiled at https://plaintextaccounting.org/#data-importconversion

To get you started, here is rules file using hledger's import system for one of my checking accounts

account1 personal:assets:bank:checking
currency $
date-format %Y-%m-%d
fields date, description, amount-out, amount-in
newest-first

include ../categorize.rules

Reading the blogs to understand the general ideas of PTA and then going to the nitty gritty of the documentation, and then going back and forth between them is the way to go. There is no royal road to PTA.....or accounting in general. I knew pretty much nothing about it all when i started. Took me about 2 months.

cottagepainter

Yes you are probably right. Sounds like a lot of extra work :(.

I think this approach can be implemented, as u/tbm stated, with tags and automatic transactions. Go through all transactions and add tags like

; :HST:

Then use automatic transactions to add the appropriate postings.

Would you mind giving an example of the method your proposing/actually using.

cottagepainter

Thank you. Fixed.

cottagepainter

Slick. Yah i'll probably do this going forward. This is my first tax season using PTA's and it's changing the way I record and think about everything 'accounting'.

Why wouldn't you do

2022-1-16 ! Gas
  Expenses:Gas:honda  10.880 gal @@ 31.54 USD
  Liabilities:Visa

Instead? That is, use accounts instead of tags?

cottagepainter

Found this old thread with the solution, https://www.reddit.com/r/plaintextaccounting/comments/7wcfyz/ledger_cli_automated_parallel_transaction_in/.

Trick is that the result takes the commodity of the first amount. Thus all i have to do is

= expenses:gas and expr 'payee =~ /LOCAL GAS STATION/'
    (expenses:gas)  (0.59523 Litre * amount)
  • Sadly have to invert the per-litre amount because you can't do expressions within expression
cottagepainter

For whom it may concern, using suggestions found in this thread, i'm positing the format i've decided (for now) to use.

commodity G
  format  1 G

2021-05-18 Opening Balance
    paintingcompany:equity:paint:leftover:ben:32567           -6 G {=$72.00}
    paintingcompany:equity:paint:leftover:aura:30114          -2 G {=$48.65}
    paintingcompany:equity:paint:leftover:aura:bowling green  -9 G {=$48.65}
    paintingcompany:assets:paint:bought:ben:32567              6 G {=$72.00}
    paintingcompany:assets:paint:bought:aura:30114             2 G {=$48.65}
    paintingcompany:assets:paint:bought:aura:bowling green     9 G {=$48.65}

2021-05-20 Paint Store
    paintingcompany:liabilities:creditcard
    paintingcompany:assets:paint:bought:ben:32655  2 G {=$82.95}

2021-05-20 Job 1
    paintingcompany:assets:paint:bought:ben:32655  -2 G {=$82.95}
    paintingcompany:expenses:paint:used:ben:32655

2021-05-21 Paint Store
    paintingcompany:liabilities:creditcard
    paintingcompany:assets:paint:bought:aura:bowling green  12 G {=$56.95}

2021-05-21 Job 2
    paintingcompany:assets:paint:bought:aura:bowling green   -9 G {=$48.65}
    paintingcompany:assets:paint:bought:aura:bowling green   -9 G {=$56.95}
    paintingcompany:expenses:paint:used:aura:bowling green

2021-05-21 Job 2
    paintingcompany:assets:paint:bought:aura:bowling green    -1 G {=$56.95}
    paintingcompany:expenses:paint:leftover:aura:bowling green

2021-05-22 Job 2
    paintingcompany:assets:paint:bought:aura:30114  -2 G {=$48.65}
    paintingcompany:expenses:paint:used:aura:30114

Highlights

  • Uses ledger lots
    • although hledger doesn't use this syntax, it can parse it
  • Uses accounts to track individual paints
    • rather then a commoditiy to differentiate each paint

And i get nice reports like

Where did the gallons go?

>ledger -f - bal -X G --depth 4
                   0  paintingcompany
                 8 G    assets:paint:bought
               -17 G    equity:paint:leftover
                23 G    expenses:paint
                 1 G      leftover
                22 G      used
               -14 G    liabilities:creditcard
--------------------
                   0

Where did the money for paint go?

>ledger -f - bal -X $ --depth 4
                   0  paintingcompany
             $545.90    assets:paint:bought
            $-967.15    equity:paint:leftover
            $1270.55    expenses:paint
              $56.95      leftover
            $1213.60      used
            $-849.30    liabilities:creditcard
--------------------
                   0

How much of each paint was used and how?

>ledger -f - bal -X G expenses:paint
                23 G  paintingcompany:expenses:paint
                 1 G    leftover:aura:bowling green
                22 G    used
                20 G      aura
                 2 G        30114
                18 G        bowling green
                 2 G      ben:32655
--------------------
                23 G
cottagepainter

Hi!

Thank you for the clarifications. My account choices are correct from my end i just didn't include explanations.

leftover might not be the best term for my meaning. Basically, leftover paint, as an expense, is paint which i didn't need but left with the client for him to use. So technically it is an expense because i gave it to the client. I 'spent it'.

I prefer just paintingcompany:assets:paint as that means its the paint i own right now. Whether i bought it or somebody gave it to me is irrelevent to me.

cottagepainter

Thank you for the response sir, and for the wonderful program you have created.

Using an entity ("paintingcompany") as the top-level account - nice, I do the same so that I can "cheat" and keep multiple entities in one set of files. When doing this you'll want to declare some account types (see manual) so that bs/is/cf reports can work.

I got that idea from you in some other thread. That saved me because i was going to go the 'seperate ledger for each business' route, but its much better to just have everything in the same ledger and generate on the fly what you need. Speed might become a problem in 20 years, but by then computers should be faster too so who cares.

How many entities (something with its own assets) are you tracking, actually ? In the first entry you record a negative expense, but from paintingcompany's point of view that seems more like a revenue (paint received) ? I think this might be a problem of trying to track both money and paint at the same time. I would try tracking each of these in entirely separate journals first, and once both of those are crystal clear I might try combining.

So normally painters will have a single paint store they do business with, in this example, i named mine paintingcompany:expenses:paintstore. I don't own paintstore.

Second, in my business, i pay paintstore monthly. That is, everything i bought, including equipment as well as paint, is contained in one transaction. In my actual ledger i have something like this,

2021-06-01 Paintstore - May's purchases
    paintingcompany:assets:bank:checking   -$5000.00
    paintingcompany:expenses:paintstore

So when i was building my paint inventory in ledger, i came up with

2021-05-20 Paint Store - purchased 4 gallons of Aura
    paintingcompany:expenses:paintstore
    paintingcompany:assets:paint  4 AFG @ $75.00

Because the money for all that paint has been put into paintingcompany:expenses:paintstore already, i'm just removing the paint from the transaction. So thats why its a negative expense, the paint is in there and i'm taking it out of there.

But writing the cost price twice like that is not normal. I think there's some better way to use assets and expenses here, which will make the entries and reports more natural.

One model for inventory transactions that i've come up with is something like this:

2021-05-20 Paint Store - purchased 4 gallons of Aura
    paintingcompany:expenses:paintstore
    paintingcompany:assets:paint  $300
    paintingcompany:assets:paint  4 AFG
    paintingcompany:assets:paint  4 G

So each transaction will contain all the information needed in itself, no conversions required. A bit tedious but seems like a good idea. What do you think?

Here is the original ledger i posted in the new format, note that theres no more need for P-lines.

account paintingcompany:assets:paint
account paintingcompany:expenses:paintstore
account paintingcompany:expenses:paint:used
account paintingcompany:expenses:paint:leftover

commodity AFG   ; Benjamin Moore Aura - Fog Gray
commodity BCW   ; Benjamin Moore BEN - Cloud White
commodity G     ; Generic Gallon
    format 1.00 G

2021-05-20 Paint Store - purchase 4 gallons of Aura
    paintingcompany:expenses:paintstore
    paintingcompany:assets:paint  $300
    paintingcompany:assets:paint  4 AFG
    paintingcompany:assets:paint  4 G

2021-05-28 Job 1 - Used 3 AFG
    paintingcompany:assets:paint
    paintingcompany:expenses:paint:used  $225
    paintingcompany:expenses:paint:used  3 AFG
    paintingcompany:expenses:paint:used  3 G

2021-05-28 Job 1 - 1 AFG leftover
    paintingcompany:assets:paint
    paintingcompany:expenses:paint:leftover  $75
    paintingcompany:expenses:paint:leftover  1 AFG
    paintingcompany:expenses:paint:leftover  1 G

2021-06-01 Paint Store - purchase 6 gallons of BEN
    paintingcompany:expenses:paintstore
    paintingcompany:assets:paint  $330
    paintingcompany:assets:paint  6 BCW
    paintingcompany:assets:paint  6 G

2021-06-07 Job 2 - Used 4 BCW
    paintingcompany:assets:paint
    paintingcompany:expenses:paint:used  $220
    paintingcompany:expenses:paint:used  4 BCW
    paintingcompany:expenses:paint:used  4 G

2021-06-07 Job 2 - 2 BCW leftover
    paintingcompany:assets:paint
    paintingcompany:expenses:paint:leftover  $110
    paintingcompany:expenses:paint:leftover  2 BCW
    paintingcompany:expenses:paint:leftover  2 G

Then i can do

>hledger -f - bal
               $-630
              -4 AFG
              -6 BCW
            -10.00 G  paintingcompany:expenses:paintstore
                $445
               3 AFG
               4 BCW
              7.00 G  paintingcompany:expenses:paint:used
                $185
               1 AFG
               2 BCW
              3.00 G  paintingcompany:expenses:paint:leftover
--------------------
                   0  

Which contains all the information i should ever need.

cottagepainter

Hey man, thanks for the help!!

I figured out that with ledger, i could add the -H flag, and then it works

>ledger -f - bal -X G -H
                   0  paintingcompany:expenses
             10.00 G    paint
              3.00 G      leftover
              7.00 G      used
            -10.00 G    paintstore
--------------------
                   0

The problem was that by default, ledger uses the latest declared price for conversion, which screws up earlier transactions. However the -H flag makes it so that the conversion algorithm uses the pricing delcared at the time of transaction.

hledger has a similar flag, but it doesnt seem to work...

>hledger -f - bal --value 'then,G' --infer-market-price
             -8.40 G  paintingcompany:expenses:paintstore
              5.93 G  paintingcompany:expenses:paint:used
              2.47 G  paintingcompany:expenses:paint:leftover
--------------------
               0  

On your suggestions, i think your absolutly right, i need to represent the transaction between me and the paint store (with $), and then the paint store giving me paint (G). This will naturally give me more of what i want.

I've been messing around with a bunch of different ways i could represent it all. Really opens your mind to PTA, i'm completely free to model the sitation anyway i want. Bit overwhelming at first to say the least.

Thanks so much!!!

cottagepainter

Yep. I just switched as well. That and switching youtube-dl for the fork yt-dlp.

cottagepainter

Must have feature here. Should be able to sort by list and tag.

cottagepainter

I think you can adjust such settings in your youtube settings.

cottagepainter

I use a shell function like this in my scripts,

quteHistory() { local dbfile=$HOME/.local/share/qutebrowser/history.sqlite test -f "$dbfile" || exit sqlite3 "$dbfile" "select url, title, atime from History" | sort -t '|' -k '3,3n' }

And then, for example, i format the output and pipe it into dmenu

cottagepainter

This is pretty much how i use youtube

cottagepainter

Put the following in your config.py

```

block youtube ads from playing. still have to skip them however.

def filter_yt(info: interceptor.Request): url = info.request_url if (url.host() == "www.youtube.com" and url.path() == "/get_video_info" and "&adformat=" in url.query() ): info.block()

interceptor.register(filter_yt)

spawn mpv

config.bind('w', 'spawn -d mpv {url}', mode='normal') ```