Files
DECOMARMOL/PROYECTO/sedir/seprmt001.4gl
T
2026-09-22 20:38:51 -04:00

115 lines
3.1 KiB
Plaintext

{
================================================================
PROGRAMA : SEPRMT001
OBJETIVO : ADMINISTRACION PERFILES USUARIOS
FECHA DESARROLLO : ABRIL 3, 2009
PROGRAMADOR : ING. JUAN SOTO
================================================================
}
DATABASE decomarmol
MAIN
DEFER INTERRUPT
CALL seprmt001()
END MAIN
FUNCTION seprmt001()
DEFINE cprograma ui.combobox
DEFINE arr_perfiles DYNAMIC ARRAY OF RECORD
acodigo INT,
pperfil CHAR(30),
psistema CHAR(20)
END RECORD,
idx,curr SMALLINT
DEFINE datos RECORD
pcodigo INT,
pdescripcion CHAR(30)
END RECORD,
psistema CHAR(40),
numero_msg int
DEFINE arr_programa DYNAMIC ARRAY OF RECORD
pprograma CHAR(20),
descrip_cion_prog CHAR(40)
END RECORD
OPEN FORM f1 FROM "sefmmt001"
DISPLAY FORM f1
DECLARE busca CURSOR FOR
SELECT UNIQUE a.cod_perfil,a.descripcion,a.sistema FROM seg0005 a
ORDER BY a.cod_perfil
LET idx = 1
FOREACH busca INTO arr_perfiles[idx].*
LET idx = idx + 1
END FOREACH
DIALOG ATTRIBUTES (UNBUFFERED, FIELD ORDER FORM)
DISPLAY ARRAY arr_perfiles TO tb3.*
AFTER DISPLAY
LET curr = arr_curr()
LET datos.pcodigo = arr_perfiles[curr].acodigo
LET datos.pdescripcion = arr_perfiles[curr].pperfil
SELECT a.desc_sistema INTO psistema FROM dstb00003 a,seg0005 b
WHERE a.cod_sistema = b.sistema
ON ACTION close
EXIT DIALOG
END DISPLAY
INPUT BY NAME datos.*
BEFORE INPUT
DISPLAY BY NAME psistema
ON ACTION close
EXIT DIALOG
END INPUT
INPUT ARRAY arr_programa FROM sprograma.* ATTRIBUTE(WITHOUT DEFAULTS)
{BEFORE ROW
LET curr = arr_curr()
LET cprograma = ui.combobox.forname("formonly.pprograma")
CALL fprograma(cprograma)
}
AFTER FIELD pprograma
IF arr_programa[arr_curr()].pprograma IS NOT NULL THEN
SELECT UNIQUE a.descripcion INTO arr_programa[arr_curr()].descrip_cion_prog
FROM dstb00001 a
WHERE a.programa = arr_programa[arr_curr()].pprograma
IF STATUS = NOTFOUND THEN
LET numero_msg = 3
CALL msg(numero_msg)
NEXT FIELD pprograma
END IF
DISPLAY arr_programa[arr_curr()].descrip_cion_prog TO sprograma[scr_line()].descripcion_prog
END IF
ON ACTION close
EXIT DIALOG
END INPUT
END DIALOG
# INSERTA INFORAMACION
DELETE FROM seg0005 WHERE cod_perfil = datos.pcodigo
FOR idx =1 TO arr_count()
IF arr_programa[idx].pprograma IS NOT NULL THEN
INSERT INTO seg0005 (cod_pefil,programa,sistema,descripcion) VALUES
(datos.pcodigo,arr_programa[idx].pprograma)
END IF
END FOR
END FUNCTION
FUNCTION fprograma(cprograma)
DEFINE cprograma ui.combobox
DEFINE kprograma CHAR(10),kdescripcion CHAR(10)
DECLARE busca_p CURSOR FOR
SELECT a.programa,a.descripcion FROM dstb00001 a,seg0005 b
WHERE a.cod_sistema = b.sistema
CALL cprograma.clear()
FOREACH busca_p INTO kprograma,kdescripcion
CALL cprograma.additem(kprograma,kdescripcion)
END FOREACH
END FUNCTION