parroquia 1.1.12 → 1.1.14

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