Code: Select all
**********************************
*MOVIMIENTO DE ARTICULOS POR MESES
**********************************
function fMovMeses()
Local cQry
Local cDato := "CORP012"
TEXT INTO cQry
SELECT mes,SUM(entradas) AS entradas,SUM(salidas) AS salidas FROM (
SELECT MONTH(MOV.o_fechas) AS mes,SUM(MOV.o_cansal) AS salidas,SUM(MOV.o_canent) AS entradas
FROM tbl_movi MOV WHERE MOV.o_articu='cDato' GROUP BY MONTH(MOV.o_fechas)
UNION
SELECT MONTH(FAC.mm_fechas) AS mes,SUM(FAC.mm_cansal) AS salidas,SUM(FAC.mm_canent) AS entradas
FROM tbl_mofa FAC WHERE FAC.mm_articu='cDato' GROUP BY MONTH(FAC.mm_fechas)
) MOV GROUP BY mes;
ENDTEXT
memoedit(cQry)
Return nil
De antemano gracias