epogrebnyak / abacus

A small yet valid double-entry accounting system in Python and command line.
https://epogrebnyak.github.io/abacus/
GNU General Public License v3.0
59 stars 4 forks source link

Handle transaction with more than 2 accounts #55

Closed elkarouh closed 1 year ago

elkarouh commented 1 year ago

In Europe, we have VAT. So a purchase might involve cash, assets and VAT. Is it possible to handle it.

By the way, there is a bug in the latest version. First 'Logger' is written with cyrillic o instead of latin o. Second logger: Logger = Logger() should become logger: Logger = field(default_factory=Logger)

epogrebnyak commented 1 year ago

@elkarouh - thanks for spotting Logger problem - now fixed in 0.7.3

purchase with VAT seems a good case for multiple entry - I have it in Python code, not exposed to CLI yet, but easier to do now when abacus is migrating to click package,

# simple entry
abacus post entry --debit cash --credit equity --amount 1000
# compound entry
abacus post multiple --debit ar 120 --credit vat_incoming 20 --credit sales 100 --credit ar 80 --debit cash 80
# operation
abacus post operation --operation invoice 200 --operation  cost 100

Does compond entry syntax seem reasonable to you? abacus post compound is another possiblity to name it

elkarouh commented 1 year ago

Hi, Glad you fixed the issue. Instead of 'multiple', I would rather use 'compound' but this is a matter of preference.

I don't understand the example you gave (i am no expert in accounting).

abacus post multiple --debit ar 120 --credit vat_incoming 20 --credit sales 100 --credit ar 120 --debit cash 120

Why do you need --debit ar 120 -credit ar 120 ? Regards

On Sun, Oct 22, 2023 at 3:57 PM Evgeny Pogrebnyak @.***> wrote:

@elkarouh https://github.com/elkarouh - thanks for spotting Logger problem - now fixed in 0.7.3

purchase with VAT seems a good case for multiple entry - I have it in Python code, not exposed to CLI yet, but easier to do now when abacus is migrating to click package,

simple entry

abacus post entry --debit cash --credit equity --amount 1000

compound entry

abacus post multiple --debit ar 120 --credit vat_incoming 20 --credit sales 100 --credit ar 120 --debit cash 120

operation

abacus post operation --operation invoice 200 --operation cost 100

Does compond entry syntax seem reasonable to you?

— Reply to this email directly, view it on GitHub https://github.com/epogrebnyak/abacus/issues/55#issuecomment-1774102774, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAXGMARUW76IBJD7E5NYGNTYAUQ57AVCNFSM6AAAAAA6GTAHRKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTONZUGEYDENZXGQ . You are receiving this because you were mentioned.Message ID: @.***>

epogrebnyak commented 1 year ago

Why do you need --debit ar 120 -credit ar 120 ?

I think I was jamming too much into one transaction, this was two things in one:

Here is a better example:

abacus post compound --debit ar 120 --credit vat_out 20 --credit sales 100 --title "Invoice with VAT 20%" --date 2023-10-01
abacus post single --debit cogs --credit inventory --amount 45 --title "Register cost of sales" --date 2023-10-01
abacus post single --debit cash --credit cr --amount 80 --title "Accept payment in cash" --date 2023-10-01
abacus post single --debit cash --credit cr --amount 40 --title "Accept payment in cash" --date 2023-10-22"

It would be nice to share some id across the transactions, for example abacus event --title "Sales contract #2023-35" may issuese some id like b9fa21, that can be later referred to by --event b9fa21 flag. Maybe there is any other strategy to link or relate to four entries above.

I was also thinking about "transaction-based" interface, similar to medici package, it more easier todo it in parogramming interface than CLI though:

const journal = await myBook
  .entry("Received payment")
  .debit("Assets:Cash", 1000)
  .credit("Income", 1000, { client: "Joe Blow" })
  .commit();
epogrebnyak commented 1 year ago

as a note to myself, maybe abacus post compound --operation cost 45 also viable

epogrebnyak commented 1 year ago

@elkarouh - we now have post-compound:

cx init
abacus chart add --asset cash
abacus chart add --income sales
abacus chart add --liability vat
abacus ledger post-compound --debit cash 120 --credit sales 100 --credit vat 20
abacus report report --trial-balance

This results in:

            Account            Debit  Credit
asset:cash (Cash).............   120      0
liability:vat (Vat)...........     0     20
income:sales (Sales)..........     0    100
capital:re (Retained earnings)     0      0
epogrebnyak commented 1 year ago

