parroquia 1.1.13 → 1.1.14

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 (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 +931 -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,313 @@
1
+ require 'fox16'
2
+ include Fox
3
+
4
+ class ActualizarBautismo < FXMainWindow
5
+ def initialize(app, registro)
6
+ super(app, 'Editando Registro', width: 1050, height: 600)
7
+ self.backColor = FXRGB(3, 187, 133)
8
+ @registro = registro
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
+ # EL input tomoo debe tener el valor del campo "tomo" del registro
29
+ @input_tomo = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 50, height: 20, x: 110, y: 100)
30
+ @input_tomo.text = registro[15]
31
+
32
+ @lbl_page = FXLabel.new(self, 'Pagina', opts: LAYOUT_EXPLICIT, width: 50, height: 20, x: 170, y: 100)
33
+ @lbl_page.backColor = FXRGB(3, 187, 133)
34
+ @input_page = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 50, height: 20, x: 230, y: 100)
35
+ @input_page.text = registro[16]
36
+ @lbl_number = FXLabel.new(self, 'Numero', opts: LAYOUT_EXPLICIT, width: 50, height: 20, x: 290,
37
+ y: 100)
38
+ @lbl_number.backColor = FXRGB(3, 187, 133)
39
+ @input_number = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 50, height: 20, x: 350,
40
+ y: 100)
41
+ @input_number.text = registro[17]
42
+
43
+ # section datos
44
+ @lbl_fecha = FXLabel.new(self, 'Fecha de bautismo (AAAA/MM/DD): ', opts: LAYOUT_EXPLICIT, width: 250,
45
+ height: 20, x: 10, y: 150)
46
+ @lbl_fecha.backColor = FXRGB(3, 187, 133)
47
+ @input_fecha = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 340,
48
+ y: 150)
49
+ @input_fecha.text = registro[2]
50
+ @lbl_sacramento = FXLabel.new(self, 'Sacramento: ', opts: LAYOUT_EXPLICIT, width: 150, height: 20,
51
+ x: 680, y: 150)
52
+ @lbl_sacramento.backColor = FXRGB(3, 187, 133)
53
+ @input_sacramento = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 850,
54
+ y: 150)
55
+ @input_sacramento.text = registro[1]
56
+ @input_sacramento.disable
57
+ @lbl_parroquia = FXLabel.new(self, 'Iglesia parroquial: ', opts: LAYOUT_EXPLICIT, width: 150, height: 20,
58
+ x: 10, y: 180)
59
+ @lbl_parroquia.backColor = FXRGB(3, 187, 133)
60
+ @input_parroquia = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 170,
61
+ y: 180)
62
+ @input_parroquia.text = registro[25]
63
+ @lbl_sector = FXLabel.new(self, 'Sector: ', opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 340,
64
+ y: 180)
65
+ @lbl_sector.backColor = FXRGB(3, 187, 133)
66
+ @input_sector = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 510,
67
+ y: 180)
68
+ @input_sector.text = registro[26]
69
+ @lbl_parroco = FXLabel.new(self, 'Parroco: ', opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 680,
70
+ y: 180)
71
+ @lbl_parroco.backColor = FXRGB(3, 187, 133)
72
+ @input_parroco = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 850,
73
+ y: 180)
74
+ @input_parroco.text = registro[27]
75
+ @lbl_ministro = FXLabel.new(self, 'Ministro: ', opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 10,
76
+ y: 210)
77
+ @lbl_ministro.backColor = FXRGB(3, 187, 133)
78
+ @input_ministro = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 170,
79
+ y: 210)
80
+ @input_ministro.text = registro[3]
81
+ @lbl_name = FXLabel.new(self, 'Nombres: ', opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 10,
82
+ y: 240)
83
+ @lbl_name.backColor = FXRGB(3, 187, 133)
84
+ @input_name = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 170,
85
+ y: 240)
86
+ @input_name.text = registro[19]
87
+ @lbl_apellidos = FXLabel.new(self, 'Apellidos: ', opts: LAYOUT_EXPLICIT, width: 150, height: 20,
88
+ x: 340, y: 240)
89
+ @lbl_apellidos.backColor = FXRGB(3, 187, 133)
90
+ @input_apellidos = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 510,
91
+ y: 240)
92
+ @input_apellidos.text = registro[20]
93
+ @lbl_cedula = FXLabel.new(self, 'Cédula: ', opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 10,
94
+ y: 270)
95
+ @lbl_cedula.backColor = FXRGB(3, 187, 133)
96
+ @input_cedula = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 170,
97
+ y: 270)
98
+ @input_cedula.text = registro[23]
99
+ @lbl_lugar_nacimiento = FXLabel.new(self, 'Lugar de nacimiento: ', opts: LAYOUT_EXPLICIT, width: 150,
100
+ height: 20, x: 10, y: 300)
101
+ @lbl_lugar_nacimiento.backColor = FXRGB(3, 187, 133)
102
+ @input_lugar_nacimiento = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20,
103
+ x: 170, y: 300)
104
+ @input_lugar_nacimiento.text = registro[21]
105
+ @lbl_fecha_nacimiento = FXLabel.new(self, 'Fecha de nacimiento (AAAA/MM/DD): ', opts: LAYOUT_EXPLICIT,
106
+ width: 250, height: 20, x: 340, y: 300)
107
+ @lbl_fecha_nacimiento.backColor = FXRGB(3, 187, 133)
108
+ @input_fecha_nacimiento = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20,
109
+ x: 590, y: 300)
110
+ @input_fecha_nacimiento.text = registro[22]
111
+ @lbl_padre = FXLabel.new(self, 'Padre: ', opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 10,
112
+ y: 330)
113
+ @lbl_padre.backColor = FXRGB(3, 187, 133)
114
+ @input_padre = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 170,
115
+ y: 330)
116
+ @input_padre.text = registro[9]
117
+ @lbl_madre = FXLabel.new(self, 'Madre: ', opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 340,
118
+ y: 330)
119
+ @lbl_madre.backColor = FXRGB(3, 187, 133)
120
+ @input_madre = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 510,
121
+ y: 330)
122
+ @input_madre.text = registro[10]
123
+ @lbl_padrino = FXLabel.new(self, 'Padrino: ', opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 10,
124
+ y: 360)
125
+ @lbl_padrino.backColor = FXRGB(3, 187, 133)
126
+ @input_padrino = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 170,
127
+ y: 360)
128
+ @input_padrino.text = registro[5]
129
+ @lbl_madrina = FXLabel.new(self, 'Madrina: ', opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 340,
130
+ y: 360)
131
+ @lbl_madrina.backColor = FXRGB(3, 187, 133)
132
+ @input_madrina = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 510,
133
+ y: 360)
134
+ @input_madrina.text = registro[6]
135
+ @lbl_certifica = FXLabel.new(self, 'Certifica: ', opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 10,
136
+ y: 390)
137
+ @lbl_certifica.backColor = FXRGB(3, 187, 133)
138
+ @input_certifica = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 170,
139
+ y: 390)
140
+ @input_certifica.text = registro[4]
141
+
142
+ # section registro civil
143
+ @lbl_reg_civ = FXLabel.new(self,
144
+ '------------------------------------ REGISTRO CIVIL ------------------------------------', opts: LAYOUT_EXPLICIT | JUSTIFY_CENTER_X, width: 1050, height: 20, x: 10, y: 420)
145
+ @lbl_reg_civ.backColor = FXRGB(3, 187, 133)
146
+ @lbl_provincia_rc = FXLabel.new(self, 'Provincia: ', opts: LAYOUT_EXPLICIT, width: 150, height: 20,
147
+ x: 10, y: 450)
148
+ @lbl_provincia_rc.backColor = FXRGB(3, 187, 133)
149
+ @input_provincia_rc = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 170,
150
+ y: 450)
151
+ @input_provincia_rc.text = registro[29]
152
+ @lbl_canton_rc = FXLabel.new(self, 'Cantón: ', opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 340,
153
+ y: 450)
154
+ @lbl_canton_rc.backColor = FXRGB(3, 187, 133)
155
+ @input_canton_rc = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 510,
156
+ y: 450)
157
+ @input_canton_rc.text = registro[30]
158
+ @lbl_parroquia_rc = FXLabel.new(self, 'Parroquia: ', opts: LAYOUT_EXPLICIT, width: 150, height: 20,
159
+ x: 680, y: 450)
160
+ @lbl_parroquia_rc.backColor = FXRGB(3, 187, 133)
161
+ @input_parroquia_rc = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 850,
162
+ y: 450)
163
+ @input_parroquia_rc.text = registro[31]
164
+ @lbl_anio_rc = FXLabel.new(self, 'Año: ', opts: LAYOUT_EXPLICIT, width: 50, height: 20, x: 50,
165
+ y: 480)
166
+ @lbl_anio_rc.backColor = FXRGB(3, 187, 133)
167
+ @input_anio_rc = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 50, height: 20, x: 110,
168
+ y: 480)
169
+ @input_anio_rc.text = registro[32]
170
+ @lbl_tomo_rc = FXLabel.new(self, 'Tomo: ', opts: LAYOUT_EXPLICIT, width: 50, height: 20, x: 170,
171
+ y: 480)
172
+ @lbl_tomo_rc.backColor = FXRGB(3, 187, 133)
173
+ @input_tomo_rc = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 50, height: 20, x: 230,
174
+ y: 480)
175
+ @input_tomo_rc.text = registro[33]
176
+ @lbl_pag_rc = FXLabel.new(self, 'Página: ', opts: LAYOUT_EXPLICIT, width: 50, height: 20, x: 290,
177
+ y: 480)
178
+ @lbl_pag_rc.backColor = FXRGB(3, 187, 133)
179
+ @input_pag_rc = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 50, height: 20, x: 350,
180
+ y: 480)
181
+ @input_pag_rc.text = registro[34]
182
+ @lbl_acta_rc = FXLabel.new(self, 'Acta: ', opts: LAYOUT_EXPLICIT, width: 50, height: 20, x: 410,
183
+ y: 480)
184
+ @lbl_acta_rc.backColor = FXRGB(3, 187, 133)
185
+ @input_acta_rc = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 50, height: 20, x: 470,
186
+ y: 480)
187
+ @input_acta_rc.text = registro[35]
188
+ @lbl_date_rc = FXLabel.new(self, 'Fecha (AAAA/MM/DD): ', opts: LAYOUT_EXPLICIT, width: 150, height: 20,
189
+ x: 10, y: 510)
190
+ @lbl_date_rc.backColor = FXRGB(3, 187, 133)
191
+ @input_date_rc = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 170,
192
+ y: 510)
193
+ @input_date_rc.text = registro[36]
194
+
195
+
196
+ # create buttons
197
+ @btnupdate = FXButton.new(self, 'Actualizar', opts: LAYOUT_EXPLICIT | BUTTON_NORMAL, width: 100, height: 30,
198
+ x: 790, y: 540)
199
+ @btncancel = FXButton.new(self, 'Cancelar', opts: LAYOUT_EXPLICIT | BUTTON_NORMAL, width: 100, height: 30,
200
+ x: 900, y: 540)
201
+
202
+ # connect buttons
203
+ @btnupdate.connect(SEL_COMMAND) do
204
+ tomo = @input_tomo.text
205
+ page = @input_page.text
206
+ number = @input_number.text
207
+ fecha = @input_fecha.text
208
+ sacramento = @input_sacramento.text
209
+ parroquia = @input_parroquia.text
210
+ sector = @input_sector.text
211
+ parroco = @input_parroco.text
212
+ ministro = @input_ministro.text
213
+ name = @input_name.text
214
+ apellidos = @input_apellidos.text
215
+ lugar_nacimiento = @input_lugar_nacimiento.text
216
+ fecha_nacimiento = @input_fecha_nacimiento.text
217
+ cedula = @input_cedula.text.empty? ? nil : @input_cedula.text
218
+ padrino = @input_padrino.text.empty? ? nil : @input_padrino.text
219
+ madrina = @input_madrina.text.empty? ? nil : @input_madrina.text
220
+ padre = @input_padre.text.empty? ? nil : @input_padre.text
221
+ madre = @input_madre.text.empty? ? nil : @input_madre.text
222
+ certifica = @input_certifica.text
223
+ provincia_rc = @input_provincia_rc.text
224
+ canton_rc = @input_canton_rc.text
225
+ parroquia_rc = @input_parroquia_rc.text
226
+ anio_rc = @input_anio_rc.text
227
+ tomo_rc = @input_tomo_rc.text
228
+ pag_rc = @input_pag_rc.text
229
+ acta_rc = @input_acta_rc.text
230
+ date_rc = @input_date_rc.text
231
+
232
+ # tables
233
+ # tabla libros (id, tomo, pagina, numero)
234
+ # tabla creyentes (id, nombres, apellidos, lugar_nacimiento, fecha_nacimiento, cedula)
235
+ # tabla parroquias (id, nombre, sector, parroco)
236
+ # 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)
237
+ # tabla registros_civiles (id, provincia_rc, canton_rc, parroquia_rc, anio_rc, tomo_rc, pagina_rc, acta_rc, fecha_rc)
238
+ # Iniciar una transacción
239
+ $conn.transaction do
240
+ $conn.exec('UPDATE libros SET tomo = $1, pagina = $2, numero = $3 WHERE id = $4',
241
+ [tomo, page, number, registro[14]])
242
+ $conn.exec(
243
+ 'UPDATE sacramentos SET fecha = $1, sacramento = $2, celebrante = $3, certifica = $4, padrino = $5, madrina = $6, padre = $7, madre = $8 WHERE id = $9', [
244
+ fecha, sacramento, ministro, certifica, padrino, madrina, padre, madre, registro[0]
245
+ ]
246
+ )
247
+ $conn.exec(
248
+ 'UPDATE creyentes SET nombres = $1, apellidos = $2, lugar_nacimiento = $3, fecha_nacimiento = $4, cedula = $5 WHERE id = $6', [
249
+ name, apellidos, lugar_nacimiento, fecha_nacimiento, cedula, registro[18]
250
+ ]
251
+ )
252
+ $conn.exec('UPDATE parroquias SET parroquia = $1, sector = $2, parroco = $3 WHERE id = $4',
253
+ [parroquia, sector, parroco, registro[24]])
254
+ $conn.exec(
255
+ 'UPDATE registros_civiles SET provincia_rc = $1, canton_rc = $2, parroquia_rc = $3, anio_rc = $4, tomo_rc = $5, pagina_rc = $6, acta_rc = $7, fecha_rc = $8 WHERE id = $9', [
256
+ provincia_rc, canton_rc, parroquia_rc, anio_rc, tomo_rc, pag_rc, acta_rc, date_rc, registro[28]
257
+ ]
258
+ )
259
+
260
+ # ¿Desea guardar los cambios? SI: commit msg: datos actualizados correctamente, NO: rollback, close
261
+ if FXMessageBox.question(self, MBOX_YES_NO, 'Pregunta', '¿Desea guardar los cambios?') == MBOX_CLICKED_YES
262
+ # Confirmar la transacción
263
+ $conn.exec('COMMIT')
264
+ FXMessageBox.information(self, MBOX_OK, 'Información', 'Datos actualizados correctamente')
265
+ else
266
+ $conn.exec('ROLLBACK')
267
+ end
268
+ close
269
+ end
270
+ end
271
+
272
+ @btncancel.connect(SEL_COMMAND) do
273
+ FXMessageBox.warning(self, MBOX_OK, 'Advertencia', 'No se guardarán los cambios')
274
+ close
275
+ end
276
+ end
277
+
278
+ # Nombre del mes
279
+ def nombre_mes(mes)
280
+ meses = {
281
+ '01' => 'enero',
282
+ '02' => 'febrero',
283
+ '03' => 'marzo',
284
+ '04' => 'abril',
285
+ '05' => 'mayo',
286
+ '06' => 'junio',
287
+ '07' => 'julio',
288
+ '08' => 'agosto',
289
+ '09' => 'septiembre',
290
+ '10' => 'octubre',
291
+ '11' => 'noviembre',
292
+ '12' => 'diciembre'
293
+ }
294
+ meses[mes]
295
+ end
296
+
297
+ # Cambiar el formato de la fecha de YYYY-MM-DD a DD de nombre_mes de YYYY
298
+ def cambiar_formato_fecha(fecha)
299
+ # split "-" or "/"
300
+ fecha = fecha.split(%r{-|/})
301
+ # si el formato de fecha es YYYY-MM-DD o YYYY/MM/DD, sino si es DD-MM-YYYY o DD/MM/YYYY
302
+ if fecha[0].length == 4
303
+ "#{fecha[2]} de #{nombre_mes(fecha[1])} de #{fecha[0]}"
304
+ else
305
+ "#{fecha[0]} de #{nombre_mes(fecha[1])} de #{fecha[2]}"
306
+ end
307
+ end
308
+
309
+ def create
310
+ super
311
+ show(PLACEMENT_SCREEN)
312
+ end
313
+ end
@@ -0,0 +1,184 @@
1
+ require 'fox16'
2
+ include Fox
3
+
4
+ class ActualizarPreBautismoal < FXMainWindow
5
+ def initialize(app, registro)
6
+ super(app, 'Editando Registro', width: 1050, height: 600)
7
+ self.backColor = FXRGB(3, 187, 133)
8
+ @registro = registro
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
+ # section datos
27
+ @lbl_fecha = FXLabel.new(self, 'Fecha de bautismo (AAAA/MM/DD): ', opts: LAYOUT_EXPLICIT, width: 250,
28
+ height: 20, x: 10, y: 150)
29
+ @lbl_fecha.backColor = FXRGB(3, 187, 133)
30
+ @input_fecha = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 340,
31
+ y: 150)
32
+ @input_fecha.text = registro[2]
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 = registro[1]
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
+ @input_parroquia.text = registro[25]
46
+ @lbl_sector = FXLabel.new(self, 'Sector: ', opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 340,
47
+ y: 180)
48
+ @lbl_sector.backColor = FXRGB(3, 187, 133)
49
+ @input_sector = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 510,
50
+ y: 180)
51
+ @input_sector.text = registro[26]
52
+ @lbl_parroco = FXLabel.new(self, 'Parroco: ', opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 680,
53
+ y: 180)
54
+ @lbl_parroco.backColor = FXRGB(3, 187, 133)
55
+ @input_parroco = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 850,
56
+ y: 180)
57
+ @input_parroco.text = registro[27]
58
+ @lbl_name = FXLabel.new(self, 'Nombres: ', opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 10,
59
+ y: 240)
60
+ @lbl_name.backColor = FXRGB(3, 187, 133)
61
+ @input_name = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 170, y: 240)
62
+ @input_name.text = registro[19]
63
+ @lbl_apellidos = FXLabel.new(self, 'Apellidos: ', opts: LAYOUT_EXPLICIT, width: 150, height: 20,
64
+ x: 340, y: 240)
65
+ @lbl_apellidos.backColor = FXRGB(3, 187, 133)
66
+ @input_apellidos = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 510,
67
+ y: 240)
68
+ @input_apellidos.text = registro[20]
69
+ @lbl_cedula = FXLabel.new(self, 'Cédula: ', opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 10,
70
+ y: 270)
71
+ @lbl_cedula.backColor = FXRGB(3, 187, 133)
72
+ @input_cedula = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 170,
73
+ y: 270)
74
+ @input_cedula.text = registro[23]
75
+ @lbl_padrino = FXLabel.new(self, 'Padrino: ', opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 10,
76
+ y: 360)
77
+ @lbl_padrino.backColor = FXRGB(3, 187, 133)
78
+ @input_padrino = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 170,
79
+ y: 360)
80
+ @input_padrino.text = registro[5]
81
+ @lbl_madrina = FXLabel.new(self, 'Madrina: ', opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 340,
82
+ y: 360)
83
+ @lbl_madrina.backColor = FXRGB(3, 187, 133)
84
+ @input_madrina = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 510,
85
+ y: 360)
86
+ @input_madrina.text = registro[6]
87
+ @lbl_certifica = FXLabel.new(self, 'Certifica: ', opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 10,
88
+ y: 390)
89
+ @lbl_certifica.backColor = FXRGB(3, 187, 133)
90
+ @input_certifica = FXTextField.new(self, 10, opts: LAYOUT_EXPLICIT, width: 150, height: 20, x: 170,
91
+ y: 390)
92
+ @input_certifica.text = registro[4]
93
+
94
+
95
+ # create buttons
96
+ @btnupdate = FXButton.new(self, 'Actualizar', opts: LAYOUT_EXPLICIT | BUTTON_NORMAL, width: 100, height: 30,
97
+ x: 790, y: 540)
98
+ @btncancel = FXButton.new(self, 'Cancelar', opts: LAYOUT_EXPLICIT | BUTTON_NORMAL, width: 100, height: 30,
99
+ x: 900, y: 540)
100
+
101
+ # connect buttons
102
+ @btnupdate.connect(SEL_COMMAND) do
103
+ fecha = @input_fecha.text
104
+ sacramento = @input_sacramento.text
105
+ parroquia = @input_parroquia.text
106
+ sector = @input_sector.text
107
+ parroco = @input_parroco.text
108
+ name = @input_name.text
109
+ apellidos = @input_apellidos.text
110
+ cedula = @input_cedula.text.empty? ? nil : @input_cedula.text
111
+ padrino = @input_padrino.text.empty? ? nil : @input_padrino.text
112
+ madrina = @input_madrina.text.empty? ? nil : @input_madrina.text
113
+
114
+ # tables
115
+ # tabla libros (id, tomo, pagina, numero)
116
+ # tabla creyentes (id, nombres, apellidos, lugar_nacimiento, fecha_nacimiento, cedula)
117
+ # tabla parroquias (id, nombre, sector, parroco)
118
+ # 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)
119
+ # tabla registros_civiles (id, provincia_rc, canton_rc, parroquia_rc, anio_rc, tomo_rc, pagina_rc, acta_rc, fecha_rc)
120
+ # Iniciar una transacción
121
+ $conn.transaction do
122
+ $conn.exec(
123
+ 'UPDATE sacramentos SET fecha = $1, sacramento = $2, certifica = $3, padrino = $4, madrina = $5 WHERE id = $9', [fecha,
124
+ sacramento, certifica, padrino, madrina, registro[0]]
125
+ )
126
+ $conn.exec('UPDATE creyentes SET nombres = $1, apellidos = $2, cedula = $3 WHERE id = $6',
127
+ [name, apellidos, cedula, registro[18]])
128
+ $conn.exec('UPDATE parroquias SET parroquia = $1, sector = $2, parroco = $3 WHERE id = $4',
129
+ [parroquia, sector, parroco, registro[24]])
130
+
131
+ # ¿Desea guardar los cambios? SI: commit msg: datos actualizados correctamente, NO: rollback, close
132
+ if FXMessageBox.question(self, MBOX_YES_NO, 'Pregunta', '¿Desea guardar los cambios?') == MBOX_CLICKED_YES
133
+ # Confirmar la transacción
134
+ $conn.exec('COMMIT')
135
+ FXMessageBox.information(self, MBOX_OK, 'Información', 'Datos actualizados correctamente')
136
+ else
137
+ $conn.exec('ROLLBACK')
138
+ end
139
+ close
140
+ end
141
+ end
142
+
143
+ @btncancel.connect(SEL_COMMAND) do
144
+ FXMessageBox.warning(self, MBOX_OK, 'Advertencia', 'No se guardarán los cambios')
145
+ close
146
+ end
147
+ end
148
+
149
+ # Nombre del mes
150
+ def nombre_mes(mes)
151
+ meses = {
152
+ '01' => 'enero',
153
+ '02' => 'febrero',
154
+ '03' => 'marzo',
155
+ '04' => 'abril',
156
+ '05' => 'mayo',
157
+ '06' => 'junio',
158
+ '07' => 'julio',
159
+ '08' => 'agosto',
160
+ '09' => 'septiembre',
161
+ '10' => 'octubre',
162
+ '11' => 'noviembre',
163
+ '12' => 'diciembre'
164
+ }
165
+ meses[mes]
166
+ end
167
+
168
+ # Cambiar el formato de la fecha de YYYY-MM-DD a DD de nombre_mes de YYYY
169
+ def cambiar_formato_fecha(fecha)
170
+ # split "-" or "/"
171
+ fecha = fecha.split(%r{-|/})
172
+ # si el formato de fecha es YYYY-MM-DD o YYYY/MM/DD, sino si es DD-MM-YYYY o DD/MM/YYYY
173
+ if fecha[0].length == 4
174
+ "#{fecha[2]} de #{nombre_mes(fecha[1])} de #{fecha[0]}"
175
+ else
176
+ "#{fecha[0]} de #{nombre_mes(fecha[1])} de #{fecha[2]}"
177
+ end
178
+ end
179
+
180
+ def create
181
+ super
182
+ show(PLACEMENT_SCREEN)
183
+ end
184
+ end