gestion 1.9.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +48 -0
- data/.project +14 -0
- data/Binaries/adduser_to_buzz +15 -0
- data/Binaries/backup +7 -0
- data/Binaries/check_gestion +8 -0
- data/Binaries/gestion.gnumail +22 -0
- data/Binaries/gestion.logrotate +34 -0
- data/Binaries/gestion.service +12 -0
- data/Binaries/gestion_update.rb +183 -0
- data/Binaries/gestion_update.service +10 -0
- data/Binaries/get_compta +11 -0
- data/Binaries/kill_gestion +16 -0
- data/Binaries/ldap/add_indexes +51 -0
- data/Binaries/ldap/backup +2 -0
- data/Binaries/ldap/install_ldap +92 -0
- data/Binaries/ldap/restore +7 -0
- data/Binaries/lib_backup +5 -0
- data/Binaries/log_scan_errors +8 -0
- data/Binaries/loop_gestion +64 -0
- data/Binaries/onetimers/sync_courses_from_compta.rb +74 -0
- data/Binaries/onetimers/transfer_cash_from_ldap_to_csv +26 -0
- data/Binaries/reboot +5 -0
- data/Binaries/restore +3 -0
- data/Binaries/restore_do +22 -0
- data/Binaries/sort_events +31 -0
- data/Binaries/start_gestion +18 -0
- data/Binaries/swipe_gestion +18 -0
- data/Binaries/update_africompta +21 -0
- data/Binaries/update_users +3 -0
- data/Diplomas.src/accredited.odg +0 -0
- data/Diplomas.src/diploma.odg +0 -0
- data/Diplomas.src/label.odg +0 -0
- data/Diplomas.src/presence_sheet.ods +0 -0
- data/Diplomas.src/presence_sheet_small.ods +0 -0
- data/Diplomas.src/student_card.odg +0 -0
- data/Doc/130514-it-ideas.odt +0 -0
- data/Doc/Compta-cash.mm +179 -0
- data/Doc/General.odt +0 -0
- data/Entities/AccessGroups.rb +117 -0
- data/Entities/Activity.rb +178 -0
- data/Entities/ChatMsg.rb +142 -0
- data/Entities/Classroom.rb +11 -0
- data/Entities/Client.rb +19 -0
- data/Entities/Computer.rb +21 -0
- data/Entities/ConfigBase.rb +280 -0
- data/Entities/Course.rb +1588 -0
- data/Entities/CourseType.rb +171 -0
- data/Entities/DFiles.rb +466 -0
- data/Entities/FilesManage.rb +226 -0
- data/Entities/Grade.rb +186 -0
- data/Entities/Internet.rb +300 -0
- data/Entities/Netdev.rb +10 -0
- data/Entities/Person.rb +1175 -0
- data/Entities/Plug.rb +98 -0
- data/Entities/Quiz.rb +33 -0
- data/Entities/Recharges.rb +37 -0
- data/Entities/Report.rb +136 -0
- data/Entities/Room.rb +12 -0
- data/Entities/SMS.rb +30 -0
- data/Entities/ScheduleType.rb +33 -0
- data/Entities/Share.rb +120 -0
- data/Entities/Task.rb +51 -0
- data/Entities/Ticket.rb +72 -0
- data/Entities/Usage.rb +143 -0
- data/Entities/Worker.rb +29 -0
- data/Files/apache-profeda.conf +36 -0
- data/Files/label.erb +121 -0
- data/Files/label_notfound.erb +64 -0
- data/Files/label_notpassed.erb +84 -0
- data/Files/mobileinfo.erb +115 -0
- data/Files/smb.conf +333 -0
- data/Files/timetable.html +36 -0
- data/Files/timetable.js +239 -0
- data/Gemfile +12 -0
- data/Gemfile.dev +12 -0
- data/Gemfile.dev.lock +127 -0
- data/Gemfile.lock +127 -0
- data/Gemfile.prod +8 -0
- data/Gestion +35 -0
- data/Gestion.rb +220 -0
- data/INSTALL +40 -0
- data/Images/connection.xcf +0 -0
- data/Images/connection_no.png +0 -0
- data/Images/connection_wait.png +0 -0
- data/Images/connection_yes.png +0 -0
- data/Paths/Exas.rb +13 -0
- data/Paths/Files.rb +19 -0
- data/Paths/GetDiplomas.rb +20 -0
- data/Paths/Info.rb +114 -0
- data/Paths/Label.rb +187 -0
- data/Paths/MobileInfo.rb +19 -0
- data/Paths/internetCash.rb +34 -0
- data/Paths/internetWifi.rb +54 -0
- data/README.md +60 -0
- data/Rakefile +13 -0
- data/TODO +1391 -0
- data/Test/.gitignore +3 -0
- data/Test/Diplomas/base_gestion.odt +0 -0
- data/Test/Diplomas/base_report.odt +0 -0
- data/Test/Diplomas/carte_etudiant.odg +0 -0
- data/Test/Diplomas/exam_language.odt +0 -0
- data/Test/Diplomas/label.odg +0 -0
- data/Test/Diplomas/presence_sheet.ods +0 -0
- data/Test/Diplomas/presence_sheet_small.ods +0 -0
- data/Test/Diplomas/student_card.odg +0 -0
- data/Test/Manual/testMerge +18 -0
- data/Test/config_test.yaml +26 -0
- data/Test/db.testGestion +0 -0
- data/Test/dfiles/descs/avg-rescue.desc +10 -0
- data/Test/dfiles/descs/avg.desc +8 -0
- data/Test/dfiles/descs/driver.desc +8 -0
- data/Test/dfiles/descs/linuxmint.desc +7 -0
- data/Test/dfiles/files/avg-160203.exe +1 -0
- data/Test/dfiles/files/avg.iso +1 -0
- data/Test/dfiles/files/driver.exe +1 -0
- data/Test/dfiles/index_post.html +3 -0
- data/Test/dfiles/index_pre.html +8 -0
- data/Test/dfiles/priorities +5 -0
- data/Test/ge_activity.rb +124 -0
- data/Test/ge_chat.rb +106 -0
- data/Test/ge_compta.rb +67 -0
- data/Test/ge_configbase.rb +54 -0
- data/Test/ge_course.rb +1114 -0
- data/Test/ge_dfiles.rb +121 -0
- data/Test/ge_filesmanage.rb +180 -0
- data/Test/ge_info.rb +27 -0
- data/Test/ge_internet.rb +246 -0
- data/Test/ge_login.rb +55 -0
- data/Test/ge_person.rb +373 -0
- data/Test/ge_qvinfo.rb +28 -0
- data/Test/ge_report.rb +97 -0
- data/Test/ge_share.rb +27 -0
- data/Test/ge_sms.rb +34 -0
- data/Test/ge_tasks.rb +19 -0
- data/Test/ge_usage.rb +168 -0
- data/Test/ge_view.rb +46 -0
- data/Test/multiconf-captive +29 -0
- data/Test/test.conf +7 -0
- data/Test/test.rb +49 -0
- data/Test/test_bytes.png +0 -0
- data/VERSION +140 -0
- data/Views/Admin/Backup.rb +91 -0
- data/Views/Admin/Configuration.rb +44 -0
- data/Views/Admin/Credit.rb +32 -0
- data/Views/Admin/FilesManage.rb +219 -0
- data/Views/Admin/Function.rb +39 -0
- data/Views/Admin/Power.rb +49 -0
- data/Views/Admin/Printer.rb +37 -0
- data/Views/Admin/Server.rb +252 -0
- data/Views/Admin/Tabs.rb +5 -0
- data/Views/Admin/Update.rb +73 -0
- data/Views/Admin/UpdateSystem.rb +26 -0
- data/Views/Cashbox/Activity.rb +191 -0
- data/Views/Cashbox/Course.rb +141 -0
- data/Views/Cashbox/Credit.rb +79 -0
- data/Views/Cashbox/Report.rb +115 -0
- data/Views/Cashbox/Service.rb +105 -0
- data/Views/Cashbox/Tabs.rb +10 -0
- data/Views/Compta/Accounts.rb +36 -0
- data/Views/Compta/Course.rb +96 -0
- data/Views/Compta/Show.rb +6 -0
- data/Views/Compta/Transfer.rb +66 -0
- data/Views/Course/Diploma.rb +203 -0
- data/Views/Course/Grade.rb +401 -0
- data/Views/Course/Modify.rb +447 -0
- data/Views/Course/Print.rb +94 -0
- data/Views/Course/Responsible.rb +44 -0
- data/Views/Course/Stats.rb +76 -0
- data/Views/Course/Students.rb +92 -0
- data/Views/Course/Tabs.rb +220 -0
- data/Views/Internet/Access.rb +134 -0
- data/Views/Internet/ClassEdit.rb +24 -0
- data/Views/Internet/ClassUsers.rb +81 -0
- data/Views/Internet/Config.rb +32 -0
- data/Views/Internet/Mobile.rb +213 -0
- data/Views/Internet/Recharges.rb +49 -0
- data/Views/Internet/Tabs.rb +6 -0
- data/Views/Inventory/Computer.rb +24 -0
- data/Views/Inventory/Room.rb +18 -0
- data/Views/Inventory/Tabs.rb +9 -0
- data/Views/Inventory/TicketClosed.rb +7 -0
- data/Views/Inventory/TicketOpen.rb +23 -0
- data/Views/Library/Person.rb +36 -0
- data/Views/Library/Tabs.rb +7 -0
- data/Views/Network/Block.rb +87 -0
- data/Views/Network/Netdevs.rb +21 -0
- data/Views/Network/Restriction.rb +37 -0
- data/Views/Network/Share.rb +167 -0
- data/Views/Network/Tables.rb +28 -0
- data/Views/Network/Tabs.rb +6 -0
- data/Views/Person/Admin.rb +99 -0
- data/Views/Person/Center.rb +48 -0
- data/Views/Person/Course.rb +72 -0
- data/Views/Person/Modify.rb +153 -0
- data/Views/Person/Tabs.rb +162 -0
- data/Views/Report/ComptaExecutive.rb +221 -0
- data/Views/Report/ComptaFlat.rb +79 -0
- data/Views/Report/ReportCourse.rb +47 -0
- data/Views/Report/Tabs.rb +8 -0
- data/Views/Report/Usage.rb +52 -0
- data/Views/Report/UsageCases.rb +59 -0
- data/Views/Self/Cash.rb +67 -0
- data/Views/Self/Chat.rb +55 -0
- data/Views/Self/Concours.rb +109 -0
- data/Views/Self/Email.rb +34 -0
- data/Views/Self/Internet.rb +255 -0
- data/Views/Self/Results.rb +17 -0
- data/Views/Self/Services.rb +85 -0
- data/Views/Self/Show.rb +47 -0
- data/Views/Self/Tabs.rb +5 -0
- data/Views/Special/DFileEdit.rb +13 -0
- data/Views/Special/PlugEdit.rb +56 -0
- data/Views/Special/Tabs.rb +6 -0
- data/Views/Special/Vnc.rb +39 -0
- data/Views/Task/Client.rb +21 -0
- data/Views/Task/Edit.rb +33 -0
- data/Views/Task/List.rb +55 -0
- data/Views/Task/Tabs.rb +9 -0
- data/Views/Task/Worker.rb +30 -0
- data/Views/Template/Activity.rb +33 -0
- data/Views/Template/CourseType.rb +63 -0
- data/Views/Template/ScheduleType.rb +29 -0
- data/Views/Template/Tabs.rb +5 -0
- data/Views/Welcome.rb +121 -0
- data/config.yaml.default +36 -0
- data/po/Gestion-ar.po +2356 -0
- data/po/Gestion-en.mo +0 -0
- data/po/Gestion-en.po +4363 -0
- data/po/Gestion-fr.mo +0 -0
- data/po/Gestion-fr.po +4345 -0
- data/po/traduction-ar.rtf +76 -0
- metadata +381 -0
@@ -0,0 +1,191 @@
|
|
1
|
+
class CashboxActivity < View
|
2
|
+
include PrintButton
|
3
|
+
|
4
|
+
def layout
|
5
|
+
@update = true
|
6
|
+
@order = 15
|
7
|
+
|
8
|
+
@functions_need = [:activities]
|
9
|
+
|
10
|
+
gui_hboxg do
|
11
|
+
gui_vboxg :nogroup do
|
12
|
+
show_entity_activity_all :activities, :single, :name, :flexheight => 1, :width => 200,
|
13
|
+
:callback => true
|
14
|
+
show_block_ro :show
|
15
|
+
end
|
16
|
+
gui_vboxg :nogroup do
|
17
|
+
gui_vboxg :nogroup do
|
18
|
+
show_entity_person :students, :single, :full_name,
|
19
|
+
:flexheight => 1, :callback => true, :width => 300
|
20
|
+
show_str :full_name
|
21
|
+
show_button :search_student, :new_student, :signed_up_students
|
22
|
+
# show_print :print_activity
|
23
|
+
end
|
24
|
+
end
|
25
|
+
gui_vboxg :nogroup do
|
26
|
+
gui_vbox :nogroup do
|
27
|
+
show_table :table_activities, :headings => %w( Start End )
|
28
|
+
show_date :date_start
|
29
|
+
end
|
30
|
+
show_button :pay_act, :delete
|
31
|
+
end
|
32
|
+
|
33
|
+
gui_window :printing do
|
34
|
+
show_html :msg_print
|
35
|
+
show_int_hidden :step
|
36
|
+
show_button :print_next, :close
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
def rpc_update(session)
|
42
|
+
# reply_print(session) +
|
43
|
+
reply(:update, :date_start => Date.today.to_web)
|
44
|
+
end
|
45
|
+
|
46
|
+
def rpc_button_pay_act(session, data)
|
47
|
+
return unless (data._activities and data._students)
|
48
|
+
# dp data._students
|
49
|
+
ActivityPayments.pay(data._activities, data._students, session.owner,
|
50
|
+
Date.from_web(data._date_start))
|
51
|
+
reply(:window_hide) +
|
52
|
+
rpc_list_choice_students(session, data)
|
53
|
+
end
|
54
|
+
|
55
|
+
def rpc_button_delete(session, data)
|
56
|
+
return unless (data._activities and data._students and
|
57
|
+
data._table_activities.length == 1)
|
58
|
+
|
59
|
+
act = ActivityPayments.match_by_activitypayment_id(data._table_activities.first)
|
60
|
+
if act.movement.account_src == act.person_cashed.account_due
|
61
|
+
act.movement.delete
|
62
|
+
act.delete
|
63
|
+
rpc_list_choice_students(session, data)
|
64
|
+
else
|
65
|
+
reply(:window_show, :printing)+
|
66
|
+
reply(:update, :msg_print => 'Ce mouvement est déjà comptabilisé')
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
def rpc_button_signed_up_students(session, data)
|
71
|
+
reply(:empty, :students) +
|
72
|
+
reply(:update, :students =>
|
73
|
+
ActivityPayments.search_by_activity(data._activities).collect { |ap|
|
74
|
+
ap.person_paid and ap.person_paid.to_list_id(session.owner)
|
75
|
+
}.compact.sort_by { |i| i[1] })
|
76
|
+
end
|
77
|
+
|
78
|
+
def rpc_button_new_student(session, data)
|
79
|
+
return unless (data._full_name || data._full_name.to_s.length > 0)
|
80
|
+
student = Persons.create({first_name: data._full_name})
|
81
|
+
student.permissions = %w(student internet)
|
82
|
+
data._full_name = student.login_name
|
83
|
+
rpc_button_search_student(session, data) +
|
84
|
+
reply(:update, students: [student.person_id])
|
85
|
+
end
|
86
|
+
|
87
|
+
def rpc_button_search_student(session, data)
|
88
|
+
return unless (data._full_name || data._full_name.to_s.length > 0)
|
89
|
+
reply(:empty_update, students: Persons.search_in(data._full_name).
|
90
|
+
collect { |p| p.to_list_id(session.owner) })
|
91
|
+
end
|
92
|
+
|
93
|
+
def rpc_list_choice_activities(session, data)
|
94
|
+
reply(:empty_nonlists_update, data._activities.to_hash) +
|
95
|
+
rpc_button_signed_up_students(session, data)
|
96
|
+
end
|
97
|
+
|
98
|
+
def rpc_list_choice_students(session, data)
|
99
|
+
return reply(:empty, %w(full_name table_activities)) unless data._students
|
100
|
+
|
101
|
+
act_table = ActivityPayments.for_user(data._students).collect { |act|
|
102
|
+
[act.activitypayment_id, [act.date_start, act.date_end]]
|
103
|
+
}.sort { |a, b| a[1] <=> b[1] }.reverse
|
104
|
+
reply(:empty_update, :table_activities => act_table) +
|
105
|
+
reply(:update, :date_start => Date.today.to_web)
|
106
|
+
end
|
107
|
+
|
108
|
+
def rpc_button_print_activity_steps(session, data)
|
109
|
+
ret = reply(:callback_button, :print_activity_steps)
|
110
|
+
var = session.s_data._print_activity
|
111
|
+
dputs(3) { "Doing with data #{var.inspect} step is #{var._step.inspect}" }
|
112
|
+
case var._step
|
113
|
+
when 1
|
114
|
+
dputs(3) { 'Showing prepare-window' }
|
115
|
+
var._students = var._activities.collect { |a| a.person_paid.login_name }
|
116
|
+
ret += reply(:window_show, :printing) +
|
117
|
+
reply(:update, :msg_print => 'Preparing students: <br><br>' +
|
118
|
+
var._students.each_slice(5).collect { |s| s.join(', ') }.
|
119
|
+
join(',<br>')) +
|
120
|
+
reply(:hide, :print_next)
|
121
|
+
when 2
|
122
|
+
dputs(3) { 'Printing pdfs' }
|
123
|
+
files = var._activities.collect { |act| act.print }
|
124
|
+
var._pages = OpenPrint.pdf_nup_duplex(files, 'activity_cards')
|
125
|
+
cmd = cmd_printer(session, :print_activity)
|
126
|
+
dputs(3) { "Command is #{cmd} with pages #{var._pages.inspect}" }
|
127
|
+
if not cmd
|
128
|
+
ret = reply(:window_show, :printing) +
|
129
|
+
reply(:update, :msg_print => 'Click on one of the links:<ul>' +
|
130
|
+
var._pages.collect { |r| "<li><a target='other' href=\"#{r}\">#{r}</a></li>" }.join('') +
|
131
|
+
'</ul>')
|
132
|
+
var._step = 9
|
133
|
+
elsif var._pages.length > 0
|
134
|
+
ret = reply(:window_show, :printing) +
|
135
|
+
reply(:update, :msg_print => 'Impression de la page face en cours pour<ul>' +
|
136
|
+
"<li>#{var._students.join('</li><li>')}</li></ul>" +
|
137
|
+
"<br>Cliquez sur 'suivant' pour imprimer les pages arrières") +
|
138
|
+
reply(:unhide, :print_next)
|
139
|
+
cmd += " #{var._pages[0]}"
|
140
|
+
dputs(3) { "Printing-cmd is #{cmd.inspect}" }
|
141
|
+
System.run_bool(cmd)
|
142
|
+
else
|
143
|
+
var._step = 9
|
144
|
+
end
|
145
|
+
when 3
|
146
|
+
cmd = cmd_printer(session, :print_activity)
|
147
|
+
dputs(3) { "Command is #{cmd} with pages #{var._pages.inspect}" }
|
148
|
+
ret = reply(:window_show, :printing) +
|
149
|
+
reply(:update, :msg_print => 'Impression de la page face arrière en cours<ul>' +
|
150
|
+
"<li>#{var._students.join('</li><li>')}</li></ul>") +
|
151
|
+
reply(:hide, :print_next)
|
152
|
+
cmd += " -o outputorder=reverse #{var._pages[1]}"
|
153
|
+
dputs(3) { "Printing-cmd is #{cmd.inspect}" }
|
154
|
+
System.run_bool(cmd)
|
155
|
+
when 4..10
|
156
|
+
dputs(3) { 'Hiding' }
|
157
|
+
ret = reply(:window_hide)
|
158
|
+
else
|
159
|
+
dputs(3) { "Oups - step is #{var._step.inspect}" }
|
160
|
+
end
|
161
|
+
|
162
|
+
var._step += 1
|
163
|
+
session.s_data[:print_activity] = var
|
164
|
+
dputs(3) { "Ret is #{ret.inspect}" }
|
165
|
+
return ret
|
166
|
+
end
|
167
|
+
|
168
|
+
def rpc_button_print_activity(session, data)
|
169
|
+
# dp "removed"
|
170
|
+
return nil
|
171
|
+
return unless data._students.length >= 1
|
172
|
+
acts = data._students.collect { |s|
|
173
|
+
if data._table_activities.length == 0
|
174
|
+
ActivityPayments.for_user(s).sort { |a, b| a.date_start <=> b.date_start }.
|
175
|
+
reverse.first
|
176
|
+
else
|
177
|
+
ActivityPayments.match_by_activitypayment_id(data._table_activities.first)
|
178
|
+
end
|
179
|
+
}
|
180
|
+
|
181
|
+
ret = rpc_print(session, :print_activity, data)
|
182
|
+
session.s_data._print_activity = {step: 1, activities: acts}
|
183
|
+
return ret + rpc_button_print_activity_steps(session, data)
|
184
|
+
end
|
185
|
+
|
186
|
+
def rpc_button_print_next(session, data)
|
187
|
+
rpc_button_print_activity_steps(session, data)
|
188
|
+
end
|
189
|
+
|
190
|
+
end
|
191
|
+
|
@@ -0,0 +1,141 @@
|
|
1
|
+
# Allows for adding cash to a specific course
|
2
|
+
|
3
|
+
class CashboxCourse < View
|
4
|
+
def layout
|
5
|
+
@order = 10
|
6
|
+
@update = true
|
7
|
+
@functions_need = [:cashbox, :accounting_courses]
|
8
|
+
|
9
|
+
gui_hboxg do
|
10
|
+
gui_vbox :nogroup do
|
11
|
+
show_entity_course :courses, :single, :name,
|
12
|
+
:flexheight => 1, :callback => true, :width => 100
|
13
|
+
end
|
14
|
+
gui_vbox :nogroup do
|
15
|
+
show_entity_person :students, :single, :full_name,
|
16
|
+
:flexheight => 1, :callback => true, :width => 300
|
17
|
+
show_str :full_name
|
18
|
+
show_button :add_student
|
19
|
+
end
|
20
|
+
gui_vbox :nogroup do
|
21
|
+
show_table :payments, :headings => [:Date, :Money, :Rest],
|
22
|
+
:widths => [100, 75, 75], :height => 200,
|
23
|
+
:columns => [0, :align_right, :align_right]
|
24
|
+
show_date :payment_date
|
25
|
+
show_int :cash
|
26
|
+
show_str :remark
|
27
|
+
show_str :receit_id
|
28
|
+
show_list_drop :old_cash, '%w( No Yes )'
|
29
|
+
show_button :pay, :delete, :move
|
30
|
+
end
|
31
|
+
|
32
|
+
gui_window :error do
|
33
|
+
show_html :msg
|
34
|
+
show_button :close
|
35
|
+
end
|
36
|
+
|
37
|
+
gui_window :win_move do
|
38
|
+
show_entity_person :move_students, :drop, :full_name, :width => 300
|
39
|
+
show_button :close, :do_move
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
@date_pay = Date.today
|
44
|
+
end
|
45
|
+
|
46
|
+
def rpc_list_choice_courses(session, data)
|
47
|
+
reply(:empty_nonlists, :students) +
|
48
|
+
reply(:update, :students => data._courses.list_students(true))
|
49
|
+
end
|
50
|
+
|
51
|
+
def rpc_list_choice_students(session, data)
|
52
|
+
reply(:empty, %w(cash remark receit_id)) +
|
53
|
+
reply(:update, :payment_date => @date_pay.strftime('%d.%m.%Y')) +
|
54
|
+
reply(:update, :payments =>
|
55
|
+
data._courses.student_payments(data._students.login_name))
|
56
|
+
end
|
57
|
+
|
58
|
+
def rpc_button_pay(session, data)
|
59
|
+
if data._payment_date
|
60
|
+
@date_pay = Date.parse(data._payment_date)
|
61
|
+
end
|
62
|
+
|
63
|
+
[[session.owner.account_due, "No account for #{session.owner.full_name}"],
|
64
|
+
[data._courses != [], 'Chose a course first'],
|
65
|
+
[data._students != [], 'Chose a student first'],
|
66
|
+
[data._courses.entries != [], 'Course has no account attached'],
|
67
|
+
[data._cash.to_i != 0, 'Enter an amount']].each { |t, msg|
|
68
|
+
dputs(3) { "Testing #{t.inspect} - #{msg}" }
|
69
|
+
t or return reply(:window_show, :error) +
|
70
|
+
reply(:update, :msg => msg)
|
71
|
+
}
|
72
|
+
|
73
|
+
dputs(3) { "Data is #{data.inspect}" }
|
74
|
+
if data._cash.to_i != 0
|
75
|
+
data._courses.payment(session.owner, data._students, data._cash, @date_pay,
|
76
|
+
session.owner.has_permission?(:admin) && data._old_cash.first == 'Yes',
|
77
|
+
remark: data._remark)
|
78
|
+
end
|
79
|
+
rpc_list_choice_students(session, data)
|
80
|
+
end
|
81
|
+
|
82
|
+
def rpc_button_add_student(session, data)
|
83
|
+
if (name = data._full_name).to_s.length > 0 &&
|
84
|
+
(course = data._courses)
|
85
|
+
Persons.create_add_course(data._full_name, session.owner, course)
|
86
|
+
rpc_list_choice_courses(session, data)
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
def rpc_button_move(session, data)
|
91
|
+
if data._students && data._courses
|
92
|
+
reply(:empty, :move_students) +
|
93
|
+
reply(:window_show, :win_move) +
|
94
|
+
reply(:update, :move_students => data._courses.list_students(true))
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
def rpc_button_do_move(session, data)
|
99
|
+
if (src = data._students) &&
|
100
|
+
(dst = data._move_students) &&
|
101
|
+
src != dst &&
|
102
|
+
data._courses
|
103
|
+
dputs(3) { "Moving student #{src.inspect}, #{dst.inspect}" }
|
104
|
+
data._courses.move_payment(src.login_name, dst.login_name)
|
105
|
+
end
|
106
|
+
reply(:window_hide) +
|
107
|
+
rpc_list_choice_students(session, data)
|
108
|
+
end
|
109
|
+
|
110
|
+
def rpc_update(session)
|
111
|
+
if owner = session.owner
|
112
|
+
reply_visible(owner.has_permission?(:admin), :old_cash)
|
113
|
+
else
|
114
|
+
[]
|
115
|
+
end +
|
116
|
+
reply(:empty_nonlists, :students) +
|
117
|
+
reply(:empty_nonlists, :courses) +
|
118
|
+
reply(:update, :courses => Courses.list_courses_entries)
|
119
|
+
end
|
120
|
+
|
121
|
+
def rpc_button_delete(session, data)
|
122
|
+
if (gid = data._payments.first).to_s.length > 0
|
123
|
+
if mov = Movements.match_by_global_id(gid)
|
124
|
+
log_msg 'cashbox_course', "Deleting movement #{mov.inspect}"
|
125
|
+
date, value = mov.date, mov.value
|
126
|
+
mov.delete
|
127
|
+
user, id = gid.match(/(.*)-(.*)/)[1..2]
|
128
|
+
ngid = [user, (id.to_i + 1).to_s].join("-")
|
129
|
+
# If the next movement starts with "old_cash" and has same date
|
130
|
+
# and value, we suppose they go together
|
131
|
+
if mov = Movements.match_by_global_id(ngid) and
|
132
|
+
mov.desc =~ /^old_cash/ and mov.date == date and
|
133
|
+
mov.value == value
|
134
|
+
log_msg 'cashbox_course', "Found old_cash at #{mov.inspect}"
|
135
|
+
mov.delete
|
136
|
+
end
|
137
|
+
rpc_list_choice_students(session, data)
|
138
|
+
end
|
139
|
+
end
|
140
|
+
end
|
141
|
+
end
|
@@ -0,0 +1,79 @@
|
|
1
|
+
=begin
|
2
|
+
This module allows for charging the internet-credit of a person. You can also
|
3
|
+
add a new person
|
4
|
+
=end
|
5
|
+
|
6
|
+
class CashboxCredit < View
|
7
|
+
def layout
|
8
|
+
set_data_class :Persons
|
9
|
+
@order = 30
|
10
|
+
@update = true
|
11
|
+
@functions_need = [:internet, :internet_cyber]
|
12
|
+
|
13
|
+
gui_hbox do
|
14
|
+
gui_vbox :nogroup do
|
15
|
+
show_str :search
|
16
|
+
show_entity_person :person, :single, :login_name, :callback => true
|
17
|
+
show_button :search_person, :add_person
|
18
|
+
end
|
19
|
+
|
20
|
+
gui_vbox :nogroup do
|
21
|
+
show_int :credit_add
|
22
|
+
show_str_ro :login_name
|
23
|
+
show_str_ro :full_name
|
24
|
+
show_int_ro :internet_credit
|
25
|
+
show_button :add_credit
|
26
|
+
end
|
27
|
+
|
28
|
+
gui_window :win_add do
|
29
|
+
show_str :full_name
|
30
|
+
show_button :win_add_person, :close
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
def rpc_button_add_person(session, data)
|
37
|
+
reply(:window_show, :win_add) +
|
38
|
+
reply(:empty, :full_name)
|
39
|
+
end
|
40
|
+
|
41
|
+
def rpc_button_win_add_person(session, data)
|
42
|
+
ret = reply(:window_hide)
|
43
|
+
person = if data._full_name.to_s.length > 0
|
44
|
+
Persons.create(complete_name: data._full_name)
|
45
|
+
end
|
46
|
+
person.permissions = %w(default internet)
|
47
|
+
ret + (person ? rpc_button_search_person(session, search: person.login_name) : [])
|
48
|
+
end
|
49
|
+
|
50
|
+
def rpc_button_search_person(session, data)
|
51
|
+
return reply(:empty, :person) unless data._search.length > 2
|
52
|
+
results = Persons.search_in(data._search, 20)
|
53
|
+
reply(:empty_update, :person => results.collect { |r| r.to_list_id(session.owner) } +
|
54
|
+
[results.first.person_id])
|
55
|
+
end
|
56
|
+
|
57
|
+
def rpc_button_add_credit(session, data)
|
58
|
+
dputs(3) { "Adding credit #{data.inspect}" }
|
59
|
+
rep = []
|
60
|
+
if person = Persons.add_internet_credit(session, data)
|
61
|
+
rep = reply(:update, :credit_add => '') +
|
62
|
+
reply(:update, :internet_credit => person.internet_credit)
|
63
|
+
end
|
64
|
+
rep + rpc_update(session)
|
65
|
+
end
|
66
|
+
|
67
|
+
def rpc_update(session)
|
68
|
+
super(session) +
|
69
|
+
reply(:parent, reply(:focus, :search))
|
70
|
+
end
|
71
|
+
|
72
|
+
def rpc_list_choice_person(session, data)
|
73
|
+
dputs(2) { "Got data: #{data.inspect}" }
|
74
|
+
if data._person
|
75
|
+
reply(:empty_update, data._person) +
|
76
|
+
reply(:focus, :credit_add)
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
@@ -0,0 +1,115 @@
|
|
1
|
+
# Allows for adding cash to a specific course
|
2
|
+
|
3
|
+
class CashboxReport < View
|
4
|
+
include PrintButton
|
5
|
+
|
6
|
+
def layout
|
7
|
+
@order = 30
|
8
|
+
@update = true
|
9
|
+
@functions_need = [:cashbox]
|
10
|
+
|
11
|
+
gui_hbox do
|
12
|
+
gui_vbox :nogroup do
|
13
|
+
show_list_single :report_type, :callback => true, :maxheight => 160
|
14
|
+
show_date :report_start, :callback => :date
|
15
|
+
show_entity_course :course, :single, :name,
|
16
|
+
lambda{|c| c.entries}, :callback => true, :flexheight => 1
|
17
|
+
show_print :print
|
18
|
+
end
|
19
|
+
gui_vbox :nogroup do
|
20
|
+
show_table :report, :headings => [ :Date, :Desc, :Amount, :Sum ],
|
21
|
+
:widths => [ 100, 200, 75, 75 ], :height => 400, :width => 470,
|
22
|
+
:columns => [0, 0, :align_right, :align_right]
|
23
|
+
show_button :delete
|
24
|
+
end
|
25
|
+
|
26
|
+
gui_window :print_status do
|
27
|
+
gui_vbox :nogroup do
|
28
|
+
show_html :status
|
29
|
+
show_button :close
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
def rpc_show( session )
|
36
|
+
super( session )
|
37
|
+
end
|
38
|
+
|
39
|
+
def rpc_update( session )
|
40
|
+
super( session ) +
|
41
|
+
reply( :empty_nonlists, [ :course, :report_type ] ) +
|
42
|
+
reply( :update, :report_type =>
|
43
|
+
%w( Course Due_Daily Due_All Paid_All ).
|
44
|
+
map.with_index{|d,i|
|
45
|
+
[ i + 1, d ]} ) +
|
46
|
+
reply( :update, :course => Courses.list_courses_entries(session) ) +
|
47
|
+
reply( :hide, [:report_start, :course ] ) +
|
48
|
+
reply( :update, :report_start => Date.today.strftime( "%d.%m.%Y") ) +
|
49
|
+
reply_visible( session.owner.has_permission?( :accounting ), :delete ) +
|
50
|
+
reply_print( session )
|
51
|
+
end
|
52
|
+
|
53
|
+
def rpc_button_print( session, data )
|
54
|
+
ret = rpc_print( session, :print, data )
|
55
|
+
if data._report_type == []
|
56
|
+
return ret
|
57
|
+
end
|
58
|
+
date = Date.parse( data._report_start )
|
59
|
+
|
60
|
+
if ( report = data._report_type.first ) > 1
|
61
|
+
file = session.owner.report_pdf(
|
62
|
+
[ :daily, :all, :all_paid ][report - 2], date )
|
63
|
+
else
|
64
|
+
file = data._course.report_pdf
|
65
|
+
end
|
66
|
+
|
67
|
+
if printer = send_printer( session, :print, file )
|
68
|
+
ret + reply( :window_show, :print_status ) +
|
69
|
+
reply( :update, :status => "Printed to #{printer}")
|
70
|
+
else
|
71
|
+
ret + reply( :window_show, :print_status ) +
|
72
|
+
reply( :update, :status => "<a href='#{file}' target='other'>#{file}</a>")
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
def rpc_list_choice_report_type( session, data )
|
77
|
+
dputs(3){"report is #{data._report_start.inspect}"}
|
78
|
+
date = Date.parse( data._report_start.to_s )
|
79
|
+
ret = reply( :empty, :report )
|
80
|
+
|
81
|
+
case report = data._report_type.first
|
82
|
+
when 1
|
83
|
+
if data._course != []
|
84
|
+
ret += reply( :update, :report => data._course.report_list )
|
85
|
+
end
|
86
|
+
show = :course
|
87
|
+
when 2..4
|
88
|
+
ret += reply( :update, :report =>
|
89
|
+
session.owner.report_list(
|
90
|
+
[ :daily, :all, :all_paid ][report - 2], date ) )
|
91
|
+
show = :report_start
|
92
|
+
end
|
93
|
+
|
94
|
+
ret + reply( :unhide, show ) +
|
95
|
+
reply( :hide, show == :report_start ? :course : :report_start )
|
96
|
+
end
|
97
|
+
|
98
|
+
def rpc_list_choice_course( session, data )
|
99
|
+
rpc_list_choice_report_type( session, data )
|
100
|
+
end
|
101
|
+
|
102
|
+
def rpc_callback_date( session, data )
|
103
|
+
rpc_list_choice_report_type( session, data )
|
104
|
+
end
|
105
|
+
|
106
|
+
def rpc_button_delete( session, data )
|
107
|
+
if ( gid = data._report.first ).to_s.length > 0
|
108
|
+
if mov = Movements.match_by_global_id( gid )
|
109
|
+
log_msg "cashbox_report", "Deleting movement #{mov.inspect}"
|
110
|
+
mov.delete
|
111
|
+
rpc_list_choice_report_type( session, data )
|
112
|
+
end
|
113
|
+
end
|
114
|
+
end
|
115
|
+
end
|
@@ -0,0 +1,105 @@
|
|
1
|
+
class CashboxService < View
|
2
|
+
def layout
|
3
|
+
set_data_class :Persons
|
4
|
+
@update = true
|
5
|
+
@order = 20
|
6
|
+
|
7
|
+
gui_hbox do
|
8
|
+
gui_vbox :nogroup do
|
9
|
+
gui_vbox :nogroup do
|
10
|
+
show_int :copies_intern, :callback => :calc
|
11
|
+
show_int :copies_extern, :callback => :calc
|
12
|
+
#show_int :heures_groupe_petit, :callback => :calc
|
13
|
+
show_int :heures_groupe_grand, :callback => :calc
|
14
|
+
show_int :CDs, :callback => :calc
|
15
|
+
end
|
16
|
+
gui_vbox :nogroup do
|
17
|
+
show_str :autres_text, :width => 200
|
18
|
+
show_int :autres_cfa, :callback => :calc
|
19
|
+
end
|
20
|
+
gui_vbox :nogroup do
|
21
|
+
show_int :services_total
|
22
|
+
end
|
23
|
+
show_date :date
|
24
|
+
show_button :add_cash
|
25
|
+
end
|
26
|
+
gui_vbox :nogroup do
|
27
|
+
gui_vbox :nogroup do
|
28
|
+
show_int_ro :account_total_due
|
29
|
+
end
|
30
|
+
gui_vbox :nogroup do
|
31
|
+
show_table :report, :headings => [:Date, :Desc, :Amount, :Sum],
|
32
|
+
:widths => [100, 300, 75, 75], :height => 400,
|
33
|
+
:columns => [0, 0, :align_right, :align_right]
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
def calc_total(values)
|
40
|
+
dputs(5) { "#{values.inspect}" }
|
41
|
+
services_total = 0
|
42
|
+
values.each { |k, v|
|
43
|
+
dputs(5) { "Searching for #{k}: #{v}" }
|
44
|
+
case k
|
45
|
+
when 'copies_intern'
|
46
|
+
services_total += v.to_i * 50
|
47
|
+
when 'copies_extern'
|
48
|
+
services_total += v.to_i * 100
|
49
|
+
when 'heures_groupe_grand'
|
50
|
+
services_total += v.to_f * 2500
|
51
|
+
when 'CDs'
|
52
|
+
services_total += v.to_i * 500
|
53
|
+
when 'autres_cfa'
|
54
|
+
services_total += v.to_i
|
55
|
+
end
|
56
|
+
}
|
57
|
+
services_total
|
58
|
+
end
|
59
|
+
|
60
|
+
def cash_msg(data)
|
61
|
+
'{' +
|
62
|
+
%w( copies_intern copies_extern heures_groupe_grand CDs autres_text ).select { |c|
|
63
|
+
data[c].to_s.length > 0
|
64
|
+
}.collect { |k|
|
65
|
+
"\"#{k}\"=>\"#{data[k]}\""
|
66
|
+
}.join(", ") +
|
67
|
+
'}'
|
68
|
+
end
|
69
|
+
|
70
|
+
# Adds the cash to the destination account, and puts the same amount into
|
71
|
+
# the AfriCompta-framework
|
72
|
+
def rpc_button_add_cash(session, data)
|
73
|
+
dputs(5) { "data is #{data.inspect}" }
|
74
|
+
services_total = calc_total(data)
|
75
|
+
dputs(5) { "which amounts to #{services_total} CFA" }
|
76
|
+
actor = session.owner
|
77
|
+
data.delete('services_total')
|
78
|
+
data.delete('account_total_due')
|
79
|
+
actor.pay_service(services_total, cash_msg(data),
|
80
|
+
data._date)
|
81
|
+
reply(:empty_nonlists) + rpc_update(session)
|
82
|
+
end
|
83
|
+
|
84
|
+
def rpc_update(session)
|
85
|
+
dputs(3) { 'Fetching total' }
|
86
|
+
ret = reply(:update, :account_total_due => session.owner.account_total_due)
|
87
|
+
dputs(3) { 'Updating time' }
|
88
|
+
ret += reply(:update, :date => Date.today.strftime('%d.%m.%Y'))
|
89
|
+
dputs(3) { 'Getting report_list' }
|
90
|
+
ret += reply(:update, :report => session.owner.report_list(:all))
|
91
|
+
dputs(3) { 'Done' }
|
92
|
+
ret
|
93
|
+
end
|
94
|
+
|
95
|
+
def rpc_update_with_values(session, values = nil)
|
96
|
+
dputs(3) { "Got values: #{values.inspect}" }
|
97
|
+
reply(:update, :services_total => calc_total(values))
|
98
|
+
end
|
99
|
+
|
100
|
+
def rpc_callback(session, name, data)
|
101
|
+
rpc_update_with_values(session, data)
|
102
|
+
end
|
103
|
+
|
104
|
+
end
|
105
|
+
|
@@ -0,0 +1,36 @@
|
|
1
|
+
class ComptaDefaults < View
|
2
|
+
def layout
|
3
|
+
@order = 300
|
4
|
+
@update = true
|
5
|
+
set_data_class(:ConfigBases)
|
6
|
+
@functions_need = [:accounting]
|
7
|
+
|
8
|
+
gui_vbox do
|
9
|
+
gui_hboxg :nogroup do
|
10
|
+
show_block :accounts
|
11
|
+
show_arg :account_cash, :width => 400
|
12
|
+
end
|
13
|
+
show_button :save
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def rpc_update(session)
|
18
|
+
accounts_current = []
|
19
|
+
AccountRoot.current.get_tree_depth { |a|
|
20
|
+
accounts_current.push [a.id, a.get_path]
|
21
|
+
}
|
22
|
+
reply(:empty_nonlists) +
|
23
|
+
reply(:update, ConfigBases.get_block_fields(:accounts).collect { |acc|
|
24
|
+
[acc, accounts_current]
|
25
|
+
}.to_h) +
|
26
|
+
update_form_data(ConfigBases.singleton)
|
27
|
+
|
28
|
+
end
|
29
|
+
|
30
|
+
def rpc_button_save(session, data)
|
31
|
+
ConfigBase.store(data.to_sym)
|
32
|
+
dputs(3) { "Configuration is now #{ConfigBase.get_functions.inspect}" }
|
33
|
+
|
34
|
+
rpc_update(session)
|
35
|
+
end
|
36
|
+
end
|