Yes, reports are "theoretically" arranged by class_id. Theoretically because today reports are much different, at least in Slovenia (a sort of GIFI system, where many accounts are merged together in certain category, not as in COA or in classic BS or PL reports...). So, I consider class_id only as a tool to decide how to record a transaction (debit / credit). In any case, in account management screens I like things to be listed as prescribed by the COA. In any case, I've found the file and changed 1 line, and I hope we are both (all) happy... ;-)

About my issue (so that 13 is not less than 2), it can be solved.

Try the following query:

SELECT c5.id, c5.name, c5.class_id, c5.parent, c5.inactive FROM (
  SELECT IF(c4.parent3 = '' OR c4.parent3 = '-1', c4.id3, c4.parent3) AS id4,
            IF(c4.parent3 = '' OR c4.parent3 = '-1', '-1', (SELECT parent FROM 0_chart_types cx4 WHERE cx4.id = c4.parent3)) AS parent4,
            c4.* FROM (
    SELECT IF(c3.parent2 = '' OR c3.parent2 = '-1', c3.id2, c3.parent2) AS id3,
            IF(c3.parent2 = '' OR c3.parent2 = '-1', '-1', (SELECT parent FROM 0_chart_types cx3 WHERE cx3.id = c3.parent2)) AS parent3,
            c3.* FROM (
      SELECT IF(c2.parent1 = '' OR c2.parent1 = '-1', c2.id1, c2.parent1) AS id2,
            IF(c2.parent1 = '' OR c2.parent1 = '-1', '-1', (SELECT parent FROM 0_chart_types cx2 WHERE cx2.id = c2.parent1)) AS parent2,
            c2.* FROM (
        SELECT IF(c1.parent = '' OR c1.parent = '-1', c1.id, c1.parent) AS id1,
            IF(c1.parent = '' OR c1.parent = '-1', '-1', (SELECT parent FROM 0_chart_types cx1 WHERE cx1.id = c1.parent)) AS parent1,
            c1.* FROM (
          SELECT * FROM 0_chart_types c) AS c1) AS c2) AS c3) AS c4
) AS c5 ORDER BY
          CAST(id4 AS UNSIGNED), CAST(id3 AS UNSIGNED), CAST(id2 AS UNSIGNED), CAST(id1 AS UNSIGNED), id, parent;

I think so many recursive levels should be enough to sort 5 levels of account groups properly.

I've tested that query with account group table, it seems to be OK (a table in account group add/edit form is created well; haven't tested the situation where $all, $class_id or $parent would be false though...). Where is the query which creates the dropdown list for the "Subgroup Of:" field (I'd like to fix that one too...)?

You have to add your class_id to the sort, of course... ;-)

joe,

I understand this is the way it works...

I just don't uderstand how should 13 be between 1 and 2, if it is on the same level. 13 is higher than 2, or? ;-)

I think that within the same level IDs should be compared as numbers, not strings (where 13 comes before 2, as 1 is lower than 2...). Sublevels are something else, as it is common practice in accounting to add digits on the right side...

