parroquia 0.0.1
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.
- checksums.yaml +7 -0
- data/bin/parroquia +3 -0
- data/lib/parroquia/actualizar_bautismo.rb +213 -0
- data/lib/parroquia/actualizar_confirmacion.rb +157 -0
- data/lib/parroquia/actualizar_matrimonio.rb +196 -0
- data/lib/parroquia/bautizo.rb +180 -0
- data/lib/parroquia/confirmacion.rb +143 -0
- data/lib/parroquia/consultas.rb +104 -0
- data/lib/parroquia/main.rb +84 -0
- data/lib/parroquia/matrimonio.rb +174 -0
- data/lib/parroquia/resultados.rb +413 -0
- metadata +114 -0
@@ -0,0 +1,180 @@
|
|
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
|
+
# create label
|
8
|
+
@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)
|
9
|
+
# create label
|
10
|
+
@lblsubtitle = FXLabel.new(self, "ARQUIDIOSESIS DE QUITO - VICARIA NORTE SERVICIO PARROQUIAL DE SAN JUDAS TADEO", :opts => LAYOUT_EXPLICIT|JUSTIFY_CENTER_X, :width => 1050, :height => 20, :x => 0, :y => 40)
|
11
|
+
|
12
|
+
#create label
|
13
|
+
@date = Time.now.strftime("%d/%m/%Y %H:%M:%S")
|
14
|
+
@lbldate = FXLabel.new(self, "Fecha: #{@date}", :opts => LAYOUT_EXPLICIT|JUSTIFY_RIGHT, :width => 1000, :height => 20, :x => 0, :y => 60)
|
15
|
+
#section libros
|
16
|
+
@lbl_tomo = FXLabel.new(self, "Tomo", :opts => LAYOUT_EXPLICIT, :width => 50, :height => 20, :x => 50, :y => 100)
|
17
|
+
@input_tomo = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 50, :height => 20, :x => 110, :y => 100)
|
18
|
+
@lbl_page = FXLabel.new(self, "Pagina", :opts => LAYOUT_EXPLICIT, :width => 50, :height => 20, :x => 170, :y => 100)
|
19
|
+
@input_page = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 50, :height => 20, :x => 230, :y => 100)
|
20
|
+
@lbl_number = FXLabel.new(self, "Numero", :opts => LAYOUT_EXPLICIT, :width => 50, :height => 20, :x => 290, :y => 100)
|
21
|
+
@input_number = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 50, :height => 20, :x => 350, :y => 100)
|
22
|
+
|
23
|
+
#section datos
|
24
|
+
@lbl_fecha = FXLabel.new(self, "Fecha de bautismo (AAAA/MM/DD): ", :opts => LAYOUT_EXPLICIT, :width => 250, :height => 20, :x => 10, :y => 150)
|
25
|
+
@input_fecha = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 150,:height => 20, :x => 340, :y => 150)
|
26
|
+
@lbl_sacramento = FXLabel.new(self, "Sacramento: ", :opts => LAYOUT_EXPLICIT, :width => 150, :height => 20, :x => 680, :y => 150)
|
27
|
+
@input_sacramento = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 150,:height => 20, :x => 850, :y => 150)
|
28
|
+
@lbl_parroquia = FXLabel.new(self, "Iglesia parroquial: ", :opts => LAYOUT_EXPLICIT, :width => 150, :height => 20, :x => 10, :y => 180)
|
29
|
+
@input_parroquia = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 150,:height => 20, :x => 170, :y => 180)
|
30
|
+
@lbl_sector = FXLabel.new(self, "Sector: ", :opts => LAYOUT_EXPLICIT, :width => 150, :height => 20, :x => 340, :y => 180)
|
31
|
+
@input_sector = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 150,:height => 20, :x => 510, :y => 180)
|
32
|
+
@lbl_parroco = FXLabel.new(self, "Parroco: ", :opts => LAYOUT_EXPLICIT, :width => 150, :height => 20, :x => 680, :y => 180)
|
33
|
+
@input_parroco = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 150,:height => 20, :x => 850, :y => 180)
|
34
|
+
@lbl_ministro = FXLabel.new(self, "Ministro: ", :opts => LAYOUT_EXPLICIT, :width => 150, :height => 20, :x => 10, :y => 210)
|
35
|
+
@input_ministro = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 150,:height => 20, :x => 170, :y => 210)
|
36
|
+
@lbl_name = FXLabel.new(self, "Nombres: ", :opts => LAYOUT_EXPLICIT, :width => 150, :height => 20, :x => 10, :y => 240)
|
37
|
+
@input_name = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 150,:height => 20, :x => 170, :y => 240)
|
38
|
+
@lbl_apellidos = FXLabel.new(self, "Apellidos: ", :opts => LAYOUT_EXPLICIT, :width => 150, :height => 20, :x => 340, :y => 240)
|
39
|
+
@input_apellidos = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 150,:height => 20, :x => 510, :y => 240)
|
40
|
+
@lbl_cedula = FXLabel.new(self, "Cédula: ", :opts => LAYOUT_EXPLICIT, :width => 150, :height => 20, :x => 10, :y => 270)
|
41
|
+
@input_cedula = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 150,:height => 20, :x => 170, :y => 270)
|
42
|
+
@lbl_lugar_nacimiento = FXLabel.new(self, "Lugar de nacimiento: ", :opts => LAYOUT_EXPLICIT, :width => 150, :height => 20, :x => 10, :y => 300)
|
43
|
+
@input_lugar_nacimiento = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 150,:height => 20, :x => 170, :y => 300)
|
44
|
+
@lbl_fecha_nacimiento = FXLabel.new(self, "Fecha de nacimiento (AAAA/MM/DD): ", :opts => LAYOUT_EXPLICIT, :width => 250, :height => 20, :x => 340, :y => 300)
|
45
|
+
@input_fecha_nacimiento = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 150,:height => 20, :x => 590, :y => 300)
|
46
|
+
@lbl_padre = FXLabel.new(self, "Padre: ", :opts => LAYOUT_EXPLICIT, :width => 150, :height => 20, :x => 10, :y => 330)
|
47
|
+
@input_padre = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 150,:height => 20, :x => 170, :y => 330)
|
48
|
+
@lbl_madre = FXLabel.new(self, "Madre: ", :opts => LAYOUT_EXPLICIT, :width => 150, :height => 20, :x => 340, :y => 330)
|
49
|
+
@input_madre = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 150,:height => 20, :x => 510, :y => 330)
|
50
|
+
@lbl_padrino = FXLabel.new(self, "Padrino: ", :opts => LAYOUT_EXPLICIT, :width => 150, :height => 20, :x => 10, :y => 360)
|
51
|
+
@input_padrino = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 150,:height => 20, :x => 170, :y => 360)
|
52
|
+
@lbl_madrina = FXLabel.new(self, "Madrina: ", :opts => LAYOUT_EXPLICIT, :width => 150, :height => 20, :x => 340, :y => 360)
|
53
|
+
@input_madrina = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 150,:height => 20, :x => 510, :y => 360)
|
54
|
+
@lbl_certifica = FXLabel.new(self, "Certifica: ", :opts => LAYOUT_EXPLICIT, :width => 150, :height => 20, :x => 10, :y => 390)
|
55
|
+
@input_certifica = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 150,:height => 20, :x => 170, :y => 390)
|
56
|
+
|
57
|
+
#section registro civil
|
58
|
+
@lbl_reg_civ = FXLabel.new(self, "------------------------------------ REGISTRO CIVIL ------------------------------------", :opts => LAYOUT_EXPLICIT|JUSTIFY_CENTER_X, :width => 1050, :height => 20, :x => 10, :y => 420)
|
59
|
+
@lbl_provincia_rc = FXLabel.new(self, "Provincia: ", :opts => LAYOUT_EXPLICIT, :width => 150, :height => 20, :x => 10, :y => 450)
|
60
|
+
@input_provincia_rc = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 150,:height => 20, :x => 170,:y => 450)
|
61
|
+
@lbl_canton_rc = FXLabel.new(self, "Cantón: ", :opts => LAYOUT_EXPLICIT, :width => 150, :height => 20, :x => 340, :y => 450)
|
62
|
+
@input_canton_rc = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 150,:height => 20, :x => 510, :y =>450)
|
63
|
+
@lbl_parroquia_rc = FXLabel.new(self, "Parroquia: ", :opts => LAYOUT_EXPLICIT, :width => 150, :height => 20, :x => 680, :y => 450)
|
64
|
+
@input_parroquia_rc = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 150,:height => 20, :x => 850,:y => 450)
|
65
|
+
@lbl_anio_rc = FXLabel.new(self, "Año: ", :opts => LAYOUT_EXPLICIT, :width => 50, :height => 20, :x => 50, :y => 480)
|
66
|
+
@input_anio_rc = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 50,:height => 20, :x => 110,:y => 480)
|
67
|
+
@lbl_tomo_rc = FXLabel.new(self, "Tomo: ", :opts => LAYOUT_EXPLICIT, :width => 50, :height => 20, :x => 170, :y => 480)
|
68
|
+
@input_tomo_rc = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 50,:height => 20, :x => 230,:y => 480)
|
69
|
+
@lbl_pag_rc = FXLabel.new(self, "Página: ", :opts => LAYOUT_EXPLICIT, :width => 50, :height => 20, :x => 290, :y => 480)
|
70
|
+
@input_pag_rc = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 50,:height => 20, :x => 350,:y => 480)
|
71
|
+
@lbl_acta_rc = FXLabel.new(self, "Acta: ", :opts => LAYOUT_EXPLICIT, :width => 50, :height => 20, :x => 410, :y => 480)
|
72
|
+
@input_acta_rc = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 50,:height => 20, :x => 470,:y => 480)
|
73
|
+
@lbl_date_rc = FXLabel.new(self, "Fecha (AAAA/MM/DD): ", :opts => LAYOUT_EXPLICIT, :width => 150, :height => 20, :x => 10, :y => 510)
|
74
|
+
@input_date_rc = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 150,:height => 20, :x => 170,:y => 510)
|
75
|
+
|
76
|
+
|
77
|
+
# create buttons
|
78
|
+
@btnsave = FXButton.new(self, "Guardar", :opts => LAYOUT_EXPLICIT|BUTTON_NORMAL, :width => 100, :height => 30, :x => 790, :y => 540)
|
79
|
+
@btncancel = FXButton.new(self, "Cancelar", :opts => LAYOUT_EXPLICIT|BUTTON_NORMAL, :width => 100, :height => 30, :x => 900, :y => 540)
|
80
|
+
|
81
|
+
# connect buttons
|
82
|
+
@btnsave.connect(SEL_COMMAND) do
|
83
|
+
tomo = @input_tomo.text
|
84
|
+
page = @input_page.text
|
85
|
+
number = @input_number.text
|
86
|
+
fecha = @input_fecha.text
|
87
|
+
sacramento = @input_sacramento.text
|
88
|
+
parroquia = @input_parroquia.text
|
89
|
+
sector = @input_sector.text
|
90
|
+
parroco = @input_parroco.text
|
91
|
+
ministro = @input_ministro.text
|
92
|
+
name = @input_name.text
|
93
|
+
apellidos = @input_apellidos.text
|
94
|
+
lugar_nacimiento = @input_lugar_nacimiento.text
|
95
|
+
fecha_nacimiento = @input_fecha_nacimiento.text
|
96
|
+
cedula = @input_cedula.text.empty? ? nil : @input_cedula.text
|
97
|
+
padrino = @input_padrino.text.empty? ? nil : @input_padrino.text
|
98
|
+
madrina = @input_madrina.text.empty? ? nil : @input_madrina.text
|
99
|
+
padre = @input_padre.text.empty? ? nil : @input_padre.text
|
100
|
+
madre = @input_madre.text.empty? ? nil : @input_madre.text
|
101
|
+
certifica = @input_certifica.text
|
102
|
+
provincia_rc = @input_provincia_rc.text
|
103
|
+
canton_rc = @input_canton_rc.text
|
104
|
+
parroquia_rc = @input_parroquia_rc.text
|
105
|
+
anio_rc = @input_anio_rc.text
|
106
|
+
tomo_rc = @input_tomo_rc.text
|
107
|
+
pag_rc = @input_pag_rc.text
|
108
|
+
acta_rc = @input_acta_rc.text
|
109
|
+
date_rc = @input_date_rc.text
|
110
|
+
|
111
|
+
|
112
|
+
begin
|
113
|
+
# tables
|
114
|
+
# tabla libros (id, tomo, pagina, numero)
|
115
|
+
# tabla creyentes (id, nombres, apellidos, lugar_nacimiento, fecha_nacimiento, cedula)
|
116
|
+
# tabla parroquias (id, nombre, sector, parroco)
|
117
|
+
# 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)
|
118
|
+
# tabla registros_civiles (id, provincia_rc, canton_rc, parroquia_rc, anio_rc, tomo_rc, pagina_rc, acta_rc, fecha_rc)
|
119
|
+
# Iniciar una transacción
|
120
|
+
$conn.transaction do
|
121
|
+
$conn.exec('INSERT INTO libros (tomo, pagina, numero) VALUES ($1, $2, $3)', [tomo, page, number])
|
122
|
+
$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])
|
123
|
+
$conn.exec('INSERT INTO parroquias (parroquia, sector, parroco) VALUES ($1, $2, $3)', [parroquia, sector, parroco])
|
124
|
+
$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])
|
125
|
+
$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])
|
126
|
+
# Confirmar la transacción
|
127
|
+
$conn.exec("COMMIT")
|
128
|
+
FXMessageBox.information(self, MBOX_OK, "Información", "Datos guardados correctamente")
|
129
|
+
clear_input_fields
|
130
|
+
end
|
131
|
+
|
132
|
+
rescue PG::Error => e
|
133
|
+
FXMessageBox.error(self, MBOX_OK, "Error", "Error al guardar los datos")
|
134
|
+
# Imprimir el error en la consola
|
135
|
+
puts e.message
|
136
|
+
# Imprimir detalles del error en la consola
|
137
|
+
puts e.backtrace.inspect
|
138
|
+
end
|
139
|
+
end
|
140
|
+
|
141
|
+
@btncancel.connect(SEL_COMMAND) do
|
142
|
+
clear_input_fields
|
143
|
+
end
|
144
|
+
|
145
|
+
def clear_input_fields
|
146
|
+
@input_tomo.text = ""
|
147
|
+
@input_page.text = ""
|
148
|
+
@input_number.text = ""
|
149
|
+
@input_fecha.text = ""
|
150
|
+
@input_sacramento.text = ""
|
151
|
+
@input_parroquia.text = ""
|
152
|
+
@input_sector.text = ""
|
153
|
+
@input_parroco.text = ""
|
154
|
+
@input_ministro.text = ""
|
155
|
+
@input_name.text = ""
|
156
|
+
@input_apellidos.text = ""
|
157
|
+
@input_lugar_nacimiento.text = ""
|
158
|
+
@input_fecha_nacimiento.text = ""
|
159
|
+
@input_cedula.text = ""
|
160
|
+
@input_padrino.text = ""
|
161
|
+
@input_madrina.text = ""
|
162
|
+
@input_padre.text = ""
|
163
|
+
@input_madre.text = ""
|
164
|
+
@input_certifica.text = ""
|
165
|
+
@input_provincia_rc.text = ""
|
166
|
+
@input_canton_rc.text = ""
|
167
|
+
@input_parroquia_rc.text = ""
|
168
|
+
@input_anio_rc.text = ""
|
169
|
+
@input_tomo_rc.text = ""
|
170
|
+
@input_pag_rc.text = ""
|
171
|
+
@input_acta_rc.text = ""
|
172
|
+
@input_date_rc.text = ""
|
173
|
+
end
|
174
|
+
end
|
175
|
+
|
176
|
+
def create
|
177
|
+
super
|
178
|
+
show(PLACEMENT_SCREEN)
|
179
|
+
end
|
180
|
+
end
|
@@ -0,0 +1,143 @@
|
|
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
|
+
# create label
|
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
|
+
# create label
|
12
|
+
@lblsubtitle = FXLabel.new(self, "ARQUIDIOSESIS DE QUITO - VICARIA NORTE SERVICIO PARROQUIAL DE SAN JUDAS TADEO", :opts => LAYOUT_EXPLICIT|JUSTIFY_CENTER_X, :width => 1050, :height => 20, :x => 0, :y => 40)
|
13
|
+
|
14
|
+
#create label
|
15
|
+
@date = Time.now.strftime("%d/%m/%Y %H:%M:%S")
|
16
|
+
@lbldate = FXLabel.new(self, "Fecha: #{@date}", :opts => LAYOUT_EXPLICIT|JUSTIFY_RIGHT, :width => 1000, :height => 20, :x => 0, :y => 60)
|
17
|
+
#section libros
|
18
|
+
@lbl_tomo = FXLabel.new(self, "Tomo", :opts => LAYOUT_EXPLICIT, :width => 50, :height => 20, :x => 10, :y => 100)
|
19
|
+
@input_tomo = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 50,:height => 20, :x => 70, :y => 100)
|
20
|
+
@lbl_page = FXLabel.new(self, "Página", :opts => LAYOUT_EXPLICIT, :width => 50, :height => 20, :x => 130, :y => 100)
|
21
|
+
@input_page = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 50, :height => 20, :x => 190, :y => 100)
|
22
|
+
@lbl_number = FXLabel.new(self, "Numero", :opts => LAYOUT_EXPLICIT, :width => 50, :height => 20, :x => 250, :y => 100)
|
23
|
+
@input_number = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 50,:height => 20, :x => 310, :y => 100)
|
24
|
+
|
25
|
+
#section datos
|
26
|
+
@lbl_fecha = FXLabel.new(self, "Fecha de confirmación (AAAA/MM/DD): ", :opts => LAYOUT_EXPLICIT, :width => 250, :height => 20, :x => 10, :y => 150)
|
27
|
+
@input_fecha = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 150,:height => 20, :x => 340, :y => 150)
|
28
|
+
@lbl_sacramento = FXLabel.new(self, "Sacramento: ", :opts => LAYOUT_EXPLICIT, :width => 150, :height => 20, :x => 680, :y => 150)
|
29
|
+
@input_sacramento = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 150,:height => 20, :x => 850, :y => 150)
|
30
|
+
@lbl_parroquia = FXLabel.new(self, "Iglesia parroquial: ", :opts => LAYOUT_EXPLICIT, :width => 150, :height => 20, :x => 10, :y => 180)
|
31
|
+
@input_parroquia = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 150,:height => 20, :x => 170, :y => 180)
|
32
|
+
@lbl_sector = FXLabel.new(self, "Sector: ", :opts => LAYOUT_EXPLICIT, :width => 150, :height => 20, :x => 340, :y => 180)
|
33
|
+
@input_sector = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 150,:height => 20, :x => 510, :y => 180)
|
34
|
+
@lbl_parroco = FXLabel.new(self, "Parroco: ", :opts => LAYOUT_EXPLICIT, :width => 150, :height => 20, :x => 680, :y => 180)
|
35
|
+
@input_parroco = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 150,:height => 20, :x => 850, :y => 180)
|
36
|
+
@lbl_celebrante = FXLabel.new(self, "Celebrante: ", :opts => LAYOUT_EXPLICIT, :width => 150, :height => 20, :x => 10, :y => 210)
|
37
|
+
@input_celebrante = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 150,:height => 20, :x => 170, :y => 210)
|
38
|
+
@lbl_name = FXLabel.new(self, "Nombres: ", :opts => LAYOUT_EXPLICIT, :width => 150, :height => 20, :x => 10, :y => 240)
|
39
|
+
@input_name = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 150,:height => 20, :x => 170, :y => 240)
|
40
|
+
@lbl_apellidos = FXLabel.new(self, "Apellidos: ", :opts => LAYOUT_EXPLICIT, :width => 150, :height => 20, :x => 10, :y => 270)
|
41
|
+
@input_apellidos = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 150,:height => 20, :x => 170, :y => 270)
|
42
|
+
@lbl_lugar_nacimiento = FXLabel.new(self, "Lugar de nacimiento: ", :opts => LAYOUT_EXPLICIT, :width => 150, :height => 20, :x => 10, :y => 300)
|
43
|
+
@input_lugar_nacimiento = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 150,:height => 20, :x => 170, :y => 300)
|
44
|
+
@lbl_fecha_nacimiento = FXLabel.new(self, "Fecha de nacimiento (AAAA/MM/DD): ", :opts => LAYOUT_EXPLICIT, :width => 250, :height => 20, :x => 340, :y => 300)
|
45
|
+
@input_fecha_nacimiento = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 150,:height => 20, :x => 590, :y => 300)
|
46
|
+
@lbl_cedula = FXLabel.new(self, "Cédula: ", :opts => LAYOUT_EXPLICIT, :width => 80, :height => 20, :x => 750, :y => 300)
|
47
|
+
@input_cedula = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 150,:height => 20, :x =>850, :y => 300)
|
48
|
+
@lbl_padrino = FXLabel.new(self, "Padrino: ", :opts => LAYOUT_EXPLICIT, :width => 150, :height => 20, :x => 10, :y => 330)
|
49
|
+
@input_padrino = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 150,:height => 20, :x => 170, :y => 330)
|
50
|
+
@lbl_certifica = FXLabel.new(self, "Certifica: ", :opts => LAYOUT_EXPLICIT, :width => 150, :height => 20, :x => 10, :y => 360)
|
51
|
+
@input_certifica = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 150,:height => 20, :x => 170, :y => 360)
|
52
|
+
|
53
|
+
# create buttons
|
54
|
+
@btnsave = FXButton.new(self, "Guardar", :opts => LAYOUT_EXPLICIT|BUTTON_NORMAL, :width => 100, :height => 30, :x => 790, :y => 400)
|
55
|
+
@btncancel = FXButton.new(self, "Cancelar", :opts => LAYOUT_EXPLICIT|BUTTON_NORMAL, :width => 100, :height => 30, :x => 900, :y => 400)
|
56
|
+
|
57
|
+
# connect buttons
|
58
|
+
@btnsave.connect(SEL_COMMAND) do
|
59
|
+
tomo = @input_tomo.text
|
60
|
+
page = @input_page.text
|
61
|
+
number = @input_number.text
|
62
|
+
fecha = @input_fecha.text
|
63
|
+
sacramento = @input_sacramento.text
|
64
|
+
parroquia = @input_parroquia.text
|
65
|
+
sector = @input_sector.text
|
66
|
+
parroco = @input_parroco.text
|
67
|
+
celebrante = @input_celebrante.text
|
68
|
+
name = @input_name.text
|
69
|
+
apellidos = @input_apellidos.text
|
70
|
+
lugar_nacimiento = @input_lugar_nacimiento.text
|
71
|
+
fecha_nacimiento = @input_fecha_nacimiento.text
|
72
|
+
cedula = @input_cedula.text.empty? ? nil : @input_cedula.text
|
73
|
+
padrino = @input_padrino.text.empty? ? nil : @input_padrino.text
|
74
|
+
certifica = @input_certifica.text
|
75
|
+
|
76
|
+
begin
|
77
|
+
# tables
|
78
|
+
# tabla libros (id, tomo, pagina, numero)
|
79
|
+
# tabla creyentes (id, nombres, apellidos, lugar_nacimiento, fecha_nacimiento, cedula)
|
80
|
+
# tabla parroquias (id, nombre, sector, parroco)
|
81
|
+
# 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)
|
82
|
+
# tabla registros_civiles (id, provincia_rc, canton_rc, parroquia_rc, anio_rc, tomo_rc, pagina_rc, acta_rc, fecha_rc)
|
83
|
+
# Iniciar una transacción
|
84
|
+
$conn.transaction do
|
85
|
+
# Insertar en la tabla libros
|
86
|
+
@registro_libros = $conn.exec('INSERT INTO libros (tomo, pagina, numero) VALUES ($1, $2, $3)', [tomo, page, number])
|
87
|
+
|
88
|
+
# Insertar en la tabla creyentes
|
89
|
+
@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])
|
90
|
+
|
91
|
+
# Insertar en la tabla parroquias
|
92
|
+
@registro_parroquias = $conn.exec('INSERT INTO parroquias (parroquia, sector, parroco) VALUES ($1, $2, $3)', [parroquia, sector, parroco])
|
93
|
+
|
94
|
+
# 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
|
95
|
+
@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])
|
96
|
+
|
97
|
+
# Insertar en la tabla sacramentos
|
98
|
+
@registro_sacramentos = $conn.exec('INSERT INTO sacramentos (sacramento, fecha, celebrante, certifica, padrino) VALUES ($1, $2, $3, $4, $5)', [sacramento, fecha, celebrante, certifica, padrino])
|
99
|
+
|
100
|
+
# Confirmar la transacción
|
101
|
+
$conn.exec("COMMIT")
|
102
|
+
FXMessageBox.information(self, MBOX_OK, "Información", "Datos guardados correctamente")
|
103
|
+
clear_input_fields
|
104
|
+
end
|
105
|
+
rescue PG::Error => e
|
106
|
+
# En caso de error, se realizará automáticamente un rollback
|
107
|
+
FXMessageBox.error(self, MBOX_OK, "Error", "Error al guardar los datos")
|
108
|
+
# Imprimir el error en la consola
|
109
|
+
puts e.message
|
110
|
+
# Imprimir detalles del error en la consola
|
111
|
+
puts e.backtrace.inspect
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
@btncancel.connect(SEL_COMMAND) do
|
116
|
+
clear_input_fields
|
117
|
+
end
|
118
|
+
|
119
|
+
def clear_input_fields
|
120
|
+
@input_tomo.text = ""
|
121
|
+
@input_page.text = ""
|
122
|
+
@input_number.text = ""
|
123
|
+
@input_fecha.text = ""
|
124
|
+
@input_sacramento.text = ""
|
125
|
+
@input_parroquia.text = ""
|
126
|
+
@input_sector.text = ""
|
127
|
+
@input_parroco.text = ""
|
128
|
+
@input_celebrante.text = ""
|
129
|
+
@input_name.text = ""
|
130
|
+
@input_apellidos.text = ""
|
131
|
+
@input_lugar_nacimiento.text = ""
|
132
|
+
@input_fecha_nacimiento.text = ""
|
133
|
+
@input_cedula.text = ""
|
134
|
+
@input_padrino.text = ""
|
135
|
+
@input_certifica.text = ""
|
136
|
+
end
|
137
|
+
end
|
138
|
+
|
139
|
+
def create
|
140
|
+
super
|
141
|
+
show(PLACEMENT_SCREEN)
|
142
|
+
end
|
143
|
+
end
|
@@ -0,0 +1,104 @@
|
|
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 => 500)
|
8
|
+
@app = app
|
9
|
+
|
10
|
+
# seccion encabezado
|
11
|
+
# create label
|
12
|
+
@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)
|
13
|
+
# create label
|
14
|
+
@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)
|
15
|
+
|
16
|
+
# create label
|
17
|
+
@date = Time.now.strftime("%d/%m/%Y %H:%M:%S")
|
18
|
+
@lbldate = FXLabel.new(self, "Fecha: #{@date}", :opts => LAYOUT_EXPLICIT | JUSTIFY_RIGHT, :width => 680, :height => 20, :x => 0, :y => 60)
|
19
|
+
|
20
|
+
# seccioan consulta
|
21
|
+
@lbl_consulta = FXLabel.new(self, "Consultar por: ", :opts => LAYOUT_EXPLICIT, :width => 150, :height => 20, :x => 10, :y => 150)
|
22
|
+
@lbl_apellidos = FXLabel.new(self, "Apellidos: ", :opts => LAYOUT_EXPLICIT, :width => 150, :height => 20, :x => 10, :y => 180)
|
23
|
+
@input_apellidos = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 150, :height => 20, :x => 170, :y => 180)
|
24
|
+
@lbl_nombres = FXLabel.new(self, "Nombres: ", :opts => LAYOUT_EXPLICIT, :width => 150, :height => 20, :x => 340, :y => 180)
|
25
|
+
@input_nombres = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 150, :height => 20, :x => 510, :y => 180)
|
26
|
+
@lbl_cedula = FXLabel.new(self, "Cédula: ", :opts => LAYOUT_EXPLICIT, :width => 150, :height => 20, :x => 10, :y => 210)
|
27
|
+
@input_cedula = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 150, :height => 20, :x => 170, :y => 210)
|
28
|
+
@lbl_fecha_desde = FXLabel.new(self, "Fecha desde (AAAA/MM/DD): ", :opts => LAYOUT_EXPLICIT, :width => 250, :height => 20, :x => 10, :y => 240)
|
29
|
+
@input_fecha_desde = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 150, :height => 20, :x => 340, :y => 240)
|
30
|
+
@lbl_fecha_hasta = FXLabel.new(self, "Fecha hasta (AAAA/MM/DD): ", :opts => LAYOUT_EXPLICIT, :width => 250, :height => 20, :x => 10, :y => 270)
|
31
|
+
@input_fecha_hasta = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 150, :height => 20, :x => 340, :y => 270)
|
32
|
+
@lbl_sacramento = FXLabel.new(self, "Sacramento: ", :opts => LAYOUT_EXPLICIT, :width => 150, :height => 20, :x => 10, :y => 300)
|
33
|
+
@input_sacramento = FXTextField.new(self, 10, :opts => LAYOUT_EXPLICIT, :width => 150, :height => 20, :x => 170, :y => 300)
|
34
|
+
|
35
|
+
# create buttons
|
36
|
+
@btnsearch = FXButton.new(self, "Buscar", :opts => LAYOUT_EXPLICIT | BUTTON_NORMAL, :width => 100, :height => 30, :x => 450, :y => 330)
|
37
|
+
@btncancel = FXButton.new(self, "Cancelar", :opts => LAYOUT_EXPLICIT | BUTTON_NORMAL, :width => 100, :height => 30, :x => 560, :y => 330)
|
38
|
+
|
39
|
+
# connect buttons
|
40
|
+
@btnsearch.connect(SEL_COMMAND) do
|
41
|
+
apellidos = @input_apellidos.text
|
42
|
+
nombres = @input_nombres.text
|
43
|
+
cedula = @input_cedula.text
|
44
|
+
fecha_desde = @input_fecha_desde.text
|
45
|
+
fecha_hasta = @input_fecha_hasta.text
|
46
|
+
sacramento = @input_sacramento.text
|
47
|
+
|
48
|
+
if apellidos.empty? && nombres.empty? && cedula.empty? && fecha_desde.empty? && fecha_hasta.empty? && sacramento.empty?
|
49
|
+
FXMessageBox.warning(self, MBOX_OK, "Advertencia", "Debe ingresar al menos un criterio de búsqueda")
|
50
|
+
else
|
51
|
+
begin
|
52
|
+
# tables
|
53
|
+
# tabla libros (id, tomo, pagina, numero)
|
54
|
+
# tabla creyentes (id, nombres, apellidos, lugar_nacimiento, fecha_nacimiento, cedula)
|
55
|
+
# tabla parroquias (id, nombre, sector, parroco)
|
56
|
+
# 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)
|
57
|
+
# tabla registros_civiles (id, provincia_rc, canton_rc, parroquia_rc, anio_rc, tomo_rc, pagina_rc, acta_rc, fecha_rc)
|
58
|
+
# Join tables
|
59
|
+
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"
|
60
|
+
sql += " WHERE creyentes.apellidos LIKE '%#{apellidos}%'" unless apellidos.empty?
|
61
|
+
sql += " AND creyentes.nombres LIKE '%#{nombres}%'" unless nombres.empty?
|
62
|
+
sql += " AND creyentes.cedula = '#{cedula}'" unless cedula.empty?
|
63
|
+
sql += " AND sacramentos.fecha >= '#{fecha_desde}'" unless fecha_desde.empty?
|
64
|
+
sql += " AND sacramentos.fecha <= '#{fecha_hasta}'" unless fecha_hasta.empty?
|
65
|
+
sql += " AND sacramentos.sacramento = '#{sacramento}'" unless sacramento.empty?
|
66
|
+
puts sql
|
67
|
+
$conn.exec(sql) do |result|
|
68
|
+
puts result.values
|
69
|
+
if result.values.empty?
|
70
|
+
FXMessageBox.information(self, MBOX_OK, "Información", "No se encontraron registros")
|
71
|
+
else
|
72
|
+
# mostrar resultados
|
73
|
+
FXMessageBox.information(self, MBOX_OK, "Información", "Se encontraron #{result.values.length} registros")
|
74
|
+
require_relative 'resultados.rb'
|
75
|
+
vtnresultados = ResultadosConsulta.new(@app, result.values)
|
76
|
+
vtnresultados.create
|
77
|
+
vtnresultados.show(PLACEMENT_SCREEN)
|
78
|
+
end
|
79
|
+
end
|
80
|
+
rescue PG::Error => e
|
81
|
+
puts e.message
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
@btncancel.connect(SEL_COMMAND) do
|
87
|
+
clear_input_fields
|
88
|
+
end
|
89
|
+
|
90
|
+
def clear_input_fields
|
91
|
+
@input_apellidos.text = ""
|
92
|
+
@input_nombres.text = ""
|
93
|
+
@input_cedula.text = ""
|
94
|
+
@input_fecha_desde.text = ""
|
95
|
+
@input_fecha_hasta.text = ""
|
96
|
+
@input_sacramento.text = ""
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
def create
|
101
|
+
super
|
102
|
+
show(PLACEMENT_SCREEN)
|
103
|
+
end
|
104
|
+
end
|
@@ -0,0 +1,84 @@
|
|
1
|
+
require 'pg'
|
2
|
+
require 'fox16'
|
3
|
+
include Fox
|
4
|
+
|
5
|
+
$conn = PG.connect(host: 'localhost', port: '5432', dbname: 'sacramentos', user: 'postgres', password: 'postgres')
|
6
|
+
# Comprobar conexión con la base de datos
|
7
|
+
if $conn.status != PG::CONNECTION_OK
|
8
|
+
puts "Error de conexión con la base de datos"
|
9
|
+
exit
|
10
|
+
end
|
11
|
+
|
12
|
+
class Home < FXMainWindow
|
13
|
+
def initialize(app)
|
14
|
+
# El fondo de la pantalla es de tono gris
|
15
|
+
super(app, "Parroquia San Judas Tadeo", :width => 700, :height => 400)
|
16
|
+
@app = app
|
17
|
+
|
18
|
+
# create label
|
19
|
+
@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)
|
20
|
+
# create label
|
21
|
+
@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)
|
22
|
+
|
23
|
+
#create label
|
24
|
+
@date = Time.now.strftime("%d/%m/%Y %H:%M:%S")
|
25
|
+
@lbldate = FXLabel.new(self, "Fecha: #{@date}", :opts => LAYOUT_EXPLICIT|JUSTIFY_RIGHT, :width => 680, :height => 20, :x => 0, :y => 60)
|
26
|
+
#section lista
|
27
|
+
@lblbautizo = FXLabel.new(self, "Ingresar Bautizo", :opts => LAYOUT_EXPLICIT, :width => 150, :height => 20, :x => 10, :y => 150)
|
28
|
+
@btnbautizo = FXButton.new(self, "Ingresar", :opts => LAYOUT_EXPLICIT|BUTTON_NORMAL, :width => 150,:height => 20, :x => 170, :y => 150)
|
29
|
+
@lblconfirmacion = FXLabel.new(self, "Ingresar Confirmacion", :opts => LAYOUT_EXPLICIT, :width => 150, :height => 20, :x => 10, :y => 180)
|
30
|
+
@btnconfirmacion = FXButton.new(self, "Ingresar", :opts => LAYOUT_EXPLICIT|BUTTON_NORMAL, :width => 150,:height => 20, :x => 170, :y => 180)
|
31
|
+
@lblmatrimonio = FXLabel.new(self, "Ingresar Matrimonio", :opts => LAYOUT_EXPLICIT, :width => 150, :height => 20, :x => 10, :y => 210)
|
32
|
+
@btnmatrimonio = FXButton.new(self, "Ingresar", :opts => LAYOUT_EXPLICIT|BUTTON_NORMAL, :width => 150,:height => 20, :x => 170, :y => 210)
|
33
|
+
@lblconsulta = FXLabel.new(self, "Realizar una consulta", :opts => LAYOUT_EXPLICIT, :width => 150, :height => 20, :x => 10, :y => 240)
|
34
|
+
@btnconsulta = FXButton.new(self, "Consultar", :opts => LAYOUT_EXPLICIT|BUTTON_NORMAL, :width => 150,:height => 20, :x => 170, :y => 240)
|
35
|
+
|
36
|
+
#section buttons executions
|
37
|
+
@btnbautizo.connect(SEL_COMMAND) do
|
38
|
+
require_relative 'bautizo.rb'
|
39
|
+
vtnbautizo = Bautizo.new(@app)
|
40
|
+
vtnbautizo.create
|
41
|
+
vtnbautizo.show(PLACEMENT_SCREEN)
|
42
|
+
end
|
43
|
+
@btnconfirmacion.connect(SEL_COMMAND) do
|
44
|
+
require_relative 'confirmacion.rb'
|
45
|
+
vtnconfirmacion = Confirmacion.new(@app)
|
46
|
+
vtnconfirmacion.create
|
47
|
+
vtnconfirmacion.show(PLACEMENT_SCREEN)
|
48
|
+
end
|
49
|
+
@btnmatrimonio.connect(SEL_COMMAND) do
|
50
|
+
require_relative 'matrimonio.rb'
|
51
|
+
vtnmatrimonio = Matrimonio.new(@app)
|
52
|
+
vtnmatrimonio.create
|
53
|
+
vtnmatrimonio.show(PLACEMENT_SCREEN)
|
54
|
+
end
|
55
|
+
@btnconsulta.connect(SEL_COMMAND) do
|
56
|
+
require_relative 'consultas.rb'
|
57
|
+
vtnconsulta = Consulta.new(@app)
|
58
|
+
vtnconsulta.create
|
59
|
+
vtnconsulta.show(PLACEMENT_SCREEN)
|
60
|
+
end
|
61
|
+
|
62
|
+
# Fondo de pantalla
|
63
|
+
#icono = FXPNGIcon.new(app, File.open("assets/images/Logo-SJT.png", "rb").read)
|
64
|
+
#fondo = FXLabel.new(self, "", :opts => LAYOUT_EXPLICIT, :width => 700, :height => 400, :x => 0, :y => 0)
|
65
|
+
#fondo.icon = icono
|
66
|
+
#fondo.iconPosition = ICON_BEFORE_TEXT
|
67
|
+
#fondo.layoutHints = LAYOUT_CENTER_X|LAYOUT_CENTER_Y
|
68
|
+
#fondo.backColor = FXRGB(255,255,255)
|
69
|
+
|
70
|
+
|
71
|
+
end
|
72
|
+
|
73
|
+
def create
|
74
|
+
super
|
75
|
+
show(PLACEMENT_SCREEN)
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
app = FXApp.new
|
80
|
+
vtnhome = Home.new(app)
|
81
|
+
app.create
|
82
|
+
app.run
|
83
|
+
|
84
|
+
|