252 lines
8.0 KiB
Plaintext
252 lines
8.0 KiB
Plaintext
{
|
|
================================================================
|
|
PROGRAMA :ACPRRP010
|
|
OBJETIVO :IMPRIMIR LAS ETIQUETAS DE LOS ACTIVOS EN MASA
|
|
FECHA :AGOSTO 20,2010
|
|
}
|
|
|
|
GLOBALS
|
|
"acprgb000.4gl"
|
|
|
|
DEFINE codigo_dp INT,
|
|
descripcion_dp CHAR(50),
|
|
inventario string,
|
|
kcantidad DEC(12,4)
|
|
|
|
|
|
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 acprrp010()
|
|
END MAIN
|
|
|
|
FUNCTION acprrp010()
|
|
DEFINE codigo_act INT,
|
|
descripcion_act char(50),
|
|
fecha_compra DATE,
|
|
precio DEC(12,2),
|
|
moneda SMALLINT,
|
|
simbolo CHAR(4),
|
|
codigo CHAR(25),
|
|
pcodn,pcodgrupo,pcodtipo,pcodsec,valor SMALLINT,
|
|
cantidad,lado1,lado2,lado3,valor_medida DEC(12,4),
|
|
punidadmed CHAR(3),
|
|
|
|
despiece DYNAMIC ARRAY OF RECORD
|
|
imp CHAR(3),
|
|
codigo CHAR(25),
|
|
descripcion CHAR(50),
|
|
unidad CHAR(4),
|
|
cantidad DEC(12,4),
|
|
lado1 DEC(12,4),
|
|
lado2 DEC(12,4),
|
|
lado3 DEC(12,4),
|
|
medida DEC(12,4)
|
|
END RECORD
|
|
|
|
DEFINE handler om.SaxDocumentHandler, -- return value from fgl_report_commitCurrentSettings()
|
|
salida,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
|
|
|
|
OPEN WINDOW w1 AT 10,1 WITH FORM "acfmrp010"
|
|
INPUT BY NAME inventario,salida,moneda,valor,lado1,lado2,lado3,cantidad
|
|
AFTER INPUT
|
|
IF Int_flag THEN
|
|
LET int_flag = FALSE
|
|
CALL msg(2)
|
|
RETURN
|
|
END IF
|
|
|
|
EXIT INPUT
|
|
END INPUT
|
|
|
|
IF inventario = "ACTIVOS FIJOS" THEN
|
|
CONSTRUCT criterio ON a.codigo,a.descripcion,a.departamento
|
|
FROM codigo_act,descripcion_act,codigo_dp
|
|
END IF
|
|
IF inventario = "PRODUCTOS TERMINADOS" THEN
|
|
CONSTRUCT criterio ON a.cod_n,a.cod_grupo,a.cod_tipo,a.cod_sec,
|
|
a.descrip_esp
|
|
FROM cod_n,cod_grupo,cod_tipo,cod_Sec,descripcion_act
|
|
END IF
|
|
IF inventario = "ACTIVOS FIJOS" THEN
|
|
|
|
LET selec = "SELECT a.codigo,a.descripcion,a.departamento,b.nom_dpto,",
|
|
"CONVERT(CHAR(10),a.fech_compra,103) ",
|
|
" FROM actb00001 a,adtb00001 b ",
|
|
" WHERE a.status_t IS NULL AND ",criterio CLIPPED,
|
|
" AND a.departamento = b.departamento "
|
|
|
|
END IF
|
|
IF inventario = "PRODUCTOS TERMINADOS" THEN
|
|
IF valor = 1 THEN
|
|
LET selec =
|
|
" SELECT a.codid,a.descrip_esp,'1','NO TIENE','01/01/2001',b.precio,c.simbolo, ",
|
|
" a.cod_n,a.cod_grupo,a.cod_tipo,a.cod_Sec,a.unidad_med ",
|
|
"FROM iptb00002 a,vetb00025 b,vetb00061 c ",
|
|
"WHERE a.status_t IS NULL AND ",criterio clipped," and ",
|
|
"a.cod_n = b.cod_n AND a.cod_grupo = b.cod_grupo and ",
|
|
"a.cod_tipo = b.cod_tipo and a.cod_Sec = b.cod_Sec and ",
|
|
"b.ventas = ",moneda," and b.ventas = c.ventas ",
|
|
"ORDER BY a.codid"
|
|
ELSE
|
|
LET selec =
|
|
" SELECT a.codid,a.descrip_esp,'1','NO TIENE','01/01/2001','0','NO', ",
|
|
" a.cod_n,a.cod_grupo,a.cod_tipo,a.cod_Sec,a.unidad_med ",
|
|
"FROM iptb00002 a ",
|
|
"WHERE a.status_t IS NULL AND ",criterio clipped,
|
|
" ORDER BY a.codid"
|
|
|
|
END IF
|
|
|
|
END IF
|
|
|
|
PREPARE comando FROM selec
|
|
DECLARE busca CURSOR FOR comando
|
|
|
|
LET idx = 1
|
|
FOREACH busca INTO codigo_act,descripcion_act,codigo_dp,
|
|
descripcion_dp ,fecha_compra,
|
|
precio,simbolo,pcodn,pcodgrupo,pcodtipo,pcodsec,
|
|
punidadmed
|
|
|
|
LET codigo = pcodn USING "<<<<","-",pcodgrupo USING "<<<&","-",
|
|
pcodtipo USING "<<<&","-",pcodsec USING "<<<<"
|
|
|
|
LET despiece[idx].imp = 'NO'
|
|
LET despiece[idx].codigo = codigo
|
|
LET despiece[idx].descripcion = descripcion_act
|
|
LET despiece[idx].unidad = punidadmed
|
|
LET despiece[idx].cantidad = cantidad
|
|
LET idx = idx + 1
|
|
END FOREACH
|
|
CALL set_count(idx-1)
|
|
|
|
INPUT ARRAY despiece WITHOUT DEFAULTS FROM smedida.*
|
|
AFTER FIELD lado3
|
|
LET idx = arr_curr()
|
|
IF despiece[idx].unidad= "M2" THEN
|
|
LET despiece[idx].medida =
|
|
despiece[idx].cantidad * (despiece[idx].lado1 * despiece[idx].lado2)
|
|
END IF
|
|
|
|
IF despiece[idx].unidad= "M3" THEN
|
|
LET despiece[idx].medida =
|
|
despiece[idx].cantidad * (despiece[idx].lado1 * despiece[idx].lado2 * despiece[idx].lado3)
|
|
END IF
|
|
|
|
IF despiece[idx].unidad= "ML" THEN
|
|
LET despiece[idx].medida =
|
|
despiece[idx].cantidad * despiece[idx].lado1
|
|
LET despiece[idx].lado2 = 0
|
|
END IF
|
|
|
|
IF despiece[idx].unidad= "UD" OR despiece[idx].unidad= "GL" THEN
|
|
LET despiece[idx].medida = despiece[idx].cantidad
|
|
END IF
|
|
|
|
|
|
AFTER INPUT
|
|
|
|
IF int_flag THEN
|
|
LET int_flag = FALSE
|
|
CALL Msg(2)
|
|
RETURN
|
|
END IF
|
|
LET idx = arr_curr()
|
|
IF despiece[idx].imp='SI' THEN
|
|
IF despiece[idx].medida IS NULL and despiece[idx].cantidad IS NULL THEN
|
|
IF despiece[idx].codigo IS NOT NULL THEN
|
|
CALL fgl_winmessage("ERROR","NO PUEDES DEJAR LA CANTIDAD Y MEDIDA EN BLANCO, EN PRODUCTO SELECCIONADO","STOP")
|
|
NEXT FIELD cantidad
|
|
END IF
|
|
END IF
|
|
END IF
|
|
EXIT INPUT
|
|
END INPUT
|
|
LET r_filename = salida
|
|
IF fgl_report_loadCurrentSettings(r_filename) THEN -- load the .4rp file
|
|
LET r_output='SVG'
|
|
LET preview=1
|
|
CALL fgl_report_selectDevice(r_output) -- changing default
|
|
CALL fgl_report_selectPreview(preview) -- changing default
|
|
LET handler = fgl_report_commitCurrentSettings() -- commit changes
|
|
END IF
|
|
-- report engine was configured ok
|
|
|
|
|
|
IF handler IS NOT NULL THEN
|
|
START REPORT activos TO "dummy"
|
|
FOR idx = 1 TO arr_count()
|
|
IF despiece[idx].imp='SI' THEN
|
|
IF despiece[idx].medida IS NULL THEN
|
|
LET despiece[idx].medida = despiece[idx].cantidad
|
|
END IF
|
|
LET kcantidad = despiece[idx].medida
|
|
OUTPUT TO REPORT activos(codigo_act,despiece[idx].descripcion,fecha_compra,precio,simbolo,
|
|
despiece[idx].codigo,despiece[idx].unidad, despiece[idx].cantidad,
|
|
despiece[idx].lado1,despiece[idx].lado2,despiece[idx].lado3,despiece[idx].medida)
|
|
END IF
|
|
END FOR
|
|
|
|
FINISH REPORT activos
|
|
END IF
|
|
|
|
|
|
END FUNCTION
|
|
|
|
REPORT activos(x,descripcion,xfecha_compra,xprecio,xsimbolo,xcodigo,xunidadmed,
|
|
xcantidad,xlado1,xlado2,xlado3,xvalor_medida)
|
|
DEFINE x INT,
|
|
fecha,xfecha_compra DATE,
|
|
barcodigo_act CHAR(128),
|
|
descripcion CHAR(50),
|
|
xprecio DEC(12,2),
|
|
xsimbolo CHAR(4),
|
|
xcodigo CHAR(25),
|
|
xunidadmed CHAR(3),
|
|
xcantidad,xlado1,xlado2,xlado3,xvalor_medida DEC(12,4)
|
|
ORDER BY x
|
|
|
|
FORMAT
|
|
FIRST PAGE HEADER
|
|
LET fecha = TODAY
|
|
BEFORE GROUP OF x
|
|
|
|
#ON EVERY ROW
|
|
LET barcodigo_act = "STARTB",codigo_128(x)
|
|
|
|
|
|
PRINTX x,codigo_dp,descripcion,descripcion_dp,fecha,barcodigo_act,
|
|
Xfecha_compra,xprecio,xsimbolo,xcodigo,xvalor_medida,xcantidad,
|
|
xlado1,xlado2,xlado3,xunidadmed
|
|
END REPORT
|
|
|
|
FUNCTION codigo_128(cod_val)
|
|
|
|
DEFINE cod_val,x INTEGER,
|
|
aux_str,barcode STRING
|
|
|
|
LET aux_str=cod_val USING "<<<<<<&"
|
|
|
|
LET barcode=""
|
|
|
|
FOR x=1 TO LENGTH(aux_str)
|
|
LET barcode=barcode,",",aux_str.getCharAt(x)
|
|
END FOR
|
|
IF inventario = "ACTIVOS FIJOS" THEN
|
|
LET barcode=barcode CLIPPED,",+,1"
|
|
ELSE
|
|
LET barcode=barcode CLIPPED,",+,",kcantidad using "<<<<<<"
|
|
END IF
|
|
|
|
RETURN barcode
|
|
|
|
END FUNCTION |