• Stars
    star
    98
  • Rank 345,811 (Top 7 %)
  • Language
    Ruby
  • License
    MIT License
  • Created about 11 years ago
  • Updated 10 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Double entry bookkeeping with Ruby on Rails

Keepr

This Ruby gem provides a double entry accounting system for use in any Rails application. It stores all the data via ActiveRecord in the SQL database.

Build Status Code Climate Coverage Status

Features

  • Journal entries with two or more postings follow the Double Entry principle
  • Accounts (including subaccounts and groups)
  • Taxes
  • Cost centers
  • Balance sheets
  • Profit and loss statements
  • DATEV exports

Dependencies

  • Ruby 3.0+
  • Rails 6.1+ (including Rails 7.1)

Installation

Add this line to your application's Gemfile:

gem 'keepr'

And then execute:

$ bundle

Or install it yourself as:

$ gem install keepr

Getting started

After installation run the following:

rails g keepr:migration
rails db:migrate

This will create the database migration files and add new models.

Usage

Account

All accounting entries are stored inside "accounts", per standard accounting principles. To create an account, use the following format:

Keepr::Account.create!(number: 27, name: 'Software', kind: :asset)

"kind" is one of following values:

[asset liability revenue expense forward debtor creditor]

Accounts can have "child" accounts. All entries posted in a child account will be shown in the "parent" account as well. To create a child account:

account_1400 = Keepr::Account.create!(number: 1400, name: 'Software', kind: :expense)
account_14001 = Keepr::Account.create!(number: 14001, name: 'Rails', parent: account_1400 , kind: :expense)

Accounts can be organised inside of groups:

group = Keepr::Group.create!(is_result: true, target: :liability, name: 'foo')
Keepr::Account.create!(number: 100, name: 'Trade payable', kind: :liability, keepr_group: group)

Groups also allow a parent/child hierarchy:

parent_group = Keepr::Group.create!(is_result: true, target: :liability, name: 'foo')
child_group = parent_group.children.create! name: 'Bar'

Journal

Simple journal:

simple_journal = Keepr::Journal.create keepr_postings_attributes: [
  { keepr_account: account_1000, amount: 100.99, side: 'debit' },
  { keepr_account: account_1200, amount: 100.99, side: 'credit' }
]

Complex journal:

complex_journal = Keepr::Journal.create keepr_postings_attributes: [
  { keepr_account: account_4920, amount: 8.40, side: 'debit' },
  { keepr_account: account_1576, amount: 1.60, side: 'debit' },
  { keepr_account: account_1600, amount: 10.00, side: 'credit' }
]

Entries can be locked for changing data:

simple_journal.update! permanent: true

Account balance

We can get an account balance as follows:

account_1000.balance

account_1000.balance(Date.today)

account_1000.balance(Date.yesterday...Date.today)

Tax account

// Create Tax account
Keepr::Account.create! number: 1776, name: 'Umsatzsteuer 19%', kind: :asset

tax = Keepr::Tax.create! name: 'USt19',
                       description: 'Umsatzsteuer 19%',
                       value: 19.0,
                       keepr_account: tax_account

// Create a sale account that links to the tax account
account = Keepr::Account.new number: 8400,
                             name: 'Erlöse 19% USt',
                             kind: :revenue,
                             keepr_tax: tax

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

Similar projects

Copyright (c) 2013-2023 Georg Ledermann, released under the MIT license

More Repositories

1

docker-rails

Dockerize Rails 7 with ActionCable, Webpacker, Stimulus, Elasticsearch, Sidekiq
Ruby
1,117
star
2

rails-settings

Manage settings with Ruby on Rails
Ruby
999
star
3

unread

Handle unread records and mark them as read with Ruby on Rails
Ruby
712
star
4

docker-rails-base

Optimized Docker image for Rails applications
Dockerfile
296
star
5

pingcrm

PingCRM on Rails - A Ruby on Rails demo application to illustrate how Inertia.js works
Ruby
282
star
6

templatus-hotwire

Opinionated template for starting new web applications with Ruby on Rails and Hotwire
Ruby
89
star
7

docker-vue

Frontend for DockerRails, built with Vue.js
Vue
85
star
8

drafting

Ruby gem for saving drafts of ActiveRecord models
Ruby
65
star
9

datev

Ruby gem for DATEV exports via CSV
Ruby
55
star
10

templatus

Opinionated template for starting new web applications with Ruby on Rails and Vue.js 3
Ruby
45
star
11

workcation

How to use Inertia.js to build a Vue.js frontend within a Ruby on Rails application (ARCHIVED)
Ruby
45
star
12

tinnef

Ruby wrapper for "tnef"
Ruby
13
star
13

blurhash-vue

Demo app to show progressive image loading with Blurhash
Vue
13
star
14

address_parser

Ruby
9
star
15

ibanomat

Ruby wrapper to calculate the IBAN of german bank account numbers
Ruby
7
star
16

docker-base

Base Docker image to build container for Ruby applications
5
star
17

dialy

Formatting phone numbers in E.123
Ruby
5
star
18

redundant_links

Automatic handling of a join table for indirect (transitive) associations.
Ruby
2
star
19

staticmatic-demo

Example of using StaticMatic to build static website with Ruby, HAML and SAS
Ruby
1
star