VARIAVEL Z_AAMM = right( str(year(date()),4), 2) + strzero( month(date()) ,2) 
VARIAVEL Z_FATF = "" 
VARIAVEL Z_FORN = 0 
VARIAVEL Z_DE = CTOD( "01."+SUBSTR(DTOC(S_DATUAL),4) ) 
VARIAVEL Z_ATE = S_DATUAL 
T10,10,18,60,Parametros 
T2,2,Ano e Mes (AaMm) ..:,4,z_aamm,9999 
T3,2,Fornecedor ........:,3,z_forn,999 
T4,2,Data Inicial ......:,10,Z_DE,99.99.9999 
T5,2,Data Final ........:,10,Z_ATE,99.99.9999 
 
COMANDO ANTES DbGoBottom() 
COMANDO DEPOIS Z_FATF = "FATF"+Z_AAMM 
 
ARQUIVO (z_FATF) "temp0101" pffor 
OUTROARQ SCCPFOR 
 
FILTRO (Z_FORN=0 .OR. Z_FORN=PFFOR) .AND. (PFDATACHE>=Z_DE .AND. PFDATACHE<=Z_ATE) 
 
COMANDO DURANTE SCCPFOR->( DbGoto( Z_fatf->pffor )) 
COMANDO DURANTE Z_FANT = SCCPFOR->cp_fantasi 
VARIAVEL Z_TPFVAL = 0 
VARIAVEL Z_TPFTOTICMS = 0 
VARIAVEL Z_TPFVALRET = 0 
VARIAVEL Z_TNF = 0 
VARIAVEL Z_STRFORN = IF( Z_FORN=0, "Todos", STR(Z_FORN,4) ) 
COMANDO DURANTE Z_TPFVAL = Z_TPFVAL + PFVAL 
COMANDO DURANTE Z_TPFTOTICMS = Z_TPFTOTICMS + PFTOTICMS 
COMANDO DURANTE Z_TPFVALRET = Z_TPFVALRET + PFVALRET 
COMANDO DURANTE Z_TNF = Z_TNF + 1 
 
*COMANDO DURANTE Z_INDFORN = ASCAN( ZV_FORN, {|X| X[1]=ZFATF->PFFOR} ) 
*COMANDO DURANTE ZV_FORN[Z_INDFORN][2] = ZV_FORN[Z_INDFORN] + PFVAL 
CRelacao de Notas Fiscais de Entrada, Emitida em [s_datual] as [time()]         Pag [pag 999] 
C*** Fornecedor: [Z_STRFORN]    Periodo de Chegada: [D_DE] ate [D_ATE] 
C[repl("-",132)] 
CPedido Forn                N.F.         Valor  DtCheg   %Icm   Val_Icm Dp CFO     Icm_Ret  DtEmis   Dv 
*999999 999-xxxxxYYYYYxxxxx 9999999 999,999.99 99% 99,999.99 99 99,999.99 DD.MM.AA dd.mm.aa 99 
C[repl("=",132)] 
D[PFNUMPED 999999] [PFFOR 999]-[Z_FANT] [PFNUM 9999999] [PFVAL 999,999.99] [pfdatache] [PFTAXAICMS 99]% [PFTOTICMS 99,999.99] [PFNUMDUP 99] [PFCODOP] [PFVALRET 999,999.99] [PFDATAemi] [PFDIVISAO 99] 
ULTPAG [repl("-",132)] 
ULTPAG *** Totais com [Z_TNF 999] lancamentos:[z_tpfval 99,999,999.99]            [z_tpftoticms 99,999,999.99]      [z_tpfvalret 99,999,999.99] 