gestion 1.9.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (233) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +48 -0
  3. data/.project +14 -0
  4. data/Binaries/adduser_to_buzz +15 -0
  5. data/Binaries/backup +7 -0
  6. data/Binaries/check_gestion +8 -0
  7. data/Binaries/gestion.gnumail +22 -0
  8. data/Binaries/gestion.logrotate +34 -0
  9. data/Binaries/gestion.service +12 -0
  10. data/Binaries/gestion_update.rb +183 -0
  11. data/Binaries/gestion_update.service +10 -0
  12. data/Binaries/get_compta +11 -0
  13. data/Binaries/kill_gestion +16 -0
  14. data/Binaries/ldap/add_indexes +51 -0
  15. data/Binaries/ldap/backup +2 -0
  16. data/Binaries/ldap/install_ldap +92 -0
  17. data/Binaries/ldap/restore +7 -0
  18. data/Binaries/lib_backup +5 -0
  19. data/Binaries/log_scan_errors +8 -0
  20. data/Binaries/loop_gestion +64 -0
  21. data/Binaries/onetimers/sync_courses_from_compta.rb +74 -0
  22. data/Binaries/onetimers/transfer_cash_from_ldap_to_csv +26 -0
  23. data/Binaries/reboot +5 -0
  24. data/Binaries/restore +3 -0
  25. data/Binaries/restore_do +22 -0
  26. data/Binaries/sort_events +31 -0
  27. data/Binaries/start_gestion +18 -0
  28. data/Binaries/swipe_gestion +18 -0
  29. data/Binaries/update_africompta +21 -0
  30. data/Binaries/update_users +3 -0
  31. data/Diplomas.src/accredited.odg +0 -0
  32. data/Diplomas.src/diploma.odg +0 -0
  33. data/Diplomas.src/label.odg +0 -0
  34. data/Diplomas.src/presence_sheet.ods +0 -0
  35. data/Diplomas.src/presence_sheet_small.ods +0 -0
  36. data/Diplomas.src/student_card.odg +0 -0
  37. data/Doc/130514-it-ideas.odt +0 -0
  38. data/Doc/Compta-cash.mm +179 -0
  39. data/Doc/General.odt +0 -0
  40. data/Entities/AccessGroups.rb +117 -0
  41. data/Entities/Activity.rb +178 -0
  42. data/Entities/ChatMsg.rb +142 -0
  43. data/Entities/Classroom.rb +11 -0
  44. data/Entities/Client.rb +19 -0
  45. data/Entities/Computer.rb +21 -0
  46. data/Entities/ConfigBase.rb +280 -0
  47. data/Entities/Course.rb +1588 -0
  48. data/Entities/CourseType.rb +171 -0
  49. data/Entities/DFiles.rb +466 -0
  50. data/Entities/FilesManage.rb +226 -0
  51. data/Entities/Grade.rb +186 -0
  52. data/Entities/Internet.rb +300 -0
  53. data/Entities/Netdev.rb +10 -0
  54. data/Entities/Person.rb +1175 -0
  55. data/Entities/Plug.rb +98 -0
  56. data/Entities/Quiz.rb +33 -0
  57. data/Entities/Recharges.rb +37 -0
  58. data/Entities/Report.rb +136 -0
  59. data/Entities/Room.rb +12 -0
  60. data/Entities/SMS.rb +30 -0
  61. data/Entities/ScheduleType.rb +33 -0
  62. data/Entities/Share.rb +120 -0
  63. data/Entities/Task.rb +51 -0
  64. data/Entities/Ticket.rb +72 -0
  65. data/Entities/Usage.rb +143 -0
  66. data/Entities/Worker.rb +29 -0
  67. data/Files/apache-profeda.conf +36 -0
  68. data/Files/label.erb +121 -0
  69. data/Files/label_notfound.erb +64 -0
  70. data/Files/label_notpassed.erb +84 -0
  71. data/Files/mobileinfo.erb +115 -0
  72. data/Files/smb.conf +333 -0
  73. data/Files/timetable.html +36 -0
  74. data/Files/timetable.js +239 -0
  75. data/Gemfile +12 -0
  76. data/Gemfile.dev +12 -0
  77. data/Gemfile.dev.lock +127 -0
  78. data/Gemfile.lock +127 -0
  79. data/Gemfile.prod +8 -0
  80. data/Gestion +35 -0
  81. data/Gestion.rb +220 -0
  82. data/INSTALL +40 -0
  83. data/Images/connection.xcf +0 -0
  84. data/Images/connection_no.png +0 -0
  85. data/Images/connection_wait.png +0 -0
  86. data/Images/connection_yes.png +0 -0
  87. data/Paths/Exas.rb +13 -0
  88. data/Paths/Files.rb +19 -0
  89. data/Paths/GetDiplomas.rb +20 -0
  90. data/Paths/Info.rb +114 -0
  91. data/Paths/Label.rb +187 -0
  92. data/Paths/MobileInfo.rb +19 -0
  93. data/Paths/internetCash.rb +34 -0
  94. data/Paths/internetWifi.rb +54 -0
  95. data/README.md +60 -0
  96. data/Rakefile +13 -0
  97. data/TODO +1391 -0
  98. data/Test/.gitignore +3 -0
  99. data/Test/Diplomas/base_gestion.odt +0 -0
  100. data/Test/Diplomas/base_report.odt +0 -0
  101. data/Test/Diplomas/carte_etudiant.odg +0 -0
  102. data/Test/Diplomas/exam_language.odt +0 -0
  103. data/Test/Diplomas/label.odg +0 -0
  104. data/Test/Diplomas/presence_sheet.ods +0 -0
  105. data/Test/Diplomas/presence_sheet_small.ods +0 -0
  106. data/Test/Diplomas/student_card.odg +0 -0
  107. data/Test/Manual/testMerge +18 -0
  108. data/Test/config_test.yaml +26 -0
  109. data/Test/db.testGestion +0 -0
  110. data/Test/dfiles/descs/avg-rescue.desc +10 -0
  111. data/Test/dfiles/descs/avg.desc +8 -0
  112. data/Test/dfiles/descs/driver.desc +8 -0
  113. data/Test/dfiles/descs/linuxmint.desc +7 -0
  114. data/Test/dfiles/files/avg-160203.exe +1 -0
  115. data/Test/dfiles/files/avg.iso +1 -0
  116. data/Test/dfiles/files/driver.exe +1 -0
  117. data/Test/dfiles/index_post.html +3 -0
  118. data/Test/dfiles/index_pre.html +8 -0
  119. data/Test/dfiles/priorities +5 -0
  120. data/Test/ge_activity.rb +124 -0
  121. data/Test/ge_chat.rb +106 -0
  122. data/Test/ge_compta.rb +67 -0
  123. data/Test/ge_configbase.rb +54 -0
  124. data/Test/ge_course.rb +1114 -0
  125. data/Test/ge_dfiles.rb +121 -0
  126. data/Test/ge_filesmanage.rb +180 -0
  127. data/Test/ge_info.rb +27 -0
  128. data/Test/ge_internet.rb +246 -0
  129. data/Test/ge_login.rb +55 -0
  130. data/Test/ge_person.rb +373 -0
  131. data/Test/ge_qvinfo.rb +28 -0
  132. data/Test/ge_report.rb +97 -0
  133. data/Test/ge_share.rb +27 -0
  134. data/Test/ge_sms.rb +34 -0
  135. data/Test/ge_tasks.rb +19 -0
  136. data/Test/ge_usage.rb +168 -0
  137. data/Test/ge_view.rb +46 -0
  138. data/Test/multiconf-captive +29 -0
  139. data/Test/test.conf +7 -0
  140. data/Test/test.rb +49 -0
  141. data/Test/test_bytes.png +0 -0
  142. data/VERSION +140 -0
  143. data/Views/Admin/Backup.rb +91 -0
  144. data/Views/Admin/Configuration.rb +44 -0
  145. data/Views/Admin/Credit.rb +32 -0
  146. data/Views/Admin/FilesManage.rb +219 -0
  147. data/Views/Admin/Function.rb +39 -0
  148. data/Views/Admin/Power.rb +49 -0
  149. data/Views/Admin/Printer.rb +37 -0
  150. data/Views/Admin/Server.rb +252 -0
  151. data/Views/Admin/Tabs.rb +5 -0
  152. data/Views/Admin/Update.rb +73 -0
  153. data/Views/Admin/UpdateSystem.rb +26 -0
  154. data/Views/Cashbox/Activity.rb +191 -0
  155. data/Views/Cashbox/Course.rb +141 -0
  156. data/Views/Cashbox/Credit.rb +79 -0
  157. data/Views/Cashbox/Report.rb +115 -0
  158. data/Views/Cashbox/Service.rb +105 -0
  159. data/Views/Cashbox/Tabs.rb +10 -0
  160. data/Views/Compta/Accounts.rb +36 -0
  161. data/Views/Compta/Course.rb +96 -0
  162. data/Views/Compta/Show.rb +6 -0
  163. data/Views/Compta/Transfer.rb +66 -0
  164. data/Views/Course/Diploma.rb +203 -0
  165. data/Views/Course/Grade.rb +401 -0
  166. data/Views/Course/Modify.rb +447 -0
  167. data/Views/Course/Print.rb +94 -0
  168. data/Views/Course/Responsible.rb +44 -0
  169. data/Views/Course/Stats.rb +76 -0
  170. data/Views/Course/Students.rb +92 -0
  171. data/Views/Course/Tabs.rb +220 -0
  172. data/Views/Internet/Access.rb +134 -0
  173. data/Views/Internet/ClassEdit.rb +24 -0
  174. data/Views/Internet/ClassUsers.rb +81 -0
  175. data/Views/Internet/Config.rb +32 -0
  176. data/Views/Internet/Mobile.rb +213 -0
  177. data/Views/Internet/Recharges.rb +49 -0
  178. data/Views/Internet/Tabs.rb +6 -0
  179. data/Views/Inventory/Computer.rb +24 -0
  180. data/Views/Inventory/Room.rb +18 -0
  181. data/Views/Inventory/Tabs.rb +9 -0
  182. data/Views/Inventory/TicketClosed.rb +7 -0
  183. data/Views/Inventory/TicketOpen.rb +23 -0
  184. data/Views/Library/Person.rb +36 -0
  185. data/Views/Library/Tabs.rb +7 -0
  186. data/Views/Network/Block.rb +87 -0
  187. data/Views/Network/Netdevs.rb +21 -0
  188. data/Views/Network/Restriction.rb +37 -0
  189. data/Views/Network/Share.rb +167 -0
  190. data/Views/Network/Tables.rb +28 -0
  191. data/Views/Network/Tabs.rb +6 -0
  192. data/Views/Person/Admin.rb +99 -0
  193. data/Views/Person/Center.rb +48 -0
  194. data/Views/Person/Course.rb +72 -0
  195. data/Views/Person/Modify.rb +153 -0
  196. data/Views/Person/Tabs.rb +162 -0
  197. data/Views/Report/ComptaExecutive.rb +221 -0
  198. data/Views/Report/ComptaFlat.rb +79 -0
  199. data/Views/Report/ReportCourse.rb +47 -0
  200. data/Views/Report/Tabs.rb +8 -0
  201. data/Views/Report/Usage.rb +52 -0
  202. data/Views/Report/UsageCases.rb +59 -0
  203. data/Views/Self/Cash.rb +67 -0
  204. data/Views/Self/Chat.rb +55 -0
  205. data/Views/Self/Concours.rb +109 -0
  206. data/Views/Self/Email.rb +34 -0
  207. data/Views/Self/Internet.rb +255 -0
  208. data/Views/Self/Results.rb +17 -0
  209. data/Views/Self/Services.rb +85 -0
  210. data/Views/Self/Show.rb +47 -0
  211. data/Views/Self/Tabs.rb +5 -0
  212. data/Views/Special/DFileEdit.rb +13 -0
  213. data/Views/Special/PlugEdit.rb +56 -0
  214. data/Views/Special/Tabs.rb +6 -0
  215. data/Views/Special/Vnc.rb +39 -0
  216. data/Views/Task/Client.rb +21 -0
  217. data/Views/Task/Edit.rb +33 -0
  218. data/Views/Task/List.rb +55 -0
  219. data/Views/Task/Tabs.rb +9 -0
  220. data/Views/Task/Worker.rb +30 -0
  221. data/Views/Template/Activity.rb +33 -0
  222. data/Views/Template/CourseType.rb +63 -0
  223. data/Views/Template/ScheduleType.rb +29 -0
  224. data/Views/Template/Tabs.rb +5 -0
  225. data/Views/Welcome.rb +121 -0
  226. data/config.yaml.default +36 -0
  227. data/po/Gestion-ar.po +2356 -0
  228. data/po/Gestion-en.mo +0 -0
  229. data/po/Gestion-en.po +4363 -0
  230. data/po/Gestion-fr.mo +0 -0
  231. data/po/Gestion-fr.po +4345 -0
  232. data/po/traduction-ar.rtf +76 -0
  233. metadata +381 -0
