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