africompta 1.9.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +15 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +74 -0
- data/TODO +31 -0
- data/Test/ac_account.rb +128 -0
- data/Test/ac_africompta.rb +1001 -0
- data/Test/ac_big.rb +62 -0
- data/Test/ac_movement.rb +59 -0
- data/Test/ac_sqlite.rb +139 -0
- data/Test/config_test.yaml +31 -0
- data/Test/db.testGestion +0 -0
- data/Test/test.rb +39 -0
- data/VERSION +140 -0
- data/africompta.gemspec +20 -0
- data/lib/africompta/acaccess.rb +257 -0
- data/lib/africompta/acqooxview.rb +77 -0
- data/lib/africompta/africompta.rb +83 -0
- data/lib/africompta/entities/account.rb +995 -0
- data/lib/africompta/entities/acschemas.rb +16 -0
- data/lib/africompta/entities/movement.rb +292 -0
- data/lib/africompta/entities/remote.rb +27 -0
- data/lib/africompta/entities/users.rb +55 -0
- data/lib/africompta/views/edit/movement.rb +8 -0
- data/lib/africompta/views/edit/tabs.rb +8 -0
- data/lib/africompta/views/report/annual.rb +3 -0
- data/lib/africompta/views/report/tabs.rb +3 -0
- data/lib/africompta.rb +2 -0
- metadata +84 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 704d5cbfc5f07dfb28510afdc7e48fc55ee903d5
|
4
|
+
data.tar.gz: c8f6198db4e0471ab210681789b9f9313770a55c
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: ba2375b01c9751d0cfa28a39f7f422b41478239c96f1594279471ba3bfba46dd6c7f013c32f487ccc43b3e74e909ca7641d8e7c30ea34829f49d6c6ef1d1f7d2
|
7
|
+
data.tar.gz: 961f644f75673085a8eda617a4a3d9d6afc410137fe9b304c52514c4f16013af20a915e6f6b19259ea9a9884eb4822fe3b7d47fabeca48f83b97721652feca35
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
africompta (1.9.8)
|
5
|
+
qooxview
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
activemodel (3.1.1)
|
11
|
+
activesupport (= 3.1.1)
|
12
|
+
builder (~> 3.0.0)
|
13
|
+
i18n (~> 0.6)
|
14
|
+
activerecord (3.1.1)
|
15
|
+
activemodel (= 3.1.1)
|
16
|
+
activesupport (= 3.1.1)
|
17
|
+
arel (~> 2.2.1)
|
18
|
+
tzinfo (~> 0.3.29)
|
19
|
+
activesupport (3.1.1)
|
20
|
+
multi_json (~> 1.0)
|
21
|
+
arel (2.2.1)
|
22
|
+
builder (3.0.4)
|
23
|
+
chunky_png (1.3.4)
|
24
|
+
docsplit (0.7.6)
|
25
|
+
gettext (3.0.0)
|
26
|
+
locale (>= 2.0.5)
|
27
|
+
text
|
28
|
+
helper_classes (0.2.1)
|
29
|
+
i18n (0.6.0)
|
30
|
+
iconv (1.0.3)
|
31
|
+
json (1.8.2)
|
32
|
+
locale (2.0.8)
|
33
|
+
multi_json (1.0.3)
|
34
|
+
net-ldap (0.5.1)
|
35
|
+
parseconfig (0.5.2)
|
36
|
+
pdf-core (0.5.1)
|
37
|
+
prawn (2.0.1)
|
38
|
+
pdf-core (~> 0.5.1)
|
39
|
+
ttfunk (~> 1.4.0)
|
40
|
+
qooxview (2.0.0.pre.pre1)
|
41
|
+
activemodel (= 3.1.1)
|
42
|
+
activerecord (= 3.1.1)
|
43
|
+
activesupport (= 3.1.1)
|
44
|
+
arel (= 2.2.1)
|
45
|
+
chunky_png (= 1.3.4)
|
46
|
+
docsplit (= 0.7.6)
|
47
|
+
gettext (= 3.0.0)
|
48
|
+
helper_classes (= 0.2.1)
|
49
|
+
i18n (= 0.6.0)
|
50
|
+
iconv (= 1.0.3)
|
51
|
+
json (= 1.8.2)
|
52
|
+
locale (= 2.0.8)
|
53
|
+
multi_json (= 1.0.3)
|
54
|
+
net-ldap (= 0.5.1)
|
55
|
+
parseconfig (= 0.5.2)
|
56
|
+
pdf-core (= 0.5.1)
|
57
|
+
prawn (= 2.0.1)
|
58
|
+
rqrcode (= 0.4.2)
|
59
|
+
rubyzip (= 1.1.7)
|
60
|
+
serialport (= 1.3.1)
|
61
|
+
text (= 1.2.3)
|
62
|
+
ttfunk (= 1.4.0)
|
63
|
+
rqrcode (0.4.2)
|
64
|
+
rubyzip (1.1.7)
|
65
|
+
serialport (1.3.1)
|
66
|
+
text (1.2.3)
|
67
|
+
ttfunk (1.4.0)
|
68
|
+
tzinfo (0.3.44)
|
69
|
+
|
70
|
+
PLATFORMS
|
71
|
+
ruby
|
72
|
+
|
73
|
+
DEPENDENCIES
|
74
|
+
africompta!
|
data/TODO
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
- Users
|
2
|
+
- some users can add accounts
|
3
|
+
- Add remote repositories
|
4
|
+
- sync movements to a remote repository
|
5
|
+
|
6
|
+
Think
|
7
|
+
* What to do about a movement that includes an account not available to
|
8
|
+
that user?
|
9
|
+
|
10
|
+
JOLI
|
11
|
+
* Edition des comptes en cliquant dedans
|
12
|
+
|
13
|
+
Performance:
|
14
|
+
/movement/list:
|
15
|
+
Before making it better
|
16
|
+
Sorting movements: 0.06-0.08
|
17
|
+
Writing accounts: 1.05-1.2
|
18
|
+
Preparing edit: 0.50-0.65
|
19
|
+
Sorting a year: 0.29-0.37
|
20
|
+
Movements: 1.60-1.65
|
21
|
+
Total: 3.6-3.8
|
22
|
+
|
23
|
+
Kicking Markaby out of loops:
|
24
|
+
Sorting movements: 0.04-0.07
|
25
|
+
Writing accounts: 0.25-0.50
|
26
|
+
Preparing edit: 0.30-0.50
|
27
|
+
Sorting a year: 0.30-0.32
|
28
|
+
Movements: 0.25-0.35
|
29
|
+
Total: 1.15-1.50
|
30
|
+
|
31
|
+
Improvement: Down to 30%-50%
|
data/Test/ac_account.rb
ADDED
@@ -0,0 +1,128 @@
|
|
1
|
+
require 'test/unit'
|
2
|
+
|
3
|
+
class TC_Account < Test::Unit::TestCase
|
4
|
+
def setup
|
5
|
+
dputs(1){ 'Setting up new data'
|
6
|
+
}
|
7
|
+
Entities.delete_all_data()
|
8
|
+
|
9
|
+
dputs(2){ 'Resetting SQLite'
|
10
|
+
}
|
11
|
+
SQLite.dbs_close_all
|
12
|
+
FileUtils.cp( 'db.testGestion', 'data/compta.db')
|
13
|
+
SQLite.dbs_open_load_migrate
|
14
|
+
|
15
|
+
dputs(2){ 'And searching for some accounts'
|
16
|
+
}
|
17
|
+
@root = Accounts.match_by_name('Root')
|
18
|
+
@cash = Accounts.match_by_name('Cash')
|
19
|
+
@lending = Accounts.match_by_name('Lending')
|
20
|
+
@income = Accounts.match_by_name('Income')
|
21
|
+
@outcome = Accounts.match_by_name('Outcome')
|
22
|
+
@local = Users.match_by_name( 'local' )
|
23
|
+
|
24
|
+
@user_1 = Users.create( 'user1', '', 'pass')
|
25
|
+
@user_2 = Users.create( 'user2', '', 'pass')
|
26
|
+
end
|
27
|
+
|
28
|
+
def teardown
|
29
|
+
end
|
30
|
+
|
31
|
+
def test_path
|
32
|
+
assert_equal 'Root::Cash', @cash.path
|
33
|
+
end
|
34
|
+
|
35
|
+
def test_del_account
|
36
|
+
AccountRoot.accounts.each{|a|
|
37
|
+
dputs(1){"Found root-account #{a.inspect}"}
|
38
|
+
a.get_tree{|t|
|
39
|
+
dputs(1){
|
40
|
+
"#{t.path} - #{t.deleted.inspect}"
|
41
|
+
}
|
42
|
+
}
|
43
|
+
}
|
44
|
+
assert_equal false, @root.delete, @root.inspect
|
45
|
+
assert_equal false, @income.delete
|
46
|
+
old_index = @lending.rev_index
|
47
|
+
assert_equal true, @lending.delete
|
48
|
+
assert_operator old_index, :<, @lending.rev_index
|
49
|
+
|
50
|
+
Accounts.create_path('Root::Cash::Foo', '')
|
51
|
+
end
|
52
|
+
|
53
|
+
def test_account_root
|
54
|
+
Accounts.create_path('Root::Archive')
|
55
|
+
assert_equal nil, AccountRoot.archive
|
56
|
+
|
57
|
+
Accounts.create_path('Archive')
|
58
|
+
assert_not_equal nil, AccountRoot.archive
|
59
|
+
end
|
60
|
+
|
61
|
+
def test_clean
|
62
|
+
Accounts.create_path('Test')
|
63
|
+
Accounts.dump
|
64
|
+
count_mov, bad_mov, count_acc, bad_acc = AccountRoot.clean
|
65
|
+
assert_equal [ 4, 0, 19, 1 ],
|
66
|
+
[ count_mov, bad_mov, count_acc, bad_acc ]
|
67
|
+
|
68
|
+
Accounts.dump
|
69
|
+
count_mov, bad_mov, count_acc, bad_acc = AccountRoot.clean
|
70
|
+
assert_equal [ 4, 0, 19, 0 ],
|
71
|
+
[ count_mov, bad_mov, count_acc, bad_acc ]
|
72
|
+
end
|
73
|
+
|
74
|
+
def test_merge_two_users
|
75
|
+
@user_1.update_all
|
76
|
+
@u1 = {'user' => 'user1', 'pass' => 'pass'}
|
77
|
+
@user_2.update_all
|
78
|
+
@u2 = {'user' => 'user2', 'pass' => 'pass'}
|
79
|
+
|
80
|
+
a_id = ACaccess.post( 'account_get_id', @u1.merge( 'account' => 'Root') )
|
81
|
+
assert_equal '1', a_id
|
82
|
+
|
83
|
+
assert_equal '', ACaccess.get('accounts_get/user1,pass')
|
84
|
+
assert_equal '', ACaccess.get('accounts_get/user2,pass')
|
85
|
+
end
|
86
|
+
|
87
|
+
def test_merge_account_delete
|
88
|
+
test_merge_two_users
|
89
|
+
|
90
|
+
@lending.delete
|
91
|
+
dputs(3){@lending.inspect}
|
92
|
+
ACaccess.post( 'account_put', @u1.merge( 'account' => @lending.to_s ) )
|
93
|
+
assert_equal '', ACaccess.get('accounts_get/user1,pass')
|
94
|
+
assert_equal @lending.to_s, ACaccess.get('accounts_get/user2,pass').chomp
|
95
|
+
end
|
96
|
+
|
97
|
+
def test_merge_account_change
|
98
|
+
test_merge_two_users
|
99
|
+
|
100
|
+
@lending.name = 'Lendings'
|
101
|
+
@lending.new_index
|
102
|
+
dputs(3){@lending.inspect}
|
103
|
+
ACaccess.post( 'account_put', @u1.merge( 'account' => @lending.to_s ) )
|
104
|
+
assert_equal '', ACaccess.get('accounts_get/user1,pass')
|
105
|
+
assert_equal @lending.to_s, ACaccess.get('accounts_get/user2,pass').chomp
|
106
|
+
|
107
|
+
assert_equal 1, @lending.account_id
|
108
|
+
end
|
109
|
+
|
110
|
+
def test_print_pdf
|
111
|
+
@root.print_pdf( 'test.pdf', true )
|
112
|
+
end
|
113
|
+
|
114
|
+
def test_get_archives
|
115
|
+
(2011..2014).each{|y|
|
116
|
+
Movements.create( '', Date.new(y), 1000, @income, @cash )
|
117
|
+
}
|
118
|
+
Movements.create( '', Date.new(2013, 3, 3), 1000, @outcome, @cash )
|
119
|
+
Accounts.archive( 1, 2014 )
|
120
|
+
|
121
|
+
assert_equal %w(Archive::2011::Income Archive::2012::Income Archive::2013::Income),
|
122
|
+
Accounts.get_by_path('Root::Income').get_archives.collect{|a|
|
123
|
+
a.path }.sort
|
124
|
+
assert_equal %w(Archive::2012::Outcome Archive::2013::Outcome),
|
125
|
+
Accounts.get_by_path('Root::Outcome').get_archives.collect{|a|
|
126
|
+
a.path }.sort
|
127
|
+
end
|
128
|
+
end
|