parroquia 1.1.13 → 1.1.15

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. checksums.yaml +4 -4
  2. data/lib/parroquia/catecismo/actualizar_alumno.rb +181 -0
  3. data/lib/parroquia/catecismo/alumno.rb +179 -0
  4. data/lib/parroquia/catecismo/catecismo.rb +119 -0
  5. data/lib/parroquia/catecismo/consulta.rb +177 -0
  6. data/lib/parroquia/catecismo/resultado.rb +230 -0
  7. data/lib/parroquia/main.rb +82 -91
  8. data/lib/parroquia/sacramentos/actualizar_bautismo.rb +313 -0
  9. data/lib/parroquia/sacramentos/actualizar_certificado_prebautismal.rb +184 -0
  10. data/lib/parroquia/sacramentos/actualizar_comunion.rb +239 -0
  11. data/lib/parroquia/sacramentos/actualizar_confirmacion.rb +239 -0
  12. data/lib/parroquia/sacramentos/actualizar_matrimonio.rb +298 -0
  13. data/lib/parroquia/sacramentos/actualizar_misa.rb +170 -0
  14. data/lib/parroquia/sacramentos/actualizar_permiso_prebautismal.rb +200 -0
  15. data/lib/parroquia/sacramentos/actualizar_permiso_prematrimonial.rb +205 -0
  16. data/lib/parroquia/sacramentos/actualizar_supletoria.rb +313 -0
  17. data/lib/parroquia/sacramentos/bautizo.rb +310 -0
  18. data/lib/parroquia/sacramentos/certificado_prebautismal.rb +195 -0
  19. data/lib/parroquia/sacramentos/comunion.rb +234 -0
  20. data/lib/parroquia/sacramentos/confirmacion.rb +239 -0
  21. data/lib/parroquia/sacramentos/consultas.rb +162 -0
  22. data/lib/parroquia/sacramentos/matrimonio.rb +297 -0
  23. data/lib/parroquia/sacramentos/misa.rb +171 -0
  24. data/lib/parroquia/sacramentos/permiso_bautismo.rb +207 -0
  25. data/lib/parroquia/sacramentos/permiso_prematrimonial.rb +219 -0
  26. data/lib/parroquia/sacramentos/resultados.rb +922 -0
  27. data/lib/parroquia/sacramentos/sacramentos.rb +182 -0
  28. data/lib/parroquia/sacramentos/supletoria.rb +309 -0
  29. metadata +30 -11
  30. data/lib/parroquia/actualizar_bautismo.rb +0 -245
  31. data/lib/parroquia/actualizar_confirmacion.rb +0 -194
  32. data/lib/parroquia/actualizar_matrimonio.rb +0 -235
  33. data/lib/parroquia/bautizo.rb +0 -239
  34. data/lib/parroquia/confirmacion.rb +0 -191
  35. data/lib/parroquia/consultas.rb +0 -144
  36. data/lib/parroquia/matrimonio.rb +0 -232
  37. data/lib/parroquia/resultados.rb +0 -414
