Commit inicial: fuentes MBS ERP (Genero 6) + .gitignore + docs/SETUP_PC_MBS.md
This commit is contained in:
@@ -0,0 +1,187 @@
|
||||
{
|
||||
PROGRAMA : noprmt044.4gl
|
||||
DESARROLLADO POR: ING. JUAN SOTO
|
||||
OBJETIVO : Impresion Carnets Empleados
|
||||
FECHA DESARROLLO: Agosto 9, 2021
|
||||
}
|
||||
GLOBALS
|
||||
"noprgb000.4gl"
|
||||
DEFINE ubicacionhtml STRING,
|
||||
direccion_suc,telefono_suc VARCHAR(100),
|
||||
cuenta_desde,cuenta_hasta INT,
|
||||
tipo_cardnet VARCHAR(60)
|
||||
|
||||
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 noprrp044()
|
||||
END MAIN
|
||||
FUNCTION noprrp044()
|
||||
DEFINE foto BYTE,
|
||||
tmpfile STRING
|
||||
|
||||
OPEN WINDOW w1 WITH FORM "nofmrp044"
|
||||
|
||||
INPUT BY NAME tipo_cardnet
|
||||
AFTER INPUT
|
||||
IF int_flag THEN
|
||||
LET int_flag = FALSE
|
||||
EXIT PROGRAM
|
||||
END IF
|
||||
EXIT INPUT
|
||||
END INPUT
|
||||
IF tipo_cardnet = 'EMPLEADOS' THEN
|
||||
CONSTRUCT criterio ON a.departamento,a.num_emp,a.nom1_emp,a.apell1_emp
|
||||
FROM departamento,num_emp,nom1_emp,apell1_emp
|
||||
BEFORE CONSTRUCT
|
||||
CALL departamentos()
|
||||
AFTER CONSTRUCT
|
||||
IF int_flag THEN
|
||||
LET int_flag = FALSE
|
||||
RETURN
|
||||
END IF
|
||||
EXIT CONSTRUCT
|
||||
END CONSTRUCT
|
||||
LET SELEC = "SELECT a.nom1_emp,a.apell1_emp,a.num_emp,a.cedula,b.nom_puesto,a.foto_empleado
|
||||
FROM adtb00003 a LEFT OUTER JOIN sucursales c ON c.sucid = a.sucid,adtb00004 b WHERE ",criterio CLIPPED," and a.cod_puesto = b.cod_puesto ",
|
||||
" AND a.status_t IS NULL "
|
||||
|
||||
PREPARE comando FROM selec
|
||||
DECLARE buscar CURSOR FOR comando
|
||||
|
||||
LET idx = 1
|
||||
LET r_filename = 'noprrp044.4rp'
|
||||
LET ubicacionhtml="https://shop.marmotech.com.do"
|
||||
LET tmpfile = '.\\TMP\\tmpfoto.jpg'
|
||||
LOCATE foto IN MEMORY
|
||||
FOREACH buscar INTO datos_cheque.nom1_emp,datos_cheque.apell1_emp,datos_cheque.num_emp,
|
||||
datos_cheque.cedula,puesto.nom_puesto,foto
|
||||
|
||||
IF idx = 1 THEN
|
||||
IF fgl_report_loadCurrentSettings(r_filename) THEN -- load the .4rp file
|
||||
LET preview=1
|
||||
LET r_output = 'SVG'
|
||||
|
||||
|
||||
CALL fgl_report_selectDevice(r_output) -- changing default
|
||||
CALL fgl_report_selectPreview(preview) -- changing default
|
||||
CALL fgl_report_setPrinterSides("two-sided-short-edge")
|
||||
|
||||
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
|
||||
IF foto IS NOT NULL THEN
|
||||
CALL foto.writeFile(tmpfile)
|
||||
ELSE
|
||||
LET tmpfile='.\\TMP\\fotodefault.jpg'
|
||||
END IF
|
||||
OUTPUT TO REPORT reporte(tmpfile)
|
||||
END FOREACH
|
||||
IF idx > 1 THEN
|
||||
FINISH REPORT reporte
|
||||
END IF
|
||||
ELSE
|
||||
CALL generacardnet()
|
||||
END IF
|
||||
CLOSE WINDOW w1
|
||||
|
||||
END FUNCTION
|
||||
|
||||
REPORT reporte(xtmpfile)
|
||||
DEFINE xtmpfile STRING
|
||||
FORMAT
|
||||
ON EVERY ROW
|
||||
#DISPLAY "ubicacion ",ubicacionhtml
|
||||
IF direccion_suc IS NOT NULL THEN
|
||||
LET p_companias.direccion = direccion_suc
|
||||
ELSE
|
||||
SELECT c.direccion,c.telefono INTO p_companias.direccion,p_companias.telefono
|
||||
FROM sucursales c WHERE sucid = 1
|
||||
END IF
|
||||
|
||||
PRINTX datos_cheque.nom1_emp,datos_cheque.apell1_emp,datos_cheque.num_emp,
|
||||
p_companias.direccion,p_Companias.telefono,datos_cheque.cedula,
|
||||
puesto.nom_puesto,xtmpfile
|
||||
END REPORT
|
||||
FUNCTION generacardnet()
|
||||
DEFINE etiqueta VARCHAR(100),
|
||||
ubicacion VARCHAR(30)
|
||||
INPUT BY NAME cuenta_desde,cuenta_hasta,ubicacion,etiqueta
|
||||
AFTER INPUT
|
||||
IF int_flag THEN
|
||||
EXIT INPUT
|
||||
END IF
|
||||
IF cuenta_desde IS NULL THEN
|
||||
CALL msg(16)
|
||||
NEXT FIELD cuenta_Desde
|
||||
END IF
|
||||
IF cuenta_hasta IS NULL THEN
|
||||
CALL msg(16)
|
||||
NEXT FIELD cuenta_hasta
|
||||
END IF
|
||||
IF etiqueta IS NULL THEN
|
||||
CALL msg(16)
|
||||
NEXT FIELD etiqueta
|
||||
END IF
|
||||
IF ubicacion IS NULL THEN
|
||||
CALL msg(16)
|
||||
NEXT FIELD ubicacion
|
||||
END IF
|
||||
IF cuenta_hasta < cuenta_desde THEN
|
||||
CALL msg(1012)
|
||||
NEXT FIELD cuenta_desde
|
||||
END IF
|
||||
IF ubicacion = 'DCM' THEN
|
||||
SELECT c.direccion,c.telefono INTO p_companias.direccion,p_companias.telefono
|
||||
FROM sucursales c WHERE sucid = 2
|
||||
|
||||
ELSE
|
||||
SELECT c.direccion,c.telefono INTO p_companias.direccion,p_companias.telefono
|
||||
FROM sucursales c WHERE sucid = 1
|
||||
|
||||
END IF
|
||||
LET idx = 1
|
||||
LET r_filename = 'noprrp044_1.4rp'
|
||||
LET ubicacionhtml="https://shop.marmotech.com.do"
|
||||
|
||||
IF fgl_report_loadCurrentSettings(r_filename) THEN -- load the .4rp file
|
||||
LET preview=1
|
||||
LET r_output = 'SVG'
|
||||
|
||||
|
||||
CALL fgl_report_selectDevice(r_output) -- changing default
|
||||
CALL fgl_report_selectPreview(preview) -- changing default
|
||||
CALL fgl_report_setPrinterSides("two-sided-short-edge")
|
||||
|
||||
LET handler = fgl_report_commitCurrentSettings() -- commit changes
|
||||
END IF
|
||||
|
||||
IF handler IS NOT NULL THEN -- report engine was configured ok
|
||||
START REPORT reporte1 TO XML HANDLER handler
|
||||
END IF
|
||||
|
||||
FOR idx = 1 TO cuenta_hasta
|
||||
OUTPUT TO REPORT reporte1(idx,etiqueta)
|
||||
END FOR
|
||||
FINISH REPORT reporte1
|
||||
EXIT INPUT
|
||||
END INPUT
|
||||
END FUNCTION
|
||||
REPORT reporte1(xidx,xetiqueta)
|
||||
DEFINE xidx INT,
|
||||
xetiqueta VARCHAR(100)
|
||||
|
||||
FORMAT
|
||||
ON EVERY ROW
|
||||
|
||||
PRINTX xidx,xetiqueta,p_companias.nombre,p_companias.telefono,p_companias.direccion
|
||||
END REPORT
|
||||
Reference in New Issue
Block a user