Commit inicial: fuentes MBS ERP (Genero 6) + .gitignore + docs/SETUP_PC_MBS.md
This commit is contained in:
@@ -0,0 +1,232 @@
|
||||
{
|
||||
------------------------------------------------------------------
|
||||
PROGRAMA : NOPRRP039
|
||||
OBJETIVO : REPORTE EMPLEADOS
|
||||
PROGRAMADOR : Ing. JUAN SOTO
|
||||
FECHA REALIZACION : Abril, 20 2010
|
||||
------------------------------------------------------------------
|
||||
}
|
||||
IMPORT os
|
||||
GLOBALS "noprgb000.4gl"
|
||||
|
||||
DEFINE handler om.SaxDocumentHandler, -- return value from fgl_report_commitCurrentSettings()
|
||||
r_filename STRING, -- filename of Report Design Document including .4rp extension
|
||||
r_output STRING, -- output format option
|
||||
preview INTEGER -- TRUE/FALSE, to set preview option
|
||||
DEFINE chempleados,salario,fotos STRING,
|
||||
pano1,pano2 SMALLINT,
|
||||
vacaciones CHAR(2),
|
||||
anovacacion SMALLINT,
|
||||
foto_empleado BYTE
|
||||
|
||||
MAIN
|
||||
DEFER INTERRUPT
|
||||
CALL ARG_VAL(1) RETURNING usuarios
|
||||
CALL ARG_VAL(2) RETURNING clave
|
||||
|
||||
CONNECT to "smarmotech" USER usuarios USING clave
|
||||
SELECT a.* INTO p_companias.* FROM companias a
|
||||
CALL noprrp039()
|
||||
END MAIN
|
||||
FUNCTION noprrp039()
|
||||
DEFINE tipoEmpleados SMALLINT
|
||||
|
||||
OPEN WINDOW w1 WITH FORM "nofmrp039"
|
||||
CONSTRUCT BY NAME criterio ON a.num_emp,a.cod_puesto,a.departamento,a.nomina,a.nom1_emp,a.apell1_emp,
|
||||
a.fech_efec,a.fecha_salida,a.fech_nac
|
||||
BEFORE CONSTRUCT
|
||||
LET kpuesto = ui.ComboBox.forName("formonly.cod_puesto")
|
||||
CALL puestos()
|
||||
CALL departamentos()
|
||||
AFTER CONSTRUCT
|
||||
IF int_flag THEN
|
||||
CALL msg(2)
|
||||
LET int_flag = FALSE
|
||||
EXIT PROGRAM
|
||||
END IF
|
||||
END CONSTRUCT
|
||||
LET chempleados = NULL
|
||||
INPUT BY NAME tipoEmpleados,salario,fotos, anovacacion,pano1,pano2
|
||||
IF tipoEmpleados = 9 THEN
|
||||
LET chEmpleados = "TODOS LOS EMPLEADOS"
|
||||
IF fotos = "SI" THEN
|
||||
LET selec =
|
||||
"SELECT a.num_emp,a.departamento,a.cod_puesto,",
|
||||
" a.nom1_emp,a.apell1_emp,a.apell2_emp,a.calle,a.casa_num,CONVERT(CHAR(10),a.fech_efec,103), ",
|
||||
" a.cedula,a.sueldo_ac,a.fech_nac,a.foto_empleado ",
|
||||
" FROM adtb00003 a WHERE ",criterio CLIPPED, " AND and a.fech_efec IS NOT NULL
|
||||
AND a.foto_empleado IS NOT NULL
|
||||
ORDER BY a.departamento,a.num_emp "
|
||||
ELSE
|
||||
LET selec =
|
||||
"SELECT a.num_emp,a.departamento,a.cod_puesto,",
|
||||
" a.nom1_emp,a.apell1_emp,a.apell2_emp,a.calle,a.casa_num,CONVERT(CHAR(10),a.fech_efec,103), ",
|
||||
" a.cedula,a.sueldo_ac,a.fech_nac,a.foto_empleado ",
|
||||
" FROM adtb00003 a WHERE ",criterio CLIPPED, " AND and a.fech_efec IS NOT NULL
|
||||
AND a.foto_empleado IS NULL
|
||||
ORDER BY a.departamento,a.num_emp "
|
||||
END IF
|
||||
IF fotos = "TODOS" THEN
|
||||
LET selec =
|
||||
"SELECT a.num_emp,a.departamento,a.cod_puesto,",
|
||||
" a.nom1_emp,a.apell1_emp,a.apell2_emp,a.calle,a.casa_num,CONVERT(CHAR(10),a.fech_efec,103), ",
|
||||
" a.cedula,a.sueldo_ac,a.fech_nac,a.foto_empleado ",
|
||||
" FROM adtb00003 a WHERE ",criterio CLIPPED, " AND and a.fech_efec IS NOT NULL
|
||||
AND a.foto_empleado IS NOT NULL
|
||||
ORDER BY a.departamento,a.num_emp "
|
||||
END IF
|
||||
END IF
|
||||
IF tipoEmpleados = 0 THEN
|
||||
LET chEmpleados = "EMPLEADOS ACTIVOS"
|
||||
LET selec =
|
||||
"SELECT a.num_emp,a.departamento,a.cod_puesto,",
|
||||
" a.nom1_emp,a.apell1_emp,a.apell2_emp,a.calle,a.casa_num,CONVERT(CHAR(10),a.fech_efec,103), ",
|
||||
" a.cedula,a.sueldo_ac,a.fech_nac,a.foto_empleado ",
|
||||
" FROM adtb00003 a WHERE ",criterio CLIPPED,
|
||||
" AND (a.status_t is null or a.status_t = 'I') and a.fech_efec IS NOT NULL ",
|
||||
" ORDER BY a.departamento,a.num_emp "
|
||||
END IF
|
||||
|
||||
IF tipoEmpleados = 1 THEN
|
||||
LET chEmpleados = "EMPLEADOS DESACTIVOS"
|
||||
LET selec =
|
||||
"SELECT a.num_emp,a.departamento,a.cod_puesto,",
|
||||
" a.nom1_emp,a.apell1_emp,a.apell2_emp,a.calle,a.casa_num,CONVERT(CHAR(10),a.fech_efec,103),",
|
||||
" a.cedula,a.sueldo_ac,a.fech_nac,a.foto_empleado ",
|
||||
" FROM adtb00003 a WHERE ",criterio CLIPPED,
|
||||
" AND a.status_t is not null and a.fech_efec IS NOT NULL",
|
||||
" ORDER BY a.departamento,a.num_emp "
|
||||
|
||||
END IF
|
||||
IF int_flag THEN
|
||||
CALL msg(2)
|
||||
LET int_flag = FALSE
|
||||
EXIT PROGRAM
|
||||
END IF
|
||||
|
||||
PREPARE comando FROM selec
|
||||
DECLARE busca_emp CURSOR FOR comando
|
||||
|
||||
-- configure report engine; the functions prefixed fgl that are called here are part of the GRW API
|
||||
LET r_filename = 'noprrp039.4rp'
|
||||
LET idx =1
|
||||
|
||||
LOCATE foto_empleado IN MEMORY
|
||||
FOREACH busca_emp INTO emplea.num_emp,emplea.departamento,emplea.cod_puesto,
|
||||
emplea.nom1_emp,emplea.apell1_emp,emplea.apell2_emp,
|
||||
emplea.calle,emplea.casa_num,emplea.fech_efec,
|
||||
emplea.cedula,emplea.sueldo_ac,emplea.fech_nac,
|
||||
foto_empleado
|
||||
|
||||
{ IF foto_empleado IS NOT NULL THEN
|
||||
LET emplea.url_foto = ".\\IMAGENES\\EMPLEADOS\\",emplea.num_emp USING "&&&&&&",".jpg"
|
||||
|
||||
CALL foto_empleado.writeFile(emplea.url_foto)
|
||||
# DISPLAY url_files TO fotos
|
||||
ELSE
|
||||
LET emplea.url_foto = ".\\IMAGENES\\EMPLEADOS\\NOIMAGEN.PNG"
|
||||
END IF
|
||||
}
|
||||
IF foto_Empleado IS NOT NULL THEN
|
||||
LET emplea.url_foto = ".\\IMAGENES\\EMPLEADOS\\",emplea.num_emp USING "&&&&&&",".jpg"
|
||||
DISPLAY "TRATE DE GUARDAR: ",emplea.url_foto
|
||||
CALL foto_empleado.writeFile(emplea.url_foto)
|
||||
ELSE
|
||||
LET emplea.url_foto = ".\\IMAGENES\\EMPLEADOS\\NOIMAGEN.PNG"
|
||||
END IF
|
||||
LET foto_empleado = NULL
|
||||
IF os.Path.exists(emplea.url_foto) THEN
|
||||
ELSE
|
||||
LET emplea.url_foto = ".\\IMAGENES\\EMPLEADOS\\NOIMAGEN.PNG"
|
||||
END IF
|
||||
|
||||
#CALL fgl_winmessage("imagen",emplea.foto_empleado,"stop")
|
||||
IF idx = 1 THEN
|
||||
IF fgl_report_loadCurrentSettings(r_filename) THEN -- load the .4rp file
|
||||
CALL seleccionarSalida() RETURNING r_output
|
||||
|
||||
|
||||
LET preview=1
|
||||
CALL fgl_report_selectDevice(r_output) -- changing default
|
||||
CALL fgl_report_selectPreview(preview) -- changing default
|
||||
CALL fgl_report_configurexlsxdevice(null,null,null,false,false,null,1)
|
||||
LET handler = fgl_report_commitCurrentSettings() -- commit changes
|
||||
END IF
|
||||
IF handler IS NOT NULL THEN -- report engine was configured ok
|
||||
|
||||
START REPORT reporte TO XML HANDLER handler
|
||||
END IF
|
||||
END IF
|
||||
LET idx = idx +1
|
||||
LET vacaciones=NULL
|
||||
IF anovacacion IS NOT NULL THEN
|
||||
#VERIFICA QUE EL EMPLEADO SE LE PAGO LA PROPORCION VACIONES
|
||||
SELECT DISTINCT a.num_emp FROM notb00008 a WHERE a.num_emp = emplea.num_emp AND a.cod_mov = 36 AND YEAR(a.fecha) = anovacacion
|
||||
IF STATUS != NOTFOUND THEN
|
||||
LET vacaciones = "SI"
|
||||
ELSE
|
||||
LET vacaciones = "NO"
|
||||
END IF
|
||||
END IF
|
||||
|
||||
IF salario = "NO SUELDO" THEN
|
||||
LET emplea.sueldo_ac =0
|
||||
END IF
|
||||
|
||||
IF pano1 > 0 AND pano2 > 0 THEN
|
||||
LET tiempo = (today-emplea.fech_efec)/365
|
||||
IF tiempo > pano1 AND tiempo < pano2 THEN
|
||||
|
||||
OUTPUT TO REPORT reporte (emplea.*,tiempo)
|
||||
END IF
|
||||
ELSE
|
||||
|
||||
OUTPUT TO REPORT reporte (emplea.*,tiempo)
|
||||
END IF
|
||||
END FOREACH
|
||||
IF idx > 1 THEN
|
||||
CALL fgl_winmessage("REPORTE","REPORTE TERMINADO","STOP")
|
||||
|
||||
FINISH REPORT reporte
|
||||
ELSE
|
||||
CALL fgl_winmessage("ERROR","NO EXISTEN REGISTROS CON ESTA CONDCION","STOP")
|
||||
|
||||
END IF
|
||||
CLOSE WINDOW w1
|
||||
END FUNCTION
|
||||
REPORT reporte(x,xtiempo)
|
||||
DEFINE nombre_depto,nombre_puesto VARCHAR(30),
|
||||
x RECORD LIKE adtb00003.*,
|
||||
total_empleados,total_empleados_g INT,
|
||||
xtiempo SMALLINT,
|
||||
chfechnac,chfechent VARCHAR(10)
|
||||
# ORDER BY x.departamento
|
||||
FORMAT
|
||||
BEFORE GROUP OF x.departamento
|
||||
LET nombre_depto = NULL
|
||||
SELECT a.nom_dpto INTO nombre_depto FROM adtb00001 a
|
||||
WHERE a.departamento = x.departamento
|
||||
|
||||
LET total_empleados = 0
|
||||
|
||||
ON EVERY ROW
|
||||
SELECT a.nom_puesto INTO nombre_puesto FROM adtb00004 a
|
||||
WHERE a.cod_puesto = x.cod_puesto
|
||||
IF x.fech_nac IS NULL THEN
|
||||
LET chfechnac='NO TIENE'
|
||||
ELSE
|
||||
LET chfechnac = x.fech_nac USING 'dd/mm/yyyy'
|
||||
END IF
|
||||
IF x.fech_efec IS NULL THEN
|
||||
LET chfechent='NO TIENE'
|
||||
ELSE
|
||||
LET chfechent = x.fech_efec USING 'dd/mm/yyyy'
|
||||
END IF
|
||||
DISPLAY "tmpfile ",x.url_foto
|
||||
LET total_empleados = total_empleados + 1
|
||||
PRINTX x.*,p_companias.nombre,nombre_depto,nombre_puesto,chempleados,
|
||||
total_empleados,xtiempo,chfechnac,chfechent,vacaciones
|
||||
ON LAST ROW
|
||||
LET total_empleados_g = COUNT(*)
|
||||
PRINTX total_empleados_g
|
||||
END REPORT
|
||||
Reference in New Issue
Block a user