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