Topic: Account & Account Type Ordering

I prefer to see accounts and account types ordered by ID, and not by type.

I've made the following modifications:

--- gl/includes/db/gl_db_account_types.inc.ORIGINAL    2010-12-10 14:12:42.000000000 +0100
+++ gl/includes/db/gl_db_account_types.inc        2010-12-14 12:04:16.000000000 +0100
@@ -71,7 +71,7 @@ function get_account_types($all=false, $
 
     if (count($where))
         $sql .= ' WHERE '.implode(' AND ', $where);
-    $sql .= " ORDER BY class_id, id, parent";
+    $sql .= " ORDER BY id, parent";
 
     return db_query($sql, "could not get account types");
 }
@@ -128,7 +128,7 @@ function get_account_classes($all=false,
         $sql .= " AND ctype>".CL_EQUITY." OR ctype=0";
     elseif ($balance == 1) 
         $sql .= " AND ctype>0 AND ctype<".CL_INCOME; 
-    $sql .= " ORDER BY ctype, cid";
+    $sql .= " ORDER BY cid";
 
     return db_query($sql, "could not get account classes");
 }
--- includes/ui/ui_lists.inc.ORIGINAL            2010-12-10 14:12:42.000000000 +0100
+++ includes/ui/ui_lists.inc                2010-12-17 15:45:28.000000000 +0100
@@ -1547,7 +1547,7 @@ function gl_account_types_list($name, $s
     return combo_input($name, $selected_id, $sql, 'id', 'name',
     array(
         'format' => '_format_account',
-        'order' => array('class_id', 'id', 'parent'),
+        'order' => array('id', 'parent'),
         'spec_option' =>$all_option,
         'spec_id' => $all_items
     ) );
@@ -1592,7 +1592,7 @@ function gl_all_accounts_list($name, $se
         'spec_option' => $all_option===true ?  _("Use Item Sales Accounts") : $all_option,
         'spec_id' => '',
         'type' => 2,
-        'order' => array('type.class_id','type.id','account_code'),
+        'order' => array('type.id','account_code'),
         'search_box' => $cells,
             'search_submit' => false,
             'size' => 12,
@@ -1608,7 +1608,13 @@ function gl_all_accounts_list($name, $se
 
 function _format_account($row)
 {
-        return $row[0] .  "&nbsp;&nbsp;&nbsp;&nbsp;" . $row[1];
+        $return = $row[0];
+        $rlen = strlen($return);
+        if ($rlen > 6) $rlen = 6;
+        for ($i = $rlen; $i < 9; $i++) {
+            $return .= "&nbsp;&nbsp;";
+        }
+        return $return . $row[1];
 }
 
 function gl_all_accounts_list_cells($label, $name, $selected_id=null,

Maybe it would be good to have a setting (option) about that - to display them ordered by type, or by ID (maybe even by name as well)?

Re: Account & Account Type Ordering

Is there any reason why this cannot be default in FA?
Why? In Colombia expenses is #5 and cost of goods sold #6 so when viewing/ printing COA, trial balance etc we get the order 1,2,3,4,6,5  so therefore have to download to excel and sort from there.

Re: Account & Account Type Ordering

@joe: makes sense.

Re: Account & Account Type Ordering

Yes, I will have a look at this.  Though it is more complicated than that. But I understand the question.

Joe

Re: Account & Account Type Ordering

@ Joe, not sure if this is an easier option:-

Leave account types as they are, (as a non-accountant and looking at the code above I'm assuming FA calculates in a different way by type) but when creating trial balance (in program or as a report) and printing COA etc. sort by ID not type? You've probably already considered this..

Re: Account & Account Type Ordering

I am a little confused over this.

Calculating the Detailed Balances is done recursively. You can have several levels of types. This is the reason for presenting it this way.

Maybe someone can help me to get the calculation correct if we change the order of types.

/Joe

Re: Account & Account Type Ordering

Sorry Joe, I may have confused you with my lack of understanding of how the code worked... please ignore last post