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