@@ -0,0 +1,162 @@
1
+ class PersonTabs < View
2
+ def layout
3
+ @order = 10
4
+ @update = true
5
+ @persons_total = Persons.data.count
6
+
7
+ gui_vbox :nogroup do
8
+ show_str :search
9
+ show_list_single :persons, '[]', :flexheight => 1, :callback => true
10
+ show_button :start_search, :delete, :add
11
+
12
+ gui_window :add_person do
13
+ show_str :complete_name, :width => 150
14
+ show_str :login_prop
15
+ #show_block :address
16
+ show_button :add_person, :close
17
+ end
18
+
19
+ gui_window :error do
20
+ show_html :info
21
+ show_button :close
22
+ end
23
+
24
+ gui_window :win_confirm_delete do
25
+ show_html :delete_txt
26
+ show_button :confirm_delete, :close
27
+ end
28
+ end
29
+ end
30
+
31
+ def rpc_update(session)
32
+ super(session)
33
+ #+ rpc_callback_search(session, {}, false)
34
+ end
35
+
36
+ def rpc_button_start_search(session, args)
37
+ rpc_callback_search(session, args)
38
+ end
39
+
40
+ def rpc_button_delete(session, args)
41
+ if session.can_view(:FlagDeletePerson)
42
+ if (p_login = args._persons) and
43
+ (p = Persons.match_by_login_name(p_login[0]))
44
+ dputs(3) { "Found person #{p.inspect} - #{p.class.name}" }
45
+ return reply(:window_show, :win_confirm_delete) +
46
+ reply(:update, :delete_txt => 'Are you sure you want to delete user<br>' +
47
+ "#{p.login_name}:#{p.full_name} ?")
48
+ end
49
+ end
50
+ end
51
+
52
+ def rpc_button_confirm_delete(session, args)
53
+ if session.can_view(:FlagDeletePerson)
54
+ if (p_login = args._persons) and
55
+ (p = Persons.match_by_login_name(p_login[0]))
56
+ dputs(3) { "Found person #{p.inspect} - #{p.class.name}" }
57
+ begin
58
+ log_msg :Persons, "User #{session.owner.login_name} deletes #{p.login_name}"
59
+ p.delete
60
+ rescue IsNecessary => who
61
+ return reply(:window_hide) +
62
+ reply(:window_show, :error) +
63
+ reply(:update, :info => "Course #{who.for_course.name} " +
64
+ "still needs #{p.login_name}")
65
+ end
66
+ end
67
+ end
68
+ reply(:window_hide) +
69
+ rpc_callback_search(session, args)
70
+ end
71
+
72
+ def rpc_update_view(session, args = nil)
73
+ login_prop = session.can_view(:FlagAdminLoginProp) ? :unhide : :hide
74
+ super(session, args) +
75
+ reply(:focus, :search) +
76
+ reply(session.can_view(:FlagPersonDelete) ? :unhide : :hide, :delete) +
77
+ reply(session.can_view(:FlagPersonAdd) ? :unhide : :hide, :add) +
78
+ reply(login_prop, :login_prop) +
79
+ reply(:fade_in, :parent)
80
+ end
81
+
82
+ def rpc_list_choice(session, name, args)
83
+ dputs(3) { "args is #{args.inspect}" }
84
+ dputs(3) { "New choice #{name} - #{args['persons']}" }
85
+
86
+ if name == 'persons' and args and args['persons']
87
+ reply(:pass_tabs, ['list_choice', name, {:persons => [args._persons]}]) +
88
+ reply(:fade_in, :parent_child)
89
+ else
90
+ []
91
+ end
92
+ end
93
+
94
+ def rpc_callback_search(session, data, do_list_choice = true)
95
+ dputs(3) { "Got data: #{data.inspect}" }
96
+
97
+ s = data._search
98
+
99
+ center = session.owner.permissions.index('center') ?
100
+ session.owner.login_name : nil
101
+ result = Persons.search_in(s, center: center)
102
+
103
+ ret = reply(:empty, :persons)
104
+
105
+ if result.length > 0
106
+ ret += reply(:update,
107
+ :persons => result.collect { |p|
108
+ p.to_list(session.owner) },
109
+ :search => s)
110
+ if do_list_choice
111
+ ret += reply(:update, :persons => [result[0].login_name])
112
+ end
113
+ else
114
+ ret += reply(:fade_in, :parent) +
115
+ reply(:child, reply(:empty_nonlists))
116
+ end
117
+
118
+ ret + reply(:focus, :search)
119
+ end
120
+
121
+ def rpc_autofill(session, args)
122
+ ret = []
123
+ if args['persons'] and args['persons'].length > 0
124
+ p = Persons.match_by_login_name(args['persons'][0])
125
+ if args['search']
126
+ ret += rpc_callback_search(session, args, false)
127
+ else
128
+ ret += reply(:update, :persons => [p.to_list(session.owner)]) +
129
+ reply(:update, :search => p.login_name)
130
+ end
131
+ ret += reply(:update, :persons => [p.login_name])
132
+ elsif args['search']
133
+ ret += rpc_callback_search(session, args)
134
+ end
135
+ ret
136
+ end
137
+
138
+ def rpc_button_close(session, data)
139
+ reply(:window_hide)
140
+ end
141
+
142
+ def rpc_button_add(session, data)
143
+ reply(:window_show, :add_person) +
144
+ reply(:empty, [:complete_name, :login_prop]) +
145
+ reply(:hide, [:family_name, :first_name]) +
146
+ reply(:focus, :complete_name)
147
+ end
148
+
149
+ def rpc_button_add_person(session, data)
150
+ data.to_sym!
151
+ dputs(3) { "Pressed button accept with #{data.inspect}" }
152
+ person = Persons.create_person(data._complete_name, session.owner,
153
+ data._login_prop)
154
+ #person.data_set_hash(data.reject { |k, v|
155
+ # k =~ /(family_name|first_name|login_name|person_id)/ })
156
+
157
+ reply(:window_hide) +
158
+ rpc_callback_search(session, 'search' => person.login_name)
159
+ #reply( :child, reply( :switch_tab, :PersonModify ) ) +
160
+ end
161
+
162
+ end
@@ -0,0 +1,221 @@
1
+ class ReportComptaExecutive < View
2
+ include PrintButton
3
+
4
+ def layout
5
+ @order = 20
6
+ @update = true
7
+ @functions_need = [:accounting]
8
+
9
+ gui_hboxg do
10
+ gui_vbox :nogroup do
11
+ gui_vboxg :nogroup do
12
+ show_entity_report_all :reports, :single, :name, :callback => true,
13
+ :flexheight => 1
14
+ show_button :report_add, :report_delete
15
+ end
16
+ gui_vbox :nogroup do
17
+ show_date :start
18
+ show_int :months
19
+ show_print :print
20
+ end
21
+ end
22
+ gui_vboxg :nogroup do
23
+ show_str :name
24
+ show_entity_reportAccount :accounts, :single,
25
+ :flexheight => 1, :width => 300
26
+ show_button :account_add, :account_del, :account_edit
27
+ show_button :account_up, :account_down
28
+ end
29
+
30
+ gui_window :win_account do
31
+ gui_vbox :nogroup do
32
+ show_entity_account :root, :drop, :width => 400,
33
+ :callback => true
34
+ show_entity_account :account, :drop
35
+ show_int :level
36
+ show_button :account_add_win, :account_save_win, :close
37
+ end
38
+ end
39
+
40
+ gui_window :win_report do
41
+ show_str :report_name
42
+ show_button :report_add_win, :close
43
+ end
44
+
45
+ gui_window :progress do
46
+ show_html :progress_txt
47
+ show_button :report_cancel
48
+ end
49
+
50
+ window_print_status
51
+ end
52
+ end
53
+
54
+ def rpc_button_report_add(session, data)
55
+ reply(:window_show, :print_status)
56
+ end
57
+
58
+ def update_account(root = AccountRoot.actual, account = nil)
59
+ reply(:empty, :account) +
60
+ reply(:update, :account => root.listp_path) +
61
+ reply(:update, :account => [(account.class == Account) ? account.id : 0])
62
+ end
63
+
64
+ def update_root(root = AccountRoot.actual)
65
+ roots = [[AccountRoot.actual.id, 'Actual']]
66
+ archive = AccountRoot.archive and roots.concat(archive.listp_path(1)[1..-1])
67
+ reply(:empty, :root) +
68
+ reply(:update_silent, :root =>
69
+ roots.concat([(root.class == Account) ? root.id : 0]))
70
+ end
71
+
72
+ def update_reports
73
+ reply(:empty, :reports) +
74
+ reply(:update, :reports => Reports.listp_name)
75
+ end
76
+
77
+ def update_report(report, account = nil)
78
+ reply(:empty, :accounts) +
79
+ reply(:update, :name => report.name) +
80
+ reply(:update, :accounts => report.listp_accounts) +
81
+ reply(:update, :accounts => (account.class == ReportAccount) ?
82
+ [account.id] : nil)
83
+ end
84
+
85
+ def rpc_update(session)
86
+ td = Date.today
87
+ # Start in beginning of semester
88
+ start = Date.new(td.year, (td.month / 7.0).floor * 6 + 1)
89
+ update_reports +
90
+ reply(:update, :start => start.to_web) +
91
+ reply(:update, :months => 6) +
92
+ reply_print(session)
93
+ end
94
+
95
+ def button_account(session, name, data)
96
+ return if data._reports == []
97
+
98
+ case name
99
+ when /add_win/
100
+ data._reports.accounts = data._reports.accounts +
101
+ [ReportAccounts.create(data)]
102
+ update_report(data._reports) +
103
+ reply(:window_hide)
104
+ when /add/
105
+ reply(:window_show, :win_account) +
106
+ update_account +
107
+ update_root +
108
+ reply(:update, :level => "1") +
109
+ reply_show_hide(:account_add_win, :account_save_win)
110
+ when /del/
111
+ return if data._accounts == []
112
+ data._reports.accounts = data._reports.accounts.reject { |a|
113
+ a == data._accounts
114
+ }
115
+ update_report(data._reports)
116
+ when /edit/
117
+ return if data._accounts == []
118
+ reply(:window_show, :win_account) +
119
+ update_root(data._accounts.root) +
120
+ update_account(data._accounts.root, data._accounts.account) +
121
+ reply(:update, :level => data._accounts.level) +
122
+ reply_show_hide(:account_save_win, :account_add_win)
123
+ when /save_win/
124
+ data._accounts.data_set_hash(data)
125
+ update_report(data._reports) +
126
+ reply(:window_hide)
127
+ when /up/
128
+ accs = data._reports.accounts
129
+ if (index = accs.index(data._accounts)) > 0
130
+ accs[index - 1], accs[index] = accs[index], accs[index - 1]
131
+ end
132
+ data._reports.accounts = accs
133
+ update_report(data._reports, data._accounts)
134
+ when /down/
135
+ accs = data._reports.accounts
136
+ if (index = accs.index(data._accounts)) < accs.length - 1
137
+ accs[index + 1], accs[index] = accs[index], accs[index + 1]
138
+ end
139
+ data._reports.accounts = accs
140
+ update_report(data._reports, data._accounts)
141
+ end
142
+ end
143
+
144
+ def button_report(session, name, data)
145
+ case name
146
+ when /add_win/
147
+ if data._report_name.to_s.length > 0
148
+ Reports.create(:name => data._report_name, :accounts => [])
149
+ end
150
+ reply(:window_hide) +
151
+ update_reports
152
+ when /add/
153
+ reply(:window_show, :win_report) +
154
+ reply(:empty, :report_name)
155
+ when /del/
156
+ data._reports != [] and data._reports.delete
157
+ rpc_update(session)
158
+ end
159
+ end
160
+
161
+ def rpc_button(session, name, data)
162
+ case name
163
+ when /^account_(.*)/
164
+ button_account(session, $~[1], data)
165
+ when /^report_(.*)/
166
+ button_report(session, $~[1], data)
167
+ when /print/
168
+ if data._reports.class == Report
169
+ start_thread(session, data)
170
+ reply(:auto_update, -1) +
171
+ reply(:update, progress_txt: 'Starting checking') +
172
+ reply(:window_show, :progress) +
173
+ rpc_print(session, :print, data)
174
+ end
175
+ when /close/
176
+ reply(:window_hide)
177
+ when /report_cancel/
178
+ dputs(2){ "Killing thread #{session.s_data._report_ce_thread}"}
179
+ if thr = session.s_data._report_ce_thread
180
+ thr.kill
181
+ end
182
+ reply(:window_hide) +
183
+ reply(:auto_update, 0)
184
+ end
185
+ end
186
+
187
+ def start_thread(session, data)
188
+ session.s_data._report_ce = nil
189
+ session.s_data._report_ce_thread = Thread.start {
190
+ System.rescue_all do
191
+ session.s_data._report_ce = data._reports.print_pdf_monthly(
192
+ Date.from_web(data._start), data._months.to_i)
193
+ end
194
+ dputs(2){ 'Thread finished'}
195
+ }
196
+ end
197
+
198
+ def rpc_update_with_values(session, data)
199
+ report = data._reports
200
+ if report_ce = session.s_data._report_ce
201
+ return reply(:window_hide) +
202
+ reply(:auto_update, 0) +
203
+ send_printer_reply(session, :print, data, report_ce)
204
+ else
205
+ return reply(:update, :progress_txt =>
206
+ "Accounts done: #{(report.print_accounts * 100).floor}%<br>" +
207
+ "Calculating: #{report.print_account}")
208
+ end
209
+ end
210
+
211
+ def rpc_list_choice_reports(session, data)
212
+ return if data._reports == []
213
+ reply(:empty, :accounts) +
214
+ update_report(data._reports)
215
+ end
216
+
217
+ def rpc_list_choice_root(session, data)
218
+ return if data._root == []
219
+ update_account(data._root)
220
+ end
221
+ end
@@ -0,0 +1,79 @@
1
+ class ReportComptaFlat < View
2
+ def layout
3
+ @count = 1
4
+ @rpc_update = true
5
+ @order = 30
6
+ @functions_need = [:accounting]
7
+
8
+ gui_hboxg do
9
+ gui_vboxg :nogroup do
10
+ show_entity_account :account_archive, :drop, :callback => true
11
+ show_entity_account :account_list, :single,
12
+ :width => 400, :flex => 1, :callback => true
13
+ end
14
+ gui_vbox :nogroup do
15
+ show_int :total
16
+ show_str :desc, :width => 300
17
+ show_button :account_update, :report_movements
18
+ end
19
+ gui_window :get_report do
20
+ show_html :txt
21
+ show_button :close
22
+ end
23
+ end
24
+ end
25
+
26
+ def rpc_button_report_movements(session, data)
27
+ if acc = data._account_list
28
+ dputs(3) { "Got account #{acc.path}" }
29
+ file = "/tmp/report_movs_#{@count += 1}.pdf"
30
+ acc.print_pdf(file, true)
31
+ reply(:window_show, :get_report) +
32
+ reply(:update, :txt => 'Get the report:<br>' +
33
+ "<a href='#{file}' target='other'>#{file}</a>")
34
+ end
35
+ end
36
+
37
+ def rpc_button_account_update(session, data)
38
+ if (acc = data._account_list).class == Account
39
+ acc.update_total
40
+ end
41
+ end
42
+
43
+ def update_list(account = [])
44
+ account.class == Account or account = AccountRoot.current
45
+
46
+ reply(:empty_nonlists, :account_list) +
47
+ reply(:update, :account_list => account.listp_path)
48
+ end
49
+
50
+ def update_archive
51
+ reply(:empty_nonlists, :account_archive) +
52
+ reply(:update_silent, :account_archive => [[0, 'Actual']].concat(
53
+ if archive = AccountRoot.archive
54
+ archive.accounts.collect { |a|
55
+ [a.id, a.path] }.sort_by { |a| a[1] }
56
+ else
57
+ []
58
+ end))
59
+ end
60
+
61
+ def rpc_update_view(session)
62
+ super(session) +
63
+ update_list +
64
+ update_archive
65
+ end
66
+
67
+ def rpc_list_choice_account_list(session, data)
68
+ if (acc = data._account_list) != []
69
+ reply(:update, :total => acc.total_form) +
70
+ reply(:update, :desc => acc.desc)
71
+ else
72
+ []
73
+ end
74
+ end
75
+
76
+ def rpc_list_choice_account_archive(session, data)
77
+ update_list(data._account_archive)
78
+ end
79
+ end
@@ -0,0 +1,47 @@
1
+ # Allows for adding cash to a specific course
2
+
3
+ class ReportCourse < View
4
+ include PrintButton
5
+
6
+ def layout
7
+ @order = 10
8
+ @update = true
9
+ @functions_need = [:cashbox, :accounting]
10
+
11
+ gui_hboxg do
12
+ gui_vboxg :nogroup do
13
+ show_entity_course :course, :single, :name,
14
+ lambda{|c| c.entries}, :callback => true, :flexheight => 1
15
+ show_print :print
16
+ end
17
+ gui_vbox :nogroup do
18
+ show_table :report, :headings => [ :Date, :Desc, :Amount, :Rest ],
19
+ :widths => [ 100, 200, 75, 75 ], :height => 400, :width => 470,
20
+ :columns => [0, 0, :align_right, :align_right]
21
+ end
22
+
23
+ window_print_status
24
+ end
25
+ end
26
+
27
+ def rpc_update( session )
28
+ super( session ) +
29
+ reply( :empty_nonlists, :course ) +
30
+ reply( :update, :course => Courses.list_courses_entries(session) ) +
31
+ reply_print( session )
32
+ end
33
+
34
+ def rpc_button_print( session, data )
35
+ send_printer_reply( session, :print, data,
36
+ data._course.report_pdf )
37
+ end
38
+
39
+ def rpc_list_choice_course( session, data )
40
+ dputs(3){"report is #{data._report_start.inspect}"}
41
+ ret = reply( :empty, :report )
42
+
43
+ if data._course != []
44
+ ret += reply( :update, :report => data._course.report_list )
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,8 @@
1
+ # To change this template, choose Tools | Templates
2
+ # and open the template in the editor.
3
+
4
+ class ReportTabs < View
5
+ def layout
6
+ @order = 100
7
+ end
8
+ end
@@ -0,0 +1,52 @@
1
+ class ReportUsage < View
2
+
3
+ def layout
4
+ @order = 60
5
+ @update = true
6
+ @functions_need = [:usage_report]
7
+
8
+ gui_hbox do
9
+ gui_vbox :nogroup do
10
+ show_entity_usage_all :usage, :single, :name, :callback => true
11
+ show_button :print
12
+ end
13
+ gui_vbox :nogroup do
14
+ show_table :usage_report, :headings => [:Element, :Count],
15
+ :widths => [300, 70], :height => 300
16
+ show_list_drop :duration, '[[1, :day],[7, :week], [14, :bi_week],' +
17
+ ' [31,:month], [365, :year]]', :callback => true
18
+ show_date :from
19
+ show_date :to
20
+ show_button :update
21
+ end
22
+ end
23
+ end
24
+
25
+ def rpc_update(session)
26
+ reply(:update, {from: (Date.today - 7).to_web, to: Date.today.to_web,
27
+ duration: [7]})
28
+ end
29
+
30
+ def rpc_print(session, name, data)
31
+
32
+ end
33
+
34
+ def rpc_list_choice_usage(session, data)
35
+ return [] unless data._usage
36
+ table = data._usage.collect_data(data._from.date_from_web,
37
+ data._to.date_from_web)
38
+ reply(:empty, :usage_report) +
39
+ reply(:update, {:usage_report => table,
40
+ from: data._from, to: data._to})
41
+ end
42
+
43
+ def rpc_list_choice_duration(session, data)
44
+ return [] if !data._to or !data._duration.first or !data._usage
45
+ data._from = (data._to.date_from_web - data._duration.first.to_i).to_web
46
+ rpc_list_choice_usage(session, data)
47
+ end
48
+
49
+ def rpc_button_update(session, data)
50
+ rpc_list_choice_usage(session, data)
51
+ end
52
+ end
@@ -0,0 +1,59 @@
1
+ class ReportUsageCases < View
2
+ include VTListPane
3
+
4
+ def layout
5
+ @order = 50
6
+ @update = true
7
+ @functions_need = [ :usage_report ]
8
+
9
+ set_data_class :Usages
10
+
11
+ gui_vbox do
12
+ gui_hbox :nogroup do
13
+ gui_vbox :nogroup do
14
+ vtlp_list :usage_list, 'name'
15
+ #show_entity_usage_all :usage, :single, :name, :callback => true,
16
+ # :flexheight => 1
17
+ show_button :delete, :new
18
+ end
19
+ gui_vbox :nogroup do
20
+ show_str :name
21
+ show_str :file_dir
22
+ show_str :file_glob
23
+ show_text :file_filter, :flexwidth => 1, :flexheight => 1
24
+ show_button :save
25
+ end
26
+ end
27
+ gui_vboxg :nogroup do
28
+ show_list_drop :file_data, '%w(none)', :callback => :file_chosen
29
+ show_text :file_source, :flexwidth => 1, :flexheight => 1
30
+ show_text :file_filtered, :flexwidth => 1, :flexheight => 1
31
+ end
32
+ end
33
+ end
34
+
35
+ def rpc_list_choice_file_data( session, data )
36
+ file_data = data._file_data.first
37
+ return if file_data == 'none'
38
+ usage_list = Usages.match_by_id( data._usage_list.first ) or return
39
+ file_f = [{}]
40
+ file_s = if File.exists? file_data.to_s
41
+ file_f = usage_list.filter_file( file_data )
42
+ File.open( file_data, 'r').readlines[0..100]
43
+ else
44
+ ''
45
+ end
46
+ reply( :empty, %w( file_source file_filtered ) ) +
47
+ reply( :update, :file_source => file_s ) +
48
+ reply( :update, :file_filtered => file_f[0..100].join("\n"))
49
+ end
50
+
51
+ def rpc_update(session)
52
+ reply(:empty, :file_data) +
53
+ if ul = Usages.match_by_id(session.s_data._usage_list)
54
+ reply(:update, :file_data => ul.fetch_files)
55
+ else
56
+ []
57
+ end
58
+ end
59
+ end
@@ -0,0 +1,67 @@
1
+ class SelfCash < View
2
+ def layout
3
+ set_data_class :Persons
4
+ @update = true
5
+ @cache_payments = {}
6
+ @order = 20
7
+ @functions_need = [:accounting]
8
+ @visible = false
9
+
10
+ gui_vbox do
11
+ show_int_ro :account_total_due, :width => 100
12
+ show_list_single :payments, :width => 500, :callback => true,
13
+ :nopreselect => true, :flexheight => 1
14
+ show_button :update
15
+ end
16
+ end
17
+
18
+ def rpc_update( session, client = nil )
19
+ person = session.owner
20
+ reply( :empty_nonlists, %w( payments ) ) +
21
+ reply( :update, { :account_total_due => person.account_total_due } ) +
22
+ reply( :update, { :payments => list_payments( session, true ) } )
23
+ end
24
+
25
+ def list_payments( session, force = false )
26
+ dputs(3){"list_payments #{session.inspect}"}
27
+ person = session.owner
28
+ pid = person.person_id
29
+ if not @cache_payments[pid] or force
30
+ @cache_payments[pid] = if ad = person.account_due
31
+ dputs(3){"account_due is here"}
32
+ ad.movements.select{|m| m.value != 0}.collect{|m|
33
+ dputs(4){"Collecting #{m.inspect}"}
34
+ "#{m.date} :: #{( m.value * 1000 ).floor.to_s.rjust(6,'_')} " +
35
+ ":: #{m.desc}"
36
+ }
37
+ else
38
+ ""
39
+ end
40
+ end
41
+ dputs(3){"Found movements #{@cache_payments[pid].inspect}"}
42
+ @cache_payments[pid]
43
+ end
44
+
45
+ def rpc_list_choice( session, name, args )
46
+ if desc = args['payments']
47
+ desc = desc[0]
48
+ dputs( 2 ){ "New choice #{name} - #{args.inspect}" }
49
+ if desc =~ /.*Gestion: internet_credit/
50
+ login = desc.sub(/.*internet_credit pour -([^:]*).*/, '\1')
51
+
52
+ reply( :parent,
53
+ reply( :init_values, [ :PersonTabs, { :search => login, :persons => [] } ] ) +
54
+ reply( :switch_tab, :PersonTabs ) ) +
55
+ reply( :switch_tab, :PersonModify )
56
+ end
57
+ #reply( :parent, reply( :update, :search => login) )
58
+ #reply( :parent, View.PersonTabs.rpc_callback_search( session,
59
+ # "search" => login ) )
60
+ end
61
+ end
62
+
63
+ def rpc_button_update( session, data)
64
+ rpc_update( session )
65
+ end
66
+
67
+ end