parroquia 1.1.13 → 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 -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
@@ -1,245 +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
- # tables
177
- # tabla libros (id, tomo, pagina, numero)
178
- # tabla creyentes (id, nombres, apellidos, lugar_nacimiento, fecha_nacimiento, cedula)
179
- # tabla parroquias (id, nombre, sector, parroco)
180
- # 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)
181
- # tabla registros_civiles (id, provincia_rc, canton_rc, parroquia_rc, anio_rc, tomo_rc, pagina_rc, acta_rc, fecha_rc)
182
- # Iniciar una transacción
183
- $conn.transaction do
184
- $conn.exec('UPDATE libros SET tomo = $1, pagina = $2, numero = $3 WHERE id = $4', [tomo, page, number, registro[14]])
185
- $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]])
186
- $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]])
187
- $conn.exec('UPDATE parroquias SET parroquia = $1, sector = $2, parroco = $3 WHERE id = $4', [parroquia, sector, parroco, registro[24]])
188
- $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]])
189
-
190
- # ¿Desea guardar los cambios? SI: commit msg: datos actualizados correctamente, NO: rollback, close
191
- if FXMessageBox.question(self, MBOX_YES_NO, "Pregunta", "¿Desea guardar los cambios?") == MBOX_CLICKED_YES
192
- # Confirmar la transacción
193
- $conn.exec("COMMIT")
194
- FXMessageBox.information(self, MBOX_OK, "Información", "Datos actualizados correctamente")
195
- close
196
- else
197
- $conn.exec("ROLLBACK")
198
- close
199
- end
200
- end
201
- end
202
-
203
- @btncancel.connect(SEL_COMMAND) do
204
- FXMessageBox.warning(self, MBOX_OK, "Advertencia", "No se guardarán los cambios")
205
- close
206
- end
207
- end
208
-
209
- # Nombre del mes
210
- def nombre_mes(mes)
211
- meses = {
212
- "01" => "enero",
213
- "02" => "febrero",
214
- "03" => "marzo",
215
- "04" => "abril",
216
- "05" => "mayo",
217
- "06" => "junio",
218
- "07" => "julio",
219
- "08" => "agosto",
220
- "09" => "septiembre",
221
- "10" => "octubre",
222
- "11" => "noviembre",
223
- "12" => "diciembre"
224
- }
225
- meses[mes]
226
- end
227
-
228
-
229
- # Cambiar el formato de la fecha de YYYY-MM-DD a DD de nombre_mes de YYYY
230
- def cambiar_formato_fecha(fecha)
231
- # split "-" or "/"
232
- fecha = fecha.split(/-|\//)
233
- # si el formato de fecha es YYYY-MM-DD o YYYY/MM/DD, sino si es DD-MM-YYYY o DD/MM/YYYY
234
- if fecha[0].length == 4
235
- "#{fecha[2]} de #{nombre_mes(fecha[1])} de #{fecha[0]}"
236
- else
237
- "#{fecha[0]} de #{nombre_mes(fecha[1])} de #{fecha[2]}"
238
- end
239
- end
240
-
241
- def create
242
- super
243
- show(PLACEMENT_SCREEN)
244
- end
245
- end
@@ -1,194 +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
- # tables
116
- # tabla libros (id, tomo, pagina, numero)
117
- # tabla creyentes (id, nombres, apellidos, lugar_nacimiento, fecha_nacimiento, cedula)
118
- # tabla parroquias (id, nombre, sector, parroco)
119
- # 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)
120
- # tabla registros_civiles (id, provincia_rc, canton_rc, parroquia_rc, anio_rc, tomo_rc, pagina_rc, acta_rc, fecha_rc)
121
- # Iniciar una transacción
122
- $conn.transaction do
123
- # Actualizar la tabla libros
124
- $conn.exec('UPDATE libros SET tomo = $1, pagina = $2, numero = $3 WHERE id = $4', [tomo, page, number, registro[14]])
125
-
126
- # Actualizar la tabla creyentes
127
- $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]])
128
-
129
- # Actualizar la tabla parroquias
130
- $conn.exec('UPDATE parroquias SET parroquia = $1, sector = $2, parroco = $3 WHERE id = $4', [parroquia, sector, parroco, registro[24]])
131
-
132
- # 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
133
- $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]])
134
-
135
- # Actualizar la tabla sacramentos
136
- $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]])
137
-
138
-
139
- # ¿Desea guardar los cambios? SI: commit msg: datos actualizados correctamente, NO: rollback, close
140
- if FXMessageBox.question(self, MBOX_YES_NO, "Pregunta", "¿Desea guardar los cambios?") == MBOX_CLICKED_YES
141
- # Confirmar la transacción
142
- $conn.exec("COMMIT")
143
- FXMessageBox.information(self, MBOX_OK, "Información", "Datos actualizados correctamente")
144
- close
145
- else
146
- $conn.exec("ROLLBACK")
147
- close
148
- end
149
- end
150
- end
151
-
152
- @btncancel.connect(SEL_COMMAND) do
153
- FXMessageBox.warning(self, MBOX_OK, "Advertencia", "No se guardarán los cambios")
154
- close
155
- end
156
- end
157
-
158
- # Nombre del mes
159
- def nombre_mes(mes)
160
- meses = {
161
- "01" => "enero",
162
- "02" => "febrero",
163
- "03" => "marzo",
164
- "04" => "abril",
165
- "05" => "mayo",
166
- "06" => "junio",
167
- "07" => "julio",
168
- "08" => "agosto",
169
- "09" => "septiembre",
170
- "10" => "octubre",
171
- "11" => "noviembre",
172
- "12" => "diciembre"
173
- }
174
- meses[mes]
175
- end
176
-
177
-
178
- # Cambiar el formato de la fecha de YYYY-MM-DD a DD de nombre_mes de YYYY
179
- def cambiar_formato_fecha(fecha)
180
- # split "-" or "/"
181
- fecha = fecha.split(/-|\//)
182
- # si el formato de fecha es YYYY-MM-DD o YYYY/MM/DD, sino si es DD-MM-YYYY o DD/MM/YYYY
183
- if fecha[0].length == 4
184
- "#{fecha[2]} de #{nombre_mes(fecha[1])} de #{fecha[0]}"
185
- else
186
- "#{fecha[0]} de #{nombre_mes(fecha[1])} de #{fecha[2]}"
187
- end
188
- end
189
-
190
- def create
191
- super
192
- show(PLACEMENT_SCREEN)
193
- end
194
- end