Double-entry accounting ledger packager
Perl 6
Switch branches/tags
Nothing to show
Permalink
Failed to load latest commit information.
bin s/returns/--> Mar 29, 2017
lib s/returns/--> Mar 29, 2017
t/exported-subroutines use TXN::Remarshal Sep 4, 2016
.gitignore allow passing txndir flag to mktxn, reup peru May 14, 2016
.hgignore
.peru.yml reup peru, git checkout commit ID Dec 3, 2016
.travis.yml update libxxhash to 0.6.3, -DBUILD_SHARED_LIBS=ON Sep 12, 2017
Build.pm replace panda with zef Aug 11, 2017
META6.json Use SPDX identifier in license field of META6.json Apr 21, 2017
README.md use TXN::Remarshal Sep 4, 2016
UNLICENSE Initial import Nov 13, 2015

README.md

TXN

Double-entry accounting ledger packager

Synopsis

cmdline

mktxn \
  --pkgname="txnjrnl" \
  --pkgver="1.0.0" \
  --pkgrel=1 \
  --pkgdesc="My transactions" \
  sample.txn

perl6

use TXN;

my Str $file = 'sample.txn';
my Str $pkgname = 'sample';
my Str $pkgver = '1.0.0';
my UInt $pkgrel = 1;
my %pkg = mktxn(:$file, :$pkgname, :$pkgver, :$pkgrel, :$pkgdesc);

Description

Serializes double-entry accounting ledgers to JSON package format.

Release Mode

In release mode, mktxn produces a tarball comprised of two JSON files:

.TXNINFO

Inspired by Arch Linux .PKGINFO files, .TXNINFO files contain accounting ledger metadata useful in simple queries.

{
   "count" : 112,
   "pkgrel" : 1,
   "entities-seen" : [
      "FooCorp",
      "Personal",
      "WigwamLLC"
   ],
   "pkgver" : "1.0.0",
   "pkgname" : "with-includes",
   "pkgdesc" : "txn with include directives",
   "compiler" : "mktxn v0.0.2 2016-05-10T10:22:44.054586-07:00"
}

txn.json

txn.json contains the output of serializing the accounting ledger to JSON.

[
  {
    "id" : {
      "xxhash" : 1468523538,
      "text" : "2014-01-01 \"I started the year with $1000 in Bankwest cheque account\"\n  Assets:Personal:Bankwest:Cheque      $1000.00 USD\n  Equity:Personal                      $1000.00 USD",
      "number" : [
        3
      ]
    },
    "header" : {
      "tag" : [ ],
      "important" : 0,
      "description" : "I started the year with $1000 in Bankwest cheque account",
      "date" : "2014-01-01"
    },
    "posting" : [
      {
        "annot" : null,
        "id" : {
          "xxhash" : 4134277096,
          "text" : "Assets:Personal:Bankwest:Cheque      $1000.00 USD",
          "entry-id" : {
            "xxhash" : 1468523538,
            "text" : "2014-01-01 \"I started the year with $1000 in Bankwest cheque account\"\n  Assets:Personal:Bankwest:Cheque      $1000.00 USD\n  Equity:Personal                      $1000.00 USD",
            "number" : [
              3
            ]
          },
          "number" : 0
        },
        "drcr" : "DEBIT",
        "decinc" : "INC",
        "amount" : {
          "asset-code" : "USD",
          "asset-symbol" : "$",
          "plus-or-minus" : null,
          "asset-quantity" : 1000
        },
        "account" : {
          "entity" : "Personal",
          "path" : [
            "Bankwest",
            "Cheque"
          ],
          "silo" : "ASSETS"
        }
      },
      {
        "annot" : null,
        "id" : {
          "xxhash" : 344831063,
          "text" : "Equity:Personal                      $1000.00 USD",
          "entry-id" : {
            "xxhash" : 1468523538,
            "text" : "2014-01-01 \"I started the year with $1000 in Bankwest cheque account\"\n  Assets:Personal:Bankwest:Cheque      $1000.00 USD\n  Equity:Personal                      $1000.00 USD",
            "number" : [
              3
            ]
          },
          "number" : 1
        },
        "drcr" : "CREDIT",
        "decinc" : "INC",
        "amount" : {
          "asset-code" : "USD",
          "asset-symbol" : "$",
          "plus-or-minus" : null,
          "asset-quantity" : 1000
        },
        "account" : {
          "entity" : "Personal",
          "path" : [ ],
          "silo" : "EQUITY"
        }
      }
    ]
  }
]

.TXNINFO and txn.json are compressed and saved as filename $pkgname-$pkgver-$pkgrel.txn.tar.xz in the current working directory.

Installation

Dependencies

Test Dependencies

To run the tests:

$ git clone https://github.com/atweiden/mktxn && cd mktxn
$ peru --file=.peru.yml --sync-dir="$PWD" sync
$ PERL6LIB=lib prove -r -e perl6

Licensing

This is free and unencumbered public domain software. For more information, see http://unlicense.org/ or the accompanying UNLICENSE file.