IMA-WorldHealth / bhima-1.X

A hospital information system for developing countries.
GNU General Public License v2.0
10 stars 14 forks source link

Restructure database account type #345

Open jmcameron opened 9 years ago

jmcameron commented 9 years ago

In the 'account' table in the database, the current column 'account_type_id' has 4 possible values: income, expense, title, balance

But I think that this should be restructured as follows: account_type_id is (income, expense, balance) title is boolean

In other words, I think that income, expense, or balance accounts could be regular accounts or title accounts. This makes it much simpler to to queries for accounts that are income/expense accounts or title accounts for incomes or expenses. Currently we have to rely on the first digit being either 6 or 7. Not sure how general that is. Having 'is_title' as a separate boolean seems more robust and more likely to be adaptable to different systems in future.

jniles commented 9 years ago

That's an interesting idea. I never thought about that.

I've always viewed title accounts as labels, not real accounts. Therefore, I feel it is inappropriate to assign the value of "balance", "income", etc to a title account, though it would make it much easier to select title acounts of balance accounts. Perhaps the simplicity is worth it.

We should never rely on the first account digit being 6 or 7 to specify an income or expense account. In every meeting I've ever had with Larry, he would like us to support more systems than just OHADA. Any code which references account_number to filter accounts by type must be refactored.

@sfount, @DedrickEnc what do you think?

jmcameron commented 9 years ago

I'm using the current /InExAccounts/ query which uses the 6/7 checking. I'd like to use account_type_id, but then I lose the title accounts which should be included in reports.

On Sat, Jan 17, 2015 at 1:40 PM, Jonathan Niles notifications@github.com wrote:

That's an interesting idea. I never thought about that.

I've always viewed title accounts as labels, not real accounts. Therefore, I feel it is inappropriate to assign the value of "balance", "income", etc to a title account, though it would make it much easier to select title acounts of balance accounts. Perhaps the simplicity is worth it.

We should never rely on the first account digit being 6 or 7 to specify an income or expense account. In every meeting I've ever had with Larry, he would like us to support more systems than just OHADA. Any code which references account_number to filter accounts by type must be refactored.

@sfount https://github.com/sfount, @DedrickEnc https://github.com/DedrickEnc what do you think?

— Reply to this email directly or view it on GitHub https://github.com/IMA-WorldHealth/bhima/issues/345#issuecomment-70365598 .

jniles commented 9 years ago

The balance_sheet report has a very hacky way of filtering out title accounts. You can see it is reports_proposed. @sfount and I were under a lot of pressure at the time and that is what we came up with. It definitely needs improvement, but it is accounting system agnostic, which is much better in my view.

wahono77 commented 9 years ago

If we want to provide financial analysis ratio (http://en.wikipedia.org/wiki/Financial_ratio), we should use more detail for account category such as :

Than we can get financial alnalysis ratio from summary of transaction in each category account

jniles commented 9 years ago

I think the original conception was to allow the accountant to group account categories under title accounts. He can then structure banks under a certain title label, cash, etc.

That makes our reporting a bit more difficult, since we won't have explicit labels for each category, but it does strike a nice balance between flexiblity and correctness, in my opinion. We have not expanded our reporting suite beyond a few basic reports, so maybe that will change with time.