plutus icon indicating copy to clipboard operation
plutus copied to clipboard

Sub account possible?

Open ccfiel opened this issue 9 years ago • 9 comments

Hello Guys,

Great gem! ;) Anyway is it possible to create a sub account.

Example I have an Account Current Asset under asset. Then Under Current Asset I have a sub account Bank number 1 and Bank Number 2. Also under Current Assets I have a sub account Prepaid.

Asset
=====
   Current Asset
         Bank 1
         Bank 2
    Prepaid
         Another Account 1
         Another Account 2

Which I can get the balance for the sub account or the main account.

Is it possible in plutus?

ccfiel avatar Nov 01 '15 09:11 ccfiel

I have the same question

amicheals avatar Dec 07 '15 20:12 amicheals

Yes I feel like this should work. I will look at the codebase and see. However, what do the maintainer/s think? @mbulat?

ramontayag avatar Mar 03 '16 00:03 ramontayag

Does anyone solved the problem?

maxigarciaf avatar Mar 30 '16 15:03 maxigarciaf

I'd like to avoid building in any tree bases structure into the models, since it would increase complexity. I've used gems like awesome_nested_set in the past, but I'd also like to keep dependencies to a minimum.

A standard way to do something like this in accounting is to use accounting codes. There's been some discussion about this in #10. So for example a small organization would use something like

010 Cash
020 Petty cash
030 Accounts receivable
100 Fixed assets – Computer equipment
110 Fixed assets – Computer software
120 Fixed assets – Furniture and fixtures
...

A larger organization might use

Account No. Division    Department  Description
10-00-010   Boston  xxx Cash
10-00-020   Boston  xxx Petty cash
10-00-030   Boston  xxx Accounts receivable
10-20-800   Boston  Sales   Bank charges
10-20-805   Boston  Sales   Benefits
10-20-810   Boston  Sales   Depreciation
10-20-815   Boston  Sales   Insurance
20-00-010   Omaha   xxx Cash
20-00-020   Omaha   xxx Petty cash
20-00-030   Omaha   xxx Accounts receivable
...

If someone has a way to implement account codes and a rollup feature that would be agnostic to some number of formats, I'd welcome comments or PRs!

mbulat avatar May 12 '16 19:05 mbulat

I think this is a fine idea. Yes nesting would make it complicated. I've also seen names like Assets:Cash, Assets:Checking

ramontayag avatar Aug 04 '16 05:08 ramontayag

@ramontayag @mbulat based on my previous experience with SAP Finance

I believe you should have different GEMS which can be installed together to add functionalities and new Models. Plutus is great because it is simple and easy to use, but still you will need some essential new objects:

  1. Accounting Documents and Transaction Types image

Accounting Documents and Transaction Types will save you lot of code writing when postings entries. For example creating a Asset Posting (AA) document would automatically select the correct accounts.

Debit                          Credit
Asset Account     -     Bank Account   100

While DR - Customer Invoice would be used for registering the sale of a product to a Customer, also here this accounts get selected from the correct table.

Debit                                                        Credit
Account Receivable(Customer 1)     -     Sales of Products (Revenues-P&L)    10

SAP is built like this, you have also performance advantages as User or Automatic Posting will have faster query when selecting the Account Master Data. You may have 10.000 Accounts, but maybe just 100 Customers.

  1. Master Data about Customers and Vendors/Suppliers

The whole idea of Account Receivable/Customer Invoice or Account Payable/Supplier Invoice is that they refer to each single Customer, for example Customer n1 Fabrizio Bertoglio, which is a totally different level of information from Customer when you have 100-1000 Customers.

so here I get to point 3 - Subledger

  1. SAP sub-ledgers modules FI-AR (Account Receivable) and AP (Account Payables)

As there is a different depth of information, the best strategy is using sub-ledgers (different tables). With this logic you would have different set of tables for Asset Accounting, Account Payable, Account Receivable, Banking and much more.

In the below image left side we can see the Account Receivable (Customer Entries) tables. This table entries will have the customer_id foreign key with the customers master data table. I am talking about BSID-KUNNR which in german is Beleg Segment Kunde Nummer (Document Line Item Customer Number), that is the foreign key to another table that records all the Customers information.

image

  1. Sub-ledger vs General Ledger

In the end you would have the sub-ledger tables BSID/BSAD (from the image) for the Customer Items and the BKPF/BSEG for the General Ledger. Entries from the Customer Tables would be relative to each single customer (Customer @ramontayag and Customer @mbulat), which do exist in the system Master Data, while BKPF would just have the aggregated result of all those Document Entries in a General Ledger Account named either Customer National or Customer International.

The same is for Assets etc...

----------------------------------------------------In Conclusion------------------------------------------------------------

I believe using the structure of an existing system is easier then recreating a new one. SAP winning strategy was using modules which are like gems, companies could install and configure them separately.

I will probably try to recreate some of this functionalities in my project development branch and maybe one day extrapolate them in a separate GEM that can be installed by the other developers, but making one single too complex accounting GEM would be a non-sense as most of the users do not want/need that level of complexity.

All my projects are and always will be opensource


the image is from http://www.erpgreat.com/ and it is free to use

fabOnReact avatar Jan 10 '18 13:01 fabOnReact

What i did was to create a different category to group the accounts. example: Current Assets ------------------- Grand Parent Account Category Cash and Cash Equivalents ------ Parent Account Category Cash in Bank ------------------- Account Category Bank 1 ------------------------ Account Bank 2 ----------------------- Account

class GrandParentAccountCategory < ApplicationRecord has_many :parent_account_categories end

class ParentAccountCategory < ApplicationRecord belongs_to :grand_parent_account_category has_many :account_categories end

class AccountCategory < ApplicationRecord belongs_to :parent_account_category has_many :accounts end

vonchristian avatar Sep 02 '19 07:09 vonchristian

Has anyone used sub account with Plutus ? I'm also trying to use it in my small project. I'm thinking about one idea but not tested yet. For creation of sub account under assets can we add type to assets model and extend it to create current_assets, fixed_assets etc. ??

prdpspkt avatar May 11 '20 13:05 prdpspkt

It's probably not possible without changing the gem, which IMO isn't needed.

You should be able to just create your own accounts on your project and make a 1:1 association with the Plutus account record

ramontayag avatar May 12 '20 00:05 ramontayag