Commit inicial: fuentes MBS ERP (Genero 6) + .gitignore + docs/SETUP_PC_MBS.md
This commit is contained in:
@@ -0,0 +1,396 @@
|
||||
{
|
||||
-------------------------------------------------------------------------------
|
||||
PROGRAMA : COPRRP001
|
||||
OBJETIVO : CATALOGO DE SUPLIDORES
|
||||
PROGRAMADOR : JUAN SOTO
|
||||
FECHA REALIZACION : AGOSTO 1997
|
||||
DIRECTOR PROYECTO : JOSE ALFREDO PAULINO ALEJO
|
||||
-------------------------------------------------------------------------------
|
||||
}
|
||||
GLOBALS "coprgb000.4gl"
|
||||
MAIN
|
||||
DEFER INTERRUPT
|
||||
CALL ARG_VAL(1) RETURNING usuarios
|
||||
CALL ARG_VAL(2) RETURNING clave
|
||||
CALL ARG_VAL(3) RETURNING impresor
|
||||
|
||||
CONNECT TO "smarmotech" USER usuarios USING clave
|
||||
SELECT a.* INTO p_companias.* FROM companias a
|
||||
|
||||
CALL coprrp001()
|
||||
END MAIN
|
||||
|
||||
FUNCTION coprrp001()
|
||||
|
||||
#### Registro que almacena la informacion requerida
|
||||
DEFINE listado RECORD
|
||||
cod_sp LIKE cotb00001.cod_sp,
|
||||
cod_sp_sec LIKE cotb00001.cod_sp_sec,
|
||||
nom_sp LIKE cotb00001.nom_sp,
|
||||
dir_sp LIKE cotb00001.dir_sp,
|
||||
area_sp LIKE cotb00001.area_sp,
|
||||
tel_sp LIKE cotb00001.tel_sp,
|
||||
fax_sp LIKE cotb00001.fax_sp,
|
||||
cont_sp LIKE cotb00001.cont_sp,
|
||||
descrip_term LIKE cotb00024.descrip_term
|
||||
END RECORD
|
||||
|
||||
DEFINE
|
||||
r_filename STRING,
|
||||
preview INT
|
||||
|
||||
# WHENEVER ERROR CONTINUE
|
||||
|
||||
OPTIONS FORM LINE 8, ERROR LINE 23, COMMENT LINE 21
|
||||
|
||||
CLEAR SCREEN
|
||||
|
||||
##### Abriendo el formulario para captura de datos de la condicion de busqueda
|
||||
|
||||
OPEN FORM cofmrp001 FROM "cofmrp001"
|
||||
DISPLAY FORM cofmrp001
|
||||
|
||||
LET tipo_papel = 2
|
||||
CALL msgrp000(tipo_papel)
|
||||
|
||||
##### Entrando el valor por el cual se ordenara la salida
|
||||
|
||||
INPUT BY NAME decide
|
||||
AFTER FIELD decide
|
||||
IF decide IS NULL THEN
|
||||
LET numero_msg = 16
|
||||
CALL msg(numero_msg)
|
||||
NEXT FIELD decide
|
||||
END IF
|
||||
END INPUT
|
||||
|
||||
IF int_flag THEN
|
||||
LET numero_msg = 2
|
||||
CALL msg(numero_msg)
|
||||
LET int_flag = FALSE
|
||||
RETURN
|
||||
END IF
|
||||
|
||||
CONSTRUCT criterio
|
||||
ON a.cod_sp, a.cod_sp_sec, a.nom_sp
|
||||
FROM cod_sp, cod_sp_sec, nom_sp
|
||||
|
||||
IF int_flag THEN
|
||||
LET numero_msg = 2
|
||||
CALL msg(numero_msg)
|
||||
LET int_flag = FALSE
|
||||
RETURN
|
||||
END IF
|
||||
|
||||
##### Selecionando la informacion ordenado alfabeticamente
|
||||
IF decide = "A" THEN
|
||||
LET SELEC =
|
||||
"SELECT a.cod_sp,a.cod_sp_sec,a.nom_sp,a.dir_sp,a.area_sp,a.tel_sp, ",
|
||||
" a.fax_sp,a.cont_sp,b.descrip_term ",
|
||||
"FROM cotb00001 a, OUTER cotb00024 b ",
|
||||
"WHERE a.term_sp = b.term_sp AND a.status_t is null AND ",
|
||||
criterio CLIPPED,
|
||||
" ORDER BY a.cod_sp,a.cod_sp_sec"
|
||||
|
||||
ELSE
|
||||
##### Selecionando la informacion ordenado numericamente
|
||||
|
||||
LET SELEC =
|
||||
"SELECT a.cod_sp,a.cod_sp_sec,a.nom_sp,a.dir_sp,a.area_sp,a.tel_sp, ",
|
||||
" a.fax_sp,a.cont_sp,b.descrip_term ",
|
||||
"FROM cotb00001 a, OUTER cotb00024 b ",
|
||||
"WHERE a.term_sp = b.term_sp AND a.status_t is null AND ",
|
||||
criterio CLIPPED,
|
||||
" ORDER BY a.cod_sp,a.cod_sp_sec"
|
||||
END IF
|
||||
|
||||
IF int_flag THEN
|
||||
LET numero_msg = 2
|
||||
CALL msg(numero_msg)
|
||||
LET int_flag = FALSE
|
||||
RETURN
|
||||
END IF
|
||||
|
||||
DISPLAY "Buscando Informacion ... Espere Por Favor"
|
||||
AT 19, 14
|
||||
ATTRIBUTE(REVERSE, BOLD)
|
||||
|
||||
PREPARE busca FROM selec
|
||||
|
||||
IF int_flag THEN
|
||||
LET numero_msg = 2
|
||||
CALL msg(numero_msg)
|
||||
LET int_flag = FALSE
|
||||
RETURN
|
||||
END IF
|
||||
|
||||
DECLARE accion CURSOR FOR busca
|
||||
|
||||
DISPLAY " " AT 19, 14
|
||||
DISPLAY "<< Reporte Generandose ... Por Favor Espere. >>"
|
||||
AT 19, 14
|
||||
ATTRIBUTE(REVERSE)
|
||||
CALL defecto(
|
||||
usuarios, clave, impresor)
|
||||
RETURNING imprime,
|
||||
negrilla_on,
|
||||
negrillas_of,
|
||||
doble_on,
|
||||
doble_off,
|
||||
comp_on,
|
||||
comp_off,
|
||||
doce,
|
||||
normal,
|
||||
archivo,
|
||||
copia
|
||||
|
||||
LET r_filename = 'coprrp001.4rp'
|
||||
CALL seleccionarSalida() RETURNING r_output
|
||||
|
||||
LET preview = 1
|
||||
|
||||
IF fgl_report_loadCurrentSettings(r_filename) THEN -- load the .4rp file
|
||||
|
||||
CALL fgl_report_selectDevice(r_output) -- changing default
|
||||
CALL fgl_report_selectPreview(preview) -- changing default
|
||||
|
||||
|
||||
LET handler = fgl_report_commitCurrentSettings() -- commit changes
|
||||
END IF
|
||||
|
||||
START REPORT catalogo2 TO XML HANDLER handler
|
||||
#### Enviando la informacion al registro del reporte
|
||||
|
||||
FOREACH accion INTO listado.*
|
||||
|
||||
IF int_flag THEN
|
||||
LET numero_msg = 2
|
||||
CALL msg(numero_msg)
|
||||
LET int_flag = FALSE
|
||||
RETURN
|
||||
END IF
|
||||
|
||||
IF status = NOTFOUND THEN
|
||||
EXIT FOREACH
|
||||
ELSE
|
||||
OUTPUT TO REPORT catalogo2(listado.*)
|
||||
END IF
|
||||
END FOREACH
|
||||
FINISH REPORT catalogo2
|
||||
|
||||
#RUN imprime
|
||||
END FUNCTION
|
||||
|
||||
##### Funcion que genera el reporte
|
||||
REPORT catalogo(x)
|
||||
DEFINE x RECORD
|
||||
cod_sp LIKE cotb00001.cod_sp,
|
||||
cod_sp_sec LIKE cotb00001.cod_sp_sec,
|
||||
nom_sp LIKE cotb00001.nom_sp,
|
||||
dir_sp LIKE cotb00001.dir_sp,
|
||||
area_sp LIKE cotb00001.area_sp,
|
||||
tel_sp LIKE cotb00001.tel_sp,
|
||||
fax_sp LIKE cotb00001.fax_sp,
|
||||
cont_sp LIKE cotb00001.cont_sp,
|
||||
descrip_term LIKE cotb00024.descrip_term
|
||||
END RECORD
|
||||
|
||||
DEFINE doble_on CHAR(2)
|
||||
DEFINE doble_off CHAR(2)
|
||||
DEFINE negrillas_on CHAR(2)
|
||||
DEFINE negrillas_off CHAR(2)
|
||||
DEFINE comp_on CHAR(2)
|
||||
DEFINE comp_off CHAR(2)
|
||||
DEFINE doce CHAR(2)
|
||||
DEFINE hora CHAR(5)
|
||||
DEFINE l SMALLINT
|
||||
DEFINE varia CHAR(10)
|
||||
|
||||
OUTPUT
|
||||
TOP MARGIN 0
|
||||
LEFT MARGIN 0
|
||||
BOTTOM MARGIN 0
|
||||
PAGE LENGTH 100
|
||||
|
||||
FORMAT
|
||||
PAGE HEADER
|
||||
{ LET doble_on = ASCII 14
|
||||
LET doble_off = ASCII 20
|
||||
LET negrillas_on = ASCII 27, ASCII 69
|
||||
LET negrillas_off = ASCII 27, ASCII 70
|
||||
LET comp_on = ASCII 15
|
||||
LET comp_off = ASCII 18
|
||||
LET doce = ASCII 27, ASCII 77
|
||||
}
|
||||
LET hora = TIME
|
||||
IF decide = "N" THEN
|
||||
LET varia = "*Numerico*"
|
||||
ELSE
|
||||
LET varia = "Alfabetico"
|
||||
END IF
|
||||
LET l = (215 - LENGTH(p_companias.nombre)) / 2
|
||||
|
||||
PRINT COLUMN 1, comp_on, negrillas_on
|
||||
PRINT COLUMN 1,
|
||||
"coprrp001",
|
||||
COLUMN l,
|
||||
p_companias.nombre CLIPPED,
|
||||
COLUMN 208,
|
||||
"Pag. ",
|
||||
PAGENO USING "<<<"
|
||||
PRINT COLUMN 99,
|
||||
"Sistema de Compras",
|
||||
COLUMN 208,
|
||||
TODAY USING "dd/mm/yy"
|
||||
PRINT COLUMN 1,
|
||||
COLUMN 97,
|
||||
"Catalogo de Suplidores",
|
||||
COLUMN 211,
|
||||
hora
|
||||
LET l = (215 - LENGTH(varia)) / 2
|
||||
PRINT COLUMN L, varia
|
||||
|
||||
PRINT COLUMN 1,
|
||||
"----------------------------------------------------",
|
||||
"----------------------------------------------------",
|
||||
"----------------------------------------------------",
|
||||
"----------------------------------------------------",
|
||||
"-------"
|
||||
|
||||
PRINT COLUMN 113, "Codigo"
|
||||
|
||||
PRINT COLUMN 2,
|
||||
"Codigo",
|
||||
COLUMN 15,
|
||||
"Nombre Suplidor",
|
||||
COLUMN 49,
|
||||
"Direccion",
|
||||
COLUMN 114,
|
||||
"Area",
|
||||
COLUMN 121,
|
||||
"Telefono",
|
||||
COLUMN 132,
|
||||
"Fax",
|
||||
COLUMN 143,
|
||||
"Persona de Contacto",
|
||||
COLUMN 177,
|
||||
"Terminos de Pago"
|
||||
|
||||
PRINT COLUMN 1,
|
||||
"----------------------------------------------------",
|
||||
"----------------------------------------------------",
|
||||
"----------------------------------------------------",
|
||||
"----------------------------------------------------",
|
||||
"-------"
|
||||
|
||||
PRINT negrillas_off
|
||||
BEFORE GROUP OF x.cod_sp
|
||||
SKIP 1 LINE
|
||||
LET idx = 0
|
||||
|
||||
ON EVERY ROW
|
||||
PRINT COLUMN 2,
|
||||
x.cod_sp USING "&&",
|
||||
"-",
|
||||
COLUMN 5,
|
||||
x.cod_sp_sec USING "&&&&",
|
||||
COLUMN 15,
|
||||
x.nom_sp,
|
||||
COLUMN 49,
|
||||
x.dir_sp,
|
||||
COLUMN 114,
|
||||
x.area_sp,
|
||||
COLUMN 121,
|
||||
x.tel_sp,
|
||||
COLUMN 132,
|
||||
x.fax_sp,
|
||||
COLUMN 143,
|
||||
x.cont_sp,
|
||||
COLUMN 177,
|
||||
x.descrip_term
|
||||
LET idx = idx + 1
|
||||
|
||||
AFTER GROUP OF x.cod_sp
|
||||
SKIP 1 LINE
|
||||
IF x.cod_sp = 10 THEN
|
||||
PRINT COLUMN 2, "Total Suplidores LOCALES .... ", idx
|
||||
ELSE
|
||||
PRINT COLUMN 2, "Total Suplidores del EXTRANJERO... ", idx
|
||||
END IF
|
||||
ON LAST ROW
|
||||
PRINT ASCII 18
|
||||
|
||||
{ ON LAST ROW
|
||||
SKIP 1 LINE
|
||||
PRINT COLUMN 2, "Total de Registros Impresos = ", count(*) USING "####"
|
||||
PRINT COLUMN 2, ASCII 27, ASCII 80
|
||||
PRINT COLUMN 1, "====================================================",
|
||||
"====================================================",
|
||||
"====================================================",
|
||||
"====================================================",
|
||||
"=======" }
|
||||
END REPORT
|
||||
|
||||
REPORT catalogo2(x)
|
||||
DEFINE x RECORD
|
||||
cod_sp LIKE cotb00001.cod_sp,
|
||||
cod_sp_sec LIKE cotb00001.cod_sp_sec,
|
||||
nom_sp LIKE cotb00001.nom_sp,
|
||||
dir_sp LIKE cotb00001.dir_sp,
|
||||
area_sp LIKE cotb00001.area_sp,
|
||||
tel_sp LIKE cotb00001.tel_sp,
|
||||
fax_sp LIKE cotb00001.fax_sp,
|
||||
cont_sp LIKE cotb00001.cont_sp,
|
||||
descrip_term LIKE cotb00024.descrip_term
|
||||
END RECORD
|
||||
|
||||
DEFINE total_suplidores,tipo_reporte,total_registros STRING
|
||||
DEFINE codigo_sp STRING
|
||||
|
||||
DEFINE l SMALLINT
|
||||
DEFINE varia CHAR(10)
|
||||
|
||||
FORMAT
|
||||
PAGE HEADER
|
||||
|
||||
BEFORE GROUP OF x.cod_sp
|
||||
IF decide = "N" THEN
|
||||
LET varia = "*Numerico*"
|
||||
ELSE
|
||||
LET varia = "Alfabetico"
|
||||
END IF
|
||||
LET tipo_reporte = varia
|
||||
|
||||
PRINTX tipo_reporte
|
||||
|
||||
LET idx = 0
|
||||
|
||||
ON EVERY ROW
|
||||
LET codigo_sp = x.cod_sp CLIPPED,"-",x.cod_sp_sec CLIPPED
|
||||
|
||||
PRINTX codigo_sp,
|
||||
x.nom_sp,
|
||||
x.dir_sp,
|
||||
x.area_sp,
|
||||
x.tel_sp,
|
||||
x.fax_sp,
|
||||
x.cont_sp,
|
||||
x.descrip_term
|
||||
LET idx = idx + 1
|
||||
|
||||
AFTER GROUP OF x.cod_sp
|
||||
IF x.cod_sp = 10 THEN
|
||||
LET total_suplidores =
|
||||
"Total Suplidores LOCALES .... ", idx
|
||||
ELSE
|
||||
LET total_suplidores =
|
||||
"Total Suplidores del EXTRANJERO... ", idx
|
||||
END IF
|
||||
|
||||
PRINTX total_suplidores
|
||||
ON LAST ROW
|
||||
|
||||
LET total_registros =
|
||||
"Total de Registros Impresos = ", COUNT(*) USING "####"
|
||||
PRINTX total_registros
|
||||
END REPORT
|
||||
Reference in New Issue
Block a user