@@ -0,0 +1,310 @@
1
+ require 'fox16'
2
+ include Fox
3
+
4
+ class Bautizo < FXMainWindow
5
+ def initialize(app)
6
+ super(app, 'Parroquia San Judas Tadeo', width: 1050, height: 600)
7
+ self.backColor = FXRGB(3, 187, 133)
8
+ # create label
9
+ # Title
10
+ @lbltitle = FXLabel.new(self, 'Bienvenido a la Parroquia San Judas Tadeo',
11
+ opts: LAYOUT_EXPLICIT | JUSTIFY_CENTER_X, width: 1050, height: 20, x: 0, y: 20)
12
+ @lbltitle.font = FXFont.new(app, 'Geneva', 16, FONTWEIGHT_BOLD)
13
+ @lbltitle.backColor = FXRGB(3, 187, 133)
14
+ # Subtitle
15
+ @lblsubtitle = FXLabel.new(self, 'ARQUIDIOSESIS DE QUITO - SERVICIO PARROQUIAL DE SAN JUDAS TADEO',
16
+ opts: LAYOUT_EXPLICIT | JUSTIFY_CENTER_X, width: 1050, height: 20, x: 0, y: 40)
17
+ @lblsubtitle.font = FXFont.new(app, 'Geneva', 10, FONTWEIGHT_BOLD)
18
+ @lblsubtitle.backColor = FXRGB(3, 187, 133)
19
+ # Date
20
+ @date = Time.now.strftime('%d/%m/%Y')
21
+ @lbldate = FXLabel.new(self, "Fecha: #{cambiar_formato_fecha(@date)}", opts: LAYOUT_EXPLICIT | JUSTIFY_RIGHT,
22
+ width: 1050, height: 20, x: 0, y: 60, padRight: 20)
23
+ @lbldate.font = FXFont.new(app, 'Geneva', 12, FONTWEIGHT_BOLD)
24
+ @lbldate.backColor = FXRGB(3, 187, 133)
25
+ # section libros
26
+ @lbl_tomo = FXLabel.new(self, 'Tomo', opts: LAYOUT_EXPLICIT, width: 50, height: 20, x: 50, y: 100)
27
+ @lbl_tomo.backColor = FXRGB(3, 187, 133)
28
+ @input_tomo = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 50, height: 20, x: 110, y: 100)
29
+ @lbl_page = FXLabel.new(self, 'Pagina', opts: LAYOUT_EXPLICIT, width: 50, height: 20, x: 170, y: 100)
30
+ @lbl_page.backColor = FXRGB(3, 187, 133)
31
+ @input_page = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 50, height: 20, x: 230, y: 100)
32
+ @lbl_number = FXLabel.new(self, 'Numero', opts: LAYOUT_EXPLICIT, width: 50, height: 20, x: 290,
33
+ y: 100)
34
+ @lbl_number.backColor = FXRGB(3, 187, 133)
35
+ @input_number = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 50, height: 20, x: 350,
36
+ y: 100)
37
+
38
+ # section datos
39
+ @lbl_fecha = FXLabel.new(self, 'Fecha de bautismo (AAAA/MM/DD): ', opts: LAYOUT_EXPLICIT, width: 250,
40
+ height: 20, x: 10, y: 150)
41
+ @lbl_fecha.backColor = FXRGB(3, 187, 133)
42
+ @input_fecha = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 340,
43
+ y: 150)
44
+ @lbl_sacramento = FXLabel.new(self, 'Sacramento: ', opts: LAYOUT_EXPLICIT, width: 150, height: 20,
45
+ x: 680, y: 150)
46
+ @lbl_sacramento.backColor = FXRGB(3, 187, 133)
47
+ @input_sacramento = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 850,
48
+ y: 150)
49
+ @input_sacramento.text = 'Bautismo'
50
+ @input_sacramento.disable
51
+ @lbl_parroquia = FXLabel.new(self, 'Iglesia parroquial: ', opts: LAYOUT_EXPLICIT, width: 150, height: 20,
52
+ x: 10, y: 180)
53
+ @lbl_parroquia.backColor = FXRGB(3, 187, 133)
54
+ @input_parroquia = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 170,
55
+ y: 180)
56
+ @input_parroquia.text = 'San Judas Tadeo'
57
+ @input_parroquia.disable
58
+ @lbl_sector = FXLabel.new(self, 'Sector: ', opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 340,
59
+ y: 180)
60
+ @lbl_sector.backColor = FXRGB(3, 187, 133)
61
+ @input_sector = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 510,
62
+ y: 180)
63
+ @input_sector.text = 'Jaime Roldós'
64
+ @input_sector.disable
65
+ @lbl_parroco = FXLabel.new(self, 'Parroco: ', opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 680,
66
+ y: 180)
67
+ @lbl_parroco.backColor = FXRGB(3, 187, 133)
68
+ @input_parroco = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 850,
69
+ y: 180)
70
+ @lbl_ministro = FXLabel.new(self, 'Ministro: ', opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 10,
71
+ y: 210)
72
+ @lbl_ministro.backColor = FXRGB(3, 187, 133)
73
+ @input_ministro = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 170,
74
+ y: 210)
75
+ @lbl_name = FXLabel.new(self, 'Nombres: ', opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 10,
76
+ y: 240)
77
+ @lbl_name.backColor = FXRGB(3, 187, 133)
78
+ @input_name = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 170,
79
+ y: 240)
80
+ @lbl_apellidos = FXLabel.new(self, 'Apellidos: ', opts: LAYOUT_EXPLICIT, width: 150, height: 20,
81
+ x: 340, y: 240)
82
+ @lbl_apellidos.backColor = FXRGB(3, 187, 133)
83
+ @input_apellidos = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 510,
84
+ y: 240)
85
+ @lbl_cedula = FXLabel.new(self, 'Cédula: ', opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 10,
86
+ y: 270)
87
+ @lbl_cedula.backColor = FXRGB(3, 187, 133)
88
+ @input_cedula = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 170,
89
+ y: 270)
90
+ @lbl_lugar_nacimiento = FXLabel.new(self, 'Lugar de nacimiento: ', opts: LAYOUT_EXPLICIT, width: 150,
91
+ height: 20, x: 10, y: 300)
92
+ @lbl_lugar_nacimiento.backColor = FXRGB(3, 187, 133)
93
+ @input_lugar_nacimiento = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20,
94
+ x: 170, y: 300)
95
+ @lbl_fecha_nacimiento = FXLabel.new(self, 'Fecha de nacimiento (AAAA/MM/DD): ', opts: LAYOUT_EXPLICIT,
96
+ width: 250, height: 20, x: 340, y: 300)
97
+ @lbl_fecha_nacimiento.backColor = FXRGB(3, 187, 133)
98
+ @input_fecha_nacimiento = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20,
99
+ x: 590, y: 300)
100
+ @lbl_padre = FXLabel.new(self, 'Padre: ', opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 10,
101
+ y: 330)
102
+ @lbl_padre.backColor = FXRGB(3, 187, 133)
103
+ @input_padre = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 170,
104
+ y: 330)
105
+ @lbl_madre = FXLabel.new(self, 'Madre: ', opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 340,
106
+ y: 330)
107
+ @lbl_madre.backColor = FXRGB(3, 187, 133)
108
+ @input_madre = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 510,
109
+ y: 330)
110
+ @lbl_padrino = FXLabel.new(self, 'Padrino: ', opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 10,
111
+ y: 360)
112
+ @lbl_padrino.backColor = FXRGB(3, 187, 133)
113
+ @input_padrino = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 170,
114
+ y: 360)
115
+ @lbl_madrina = FXLabel.new(self, 'Madrina: ', opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 340,
116
+ y: 360)
117
+ @lbl_madrina.backColor = FXRGB(3, 187, 133)
118
+ @input_madrina = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 510,
119
+ y: 360)
120
+ @lbl_certifica = FXLabel.new(self, 'Certifica: ', opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 10,
121
+ y: 390)
122
+ @lbl_certifica.backColor = FXRGB(3, 187, 133)
123
+ @input_certifica = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 170,
124
+ y: 390)
125
+
126
+ # section registro civil
127
+ @lbl_reg_civ = FXLabel.new(self,
128
+ '------------------------------------ REGISTRO CIVIL ------------------------------------', opts: LAYOUT_EXPLICIT | JUSTIFY_CENTER_X, width: 1050, height: 20, x: 10, y: 420)
129
+ @lbl_reg_civ.backColor = FXRGB(3, 187, 133)
130
+ @lbl_provincia_rc = FXLabel.new(self, 'Provincia: ', opts: LAYOUT_EXPLICIT, width: 150, height: 20,
131
+ x: 10, y: 450)
132
+ @lbl_provincia_rc.backColor = FXRGB(3, 187, 133)
133
+ @input_provincia_rc = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 170,
134
+ y: 450)
135
+ @lbl_canton_rc = FXLabel.new(self, 'Cantón: ', opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 340,
136
+ y: 450)
137
+ @lbl_canton_rc.backColor = FXRGB(3, 187, 133)
138
+ @input_canton_rc = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 510,
139
+ y: 450)
140
+ @lbl_parroquia_rc = FXLabel.new(self, 'Parroquia: ', opts: LAYOUT_EXPLICIT, width: 150, height: 20,
141
+ x: 680, y: 450)
142
+ @lbl_parroquia_rc.backColor = FXRGB(3, 187, 133)
143
+ @input_parroquia_rc = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 850,
144
+ y: 450)
145
+ @lbl_anio_rc = FXLabel.new(self, 'Año: ', opts: LAYOUT_EXPLICIT, width: 50, height: 20, x: 50,
146
+ y: 480)
147
+ @lbl_anio_rc.backColor = FXRGB(3, 187, 133)
148
+ @input_anio_rc = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 50, height: 20, x: 110,
149
+ y: 480)
150
+ @lbl_tomo_rc = FXLabel.new(self, 'Tomo: ', opts: LAYOUT_EXPLICIT, width: 50, height: 20, x: 170,
151
+ y: 480)
152
+ @lbl_tomo_rc.backColor = FXRGB(3, 187, 133)
153
+ @input_tomo_rc = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 50, height: 20, x: 230,
154
+ y: 480)
155
+ @lbl_pag_rc = FXLabel.new(self, 'Página: ', opts: LAYOUT_EXPLICIT, width: 50, height: 20, x: 290,
156
+ y: 480)
157
+ @lbl_pag_rc.backColor = FXRGB(3, 187, 133)
158
+ @input_pag_rc = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 50, height: 20, x: 350,
159
+ y: 480)
160
+ @lbl_acta_rc = FXLabel.new(self, 'Acta: ', opts: LAYOUT_EXPLICIT, width: 50, height: 20, x: 410,
161
+ y: 480)
162
+ @lbl_acta_rc.backColor = FXRGB(3, 187, 133)
163
+ @input_acta_rc = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 50, height: 20, x: 470,
164
+ y: 480)
165
+ @lbl_date_rc = FXLabel.new(self, 'Fecha (AAAA/MM/DD): ', opts: LAYOUT_EXPLICIT, width: 150, height: 20,
166
+ x: 10, y: 510)
167
+ @lbl_date_rc.backColor = FXRGB(3, 187, 133)
168
+ @input_date_rc = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 170,
169
+ y: 510)
170
+
171
+
172
+ # create buttons
173
+ @btnsave = FXButton.new(self, 'Guardar', opts: LAYOUT_EXPLICIT | BUTTON_NORMAL, width: 100, height: 30,
174
+ x: 790, y: 540)
175
+ @btncancel = FXButton.new(self, 'Cancelar', opts: LAYOUT_EXPLICIT | BUTTON_NORMAL, width: 100, height: 30,
176
+ x: 900, y: 540)
177
+
178
+ # connect buttons
179
+ @btnsave.connect(SEL_COMMAND) do
180
+ tomo = @input_tomo.text
181
+ page = @input_page.text
182
+ number = @input_number.text
183
+ fecha = @input_fecha.text
184
+ sacramento = @input_sacramento.text
185
+ parroquia = @input_parroquia.text
186
+ sector = @input_sector.text
187
+ parroco = @input_parroco.text
188
+ ministro = @input_ministro.text
189
+ name = @input_name.text
190
+ apellidos = @input_apellidos.text
191
+ lugar_nacimiento = @input_lugar_nacimiento.text
192
+ fecha_nacimiento = @input_fecha_nacimiento.text
193
+ cedula = @input_cedula.text.empty? ? nil : @input_cedula.text
194
+ padrino = @input_padrino.text.empty? ? nil : @input_padrino.text
195
+ madrina = @input_madrina.text.empty? ? nil : @input_madrina.text
196
+ padre = @input_padre.text.empty? ? nil : @input_padre.text
197
+ madre = @input_madre.text.empty? ? nil : @input_madre.text
198
+ certifica = @input_certifica.text
199
+ provincia_rc = @input_provincia_rc.text
200
+ canton_rc = @input_canton_rc.text
201
+ parroquia_rc = @input_parroquia_rc.text
202
+ anio_rc = @input_anio_rc.text
203
+ tomo_rc = @input_tomo_rc.text
204
+ pag_rc = @input_pag_rc.text
205
+ acta_rc = @input_acta_rc.text
206
+ date_rc = @input_date_rc.text
207
+
208
+ # tables
209
+ # tabla libros (id, tomo, pagina, numero)
210
+ # tabla creyentes (id, nombres, apellidos, lugar_nacimiento, fecha_nacimiento, cedula)
211
+ # tabla parroquias (id, nombre, sector, parroco)
212
+ # tabla sacramentos (id, nombre, fecha, celebrante, certifica, padrino, madrina, testigo_novio, testigo_novia, padre, madre, nombres_novia, apellidos_novia, cedula_novia, fk_creyentes, fk_parroquias, fk_registros_civiles, fk_libros)
213
+ # tabla registros_civiles (id, provincia_rc, canton_rc, parroquia_rc, anio_rc, tomo_rc, pagina_rc, acta_rc, fecha_rc)
214
+ # Iniciar una transacción
215
+ $conn.transaction do
216
+ $conn.exec('INSERT INTO libros (tomo, pagina, numero) VALUES ($1, $2, $3)', [tomo, page, number])
217
+ $conn.exec(
218
+ 'INSERT INTO creyentes (nombres, apellidos, lugar_nacimiento, fecha_nacimiento, cedula) VALUES ($1, $2, $3, $4, $5)', [
219
+ name, apellidos, lugar_nacimiento, fecha_nacimiento, cedula
220
+ ]
221
+ )
222
+ $conn.exec('INSERT INTO parroquias (parroquia, sector, parroco) VALUES ($1, $2, $3)',
223
+ [parroquia, sector, parroco])
224
+ $conn.exec(
225
+ 'INSERT INTO registros_civiles (provincia_rc, canton_rc, parroquia_rc, anio_rc, tomo_rc, pagina_rc, acta_rc, fecha_rc) VALUES ($1, $2, $3, $4, $5, $6, $7, $8)', [
226
+ provincia_rc, canton_rc, parroquia_rc, anio_rc, tomo_rc, pag_rc, acta_rc, date_rc
227
+ ]
228
+ )
229
+ # Insertar en la tabla misas
230
+ @registro_misas = $conn.exec('INSERT INTO misas (intencion, fecha, hora) VALUES ($1, $2, $3)', [nil, nil, nil])
231
+ $conn.exec(
232
+ 'INSERT INTO sacramentos (sacramento, fecha, celebrante, certifica, padrino, madrina, padre, madre) VALUES ($1, $2, $3, $4, $5, $6, $7, $8)', [
233
+ sacramento, fecha, ministro, certifica, padrino, madrina, padre, madre
234
+ ]
235
+ )
236
+ # Confirmar la transacción
237
+ $conn.exec('COMMIT')
238
+ FXMessageBox.information(self, MBOX_OK, 'Información', 'Datos guardados correctamente')
239
+ clear_input_fields
240
+ end
241
+ end
242
+
243
+ @btncancel.connect(SEL_COMMAND) do
244
+ clear_input_fields
245
+ end
246
+
247
+ def clear_input_fields
248
+ @input_tomo.text = ''
249
+ @input_page.text = ''
250
+ @input_number.text = ''
251
+ @input_fecha.text = ''
252
+ @input_parroco.text = ''
253
+ @input_ministro.text = ''
254
+ @input_name.text = ''
255
+ @input_apellidos.text = ''
256
+ @input_lugar_nacimiento.text = ''
257
+ @input_fecha_nacimiento.text = ''
258
+ @input_cedula.text = ''
259
+ @input_padrino.text = ''
260
+ @input_madrina.text = ''
261
+ @input_padre.text = ''
262
+ @input_madre.text = ''
263
+ @input_certifica.text = ''
264
+ @input_provincia_rc.text = ''
265
+ @input_canton_rc.text = ''
266
+ @input_parroquia_rc.text = ''
267
+ @input_anio_rc.text = ''
268
+ @input_tomo_rc.text = ''
269
+ @input_pag_rc.text = ''
270
+ @input_acta_rc.text = ''
271
+ @input_date_rc.text = ''
272
+ end
273
+ end
274
+
275
+ # Nombre del mes
276
+ def nombre_mes(mes)
277
+ meses = {
278
+ '01' => 'enero',
279
+ '02' => 'febrero',
280
+ '03' => 'marzo',
281
+ '04' => 'abril',
282
+ '05' => 'mayo',
283
+ '06' => 'junio',
284
+ '07' => 'julio',
285
+ '08' => 'agosto',
286
+ '09' => 'septiembre',
287
+ '10' => 'octubre',
288
+ '11' => 'noviembre',
289
+ '12' => 'diciembre'
290
+ }
291
+ meses[mes]
292
+ end
293
+
294
+ # Cambiar el formato de la fecha de YYYY-MM-DD a DD de nombre_mes de YYYY
295
+ def cambiar_formato_fecha(fecha)
296
+ # split "-" or "/"
297
+ fecha = fecha.split(%r{-|/})
298
+ # si el formato de fecha es YYYY-MM-DD o YYYY/MM/DD, sino si es DD-MM-YYYY o DD/MM/YYYY
299
+ if fecha[0].length == 4
300
+ "#{fecha[2]} de #{nombre_mes(fecha[1])} de #{fecha[0]}"
301
+ else
302
+ "#{fecha[0]} de #{nombre_mes(fecha[1])} de #{fecha[2]}"
303
+ end
304
+ end
305
+
306
+ def create
307
+ super
308
+ show(PLACEMENT_SCREEN)
309
+ end
310
+ end
@@ -0,0 +1,195 @@
1
+ require 'fox16'
2
+ include Fox
3
+
4
+ class PreBautismal < FXMainWindow
5
+ def initialize(app)
6
+ super(app, 'Parroquia San Judas Tadeo', width: 1050, height: 600)
7
+ self.backColor = FXRGB(3, 187, 133)
8
+ # create label
9
+ # Title
10
+ @lbltitle = FXLabel.new(self, 'Bienvenido a la Parroquia San Judas Tadeo',
11
+ opts: LAYOUT_EXPLICIT | JUSTIFY_CENTER_X, width: 1050, height: 20, x: 0, y: 20)
12
+ @lbltitle.font = FXFont.new(app, 'Geneva', 16, FONTWEIGHT_BOLD)
13
+ @lbltitle.backColor = FXRGB(3, 187, 133)
14
+ # Subtitle
15
+ @lblsubtitle = FXLabel.new(self, 'ARQUIDIOSESIS DE QUITO - SERVICIO PARROQUIAL DE SAN JUDAS TADEO',
16
+ opts: LAYOUT_EXPLICIT | JUSTIFY_CENTER_X, width: 1050, height: 20, x: 0, y: 40)
17
+ @lblsubtitle.font = FXFont.new(app, 'Geneva', 10, FONTWEIGHT_BOLD)
18
+ @lblsubtitle.backColor = FXRGB(3, 187, 133)
19
+ # Date
20
+ @date = Time.now.strftime('%d/%m/%Y')
21
+ @lbldate = FXLabel.new(self, "Fecha: #{cambiar_formato_fecha(@date)}", opts: LAYOUT_EXPLICIT | JUSTIFY_RIGHT,
22
+ width: 1050, height: 20, x: 0, y: 60, padRight: 20)
23
+ @lbldate.font = FXFont.new(app, 'Geneva', 12, FONTWEIGHT_BOLD)
24
+ @lbldate.backColor = FXRGB(3, 187, 133)
25
+
26
+
27
+ # section datos
28
+ @lbl_fecha = FXLabel.new(self, 'Fecha de bautismo (AAAA/MM/DD): ', opts: LAYOUT_EXPLICIT, width: 250,
29
+ height: 20, x: 10, y: 150)
30
+ @lbl_fecha.backColor = FXRGB(3, 187, 133)
31
+ @input_fecha = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 340,
32
+ y: 150)
33
+ @lbl_sacramento = FXLabel.new(self, 'Sacramento: ', opts: LAYOUT_EXPLICIT, width: 150, height: 20,
34
+ x: 680, y: 150)
35
+ @lbl_sacramento.backColor = FXRGB(3, 187, 133)
36
+ @input_sacramento = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 850,
37
+ y: 150)
38
+ @input_sacramento.text = 'Curso Prebautismal'
39
+ @input_sacramento.disable
40
+ @lbl_parroquia = FXLabel.new(self, 'Iglesia parroquial: ', opts: LAYOUT_EXPLICIT, width: 150, height: 20,
41
+ x: 10, y: 180)
42
+ @lbl_parroquia.backColor = FXRGB(3, 187, 133)
43
+ @input_parroquia = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 170,
44
+ y: 180)
45
+ @lbl_sector = FXLabel.new(self, 'Sector: ', opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 340,
46
+ y: 180)
47
+ @lbl_sector.backColor = FXRGB(3, 187, 133)
48
+ @input_sector = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 510,
49
+ y: 180)
50
+ @lbl_parroco = FXLabel.new(self, 'Parroco: ', opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 680,
51
+ y: 180)
52
+ @lbl_parroco.backColor = FXRGB(3, 187, 133)
53
+ @input_parroco = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 850,
54
+ y: 180)
55
+ @lbl_name = FXLabel.new(self, 'Nombres: ', opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 10,
56
+ y: 240)
57
+ @lbl_name.backColor = FXRGB(3, 187, 133)
58
+ @input_name = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 170, y: 240)
59
+ @lbl_apellidos = FXLabel.new(self, 'Apellidos: ', opts: LAYOUT_EXPLICIT, width: 150, height: 20,
60
+ x: 340, y: 240)
61
+ @lbl_apellidos.backColor = FXRGB(3, 187, 133)
62
+ @input_apellidos = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 510,
63
+ y: 240)
64
+ @lbl_cedula = FXLabel.new(self, 'Cédula: ', opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 10,
65
+ y: 270)
66
+ @lbl_cedula.backColor = FXRGB(3, 187, 133)
67
+ @input_cedula = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 170,
68
+ y: 270)
69
+ @lbl_padrino = FXLabel.new(self, 'Padrino: ', opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 10,
70
+ y: 360)
71
+ @lbl_padrino.backColor = FXRGB(3, 187, 133)
72
+ @input_padrino = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 170,
73
+ y: 360)
74
+ @lbl_madrina = FXLabel.new(self, 'Madrina: ', opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 340,
75
+ y: 360)
76
+ @lbl_madrina.backColor = FXRGB(3, 187, 133)
77
+ @input_madrina = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 510,
78
+ y: 360)
79
+ @lbl_certifica = FXLabel.new(self, 'Certifica: ', opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 10,
80
+ y: 390)
81
+ @lbl_certifica.backColor = FXRGB(3, 187, 133)
82
+ @input_certifica = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 170,
83
+ y: 390)
84
+
85
+ # create buttons
86
+ @btnsave = FXButton.new(self, 'Guardar', opts: LAYOUT_EXPLICIT | BUTTON_NORMAL, width: 100, height: 30,
87
+ x: 790, y: 540)
88
+ @btncancel = FXButton.new(self, 'Cancelar', opts: LAYOUT_EXPLICIT | BUTTON_NORMAL, width: 100, height: 30,
89
+ x: 900, y: 540)
90
+
91
+ # connect buttons
92
+ @btnsave.connect(SEL_COMMAND) do
93
+ fecha = @input_fecha.text
94
+ sacramento = @input_sacramento.text
95
+ parroquia = @input_parroquia.text
96
+ sector = @input_sector.text
97
+ parroco = @input_parroco.text
98
+ name = @input_name.text
99
+ apellidos = @input_apellidos.text
100
+ cedula = @input_cedula.text.empty? ? nil : @input_cedula.text
101
+ padrino = @input_padrino.text.empty? ? nil : @input_padrino.text
102
+ madrina = @input_madrina.text.empty? ? nil : @input_madrina.text
103
+ certifica = @input_certifica.text
104
+
105
+ # tables
106
+ # tabla libros (id, tomo, pagina, numero)
107
+ # tabla creyentes (id, nombres, apellidos, lugar_nacimiento, fecha_nacimiento, cedula)
108
+ # tabla parroquias (id, nombre, sector, parroco)
109
+ # tabla sacramentos (id, nombre, fecha, celebrante, certifica, padrino, madrina, testigo_novio, testigo_novia, padre, madre, nombres_novia, apellidos_novia, cedula_novia, fk_creyentes, fk_parroquias, fk_registros_civiles, fk_libros)
110
+ # tabla registros_civiles (id, provincia_rc, canton_rc, parroquia_rc, anio_rc, tomo_rc, pagina_rc, acta_rc, fecha_rc)
111
+ # Iniciar una transacción
112
+ $conn.transaction do
113
+ $conn.exec('INSERT INTO libros (tomo, pagina, numero) VALUES ($1, $2, $3)', [nil, nil, nil])
114
+ $conn.exec(
115
+ 'INSERT INTO creyentes (nombres, apellidos, lugar_nacimiento, fecha_nacimiento, cedula) VALUES ($1, $2, $3, $4, $5)', [
116
+ name, apellidos, nil, nil, cedula
117
+ ]
118
+ )
119
+ $conn.exec('INSERT INTO parroquias (parroquia, sector, parroco) VALUES ($1, $2, $3)',
120
+ [parroquia, sector, parroco])
121
+ $conn.exec(
122
+ 'INSERT INTO registros_civiles (provincia_rc, canton_rc, parroquia_rc, anio_rc, tomo_rc, pagina_rc, acta_rc, fecha_rc) VALUES ($1, $2, $3, $4, $5, $6, $7, $8)', [
123
+ nil, nil, nil, nil, nil, nil, nil, nil
124
+ ]
125
+ )
126
+ # Insertar en la tabla misas
127
+ @registro_misas = $conn.exec('INSERT INTO misas (intencion, fecha, hora) VALUES ($1, $2, $3)', [nil, nil, nil])
128
+ $conn.exec(
129
+ 'INSERT INTO sacramentos (sacramento, fecha, celebrante, certifica, padrino, madrina, padre, madre) VALUES ($1, $2, $3, $4, $5, $6, $7, $8)', [
130
+ sacramento, fecha, nil, certifica, padrino, madrina, nil, nil
131
+ ]
132
+ )
133
+ # Confirmar la transacción
134
+ $conn.exec('COMMIT')
135
+ FXMessageBox.information(self, MBOX_OK, 'Información', 'Datos guardados correctamente')
136
+ clear_input_fields
137
+ end
138
+ end
139
+
140
+ @btncancel.connect(SEL_COMMAND) do
141
+ clear_input_fields
142
+ end
143
+
144
+ def clear_input_fields
145
+ @input_fecha.text = ''
146
+ @input_parroco.text = ''
147
+ @input_name.text = ''
148
+ @input_apellidos.text = ''
149
+ @input_lugar_nacimiento.text = ''
150
+ @input_fecha_nacimiento.text = ''
151
+ @input_cedula.text = ''
152
+ @input_padrino.text = ''
153
+ @input_madrina.text = ''
154
+ @input_padre.text = ''
155
+ @input_madre.text = ''
156
+ @input_certifica.text = ''
157
+ end
158
+ end
159
+
160
+ # Nombre del mes
161
+ def nombre_mes(mes)
162
+ meses = {
163
+ '01' => 'enero',
164
+ '02' => 'febrero',
165
+ '03' => 'marzo',
166
+ '04' => 'abril',
167
+ '05' => 'mayo',
168
+ '06' => 'junio',
169
+ '07' => 'julio',
170
+ '08' => 'agosto',
171
+ '09' => 'septiembre',
172
+ '10' => 'octubre',
173
+ '11' => 'noviembre',
174
+ '12' => 'diciembre'
175
+ }
176
+ meses[mes]
177
+ end
178
+
179
+ # Cambiar el formato de la fecha de YYYY-MM-DD a DD de nombre_mes de YYYY
180
+ def cambiar_formato_fecha(fecha)
181
+ # split "-" or "/"
182
+ fecha = fecha.split(%r{-|/})
183
+ # si el formato de fecha es YYYY-MM-DD o YYYY/MM/DD, sino si es DD-MM-YYYY o DD/MM/YYYY
184
+ if fecha[0].length == 4
185
+ "#{fecha[2]} de #{nombre_mes(fecha[1])} de #{fecha[0]}"
186
+ else
187
+ "#{fecha[0]} de #{nombre_mes(fecha[1])} de #{fecha[2]}"
188
+ end
189
+ end
190
+
191
+ def create
192
+ super
193
+ show(PLACEMENT_SCREEN)
194
+ end
195
+ end