in reply to My doubts about using fetchall_arrayref

In my understanding, fetchall_arrayref would return all the columns you specify in your sql statement and

{ id => 1, account_number => 1, box => 1, number => 1, address => 1, type => 1, quantity => 1, count => 1, new_line => 1, date => 1, }

is not needed anyway? In which case, your _all_data function works with either sql statement. If you just provide an empty hash reference it should work and your _all_data function becomes more useful:

my $rs = $sth->fetchall_arrayref({});