And, I don't understand your suggestion to rearrange group_id - to achieve what? I can do whatever I want with IDs, they will still be ordered by class ID first (what I don't like). If you think this is how it should be (without changing it, or give us an option to disable / change that), I will have to patch my code (probably just one SQL to be edited or so - haven't take a look yet). Altough I hate to do that (unless really necessary), it should make us all happy...

joe,

thank you. This is resolved now, dropdown list is properly ordered.

I've found another weirdness. After adding a group:
ID: 13
Name: TEST 3
Subgroup Of: None
Class Type: Assets

I've found it listed between groups 1 ("Current Assets") and 2 ("Inventory Assets"). Shouldn't it be listed after 3 ("Capital Assets"), since it is not a subgroup of 1?

Otherwise, we could simply say sublevels are automatic (10 is a subgroup of 1, 100 is a subgroup if 10 etc.). But, if we accept more than 10 (ID 0 - 9) level 1 groups (as now 10, 11 and 12 are...), they should be ordered as if they are integers, or? Otherwise, the ordering is quite confusing (like in good old DOS and older Win$ versions, with dir command).

Also my another question seems to be overlooked, altough not so unimportant as it may look. Imagine I change (from the situation as in my previous post) the group 001 to class type "Liabilities" now. It will fall down to the position after group 3 ("Capital Assets"), being the first one among "Liabilities" groups (altough being a subgroup of 01, listed in another / totally different position). If there are many account groups (doesn't fit in just one screen), this can be not only quite annoying, but also confusing (one may think some groups or subgroups doesn't exist, would try to create them, get an error...). I think all groups should be listed by the ID order, no matter what class type they are. If I want all assets to be listed first, liabilities after etc., I can change IDs and I have such an order. Why to insist on so strange ordering (without at least giving us an option to disable it / to order by ID only)?

Hi Joe,

it is default empty installation. I've set CVS version just to test this feature, as it is very important to me (otherwise, I am evaluating 2.2.7 version).

So, the only difference is (copied from backup):

### Data of table `0_chart_types` ###
INSERT INTO `0_chart_types` VALUES ('1', 'Current Assets', '1', '-1', '0');
INSERT INTO `0_chart_types` VALUES ('2', 'Inventory Assets', '1', '-1', '0');
INSERT INTO `0_chart_types` VALUES ('3', 'Capital Assets', '1', '-1', '0');
INSERT INTO `0_chart_types` VALUES ('4', 'Current Liabilities', '2', '-1', '0');
INSERT INTO `0_chart_types` VALUES ('5', 'Long Term Liabilities', '2', '-1', '0');
INSERT INTO `0_chart_types` VALUES ('6', 'Share Capital', '2', '-1', '0');
INSERT INTO `0_chart_types` VALUES ('7', 'Retained Earnings', '2', '-1', '0');
INSERT INTO `0_chart_types` VALUES ('8', 'Sales Revenue', '3', '-1', '0');
INSERT INTO `0_chart_types` VALUES ('9', 'Other Revenue', '3', '-1', '0');
INSERT INTO `0_chart_types` VALUES ('10', 'Cost of Goods Sold', '4', '-1', '0');
INSERT INTO `0_chart_types` VALUES ('11', 'Payroll Expenses', '4', '-1', '0');
INSERT INTO `0_chart_types` VALUES ('12', 'General & Administrative expenses', '4', '-1', '0');
INSERT INTO `0_chart_types` VALUES ('0', 'level 1 - TEST', '1', '', '0');
INSERT INTO `0_chart_types` VALUES ('00', 'level 2 - TEST1', '1', '0', '0');
INSERT INTO `0_chart_types` VALUES ('000', 'level 3 - TEST1-1', '1', '00', '0');
INSERT INTO `0_chart_types` VALUES ('01', 'level 2 - TEST2', '1', '0', '0');
INSERT INTO `0_chart_types` VALUES ('010', 'level 3 - TEST2-1', '1', '01', '0');
INSERT INTO `0_chart_types` VALUES ('001', 'level 3 - TEST1-2', '1', '00', '0');
INSERT INTO `0_chart_types` VALUES ('011', 'level 3 - TEST2-2', '1', '01', '0');

Up to Administrative expenses (12) it is a default, the rest is everything I've added. If there is a need, I can send you a complete backup and screenshot, but it was easier to simply copy/paste an extract from a backup (just made for this purpose) here...

Yes, I've checked - it is the same (and, I've just updated the whole CVS tree again, no changes...).

Maybe the reason could be that you've entered the data in the order (as it should be)? I can not imagine what would be different, but for sure on my system it is as described above (a pitty that I can not attach a screenshot...).

I am getting the unstable branch - this should be OK, or? I see some updates every day, and "FrontAccounting 2.3 CVS (m7) - Theme: default - " is reported (at the moment: "Version 2.3 CVS (m7) Build 25.03.2010").

None is OK, but 0 should be in front of 1 (both are Assets...), or?

And, 0 should be followed by 00, 000, 001, 01, 010, 111 by my opinion. Imagine you have about 25 groups or more of the same type, all mixed (not sorted...) and with quite similar names... If they are ordered as in COA, it would be much easier to find the right one.

And, what is the reason that groups are ordered by class type? I mean, if the national chart of account is not sorted this way, why not to allow it to be matched? Isn't it why IDs are there for - to manage the sort order with them? It can be by class types or not, as one desires. Wouldn't it be better this way (it can suit anyone...)?

It seems I have a problem with a screenshot attachment. Another try...

Doesn't work... Is it not possible to attach a JPG screenshot?

A try with zipped one...  Doesn't work. :-(