The example is at https://github.com/epogrebnyak/abacus/blob/main/scripts/vat/vat.sh

I think I shoudl close even though more docs are needed (eg in README)

elkarouh commented 1 year ago

Awesome, thanks for the update!

On Sat, Nov 4, 2023, 23:38 Evgeny Pogrebnyak @.***> wrote:

Closed #55 https://github.com/epogrebnyak/abacus/issues/55 as completed.

— Reply to this email directly, view it on GitHub https://github.com/epogrebnyak/abacus/issues/55#event-10863759754, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAXGMAX5TY3KDZHTQ3IM6ALYC27XPAVCNFSM6AAAAAA6GTAHRKVHI2DSMVQWIX3LMV45UABCJFZXG5LFIV3GK3TUJZXXI2LGNFRWC5DJN5XDWMJQHA3DGNZVHE3TKNA . You are receiving this because you were mentioned.Message ID: @.***>

elkarouh commented 1 year ago

I just downloaded it. It seems broken. You have the same dataclass bug at another place. In char_command.py: line 20 and 21 should be: class ChartCommand(BaseCommand): chart: Chart = field(default_factory=Chart)

The example you gave in also broken: abacus report report --trial-balance should be abacus report trial-balance

epogrebnyak commented 1 year ago

Strange - tasts do pass and in README there is specifically 'abacus report trial-balance' . Where do you happen to get example from?

By saying downloaded - are you downloading from pip or from git?

epogrebnyak commented 1 year ago

Vat.sh is wrong example, I get it

epogrebnyak commented 1 year ago

How does dataclass bug manifest? Which python version do you use?

epogrebnyak commented 1 year ago

pushed ay some changes in v 0.7.7 - @elkarouh can you please check?

elkarouh commented 1 year ago

I get the same dataclass problem at line 20 of chart_command.py. I applied the same fix again. I use python 3.11. I wonder how this works for you because this is not a recent feature. Regards

On Thu, Nov 9, 2023 at 4:56 AM Evgeny Pogrebnyak @.***> wrote:

pushed ay some changes in v 0.7.7 - @elkarouh https://github.com/elkarouh can you please check?

— Reply to this email directly, view it on GitHub https://github.com/epogrebnyak/abacus/issues/55#issuecomment-1803162870, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAXGMASCMNNSPBNVMTY3HQ3YDRO6XAVCNFSM6AAAAAA6GTAHRKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMBTGE3DEOBXGA . You are receiving this because you were mentioned.Message ID: @.***>

epogrebnyak commented 1 year ago

Strange indeed! Mind if we dig a bit to find out?

What are your commands to install abacus and to run the program to reproduce error?

чт, 9 нояб. 2023 г., 15:01 elkarouh @.***>:

I get the same dataclass problem at line 20 of chart_command.py. I applied the same fix again. I use python 3.11. I wonder how this works for you because this is not a recent feature. Regards

On Thu, Nov 9, 2023 at 4:56 AM Evgeny Pogrebnyak @.***> wrote:

pushed ay some changes in v 0.7.7 - @elkarouh https://github.com/elkarouh can you please check?

— Reply to this email directly, view it on GitHub https://github.com/epogrebnyak/abacus/issues/55#issuecomment-1803162870,

or unsubscribe < https://github.com/notifications/unsubscribe-auth/AAXGMASCMNNSPBNVMTY3HQ3YDRO6XAVCNFSM6AAAAAA6GTAHRKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMBTGE3DEOBXGA>

. You are receiving this because you were mentioned.Message ID: @.***>

— Reply to this email directly, view it on GitHub https://github.com/epogrebnyak/abacus/issues/55#issuecomment-1803701836, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACGWBLSZEY7CWHRRKR5BPKLYDTA23AVCNFSM6AAAAAA6GTAHRKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMBTG4YDCOBTGY . You are receiving this because you modified the open/close state.Message ID: @.***>

epogrebnyak commented 1 year ago

https://replit.com/@IevghieniiPogh1/ImpoliteTechnoMosaic#main.sh

In here you could see three comamnds finish up running:

pip install abacus-py
curl https://raw.githubusercontent.com/epogrebnyak/abacus/main/scripts/vat/vat.sh > vat.sh
source vat.sh

in replit - can run source vat.sh

epogrebnyak commented 1 year ago

@elkarouh, closing for now, please let me know how things work on your side or in replit.