parroquia 1.1.13 → 1.1.15

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 +922 -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,191 +0,0 @@
1
- require 'pg'
2
- require 'fox16'
3
- include Fox
4
-
5
- class Confirmacion < FXMainWindow
6
- def initialize(app)
7
- @app = app
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
- @input_tomo = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 50, :height => 20, :x => 110, :y => 100)
27
- @lbl_page = FXLabel.new(self, "Pagina", :opts => LAYOUT_EXPLICIT, :width => 50, :height => 20, :x => 170, :y => 100)
28
- @lbl_page.backColor = FXRGB(3,187,133)
29
- @input_page = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 50, :height => 20, :x => 230, :y => 100)
30
- @lbl_number = FXLabel.new(self, "Numero", :opts => LAYOUT_EXPLICIT, :width => 50, :height => 20, :x => 290, :y => 100)
31
- @lbl_number.backColor = FXRGB(3,187,133)
32
- @input_number = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 50, :height => 20, :x => 350, :y => 100)
33
-
34
- #section datos
35
- @lbl_fecha = FXLabel.new(self, "Fecha de confirmación (AAAA/MM/DD): ", :opts => LAYOUT_EXPLICIT, :width => 250, :height => 20, :x => 10, :y => 150)
36
- @lbl_fecha.backColor = FXRGB(3,187,133)
37
- @input_fecha = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 150,:height => 20, :x => 340, :y => 150)
38
- @lbl_sacramento = FXLabel.new(self, "Sacramento: ", :opts => LAYOUT_EXPLICIT, :width => 150, :height => 20, :x => 680, :y => 150)
39
- @lbl_sacramento.backColor = FXRGB(3,187,133)
40
- @input_sacramento = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 150,:height => 20, :x => 850, :y => 150)
41
- @input_sacramento.text = "Confirmación"
42
- @input_sacramento.disable
43
- @lbl_parroquia = FXLabel.new(self, "Iglesia parroquial: ", :opts => LAYOUT_EXPLICIT, :width => 150, :height => 20, :x => 10, :y => 180)
44
- @lbl_parroquia.backColor = FXRGB(3,187,133)
45
- @input_parroquia = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 150,:height => 20, :x => 170, :y => 180)
46
- @input_parroquia.text = "San Judas Tadeo"
47
- @input_parroquia.disable
48
- @lbl_sector = FXLabel.new(self, "Sector: ", :opts => LAYOUT_EXPLICIT, :width => 150, :height => 20, :x => 340, :y => 180)
49
- @lbl_sector.backColor = FXRGB(3,187,133)
50
- @input_sector = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 150,:height => 20, :x => 510, :y => 180)
51
- @input_sector.text = "Jaime Roldós"
52
- @input_sector.disable
53
- @lbl_parroco = FXLabel.new(self, "Parroco: ", :opts => LAYOUT_EXPLICIT, :width => 150, :height => 20, :x => 680, :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, :y => 180)
56
- @lbl_celebrante = FXLabel.new(self, "Celebrante: ", :opts => LAYOUT_EXPLICIT, :width => 150, :height => 20, :x => 10, :y => 210)
57
- @lbl_celebrante.backColor = FXRGB(3,187,133)
58
- @input_celebrante = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 150,:height => 20, :x => 170, :y => 210)
59
- @lbl_name = FXLabel.new(self, "Nombres: ", :opts => LAYOUT_EXPLICIT, :width => 150, :height => 20, :x => 10, :y => 240)
60
- @lbl_name.backColor = FXRGB(3,187,133)
61
- @input_name = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 150,:height => 20, :x => 170, :y => 240)
62
- @lbl_apellidos = FXLabel.new(self, "Apellidos: ", :opts => LAYOUT_EXPLICIT, :width => 150, :height => 20, :x => 10, :y => 270)
63
- @lbl_apellidos.backColor = FXRGB(3,187,133)
64
- @input_apellidos = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 150,:height => 20, :x => 170, :y => 270)
65
- @lbl_lugar_nacimiento = FXLabel.new(self, "Lugar de nacimiento: ", :opts => LAYOUT_EXPLICIT, :width => 150, :height => 20, :x => 10, :y => 300)
66
- @lbl_lugar_nacimiento.backColor = FXRGB(3,187,133)
67
- @input_lugar_nacimiento = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 150,:height => 20, :x => 170, :y => 300)
68
- @lbl_fecha_nacimiento = FXLabel.new(self, "Fecha de nacimiento (AAAA/MM/DD): ", :opts => LAYOUT_EXPLICIT, :width => 250, :height => 20, :x => 340, :y => 300)
69
- @lbl_fecha_nacimiento.backColor = FXRGB(3,187,133)
70
- @input_fecha_nacimiento = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 150,:height => 20, :x => 590, :y => 300)
71
- @lbl_cedula = FXLabel.new(self, "Cédula: ", :opts => LAYOUT_EXPLICIT, :width => 80, :height => 20, :x => 750, :y => 300)
72
- @lbl_cedula.backColor = FXRGB(3,187,133)
73
- @input_cedula = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 150,:height => 20, :x =>850, :y => 300)
74
- @lbl_padrino = FXLabel.new(self, "Padrino: ", :opts => LAYOUT_EXPLICIT, :width => 150, :height => 20, :x => 10, :y => 330)
75
- @lbl_padrino.backColor = FXRGB(3,187,133)
76
- @input_padrino = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 150,:height => 20, :x => 170, :y => 330)
77
- @lbl_certifica = FXLabel.new(self, "Certifica: ", :opts => LAYOUT_EXPLICIT, :width => 150, :height => 20, :x => 10, :y => 360)
78
- @lbl_certifica.backColor = FXRGB(3,187,133)
79
- @input_certifica = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 150,:height => 20, :x => 170, :y => 360)
80
- # create buttons
81
- @btnsave = FXButton.new(self, "Guardar", :opts => LAYOUT_EXPLICIT|BUTTON_NORMAL, :width => 100, :height => 30, :x => 790, :y => 400)
82
- @btncancel = FXButton.new(self, "Cancelar", :opts => LAYOUT_EXPLICIT|BUTTON_NORMAL, :width => 100, :height => 30, :x => 900, :y => 400)
83
-
84
- # connect buttons
85
- @btnsave.connect(SEL_COMMAND) do
86
- tomo = @input_tomo.text
87
- page = @input_page.text
88
- number = @input_number.text
89
- fecha = @input_fecha.text
90
- sacramento = @input_sacramento.text
91
- parroquia = @input_parroquia.text
92
- sector = @input_sector.text
93
- parroco = @input_parroco.text
94
- celebrante = @input_celebrante.text
95
- name = @input_name.text
96
- apellidos = @input_apellidos.text
97
- lugar_nacimiento = @input_lugar_nacimiento.text
98
- fecha_nacimiento = @input_fecha_nacimiento.text
99
- cedula = @input_cedula.text.empty? ? nil : @input_cedula.text
100
- padrino = @input_padrino.text.empty? ? nil : @input_padrino.text
101
- certifica = @input_certifica.text
102
-
103
-
104
- # tables
105
- # tabla libros (id, tomo, pagina, numero)
106
- # tabla creyentes (id, nombres, apellidos, lugar_nacimiento, fecha_nacimiento, cedula)
107
- # tabla parroquias (id, nombre, sector, parroco)
108
- # 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)
109
- # tabla registros_civiles (id, provincia_rc, canton_rc, parroquia_rc, anio_rc, tomo_rc, pagina_rc, acta_rc, fecha_rc)
110
- # Iniciar una transacción
111
- $conn.transaction do
112
- # Insertar en la tabla libros
113
- @registro_libros = $conn.exec('INSERT INTO libros (tomo, pagina, numero) VALUES ($1, $2, $3)', [tomo, page, number])
114
-
115
- # Insertar en la tabla creyentes
116
- @registro_creyentes = $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])
117
-
118
- # Insertar en la tabla parroquias
119
- @registro_parroquias = $conn.exec('INSERT INTO parroquias (parroquia, sector, parroco) VALUES ($1, $2, $3)', [parroquia, sector, parroco])
120
-
121
- # Insertar en 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
122
- @registro_registros_civiles = $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)', [nil, nil, nil, nil, nil, nil, nil, nil])
123
-
124
- # Insertar en la tabla sacramentos
125
- @registro_sacramentos = $conn.exec('INSERT INTO sacramentos (sacramento, fecha, celebrante, certifica, padrino) VALUES ($1, $2, $3, $4, $5)', [sacramento, fecha, celebrante, certifica, padrino])
126
-
127
- # Confirmar la transacción
128
- $conn.exec("COMMIT")
129
- FXMessageBox.information(self, MBOX_OK, "Información", "Datos guardados correctamente")
130
- clear_input_fields
131
- end
132
- end
133
-
134
- @btncancel.connect(SEL_COMMAND) do
135
- clear_input_fields
136
- end
137
-
138
- def clear_input_fields
139
- @input_tomo.text = ""
140
- @input_page.text = ""
141
- @input_number.text = ""
142
- @input_fecha.text = ""
143
- @input_parroco.text = ""
144
- @input_celebrante.text = ""
145
- @input_name.text = ""
146
- @input_apellidos.text = ""
147
- @input_lugar_nacimiento.text = ""
148
- @input_fecha_nacimiento.text = ""
149
- @input_cedula.text = ""
150
- @input_padrino.text = ""
151
- @input_certifica.text = ""
152
- end
153
- end
154
-
155
- # Nombre del mes
156
- def nombre_mes(mes)
157
- meses = {
158
- "01" => "enero",
159
- "02" => "febrero",
160
- "03" => "marzo",
161
- "04" => "abril",
162
- "05" => "mayo",
163
- "06" => "junio",
164
- "07" => "julio",
165
- "08" => "agosto",
166
- "09" => "septiembre",
167
- "10" => "octubre",
168
- "11" => "noviembre",
169
- "12" => "diciembre"
170
- }
171
- meses[mes]
172
- end
173
-
174
-
175
- # Cambiar el formato de la fecha de YYYY-MM-DD a DD de nombre_mes de YYYY
176
- def cambiar_formato_fecha(fecha)
177
- # split "-" or "/"
178
- fecha = fecha.split(/-|\//)
179
- # si el formato de fecha es YYYY-MM-DD o YYYY/MM/DD, sino si es DD-MM-YYYY o DD/MM/YYYY
180
- if fecha[0].length == 4
181
- "#{fecha[2]} de #{nombre_mes(fecha[1])} de #{fecha[0]}"
182
- else
183
- "#{fecha[0]} de #{nombre_mes(fecha[1])} de #{fecha[2]}"
184
- end
185
- end
186
-
187
- def create
188
- super
189
- show(PLACEMENT_SCREEN)
190
- end
191
- end
@@ -1,144 +0,0 @@
1
- require 'pg'
2
- require 'fox16'
3
- include Fox
4
-
5
- class Consulta < FXMainWindow
6
- def initialize(app)
7
- super(app, "Parroquia San Judas Tadeo", :width => 700, :height => 380)
8
- @app = app
9
- self.backColor = FXRGB(3,187,133)
10
-
11
- # seccion encabezado
12
- # create label
13
- @lbltitle = FXLabel.new(self, "Bienvenido a la Parroquia San Judas Tadeo", :opts => LAYOUT_EXPLICIT | JUSTIFY_CENTER_X, :width => 700, :height => 20, :x => 0, :y => 20)
14
- @lbltitle.font = FXFont.new(app, "Geneva", 16, FONTWEIGHT_BOLD)
15
- @lbltitle.backColor = FXRGB(3,187,133)
16
- # create label
17
- @lblsubtitle = FXLabel.new(self, "ARQUIDIOSESIS DE QUITO - VICARIA NORTE SERVICIO PARROQUIAL DE SAN JUDAS TADEO", :opts => LAYOUT_EXPLICIT | JUSTIFY_CENTER_X, :width => 700, :height => 20, :x => 0, :y => 40)
18
- @lblsubtitle.font = FXFont.new(app, "Geneva", 10, FONTWEIGHT_BOLD)
19
- @lblsubtitle.backColor = FXRGB(3,187,133)
20
- # create label
21
- @date = Time.now.strftime("%d/%m/%Y")
22
- @lbldate = FXLabel.new(self, "Fecha: #{cambiar_formato_fecha(@date)} ", :opts => LAYOUT_EXPLICIT | JUSTIFY_RIGHT, :width => 680, :height => 20, :x => 0, :y => 60)
23
- @lbldate.font = FXFont.new(app, "Geneva", 12, FONTWEIGHT_BOLD)
24
- @lbldate.backColor = FXRGB(3,187,133)
25
- # seccioan consulta
26
- @lbl_consulta = FXLabel.new(self, "Consultar por: ", :opts => LAYOUT_EXPLICIT, :width => 150, :height => 20, :x => 10, :y => 150)
27
- @lbl_consulta.backColor = FXRGB(3,187,133)
28
- @lbl_apellidos = FXLabel.new(self, "Apellidos: ", :opts => LAYOUT_EXPLICIT, :width => 150, :height => 20, :x => 10, :y => 180)
29
- @lbl_apellidos.backColor = FXRGB(3,187,133)
30
- @input_apellidos = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 150, :height => 20, :x => 170, :y => 180)
31
- @lbl_nombres = FXLabel.new(self, "Nombres: ", :opts => LAYOUT_EXPLICIT, :width => 150, :height => 20, :x => 340, :y => 180)
32
- @lbl_nombres.backColor = FXRGB(3,187,133)
33
- @input_nombres = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 150, :height => 20, :x => 510, :y => 180)
34
- @lbl_cedula = FXLabel.new(self, "Cédula: ", :opts => LAYOUT_EXPLICIT, :width => 150, :height => 20, :x => 10, :y => 210)
35
- @lbl_cedula.backColor = FXRGB(3,187,133)
36
- @input_cedula = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 150, :height => 20, :x => 170, :y => 210)
37
- @lbl_fecha_desde = FXLabel.new(self, "Fecha desde (AAAA/MM/DD): ", :opts => LAYOUT_EXPLICIT, :width => 250, :height => 20, :x => 10, :y => 240)
38
- @lbl_fecha_desde.backColor = FXRGB(3,187,133)
39
- @input_fecha_desde = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 150, :height => 20, :x => 340, :y => 240)
40
- @lbl_fecha_hasta = FXLabel.new(self, "Fecha hasta (AAAA/MM/DD): ", :opts => LAYOUT_EXPLICIT, :width => 250, :height => 20, :x => 10, :y => 270)
41
- @lbl_fecha_hasta.backColor = FXRGB(3,187,133)
42
- @input_fecha_hasta = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 150, :height => 20, :x => 340, :y => 270)
43
- @lbl_sacramento = FXLabel.new(self, "Sacramento: ", :opts => LAYOUT_EXPLICIT, :width => 150, :height => 20, :x => 10, :y => 300)
44
- @lbl_sacramento.backColor = FXRGB(3,187,133)
45
- @input_sacramento = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 150, :height => 20, :x => 170, :y => 300)
46
-
47
- # create buttons
48
- @btnsearch = FXButton.new(self, "Buscar", :opts => LAYOUT_EXPLICIT | BUTTON_NORMAL, :width => 100, :height => 30, :x => 450, :y => 330)
49
- @btncancel = FXButton.new(self, "Cancelar", :opts => LAYOUT_EXPLICIT | BUTTON_NORMAL, :width => 100, :height => 30, :x => 560, :y => 330)
50
-
51
- # connect buttons
52
- @btnsearch.connect(SEL_COMMAND) do
53
- apellidos = @input_apellidos.text
54
- nombres = @input_nombres.text
55
- cedula = @input_cedula.text
56
- fecha_desde = @input_fecha_desde.text
57
- fecha_hasta = @input_fecha_hasta.text
58
- sacramento = @input_sacramento.text
59
-
60
- if apellidos.empty? && nombres.empty? && cedula.empty? && fecha_desde.empty? && fecha_hasta.empty? && sacramento.empty?
61
- FXMessageBox.warning(self, MBOX_OK, "Advertencia", "Debe ingresar al menos un criterio de búsqueda")
62
- else
63
- # conectar a la base de datos
64
- # tables
65
- # tabla libros (id, tomo, pagina, numero)
66
- # tabla creyentes (id, nombres, apellidos, lugar_nacimiento, fecha_nacimiento, cedula)
67
- # tabla parroquias (id, nombre, sector, parroco)
68
- # 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)
69
- # tabla registros_civiles (id, provincia_rc, canton_rc, parroquia_rc, anio_rc, tomo_rc, pagina_rc, acta_rc, fecha_rc)
70
- # Join tables
71
- sql = "SELECT * FROM sacramentos INNER JOIN libros ON sacramentos.id = libros.id INNER JOIN creyentes ON sacramentos.id = creyentes.id INNER JOIN parroquias ON sacramentos.id = parroquias.id INNER JOIN registros_civiles ON sacramentos.id = registros_civiles.id"
72
- sql += " WHERE creyentes.apellidos LIKE '%#{apellidos}%'" unless apellidos.empty?
73
- sql += " AND creyentes.nombres LIKE '%#{nombres}%'" unless nombres.empty?
74
- sql += " AND creyentes.cedula = '#{cedula}'" unless cedula.empty?
75
- sql += " AND sacramentos.fecha >= '#{fecha_desde}'" unless fecha_desde.empty?
76
- sql += " AND sacramentos.fecha <= '#{fecha_hasta}'" unless fecha_hasta.empty?
77
- sql += " AND sacramentos.sacramento = '#{sacramento}'" unless sacramento.empty?
78
- $conn.exec(sql) do |result|
79
- if result.values.empty?
80
- FXMessageBox.information(self, MBOX_OK, "Información", "No se encontraron registros")
81
- else
82
- # mostrar resultados
83
- FXMessageBox.information(self, MBOX_OK, "Información", "Se encontraron #{result.values.length} registros")
84
- require_relative 'resultados.rb'
85
- vtnresultados = ResultadosConsulta.new(@app, result.values)
86
- vtnresultados.create
87
- vtnresultados.show(PLACEMENT_SCREEN)
88
- end
89
- end
90
- end
91
- end
92
-
93
- @btncancel.connect(SEL_COMMAND) do
94
- clear_input_fields
95
- end
96
-
97
- def clear_input_fields
98
- @input_apellidos.text = ""
99
- @input_nombres.text = ""
100
- @input_cedula.text = ""
101
- @input_fecha_desde.text = ""
102
- @input_fecha_hasta.text = ""
103
- @input_sacramento.text = ""
104
- end
105
- end
106
-
107
- # Nombre del mes
108
- def nombre_mes(mes)
109
- meses = {
110
- "01" => "enero",
111
- "02" => "febrero",
112
- "03" => "marzo",
113
- "04" => "abril",
114
- "05" => "mayo",
115
- "06" => "junio",
116
- "07" => "julio",
117
- "08" => "agosto",
118
- "09" => "septiembre",
119
- "10" => "octubre",
120
- "11" => "noviembre",
121
- "12" => "diciembre"
122
- }
123
- meses[mes]
124
- end
125
-
126
-
127
- # Cambiar el formato de la fecha de YYYY-MM-DD a DD de nombre_mes de YYYY
128
- def cambiar_formato_fecha(fecha)
129
- # split "-" or "/"
130
- fecha = fecha.split(/-|\//)
131
- # si el formato de fecha es YYYY-MM-DD o YYYY/MM/DD, sino si es DD-MM-YYYY o DD/MM/YYYY
132
- if fecha[0].length == 4
133
- "#{fecha[2]} de #{nombre_mes(fecha[1])} de #{fecha[0]}"
134
- else
135
- "#{fecha[0]} de #{nombre_mes(fecha[1])} de #{fecha[2]}"
136
- end
137
- end
138
-
139
-
140
- def create
141
- super
142
- show(PLACEMENT_SCREEN)
143
- end
144
- end
@@ -1,232 +0,0 @@
1
- require 'fox16'
2
- include Fox
3
-
4
- class Matrimonio < FXMainWindow
5
- def initialize(app)
6
- super(app, "Parroquia San Judas Tadeo", :width => 1050, :height => 530)
7
- self.backColor = FXRGB(3,187,133)
8
- # Title
9
- @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)
10
- @lbltitle.font = FXFont.new(app, "Geneva", 16, FONTWEIGHT_BOLD)
11
- @lbltitle.backColor = FXRGB(3,187,133)
12
- # Subtitle
13
- @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)
14
- @lblsubtitle.font = FXFont.new(app, "Geneva", 10, FONTWEIGHT_BOLD)
15
- @lblsubtitle.backColor = FXRGB(3,187,133)
16
- # Date
17
- @date = Time.now.strftime("%d/%m/%Y")
18
- @lbldate = FXLabel.new(self, "Fecha: #{cambiar_formato_fecha(@date)}", :opts => LAYOUT_EXPLICIT|JUSTIFY_RIGHT, :width => 1050, :height => 20, :x => 0, :y => 60, :padRight => 20)
19
- @lbldate.font = FXFont.new(app, "Geneva", 12, FONTWEIGHT_BOLD)
20
- @lbldate.backColor = FXRGB(3,187,133)
21
- # section libros
22
- @lbl_tomo = FXLabel.new(self, "Tomo", :opts => LAYOUT_EXPLICIT, :width => 50, :height => 20, :x => 50, :y => 100)
23
- @lbl_tomo.backColor = FXRGB(3,187,133)
24
- @input_tomo = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 50, :height => 20, :x => 110, :y => 100)
25
- @lbl_page = FXLabel.new(self, "Pagina", :opts => LAYOUT_EXPLICIT, :width => 50, :height => 20, :x => 170, :y => 100)
26
- @lbl_page.backColor = FXRGB(3,187,133)
27
- @input_page = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 50, :height => 20, :x => 230, :y => 100)
28
- @lbl_number = FXLabel.new(self, "Numero", :opts => LAYOUT_EXPLICIT, :width => 50, :height => 20, :x => 290, :y => 100)
29
- @lbl_number.backColor = FXRGB(3,187,133)
30
- @input_number = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 50, :height => 20, :x => 350, :y => 100)
31
-
32
- #section datos
33
- @lbl_fecha = FXLabel.new(self, "Fecha de matrimonio (AAAA/MM/DD): ", :opts => LAYOUT_EXPLICIT, :width => 250, :height => 20, :x => 10, :y => 150)
34
- @lbl_fecha.backColor = FXRGB(3,187,133)
35
- @input_fecha = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 150,:height => 20, :x => 340, :y => 150)
36
- @lbl_sacramento = FXLabel.new(self, "Sacramento: ", :opts => LAYOUT_EXPLICIT, :width => 150, :height => 20, :x => 680, :y => 150)
37
- @lbl_sacramento.backColor = FXRGB(3,187,133)
38
- @input_sacramento = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 150,:height => 20, :x => 850, :y => 150)
39
- @input_sacramento.text = "Matrimonio"
40
- @input_sacramento.disable
41
- @lbl_parroquia = FXLabel.new(self, "Iglesia parroquial: ", :opts => LAYOUT_EXPLICIT, :width => 150, :height => 20, :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, :y => 180)
44
- @input_parroquia.text = "San Judas Tadeo"
45
- @input_parroquia.disable
46
- @lbl_sector = FXLabel.new(self, "Sector: ", :opts => LAYOUT_EXPLICIT, :width => 150, :height => 20, :x => 340, :y => 180)
47
- @lbl_sector.backColor = FXRGB(3,187,133)
48
- @input_sector = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 150,:height => 20, :x => 510, :y => 180)
49
- @input_sector.text = "Jaime Roldós"
50
- @input_sector.disable
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_celebrante = FXLabel.new(self, "Celebrante: ", :opts => LAYOUT_EXPLICIT, :width => 150, :height => 20, :x => 10, :y => 210)
55
- @lbl_celebrante.backColor = FXRGB(3,187,133)
56
- @input_celebrante = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 150,:height => 20, :x => 170, :y => 210)
57
- @lbl_name_novio = FXLabel.new(self, "Nombres del novio: ", :opts => LAYOUT_EXPLICIT, :width => 150, :height => 20, :x => 10, :y => 240)
58
- @lbl_name_novio.backColor = FXRGB(3,187,133)
59
- @input_name_novio = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 150,:height => 20, :x => 170, :y => 240)
60
- @lbl_apellido_novio = FXLabel.new(self, "Apellidos del novio: ", :opts => LAYOUT_EXPLICIT, :width => 150, :height => 20, :x => 340, :y => 240)
61
- @lbl_apellido_novio.backColor = FXRGB(3,187,133)
62
- @input_apellido_novio = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 150,:height => 20, :x => 510, :y => 240)
63
- @lbl_cedula_novio = FXLabel.new(self, "Cédula del novio: ", :opts => LAYOUT_EXPLICIT, :width => 150, :height => 20, :x => 680, :y => 240)
64
- @lbl_cedula_novio.backColor = FXRGB(3,187,133)
65
- @input_cedula_novio = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 150,:height => 20, :x => 850, :y => 240)
66
- @lbl_name_novia = FXLabel.new(self, "Nombres de la novia: ", :opts => LAYOUT_EXPLICIT, :width => 150, :height => 20, :x => 10, :y => 270)
67
- @lbl_name_novia.backColor = FXRGB(3,187,133)
68
- @input_name_novia = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 150,:height => 20, :x => 170, :y => 270)
69
- @lbl_apellido_novia = FXLabel.new(self, "Apellidos de la novia: ", :opts => LAYOUT_EXPLICIT, :width => 150, :height => 20, :x => 340, :y => 270)
70
- @lbl_apellido_novia.backColor = FXRGB(3,187,133)
71
- @input_apellido_novia = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 150,:height => 20, :x => 510, :y => 270)
72
- @lbl_cedula_novia = FXLabel.new(self, "Cédula de la novia: ", :opts => LAYOUT_EXPLICIT, :width => 150, :height => 20, :x => 680, :y => 270)
73
- @lbl_cedula_novia.backColor = FXRGB(3,187,133)
74
- @input_cedula_novia = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 150,:height => 20, :x => 850, :y => 270)
75
- @lbl_testigo_novio = FXLabel.new(self, "Testigo del novio: ", :opts => LAYOUT_EXPLICIT, :width => 150, :height => 20, :x => 10, :y => 300)
76
- @lbl_testigo_novio.backColor = FXRGB(3,187,133)
77
- @input_nombres_testigo_novio = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 150,:height => 20, :x => 170, :y => 300)
78
- @lbl_testigo_novia = FXLabel.new(self, "Testigo novia: ", :opts => LAYOUT_EXPLICIT, :width => 150, :height => 20, :x => 340, :y => 300)
79
- @lbl_testigo_novia.backColor = FXRGB(3,187,133)
80
- @input_nombres_testigo_novia = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 150,:height => 20, :x => 510, :y => 300)
81
- @lbl_certifica = FXLabel.new(self, "Certifica: ", :opts => LAYOUT_EXPLICIT, :width => 150, :height => 20, :x => 680, :y => 300)
82
- @lbl_certifica.backColor = FXRGB(3,187,133)
83
- @input_certifica = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 150,:height => 20, :x => 850, :y => 300)
84
-
85
- #section registro civil
86
- @lbl_reg_civ = FXLabel.new(self, "------------------------------------ REGISTRO CIVIL ------------------------------------", :opts => LAYOUT_EXPLICIT|JUSTIFY_CENTER_X, :width => 1050, :height => 20, :x => 10, :y => 330)
87
- @lbl_reg_civ.backColor = FXRGB(3,187,133)
88
- @lbl_provincia_rc = FXLabel.new(self, "Provincia: ", :opts => LAYOUT_EXPLICIT, :width => 150, :height => 20, :x => 10, :y => 360)
89
- @lbl_provincia_rc.backColor = FXRGB(3,187,133)
90
- @input_provincia_rc = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 150,:height => 20, :x => 170,:y => 360)
91
- @lbl_canton_rc = FXLabel.new(self, "Cantón: ", :opts => LAYOUT_EXPLICIT, :width => 150, :height => 20, :x => 340, :y => 360)
92
- @lbl_canton_rc.backColor = FXRGB(3,187,133)
93
- @input_canton_rc = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 150,:height => 20, :x => 510, :y =>360)
94
- @lbl_parroquia_rc = FXLabel.new(self, "Parroquia: ", :opts => LAYOUT_EXPLICIT, :width => 150, :height => 20, :x => 680, :y => 360)
95
- @lbl_parroquia_rc.backColor = FXRGB(3,187,133)
96
- @input_parroquia_rc = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 150,:height => 20, :x => 850,:y => 360)
97
- @lbl_anio_rc = FXLabel.new(self, "Año: ", :opts => LAYOUT_EXPLICIT, :width => 50, :height => 20, :x => 50, :y => 390)
98
- @lbl_anio_rc.backColor = FXRGB(3,187,133)
99
- @input_anio_rc = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 50,:height => 20, :x => 110,:y => 390)
100
- @lbl_tomo_rc = FXLabel.new(self, "Tomo: ", :opts => LAYOUT_EXPLICIT, :width => 50, :height => 20, :x => 170, :y => 390)
101
- @lbl_tomo_rc.backColor = FXRGB(3,187,133)
102
- @input_tomo_rc = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 50,:height => 20, :x => 230,:y => 390)
103
- @lbl_pag_rc = FXLabel.new(self, "Página: ", :opts => LAYOUT_EXPLICIT, :width => 50, :height => 20, :x => 290, :y => 390)
104
- @lbl_pag_rc.backColor = FXRGB(3,187,133)
105
- @input_pag_rc = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 50,:height => 20, :x => 350,:y => 390)
106
- @lbl_acta_rc = FXLabel.new(self, "Acta: ", :opts => LAYOUT_EXPLICIT, :width => 50, :height => 20, :x => 410, :y => 390)
107
- @lbl_acta_rc.backColor = FXRGB(3,187,133)
108
- @input_acta_rc = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 50,:height => 20, :x => 470,:y => 390)
109
- @lbl_date_rc = FXLabel.new(self, "Fecha (AAAA/MM/DD): ", :opts => LAYOUT_EXPLICIT, :width => 150, :height => 20, :x => 10, :y => 420)
110
- @lbl_date_rc.backColor = FXRGB(3,187,133)
111
- @input_date_rc = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 150,:height => 20, :x => 170,:y => 420)
112
-
113
-
114
- # create buttons
115
- @btnsave = FXButton.new(self, "Guardar", :opts => LAYOUT_EXPLICIT|BUTTON_NORMAL, :width => 100, :height => 30, :x => 790, :y => 480)
116
- @btncancel = FXButton.new(self, "Cancelar", :opts => LAYOUT_EXPLICIT|BUTTON_NORMAL, :width => 100, :height => 30, :x => 900, :y => 480)
117
-
118
- # connect buttons
119
- @btnsave.connect(SEL_COMMAND) do
120
- tomo = @input_tomo.text
121
- page = @input_page.text
122
- number = @input_number.text
123
- fecha = @input_fecha.text
124
- sacramento = @input_sacramento.text
125
- parroquia = @input_parroquia.text
126
- sector = @input_sector.text
127
- parroco = @input_parroco.text
128
- celebrante = @input_celebrante.text
129
- name_novio = @input_name_novio.text
130
- apellido_novio = @input_apellido_novio.text
131
- cedula_novio = @input_cedula_novio.text.empty? ? nil : @input_cedula_novio.text
132
- nombres_novia = @input_name_novia.text.empty? ? nil : @input_name_novia.text
133
- apellidos_novia = @input_apellido_novia.text.empty? ? nil : @input_apellido_novia.text
134
- cedula_novia = @input_cedula_novia.text.empty? ? nil : @input_cedula_novia.text
135
- testigo_novio = @input_nombres_testigo_novio.text.empty? ? nil : @input_nombres_testigo_novio.text
136
- testigo_novia = @input_nombres_testigo_novia.text.empty? ? nil : @input_nombres_testigo_novia.text
137
- certifica = @input_certifica.text
138
- provincia_rc = @input_provincia_rc.text
139
- canton_rc = @input_canton_rc.text
140
- parroquia_rc = @input_parroquia_rc.text
141
- anio_rc = @input_anio_rc.text
142
- tomo_rc = @input_tomo_rc.text
143
- pagina_rc = @input_pag_rc.text
144
- acta_rc = @input_acta_rc.text
145
- fecha_rc = @input_date_rc.text
146
-
147
- # tables
148
- # tabla libros (id, tomo, pagina, numero)
149
- # tabla creyentes (id, nombres, apellidos, lugar_nacimiento, fecha_nacimiento, cedula)
150
- # tabla parroquias (id, nombre, sector, parroco)
151
- # 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)
152
- # tabla registros_civiles (id, provincia_rc, canton_rc, parroquia_rc, anio_rc, tomo_rc, pagina_rc, acta_rc, fecha_rc)
153
- $conn.transaction do
154
- $conn.exec('INSERT INTO libros (tomo, pagina, numero) VALUES ($1, $2, $3)', [tomo, page, number])
155
- $conn.exec('INSERT INTO creyentes (nombres, apellidos, cedula) VALUES ($1, $2, $3)', [name_novio, apellido_novio, cedula_novio])
156
- $conn.exec('INSERT INTO parroquias (parroquia, sector, parroco) VALUES ($1, $2, $3)', [parroquia, sector, parroco])
157
- $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, pagina_rc, acta_rc, fecha_rc])
158
- $conn.exec('INSERT INTO sacramentos (sacramento, fecha, celebrante, certifica, testigo_novio, testigo_novia, nombres_novia, apellidos_novia, cedula_novia) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9)', [sacramento, fecha, celebrante, certifica, testigo_novio, testigo_novia, nombres_novia, apellidos_novia, cedula_novia])
159
- $conn.exec("COMMIT")
160
- FXMessageBox.information(self, MBOX_OK, "Información", "Datos guardados correctamente")
161
- clear_input_fields
162
- end
163
- end
164
-
165
- @btncancel.connect(SEL_COMMAND) do
166
- clear_input_fields
167
- end
168
-
169
- def clear_input_fields
170
- @input_tomo.text = ""
171
- @input_page.text = ""
172
- @input_number.text = ""
173
- @input_fecha.text = ""
174
- @input_parroco.text = ""
175
- @input_celebrante.text = ""
176
- @input_name_novio.text = ""
177
- @input_apellido_novio.text = ""
178
- @input_cedula_novio.text = ""
179
- @input_name_novia.text = ""
180
- @input_apellido_novia.text = ""
181
- @input_cedula_novia.text = ""
182
- @input_nombres_testigo_novio.text = ""
183
- @input_nombres_testigo_novia.text = ""
184
- @input_certifica.text = ""
185
- @input_provincia_rc.text = ""
186
- @input_canton_rc.text = ""
187
- @input_parroquia_rc.text = ""
188
- @input_anio_rc.text = ""
189
- @input_tomo_rc.text = ""
190
- @input_pag_rc.text = ""
191
- @input_acta_rc.text = ""
192
- @input_date_rc.text = ""
193
- end
194
- end
195
-
196
- # Nombre del mes
197
- def nombre_mes(mes)
198
- meses = {
199
- "01" => "enero",
200
- "02" => "febrero",
201
- "03" => "marzo",
202
- "04" => "abril",
203
- "05" => "mayo",
204
- "06" => "junio",
205
- "07" => "julio",
206
- "08" => "agosto",
207
- "09" => "septiembre",
208
- "10" => "octubre",
209
- "11" => "noviembre",
210
- "12" => "diciembre"
211
- }
212
- meses[mes]
213
- end
214
-
215
-
216
- # Cambiar el formato de la fecha de YYYY-MM-DD a DD de nombre_mes de YYYY
217
- def cambiar_formato_fecha(fecha)
218
- # split "-" or "/"
219
- fecha = fecha.split(/-|\//)
220
- # si el formato de fecha es YYYY-MM-DD o YYYY/MM/DD, sino si es DD-MM-YYYY o DD/MM/YYYY
221
- if fecha[0].length == 4
222
- "#{fecha[2]} de #{nombre_mes(fecha[1])} de #{fecha[0]}"
223
- else
224
- "#{fecha[0]} de #{nombre_mes(fecha[1])} de #{fecha[2]}"
225
- end
226
- end
227
-
228
- def create
229
- super
230
- show(PLACEMENT_SCREEN)
231
- end
232
- end