OK, no screenshot...

I have to type it:

my groups are:
0     - level 1 - TEST
00   - level 2 - TEST1
000 - level 3 - TEST1-1
001 - level 3 - TEST1-2
01   - level 2 - TEST2
010 - level 3 - TEST2-1
011 - level 2 - TEST2-2
1     - Current Assets
2     - Inventory Assets
...


which are listed as:
None
Current Assests
level 3 - TEST1-2
level 3 - TEST2-1
level 2 - TEST2
level 3 - TEST1-1
level 2 - TEST1
level 1 - TEST
level 3 - TEST2-2
Inventory Assets
...

Changing class types seems to work well now, thank you.

Subgroup parent list seems to be a bit unodrered though. Could be unpleaseant if there are many groups (a long list), with similar names (titles). Probably the order shall be by Group ID, considering level order as well (as it would be in a table above if it wouldn't be odrered by class types first). I am attaching a screenshot.

What about (an option to have) account groups ordered by "Group ID" (instead of "Class Type") in a table displayed? Shall I put this in feature requests?

joe,

thank you, editing of all levels ("0", "00", "000" tested) seems to work fine now.

What exactly do you mean by a problem setting type of parent? The only situation when I've got the error was setting "00" (intermediate level) to some other type (went OK) and than back to the type "00" had before (and, is same as "0" and "00"). In this case (or, when tried to change type to something else...) I got the error "id = 00, parent = 00".

I was able to come around setting type of "0" to type of "00" first, than set "00" type (to the desired type, can be whatever...) and at the end set type of "0" back (can be whatever). For sure it is not nice to have a situation that end with error, but as it is now fulfills my needs quite well (I don't expect to change types very often...).

Probably the cause is in some numeric/string conversions? I believe in those IDs you have to get rid of any numeric treatment, and compare (sub)strings - if some sting matches left part of another string, it can be a parent (example: 0 at level 1 and 00 at level 2), but doesn't have to be (example: 1 and 11, when both level 1). If it doesn't, it can't be (example: 0 at level 1 and 11 at level 2).

But, why are parents tested at all, when setting (changing) a group type? If we can change a subgroup to something different as a parent, but we can not change back to the same type? I could understand the opposite (restricting the type of subgroup to the type of a parent), but I need them to be different in some cases. At the end, it should be a responsability of admin to take care about that (maybe we could display a warning that something unusual is happening, but in some groups I need them to be different!).

Regarding types, I would have just a remark (became even more obvious when I was doing the moves as above, and account groups were jumping here and there...) - everything (assounts and account groups) should be ordered by account ID by my opinion, not by account types. If the list is longer, it becomes even more annoying searching some account around.  Or, to have a preference about how those lists are ordered - this would be even better, as anyone could adjust how he/she wants to see something (I would defenitely choose by IDs, as we have for example 2 different types of subgroups - incomes and costs - within one main group in official COA).

Hi,

I've set all subgroups (00 / 000) to None (empty) through web interface (went well).

After, when I've tried to set group 0 as a parent of 00, I've got (well known): "You cannot set an account group to be a subgroup of itself.".

So, there seems to be some "numeric" check remaining, which is causing this (annoying) error report...

Editing database manually (not with phpMyAdmin, which is quite slow sometimes...; I prefer HeidiSQL, and suggest it to the others as well) seems to do the trick (table is now displayed well), but this bug can probably not be considered as 100% resolved yet (since we can not edit account types through the web interface...).

In next days, I'll try to see how it behaves (in other activities than just enter / edit it...).

Thanks & regards,

LUTi

joe,

thank you for a quick fix.

Unfortunately, it doesn't seem to (completely) resolve the issue.

"Subgroup of" in Account Groups table now contains entries, but I am still getting the error "You cannot set an account group to be a subgroup of itself." when I try to edit level 2 or level 3 subaccounts (level 1 subaccount can be edited and saved).

I've checked - all files you are listing are updated (new).

BTW, I've noticed all default level 1 subgroups have parent -1 (in the database), while my level 1 test entry got 0 after editing (was set to be a subgroup of itself immediately after CVS update).

Rgds,

LUTi

I find the limit of account / account group / account class names (45 characters) too limited for my needs.

I can understand that longer strings would affect the whole display (forms), but I need to see complete lines at least in in reports.

Could it be possible to have longer strings available (varchar 255), and just a recommendation to keep the length below 45? We can still limit the sizes of fields where those strings are displayed at the end...

Or, better - to have 2 names for each account / account group / account class:
- one to be used (in the web interface) with "custom" account / account group / account class names, and
- another with "official" names (to be used in reports)

The benefit of the second solution would also be that I can have more descriptive account names (meaning something to me), but can switch to "official" names (if an inspector wants to see it...). Or, even more improved - that those "custom" names are per user (with some defaults, to simplify the managenent, if there are a lot of users with more or less the same wishes...) - so we can put different custom names for different users (anyone sees account / account group names according to his/her preferences...).

I have tried to set the following account groups:

0 - Level 1 TEST 1
00 - Level 2 TEST 1
000 - Level 3 - TEST 1-1
001 - Level 3 - TEST 1-2
01 - Level 2 - TEST 2
010 - Level 3 - TEST 2-1
011 - Level 3 - TEST 2-2
...

When I've tried to edit account group 00 ("Level 2 TEST 1"), I've got an error:
"You cannot set an account group to be a subgroup of itself."

At that moment, I've also noticed that 00 ("Level 2 TEST 1") is actually not listed as a subgroup of 0 ("Level 1 TEST 1"), altough I've entered it that way. The same is with 000 ("Level 3 - TEST 1-1") and 001 ("Level 3 - TEST 1-2"), which should be subgroups of 00. When I click to edit them, 000 and 001 are reported to be subgroups of 0 instead of 00.

Account groups 01 and 010 are OK.

I guess the problem is that somewhere 0 and 00 are still treated as the same (integers instead of strings...).

joe wrote:

Please look once again. I was sure it had been updated smile.

Look under Banking and General Ledger, Account Groups.

/Joe

joe,

that's all I've found:
---
Allow using of multi level sub-types when digits are of same length in account types

The current account types setup with sub-levels only allowed 2 levels in the current system.

By setting up the account types with same digit lenghts in id and exactly in the order you want them presented in COA and reports and with the sub-levels you want them belong to it is now possible to use at least 4 or 5 levels. Having more is not appropriate.

Condition for doing that:

Set the variable, $use_new_account_types = 1; in your config.php
---

It is not an example, just a (brief) description of the setting... BTW, it is more or less just the same as introduction of this setting (feature) in NEWS:
https://frontaccounting.com/wbt/pages/posts/release-2.2.3121.php

I believe Kalido has seen that already (as I did), but asked for an example to understand exactly what one can achieve through this setting.

Or, is the only difference that with this setting we have now a possibility to construct 4-5 levels of classes instead of only 2 (as until now)?

In this case, why this is an option at all? To be more precise, am I loosing something if I set this option to 1 altough I have (need) only 2 levels? If not, why would it be good to have it set to 0 at all?

I can't find an example in Wiki for this new feature... :-(

I am setting up a test company, and managed to enter a 2-level account type system (the majority of account types was 3-digit, so the same length, but still one above the other...) in 2.2.2 already (without that setting). I've read that it should now be possible to set more than 2 levels, but am still not sure what exactly this setting does (or, does it mean only that we have more digits now, like INT instead of TINY INT or so?).

As said already (in another topic), I'd also like to have an option to set id for chart types as charatcters.

I support the idea to have character IDs. This way, we can distinguish between 0 and 00, which are used in some countries as well (I am from Slovenia, and we have fixed assets in class / type 0 and 00).

Maybe there can still be an option to use IDs as "numeric" (so, strings are converted to their values first...), if this functionality is not needed (and, would help anyhow). Or, to have an extra field (and, use one or another) in the same table, or 2 different tables...

Maybe it would be good to attach (arbitrary number of) extra descriptions to each account. This way, one could have:
- primary account names, used generally for the majority of reports (or, as defined by country legislation...)
- some other account names for certain specific reports (other languages, some particular purposes...)
- some other account names for some forms (menus) - for example to reduce the lenght, to make entries better understandable for some user (in terms of meaning or language)

I believe this shouldn't be too complicated to implement (additional account names/descriptions should probably belong into another table, consisting of min. 3 fields - account id, "level" or "purpose" id and name/description), but could probably help many of us (since I need longer account and account type names, I've had to change those 2 tables for now - it seems to work, but I am not very comfortable doing that...).